@gamecore-api/sdk 0.2.0 → 0.3.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 { TelegramInitResponse, User, SiteConfig, ExchangeRates, LegalDocument, Game, GameDetail, Product, SearchResult, Category, CartItem, CheckoutRequest, CheckoutResponse, Order, UserBalance, LevelStatus, Transaction, Notification, Favorite, Review, ReviewStats, CouponResult, ReferralStats, ReferralLink, ReferralCommission, TopupMethod, TopupResponse, TopupStatus, GiftCard, Announcement, PaginatedResponse } from "./types";
1
+ import type { TelegramInitResponse, User, SiteConfig, ExchangeRates, LegalDocument, Game, GameDetail, Product, SearchResult, Category, CartItem, CheckoutRequest, CheckoutResponse, Order, UserBalance, LevelStatus, Transaction, Notification, Favorite, Review, ReviewStats, CouponResult, ReferralStats, ReferralLink, ReferralCommission, TopupMethod, TopupResponse, TopupStatus, GiftCard, Announcement, AnnouncementBar, ProductFilters, PaginatedResponse } from "./types";
2
2
  export interface GameCoreOptions {
3
3
  /** Site API key (gc_live_xxx or gc_test_xxx) */
4
4
  apiKey: string;
@@ -20,6 +20,8 @@ export declare class GameCoreClient {
20
20
  getRates: () => Promise<ExchangeRates>;
21
21
  /** Get legal document by type (privacy, terms, etc.) */
22
22
  getLegal: (type: string, locale?: string) => Promise<LegalDocument>;
23
+ /** Get announcement bar settings (text, link, enabled) */
24
+ getAnnouncementBar: () => Promise<AnnouncementBar>;
23
25
  };
24
26
  auth: {
25
27
  /** Start Telegram auth flow → returns bot link for user to click */
@@ -49,17 +51,21 @@ export declare class GameCoreClient {
49
51
  unlinkProvider: (provider: string) => Promise<void>;
50
52
  };
51
53
  catalog: {
52
- /** Get all games with product counts */
54
+ /** Get all games with product counts. Use include:"meta" for categories/deliveryTypes/platforms/regions. */
53
55
  getGames: (params?: {
54
56
  locale?: string;
55
57
  type?: string;
58
+ deliveryType?: string;
59
+ include?: string;
56
60
  }) => Promise<Game[]>;
57
61
  /** Get homepage ranked games */
58
62
  getHomepageGames: () => Promise<Game[]>;
59
63
  /** Get single game with categories */
60
64
  getGame: (slug: string, locale?: string) => Promise<GameDetail>;
61
- /** Get products for a game */
62
- getProducts: (gameSlug: string, categorySlug?: string) => Promise<Product[]>;
65
+ /** Get categories for a game with product counts and delivery metadata */
66
+ getCategories: (gameSlug: string) => Promise<Category[]>;
67
+ /** Get products for a game with optional filters */
68
+ getProducts: (gameSlug: string, filters?: ProductFilters) => Promise<Product[]>;
63
69
  /** Get products grouped by category */
64
70
  getProductsGrouped: (gameSlug: string) => Promise<{
65
71
  category: Category;
package/dist/index.js CHANGED
@@ -75,7 +75,8 @@ class GameCoreClient {
75
75
  site = {
76
76
  getConfig: () => this.request("GET", "/site/config"),
77
77
  getRates: () => this.request("GET", "/rates"),
78
- getLegal: (type, locale) => this.request("GET", `/legal/${type}${locale ? `?locale=${locale}` : ""}`)
78
+ getLegal: (type, locale) => this.request("GET", `/legal/${type}${locale ? `?locale=${locale}` : ""}`),
79
+ getAnnouncementBar: () => this.request("GET", "/site/announcement-bar")
79
80
  };
80
81
  auth = {
81
82
  initTelegram: () => this.request("POST", "/auth/telegram/init"),
@@ -110,6 +111,10 @@ class GameCoreClient {
110
111
  qs.set("locale", params.locale);
111
112
  if (params?.type)
112
113
  qs.set("type", params.type);
114
+ if (params?.deliveryType)
115
+ qs.set("deliveryType", params.deliveryType);
116
+ if (params?.include)
117
+ qs.set("include", params.include);
113
118
  const q = qs.toString();
114
119
  return this.request("GET", `/catalog/games${q ? `?${q}` : ""}`);
115
120
  },
@@ -118,9 +123,19 @@ class GameCoreClient {
118
123
  const qs = locale ? `?locale=${locale}` : "";
119
124
  return this.request("GET", `/catalog/games/${slug}${qs}`);
120
125
  },
121
- getProducts: (gameSlug, categorySlug) => {
122
- const qs = categorySlug ? `?category=${categorySlug}` : "";
123
- return this.request("GET", `/catalog/games/${gameSlug}/products${qs}`);
126
+ getCategories: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/categories`),
127
+ getProducts: (gameSlug, filters) => {
128
+ const qs = new URLSearchParams;
129
+ if (filters?.deliveryType)
130
+ qs.set("deliveryType", filters.deliveryType);
131
+ if (filters?.region)
132
+ qs.set("region", filters.region);
133
+ if (filters?.platform)
134
+ qs.set("platform", filters.platform);
135
+ if (filters?.categoryId)
136
+ qs.set("categoryId", String(filters.categoryId));
137
+ const q = qs.toString();
138
+ return this.request("GET", `/catalog/games/${gameSlug}/products${q ? `?${q}` : ""}`);
124
139
  },
125
140
  getProductsGrouped: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/products/grouped`),
126
141
  search: (query, limit = 20) => this.request("GET", `/catalog/search?q=${encodeURIComponent(query)}&limit=${limit}`),
package/dist/types.d.ts CHANGED
@@ -56,6 +56,10 @@ export interface Game {
56
56
  productCount: number;
57
57
  minPrice?: number | null;
58
58
  type?: string;
59
+ deliveryTypes?: string[];
60
+ categories?: Category[];
61
+ platforms?: string[];
62
+ regions?: string[];
59
63
  }
60
64
  export interface GameDetail {
61
65
  id: number;
@@ -71,6 +75,21 @@ export interface Category {
71
75
  slug: string;
72
76
  name: string;
73
77
  productCount: number;
78
+ deliveryTypes?: string[];
79
+ platforms?: string[];
80
+ }
81
+ export interface FulfillmentMeta {
82
+ needsPlayerId: boolean;
83
+ needsLogin: boolean;
84
+ needsEmail: boolean;
85
+ isGiftCode: boolean;
86
+ isAutoDelivery: boolean;
87
+ inputFields: Array<{
88
+ id: string;
89
+ label: string;
90
+ type: string;
91
+ required: boolean;
92
+ }>;
74
93
  }
75
94
  export interface Product {
76
95
  id: number;
@@ -84,9 +103,19 @@ export interface Product {
84
103
  gameIcon: string | null;
85
104
  categoryId: number;
86
105
  categoryName: string;
106
+ categorySlug?: string;
87
107
  productType: string;
108
+ deliveryType?: string;
109
+ fulfillment?: FulfillmentMeta;
88
110
  deliveryDataSchema: unknown[];
89
111
  region?: string;
112
+ platform?: string;
113
+ }
114
+ export interface ProductFilters {
115
+ deliveryType?: string;
116
+ region?: string;
117
+ platform?: string;
118
+ categoryId?: number;
90
119
  }
91
120
  export interface SearchResult {
92
121
  games: Game[];
@@ -313,6 +342,11 @@ export interface Announcement {
313
342
  imageUrl?: string | null;
314
343
  createdAt: string;
315
344
  }
345
+ export interface AnnouncementBar {
346
+ enabled: boolean;
347
+ text: string;
348
+ link: string | null;
349
+ }
316
350
  export interface OrderUpdateEvent {
317
351
  orderId: number;
318
352
  orderCode: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamecore-api/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.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",