UNPKG

@emergentmethods/asknews-typescript-sdk

Version:
48 lines (47 loc) 1.8 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 { ServiceAccountProfileFromJSONTyped, ServiceAccountProfileToJSON, } from './ServiceAccountProfile'; import { UserProfileFromJSONTyped, UserProfileToJSON, } from './UserProfile'; export function ProfileFromJSON(json) { return ProfileFromJSONTyped(json, false); } export function ProfileFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } switch (json['identity_type']) { case 'service_account': return Object.assign({}, ServiceAccountProfileFromJSONTyped(json, true), { identityType: 'service_account' }); case 'user': return Object.assign({}, UserProfileFromJSONTyped(json, true), { identityType: 'user' }); default: throw new Error(`No variant of Profile exists with 'identityType=${json['identityType']}'`); } } export function ProfileToJSON(json) { return ProfileToJSONTyped(json, false); } export function ProfileToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } switch (value['identityType']) { case 'service_account': return Object.assign({}, ServiceAccountProfileToJSON(value), { identityType: 'service_account' }); case 'user': return Object.assign({}, UserProfileToJSON(value), { identityType: 'user' }); default: throw new Error(`No variant of Profile exists with 'identityType=${value['identityType']}'`); } }