Integration.ts•2.46 kB
/* tslint:disable */
/* eslint-disable */
/**
* Squad API
* API for managing Squad resources
*
* The version of the OpenAPI document: 4.0.0
* Contact: help@meetsquad.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 { NotionIntegration } from './NotionIntegration.js';
import {
instanceOfNotionIntegration,
NotionIntegrationFromJSON,
NotionIntegrationFromJSONTyped,
NotionIntegrationToJSON,
} from './NotionIntegration.js';
import type { TypeformIntegration } from './TypeformIntegration.js';
import {
instanceOfTypeformIntegration,
TypeformIntegrationFromJSON,
TypeformIntegrationFromJSONTyped,
TypeformIntegrationToJSON,
} from './TypeformIntegration.js';
/**
* @type Integration
* Integration record
* @export
*/
export type Integration = { integrationId: 'NOTION' } & NotionIntegration | { integrationId: 'TYPEFORM' } & TypeformIntegration;
export function IntegrationFromJSON(json: any): Integration {
return IntegrationFromJSONTyped(json, false);
}
export function IntegrationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Integration {
if (json == null) {
return json;
}
switch (json['integrationId']) {
case 'NOTION':
return Object.assign({}, NotionIntegrationFromJSONTyped(json, true), { integrationId: 'NOTION' } as const);
case 'TYPEFORM':
return Object.assign({}, TypeformIntegrationFromJSONTyped(json, true), { integrationId: 'TYPEFORM' } as const);
default:
throw new Error(`No variant of Integration exists with 'integrationId=${json['integrationId']}'`);
}
}
export function IntegrationToJSON(json: any): any {
return IntegrationToJSONTyped(json, false);
}
export function IntegrationToJSONTyped(value?: Integration | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
switch (value['integrationId']) {
case 'NOTION':
return Object.assign({}, NotionIntegrationToJSON(value), { integrationId: 'NOTION' } as const);
case 'TYPEFORM':
return Object.assign({}, TypeformIntegrationToJSON(value), { integrationId: 'TYPEFORM' } as const);
default:
throw new Error(`No variant of Integration exists with 'integrationId=${value['integrationId']}'`);
}
}