@playcademy/sdk 0.0.1-beta.11 → 0.0.1-beta.12
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/core/client.d.ts +15 -11
- package/dist/runtime.js +12 -12
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
package/dist/core/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Method } from './request';
|
|
2
|
-
import type { Game, GameWithManifest, UpsertGameMetadataInput,
|
|
3
|
-
import type { GameState,
|
|
2
|
+
import type { Game, GameWithManifest, UpsertGameMetadataInput, InsertItem, UpdateItem } from '@playcademy/types';
|
|
3
|
+
import type { GameState, InventoryItemWithItem, ClientConfig, ClientEvents, LoginResponse, GameTokenResponse, StartSessionResponse, InventoryMutationResponse, DeveloperStatusValue } from '../types';
|
|
4
4
|
export declare class PlaycademyClient {
|
|
5
5
|
private baseUrl;
|
|
6
6
|
private token?;
|
|
@@ -47,9 +47,9 @@ export declare class PlaycademyClient {
|
|
|
47
47
|
developerStatus: "none" | "pending" | "approved";
|
|
48
48
|
}>;
|
|
49
49
|
inventory: {
|
|
50
|
-
get: () => Promise<
|
|
51
|
-
add: (
|
|
52
|
-
spend: (
|
|
50
|
+
get: () => Promise<InventoryItemWithItem[]>;
|
|
51
|
+
add: (itemId: string, qty: number) => Promise<InventoryMutationResponse>;
|
|
52
|
+
spend: (itemId: string, qty: number) => Promise<InventoryMutationResponse>;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
dev: {
|
|
@@ -100,40 +100,44 @@ export declare class PlaycademyClient {
|
|
|
100
100
|
pauseGame: (gameId: string) => Promise<void>;
|
|
101
101
|
resumeGame: (gameId: string) => Promise<void>;
|
|
102
102
|
};
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
items: {
|
|
104
|
+
createItem: (props: InsertItem) => Promise<{
|
|
105
105
|
id: string;
|
|
106
106
|
displayName: string;
|
|
107
107
|
metadata: unknown;
|
|
108
108
|
internalName: string;
|
|
109
109
|
description: string | null;
|
|
110
110
|
type: "currency" | "badge" | "trophy" | "unlock" | "upgrade" | "other";
|
|
111
|
+
imageUrl: string | null;
|
|
111
112
|
}>;
|
|
112
|
-
|
|
113
|
+
getItem: (itemId: string) => Promise<{
|
|
113
114
|
id: string;
|
|
114
115
|
displayName: string;
|
|
115
116
|
metadata: unknown;
|
|
116
117
|
internalName: string;
|
|
117
118
|
description: string | null;
|
|
118
119
|
type: "currency" | "badge" | "trophy" | "unlock" | "upgrade" | "other";
|
|
120
|
+
imageUrl: string | null;
|
|
119
121
|
}>;
|
|
120
|
-
|
|
122
|
+
listItems: () => Promise<{
|
|
121
123
|
id: string;
|
|
122
124
|
displayName: string;
|
|
123
125
|
metadata: unknown;
|
|
124
126
|
internalName: string;
|
|
125
127
|
description: string | null;
|
|
126
128
|
type: "currency" | "badge" | "trophy" | "unlock" | "upgrade" | "other";
|
|
129
|
+
imageUrl: string | null;
|
|
127
130
|
}[]>;
|
|
128
|
-
|
|
131
|
+
updateItem: (itemId: string, props: UpdateItem) => Promise<{
|
|
129
132
|
id: string;
|
|
130
133
|
displayName: string;
|
|
131
134
|
metadata: unknown;
|
|
132
135
|
internalName: string;
|
|
133
136
|
description: string | null;
|
|
134
137
|
type: "currency" | "badge" | "trophy" | "unlock" | "upgrade" | "other";
|
|
138
|
+
imageUrl: string | null;
|
|
135
139
|
}>;
|
|
136
|
-
|
|
140
|
+
deleteItem: (itemId: string) => Promise<void>;
|
|
137
141
|
};
|
|
138
142
|
};
|
|
139
143
|
telemetry: {
|
package/dist/runtime.js
CHANGED
|
@@ -256,19 +256,19 @@ class PlaycademyClient {
|
|
|
256
256
|
},
|
|
257
257
|
inventory: {
|
|
258
258
|
get: async () => this.request(`/inventory`, "GET"),
|
|
259
|
-
add: async (
|
|
260
|
-
const res = await this.request(`/inventory/add`, "POST", {
|
|
259
|
+
add: async (itemId, qty) => {
|
|
260
|
+
const res = await this.request(`/inventory/add`, "POST", { itemId, qty });
|
|
261
261
|
this.emit("inventoryChange", {
|
|
262
|
-
|
|
262
|
+
itemId,
|
|
263
263
|
delta: qty,
|
|
264
264
|
newTotal: res.newTotal
|
|
265
265
|
});
|
|
266
266
|
return res;
|
|
267
267
|
},
|
|
268
|
-
spend: async (
|
|
269
|
-
const res = await this.request(`/inventory/spend`, "POST", {
|
|
268
|
+
spend: async (itemId, qty) => {
|
|
269
|
+
const res = await this.request(`/inventory/spend`, "POST", { itemId, qty });
|
|
270
270
|
this.emit("inventoryChange", {
|
|
271
|
-
|
|
271
|
+
itemId,
|
|
272
272
|
delta: -qty,
|
|
273
273
|
newTotal: res.newTotal
|
|
274
274
|
});
|
|
@@ -308,12 +308,12 @@ class PlaycademyClient {
|
|
|
308
308
|
pauseGame: (gameId) => this.request(`/admin/games/${gameId}/pause`, "POST"),
|
|
309
309
|
resumeGame: (gameId) => this.request(`/admin/games/${gameId}/resume`, "POST")
|
|
310
310
|
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
311
|
+
items: {
|
|
312
|
+
createItem: (props) => this.request("/items", "POST", props),
|
|
313
|
+
getItem: (itemId) => this.request(`/items/${itemId}`, "GET"),
|
|
314
|
+
listItems: () => this.request("/items", "GET"),
|
|
315
|
+
updateItem: (itemId, props) => this.request(`/items/${itemId}`, "PATCH", props),
|
|
316
|
+
deleteItem: (itemId) => this.request(`/items/${itemId}`, "DELETE")
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
telemetry = {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { User,
|
|
1
|
+
import type { User, InventoryItemWithItem, Game, DeveloperKey, DeveloperStatusResponse, MapElement, Item, InsertItem, ManifestV1, UpdateItem } from '@playcademy/types';
|
|
2
2
|
export interface ClientConfig {
|
|
3
3
|
baseUrl: string;
|
|
4
4
|
token?: string;
|
|
@@ -9,7 +9,7 @@ export interface ClientEvents {
|
|
|
9
9
|
token: string | null;
|
|
10
10
|
};
|
|
11
11
|
inventoryChange: {
|
|
12
|
-
|
|
12
|
+
itemId: string;
|
|
13
13
|
delta: number;
|
|
14
14
|
newTotal: number;
|
|
15
15
|
};
|
|
@@ -40,4 +40,4 @@ export type StartSessionResponse = {
|
|
|
40
40
|
export type InventoryMutationResponse = {
|
|
41
41
|
newTotal: number;
|
|
42
42
|
};
|
|
43
|
-
export type { User,
|
|
43
|
+
export type { User, InventoryItemWithItem, Game, ManifestV1, DeveloperKey, DeveloperStatusResponse, MapElement, Item, InsertItem, UpdateItem, };
|