@emergentmethods/asknews-typescript-sdk
Version:
Typescript SDK for AskNews API
55 lines (54 loc) • 2.16 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* AskNews API
* AskNews API
*
* The version of the OpenAPI document: 0.18.6
* 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 { EmailActionFromJSONTyped, EmailActionToJSON, } from './EmailAction';
import { GoogleDocsActionFromJSONTyped, GoogleDocsActionToJSON, } from './GoogleDocsAction';
import { ResendBroadcastActionFromJSONTyped, ResendBroadcastActionToJSON, } from './ResendBroadcastAction';
import { WebhookActionFromJSONTyped, WebhookActionToJSON, } from './WebhookAction';
export function TriggersInnerFromJSON(json) {
return TriggersInnerFromJSONTyped(json, false);
}
export function TriggersInnerFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
switch (json['action']) {
case 'email':
return Object.assign({}, EmailActionFromJSONTyped(json, true), { action: 'email' });
case 'google_docs':
return Object.assign({}, GoogleDocsActionFromJSONTyped(json, true), { action: 'google_docs' });
case 'resend_broadcast':
return Object.assign({}, ResendBroadcastActionFromJSONTyped(json, true), { action: 'resend_broadcast' });
case 'webhook':
return Object.assign({}, WebhookActionFromJSONTyped(json, true), { action: 'webhook' });
default:
throw new Error(`No variant of TriggersInner exists with 'action=${json['action']}'`);
}
}
export function TriggersInnerToJSON(value) {
if (value == null) {
return value;
}
switch (value['action']) {
case 'email':
return EmailActionToJSON(value);
case 'google_docs':
return GoogleDocsActionToJSON(value);
case 'resend_broadcast':
return ResendBroadcastActionToJSON(value);
case 'webhook':
return WebhookActionToJSON(value);
default:
throw new Error(`No variant of TriggersInner exists with 'action=${value['action']}'`);
}
}