itad-api-client-ts
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,2 +0,2 @@ | ||
import { ItadShop, ItadRegions, ItadDeals, ItadGameSearchParams, ItadGameHistorySearchParams, ItadGameDealSearchParams, ItadPlain, ItadGamesInfo, ItadHistoricalGamesInfo, ItadShopPlains, ItadDealsFull, ItadGamePriceSearchParams, ItadCurrentPrices } from "./types"; | ||
import { ItadShop, ItadRegions, ItadDeals, ItadGameSearchParams, ItadGameHistorySearchParams, ItadGameDealSearchParams, ItadPlain, ItadGamesInfo, ItadHistoricalGamesInfo, ItadShopPlains, ItadDealsFull, ItadGamePriceSearchParams, ItadCurrentPrices, ItadExternalIdPlains } from "./types"; | ||
export declare class IsThereAnyDealApi { | ||
@@ -16,2 +16,3 @@ private readonly BASE_URL; | ||
getPlains(shops: string[]): Promise<ItadShopPlains>; | ||
getPlainsByExternalId(ids: string[], shop: string): Promise<ItadExternalIdPlains>; | ||
getGameInfo(plains: string[]): Promise<ItadGamesInfo>; | ||
@@ -18,0 +19,0 @@ getGamePrices(params: ItadGamePriceSearchParams): Promise<ItadCurrentPrices>; |
@@ -75,2 +75,15 @@ "use strict"; | ||
} | ||
getPlainsByExternalId(ids, shop) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!ids || ids.length === 0) { | ||
throw new Error("Must provide at least one external id. Ex: ['app/12345']."); | ||
} | ||
if (!shop) { | ||
throw new Error("Must provide a shop. Ex: 'steam'"); | ||
} | ||
const idsParam = `ids=${ids ? ids.join(",") : ""}`; | ||
const url = `/v01/game/plain/id/?key=${this.key}&shop=${shop}&${idsParam}`; | ||
return yield this.request(url); | ||
}); | ||
} | ||
getGameInfo(plains) { | ||
@@ -181,3 +194,2 @@ return __awaiter(this, void 0, void 0, function* () { | ||
: err; | ||
console.log(error); | ||
throw error; | ||
@@ -184,0 +196,0 @@ } |
@@ -9,1 +9,4 @@ export declare type ItadPlain = { | ||
}; | ||
export declare type ItadExternalIdPlains = { | ||
[external_id: string]: string; | ||
}; |
{ | ||
"name": "itad-api-client-ts", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A typescript api client/library for the IsThereAnyDeal api.", | ||
@@ -5,0 +5,0 @@ "author": "onowrouzi", |
Sorry, the diff of this file is not supported yet
27742
445