@playdrop/playdrop-cli 0.7.15 → 0.7.17
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/config/client-meta.json +1 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +461 -444
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +903 -882
- package/node_modules/@playdrop/api-client/dist/core/errors.js +69 -45
- package/node_modules/@playdrop/api-client/dist/core/request.js +188 -159
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +516 -491
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +40 -14
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +480 -462
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +439 -419
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +696 -676
- package/node_modules/@playdrop/api-client/dist/domains/auth.js +346 -320
- package/node_modules/@playdrop/api-client/dist/domains/comments.js +124 -98
- package/node_modules/@playdrop/api-client/dist/domains/free-credits.js +91 -65
- package/node_modules/@playdrop/api-client/dist/domains/me.js +71 -45
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +407 -386
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +144 -118
- package/node_modules/@playdrop/api-client/dist/domains/search.js +117 -104
- package/node_modules/@playdrop/api-client/dist/domains/tags.js +188 -162
- package/node_modules/@playdrop/api-client/dist/index.js +993 -552
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/animations.js +84 -62
- package/node_modules/@playdrop/boxel-three/dist/src/builders.js +341 -308
- package/node_modules/@playdrop/boxel-three/dist/src/context.js +55 -29
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +856 -858
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +267 -261
- package/node_modules/@playdrop/boxel-three/dist/src/index.js +64 -15
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +89 -63
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +81 -56
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +112 -86
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +45 -17
- package/node_modules/@playdrop/boxel-three/dist/src/scene.js +160 -136
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +582 -584
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +123 -97
- package/node_modules/@playdrop/boxel-three/dist/src/textures.js +207 -182
- package/node_modules/@playdrop/boxel-three/dist/src/types.js +15 -1
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +451 -425
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +109 -84
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +127 -106
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +73 -51
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +97 -79
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +29 -7
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +80 -60
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +41 -19
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +72 -50
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +84 -62
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +69 -47
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +129 -109
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +40 -18
- package/node_modules/@playdrop/boxel-three/package.json +1 -1
- package/node_modules/@playdrop/config/client-meta.json +1 -1
- package/node_modules/@playdrop/types/dist/api.js +289 -203
- package/node_modules/@playdrop/types/dist/app-capability-filters.js +112 -62
- package/node_modules/@playdrop/types/dist/app.js +91 -45
- package/node_modules/@playdrop/types/dist/asset-pack.js +37 -5
- package/node_modules/@playdrop/types/dist/asset-spec.js +170 -90
- package/node_modules/@playdrop/types/dist/asset.js +186 -108
- package/node_modules/@playdrop/types/dist/content-license.js +49 -15
- package/node_modules/@playdrop/types/dist/creator-public-image.js +60 -32
- package/node_modules/@playdrop/types/dist/ecs.js +102 -82
- package/node_modules/@playdrop/types/dist/engine-builtins.js +603 -573
- package/node_modules/@playdrop/types/dist/entity.js +63 -53
- package/node_modules/@playdrop/types/dist/graph.js +116 -80
- package/node_modules/@playdrop/types/dist/index.js +47 -20
- package/node_modules/@playdrop/types/dist/owned-assets.js +55 -33
- package/node_modules/@playdrop/types/dist/player-meta.js +151 -100
- package/node_modules/@playdrop/types/dist/realtime.js +27 -7
- package/node_modules/@playdrop/types/dist/version.js +182 -124
- package/node_modules/@playdrop/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,387 +1,408 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var payments_exports = {};
|
|
19
|
+
__export(payments_exports, {
|
|
20
|
+
buildPaymentsApiClientMethods: () => buildPaymentsApiClientMethods
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(payments_exports);
|
|
23
|
+
function buildPaymentsApiClientMethods(input) {
|
|
24
|
+
const { request, handleApiError, buildIapQuery } = input;
|
|
25
|
+
return {
|
|
26
|
+
async fetchPublicCreditShop() {
|
|
27
|
+
const response = await request({
|
|
28
|
+
method: "GET",
|
|
29
|
+
path: "/shop/public"
|
|
30
|
+
});
|
|
31
|
+
if (response.status !== 200) {
|
|
32
|
+
handleApiError(response, "fetch_public_shop");
|
|
33
|
+
}
|
|
34
|
+
return response.body;
|
|
35
|
+
},
|
|
36
|
+
async fetchCreditShop() {
|
|
37
|
+
const response = await request({
|
|
38
|
+
method: "GET",
|
|
39
|
+
path: "/shop"
|
|
40
|
+
});
|
|
41
|
+
if (response.status !== 200) {
|
|
42
|
+
handleApiError(response, "fetch_shop");
|
|
43
|
+
}
|
|
44
|
+
return response.body;
|
|
45
|
+
},
|
|
46
|
+
async createCreditPackCheckoutSession(sku, requestBody) {
|
|
47
|
+
const normalizedSku = sku.trim();
|
|
48
|
+
if (!normalizedSku) {
|
|
49
|
+
throw new Error("invalid_credit_pack_sku");
|
|
50
|
+
}
|
|
51
|
+
const response = await request({
|
|
52
|
+
method: "POST",
|
|
53
|
+
path: `/shop/credit-packs/${encodeURIComponent(normalizedSku)}/checkout-session`,
|
|
54
|
+
...requestBody ? { body: requestBody } : {}
|
|
55
|
+
});
|
|
56
|
+
if (response.status !== 200) {
|
|
57
|
+
handleApiError(response, "create_credit_pack_checkout_session");
|
|
58
|
+
}
|
|
59
|
+
return response.body;
|
|
60
|
+
},
|
|
61
|
+
async fetchCreditPackCheckoutStatus(sessionId) {
|
|
62
|
+
const normalizedSessionId = sessionId.trim();
|
|
63
|
+
if (!normalizedSessionId) {
|
|
64
|
+
throw new Error("invalid_checkout_session_id");
|
|
65
|
+
}
|
|
66
|
+
const response = await request({
|
|
67
|
+
method: "GET",
|
|
68
|
+
path: `/shop/credit-packs/checkout-session/${encodeURIComponent(normalizedSessionId)}`
|
|
69
|
+
});
|
|
70
|
+
if (response.status !== 200) {
|
|
71
|
+
handleApiError(response, "fetch_credit_pack_checkout_status");
|
|
72
|
+
}
|
|
73
|
+
return response.body;
|
|
74
|
+
},
|
|
75
|
+
async purchaseAsset(body) {
|
|
76
|
+
const response = await request({
|
|
77
|
+
method: "POST",
|
|
78
|
+
path: "/purchase",
|
|
79
|
+
body
|
|
80
|
+
});
|
|
81
|
+
if (response.status !== 200) {
|
|
82
|
+
handleApiError(response, "purchase_asset");
|
|
83
|
+
}
|
|
84
|
+
return response.body;
|
|
85
|
+
},
|
|
86
|
+
async purchaseIap(body) {
|
|
87
|
+
const response = await request({
|
|
88
|
+
method: "POST",
|
|
89
|
+
path: "/iap/purchase",
|
|
90
|
+
body
|
|
91
|
+
});
|
|
92
|
+
if (response.status !== 200) {
|
|
93
|
+
handleApiError(response, "purchase_iap");
|
|
94
|
+
}
|
|
95
|
+
return response.body;
|
|
96
|
+
},
|
|
97
|
+
async purchaseDevIap(appId, slot, body) {
|
|
98
|
+
const response = await request({
|
|
99
|
+
method: "POST",
|
|
100
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/iap/purchase`,
|
|
101
|
+
body
|
|
102
|
+
});
|
|
103
|
+
if (response.status !== 200) {
|
|
104
|
+
handleApiError(response, "purchase_dev_iap");
|
|
105
|
+
}
|
|
106
|
+
return response.body;
|
|
107
|
+
},
|
|
108
|
+
async fetchIapReceipts(params) {
|
|
109
|
+
const query = buildIapQuery(params);
|
|
110
|
+
const path = query ? `/iap/receipts?${query}` : "/iap/receipts";
|
|
111
|
+
const response = await request({
|
|
112
|
+
method: "GET",
|
|
113
|
+
path
|
|
114
|
+
});
|
|
115
|
+
if (response.status !== 200) {
|
|
116
|
+
handleApiError(response, "fetch_iap_receipts");
|
|
117
|
+
}
|
|
118
|
+
return response.body;
|
|
119
|
+
},
|
|
120
|
+
async cancelIapReceipt(receiptId) {
|
|
121
|
+
const response = await request({
|
|
122
|
+
method: "POST",
|
|
123
|
+
path: `/iap/receipts/${encodeURIComponent(String(receiptId))}/cancel`
|
|
124
|
+
});
|
|
125
|
+
if (response.status !== 200) {
|
|
126
|
+
handleApiError(response, "cancel_iap_receipt");
|
|
127
|
+
}
|
|
128
|
+
return response.body;
|
|
129
|
+
},
|
|
130
|
+
async fetchAppIapReceipts(params) {
|
|
131
|
+
const query = buildIapQuery(params);
|
|
132
|
+
const path = query ? `/app/iap/receipts?${query}` : "/app/iap/receipts";
|
|
133
|
+
const response = await request({
|
|
134
|
+
method: "GET",
|
|
135
|
+
path
|
|
136
|
+
});
|
|
137
|
+
if (response.status !== 200) {
|
|
138
|
+
handleApiError(response, "fetch_app_iap_receipts");
|
|
139
|
+
}
|
|
140
|
+
return response.body;
|
|
141
|
+
},
|
|
142
|
+
async consumeAppIapReceipt(receiptId) {
|
|
143
|
+
const response = await request({
|
|
144
|
+
method: "POST",
|
|
145
|
+
path: `/app/iap/receipts/${encodeURIComponent(String(receiptId))}/consume`
|
|
146
|
+
});
|
|
147
|
+
if (response.status !== 200) {
|
|
148
|
+
handleApiError(response, "consume_app_iap_receipt");
|
|
149
|
+
}
|
|
150
|
+
return response.body;
|
|
151
|
+
},
|
|
152
|
+
async grantAppIapReceipt(receiptId) {
|
|
153
|
+
const response = await request({
|
|
154
|
+
method: "POST",
|
|
155
|
+
path: `/app/iap/receipts/${encodeURIComponent(String(receiptId))}/grant`
|
|
156
|
+
});
|
|
157
|
+
if (response.status !== 200) {
|
|
158
|
+
handleApiError(response, "grant_app_iap_receipt");
|
|
159
|
+
}
|
|
160
|
+
return response.body;
|
|
161
|
+
},
|
|
162
|
+
async cancelAppIapReceipt(receiptId) {
|
|
163
|
+
const response = await request({
|
|
164
|
+
method: "POST",
|
|
165
|
+
path: `/app/iap/receipts/${encodeURIComponent(String(receiptId))}/cancel`
|
|
166
|
+
});
|
|
167
|
+
if (response.status !== 200) {
|
|
168
|
+
handleApiError(response, "cancel_app_iap_receipt");
|
|
169
|
+
}
|
|
170
|
+
return response.body;
|
|
171
|
+
},
|
|
172
|
+
async fetchCreditTransactions(options) {
|
|
173
|
+
const params = new URLSearchParams();
|
|
174
|
+
if (options?.limit !== void 0) {
|
|
175
|
+
params.set("limit", String(options.limit));
|
|
176
|
+
}
|
|
177
|
+
if (options?.offset !== void 0) {
|
|
178
|
+
params.set("offset", String(options.offset));
|
|
179
|
+
}
|
|
180
|
+
const query = params.toString();
|
|
181
|
+
const path = query ? `/transactions?${query}` : "/transactions";
|
|
182
|
+
const response = await request({
|
|
183
|
+
method: "GET",
|
|
184
|
+
path
|
|
185
|
+
});
|
|
186
|
+
if (response.status !== 200) {
|
|
187
|
+
handleApiError(response, "fetch_credit_transactions");
|
|
188
|
+
}
|
|
189
|
+
return response.body;
|
|
190
|
+
},
|
|
191
|
+
async fetchBoostBalance() {
|
|
192
|
+
const response = await request({
|
|
193
|
+
method: "GET",
|
|
194
|
+
path: "/boosts/balance"
|
|
195
|
+
});
|
|
196
|
+
if (response.status !== 200) {
|
|
197
|
+
handleApiError(response, "fetch_boost_balance");
|
|
198
|
+
}
|
|
199
|
+
return response.body;
|
|
200
|
+
},
|
|
201
|
+
async purchaseBoostPack(body) {
|
|
202
|
+
const normalizedQuantity = body.quantity;
|
|
203
|
+
if (normalizedQuantity !== void 0) {
|
|
204
|
+
if (!Number.isInteger(normalizedQuantity) || normalizedQuantity <= 0) {
|
|
205
|
+
throw new Error("invalid_boost_quantity");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const response = await request({
|
|
209
|
+
method: "POST",
|
|
210
|
+
path: "/boosts/purchase",
|
|
211
|
+
body
|
|
212
|
+
});
|
|
213
|
+
if (response.status !== 200) {
|
|
214
|
+
handleApiError(response, "purchase_boost_pack");
|
|
215
|
+
}
|
|
216
|
+
return response.body;
|
|
217
|
+
},
|
|
218
|
+
async activateAppBoost(appId, body) {
|
|
219
|
+
const normalizedAppId = Number(appId);
|
|
220
|
+
if (!Number.isInteger(normalizedAppId) || normalizedAppId <= 0) {
|
|
221
|
+
throw new Error("invalid_app_id");
|
|
222
|
+
}
|
|
223
|
+
const response = await request({
|
|
224
|
+
method: "POST",
|
|
225
|
+
path: `/apps/${encodeURIComponent(String(normalizedAppId))}/boosts/activate`,
|
|
226
|
+
...body ? { body } : {}
|
|
227
|
+
});
|
|
228
|
+
if (response.status !== 200) {
|
|
229
|
+
handleApiError(response, "activate_app_boost");
|
|
230
|
+
}
|
|
231
|
+
return response.body;
|
|
232
|
+
},
|
|
233
|
+
async fetchAppBoostStatus(appId) {
|
|
234
|
+
const normalizedAppId = Number(appId);
|
|
235
|
+
if (!Number.isInteger(normalizedAppId) || normalizedAppId <= 0) {
|
|
236
|
+
throw new Error("invalid_app_id");
|
|
237
|
+
}
|
|
238
|
+
const response = await request({
|
|
239
|
+
method: "GET",
|
|
240
|
+
path: `/apps/${encodeURIComponent(String(normalizedAppId))}/boosts/status`
|
|
241
|
+
});
|
|
242
|
+
if (response.status !== 200) {
|
|
243
|
+
handleApiError(response, "fetch_app_boost_status");
|
|
244
|
+
}
|
|
245
|
+
return response.body;
|
|
246
|
+
},
|
|
247
|
+
async fetchAppBoostHistory(appId, options) {
|
|
248
|
+
const normalizedAppId = Number(appId);
|
|
249
|
+
if (!Number.isInteger(normalizedAppId) || normalizedAppId <= 0) {
|
|
250
|
+
throw new Error("invalid_app_id");
|
|
251
|
+
}
|
|
252
|
+
const params = new URLSearchParams();
|
|
253
|
+
if (typeof options?.limit === "number") {
|
|
254
|
+
if (!Number.isInteger(options.limit) || options.limit <= 0) {
|
|
255
|
+
throw new Error("invalid_boost_history_limit");
|
|
256
|
+
}
|
|
257
|
+
params.set("limit", String(options.limit));
|
|
258
|
+
}
|
|
259
|
+
const query = params.toString();
|
|
260
|
+
const response = await request({
|
|
261
|
+
method: "GET",
|
|
262
|
+
path: query ? `/apps/${encodeURIComponent(String(normalizedAppId))}/boosts/history?${query}` : `/apps/${encodeURIComponent(String(normalizedAppId))}/boosts/history`
|
|
263
|
+
});
|
|
264
|
+
if (response.status !== 200) {
|
|
265
|
+
handleApiError(response, "fetch_app_boost_history");
|
|
266
|
+
}
|
|
267
|
+
return response.body;
|
|
268
|
+
},
|
|
269
|
+
async fetchAppBoostReport(appId, options) {
|
|
270
|
+
const normalizedAppId = Number(appId);
|
|
271
|
+
if (!Number.isInteger(normalizedAppId) || normalizedAppId <= 0) {
|
|
272
|
+
throw new Error("invalid_app_id");
|
|
273
|
+
}
|
|
274
|
+
const params = new URLSearchParams();
|
|
275
|
+
if (typeof options?.days === "number") {
|
|
276
|
+
if (options.startDateUtc || options.endDateUtc) {
|
|
277
|
+
throw new Error("invalid_boost_report_range");
|
|
278
|
+
}
|
|
279
|
+
params.set("days", String(options.days));
|
|
280
|
+
}
|
|
281
|
+
if (typeof options?.startDateUtc === "string") {
|
|
282
|
+
params.set("startDateUtc", options.startDateUtc);
|
|
283
|
+
}
|
|
284
|
+
if (typeof options?.endDateUtc === "string") {
|
|
285
|
+
params.set("endDateUtc", options.endDateUtc);
|
|
286
|
+
}
|
|
287
|
+
const query = params.toString();
|
|
288
|
+
const response = await request({
|
|
289
|
+
method: "GET",
|
|
290
|
+
path: query ? `/apps/${encodeURIComponent(String(normalizedAppId))}/boosts/report?${query}` : `/apps/${encodeURIComponent(String(normalizedAppId))}/boosts/report`
|
|
291
|
+
});
|
|
292
|
+
if (response.status !== 200) {
|
|
293
|
+
handleApiError(response, "fetch_app_boost_report");
|
|
294
|
+
}
|
|
295
|
+
return response.body;
|
|
296
|
+
},
|
|
297
|
+
async fetchCreatorEarnings(options) {
|
|
298
|
+
const params = new URLSearchParams();
|
|
299
|
+
if (typeof options?.days === "number") {
|
|
300
|
+
params.set("days", String(options.days));
|
|
301
|
+
}
|
|
302
|
+
if (typeof options?.appId === "number") {
|
|
303
|
+
params.set("appId", String(options.appId));
|
|
304
|
+
}
|
|
305
|
+
const query = params.toString();
|
|
306
|
+
const response = await request({
|
|
307
|
+
method: "GET",
|
|
308
|
+
path: query ? `/creator/earnings?${query}` : "/creator/earnings"
|
|
309
|
+
});
|
|
310
|
+
if (response.status !== 200) {
|
|
311
|
+
handleApiError(response, "fetch_creator_earnings");
|
|
312
|
+
}
|
|
313
|
+
return response.body;
|
|
314
|
+
},
|
|
315
|
+
async loadInterstitialAd(body) {
|
|
316
|
+
const response = await request({
|
|
317
|
+
method: "POST",
|
|
318
|
+
path: "/ads/interstitial/load",
|
|
319
|
+
body
|
|
320
|
+
});
|
|
321
|
+
if (response.status !== 200) {
|
|
322
|
+
handleApiError(response, "load_interstitial_ad");
|
|
323
|
+
}
|
|
324
|
+
return response.body;
|
|
325
|
+
},
|
|
326
|
+
async loadDevInterstitialAd(appId, slot, body) {
|
|
327
|
+
const response = await request({
|
|
328
|
+
method: "POST",
|
|
329
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/ads/interstitial/load`,
|
|
330
|
+
body
|
|
331
|
+
});
|
|
332
|
+
if (response.status !== 200) {
|
|
333
|
+
handleApiError(response, "load_dev_interstitial_ad");
|
|
334
|
+
}
|
|
335
|
+
return response.body;
|
|
336
|
+
},
|
|
337
|
+
async showInterstitialAd(body) {
|
|
338
|
+
const response = await request({
|
|
339
|
+
method: "POST",
|
|
340
|
+
path: "/ads/interstitial/show",
|
|
341
|
+
body
|
|
342
|
+
});
|
|
343
|
+
if (response.status !== 200) {
|
|
344
|
+
handleApiError(response, "show_interstitial_ad");
|
|
345
|
+
}
|
|
346
|
+
return response.body;
|
|
347
|
+
},
|
|
348
|
+
async showDevInterstitialAd(appId, slot, body) {
|
|
349
|
+
const response = await request({
|
|
350
|
+
method: "POST",
|
|
351
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/ads/interstitial/show`,
|
|
352
|
+
body
|
|
353
|
+
});
|
|
354
|
+
if (response.status !== 200) {
|
|
355
|
+
handleApiError(response, "show_dev_interstitial_ad");
|
|
356
|
+
}
|
|
357
|
+
return response.body;
|
|
358
|
+
},
|
|
359
|
+
async loadRewardedAd(body) {
|
|
360
|
+
const response = await request({
|
|
361
|
+
method: "POST",
|
|
362
|
+
path: "/ads/rewarded/load",
|
|
363
|
+
body
|
|
364
|
+
});
|
|
365
|
+
if (response.status !== 200) {
|
|
366
|
+
handleApiError(response, "load_rewarded_ad");
|
|
367
|
+
}
|
|
368
|
+
return response.body;
|
|
369
|
+
},
|
|
370
|
+
async loadDevRewardedAd(appId, slot, body) {
|
|
371
|
+
const response = await request({
|
|
372
|
+
method: "POST",
|
|
373
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/ads/rewarded/load`,
|
|
374
|
+
body
|
|
375
|
+
});
|
|
376
|
+
if (response.status !== 200) {
|
|
377
|
+
handleApiError(response, "load_dev_rewarded_ad");
|
|
378
|
+
}
|
|
379
|
+
return response.body;
|
|
380
|
+
},
|
|
381
|
+
async showRewardedAd(body) {
|
|
382
|
+
const response = await request({
|
|
383
|
+
method: "POST",
|
|
384
|
+
path: "/ads/rewarded/show",
|
|
385
|
+
body
|
|
386
|
+
});
|
|
387
|
+
if (response.status !== 200) {
|
|
388
|
+
handleApiError(response, "show_rewarded_ad");
|
|
389
|
+
}
|
|
390
|
+
return response.body;
|
|
391
|
+
},
|
|
392
|
+
async showDevRewardedAd(appId, slot, body) {
|
|
393
|
+
const response = await request({
|
|
394
|
+
method: "POST",
|
|
395
|
+
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/ads/rewarded/show`,
|
|
396
|
+
body
|
|
397
|
+
});
|
|
398
|
+
if (response.status !== 200) {
|
|
399
|
+
handleApiError(response, "show_dev_rewarded_ad");
|
|
400
|
+
}
|
|
401
|
+
return response.body;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
387
404
|
}
|
|
405
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
406
|
+
0 && (module.exports = {
|
|
407
|
+
buildPaymentsApiClientMethods
|
|
408
|
+
});
|