UNPKG

@emergentmethods/asknews-typescript-sdk

Version:
85 lines (76 loc) 2.83 kB
/* 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 { AskNewsSource } from './AskNewsSource'; import { instanceOfAskNewsSource, AskNewsSourceFromJSON, AskNewsSourceFromJSONTyped, AskNewsSourceToJSON, } from './AskNewsSource'; import type { BlueskySource } from './BlueskySource'; import { instanceOfBlueskySource, BlueskySourceFromJSON, BlueskySourceFromJSONTyped, BlueskySourceToJSON, } from './BlueskySource'; import type { TelegramSource } from './TelegramSource'; import { instanceOfTelegramSource, TelegramSourceFromJSON, TelegramSourceFromJSONTyped, TelegramSourceToJSON, } from './TelegramSource'; /** * @type SourcesInner * * @export */ export type SourcesInner = { identifier: 'asknews' } & AskNewsSource | { identifier: 'bluesky' } & BlueskySource | { identifier: 'telegram' } & TelegramSource; export function SourcesInnerFromJSON(json: any): SourcesInner { return SourcesInnerFromJSONTyped(json, false); } export function SourcesInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): SourcesInner { if (json == null) { return json; } switch (json['identifier']) { case 'asknews': return Object.assign({}, AskNewsSourceFromJSONTyped(json, true), { identifier: 'asknews' } as const); case 'bluesky': return Object.assign({}, BlueskySourceFromJSONTyped(json, true), { identifier: 'bluesky' } as const); case 'telegram': return Object.assign({}, TelegramSourceFromJSONTyped(json, true), { identifier: 'telegram' } as const); default: throw new Error(`No variant of SourcesInner exists with 'identifier=${json['identifier']}'`); } } export function SourcesInnerToJSON(json: any): any { return SourcesInnerToJSONTyped(json, false); } export function SourcesInnerToJSONTyped(value?: SourcesInner | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } switch (value['identifier']) { case 'asknews': return Object.assign({}, AskNewsSourceToJSON(value), { identifier: 'asknews' } as const); case 'bluesky': return Object.assign({}, BlueskySourceToJSON(value), { identifier: 'bluesky' } as const); case 'telegram': return Object.assign({}, TelegramSourceToJSON(value), { identifier: 'telegram' } as const); default: throw new Error(`No variant of SourcesInner exists with 'identifier=${value['identifier']}'`); } }