@emergentmethods/asknews-typescript-sdk
Version:
Typescript SDK for AskNews API
468 lines (453 loc) • 15.2 kB
text/typescript
/* 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 { mapValues } from '../runtime';
import type { IntraClusterStatistics } from './IntraClusterStatistics';
import {
IntraClusterStatisticsFromJSON,
IntraClusterStatisticsFromJSONTyped,
IntraClusterStatisticsToJSON,
IntraClusterStatisticsToJSONTyped,
} from './IntraClusterStatistics';
import type { Article } from './Article';
import {
ArticleFromJSON,
ArticleFromJSONTyped,
ArticleToJSON,
ArticleToJSONTyped,
} from './Article';
import type { RedditPerspective } from './RedditPerspective';
import {
RedditPerspectiveFromJSON,
RedditPerspectiveFromJSONTyped,
RedditPerspectiveToJSON,
RedditPerspectiveToJSONTyped,
} from './RedditPerspective';
import type { StoryUpdateDisplayImageUrlsInner } from './StoryUpdateDisplayImageUrlsInner';
import {
StoryUpdateDisplayImageUrlsInnerFromJSON,
StoryUpdateDisplayImageUrlsInnerFromJSONTyped,
StoryUpdateDisplayImageUrlsInnerToJSON,
StoryUpdateDisplayImageUrlsInnerToJSONTyped,
} from './StoryUpdateDisplayImageUrlsInner';
import type { AsknewsApiSchemaV1StoriesGraphRelationships } from './AsknewsApiSchemaV1StoriesGraphRelationships';
import {
AsknewsApiSchemaV1StoriesGraphRelationshipsFromJSON,
AsknewsApiSchemaV1StoriesGraphRelationshipsFromJSONTyped,
AsknewsApiSchemaV1StoriesGraphRelationshipsToJSON,
AsknewsApiSchemaV1StoriesGraphRelationshipsToJSONTyped,
} from './AsknewsApiSchemaV1StoriesGraphRelationships';
import type { RedditThread } from './RedditThread';
import {
RedditThreadFromJSON,
RedditThreadFromJSONTyped,
RedditThreadToJSON,
RedditThreadToJSONTyped,
} from './RedditThread';
import type { Entities } from './Entities';
import {
EntitiesFromJSON,
EntitiesFromJSONTyped,
EntitiesToJSON,
EntitiesToJSONTyped,
} from './Entities';
/**
*
* @export
* @interface StoryUpdate
*/
export interface StoryUpdate {
/**
*
* @type {string}
* @memberof StoryUpdate
*/
uuid: string;
/**
*
* @type {Array<Article>}
* @memberof StoryUpdate
*/
clusterArticles: Array<Article>;
/**
*
* @type {Array<Article>}
* @memberof StoryUpdate
*/
promptArticles: Array<Article>;
/**
*
* @type {number}
* @memberof StoryUpdate
*/
nArticles: number;
/**
*
* @type {Entities}
* @memberof StoryUpdate
*/
entities: Entities;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
headline: string;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
story: string;
/**
*
* @type {number}
* @memberof StoryUpdate
*/
storyUpdateTs: number;
/**
*
* @type {{ [key: string]: number; }}
* @memberof StoryUpdate
*/
sourcesUrls: { [key: string]: number; };
/**
*
* @type {{ [key: string]: number; }}
* @memberof StoryUpdate
*/
languagesPct: { [key: string]: number; };
/**
*
* @type {{ [key: string]: number; }}
* @memberof StoryUpdate
*/
countriesPct: { [key: string]: number; };
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
keyTakeaways: Array<string>;
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
contradictions: Array<string>;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
continent: string;
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
people: Array<string>;
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
locations: Array<string>;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
newInformation: string;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
imageUrl: string;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
urlSafeTitle: string;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
storyUuid: string;
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
categories: Array<string>;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
imagePrompt: string;
/**
*
* @type {RedditPerspective}
* @memberof StoryUpdate
*/
redditPerspective: RedditPerspective;
/**
*
* @type {Array<RedditThread>}
* @memberof StoryUpdate
*/
redditThreads: Array<RedditThread>;
/**
*
* @type {{ [key: string]: number; }}
* @memberof StoryUpdate
*/
languages: { [key: string]: number; };
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
keywords: Array<string>;
/**
*
* @type {IntraClusterStatistics}
* @memberof StoryUpdate
*/
intraClusterStatistics: IntraClusterStatistics;
/**
*
* @type {{ [key: string]: any; }}
* @memberof StoryUpdate
*/
silhouetteScore: { [key: string]: any; };
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
articleIds: Array<string>;
/**
*
* @type {{ [key: string]: number; }}
* @memberof StoryUpdate
*/
countries: { [key: string]: number; };
/**
*
* @type {Array<string>}
* @memberof StoryUpdate
*/
markdownCitations: Array<string>;
/**
*
* @type {number}
* @memberof StoryUpdate
*/
confidence?: number;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
provocative?: StoryUpdateProvocativeEnum;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
reportingVoice?: string;
/**
*
* @type {AsknewsApiSchemaV1StoriesGraphRelationships}
* @memberof StoryUpdate
*/
relationships: AsknewsApiSchemaV1StoriesGraphRelationships;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
mermaid: string;
/**
*
* @type {string}
* @memberof StoryUpdate
*/
ccImageUrl: string;
/**
*
* @type {Array<StoryUpdateDisplayImageUrlsInner>}
* @memberof StoryUpdate
*/
displayImageUrls: Array<StoryUpdateDisplayImageUrlsInner>;
/**
*
* @type {number}
* @memberof StoryUpdate
*/
alignment?: number;
}
/**
* @export
*/
export const StoryUpdateProvocativeEnum = {
Unknown: 'unknown',
Low: 'low',
Medium: 'medium',
High: 'high'
} as const;
export type StoryUpdateProvocativeEnum = typeof StoryUpdateProvocativeEnum[keyof typeof StoryUpdateProvocativeEnum];
/**
* Check if a given object implements the StoryUpdate interface.
*/
export function instanceOfStoryUpdate(value: object): value is StoryUpdate {
if (!('uuid' in value) || value['uuid'] === undefined) return false;
if (!('clusterArticles' in value) || value['clusterArticles'] === undefined) return false;
if (!('promptArticles' in value) || value['promptArticles'] === undefined) return false;
if (!('nArticles' in value) || value['nArticles'] === undefined) return false;
if (!('entities' in value) || value['entities'] === undefined) return false;
if (!('headline' in value) || value['headline'] === undefined) return false;
if (!('story' in value) || value['story'] === undefined) return false;
if (!('storyUpdateTs' in value) || value['storyUpdateTs'] === undefined) return false;
if (!('sourcesUrls' in value) || value['sourcesUrls'] === undefined) return false;
if (!('languagesPct' in value) || value['languagesPct'] === undefined) return false;
if (!('countriesPct' in value) || value['countriesPct'] === undefined) return false;
if (!('keyTakeaways' in value) || value['keyTakeaways'] === undefined) return false;
if (!('contradictions' in value) || value['contradictions'] === undefined) return false;
if (!('continent' in value) || value['continent'] === undefined) return false;
if (!('people' in value) || value['people'] === undefined) return false;
if (!('locations' in value) || value['locations'] === undefined) return false;
if (!('newInformation' in value) || value['newInformation'] === undefined) return false;
if (!('imageUrl' in value) || value['imageUrl'] === undefined) return false;
if (!('urlSafeTitle' in value) || value['urlSafeTitle'] === undefined) return false;
if (!('storyUuid' in value) || value['storyUuid'] === undefined) return false;
if (!('categories' in value) || value['categories'] === undefined) return false;
if (!('imagePrompt' in value) || value['imagePrompt'] === undefined) return false;
if (!('redditPerspective' in value) || value['redditPerspective'] === undefined) return false;
if (!('redditThreads' in value) || value['redditThreads'] === undefined) return false;
if (!('languages' in value) || value['languages'] === undefined) return false;
if (!('keywords' in value) || value['keywords'] === undefined) return false;
if (!('intraClusterStatistics' in value) || value['intraClusterStatistics'] === undefined) return false;
if (!('silhouetteScore' in value) || value['silhouetteScore'] === undefined) return false;
if (!('articleIds' in value) || value['articleIds'] === undefined) return false;
if (!('countries' in value) || value['countries'] === undefined) return false;
if (!('markdownCitations' in value) || value['markdownCitations'] === undefined) return false;
if (!('relationships' in value) || value['relationships'] === undefined) return false;
if (!('mermaid' in value) || value['mermaid'] === undefined) return false;
if (!('ccImageUrl' in value) || value['ccImageUrl'] === undefined) return false;
if (!('displayImageUrls' in value) || value['displayImageUrls'] === undefined) return false;
return true;
}
export function StoryUpdateFromJSON(json: any): StoryUpdate {
return StoryUpdateFromJSONTyped(json, false);
}
export function StoryUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): StoryUpdate {
if (json == null) {
return json;
}
return {
'uuid': json['uuid'],
'clusterArticles': ((json['cluster_articles'] as Array<any>).map(ArticleFromJSON)),
'promptArticles': ((json['prompt_articles'] as Array<any>).map(ArticleFromJSON)),
'nArticles': json['n_articles'],
'entities': EntitiesFromJSON(json['entities']),
'headline': json['headline'],
'story': json['story'],
'storyUpdateTs': json['story_update_ts'],
'sourcesUrls': json['sources_urls'],
'languagesPct': json['languages_pct'],
'countriesPct': json['countries_pct'],
'keyTakeaways': json['key_takeaways'],
'contradictions': json['contradictions'],
'continent': json['continent'],
'people': json['people'],
'locations': json['locations'],
'newInformation': json['new_information'],
'imageUrl': json['image_url'],
'urlSafeTitle': json['url_safe_title'],
'storyUuid': json['story_uuid'],
'categories': json['categories'],
'imagePrompt': json['image_prompt'],
'redditPerspective': RedditPerspectiveFromJSON(json['reddit_perspective']),
'redditThreads': ((json['reddit_threads'] as Array<any>).map(RedditThreadFromJSON)),
'languages': json['languages'],
'keywords': json['keywords'],
'intraClusterStatistics': IntraClusterStatisticsFromJSON(json['intra_cluster_statistics']),
'silhouetteScore': json['silhouette_score'],
'articleIds': json['article_ids'],
'countries': json['countries'],
'markdownCitations': json['markdown_citations'],
'confidence': json['confidence'] == null ? undefined : json['confidence'],
'provocative': json['provocative'] == null ? undefined : json['provocative'],
'reportingVoice': json['reporting_voice'] == null ? undefined : json['reporting_voice'],
'relationships': AsknewsApiSchemaV1StoriesGraphRelationshipsFromJSON(json['relationships']),
'mermaid': json['mermaid'],
'ccImageUrl': json['cc_image_url'],
'displayImageUrls': ((json['display_image_urls'] as Array<any>).map(StoryUpdateDisplayImageUrlsInnerFromJSON)),
'alignment': json['alignment'] == null ? undefined : json['alignment'],
};
}
export function StoryUpdateToJSON(json: any): StoryUpdate {
return StoryUpdateToJSONTyped(json, false);
}
export function StoryUpdateToJSONTyped(value?: StoryUpdate | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'uuid': value['uuid'],
'cluster_articles': ((value['clusterArticles'] as Array<any>).map(ArticleToJSON)),
'prompt_articles': ((value['promptArticles'] as Array<any>).map(ArticleToJSON)),
'n_articles': value['nArticles'],
'entities': EntitiesToJSON(value['entities']),
'headline': value['headline'],
'story': value['story'],
'story_update_ts': value['storyUpdateTs'],
'sources_urls': value['sourcesUrls'],
'languages_pct': value['languagesPct'],
'countries_pct': value['countriesPct'],
'key_takeaways': value['keyTakeaways'],
'contradictions': value['contradictions'],
'continent': value['continent'],
'people': value['people'],
'locations': value['locations'],
'new_information': value['newInformation'],
'image_url': value['imageUrl'],
'url_safe_title': value['urlSafeTitle'],
'story_uuid': value['storyUuid'],
'categories': value['categories'],
'image_prompt': value['imagePrompt'],
'reddit_perspective': RedditPerspectiveToJSON(value['redditPerspective']),
'reddit_threads': ((value['redditThreads'] as Array<any>).map(RedditThreadToJSON)),
'languages': value['languages'],
'keywords': value['keywords'],
'intra_cluster_statistics': IntraClusterStatisticsToJSON(value['intraClusterStatistics']),
'silhouette_score': value['silhouetteScore'],
'article_ids': value['articleIds'],
'countries': value['countries'],
'markdown_citations': value['markdownCitations'],
'confidence': value['confidence'],
'provocative': value['provocative'],
'reporting_voice': value['reportingVoice'],
'relationships': AsknewsApiSchemaV1StoriesGraphRelationshipsToJSON(value['relationships']),
'mermaid': value['mermaid'],
'cc_image_url': value['ccImageUrl'],
'display_image_urls': ((value['displayImageUrls'] as Array<any>).map(StoryUpdateDisplayImageUrlsInnerToJSON)),
'alignment': value['alignment'],
};
}