diff --git a/src/CasparCG.ts b/src/CasparCG.ts index 72d5e4fa..eb9dd449 100644 --- a/src/CasparCG.ts +++ b/src/CasparCG.ts @@ -82,6 +82,7 @@ import { PingParameters, BeginParameters, CommitParameters, + DiscardParameters, } from './parameters' export class CasparCG extends BasicCasparCGAPI { @@ -575,5 +576,11 @@ export class CasparCG extends BasicCasparCGAPI { params, }) } + async discard(params: DiscardParameters = {}): Promise> { + return this.executeCommand({ + command: Commands.Discard, + params, + }) + } } export type APIRequest = SendResult> diff --git a/src/commands.ts b/src/commands.ts index 09067d58..d68920cf 100755 --- a/src/commands.ts +++ b/src/commands.ts @@ -92,6 +92,7 @@ import { BeginParameters, CommitParameters, PingParameters, + DiscardParameters, } from './parameters' export enum Commands { @@ -182,6 +183,7 @@ export enum Commands { Ping = 'PING', Begin = 'BEGIN', Commit = 'COMMIT', + Discard = 'DISCARD', } export interface Command { @@ -298,6 +300,7 @@ export interface AllTypedCommands { [Commands.Ping]: TypedResponseCommand [Commands.Begin]: TypedResponseCommand [Commands.Commit]: TypedResponseCommand + [Commands.Discard]: TypedResponseCommand } export type LoadbgCommand = AllTypedCommands[Commands.Loadbg]['command'] @@ -387,6 +390,7 @@ export type RestartCommand = AllTypedCommands[Commands.Restart]['command'] export type PingCommand = AllTypedCommands[Commands.Ping]['command'] export type BeginCommand = AllTypedCommands[Commands.Begin]['command'] export type CommitCommand = AllTypedCommands[Commands.Commit]['command'] +export type DiscardCommand = AllTypedCommands[Commands.Discard]['command'] export type AMCPCommand = | LoadbgCommand @@ -476,3 +480,4 @@ export type AMCPCommand = | PingCommand | BeginCommand | CommitCommand + | DiscardCommand diff --git a/src/parameters.ts b/src/parameters.ts index d8d451e0..dfa7e3f9 100644 --- a/src/parameters.ts +++ b/src/parameters.ts @@ -528,3 +528,4 @@ export type RestartParameters = Empty export type PingParameters = Empty export type BeginParameters = Empty export type CommitParameters = Empty +export type DiscardParameters = Empty diff --git a/src/serializers.ts b/src/serializers.ts index 3e8a4a98..8f062561 100755 --- a/src/serializers.ts +++ b/src/serializers.ts @@ -464,6 +464,10 @@ export const serializers: Readonly> = { [Commands.Bye]: [commandNameSerializer], [Commands.Kill]: [commandNameSerializer], [Commands.Restart]: [commandNameSerializer], + [Commands.Ping]: [commandNameSerializer], + [Commands.Begin]: [commandNameSerializer], + [Commands.Commit]: [commandNameSerializer], + [Commands.Discard]: [commandNameSerializer], } export const serializersV21: Readonly> = {