@emergentmethods/asknews-typescript-sdk
Version:
Typescript SDK for AskNews API
274 lines (262 loc) • 7.83 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 { Classification } from './Classification';
import {
ClassificationFromJSON,
ClassificationFromJSONTyped,
ClassificationToJSON,
ClassificationToJSONTyped,
} from './Classification';
import type { RedditEntities } from './RedditEntities';
import {
RedditEntitiesFromJSON,
RedditEntitiesFromJSONTyped,
RedditEntitiesToJSON,
RedditEntitiesToJSONTyped,
} from './RedditEntities';
import type { RedditComment } from './RedditComment';
import {
RedditCommentFromJSON,
RedditCommentFromJSONTyped,
RedditCommentToJSON,
RedditCommentToJSONTyped,
} from './RedditComment';
import type { Sentiment } from './Sentiment';
import {
SentimentFromJSON,
SentimentFromJSONTyped,
SentimentToJSON,
SentimentToJSONTyped,
} from './Sentiment';
/**
*
* @export
* @interface RedditThread
*/
export interface RedditThread {
/**
*
* @type {string}
* @memberof RedditThread
*/
author: string;
/**
*
* @type {number}
* @memberof RedditThread
*/
authorCommentKarma: number;
/**
*
* @type {number}
* @memberof RedditThread
*/
authorLinkKarma: number;
/**
*
* @type {string}
* @memberof RedditThread
*/
body: string;
/**
*
* @type {Classification}
* @memberof RedditThread
*/
classification: Classification;
/**
*
* @type {Array<RedditComment>}
* @memberof RedditThread
*/
comments: Array<RedditComment>;
/**
*
* @type {number}
* @memberof RedditThread
*/
commentsCount: number;
/**
*
* @type {Date}
* @memberof RedditThread
*/
date: Date;
/**
*
* @type {RedditEntities}
* @memberof RedditThread
*/
entities: RedditEntities;
/**
*
* @type {string}
* @memberof RedditThread
*/
id: string;
/**
*
* @type {Array<string>}
* @memberof RedditThread
*/
keyTakeaways?: Array<string>;
/**
*
* @type {Array<string>}
* @memberof RedditThread
*/
keywords: Array<string>;
/**
*
* @type {Sentiment}
* @memberof RedditThread
*/
sentiment: Sentiment;
/**
*
* @type {string}
* @memberof RedditThread
*/
subredditName: string;
/**
*
* @type {string}
* @memberof RedditThread
*/
subredditUrl: string;
/**
*
* @type {string}
* @memberof RedditThread
*/
summary: string;
/**
*
* @type {string}
* @memberof RedditThread
*/
title: string;
/**
*
* @type {string}
* @memberof RedditThread
*/
topic: string;
/**
*
* @type {number}
* @memberof RedditThread
*/
upvotes: number;
/**
*
* @type {string}
* @memberof RedditThread
*/
url: string;
/**
*
* @type {string}
* @memberof RedditThread
*/
mainSpeculation?: string;
}
/**
* Check if a given object implements the RedditThread interface.
*/
export function instanceOfRedditThread(value: object): value is RedditThread {
if (!('author' in value) || value['author'] === undefined) return false;
if (!('authorCommentKarma' in value) || value['authorCommentKarma'] === undefined) return false;
if (!('authorLinkKarma' in value) || value['authorLinkKarma'] === undefined) return false;
if (!('body' in value) || value['body'] === undefined) return false;
if (!('classification' in value) || value['classification'] === undefined) return false;
if (!('comments' in value) || value['comments'] === undefined) return false;
if (!('commentsCount' in value) || value['commentsCount'] === undefined) return false;
if (!('date' in value) || value['date'] === undefined) return false;
if (!('entities' in value) || value['entities'] === undefined) return false;
if (!('id' in value) || value['id'] === undefined) return false;
if (!('keywords' in value) || value['keywords'] === undefined) return false;
if (!('sentiment' in value) || value['sentiment'] === undefined) return false;
if (!('subredditName' in value) || value['subredditName'] === undefined) return false;
if (!('subredditUrl' in value) || value['subredditUrl'] === undefined) return false;
if (!('summary' in value) || value['summary'] === undefined) return false;
if (!('title' in value) || value['title'] === undefined) return false;
if (!('topic' in value) || value['topic'] === undefined) return false;
if (!('upvotes' in value) || value['upvotes'] === undefined) return false;
if (!('url' in value) || value['url'] === undefined) return false;
return true;
}
export function RedditThreadFromJSON(json: any): RedditThread {
return RedditThreadFromJSONTyped(json, false);
}
export function RedditThreadFromJSONTyped(json: any, ignoreDiscriminator: boolean): RedditThread {
if (json == null) {
return json;
}
return {
'author': json['author'],
'authorCommentKarma': json['author_comment_karma'],
'authorLinkKarma': json['author_link_karma'],
'body': json['body'],
'classification': ClassificationFromJSON(json['classification']),
'comments': ((json['comments'] as Array<any>).map(RedditCommentFromJSON)),
'commentsCount': json['comments_count'],
'date': (new Date(json['date'])),
'entities': RedditEntitiesFromJSON(json['entities']),
'id': json['id'],
'keyTakeaways': json['key_takeaways'] == null ? undefined : json['key_takeaways'],
'keywords': json['keywords'],
'sentiment': SentimentFromJSON(json['sentiment']),
'subredditName': json['subreddit_name'],
'subredditUrl': json['subreddit_url'],
'summary': json['summary'],
'title': json['title'],
'topic': json['topic'],
'upvotes': json['upvotes'],
'url': json['url'],
'mainSpeculation': json['main_speculation'] == null ? undefined : json['main_speculation'],
};
}
export function RedditThreadToJSON(json: any): RedditThread {
return RedditThreadToJSONTyped(json, false);
}
export function RedditThreadToJSONTyped(value?: RedditThread | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'author': value['author'],
'author_comment_karma': value['authorCommentKarma'],
'author_link_karma': value['authorLinkKarma'],
'body': value['body'],
'classification': ClassificationToJSON(value['classification']),
'comments': ((value['comments'] as Array<any>).map(RedditCommentToJSON)),
'comments_count': value['commentsCount'],
'date': ((value['date']).toISOString()),
'entities': RedditEntitiesToJSON(value['entities']),
'id': value['id'],
'key_takeaways': value['keyTakeaways'],
'keywords': value['keywords'],
'sentiment': SentimentToJSON(value['sentiment']),
'subreddit_name': value['subredditName'],
'subreddit_url': value['subredditUrl'],
'summary': value['summary'],
'title': value['title'],
'topic': value['topic'],
'upvotes': value['upvotes'],
'url': value['url'],
'main_speculation': value['mainSpeculation'],
};
}