@emergentmethods/asknews-typescript-sdk
Version:
Typescript SDK for AskNews API
190 lines (189 loc) • 8.01 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* AskNews API
* AskNews API
*
* The version of the OpenAPI document: 0.21.1
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArticleToJSONTyped = exports.ArticleToJSON = exports.ArticleFromJSONTyped = exports.ArticleFromJSON = exports.instanceOfArticle = exports.ArticleBiasEnum = exports.ArticleContinentEnum = exports.ArticleProvocativeEnum = void 0;
const runtime_1 = require("../runtime");
const Assets_1 = require("./Assets");
const Classification_1 = require("./Classification");
const AsknewsApiSchemaV1CommonGraphRelationships_1 = require("./AsknewsApiSchemaV1CommonGraphRelationships");
const GeoCoordinate_1 = require("./GeoCoordinate");
const ReportingVoice1_1 = require("./ReportingVoice1");
const Entities_1 = require("./Entities");
/**
* @export
*/
exports.ArticleProvocativeEnum = {
Unknown: 'unknown',
Low: 'low',
Medium: 'medium',
High: 'high'
};
/**
* @export
*/
exports.ArticleContinentEnum = {
Africa: 'Africa',
Asia: 'Asia',
Europe: 'Europe',
MiddleEast: 'Middle East',
NorthAmerica: 'North America',
SouthAmerica: 'South America',
Oceania: 'Oceania'
};
/**
* @export
*/
exports.ArticleBiasEnum = {
Political: 'Political',
Gender: 'Gender',
Cultural: 'Cultural',
Age: 'Age',
Religious: 'Religious',
Statement: 'Statement',
IllogicalClaims: 'Illogical Claims',
Slant: 'Slant',
SourceSelection: 'Source Selection',
OmissionOfSourceAttribution: 'Omission of Source Attribution',
Spin: 'Spin',
Sensationalism: 'Sensationalism',
Negativity: 'Negativity',
SubjectiveAdjectives: 'Subjective Adjectives',
AdHominem: 'Ad Hominem',
MindReading: 'Mind Reading',
OpinionAsFact: 'Opinion-as-Fact',
None: 'None',
Unknown: 'Unknown'
};
/**
* Check if a given object implements the Article interface.
*/
function instanceOfArticle(value) {
if (!('articleUrl' in value) || value['articleUrl'] === undefined)
return false;
if (!('articleId' in value) || value['articleId'] === undefined)
return false;
if (!('classification' in value) || value['classification'] === undefined)
return false;
if (!('country' in value) || value['country'] === undefined)
return false;
if (!('sourceId' in value) || value['sourceId'] === undefined)
return false;
if (!('pageRank' in value) || value['pageRank'] === undefined)
return false;
if (!('domainUrl' in value) || value['domainUrl'] === undefined)
return false;
if (!('engTitle' in value) || value['engTitle'] === undefined)
return false;
if (!('entities' in value) || value['entities'] === undefined)
return false;
if (!('keywords' in value) || value['keywords'] === undefined)
return false;
if (!('language' in value) || value['language'] === undefined)
return false;
if (!('pubDate' in value) || value['pubDate'] === undefined)
return false;
if (!('summary' in value) || value['summary'] === undefined)
return false;
if (!('title' in value) || value['title'] === undefined)
return false;
if (!('sentiment' in value) || value['sentiment'] === undefined)
return false;
if (!('centroidDistance' in value) || value['centroidDistance'] === undefined)
return false;
if (!('clusterProbability' in value) || value['clusterProbability'] === undefined)
return false;
return true;
}
exports.instanceOfArticle = instanceOfArticle;
function ArticleFromJSON(json) {
return ArticleFromJSONTyped(json, false);
}
exports.ArticleFromJSON = ArticleFromJSON;
function ArticleFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'articleUrl': json['article_url'],
'articleId': json['article_id'],
'classification': (0, Classification_1.ClassificationFromJSON)(json['classification']),
'country': json['country'],
'sourceId': json['source_id'],
'pageRank': json['page_rank'],
'domainUrl': json['domain_url'],
'engTitle': json['eng_title'],
'entities': (0, Entities_1.EntitiesFromJSON)(json['entities']),
'imageUrl': json['image_url'] == null ? undefined : json['image_url'],
'keywords': json['keywords'],
'language': json['language'],
'pubDate': (new Date(json['pub_date'])),
'summary': json['summary'],
'keyPoints': json['key_points'] == null ? undefined : json['key_points'],
'title': json['title'],
'sentiment': json['sentiment'],
'centroidDistance': json['centroid_distance'],
'clusterProbability': json['cluster_probability'],
'markdownCitation': json['markdown_citation'] == null ? undefined : json['markdown_citation'],
'provocative': json['provocative'] == null ? undefined : json['provocative'],
'reportingVoice': json['reporting_voice'] == null ? undefined : (0, ReportingVoice1_1.ReportingVoice1FromJSON)(json['reporting_voice']),
'entityRelationGraph': json['entity_relation_graph'] == null ? undefined : (0, AsknewsApiSchemaV1CommonGraphRelationships_1.AsknewsApiSchemaV1CommonGraphRelationshipsFromJSON)(json['entity_relation_graph']),
'geoCoordinates': json['geo_coordinates'] == null ? undefined : ((0, runtime_1.mapValues)(json['geo_coordinates'], GeoCoordinate_1.GeoCoordinateFromJSON)),
'continent': json['continent'] == null ? undefined : json['continent'],
'assets': json['assets'] == null ? undefined : (0, Assets_1.AssetsFromJSON)(json['assets']),
'socialEmbeds': json['social_embeds'] == null ? undefined : json['social_embeds'],
'bias': json['bias'] == null ? undefined : json['bias'],
};
}
exports.ArticleFromJSONTyped = ArticleFromJSONTyped;
function ArticleToJSON(json) {
return ArticleToJSONTyped(json, false);
}
exports.ArticleToJSON = ArticleToJSON;
function ArticleToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'article_url': value['articleUrl'],
'article_id': value['articleId'],
'classification': (0, Classification_1.ClassificationToJSON)(value['classification']),
'country': value['country'],
'source_id': value['sourceId'],
'page_rank': value['pageRank'],
'domain_url': value['domainUrl'],
'eng_title': value['engTitle'],
'entities': (0, Entities_1.EntitiesToJSON)(value['entities']),
'image_url': value['imageUrl'],
'keywords': value['keywords'],
'language': value['language'],
'pub_date': ((value['pubDate']).toISOString()),
'summary': value['summary'],
'key_points': value['keyPoints'],
'title': value['title'],
'sentiment': value['sentiment'],
'centroid_distance': value['centroidDistance'],
'cluster_probability': value['clusterProbability'],
'markdown_citation': value['markdownCitation'],
'provocative': value['provocative'],
'reporting_voice': (0, ReportingVoice1_1.ReportingVoice1ToJSON)(value['reportingVoice']),
'entity_relation_graph': (0, AsknewsApiSchemaV1CommonGraphRelationships_1.AsknewsApiSchemaV1CommonGraphRelationshipsToJSON)(value['entityRelationGraph']),
'geo_coordinates': value['geoCoordinates'] == null ? undefined : ((0, runtime_1.mapValues)(value['geoCoordinates'], GeoCoordinate_1.GeoCoordinateToJSON)),
'continent': value['continent'],
'assets': (0, Assets_1.AssetsToJSON)(value['assets']),
'social_embeds': value['socialEmbeds'],
'bias': value['bias'],
};
}
exports.ArticleToJSONTyped = ArticleToJSONTyped;
;