-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release(0.2.0): Release typescript-fetch SDK
- Loading branch information
kevin
committed
Jul 1, 2024
1 parent
7e2448e
commit dd59117
Showing
95 changed files
with
991 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@emergentmethods/asknews-typescript-sdk", | ||
"version": "0.1.14", | ||
"version": "0.2.0", | ||
"description": "Typescript SDK for AskNews API", | ||
"author": "Emergent Methods <[email protected]>", | ||
"license": "MIT", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* AskNews API | ||
* AskNews API | ||
* | ||
* The version of the OpenAPI document: 0.6.4 | ||
* The version of the OpenAPI document: 0.8.2 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* AskNews API | ||
* AskNews API | ||
* | ||
* The version of the OpenAPI document: 0.6.4 | ||
* The version of the OpenAPI document: 0.8.2 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* AskNews API | ||
* AskNews API | ||
* | ||
* The version of the OpenAPI document: 0.8.2 | ||
* Contact: [email protected] | ||
* | ||
* 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 { | ||
ForecastResponse, | ||
HTTPValidationError, | ||
} from '../models/index'; | ||
import { | ||
ForecastResponseFromJSON, | ||
ForecastResponseToJSON, | ||
HTTPValidationErrorFromJSON, | ||
HTTPValidationErrorToJSON, | ||
} from '../models/index'; | ||
|
||
export interface GetForecastRequest { | ||
query: string; | ||
lookback?: number; | ||
articlesToUse?: number; | ||
method?: GetForecastMethodEnum; | ||
model?: GetForecastModelEnum; | ||
cutoffDate?: string; | ||
useReddit?: boolean; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class ForecastApi extends runtime.BaseAPI { | ||
|
||
/** | ||
* Make an expert forecast for a news event. This endpoint reaches into the news archive, looking back `lookback` days to extract the most relevant news articles, building a timeline of events, and then making an expert forecast. This endpoint is more expensive than the search endpoint, it is calling gpt-4o or claude 3-5 on approx 15k tokens to build the forecast. This endpoint counts toward \"deep\" calls in the billing system. It returns the forecast, the reasoning, and the sources. | ||
* Make an expert forecast for a news event. | ||
*/ | ||
async getForecastRaw(requestParameters: GetForecastRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ForecastResponse>> { | ||
if (requestParameters['query'] == null) { | ||
throw new runtime.RequiredError( | ||
'query', | ||
'Required parameter "query" was null or undefined when calling getForecast().' | ||
); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
if (requestParameters['query'] != null) { | ||
queryParameters['query'] = requestParameters['query']; | ||
} | ||
|
||
if (requestParameters['lookback'] != null) { | ||
queryParameters['lookback'] = requestParameters['lookback']; | ||
} | ||
|
||
if (requestParameters['articlesToUse'] != null) { | ||
queryParameters['articles_to_use'] = requestParameters['articlesToUse']; | ||
} | ||
|
||
if (requestParameters['method'] != null) { | ||
queryParameters['method'] = requestParameters['method']; | ||
} | ||
|
||
if (requestParameters['model'] != null) { | ||
queryParameters['model'] = requestParameters['model']; | ||
} | ||
|
||
if (requestParameters['cutoffDate'] != null) { | ||
queryParameters['cutoff_date'] = requestParameters['cutoffDate']; | ||
} | ||
|
||
if (requestParameters['useReddit'] != null) { | ||
queryParameters['use_reddit'] = requestParameters['useReddit']; | ||
} | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
const response = await this.request({ | ||
path: `/v1/chat/forecast`, | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => ForecastResponseFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Make an expert forecast for a news event. This endpoint reaches into the news archive, looking back `lookback` days to extract the most relevant news articles, building a timeline of events, and then making an expert forecast. This endpoint is more expensive than the search endpoint, it is calling gpt-4o or claude 3-5 on approx 15k tokens to build the forecast. This endpoint counts toward \"deep\" calls in the billing system. It returns the forecast, the reasoning, and the sources. | ||
* Make an expert forecast for a news event. | ||
*/ | ||
async getForecast(requestParameters: GetForecastRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ForecastResponse> { | ||
const response = await this.getForecastRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @export | ||
*/ | ||
export const GetForecastMethodEnum = { | ||
Kw: 'kw' | ||
} as const; | ||
export type GetForecastMethodEnum = typeof GetForecastMethodEnum[keyof typeof GetForecastMethodEnum]; | ||
/** | ||
* @export | ||
*/ | ||
export const GetForecastModelEnum = { | ||
Gpt4o: 'gpt-4o', | ||
Claude35Sonnet20240620: 'claude-3-5-sonnet-20240620', | ||
CommandNightly: 'command-nightly' | ||
} as const; | ||
export type GetForecastModelEnum = typeof GetForecastModelEnum[keyof typeof GetForecastModelEnum]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* AskNews API | ||
* AskNews API | ||
* | ||
* The version of the OpenAPI document: 0.6.4 | ||
* The version of the OpenAPI document: 0.8.2 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* AskNews API | ||
* AskNews API | ||
* | ||
* The version of the OpenAPI document: 0.6.4 | ||
* The version of the OpenAPI document: 0.8.2 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* AskNews API | ||
* AskNews API | ||
* | ||
* The version of the OpenAPI document: 0.8.2 | ||
* Contact: [email protected] | ||
* | ||
* 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 { | ||
AbcAPIErrorModel29, | ||
AbcAPIErrorModel30, | ||
AbcAPIErrorModel31, | ||
AbcAPIErrorModel32, | ||
AsknewsApiErrorsAPIErrorModel, | ||
RedditResponse, | ||
ValidationErrorModel, | ||
} from '../models/index'; | ||
import { | ||
AbcAPIErrorModel29FromJSON, | ||
AbcAPIErrorModel29ToJSON, | ||
AbcAPIErrorModel30FromJSON, | ||
AbcAPIErrorModel30ToJSON, | ||
AbcAPIErrorModel31FromJSON, | ||
AbcAPIErrorModel31ToJSON, | ||
AbcAPIErrorModel32FromJSON, | ||
AbcAPIErrorModel32ToJSON, | ||
AsknewsApiErrorsAPIErrorModelFromJSON, | ||
AsknewsApiErrorsAPIErrorModelToJSON, | ||
RedditResponseFromJSON, | ||
RedditResponseToJSON, | ||
ValidationErrorModelFromJSON, | ||
ValidationErrorModelToJSON, | ||
} from '../models/index'; | ||
|
||
export interface SearchRedditRequest { | ||
keywords: Array<string>; | ||
nThreads?: number; | ||
method?: SearchRedditMethodEnum; | ||
deep?: boolean; | ||
returnType?: SearchRedditReturnTypeEnum; | ||
timeFilter?: SearchRedditTimeFilterEnum; | ||
sort?: SearchRedditSortEnum; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class RedditApi extends runtime.BaseAPI { | ||
|
||
/** | ||
* Go to Reddit, search threads, summarize the threads, return analysis. `deep`=True is a live web scrape, AskNews searches Reddit, finds threads, summarizes them, analyzes them, and returns the results. `deep`=False is a search in AskNews\' existing database of Reddit threads. | ||
* Search Reddit, summarize threads, and return analysis. | ||
*/ | ||
async searchRedditRaw(requestParameters: SearchRedditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RedditResponse>> { | ||
if (requestParameters['keywords'] == null) { | ||
throw new runtime.RequiredError( | ||
'keywords', | ||
'Required parameter "keywords" was null or undefined when calling searchReddit().' | ||
); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
if (requestParameters['keywords'] != null) { | ||
queryParameters['keywords'] = requestParameters['keywords']; | ||
} | ||
|
||
if (requestParameters['nThreads'] != null) { | ||
queryParameters['n_threads'] = requestParameters['nThreads']; | ||
} | ||
|
||
if (requestParameters['method'] != null) { | ||
queryParameters['method'] = requestParameters['method']; | ||
} | ||
|
||
if (requestParameters['deep'] != null) { | ||
queryParameters['deep'] = requestParameters['deep']; | ||
} | ||
|
||
if (requestParameters['returnType'] != null) { | ||
queryParameters['return_type'] = requestParameters['returnType']; | ||
} | ||
|
||
if (requestParameters['timeFilter'] != null) { | ||
queryParameters['time_filter'] = requestParameters['timeFilter']; | ||
} | ||
|
||
if (requestParameters['sort'] != null) { | ||
queryParameters['sort'] = requestParameters['sort']; | ||
} | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
const response = await this.request({ | ||
path: `/v1/reddit/search`, | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => RedditResponseFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
* Go to Reddit, search threads, summarize the threads, return analysis. `deep`=True is a live web scrape, AskNews searches Reddit, finds threads, summarizes them, analyzes them, and returns the results. `deep`=False is a search in AskNews\' existing database of Reddit threads. | ||
* Search Reddit, summarize threads, and return analysis. | ||
*/ | ||
async searchReddit(requestParameters: SearchRedditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RedditResponse> { | ||
const response = await this.searchRedditRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @export | ||
*/ | ||
export const SearchRedditMethodEnum = { | ||
Nl: 'nl', | ||
Kw: 'kw' | ||
} as const; | ||
export type SearchRedditMethodEnum = typeof SearchRedditMethodEnum[keyof typeof SearchRedditMethodEnum]; | ||
/** | ||
* @export | ||
*/ | ||
export const SearchRedditReturnTypeEnum = { | ||
Dicts: 'dicts', | ||
String: 'string', | ||
Both: 'both' | ||
} as const; | ||
export type SearchRedditReturnTypeEnum = typeof SearchRedditReturnTypeEnum[keyof typeof SearchRedditReturnTypeEnum]; | ||
/** | ||
* @export | ||
*/ | ||
export const SearchRedditTimeFilterEnum = { | ||
Hour: 'hour', | ||
Day: 'day', | ||
Week: 'week', | ||
Month: 'month', | ||
Year: 'year', | ||
All: 'all' | ||
} as const; | ||
export type SearchRedditTimeFilterEnum = typeof SearchRedditTimeFilterEnum[keyof typeof SearchRedditTimeFilterEnum]; | ||
/** | ||
* @export | ||
*/ | ||
export const SearchRedditSortEnum = { | ||
Relevance: 'relevance', | ||
Hot: 'hot', | ||
Top: 'top', | ||
New: 'new', | ||
Comments: 'comments' | ||
} as const; | ||
export type SearchRedditSortEnum = typeof SearchRedditSortEnum[keyof typeof SearchRedditSortEnum]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* AskNews API | ||
* AskNews API | ||
* | ||
* The version of the OpenAPI document: 0.6.4 | ||
* The version of the OpenAPI document: 0.8.2 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
@@ -345,7 +345,9 @@ export type GetStoriesProvocativeEnum = typeof GetStoriesProvocativeEnum[keyof t | |
*/ | ||
export const GetStoriesStrategyEnum = { | ||
Default: 'default', | ||
Topstories: 'topstories' | ||
Topstories: 'topstories', | ||
TopstoriesCategories: 'topstories_categories', | ||
TopstoriesContinents: 'topstories_continents' | ||
} as const; | ||
export type GetStoriesStrategyEnum = typeof GetStoriesStrategyEnum[keyof typeof GetStoriesStrategyEnum]; | ||
/** | ||
|
Oops, something went wrong.