@gamecore-api/sdk 0.16.0 → 0.17.0

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 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;
@@ -285,7 +285,31 @@ export declare class GameCoreClient {
285
285
  inStockOnly?: boolean;
286
286
  sort?: "popular" | "name" | "new" | "soldCount";
287
287
  q?: string;
288
+ /**
289
+ * Filter by canonical platform slug — "steam", "xbox", "psn",
290
+ * "mobile_game", etc. Use slugs from `getPlatforms()`.
291
+ */
292
+ platform?: string;
293
+ /**
294
+ * Filter by canonical category slug — "currency",
295
+ * "battle_pass", "bundle", etc. Use slugs from `getCategories()`.
296
+ */
297
+ category?: string;
288
298
  }) => Promise<PagedGamesResponse>;
299
+ /**
300
+ * List distribution platforms present in the site catalog with
301
+ * per-platform game counts (post site-overrides). Drives
302
+ * storefront filter chips. Introduced in task 118 Phase 3.
303
+ */
304
+ getPlatforms: () => Promise<PlatformInfo[]>;
305
+ /**
306
+ * List canonical category slugs present in the site catalog
307
+ * with per-slug game counts. Use the returned `slug` as the
308
+ * `category` argument to `getGames()`. Not to be confused with
309
+ * `getCategories(gameSlug)` which returns categories of a
310
+ * single game. Introduced in task 119 Phase 3.
311
+ */
312
+ getCatalogCategories: () => Promise<CategoryInfo[]>;
289
313
  /** Get homepage ranked games */
290
314
  getHomepageGames: () => Promise<Game[]>;
291
315
  /** 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
@@ -297,6 +297,40 @@ export interface Category {
297
297
  productCount: number;
298
298
  deliveryTypes?: string[];
299
299
  platforms?: string[];
300
+ /**
301
+ * Canonical category slug (e.g. "currency", "battle_pass"). Present
302
+ * on responses from servers running task 119 Phase 2+. Stable across
303
+ * suppliers — Nexus "Алмазы" and Vendoria "Diamonds" both carry
304
+ * canonicalSlug="currency". Use this (not `name`) for storefront
305
+ * dedup and routing.
306
+ */
307
+ canonicalSlug?: string | null;
308
+ }
309
+ /**
310
+ * Distribution platform descriptor from GET /catalog/platforms.
311
+ * Use `slug` as the key for ?platform= filter and as a stable identifier
312
+ * across locales. `label` is storefront-ready display text.
313
+ * Introduced by task 118 Phase 3.
314
+ */
315
+ export interface PlatformInfo {
316
+ slug: string;
317
+ label: string;
318
+ group: string;
319
+ gameCount: number;
320
+ }
321
+ /**
322
+ * Canonical category descriptor from GET /catalog/categories. Use
323
+ * `slug` as the key for ?category= filter. `labelRu`/`labelEn` are
324
+ * storefront-ready display text in each supported UI locale; pick
325
+ * whichever matches the current site locale. Introduced by task 119
326
+ * Phase 3.
327
+ */
328
+ export interface CategoryInfo {
329
+ slug: string;
330
+ labelRu: string;
331
+ labelEn: string;
332
+ group: string;
333
+ gameCount: number;
300
334
  }
301
335
  export interface FulfillmentMeta {
302
336
  needsPlayerId: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamecore-api/sdk",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "TypeScript SDK for GameCore API — browser-safe, zero dependencies",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",