UNPKG

@emergentmethods/asknews-typescript-sdk

Version:
121 lines (120 loc) 4.2 kB
/* tslint:disable */ /* eslint-disable */ /** * AskNews API * AskNews API * * The version of the OpenAPI document: 0.18.6 * 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 { ClassificationFromJSON, ClassificationToJSON, } from './Classification'; import { RedditCommentFromJSON, RedditCommentToJSON, } from './RedditComment'; import { RedditEntitiesFromJSON, RedditEntitiesToJSON, } from './RedditEntities'; import { SentimentFromJSON, SentimentToJSON, } from './Sentiment'; /** * Check if a given object implements the RedditThread interface. */ export function instanceOfRedditThread(value) { if (!('author' in value)) return false; if (!('authorCommentKarma' in value)) return false; if (!('authorLinkKarma' in value)) return false; if (!('body' in value)) return false; if (!('classification' in value)) return false; if (!('comments' in value)) return false; if (!('commentsCount' in value)) return false; if (!('date' in value)) return false; if (!('entities' in value)) return false; if (!('id' in value)) return false; if (!('keywords' in value)) return false; if (!('sentiment' in value)) return false; if (!('subredditName' in value)) return false; if (!('subredditUrl' in value)) return false; if (!('summary' in value)) return false; if (!('title' in value)) return false; if (!('topic' in value)) return false; if (!('upvotes' in value)) return false; if (!('url' in value)) return false; return true; } export function RedditThreadFromJSON(json) { return RedditThreadFromJSONTyped(json, false); } export function RedditThreadFromJSONTyped(json, ignoreDiscriminator) { 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'].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(value) { 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'].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'], }; }