@gamecore-api/sdk 0.2.0 → 0.3.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 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;
@@ -73,6 +79,37 @@ export declare class GameCoreClient {
73
79
  }>;
74
80
  /** Get single product by ID */
75
81
  getProduct: (productId: number) => Promise<Product>;
82
+ /** Get bundle discount rules */
83
+ getBundleRules: () => Promise<{
84
+ id: number;
85
+ name: string;
86
+ scope: string;
87
+ minItems: number;
88
+ discountPercent: number;
89
+ }[]>;
90
+ /** Get active promo campaigns */
91
+ getPromos: () => Promise<{
92
+ id: number;
93
+ name: string;
94
+ type: string;
95
+ value: number;
96
+ scope: string;
97
+ bannerTitle?: string;
98
+ bannerDescription?: string;
99
+ bannerImageUrl?: string;
100
+ bannerColor?: string;
101
+ endsAt?: string;
102
+ }[]>;
103
+ /** Get all games with full metadata (categories, delivery types) */
104
+ getGamesFull: () => Promise<Game[]>;
105
+ /** Validate delivery data before checkout */
106
+ validateDelivery: (productId: number, deliveryData: Record<string, string>) => Promise<{
107
+ valid: boolean;
108
+ errors?: Array<{
109
+ field: string;
110
+ message: string;
111
+ }>;
112
+ }>;
76
113
  };
77
114
  cart: {
78
115
  /** Get cart items for authenticated user */
@@ -139,6 +176,10 @@ export declare class GameCoreClient {
139
176
  markRead: (id: number) => Promise<void>;
140
177
  /** Mark all notifications as read */
141
178
  markAllRead: () => Promise<void>;
179
+ /** Delete user account */
180
+ deleteAccount: () => Promise<void>;
181
+ /** Export user data (GDPR) */
182
+ exportData: () => Promise<Record<string, unknown>>;
142
183
  };
143
184
  favorites: {
144
185
  /** List user's favorite products */
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,14 +123,28 @@ 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}`),
127
142
  searchSuggestions: (query, limit = 5) => this.request("GET", `/catalog/search/suggestions?q=${encodeURIComponent(query)}&limit=${limit}`),
128
- getProduct: (productId) => this.request("GET", `/catalog/products/${productId}`)
143
+ getProduct: (productId) => this.request("GET", `/catalog/products/${productId}`),
144
+ getBundleRules: () => this.request("GET", "/catalog/bundle-rules"),
145
+ getPromos: () => this.request("GET", "/catalog/promos"),
146
+ getGamesFull: () => this.request("GET", "/catalog/games/full"),
147
+ validateDelivery: (productId, deliveryData) => this.request("POST", "/catalog/validate-delivery", { productId, deliveryData })
129
148
  };
130
149
  cart = {
131
150
  get: () => this.request("GET", "/cart"),
@@ -163,7 +182,9 @@ class GameCoreClient {
163
182
  getNotifications: () => this.request("GET", "/profile/notifications"),
164
183
  getUnreadCount: () => this.request("GET", "/profile/notifications/unread-count"),
165
184
  markRead: (id) => this.request("POST", `/profile/notifications/${id}/read`),
166
- markAllRead: () => this.request("POST", "/profile/notifications/read-all")
185
+ markAllRead: () => this.request("POST", "/profile/notifications/read-all"),
186
+ deleteAccount: () => this.request("POST", "/profile/delete-account"),
187
+ exportData: () => this.request("GET", "/profile/export")
167
188
  };
168
189
  favorites = {
169
190
  list: () => this.request("GET", "/favorites"),
@@ -180,7 +201,7 @@ class GameCoreClient {
180
201
  getStats: () => this.request("GET", "/referral/stats"),
181
202
  getLinks: () => this.request("GET", "/referral/links"),
182
203
  createLink: (data) => this.request("POST", "/referral/links", data),
183
- updateLink: (id, data) => this.request("PATCH", `/referral/links/${id}`, data),
204
+ updateLink: (id, data) => this.request("PUT", `/referral/links/${id}`, data),
184
205
  deleteLink: (id) => this.request("DELETE", `/referral/links/${id}`),
185
206
  getLinkStats: (id) => this.request("GET", `/referral/links/${id}/stats`),
186
207
  getCommissions: () => this.request("GET", "/referral/commissions")
@@ -203,7 +224,7 @@ class GameCoreClient {
203
224
  },
204
225
  getRandom: (limit = 5) => this.request("GET", `/reviews/public/random?limit=${limit}`),
205
226
  getMine: () => this.request("GET", "/reviews/mine"),
206
- getPending: () => this.request("GET", "/reviews/orders-without-reviews"),
227
+ getPending: () => this.request("GET", "/reviews/pending"),
207
228
  create: (orderId, rating, text) => this.request("POST", "/reviews", { orderId, rating, text })
208
229
  };
209
230
  topup = {
@@ -214,7 +235,7 @@ class GameCoreClient {
214
235
  giftCards = {
215
236
  purchase: (amountUsd) => this.request("POST", "/gift-cards/purchase", { amountUsd }),
216
237
  redeem: (code) => this.request("POST", "/gift-cards/redeem", { code }),
217
- check: (code) => this.request("GET", `/gift-cards/check?code=${code}`),
238
+ check: (code) => this.request("GET", `/gift-cards/check/${code}`),
218
239
  getMine: () => this.request("GET", "/profile/gift-cards")
219
240
  };
220
241
  announcements = {
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.1",
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",