UNPKG

@emergentmethods/asknews-typescript-sdk

Version:
74 lines (65 loc) 2.43 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 type { OrganizationProfile } from './OrganizationProfile'; import { instanceOfOrganizationProfile, OrganizationProfileFromJSON, OrganizationProfileFromJSONTyped, OrganizationProfileToJSON, } from './OrganizationProfile'; import type { UserProfile } from './UserProfile'; import { instanceOfUserProfile, UserProfileFromJSON, UserProfileFromJSONTyped, UserProfileToJSON, } from './UserProfile'; /** * @type Profile * * @export */ export type Profile = { identityType: 'organization' } & OrganizationProfile | { identityType: 'user' } & UserProfile; export function ProfileFromJSON(json: any): Profile { return ProfileFromJSONTyped(json, false); } export function ProfileFromJSONTyped(json: any, ignoreDiscriminator: boolean): Profile { if (json == null) { return json; } switch (json['identity_type']) { case 'organization': return Object.assign({}, OrganizationProfileFromJSONTyped(json, true), { identityType: 'organization' } as const); case 'user': return Object.assign({}, UserProfileFromJSONTyped(json, true), { identityType: 'user' } as const); default: throw new Error(`No variant of Profile exists with 'identityType=${json['identityType']}'`); } } export function ProfileToJSON(json: any): any { return ProfileToJSONTyped(json, false); } export function ProfileToJSONTyped(value?: Profile | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } switch (value['identityType']) { case 'organization': return Object.assign({}, OrganizationProfileToJSON(value), { identityType: 'organization' } as const); case 'user': return Object.assign({}, UserProfileToJSON(value), { identityType: 'user' } as const); default: throw new Error(`No variant of Profile exists with 'identityType=${value['identityType']}'`); } }