@playcademy/sdk 0.0.1-beta.10 → 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.
@@ -1,6 +1,6 @@
1
1
  import { type Method } from './request';
2
- import type { Game, GameWithManifest, UpsertGameMetadataInput, InsertReward, UpdateReward } from '@playcademy/types';
3
- import type { GameState, InventoryItemWithReward, ClientConfig, ClientEvents, LoginResponse, GameTokenResponse, StartSessionResponse, InventoryMutationResponse, DeveloperStatusValue } from '../types';
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<InventoryItemWithReward[]>;
51
- add: (rewardId: string, qty: number) => Promise<InventoryMutationResponse>;
52
- spend: (rewardId: string, qty: number) => Promise<InventoryMutationResponse>;
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
- rewards: {
104
- createReward: (props: InsertReward) => Promise<{
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
- getReward: (rewardId: string) => Promise<{
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
- listRewards: () => Promise<{
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
- updateReward: (rewardId: string, props: UpdateReward) => Promise<{
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
- deleteReward: (rewardId: string) => Promise<void>;
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 (rewardId, qty) => {
260
- const res = await this.request(`/inventory/add`, "POST", { rewardId, qty });
259
+ add: async (itemId, qty) => {
260
+ const res = await this.request(`/inventory/add`, "POST", { itemId, qty });
261
261
  this.emit("inventoryChange", {
262
- rewardId,
262
+ itemId,
263
263
  delta: qty,
264
264
  newTotal: res.newTotal
265
265
  });
266
266
  return res;
267
267
  },
268
- spend: async (rewardId, qty) => {
269
- const res = await this.request(`/inventory/spend`, "POST", { rewardId, qty });
268
+ spend: async (itemId, qty) => {
269
+ const res = await this.request(`/inventory/spend`, "POST", { itemId, qty });
270
270
  this.emit("inventoryChange", {
271
- rewardId,
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
- rewards: {
312
- createReward: (props) => this.request("/rewards", "POST", props),
313
- getReward: (rewardId) => this.request(`/rewards/${rewardId}`, "GET"),
314
- listRewards: () => this.request("/rewards", "GET"),
315
- updateReward: (rewardId, props) => this.request(`/rewards/${rewardId}`, "PATCH", props),
316
- deleteReward: (rewardId) => this.request(`/rewards/${rewardId}`, "DELETE")
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, InventoryItemWithReward, Game, DeveloperKey, DeveloperStatusResponse, MapElement, Reward, InsertReward, ManifestV1, UpdateReward } from '@playcademy/types';
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
- rewardId: string;
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, InventoryItemWithReward, Game, ManifestV1, DeveloperKey, DeveloperStatusResponse, MapElement, Reward, InsertReward, UpdateReward, };
43
+ export type { User, InventoryItemWithItem, Game, ManifestV1, DeveloperKey, DeveloperStatusResponse, MapElement, Item, InsertItem, UpdateItem, };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
3
  "type": "module",
4
- "version": "0.0.1-beta.10",
4
+ "version": "0.0.1-beta.12",
5
5
  "exports": {
6
6
  ".": {
7
7
  "import": "./dist/runtime.js",
@@ -24,7 +24,7 @@
24
24
  "pub": "bun run build && bunx bumpp --no-tag --no-push -c \"chore(@playcademy/sdk): release v%s\" && bun publish --access public"
25
25
  },
26
26
  "devDependencies": {
27
- "@playcademy/types": "latest",
27
+ "@playcademy/types": "^0.0.1-beta.6",
28
28
  "@types/bun": "latest",
29
29
  "typescript": "^5.0.0",
30
30
  "yocto-spinner": "^0.2.1"