Comparing version 10.0.0-beta.14 to 10.0.0-beta.15
@@ -1,2 +0,2 @@ | ||
import { EndpointDescription, HistoricalFilter, News, RestResponse, RestResponseError, RestResponseSuccess } from "./types"; | ||
import { CategoryCode, EndpointDescription, HistoricalFilter, News, RestResponse, RestResponseError, RestResponseSuccess, Source } from "./types"; | ||
export declare class Api { | ||
@@ -9,2 +9,4 @@ private apikey; | ||
getById(id: string, errorHandler?: (apiResponse: RestResponseError<News>) => void): Promise<News>; | ||
getCategoryCodes(source: string): Promise<CategoryCode[]>; | ||
getSources(): Promise<Source[]>; | ||
get<T>(path: string, params?: any, errorHandler?: (apiResponse: RestResponseError<T>) => void): Promise<RestResponse<T>>; | ||
@@ -11,0 +13,0 @@ post<T, Z>(path: string, body: T, errorHandler?: (apiResponse: RestResponseError<Z>) => void): Promise<RestResponseSuccess<Z>>; |
@@ -36,2 +36,14 @@ "use strict"; | ||
} | ||
getCategoryCodes(source) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.get('/category-codes', { | ||
source | ||
})).data; | ||
}); | ||
} | ||
getSources() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (yield (this.get('/sources'))).data; | ||
}); | ||
} | ||
get(path, params, errorHandler = this.handleError) { | ||
@@ -38,0 +50,0 @@ var _a, _b; |
@@ -133,1 +133,9 @@ /// <reference types="ws" /> | ||
}; | ||
export interface CategoryCode { | ||
code: string; | ||
source: string; | ||
description: string; | ||
} | ||
export interface Source { | ||
code: string; | ||
} |
{ | ||
"name": "newsware", | ||
"version": "10.0.0-beta.14", | ||
"version": "10.0.0-beta.15", | ||
"description": "Typescript client for interacting with the Newsware API", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
import { | ||
CategoryCode, | ||
EndpointDescription, | ||
@@ -7,3 +8,4 @@ HistoricalFilter, | ||
RestResponseError, | ||
RestResponseSuccess | ||
RestResponseSuccess, | ||
Source | ||
} from "./types" | ||
@@ -35,2 +37,12 @@ import { Endpoint } from "./enums" | ||
async getCategoryCodes(source: string): Promise<CategoryCode[]> { | ||
return (await this.get<CategoryCode[]>('/category-codes', { | ||
source | ||
})).data; | ||
} | ||
async getSources(): Promise<Source[]> { | ||
return (await (this.get<Source[]>('/sources'))).data; | ||
} | ||
async get<T>( | ||
@@ -37,0 +49,0 @@ path: string, |
@@ -149,2 +149,12 @@ import { CloseEvent } from "isomorphic-ws" | ||
reconnectDelay?: number // In milliseconds | ||
} | ||
export interface CategoryCode { | ||
code: string | ||
source: string | ||
description: string | ||
} | ||
export interface Source { | ||
code: string | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95234
1896
42