UNPKG

@emergentmethods/asknews-typescript-sdk

Version:
492 lines (491 loc) 18.3 kB
/** * 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 * as runtime from '../runtime'; import type { BadDomainUrl, BadDomainUrl1, DomainUrl, IndexCountItem, Offset, ReportingVoice, SearchResponse, SearchResponseDictItem, SourceReportItem } from '../models/index'; export interface GetArticleRequest { articleId: string; } export interface GetArticlesRequest { articleIds: Array<string>; } export interface GetIndexCountsRequest { startDatetime?: Date; endDatetime?: Date; domains?: Array<string>; sampling?: GetIndexCountsSamplingEnum; timeFilter?: GetIndexCountsTimeFilterEnum; categories?: Array<GetIndexCountsCategoriesEnum>; provocative?: GetIndexCountsProvocativeEnum; reportingVoice?: Array<GetIndexCountsReportingVoiceEnum>; badDomainUrl?: BadDomainUrl1; pageRank?: number; stringGuarantee?: Array<string>; stringGuaranteeOp?: GetIndexCountsStringGuaranteeOpEnum; reverseStringGuarantee?: Array<string>; entityGuarantee?: Array<string>; entityGuaranteeOp?: GetIndexCountsEntityGuaranteeOpEnum; languages?: Array<GetIndexCountsLanguagesEnum>; countries?: Array<string>; countriesBlacklist?: Array<string>; continents?: Array<GetIndexCountsContinentsEnum>; sentiment?: GetIndexCountsSentimentEnum; } export interface GetSourcesReportRequest { nPoints?: number; startTimestamp?: number; endTimestamp?: number; metric?: GetSourcesReportMetricEnum; sampling?: GetSourcesReportSamplingEnum; } export interface SearchNewsRequest { query?: string; nArticles?: number; startTimestamp?: number; endTimestamp?: number; timeFilter?: SearchNewsTimeFilterEnum; returnType?: SearchNewsReturnTypeEnum; historical?: boolean; method?: SearchNewsMethodEnum; similarityScoreThreshold?: number; offset?: Offset; categories?: Array<SearchNewsCategoriesEnum>; docStartDelimiter?: string; docEndDelimiter?: string; provocative?: SearchNewsProvocativeEnum; reportingVoice?: ReportingVoice; domainUrl?: DomainUrl; badDomainUrl?: BadDomainUrl; pageRank?: number; diversifySources?: boolean; strategy?: SearchNewsStrategyEnum; hoursBack?: number; stringGuarantee?: Array<string>; stringGuaranteeOp?: SearchNewsStringGuaranteeOpEnum; reverseStringGuarantee?: Array<string>; entityGuarantee?: Array<string>; reverseEntityGuarantee?: Array<string>; entityGuaranteeOp?: SearchNewsEntityGuaranteeOpEnum; returnGraphs?: boolean; returnGeo?: boolean; languages?: Array<SearchNewsLanguagesEnum>; countries?: Array<string>; countriesBlacklist?: Array<string>; continents?: Array<SearchNewsContinentsEnum>; sentiment?: SearchNewsSentimentEnum; premium?: boolean; authors?: Array<string>; } /** * */ export declare class NewsApi extends runtime.BaseAPI { /** * Get a single article given a UUID. * Get an article by its UUID */ getArticleRaw(requestParameters: GetArticleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SearchResponseDictItem>>; /** * Get a single article given a UUID. * Get an article by its UUID */ getArticle(requestParameters: GetArticleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SearchResponseDictItem>; /** * Get articles given a list of UUIDs. * Get multiple articles by UUID */ getArticlesRaw(requestParameters: GetArticlesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SearchResponseDictItem>>>; /** * Get articles given a list of UUIDs. * Get multiple articles by UUID */ getArticles(requestParameters: GetArticlesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SearchResponseDictItem>>; /** * This endpoint is primarly used for the publisher dashboard, to show the number of articles indexed per source. * Get the index counts underlying AskNews */ getIndexCountsRaw(requestParameters: GetIndexCountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<IndexCountItem>>>; /** * This endpoint is primarly used for the publisher dashboard, to show the number of articles indexed per source. * Get the index counts underlying AskNews */ getIndexCounts(requestParameters?: GetIndexCountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<IndexCountItem>>; /** * This endpoint is primarly used for transparency and monitoring the diversity of the data. Visualized at `https://asknews.app/transparency`. Get the distribution of sources/languages/countries underlying AskNews content. * Get the sources underlying AskNews */ getSourcesReportRaw(requestParameters: GetSourcesReportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SourceReportItem>>>; /** * This endpoint is primarly used for transparency and monitoring the diversity of the data. Visualized at `https://asknews.app/transparency`. Get the distribution of sources/languages/countries underlying AskNews content. * Get the sources underlying AskNews */ getSourcesReport(requestParameters?: GetSourcesReportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SourceReportItem>>; /** * Search for any news, up to the last 5 minutes or in our extensive historical archive filled with 100s of millions of articles. Geared toward low-latency applications, where time is of the essence. For example, this endpoint is commonly used for quickly getting news context for an LLM. This endpoint is also commonly used for synthetic data curation. For example, say you are fine-tuning a model for sports. You could filter with `classification=\"Sports\"` and build a dataset of sports articles. News articles come with an abundance of valuable metadata, including full summaries, sentiment, entities, reporting voice, page rank, language, and much much more. An example of this data in action can be found and interacted with at `https://asknews.app/chat` * Search for enriched real-time news context */ searchNewsRaw(requestParameters: SearchNewsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SearchResponse>>; /** * Search for any news, up to the last 5 minutes or in our extensive historical archive filled with 100s of millions of articles. Geared toward low-latency applications, where time is of the essence. For example, this endpoint is commonly used for quickly getting news context for an LLM. This endpoint is also commonly used for synthetic data curation. For example, say you are fine-tuning a model for sports. You could filter with `classification=\"Sports\"` and build a dataset of sports articles. News articles come with an abundance of valuable metadata, including full summaries, sentiment, entities, reporting voice, page rank, language, and much much more. An example of this data in action can be found and interacted with at `https://asknews.app/chat` * Search for enriched real-time news context */ searchNews(requestParameters?: SearchNewsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SearchResponse>; } /** * @export */ export declare const GetIndexCountsSamplingEnum: { readonly _5m: "5m"; readonly _1h: "1h"; readonly _12h: "12h"; readonly _1d: "1d"; readonly _1w: "1w"; readonly _1m: "1m"; }; export type GetIndexCountsSamplingEnum = typeof GetIndexCountsSamplingEnum[keyof typeof GetIndexCountsSamplingEnum]; /** * @export */ export declare const GetIndexCountsTimeFilterEnum: { readonly CrawlDate: "crawl_date"; readonly PubDate: "pub_date"; }; export type GetIndexCountsTimeFilterEnum = typeof GetIndexCountsTimeFilterEnum[keyof typeof GetIndexCountsTimeFilterEnum]; /** * @export */ export declare const GetIndexCountsCategoriesEnum: { readonly All: "All"; readonly Business: "Business"; readonly Crime: "Crime"; readonly Politics: "Politics"; readonly Science: "Science"; readonly Sports: "Sports"; readonly Technology: "Technology"; readonly Military: "Military"; readonly Health: "Health"; readonly Entertainment: "Entertainment"; readonly Finance: "Finance"; readonly Culture: "Culture"; readonly Climate: "Climate"; readonly Environment: "Environment"; readonly World: "World"; }; export type GetIndexCountsCategoriesEnum = typeof GetIndexCountsCategoriesEnum[keyof typeof GetIndexCountsCategoriesEnum]; /** * @export */ export declare const GetIndexCountsProvocativeEnum: { readonly Unknown: "unknown"; readonly Low: "low"; readonly Medium: "medium"; readonly High: "high"; readonly All: "all"; }; export type GetIndexCountsProvocativeEnum = typeof GetIndexCountsProvocativeEnum[keyof typeof GetIndexCountsProvocativeEnum]; /** * @export */ export declare const GetIndexCountsReportingVoiceEnum: { readonly Objective: "Objective"; readonly Subjective: "Subjective"; readonly Investigative: "Investigative"; readonly Narrative: "Narrative"; readonly Analytical: "Analytical"; readonly Advocacy: "Advocacy"; readonly Conversational: "Conversational"; readonly Satirical: "Satirical"; readonly Emotive: "Emotive"; readonly Explanatory: "Explanatory"; readonly Persuasive: "Persuasive"; readonly Sensational: "Sensational"; readonly Unknown: "Unknown"; readonly All: "all"; }; export type GetIndexCountsReportingVoiceEnum = typeof GetIndexCountsReportingVoiceEnum[keyof typeof GetIndexCountsReportingVoiceEnum]; /** * @export */ export declare const GetIndexCountsStringGuaranteeOpEnum: { readonly And: "AND"; readonly Or: "OR"; }; export type GetIndexCountsStringGuaranteeOpEnum = typeof GetIndexCountsStringGuaranteeOpEnum[keyof typeof GetIndexCountsStringGuaranteeOpEnum]; /** * @export */ export declare const GetIndexCountsEntityGuaranteeOpEnum: { readonly And: "AND"; readonly Or: "OR"; }; export type GetIndexCountsEntityGuaranteeOpEnum = typeof GetIndexCountsEntityGuaranteeOpEnum[keyof typeof GetIndexCountsEntityGuaranteeOpEnum]; /** * @export */ export declare const GetIndexCountsLanguagesEnum: { readonly Sq: "sq"; readonly Ar: "ar"; readonly Az: "az"; readonly Ca: "ca"; readonly Zh: "zh"; readonly Hr: "hr"; readonly Cs: "cs"; readonly Da: "da"; readonly Nl: "nl"; readonly En: "en"; readonly Eo: "eo"; readonly Fi: "fi"; readonly Fr: "fr"; readonly Gl: "gl"; readonly De: "de"; readonly El: "el"; readonly He: "he"; readonly Hi: "hi"; readonly Hu: "hu"; readonly Is: "is"; readonly Id: "id"; readonly Ia: "ia"; readonly It: "it"; readonly Ja: "ja"; readonly Kk: "kk"; readonly Km: "km"; readonly Ko: "ko"; readonly Ky: "ky"; readonly Ms: "ms"; readonly Mt: "mt"; readonly Mhr: "mhr"; readonly Mn: "mn"; readonly No: "no"; readonly Or: "or"; readonly Pl: "pl"; readonly Pt: "pt"; readonly Pa: "pa"; readonly Ro: "ro"; readonly Ru: "ru"; readonly Sr: "sr"; readonly Sk: "sk"; readonly Sl: "sl"; readonly Es: "es"; readonly Sv: "sv"; readonly Ta: "ta"; readonly Te: "te"; readonly Th: "th"; readonly Tr: "tr"; readonly Uk: "uk"; readonly Vi: "vi"; readonly Unknown: "unknown"; }; export type GetIndexCountsLanguagesEnum = typeof GetIndexCountsLanguagesEnum[keyof typeof GetIndexCountsLanguagesEnum]; /** * @export */ export declare const GetIndexCountsContinentsEnum: { readonly Africa: "Africa"; readonly Asia: "Asia"; readonly Oceania: "Oceania"; readonly Europe: "Europe"; readonly MiddleEast: "Middle East"; readonly NorthAmerica: "North America"; readonly SouthAmerica: "South America"; }; export type GetIndexCountsContinentsEnum = typeof GetIndexCountsContinentsEnum[keyof typeof GetIndexCountsContinentsEnum]; /** * @export */ export declare const GetIndexCountsSentimentEnum: { readonly Negative: "negative"; readonly Neutral: "neutral"; readonly Positive: "positive"; }; export type GetIndexCountsSentimentEnum = typeof GetIndexCountsSentimentEnum[keyof typeof GetIndexCountsSentimentEnum]; /** * @export */ export declare const GetSourcesReportMetricEnum: { readonly Duplication: "duplication"; readonly CountriesDiversity: "countries_diversity"; readonly LanguagesDiversity: "languages_diversity"; readonly SourcesDiversity: "sources_diversity"; readonly BucketLoss: "bucket_loss"; }; export type GetSourcesReportMetricEnum = typeof GetSourcesReportMetricEnum[keyof typeof GetSourcesReportMetricEnum]; /** * @export */ export declare const GetSourcesReportSamplingEnum: { readonly _5m: "5m"; readonly _1h: "1h"; readonly _4h: "4h"; readonly _1d: "1d"; }; export type GetSourcesReportSamplingEnum = typeof GetSourcesReportSamplingEnum[keyof typeof GetSourcesReportSamplingEnum]; /** * @export */ export declare const SearchNewsTimeFilterEnum: { readonly CrawlDate: "crawl_date"; readonly PubDate: "pub_date"; }; export type SearchNewsTimeFilterEnum = typeof SearchNewsTimeFilterEnum[keyof typeof SearchNewsTimeFilterEnum]; /** * @export */ export declare const SearchNewsReturnTypeEnum: { readonly String: "string"; readonly Dicts: "dicts"; readonly Both: "both"; }; export type SearchNewsReturnTypeEnum = typeof SearchNewsReturnTypeEnum[keyof typeof SearchNewsReturnTypeEnum]; /** * @export */ export declare const SearchNewsMethodEnum: { readonly Nl: "nl"; readonly Kw: "kw"; readonly Both: "both"; }; export type SearchNewsMethodEnum = typeof SearchNewsMethodEnum[keyof typeof SearchNewsMethodEnum]; /** * @export */ export declare const SearchNewsCategoriesEnum: { readonly All: "All"; readonly Business: "Business"; readonly Crime: "Crime"; readonly Politics: "Politics"; readonly Science: "Science"; readonly Sports: "Sports"; readonly Technology: "Technology"; readonly Military: "Military"; readonly Health: "Health"; readonly Entertainment: "Entertainment"; readonly Finance: "Finance"; readonly Culture: "Culture"; readonly Climate: "Climate"; readonly Environment: "Environment"; readonly World: "World"; }; export type SearchNewsCategoriesEnum = typeof SearchNewsCategoriesEnum[keyof typeof SearchNewsCategoriesEnum]; /** * @export */ export declare const SearchNewsProvocativeEnum: { readonly Unknown: "unknown"; readonly Low: "low"; readonly Medium: "medium"; readonly High: "high"; readonly All: "all"; }; export type SearchNewsProvocativeEnum = typeof SearchNewsProvocativeEnum[keyof typeof SearchNewsProvocativeEnum]; /** * @export */ export declare const SearchNewsStrategyEnum: { readonly LatestNews: "latest news"; readonly NewsKnowledge: "news knowledge"; readonly Default: "default"; }; export type SearchNewsStrategyEnum = typeof SearchNewsStrategyEnum[keyof typeof SearchNewsStrategyEnum]; /** * @export */ export declare const SearchNewsStringGuaranteeOpEnum: { readonly And: "AND"; readonly Or: "OR"; }; export type SearchNewsStringGuaranteeOpEnum = typeof SearchNewsStringGuaranteeOpEnum[keyof typeof SearchNewsStringGuaranteeOpEnum]; /** * @export */ export declare const SearchNewsEntityGuaranteeOpEnum: { readonly And: "AND"; readonly Or: "OR"; }; export type SearchNewsEntityGuaranteeOpEnum = typeof SearchNewsEntityGuaranteeOpEnum[keyof typeof SearchNewsEntityGuaranteeOpEnum]; /** * @export */ export declare const SearchNewsLanguagesEnum: { readonly Sq: "sq"; readonly Ar: "ar"; readonly Az: "az"; readonly Ca: "ca"; readonly Zh: "zh"; readonly Hr: "hr"; readonly Cs: "cs"; readonly Da: "da"; readonly Nl: "nl"; readonly En: "en"; readonly Eo: "eo"; readonly Fi: "fi"; readonly Fr: "fr"; readonly Gl: "gl"; readonly De: "de"; readonly El: "el"; readonly He: "he"; readonly Hi: "hi"; readonly Hu: "hu"; readonly Is: "is"; readonly Id: "id"; readonly Ia: "ia"; readonly It: "it"; readonly Ja: "ja"; readonly Kk: "kk"; readonly Km: "km"; readonly Ko: "ko"; readonly Ky: "ky"; readonly Ms: "ms"; readonly Mt: "mt"; readonly Mhr: "mhr"; readonly Mn: "mn"; readonly No: "no"; readonly Or: "or"; readonly Pl: "pl"; readonly Pt: "pt"; readonly Pa: "pa"; readonly Ro: "ro"; readonly Ru: "ru"; readonly Sr: "sr"; readonly Sk: "sk"; readonly Sl: "sl"; readonly Es: "es"; readonly Sv: "sv"; readonly Ta: "ta"; readonly Te: "te"; readonly Th: "th"; readonly Tr: "tr"; readonly Uk: "uk"; readonly Vi: "vi"; readonly Unknown: "unknown"; }; export type SearchNewsLanguagesEnum = typeof SearchNewsLanguagesEnum[keyof typeof SearchNewsLanguagesEnum]; /** * @export */ export declare const SearchNewsContinentsEnum: { readonly Africa: "Africa"; readonly Asia: "Asia"; readonly Oceania: "Oceania"; readonly Europe: "Europe"; readonly MiddleEast: "Middle East"; readonly NorthAmerica: "North America"; readonly SouthAmerica: "South America"; }; export type SearchNewsContinentsEnum = typeof SearchNewsContinentsEnum[keyof typeof SearchNewsContinentsEnum]; /** * @export */ export declare const SearchNewsSentimentEnum: { readonly Negative: "negative"; readonly Neutral: "neutral"; readonly Positive: "positive"; }; export type SearchNewsSentimentEnum = typeof SearchNewsSentimentEnum[keyof typeof SearchNewsSentimentEnum];