@playcademy/sdk 0.0.1-beta.25 → 0.0.1-beta.26
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 +52 -52
- 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 +6 -7
- package/dist/core/namespaces/games.d.ts +8 -4
- package/dist/core/namespaces/levels.d.ts +2 -2
- package/dist/core/namespaces/maps.d.ts +4 -9
- 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 +476 -4666
- package/dist/types.d.ts +2 -35
- package/dist/types.js +219 -4502
- package/package.json +6 -4
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,21 @@ 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<
|
|
102
|
-
|
|
101
|
+
loadState: () => Promise<{
|
|
102
|
+
data: unknown;
|
|
103
|
+
updatedAt: Date | null;
|
|
104
|
+
userId: string;
|
|
105
|
+
gameId: string;
|
|
106
|
+
}>;
|
|
107
|
+
startSession: (gameId?: string) => Promise<import("../types").StartSessionResponse>;
|
|
103
108
|
endSession: (sessionId: string, gameId?: string) => Promise<void>;
|
|
104
109
|
};
|
|
105
110
|
/** User methods (me, inventory management) */
|
|
@@ -117,9 +122,9 @@ export declare class PlaycademyClient {
|
|
|
117
122
|
updatedAt: Date;
|
|
118
123
|
}>;
|
|
119
124
|
inventory: {
|
|
120
|
-
get: () => Promise<import("@playcademy/types").InventoryItemWithItem[]>;
|
|
121
|
-
add: (identifier: string, qty: number) => Promise<import("
|
|
122
|
-
remove: (identifier: string, qty: number) => Promise<import("
|
|
125
|
+
get: () => Promise<import("@playcademy/data/types").InventoryItemWithItem[]>;
|
|
126
|
+
add: (identifier: string, qty: number) => Promise<import("../types").InventoryMutationResponse>;
|
|
127
|
+
remove: (identifier: string, qty: number) => Promise<import("../types").InventoryMutationResponse>;
|
|
123
128
|
quantity: (identifier: string) => Promise<number>;
|
|
124
129
|
has: (identifier: string, minQuantity?: number) => Promise<boolean>;
|
|
125
130
|
};
|
|
@@ -128,11 +133,11 @@ export declare class PlaycademyClient {
|
|
|
128
133
|
dev: {
|
|
129
134
|
auth: {
|
|
130
135
|
applyForDeveloper: () => Promise<void>;
|
|
131
|
-
getDeveloperStatus: () => Promise<import("
|
|
136
|
+
getDeveloperStatus: () => Promise<import("@playcademy/data/types").DeveloperStatusValue>;
|
|
132
137
|
};
|
|
133
138
|
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>;
|
|
139
|
+
upsert: (slug: string, metadata: import("@playcademy/data/types").UpsertGameMetadataInput, file: File | Blob) => Promise<import("@playcademy/data/types").Game>;
|
|
140
|
+
update: (gameId: string, props: Partial<import("@playcademy/data/types").Game>) => Promise<void>;
|
|
136
141
|
delete: (gameId: string) => Promise<void>;
|
|
137
142
|
};
|
|
138
143
|
keys: {
|
|
@@ -153,18 +158,18 @@ export declare class PlaycademyClient {
|
|
|
153
158
|
revokeKey: (keyId: string) => Promise<void>;
|
|
154
159
|
};
|
|
155
160
|
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>;
|
|
161
|
+
create: (gameId: string, slug: string, itemData: Omit<import("@playcademy/data/types").InsertItemInput, "slug" | "gameId">) => Promise<import("@playcademy/data/types").Item>;
|
|
162
|
+
update: (gameId: string, itemId: string, updates: import("@playcademy/data/types").UpdateItemInput) => Promise<import("@playcademy/data/types").Item>;
|
|
163
|
+
list: (gameId: string) => Promise<Array<import("@playcademy/data/types").Item>>;
|
|
164
|
+
get: (gameId: string, slug: string) => Promise<import("@playcademy/data/types").Item>;
|
|
160
165
|
delete: (gameId: string, itemId: string) => Promise<void>;
|
|
161
166
|
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").
|
|
167
|
+
create: (gameId: string, itemId: string, listingData: Omit<import("@playcademy/data/types").InsertShopListingInput, "itemId">) => Promise<import("@playcademy/data/types").ShopListing>;
|
|
168
|
+
get: (gameId: string, itemId: string) => Promise<import("@playcademy/data/types").ShopListing | null>;
|
|
169
|
+
update: (gameId: string, itemId: string, updates: import("@playcademy/data/types").UpdateShopListingInput) => Promise<import("@playcademy/data/types").ShopListing>;
|
|
165
170
|
delete: (gameId: string, itemId: string) => Promise<void>;
|
|
166
|
-
list: (gameId: string) => Promise<Array<import("@playcademy/types").ShopListing & {
|
|
167
|
-
item: import("@playcademy/types").Item;
|
|
171
|
+
list: (gameId: string) => Promise<Array<import("@playcademy/data/types").ShopListing & {
|
|
172
|
+
item: import("@playcademy/data/types").Item;
|
|
168
173
|
}>>;
|
|
169
174
|
};
|
|
170
175
|
};
|
|
@@ -173,16 +178,11 @@ export declare class PlaycademyClient {
|
|
|
173
178
|
maps: {
|
|
174
179
|
elements: (mapId: string) => Promise<{
|
|
175
180
|
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
181
|
mapId: string | null;
|
|
184
182
|
elementSlug: string;
|
|
185
|
-
interactionType: "
|
|
183
|
+
interactionType: "info" | "game_entry" | "game_registry" | "teleport" | "door_in" | "door_out" | "npc_interaction" | "quest_trigger";
|
|
184
|
+
metadata: Record<string, unknown> | null;
|
|
185
|
+
gameId: string | null;
|
|
186
186
|
}[]>;
|
|
187
187
|
};
|
|
188
188
|
/** Admin methods (games, items, currencies, shop listings) */
|
|
@@ -192,54 +192,54 @@ export declare class PlaycademyClient {
|
|
|
192
192
|
resumeGame: (gameId: string) => Promise<void>;
|
|
193
193
|
};
|
|
194
194
|
items: {
|
|
195
|
-
create: (props: import("@playcademy/types").
|
|
195
|
+
create: (props: import("@playcademy/data/types").InsertItemInput) => Promise<{
|
|
196
196
|
id: string;
|
|
197
197
|
createdAt: Date;
|
|
198
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
199
|
-
slug: string;
|
|
200
198
|
displayName: string;
|
|
199
|
+
description: string | null;
|
|
200
|
+
slug: string;
|
|
201
201
|
metadata: unknown;
|
|
202
202
|
gameId: string | null;
|
|
203
|
-
|
|
203
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
204
204
|
imageUrl: string | null;
|
|
205
205
|
}>;
|
|
206
206
|
get: (itemId: string) => Promise<{
|
|
207
207
|
id: string;
|
|
208
208
|
createdAt: Date;
|
|
209
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
210
|
-
slug: string;
|
|
211
209
|
displayName: string;
|
|
210
|
+
description: string | null;
|
|
211
|
+
slug: string;
|
|
212
212
|
metadata: unknown;
|
|
213
213
|
gameId: string | null;
|
|
214
|
-
|
|
214
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
215
215
|
imageUrl: string | null;
|
|
216
216
|
}>;
|
|
217
217
|
list: () => Promise<{
|
|
218
218
|
id: string;
|
|
219
219
|
createdAt: Date;
|
|
220
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
221
|
-
slug: string;
|
|
222
220
|
displayName: string;
|
|
221
|
+
description: string | null;
|
|
222
|
+
slug: string;
|
|
223
223
|
metadata: unknown;
|
|
224
224
|
gameId: string | null;
|
|
225
|
-
|
|
225
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
226
226
|
imageUrl: string | null;
|
|
227
227
|
}[]>;
|
|
228
|
-
update: (itemId: string, props: import("@playcademy/types").
|
|
228
|
+
update: (itemId: string, props: import("@playcademy/data/types").UpdateItemInput) => Promise<{
|
|
229
229
|
id: string;
|
|
230
230
|
createdAt: Date;
|
|
231
|
-
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
232
|
-
slug: string;
|
|
233
231
|
displayName: string;
|
|
232
|
+
description: string | null;
|
|
233
|
+
slug: string;
|
|
234
234
|
metadata: unknown;
|
|
235
235
|
gameId: string | null;
|
|
236
|
-
|
|
236
|
+
type: "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
|
|
237
237
|
imageUrl: string | null;
|
|
238
238
|
}>;
|
|
239
239
|
delete: (itemId: string) => Promise<void>;
|
|
240
240
|
};
|
|
241
241
|
currencies: {
|
|
242
|
-
create: (props: import("@playcademy/types").
|
|
242
|
+
create: (props: import("@playcademy/data/types").InsertCurrencyInput) => Promise<{
|
|
243
243
|
symbol: string | null;
|
|
244
244
|
id: string;
|
|
245
245
|
createdAt: Date;
|
|
@@ -263,7 +263,7 @@ export declare class PlaycademyClient {
|
|
|
263
263
|
itemId: string;
|
|
264
264
|
isPrimary: boolean;
|
|
265
265
|
}[]>;
|
|
266
|
-
update: (currencyId: string, props: import("@playcademy/types").
|
|
266
|
+
update: (currencyId: string, props: import("@playcademy/data/types").UpdateCurrencyInput) => Promise<{
|
|
267
267
|
symbol: string | null;
|
|
268
268
|
id: string;
|
|
269
269
|
createdAt: Date;
|
|
@@ -274,7 +274,7 @@ export declare class PlaycademyClient {
|
|
|
274
274
|
delete: (currencyId: string) => Promise<void>;
|
|
275
275
|
};
|
|
276
276
|
shopListings: {
|
|
277
|
-
create: (props: import("@playcademy/types").
|
|
277
|
+
create: (props: import("@playcademy/data/types").InsertShopListingInput) => Promise<{
|
|
278
278
|
id: string;
|
|
279
279
|
createdAt: Date;
|
|
280
280
|
updatedAt: Date | null;
|
|
@@ -313,7 +313,7 @@ export declare class PlaycademyClient {
|
|
|
313
313
|
availableFrom: Date | null;
|
|
314
314
|
availableUntil: Date | null;
|
|
315
315
|
}[]>;
|
|
316
|
-
update: (listingId: string, props: import("@playcademy/types").
|
|
316
|
+
update: (listingId: string, props: import("@playcademy/data/types").UpdateShopListingInput) => Promise<{
|
|
317
317
|
id: string;
|
|
318
318
|
createdAt: Date;
|
|
319
319
|
updatedAt: Date | null;
|
|
@@ -331,21 +331,21 @@ export declare class PlaycademyClient {
|
|
|
331
331
|
};
|
|
332
332
|
/** Shop methods (view) */
|
|
333
333
|
shop: {
|
|
334
|
-
view: () => Promise<import("
|
|
334
|
+
view: () => Promise<import("@playcademy/data/types").ShopViewResponse>;
|
|
335
335
|
};
|
|
336
336
|
/** Level methods (levels) */
|
|
337
337
|
levels: {
|
|
338
|
-
get: () => Promise<import("@playcademy/types").UserLevel>;
|
|
338
|
+
get: () => Promise<import("@playcademy/data/types").UserLevel>;
|
|
339
339
|
progress: () => Promise<{
|
|
340
340
|
level: number;
|
|
341
341
|
currentXp: number;
|
|
342
342
|
xpToNextLevel: number;
|
|
343
343
|
totalXP: number;
|
|
344
344
|
}>;
|
|
345
|
-
addXP: (amount: number) => Promise<import("@playcademy/types").XPAddResult>;
|
|
345
|
+
addXP: (amount: number) => Promise<import("@playcademy/data/types").XPAddResult>;
|
|
346
346
|
config: {
|
|
347
|
-
list: () => Promise<import("@playcademy/types").LevelConfig[]>;
|
|
348
|
-
get: (level: number) => Promise<import("@playcademy/types").LevelConfig | null>;
|
|
347
|
+
list: () => Promise<import("@playcademy/data/types").LevelConfig[]>;
|
|
348
|
+
get: (level: number) => Promise<import("@playcademy/data/types").LevelConfig | null>;
|
|
349
349
|
};
|
|
350
350
|
};
|
|
351
351
|
/** 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.
|
|
@@ -170,7 +169,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
170
169
|
* })
|
|
171
170
|
* ```
|
|
172
171
|
*/
|
|
173
|
-
create: (gameId: string, slug: string, itemData: Omit<
|
|
172
|
+
create: (gameId: string, slug: string, itemData: Omit<InsertItemInput, "slug" | "gameId">) => Promise<Item>;
|
|
174
173
|
/**
|
|
175
174
|
* Updates an existing game-scoped item.
|
|
176
175
|
*
|
|
@@ -187,7 +186,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
187
186
|
* })
|
|
188
187
|
* ```
|
|
189
188
|
*/
|
|
190
|
-
update: (gameId: string, itemId: string, updates:
|
|
189
|
+
update: (gameId: string, itemId: string, updates: UpdateItemInput) => Promise<Item>;
|
|
191
190
|
/**
|
|
192
191
|
* Lists all items for a specific game.
|
|
193
192
|
*
|
|
@@ -253,7 +252,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
253
252
|
* })
|
|
254
253
|
* ```
|
|
255
254
|
*/
|
|
256
|
-
create: (gameId: string, itemId: string, listingData: Omit<
|
|
255
|
+
create: (gameId: string, itemId: string, listingData: Omit<InsertShopListingInput, "itemId">) => Promise<ShopListing>;
|
|
257
256
|
/**
|
|
258
257
|
* Gets the shop listing for a specific game item.
|
|
259
258
|
*
|
|
@@ -286,7 +285,7 @@ export declare function createDevNamespace(client: PlaycademyClient): {
|
|
|
286
285
|
* })
|
|
287
286
|
* ```
|
|
288
287
|
*/
|
|
289
|
-
update: (gameId: string, itemId: string, updates:
|
|
288
|
+
update: (gameId: string, itemId: string, updates: UpdateShopListingInput) => Promise<ShopListing>;
|
|
290
289
|
/**
|
|
291
290
|
* Removes the shop listing for a game item.
|
|
292
291
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { GameState, StartSessionResponse } from '../../types';
|
|
1
|
+
import type { Game, 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.
|
|
@@ -65,7 +64,12 @@ export declare function createGamesNamespace(client: PlaycademyClient): {
|
|
|
65
64
|
* console.log('Current level:', state.level)
|
|
66
65
|
* ```
|
|
67
66
|
*/
|
|
68
|
-
loadState: () => Promise<
|
|
67
|
+
loadState: () => Promise<{
|
|
68
|
+
data: unknown;
|
|
69
|
+
updatedAt: Date | null;
|
|
70
|
+
userId: string;
|
|
71
|
+
gameId: string;
|
|
72
|
+
}>;
|
|
69
73
|
/**
|
|
70
74
|
* Starts a new game session.
|
|
71
75
|
*
|
|
@@ -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,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { PlaycademyClient } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Creates the maps namespace for the PlaycademyClient.
|
|
4
4
|
* Provides methods for retrieving map data and elements.
|
|
@@ -23,15 +23,10 @@ export declare function createMapsNamespace(client: PlaycademyClient): {
|
|
|
23
23
|
*/
|
|
24
24
|
elements: (mapId: string) => Promise<{
|
|
25
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
26
|
mapId: string | null;
|
|
34
27
|
elementSlug: string;
|
|
35
|
-
interactionType: "
|
|
28
|
+
interactionType: "info" | "game_entry" | "game_registry" | "teleport" | "door_in" | "door_out" | "npc_interaction" | "quest_trigger";
|
|
29
|
+
metadata: Record<string, unknown> | null;
|
|
30
|
+
gameId: string | null;
|
|
36
31
|
}[]>;
|
|
37
32
|
};
|
|
@@ -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