@gamecore-api/sdk 0.3.0 → 0.4.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 +37 -1
- package/dist/index.js +13 -5
- package/dist/types.d.ts +37 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -51,12 +51,13 @@ export declare class GameCoreClient {
|
|
|
51
51
|
unlinkProvider: (provider: string) => Promise<void>;
|
|
52
52
|
};
|
|
53
53
|
catalog: {
|
|
54
|
-
/** Get all games with
|
|
54
|
+
/** Get all games. Use inStockOnly:true for only games with products. include:"meta" for categories/deliveryTypes. */
|
|
55
55
|
getGames: (params?: {
|
|
56
56
|
locale?: string;
|
|
57
57
|
type?: string;
|
|
58
58
|
deliveryType?: string;
|
|
59
59
|
include?: string;
|
|
60
|
+
inStockOnly?: boolean;
|
|
60
61
|
}) => Promise<Game[]>;
|
|
61
62
|
/** Get homepage ranked games */
|
|
62
63
|
getHomepageGames: () => Promise<Game[]>;
|
|
@@ -79,6 +80,37 @@ export declare class GameCoreClient {
|
|
|
79
80
|
}>;
|
|
80
81
|
/** Get single product by ID */
|
|
81
82
|
getProduct: (productId: number) => Promise<Product>;
|
|
83
|
+
/** Get bundle discount rules */
|
|
84
|
+
getBundleRules: () => Promise<{
|
|
85
|
+
id: number;
|
|
86
|
+
name: string;
|
|
87
|
+
scope: string;
|
|
88
|
+
minItems: number;
|
|
89
|
+
discountPercent: number;
|
|
90
|
+
}[]>;
|
|
91
|
+
/** Get active promo campaigns */
|
|
92
|
+
getPromos: () => Promise<{
|
|
93
|
+
id: number;
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
value: number;
|
|
97
|
+
scope: string;
|
|
98
|
+
bannerTitle?: string;
|
|
99
|
+
bannerDescription?: string;
|
|
100
|
+
bannerImageUrl?: string;
|
|
101
|
+
bannerColor?: string;
|
|
102
|
+
endsAt?: string;
|
|
103
|
+
}[]>;
|
|
104
|
+
/** Get all games with full metadata (categories, delivery types) */
|
|
105
|
+
getGamesFull: () => Promise<Game[]>;
|
|
106
|
+
/** Validate delivery data before checkout */
|
|
107
|
+
validateDelivery: (productId: number, deliveryData: Record<string, string>) => Promise<{
|
|
108
|
+
valid: boolean;
|
|
109
|
+
errors?: Array<{
|
|
110
|
+
field: string;
|
|
111
|
+
message: string;
|
|
112
|
+
}>;
|
|
113
|
+
}>;
|
|
82
114
|
};
|
|
83
115
|
cart: {
|
|
84
116
|
/** Get cart items for authenticated user */
|
|
@@ -145,6 +177,10 @@ export declare class GameCoreClient {
|
|
|
145
177
|
markRead: (id: number) => Promise<void>;
|
|
146
178
|
/** Mark all notifications as read */
|
|
147
179
|
markAllRead: () => Promise<void>;
|
|
180
|
+
/** Delete user account */
|
|
181
|
+
deleteAccount: () => Promise<void>;
|
|
182
|
+
/** Export user data (GDPR) */
|
|
183
|
+
exportData: () => Promise<Record<string, unknown>>;
|
|
148
184
|
};
|
|
149
185
|
favorites: {
|
|
150
186
|
/** List user's favorite products */
|
package/dist/index.js
CHANGED
|
@@ -115,6 +115,8 @@ class GameCoreClient {
|
|
|
115
115
|
qs.set("deliveryType", params.deliveryType);
|
|
116
116
|
if (params?.include)
|
|
117
117
|
qs.set("include", params.include);
|
|
118
|
+
if (params?.inStockOnly)
|
|
119
|
+
qs.set("inStockOnly", "true");
|
|
118
120
|
const q = qs.toString();
|
|
119
121
|
return this.request("GET", `/catalog/games${q ? `?${q}` : ""}`);
|
|
120
122
|
},
|
|
@@ -140,7 +142,11 @@ class GameCoreClient {
|
|
|
140
142
|
getProductsGrouped: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/products/grouped`),
|
|
141
143
|
search: (query, limit = 20) => this.request("GET", `/catalog/search?q=${encodeURIComponent(query)}&limit=${limit}`),
|
|
142
144
|
searchSuggestions: (query, limit = 5) => this.request("GET", `/catalog/search/suggestions?q=${encodeURIComponent(query)}&limit=${limit}`),
|
|
143
|
-
getProduct: (productId) => this.request("GET", `/catalog/products/${productId}`)
|
|
145
|
+
getProduct: (productId) => this.request("GET", `/catalog/products/${productId}`),
|
|
146
|
+
getBundleRules: () => this.request("GET", "/catalog/bundle-rules"),
|
|
147
|
+
getPromos: () => this.request("GET", "/catalog/promos"),
|
|
148
|
+
getGamesFull: () => this.request("GET", "/catalog/games/full"),
|
|
149
|
+
validateDelivery: (productId, deliveryData) => this.request("POST", "/catalog/validate-delivery", { productId, deliveryData })
|
|
144
150
|
};
|
|
145
151
|
cart = {
|
|
146
152
|
get: () => this.request("GET", "/cart"),
|
|
@@ -178,7 +184,9 @@ class GameCoreClient {
|
|
|
178
184
|
getNotifications: () => this.request("GET", "/profile/notifications"),
|
|
179
185
|
getUnreadCount: () => this.request("GET", "/profile/notifications/unread-count"),
|
|
180
186
|
markRead: (id) => this.request("POST", `/profile/notifications/${id}/read`),
|
|
181
|
-
markAllRead: () => this.request("POST", "/profile/notifications/read-all")
|
|
187
|
+
markAllRead: () => this.request("POST", "/profile/notifications/read-all"),
|
|
188
|
+
deleteAccount: () => this.request("POST", "/profile/delete-account"),
|
|
189
|
+
exportData: () => this.request("GET", "/profile/export")
|
|
182
190
|
};
|
|
183
191
|
favorites = {
|
|
184
192
|
list: () => this.request("GET", "/favorites"),
|
|
@@ -195,7 +203,7 @@ class GameCoreClient {
|
|
|
195
203
|
getStats: () => this.request("GET", "/referral/stats"),
|
|
196
204
|
getLinks: () => this.request("GET", "/referral/links"),
|
|
197
205
|
createLink: (data) => this.request("POST", "/referral/links", data),
|
|
198
|
-
updateLink: (id, data) => this.request("
|
|
206
|
+
updateLink: (id, data) => this.request("PUT", `/referral/links/${id}`, data),
|
|
199
207
|
deleteLink: (id) => this.request("DELETE", `/referral/links/${id}`),
|
|
200
208
|
getLinkStats: (id) => this.request("GET", `/referral/links/${id}/stats`),
|
|
201
209
|
getCommissions: () => this.request("GET", "/referral/commissions")
|
|
@@ -218,7 +226,7 @@ class GameCoreClient {
|
|
|
218
226
|
},
|
|
219
227
|
getRandom: (limit = 5) => this.request("GET", `/reviews/public/random?limit=${limit}`),
|
|
220
228
|
getMine: () => this.request("GET", "/reviews/mine"),
|
|
221
|
-
getPending: () => this.request("GET", "/reviews/
|
|
229
|
+
getPending: () => this.request("GET", "/reviews/pending"),
|
|
222
230
|
create: (orderId, rating, text) => this.request("POST", "/reviews", { orderId, rating, text })
|
|
223
231
|
};
|
|
224
232
|
topup = {
|
|
@@ -229,7 +237,7 @@ class GameCoreClient {
|
|
|
229
237
|
giftCards = {
|
|
230
238
|
purchase: (amountUsd) => this.request("POST", "/gift-cards/purchase", { amountUsd }),
|
|
231
239
|
redeem: (code) => this.request("POST", "/gift-cards/redeem", { code }),
|
|
232
|
-
check: (code) => this.request("GET", `/gift-cards/check
|
|
240
|
+
check: (code) => this.request("GET", `/gift-cards/check/${code}`),
|
|
233
241
|
getMine: () => this.request("GET", "/profile/gift-cards")
|
|
234
242
|
};
|
|
235
243
|
announcements = {
|
package/dist/types.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export interface Game {
|
|
|
54
54
|
icon: string | null;
|
|
55
55
|
localIcon?: string | null;
|
|
56
56
|
productCount: number;
|
|
57
|
+
inStock: boolean;
|
|
57
58
|
minPrice?: number | null;
|
|
58
59
|
type?: string;
|
|
59
60
|
deliveryTypes?: string[];
|
|
@@ -68,7 +69,43 @@ export interface GameDetail {
|
|
|
68
69
|
icon: string | null;
|
|
69
70
|
localIcon?: string | null;
|
|
70
71
|
description: string | null;
|
|
72
|
+
inStock?: boolean;
|
|
73
|
+
productCount?: number;
|
|
71
74
|
categories: Category[];
|
|
75
|
+
seo?: SeoContent | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Per-site SEO content for a game page.
|
|
79
|
+
* Stored in GameCore admin per site and returned with the game detail response.
|
|
80
|
+
* All fields are nullable — filled in by content managers via Claude Code workflow.
|
|
81
|
+
*/
|
|
82
|
+
export interface SeoContent {
|
|
83
|
+
title: string | null;
|
|
84
|
+
h1: string | null;
|
|
85
|
+
metaDescription: string | null;
|
|
86
|
+
metaKeywords: string | null;
|
|
87
|
+
ogTitle: string | null;
|
|
88
|
+
ogDescription: string | null;
|
|
89
|
+
ogImage: string | null;
|
|
90
|
+
canonicalUrl: string | null;
|
|
91
|
+
intro: string | null;
|
|
92
|
+
content: string | null;
|
|
93
|
+
/** Structured content blocks for H2/H3 sections */
|
|
94
|
+
contentSections: Array<{
|
|
95
|
+
heading: string;
|
|
96
|
+
level: number;
|
|
97
|
+
body: string;
|
|
98
|
+
}>;
|
|
99
|
+
faq: Array<{
|
|
100
|
+
question: string;
|
|
101
|
+
answer: string;
|
|
102
|
+
}>;
|
|
103
|
+
keywords: string[];
|
|
104
|
+
/** JSON-LD schema.org object (Product, FAQPage, BreadcrumbList) */
|
|
105
|
+
schemaJsonLd: Record<string, unknown> | null;
|
|
106
|
+
footerText: string | null;
|
|
107
|
+
/** Key cluster identifying the store's SEO theme (e.g. "рублями", "kz-tenge") */
|
|
108
|
+
cluster: string | null;
|
|
72
109
|
}
|
|
73
110
|
export interface Category {
|
|
74
111
|
id: number;
|