@emergentmethods/asknews-typescript-sdk
Version:
Typescript SDK for AskNews API
96 lines (87 loc) • 3.41 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* AskNews API
* AskNews API
*
* The version of the OpenAPI document: 0.19.10
* Contact: contact@emergentmethods.ai
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { EmailAction } from './EmailAction';
import {
instanceOfEmailAction,
EmailActionFromJSON,
EmailActionFromJSONTyped,
EmailActionToJSON,
} from './EmailAction';
import type { GoogleDocsAction } from './GoogleDocsAction';
import {
instanceOfGoogleDocsAction,
GoogleDocsActionFromJSON,
GoogleDocsActionFromJSONTyped,
GoogleDocsActionToJSON,
} from './GoogleDocsAction';
import type { ResendBroadcastAction } from './ResendBroadcastAction';
import {
instanceOfResendBroadcastAction,
ResendBroadcastActionFromJSON,
ResendBroadcastActionFromJSONTyped,
ResendBroadcastActionToJSON,
} from './ResendBroadcastAction';
import type { WebhookAction } from './WebhookAction';
import {
instanceOfWebhookAction,
WebhookActionFromJSON,
WebhookActionFromJSONTyped,
WebhookActionToJSON,
} from './WebhookAction';
/**
* @type TriggersInner
*
* @export
*/
export type TriggersInner = { action: 'email' } & EmailAction | { action: 'google_docs' } & GoogleDocsAction | { action: 'resend_broadcast' } & ResendBroadcastAction | { action: 'webhook' } & WebhookAction;
export function TriggersInnerFromJSON(json: any): TriggersInner {
return TriggersInnerFromJSONTyped(json, false);
}
export function TriggersInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): TriggersInner {
if (json == null) {
return json;
}
switch (json['action']) {
case 'email':
return Object.assign({}, EmailActionFromJSONTyped(json, true), { action: 'email' } as const);
case 'google_docs':
return Object.assign({}, GoogleDocsActionFromJSONTyped(json, true), { action: 'google_docs' } as const);
case 'resend_broadcast':
return Object.assign({}, ResendBroadcastActionFromJSONTyped(json, true), { action: 'resend_broadcast' } as const);
case 'webhook':
return Object.assign({}, WebhookActionFromJSONTyped(json, true), { action: 'webhook' } as const);
default:
throw new Error(`No variant of TriggersInner exists with 'action=${json['action']}'`);
}
}
export function TriggersInnerToJSON(json: any): any {
return TriggersInnerToJSONTyped(json, false);
}
export function TriggersInnerToJSONTyped(value?: TriggersInner | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
switch (value['action']) {
case 'email':
return Object.assign({}, EmailActionToJSON(value), { action: 'email' } as const);
case 'google_docs':
return Object.assign({}, GoogleDocsActionToJSON(value), { action: 'google_docs' } as const);
case 'resend_broadcast':
return Object.assign({}, ResendBroadcastActionToJSON(value), { action: 'resend_broadcast' } as const);
case 'webhook':
return Object.assign({}, WebhookActionToJSON(value), { action: 'webhook' } as const);
default:
throw new Error(`No variant of TriggersInner exists with 'action=${value['action']}'`);
}
}