@gamecore-api/sdk 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +37 -1
- package/dist/index.js +6 -0
- package/dist/types.d.ts +45 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Announcement, AnnouncementBar, CartItem, CatalogSection, Category, CheckoutRequest, CheckoutResponse, CompleteWithBalanceResult, Conversation, ConversationDetail, CouponResult, ExchangeRates, Favorite, Game, GameDetail, GiftCard, LegalDocument, LevelStatus, Notification, Order, PagedGamesResponse, PaginatedResponse, PaymentInfo, PaymentMethod, Product, ProductFilters, ReferralCommission, ReferralLink, ReferralPerformance, ReferralStats, Review, ReviewCreateResult, ReviewStats, SearchResult, SiteConfig, SiteStats, SiteUIConfig, TelegramAuthResponse, TelegramBotLoginOptions, TelegramInitResponse, TelegramWidgetRenderOptions, TelegramWidgetUser, TopupMethod, TopupResponse, TopupStatus, Transaction, User, UserBalance, WebPushSubscriptionInput } from "./types";
|
|
1
|
+
import type { Announcement, AnnouncementBar, CartItem, CatalogSection, Category, CategoryInfo, CheckoutRequest, CheckoutResponse, CompleteWithBalanceResult, Conversation, ConversationDetail, CouponResult, ExchangeRates, Favorite, Game, GameDetail, GiftCard, LegalDocument, LevelStatus, Notification, Order, PagedGamesResponse, PlatformInfo, PaginatedResponse, PaymentInfo, PaymentMethod, Product, ProductFilters, ReferralCommission, ReferralLink, ReferralPerformance, ReferralStats, Review, ReviewCreateResult, ReviewStats, SearchResult, SiteConfig, SiteStats, SiteUIConfig, TelegramAuthResponse, TelegramBotLoginOptions, TelegramInitResponse, TelegramWidgetRenderOptions, TelegramWidgetUser, TopupMethod, TopupResponse, TopupStatus, Transaction, User, UserBalance, WebPushSubscriptionInput } from "./types";
|
|
2
2
|
export interface GameCoreOptions {
|
|
3
3
|
/** Site API key (gc_live_xxx or gc_test_xxx) */
|
|
4
4
|
apiKey: string;
|
|
@@ -279,13 +279,49 @@ export declare class GameCoreClient {
|
|
|
279
279
|
page?: number;
|
|
280
280
|
limit?: number;
|
|
281
281
|
locale?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Legacy coarse-grained filter: `"topup"` → mobile donate
|
|
284
|
+
* (keyhub + vendoria), `"cdkey"` → Steam keys (keyhub).
|
|
285
|
+
* Still accepted for backward-compat with early storefront
|
|
286
|
+
* builds.
|
|
287
|
+
*
|
|
288
|
+
* @deprecated Prefer `platform: "mobile_game"` instead of
|
|
289
|
+
* `type: "topup"` and `platform: "steam"` instead of
|
|
290
|
+
* `type: "cdkey"`. Canonical platforms give you facet
|
|
291
|
+
* counts via `getPlatforms()` and survive supplier
|
|
292
|
+
* reshuffles.
|
|
293
|
+
*/
|
|
282
294
|
type?: string;
|
|
283
295
|
deliveryType?: string;
|
|
284
296
|
include?: string;
|
|
285
297
|
inStockOnly?: boolean;
|
|
286
298
|
sort?: "popular" | "name" | "new" | "soldCount";
|
|
287
299
|
q?: string;
|
|
300
|
+
/**
|
|
301
|
+
* Filter by canonical platform slug — "steam", "xbox", "psn",
|
|
302
|
+
* "mobile_game", etc. Use slugs from `getPlatforms()`.
|
|
303
|
+
*/
|
|
304
|
+
platform?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Filter by canonical category slug — "currency",
|
|
307
|
+
* "battle_pass", "bundle", etc. Use slugs from `getCategories()`.
|
|
308
|
+
*/
|
|
309
|
+
category?: string;
|
|
288
310
|
}) => Promise<PagedGamesResponse>;
|
|
311
|
+
/**
|
|
312
|
+
* List distribution platforms present in the site catalog with
|
|
313
|
+
* per-platform game counts (post site-overrides). Drives
|
|
314
|
+
* storefront filter chips. Introduced in task 118 Phase 3.
|
|
315
|
+
*/
|
|
316
|
+
getPlatforms: () => Promise<PlatformInfo[]>;
|
|
317
|
+
/**
|
|
318
|
+
* List canonical category slugs present in the site catalog
|
|
319
|
+
* with per-slug game counts. Use the returned `slug` as the
|
|
320
|
+
* `category` argument to `getGames()`. Not to be confused with
|
|
321
|
+
* `getCategories(gameSlug)` which returns categories of a
|
|
322
|
+
* single game. Introduced in task 119 Phase 3.
|
|
323
|
+
*/
|
|
324
|
+
getCatalogCategories: () => Promise<CategoryInfo[]>;
|
|
289
325
|
/** Get homepage ranked games */
|
|
290
326
|
getHomepageGames: () => Promise<Game[]>;
|
|
291
327
|
/** Get single game with categories */
|
package/dist/index.js
CHANGED
|
@@ -239,9 +239,15 @@ class GameCoreClient {
|
|
|
239
239
|
qs.set("sort", params.sort);
|
|
240
240
|
if (params?.q)
|
|
241
241
|
qs.set("q", params.q);
|
|
242
|
+
if (params?.platform)
|
|
243
|
+
qs.set("platform", params.platform);
|
|
244
|
+
if (params?.category)
|
|
245
|
+
qs.set("category", params.category);
|
|
242
246
|
const q = qs.toString();
|
|
243
247
|
return this.request("GET", `/catalog/games${q ? `?${q}` : ""}`);
|
|
244
248
|
},
|
|
249
|
+
getPlatforms: () => this.request("GET", "/catalog/platforms"),
|
|
250
|
+
getCatalogCategories: () => this.request("GET", "/catalog/categories"),
|
|
245
251
|
getHomepageGames: () => this.request("GET", "/catalog/homepage-games"),
|
|
246
252
|
getGame: (slug, locale) => {
|
|
247
253
|
const qs = locale ? `?locale=${locale}` : "";
|
package/dist/types.d.ts
CHANGED
|
@@ -197,6 +197,17 @@ export interface Game {
|
|
|
197
197
|
type?: string;
|
|
198
198
|
deliveryTypes?: string[];
|
|
199
199
|
categories?: Category[];
|
|
200
|
+
/**
|
|
201
|
+
* Distribution platforms (`steam`, `mobile_game`, `xbox`, `playstation`,
|
|
202
|
+
* `nintendo`, `epic`). Same slugs that `?platform=` filter accepts and
|
|
203
|
+
* that `getPlatforms()` enumerates — single source of truth.
|
|
204
|
+
*
|
|
205
|
+
* Always present in list endpoints (`getGames`, `getHomepageGames`,
|
|
206
|
+
* `getGamesFull`, `getRecentGames`, `getRecommendations`, `search`)
|
|
207
|
+
* and `getGame` since gamecore-api 2026-04-30 — empty array if no
|
|
208
|
+
* platform metadata. Type stays optional for backward-compat with
|
|
209
|
+
* pre-0.17 backends. Treat as `string[]` in modern code.
|
|
210
|
+
*/
|
|
200
211
|
platforms?: string[];
|
|
201
212
|
regions?: string[];
|
|
202
213
|
}
|
|
@@ -297,6 +308,40 @@ export interface Category {
|
|
|
297
308
|
productCount: number;
|
|
298
309
|
deliveryTypes?: string[];
|
|
299
310
|
platforms?: string[];
|
|
311
|
+
/**
|
|
312
|
+
* Canonical category slug (e.g. "currency", "battle_pass"). Present
|
|
313
|
+
* on responses from servers running task 119 Phase 2+. Stable across
|
|
314
|
+
* suppliers — Nexus "Алмазы" and Vendoria "Diamonds" both carry
|
|
315
|
+
* canonicalSlug="currency". Use this (not `name`) for storefront
|
|
316
|
+
* dedup and routing.
|
|
317
|
+
*/
|
|
318
|
+
canonicalSlug?: string | null;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Distribution platform descriptor from GET /catalog/platforms.
|
|
322
|
+
* Use `slug` as the key for ?platform= filter and as a stable identifier
|
|
323
|
+
* across locales. `label` is storefront-ready display text.
|
|
324
|
+
* Introduced by task 118 Phase 3.
|
|
325
|
+
*/
|
|
326
|
+
export interface PlatformInfo {
|
|
327
|
+
slug: string;
|
|
328
|
+
label: string;
|
|
329
|
+
group: string;
|
|
330
|
+
gameCount: number;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Canonical category descriptor from GET /catalog/categories. Use
|
|
334
|
+
* `slug` as the key for ?category= filter. `labelRu`/`labelEn` are
|
|
335
|
+
* storefront-ready display text in each supported UI locale; pick
|
|
336
|
+
* whichever matches the current site locale. Introduced by task 119
|
|
337
|
+
* Phase 3.
|
|
338
|
+
*/
|
|
339
|
+
export interface CategoryInfo {
|
|
340
|
+
slug: string;
|
|
341
|
+
labelRu: string;
|
|
342
|
+
labelEn: string;
|
|
343
|
+
group: string;
|
|
344
|
+
gameCount: number;
|
|
300
345
|
}
|
|
301
346
|
export interface FulfillmentMeta {
|
|
302
347
|
needsPlayerId: boolean;
|