UNPKG

@emergentmethods/asknews-typescript-sdk

Version:
48 lines (47 loc) 1.9 kB
/* tslint:disable */ /* eslint-disable */ /** * AskNews API * AskNews API [![status](https://status.asknews.app/api/badge/2/status?style=for-the-badge)](https://status.asknews.app/status/prod) * * The version of the OpenAPI document: 0.24.22 * 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 { OrganizationProfileFromJSONTyped, OrganizationProfileToJSON, } from './OrganizationProfile'; 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 'organization': return Object.assign({}, OrganizationProfileFromJSONTyped(json, true), { identityType: 'organization' }); 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 'organization': return Object.assign({}, OrganizationProfileToJSON(value), { identityType: 'organization' }); case 'user': return Object.assign({}, UserProfileToJSON(value), { identityType: 'user' }); default: throw new Error(`No variant of Profile exists with 'identityType=${value['identityType']}'`); } }