@playcademy/sdk 0.0.1-beta.25 → 0.0.1-beta.27
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/README.md +4 -6
- package/dist/core/client.d.ts +45 -57
- package/dist/core/namespaces/admin.d.ts +20 -20
- package/dist/core/namespaces/auth.d.ts +1 -1
- package/dist/core/namespaces/credits.d.ts +1 -1
- package/dist/core/namespaces/dev.d.ts +9 -9
- package/dist/core/namespaces/games.d.ts +4 -5
- package/dist/core/namespaces/levels.d.ts +2 -2
- package/dist/core/namespaces/maps.d.ts +5 -16
- package/dist/core/namespaces/runtime.d.ts +1 -2
- package/dist/core/namespaces/shop.d.ts +1 -2
- package/dist/core/namespaces/telemetry.d.ts +1 -1
- package/dist/core/namespaces/users.d.ts +2 -2
- package/dist/core/request.d.ts +1 -1
- package/dist/core/static/init.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +543 -4671
- package/dist/types.d.ts +2 -35
- package/dist/types.js +219 -4502
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -36,7 +36,9 @@ const client = await initFromWindow() // initFromWindow is async
|
|
|
36
36
|
For server-side code, UI applications, or other environments where you manage configuration manually:
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
import { PlaycademyClient
|
|
39
|
+
import { PlaycademyClient } from '@playcademy/sdk'
|
|
40
|
+
|
|
41
|
+
import type { LoginResponse } from '@playcademy/sdk'
|
|
40
42
|
|
|
41
43
|
async function initializeAndUseClient() {
|
|
42
44
|
const baseUrl = 'https://api.playcademy.com' // Or your local /api endpoint
|
|
@@ -44,11 +46,7 @@ async function initializeAndUseClient() {
|
|
|
44
46
|
|
|
45
47
|
try {
|
|
46
48
|
// 1. Authenticate to get a token
|
|
47
|
-
loginResponse = await PlaycademyClient.login(
|
|
48
|
-
baseUrl,
|
|
49
|
-
'user@example.com',
|
|
50
|
-
'password',
|
|
51
|
-
)
|
|
49
|
+
loginResponse = await PlaycademyClient.login(baseUrl, 'user@example.com', 'password')
|
|
52
50
|
} catch (error) {
|
|
53
51
|
console.error('Login failed:', error)
|
|
54
52
|
return
|
package/dist/core/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Method } from './request';
|
|
2
1
|
import { init, login } from './static';
|
|
3
2
|
import type { ClientConfig, ClientEvents } from '../types';
|
|
3
|
+
import type { Method } from './request';
|
|
4
4
|
/**
|
|
5
5
|
* Main Playcademy SDK client for interacting with the platform API.
|
|
6
6
|
* Provides namespaced access to all platform features including games, users, inventory, and more.
|
|
@@ -90,16 +90,16 @@ export declare class PlaycademyClient {
|
|
|
90
90
|
runtime: {
|
|
91
91
|
getGameToken: (gameId: string, options?: {
|
|
92
92
|
apply?: boolean;
|
|
93
|
-
}) => Promise<import("
|
|
93
|
+
}) => Promise<import("../types").GameTokenResponse>;
|
|
94
94
|
exit: () => Promise<void>;
|
|
95
95
|
};
|
|
96
96
|
/** Game management methods (fetch, list, saveState, loadState, sessions) */
|
|
97
97
|
games: {
|
|
98
|
-
fetch: (gameIdOrSlug: string) => Promise<import("@playcademy/types").GameWithManifest>;
|
|
99
|
-
list: () => Promise<Array<import("@playcademy/types").Game>>;
|
|
98
|
+
fetch: (gameIdOrSlug: string) => Promise<import("@playcademy/data/types").GameWithManifest>;
|
|
99
|
+
list: () => Promise<Array<import("@playcademy/data/types").Game>>;
|
|
100
100
|
saveState: (state: Record<string, unknown>) => Promise<void>;
|
|
101
|
-
loadState: () => Promise<import("
|
|
102
|
-
startSession: (gameId?: string) => Promise<import("
|
|
101
|
+
loadState: () => Promise<import("@playcademy/data/types").GameStateData>;
|
|
102
|
+
startSession: (gameId?: string) => Promise<import("../types").StartSessionResponse>;
|
|
103
103
|
endSession: (sessionId: string, gameId?: string) => Promise<void>;
|
|
104
104
|
};
|
|
105
105
|
/** User methods (me, inventory management) */
|
|
@@ -117,9 +117,9 @@ export declare class PlaycademyClient {
|
|
|
117
117
|
updatedAt: Date;
|
|
118
118
|
}>;
|
|
119
119
|
inventory: {
|
|
120
|
-
get: () => Promise<import("@playcademy/types").InventoryItemWithItem[]>;
|
|
121
|
-
add: (identifier: string, qty: number) => Promise<import("
|
|
122
|
-
remove: (identifier: string, qty: number) => Promise<import("
|
|
120
|
+
get: () => Promise<import("@playcademy/data/types").InventoryItemWithItem[]>;
|
|
121
|
+
add: (identifier: string, qty: number) => Promise<import("../types").InventoryMutationResponse>;
|
|
122
|
+
remove: (identifier: string, qty: number) => Promise<import("../types").InventoryMutationResponse>;
|
|
123
123
|
quantity: (identifier: string) => Promise<number>;
|
|
124
124
|
has: (identifier: string, minQuantity?: number) => Promise<boolean>;
|
|
125
125
|
};
|
|
@@ -128,11 +128,11 @@ export declare class PlaycademyClient {
|
|
|
128
128
|
dev: {
|
|
129
129
|
auth: {
|
|
130
130
|
applyForDeveloper: () => Promise<void>;
|
|
131
|
-
getDeveloperStatus: () => Promise<import("
|
|
131
|
+
getDeveloperStatus: () => Promise<import("@playcademy/data/types").DeveloperStatusValue>;
|
|
132
132
|
};
|
|
133
133
|
games: {
|
|
134
|
-
upsert: (slug: string, metadata: import("@playcademy/types").UpsertGameMetadataInput, file: File | Blob) => Promise<import("@playcademy/types").Game>;
|
|
135
|
-
update: (gameId: string, props: Partial<import("@playcademy/types").Game>) => Promise<void>;
|
|
134
|
+
upsert: (slug: string, metadata: import("@playcademy/data/types").UpsertGameMetadataInput, file: File | Blob) => Promise<import("@playcademy/data/types").Game>;
|
|
135
|
+
update: (gameId: string, props: Partial<import("@playcademy/data/types").Game>) => Promise<void>;
|
|
136
136
|
delete: (gameId: string) => Promise<void>;
|
|
137
137
|
};
|
|
138
138
|
keys: {
|
|
@@ -153,37 +153,25 @@ export declare class PlaycademyClient {
|
|
|
153
153
|
revokeKey: (keyId: string) => Promise<void>;
|
|
154
154
|
};
|
|
155
155
|
items: {
|
|
156
|
-
create: (gameId: string, slug: string, itemData: Omit<import("@playcademy/types").
|
|
157
|
-
update: (gameId: string, itemId: string, updates: import("@playcademy/types").
|
|
158
|
-
list: (gameId: string) => Promise<Array<import("@playcademy/types").Item>>;
|
|
159
|
-
get: (gameId: string, slug: string) => Promise<import("@playcademy/types").Item>;
|
|
156
|
+
create: (gameId: string, slug: string, itemData: Omit<import("@playcademy/data/types").InsertItemInput, "slug" | "gameId">) => Promise<import("@playcademy/data/types").Item>;
|
|
157
|
+
update: (gameId: string, itemId: string, updates: import("@playcademy/data/types").UpdateItemInput) => Promise<import("@playcademy/data/types").Item>;
|
|
158
|
+
list: (gameId: string) => Promise<Array<import("@playcademy/data/types").Item>>;
|
|
159
|
+
get: (gameId: string, slug: string) => Promise<import("@playcademy/data/types").Item>;
|
|
160
160
|
delete: (gameId: string, itemId: string) => Promise<void>;
|
|
161
161
|
shop: {
|
|
162
|
-
create: (gameId: string, itemId: string, listingData: Omit<import("@playcademy/types").
|
|
163
|
-
get: (gameId: string, itemId: string) => Promise<import("@playcademy/types").ShopListing | null>;
|
|
164
|
-
update: (gameId: string, itemId: string, updates: import("@playcademy/types").
|
|
162
|
+
create: (gameId: string, itemId: string, listingData: Omit<import("@playcademy/data/types").InsertShopListingInput, "itemId">) => Promise<import("@playcademy/data/types").ShopListing>;
|
|
163
|
+
get: (gameId: string, itemId: string) => Promise<import("@playcademy/data/types").ShopListing | null>;
|
|
164
|
+
update: (gameId: string, itemId: string, updates: import("@playcademy/data/types").UpdateShopListingInput) => Promise<import("@playcademy/data/types").ShopListing>;
|
|
165
165
|
delete: (gameId: string, itemId: string) => Promise<void>;
|
|
166
|
-
list: (gameId: string) => Promise<Array<import("@playcademy/types").ShopListing & {
|
|
167
|
-
item: import("@playcademy/types").Item;
|
|
166
|
+
list: (gameId: string) => Promise<Array<import("@playcademy/data/types").ShopListing & {
|
|
167
|
+
item: import("@playcademy/data/types").Item;
|
|
168
168
|
}>>;
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
};
|
|
172
172
|
/** Map methods (elements) */
|
|
173
173
|
maps: {
|
|
174
|
-
elements: (mapId: string) => Promise<
|
|
175
|
-
id: string;
|
|
176
|
-
metadata: ({
|
|
177
|
-
description?: string | undefined;
|
|
178
|
-
sourceTiledObjects?: Record<string, unknown>[] | undefined;
|
|
179
|
-
} & {
|
|
180
|
-
[k: string]: unknown;
|
|
181
|
-
}) | null;
|
|
182
|
-
gameId: string | null;
|
|
183
|
-
mapId: string | null;
|
|
184
|
-
elementSlug: string;
|
|
185
|
-
interactionType: "game_entry" | "game_registry" | "info" | "teleport" | "door_in" | "door_out" | "npc_interaction" | "quest_trigger";
|
|
186
|
-
}[]>;
|
|
174
|
+
elements: (mapId: string) => Promise<import("@playcademy/data/types").MapElementWithGame[]>;
|
|
187
175
|
};
|
|
188
176
|
/** Admin methods (games, items, currencies, shop listings) */
|
|
189
177
|
admin: {
|
|
@@ -192,54 +180,54 @@ export declare class PlaycademyClient {
|
|
|
192
180
|
resumeGame: (gameId: string) => Promise<void>;
|
|
193
181
|
};
|
|
194
182
|
items: {
|
|
195
|
-
create: (props: import("@playcademy/types").
|
|
183
|
+
create: (props: import("@playcademy/data/types").InsertItemInput) => Promise<{
|
|
196
184
|
id: string;
|
|
197
185
|
createdAt: Date;
|
|
198
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
199
|
-
slug: string;
|
|
200
186
|
displayName: string;
|
|
187
|
+
description: string | null;
|
|
188
|
+
slug: string;
|
|
201
189
|
metadata: unknown;
|
|
202
190
|
gameId: string | null;
|
|
203
|
-
|
|
191
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
204
192
|
imageUrl: string | null;
|
|
205
193
|
}>;
|
|
206
194
|
get: (itemId: string) => Promise<{
|
|
207
195
|
id: string;
|
|
208
196
|
createdAt: Date;
|
|
209
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
210
|
-
slug: string;
|
|
211
197
|
displayName: string;
|
|
198
|
+
description: string | null;
|
|
199
|
+
slug: string;
|
|
212
200
|
metadata: unknown;
|
|
213
201
|
gameId: string | null;
|
|
214
|
-
|
|
202
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
215
203
|
imageUrl: string | null;
|
|
216
204
|
}>;
|
|
217
205
|
list: () => Promise<{
|
|
218
206
|
id: string;
|
|
219
207
|
createdAt: Date;
|
|
220
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
221
|
-
slug: string;
|
|
222
208
|
displayName: string;
|
|
209
|
+
description: string | null;
|
|
210
|
+
slug: string;
|
|
223
211
|
metadata: unknown;
|
|
224
212
|
gameId: string | null;
|
|
225
|
-
|
|
213
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
226
214
|
imageUrl: string | null;
|
|
227
215
|
}[]>;
|
|
228
|
-
update: (itemId: string, props: import("@playcademy/types").
|
|
216
|
+
update: (itemId: string, props: import("@playcademy/data/types").UpdateItemInput) => Promise<{
|
|
229
217
|
id: string;
|
|
230
218
|
createdAt: Date;
|
|
231
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
232
|
-
slug: string;
|
|
233
219
|
displayName: string;
|
|
220
|
+
description: string | null;
|
|
221
|
+
slug: string;
|
|
234
222
|
metadata: unknown;
|
|
235
223
|
gameId: string | null;
|
|
236
|
-
|
|
224
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
237
225
|
imageUrl: string | null;
|
|
238
226
|
}>;
|
|
239
227
|
delete: (itemId: string) => Promise<void>;
|
|
240
228
|
};
|
|
241
229
|
currencies: {
|
|
242
|
-
create: (props: import("@playcademy/types").
|
|
230
|
+
create: (props: import("@playcademy/data/types").InsertCurrencyInput) => Promise<{
|
|
243
231
|
symbol: string | null;
|
|
244
232
|
id: string;
|
|
245
233
|
createdAt: Date;
|
|
@@ -263,7 +251,7 @@ export declare class PlaycademyClient {
|
|
|
263
251
|
itemId: string;
|
|
264
252
|
isPrimary: boolean;
|
|
265
253
|
}[]>;
|
|
266
|
-
update: (currencyId: string, props: import("@playcademy/types").
|
|
254
|
+
update: (currencyId: string, props: import("@playcademy/data/types").UpdateCurrencyInput) => Promise<{
|
|
267
255
|
symbol: string | null;
|
|
268
256
|
id: string;
|
|
269
257
|
createdAt: Date;
|
|
@@ -274,7 +262,7 @@ export declare class PlaycademyClient {
|
|
|
274
262
|
delete: (currencyId: string) => Promise<void>;
|
|
275
263
|
};
|
|
276
264
|
shopListings: {
|
|
277
|
-
create: (props: import("@playcademy/types").
|
|
265
|
+
create: (props: import("@playcademy/data/types").InsertShopListingInput) => Promise<{
|
|
278
266
|
id: string;
|
|
279
267
|
createdAt: Date;
|
|
280
268
|
updatedAt: Date | null;
|
|
@@ -313,7 +301,7 @@ export declare class PlaycademyClient {
|
|
|
313
301
|
availableFrom: Date | null;
|
|
314
302
|
availableUntil: Date | null;
|
|
315
303
|
}[]>;
|
|
316
|
-
update: (listingId: string, props: import("@playcademy/types").
|
|
304
|
+
update: (listingId: string, props: import("@playcademy/data/types").UpdateShopListingInput) => Promise<{
|
|
317
305
|
id: string;
|
|
318
306
|
createdAt: Date;
|
|
319
307
|
updatedAt: Date | null;
|
|
@@ -331,21 +319,21 @@ export declare class PlaycademyClient {
|
|
|
331
319
|
};
|
|
332
320
|
/** Shop methods (view) */
|
|
333
321
|
shop: {
|
|
334
|
-
view: () => Promise<import("
|
|
322
|
+
view: () => Promise<import("@playcademy/data/types").ShopViewResponse>;
|
|
335
323
|
};
|
|
336
324
|
/** Level methods (levels) */
|
|
337
325
|
levels: {
|
|
338
|
-
get: () => Promise<import("@playcademy/types").UserLevel>;
|
|
326
|
+
get: () => Promise<import("@playcademy/data/types").UserLevel>;
|
|
339
327
|
progress: () => Promise<{
|
|
340
328
|
level: number;
|
|
341
329
|
currentXp: number;
|
|
342
330
|
xpToNextLevel: number;
|
|
343
331
|
totalXP: number;
|
|
344
332
|
}>;
|
|
345
|
-
addXP: (amount: number) => Promise<import("@playcademy/types").XPAddResult>;
|
|
333
|
+
addXP: (amount: number) => Promise<import("@playcademy/data/types").XPAddResult>;
|
|
346
334
|
config: {
|
|
347
|
-
list: () => Promise<import("@playcademy/types").LevelConfig[]>;
|
|
348
|
-
get: (level: number) => Promise<import("@playcademy/types").LevelConfig | null>;
|
|
335
|
+
list: () => Promise<import("@playcademy/data/types").LevelConfig[]>;
|
|
336
|
+
get: (level: number) => Promise<import("@playcademy/data/types").LevelConfig | null>;
|
|
349
337
|
};
|
|
350
338
|
};
|
|
351
339
|
/** Telemetry methods (pushMetrics) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { InsertCurrencyInput, InsertItemInput, InsertShopListingInput, UpdateCurrencyInput, UpdateItemInput, UpdateShopListingInput } from '@playcademy/data/types';
|
|
2
|
+
import type { PlaycademyClient } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Creates the admin namespace for the PlaycademyClient.
|
|
5
5
|
* Provides administrative methods for managing games, items, currencies, and shop listings.
|
|
@@ -59,15 +59,15 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
59
59
|
* })
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
create: (props:
|
|
62
|
+
create: (props: InsertItemInput) => Promise<{
|
|
63
63
|
id: string;
|
|
64
64
|
createdAt: Date;
|
|
65
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
66
|
-
slug: string;
|
|
67
65
|
displayName: string;
|
|
66
|
+
description: string | null;
|
|
67
|
+
slug: string;
|
|
68
68
|
metadata: unknown;
|
|
69
69
|
gameId: string | null;
|
|
70
|
-
|
|
70
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
71
71
|
imageUrl: string | null;
|
|
72
72
|
}>;
|
|
73
73
|
/**
|
|
@@ -85,12 +85,12 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
85
85
|
get: (itemId: string) => Promise<{
|
|
86
86
|
id: string;
|
|
87
87
|
createdAt: Date;
|
|
88
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
89
|
-
slug: string;
|
|
90
88
|
displayName: string;
|
|
89
|
+
description: string | null;
|
|
90
|
+
slug: string;
|
|
91
91
|
metadata: unknown;
|
|
92
92
|
gameId: string | null;
|
|
93
|
-
|
|
93
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
94
94
|
imageUrl: string | null;
|
|
95
95
|
}>;
|
|
96
96
|
/**
|
|
@@ -107,12 +107,12 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
107
107
|
list: () => Promise<{
|
|
108
108
|
id: string;
|
|
109
109
|
createdAt: Date;
|
|
110
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
111
|
-
slug: string;
|
|
112
110
|
displayName: string;
|
|
111
|
+
description: string | null;
|
|
112
|
+
slug: string;
|
|
113
113
|
metadata: unknown;
|
|
114
114
|
gameId: string | null;
|
|
115
|
-
|
|
115
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
116
116
|
imageUrl: string | null;
|
|
117
117
|
}[]>;
|
|
118
118
|
/**
|
|
@@ -129,15 +129,15 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
129
129
|
* })
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
|
-
update: (itemId: string, props:
|
|
132
|
+
update: (itemId: string, props: UpdateItemInput) => Promise<{
|
|
133
133
|
id: string;
|
|
134
134
|
createdAt: Date;
|
|
135
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
136
|
-
slug: string;
|
|
137
135
|
displayName: string;
|
|
136
|
+
description: string | null;
|
|
137
|
+
slug: string;
|
|
138
138
|
metadata: unknown;
|
|
139
139
|
gameId: string | null;
|
|
140
|
-
|
|
140
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
141
141
|
imageUrl: string | null;
|
|
142
142
|
}>;
|
|
143
143
|
/**
|
|
@@ -173,7 +173,7 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
173
173
|
* })
|
|
174
174
|
* ```
|
|
175
175
|
*/
|
|
176
|
-
create: (props:
|
|
176
|
+
create: (props: InsertCurrencyInput) => Promise<{
|
|
177
177
|
symbol: string | null;
|
|
178
178
|
id: string;
|
|
179
179
|
createdAt: Date;
|
|
@@ -234,7 +234,7 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
234
234
|
* })
|
|
235
235
|
* ```
|
|
236
236
|
*/
|
|
237
|
-
update: (currencyId: string, props:
|
|
237
|
+
update: (currencyId: string, props: UpdateCurrencyInput) => Promise<{
|
|
238
238
|
symbol: string | null;
|
|
239
239
|
id: string;
|
|
240
240
|
createdAt: Date;
|
|
@@ -275,7 +275,7 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
275
275
|
* })
|
|
276
276
|
* ```
|
|
277
277
|
*/
|
|
278
|
-
create: (props:
|
|
278
|
+
create: (props: InsertShopListingInput) => Promise<{
|
|
279
279
|
id: string;
|
|
280
280
|
createdAt: Date;
|
|
281
281
|
updatedAt: Date | null;
|
|
@@ -351,7 +351,7 @@ export declare function createAdminNamespace(client: PlaycademyClient): {
|
|
|
351
351
|
* })
|
|
352
352
|
* ```
|
|
353
353
|
*/
|
|
354
|
-
update: (listingId: string, props:
|
|
354
|
+
update: (listingId: string, props: UpdateShopListingInput) => Promise<{
|
|
355
355
|
id: string;
|
|
356
356
|
createdAt: Date;
|
|
357
357
|
updatedAt: Date | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { PlaycademyClient } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Creates the credits namespace for the PlaycademyClient.
|
|
4
4
|
* Provides convenient methods for working with Playcademy Credits (the primary platform currency).
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { DeveloperStatusValue } from '../../types';
|
|
1
|
+
import type { DeveloperStatusValue, Game, InsertItemInput, InsertShopListingInput, Item, ShopListing, UpdateItemInput, UpdateShopListingInput, UpsertGameMetadataInput } from '@playcademy/data/types';
|
|
2
|
+
import type { PlaycademyClient } from '../../types';
|
|
4
3
|
/**
|
|
5
4
|
* Creates the developer namespace for the PlaycademyClient.
|
|
6
5
|
* Provides methods for developer account management, game publishing, API key management, and item management.
|
|
@@ -56,8 +55,9 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
56
55
|
* ```typescript
|
|
57
56
|
* const gameFile = new File([zipData], 'game.zip')
|
|
58
57
|
* const game = await client.dev.games.upsert('my-game', {
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* displayName: 'My Awesome Game',
|
|
59
|
+
* platform: 'web',
|
|
60
|
+
* metadata: { description: 'A fun puzzle game' }
|
|
61
61
|
* }, gameFile)
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
@@ -170,7 +170,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
170
170
|
* })
|
|
171
171
|
* ```
|
|
172
172
|
*/
|
|
173
|
-
create: (gameId: string, slug: string, itemData: Omit<
|
|
173
|
+
create: (gameId: string, slug: string, itemData: Omit<InsertItemInput, "slug" | "gameId">) => Promise<Item>;
|
|
174
174
|
/**
|
|
175
175
|
* Updates an existing game-scoped item.
|
|
176
176
|
*
|
|
@@ -187,7 +187,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
187
187
|
* })
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
190
|
-
update: (gameId: string, itemId: string, updates:
|
|
190
|
+
update: (gameId: string, itemId: string, updates: UpdateItemInput) => Promise<Item>;
|
|
191
191
|
/**
|
|
192
192
|
* Lists all items for a specific game.
|
|
193
193
|
*
|
|
@@ -253,7 +253,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
253
253
|
* })
|
|
254
254
|
* ```
|
|
255
255
|
*/
|
|
256
|
-
create: (gameId: string, itemId: string, listingData: Omit<
|
|
256
|
+
create: (gameId: string, itemId: string, listingData: Omit<InsertShopListingInput, "itemId">) => Promise<ShopListing>;
|
|
257
257
|
/**
|
|
258
258
|
* Gets the shop listing for a specific game item.
|
|
259
259
|
*
|
|
@@ -286,7 +286,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
286
286
|
* })
|
|
287
287
|
* ```
|
|
288
288
|
*/
|
|
289
|
-
update: (gameId: string, itemId: string, updates:
|
|
289
|
+
update: (gameId: string, itemId: string, updates: UpdateShopListingInput) => Promise<ShopListing>;
|
|
290
290
|
/**
|
|
291
291
|
* Removes the shop listing for a game item.
|
|
292
292
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { GameState, StartSessionResponse } from '../../types';
|
|
1
|
+
import type { Game, GameStateData, GameWithManifest } from '@playcademy/data/types';
|
|
2
|
+
import type { PlaycademyClient, StartSessionResponse } from '../../types';
|
|
4
3
|
/**
|
|
5
4
|
* Creates the games namespace for the PlaycademyClient.
|
|
6
5
|
* Provides methods for managing games, game state, and game sessions.
|
|
@@ -57,7 +56,7 @@ export declare function createGamesNamespace(client: PlaycademyClient): {
|
|
|
57
56
|
* Loads the saved game state from the server.
|
|
58
57
|
* Requires a gameId to be configured in the client.
|
|
59
58
|
*
|
|
60
|
-
* @returns Promise resolving to the saved game state
|
|
59
|
+
* @returns Promise resolving to the saved game state data
|
|
61
60
|
*
|
|
62
61
|
* @example
|
|
63
62
|
* ```typescript
|
|
@@ -65,7 +64,7 @@ export declare function createGamesNamespace(client: PlaycademyClient): {
|
|
|
65
64
|
* console.log('Current level:', state.level)
|
|
66
65
|
* ```
|
|
67
66
|
*/
|
|
68
|
-
loadState: () => Promise<
|
|
67
|
+
loadState: () => Promise<GameStateData>;
|
|
69
68
|
/**
|
|
70
69
|
* Starts a new game session.
|
|
71
70
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { LevelConfig, UserLevel, XPAddResult } from '@playcademy/data/types';
|
|
2
|
+
import type { PlaycademyClient } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Creates the levels namespace for the PlaycademyClient.
|
|
5
5
|
* Provides methods for managing user levels and experience points.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MapElementWithGame } from '@playcademy/data/types';
|
|
2
|
+
import type { PlaycademyClient } from '../../types';
|
|
2
3
|
/**
|
|
3
4
|
* Creates the maps namespace for the PlaycademyClient.
|
|
4
5
|
* Provides methods for retrieving map data and elements.
|
|
@@ -11,27 +12,15 @@ export declare function createMapsNamespace(client: PlaycademyClient): {
|
|
|
11
12
|
* Retrieves all elements for a specific map.
|
|
12
13
|
*
|
|
13
14
|
* @param mapId - The ID of the map to get elements for
|
|
14
|
-
* @returns Promise resolving to array of map elements
|
|
15
|
+
* @returns Promise resolving to array of map elements with game data
|
|
15
16
|
*
|
|
16
17
|
* @example
|
|
17
18
|
* ```typescript
|
|
18
19
|
* const elements = await client.maps.elements('map-123')
|
|
19
20
|
* elements.forEach(element => {
|
|
20
|
-
* console.log(`Element: ${element.
|
|
21
|
+
* console.log(`Element: ${element.elementSlug} - Game: ${element.game?.displayName || 'None'}`)
|
|
21
22
|
* })
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
|
-
elements: (mapId: string) => Promise<
|
|
25
|
-
id: string;
|
|
26
|
-
metadata: ({
|
|
27
|
-
description?: string | undefined;
|
|
28
|
-
sourceTiledObjects?: Record<string, unknown>[] | undefined;
|
|
29
|
-
} & {
|
|
30
|
-
[k: string]: unknown;
|
|
31
|
-
}) | null;
|
|
32
|
-
gameId: string | null;
|
|
33
|
-
mapId: string | null;
|
|
34
|
-
elementSlug: string;
|
|
35
|
-
interactionType: "game_entry" | "game_registry" | "info" | "teleport" | "door_in" | "door_out" | "npc_interaction" | "quest_trigger";
|
|
36
|
-
}[]>;
|
|
25
|
+
elements: (mapId: string) => Promise<MapElementWithGame[]>;
|
|
37
26
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
2
|
-
import type { GameTokenResponse } from '../../types';
|
|
1
|
+
import type { GameTokenResponse, PlaycademyClient } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Creates the runtime namespace for the PlaycademyClient.
|
|
5
4
|
* Provides methods for managing game runtime operations and lifecycle.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
2
|
-
import type { ShopViewResponse } from '../../types';
|
|
1
|
+
import type { PlaycademyClient, ShopViewResponse } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Creates the shop namespace for the PlaycademyClient.
|
|
5
4
|
* Provides methods for viewing shop listings and items available for purchase.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InventoryItemWithItem
|
|
2
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { InventoryItemWithItem } from '@playcademy/data/types';
|
|
2
|
+
import type { InventoryMutationResponse, PlaycademyClient } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Creates the users namespace for the PlaycademyClient.
|
|
5
5
|
* Provides methods for managing user data and inventory operations.
|
package/dist/core/request.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { PlaycademyClient } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Auto-initializes a PlaycademyClient with context from the environment.
|
|
4
4
|
* Works in both iframe mode (production/development) and standalone mode (local dev).
|
package/dist/index.d.ts
CHANGED