UNPKG

@emergentmethods/asknews-typescript-sdk

Version:
66 lines (65 loc) 3.47 kB
"use strict"; /* 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. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphApi = void 0; const runtime = require("../runtime"); const index_1 = require("../models/index"); /** * */ class GraphApi extends runtime.BaseAPI { /** * Explore our mega-news-knowledge-graph at which ever level of resolution you need. Fully disambiguated and ready to be used in any downstream application. Pass a natural language query to get a graph of the latest news. Add parameters to build a graph from our archive, filter your graph by language, country, reporting voice, sentiment, provocative levels, and much more. * Build a custom mega-news-knowledge graph */ buildGraphRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; const response = yield this.request({ path: `/v1/news/graph`, method: 'POST', headers: headerParameters, query: queryParameters, body: (0, index_1.BodyBuildGraphToJSON)(requestParameters['bodyBuildGraph']), }, initOverrides); if ('bodyBuildGraph' in requestParameters && requestParameters['bodyBuildGraph'] != null && 'stream' in requestParameters['bodyBuildGraph'] && requestParameters['bodyBuildGraph']['stream'] === true) { return new runtime.StreamApiResponse(response); } return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GraphResponseFromJSON)(jsonValue)); }); } /** * Explore our mega-news-knowledge-graph at which ever level of resolution you need. Fully disambiguated and ready to be used in any downstream application. Pass a natural language query to get a graph of the latest news. Add parameters to build a graph from our archive, filter your graph by language, country, reporting voice, sentiment, provocative levels, and much more. * Build a custom mega-news-knowledge graph */ buildGraph(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.buildGraphRaw(requestParameters, initOverrides); return yield response.value(); }); } } exports.GraphApi = GraphApi;