@playdrop/playdrop-cli 0.7.15 → 0.7.16

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