@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.
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,910 +1,931 @@
1
- import { APP_LAUNCH_CONTEXT_VALUES, FOLLOWING_FEED_SECTION_VALUES, FOLLOWING_SORT_VALUES, ENGAGEMENT_EVENT_TYPE_VALUES, ENGAGEMENT_TARGET_KIND_VALUES, LIBRARY_CATEGORY_VALUES, LIBRARY_SORT_VALUES, NOTIFICATION_STATUS_VALUES, SAVED_ITEM_KIND_VALUES, SEARCH_ASSET_TYPE_VALUES, SEARCH_KIND_VALUES, SEARCH_MODE_VALUES, } from '@playdrop/types';
2
- import { buildMeApiClientMethods } from './domains/me.js';
3
- import { buildSearchApiClientMethods } from './domains/search.js';
4
- import { buildTagsApiClientMethods } from './domains/tags.js';
5
- import { buildAppsApiClientMethods } from './domains/apps.js';
6
- import { buildAssetsApiClientMethods } from './domains/assets.js';
7
- import { buildAssetPacksApiClientMethods } from './domains/asset-packs.js';
8
- import { buildAuthApiClientMethods } from './domains/auth.js';
9
- import { buildCommentsApiClientMethods } from './domains/comments.js';
10
- import { buildPaymentsApiClientMethods } from './domains/payments.js';
11
- import { buildAdminApiClientMethods } from './domains/admin.js';
12
- import { buildAiApiClientMethods } from './domains/ai.js';
13
- import { buildFreeCreditsApiClientMethods } from './domains/free-credits.js';
14
- import { buildPlayerMetaApiClientMethods } from './domains/player-meta.js';
15
- import { createBaseUrlResolver, createRequestExecutor, parseResponseBody, resolveRequestTimeoutMs, resolveUrl, } from './core/request.js';
16
- import { handleApiError } from './core/errors.js';
17
- // eslint-disable-next-line max-lines-per-function -- The client factory intentionally exposes the full platform surface from one entry point.
18
- export function createApiClient(config = {}) {
19
- const fetchImpl = config.fetchImpl ?? globalThis.fetch?.bind(globalThis);
20
- if (!fetchImpl) {
21
- throw new Error('api_client_missing_fetch');
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 client_exports = {};
19
+ __export(client_exports, {
20
+ createApiClient: () => createApiClient
21
+ });
22
+ module.exports = __toCommonJS(client_exports);
23
+ var import_types = require("@playdrop/types");
24
+ var import_me = require("./domains/me.js");
25
+ var import_search = require("./domains/search.js");
26
+ var import_tags = require("./domains/tags.js");
27
+ var import_apps = require("./domains/apps.js");
28
+ var import_assets = require("./domains/assets.js");
29
+ var import_asset_packs = require("./domains/asset-packs.js");
30
+ var import_auth = require("./domains/auth.js");
31
+ var import_comments = require("./domains/comments.js");
32
+ var import_payments = require("./domains/payments.js");
33
+ var import_admin = require("./domains/admin.js");
34
+ var import_ai = require("./domains/ai.js");
35
+ var import_free_credits = require("./domains/free-credits.js");
36
+ var import_player_meta = require("./domains/player-meta.js");
37
+ var import_request = require("./core/request.js");
38
+ var import_errors = require("./core/errors.js");
39
+ function createApiClient(config = {}) {
40
+ const fetchImpl = config.fetchImpl ?? globalThis.fetch?.bind(globalThis);
41
+ if (!fetchImpl) {
42
+ throw new Error("api_client_missing_fetch");
43
+ }
44
+ const requestTimeoutMs = (0, import_request.resolveRequestTimeoutMs)(config.requestTimeoutMs);
45
+ const includeBrowserCredentials = config.includeBrowserCredentials ?? true;
46
+ const resolveBaseUrl = (0, import_request.createBaseUrlResolver)(config.baseUrl);
47
+ const getClientHeaders = () => config.clientHeaders ? config.clientHeaders() : {};
48
+ async function resolveToken() {
49
+ if (config.tokenProvider) {
50
+ const token = await config.tokenProvider();
51
+ return token ?? null;
22
52
  }
23
- const requestTimeoutMs = resolveRequestTimeoutMs(config.requestTimeoutMs);
24
- const includeBrowserCredentials = config.includeBrowserCredentials ?? true;
25
- const resolveBaseUrl = createBaseUrlResolver(config.baseUrl);
26
- const getClientHeaders = () => (config.clientHeaders ? config.clientHeaders() : {});
27
- async function resolveToken() {
28
- if (config.tokenProvider) {
29
- const token = await config.tokenProvider();
30
- return token ?? null;
31
- }
32
- return null;
53
+ return null;
54
+ }
55
+ function buildIapQuery(params) {
56
+ if (!params) {
57
+ return "";
33
58
  }
34
- function buildIapQuery(params) {
35
- if (!params) {
36
- return '';
37
- }
38
- const search = new URLSearchParams();
39
- if (params.kind) {
40
- search.set('kind', params.kind);
41
- }
42
- if (params.status) {
43
- const statuses = Array.isArray(params.status) ? params.status : [params.status];
44
- if (statuses.length > 0) {
45
- search.set('status', statuses.join(','));
46
- }
47
- }
48
- if (params.from) {
49
- const fromValue = params.from instanceof Date ? params.from.toISOString() : params.from;
50
- search.set('from', fromValue);
51
- }
52
- if (params.to) {
53
- const toValue = params.to instanceof Date ? params.to.toISOString() : params.to;
54
- search.set('to', toValue);
55
- }
56
- if (typeof params.appId === 'number') {
57
- search.set('appId', String(params.appId));
58
- }
59
- if (typeof params.limit === 'number') {
60
- search.set('limit', String(params.limit));
61
- }
62
- if (typeof params.offset === 'number') {
63
- search.set('offset', String(params.offset));
64
- }
65
- const query = search.toString();
66
- return query;
59
+ const search = new URLSearchParams();
60
+ if (params.kind) {
61
+ search.set("kind", params.kind);
67
62
  }
68
- function normalizeAssetRevisionInput(revision) {
69
- if (typeof revision === 'number') {
70
- if (!Number.isInteger(revision) || revision <= 0) {
71
- throw new Error('invalid_asset_revision');
72
- }
73
- return String(revision);
74
- }
75
- const trimmed = revision.trim().toLowerCase();
76
- if (!trimmed) {
77
- throw new Error('invalid_asset_revision');
78
- }
79
- const numeric = trimmed.startsWith('r') ? trimmed.slice(1) : trimmed;
80
- const parsed = Number.parseInt(numeric, 10);
81
- if (!Number.isInteger(parsed) || parsed <= 0) {
82
- throw new Error('invalid_asset_revision');
83
- }
84
- return String(parsed);
63
+ if (params.status) {
64
+ const statuses = Array.isArray(params.status) ? params.status : [params.status];
65
+ if (statuses.length > 0) {
66
+ search.set("status", statuses.join(","));
67
+ }
85
68
  }
86
- function normalizeSemverInput(version) {
87
- const trimmed = typeof version === 'string' ? version.trim() : '';
88
- if (!trimmed) {
89
- throw new Error('invalid_version_format');
90
- }
91
- const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
92
- if (!semverRegex.test(trimmed)) {
93
- throw new Error('invalid_version_format');
94
- }
95
- return trimmed;
69
+ if (params.from) {
70
+ const fromValue = params.from instanceof Date ? params.from.toISOString() : params.from;
71
+ search.set("from", fromValue);
96
72
  }
97
- function normalizeEnumInput(value, allowed, errorCode) {
98
- if (!allowed.includes(value)) {
99
- throw new Error(errorCode);
100
- }
101
- return value;
73
+ if (params.to) {
74
+ const toValue = params.to instanceof Date ? params.to.toISOString() : params.to;
75
+ search.set("to", toValue);
102
76
  }
103
- function normalizeSavedItemKindInput(kind) {
104
- return normalizeEnumInput(kind, SAVED_ITEM_KIND_VALUES, 'invalid_saved_item_kind');
77
+ if (typeof params.appId === "number") {
78
+ search.set("appId", String(params.appId));
105
79
  }
106
- function normalizeEngagementEventTypeInput(eventType) {
107
- return normalizeEnumInput(eventType, ENGAGEMENT_EVENT_TYPE_VALUES, 'invalid_engagement_event_type');
80
+ if (typeof params.limit === "number") {
81
+ search.set("limit", String(params.limit));
108
82
  }
109
- function normalizeEngagementTargetKindInput(targetKind) {
110
- return normalizeEnumInput(targetKind, ENGAGEMENT_TARGET_KIND_VALUES, 'invalid_engagement_target_kind');
83
+ if (typeof params.offset === "number") {
84
+ search.set("offset", String(params.offset));
111
85
  }
112
- function normalizeLibraryCategoryInput(category) {
113
- return normalizeEnumInput(category, LIBRARY_CATEGORY_VALUES, 'invalid_library_category');
86
+ const query = search.toString();
87
+ return query;
88
+ }
89
+ function normalizeAssetRevisionInput(revision) {
90
+ if (typeof revision === "number") {
91
+ if (!Number.isInteger(revision) || revision <= 0) {
92
+ throw new Error("invalid_asset_revision");
93
+ }
94
+ return String(revision);
114
95
  }
115
- function normalizeLibrarySortInput(sort) {
116
- return normalizeEnumInput(sort, LIBRARY_SORT_VALUES, 'invalid_library_sort');
96
+ const trimmed = revision.trim().toLowerCase();
97
+ if (!trimmed) {
98
+ throw new Error("invalid_asset_revision");
117
99
  }
118
- function normalizeFollowingSortInput(sort) {
119
- return normalizeEnumInput(sort, FOLLOWING_SORT_VALUES, 'invalid_following_sort');
100
+ const numeric = trimmed.startsWith("r") ? trimmed.slice(1) : trimmed;
101
+ const parsed = Number.parseInt(numeric, 10);
102
+ if (!Number.isInteger(parsed) || parsed <= 0) {
103
+ throw new Error("invalid_asset_revision");
120
104
  }
121
- function normalizeFollowingFeedSectionInput(section) {
122
- return normalizeEnumInput(section, FOLLOWING_FEED_SECTION_VALUES, 'invalid_following_feed_section');
105
+ return String(parsed);
106
+ }
107
+ function normalizeSemverInput(version) {
108
+ const trimmed = typeof version === "string" ? version.trim() : "";
109
+ if (!trimmed) {
110
+ throw new Error("invalid_version_format");
123
111
  }
124
- function normalizeNotificationStatusInput(status) {
125
- return normalizeEnumInput(status, NOTIFICATION_STATUS_VALUES, 'invalid_notification_status');
112
+ const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
113
+ if (!semverRegex.test(trimmed)) {
114
+ throw new Error("invalid_version_format");
126
115
  }
127
- function normalizeSearchKindInput(kind) {
128
- return normalizeEnumInput(kind, SEARCH_KIND_VALUES, 'invalid_search_kind');
116
+ return trimmed;
117
+ }
118
+ function normalizeEnumInput(value, allowed, errorCode) {
119
+ if (!allowed.includes(value)) {
120
+ throw new Error(errorCode);
129
121
  }
130
- function normalizeSearchModeInput(mode) {
131
- return normalizeEnumInput(mode, SEARCH_MODE_VALUES, 'invalid_search_mode');
122
+ return value;
123
+ }
124
+ function normalizeSavedItemKindInput(kind) {
125
+ return normalizeEnumInput(kind, import_types.SAVED_ITEM_KIND_VALUES, "invalid_saved_item_kind");
126
+ }
127
+ function normalizeEngagementEventTypeInput(eventType) {
128
+ return normalizeEnumInput(eventType, import_types.ENGAGEMENT_EVENT_TYPE_VALUES, "invalid_engagement_event_type");
129
+ }
130
+ function normalizeEngagementTargetKindInput(targetKind) {
131
+ return normalizeEnumInput(targetKind, import_types.ENGAGEMENT_TARGET_KIND_VALUES, "invalid_engagement_target_kind");
132
+ }
133
+ function normalizeLibraryCategoryInput(category) {
134
+ return normalizeEnumInput(category, import_types.LIBRARY_CATEGORY_VALUES, "invalid_library_category");
135
+ }
136
+ function normalizeLibrarySortInput(sort) {
137
+ return normalizeEnumInput(sort, import_types.LIBRARY_SORT_VALUES, "invalid_library_sort");
138
+ }
139
+ function normalizeFollowingSortInput(sort) {
140
+ return normalizeEnumInput(sort, import_types.FOLLOWING_SORT_VALUES, "invalid_following_sort");
141
+ }
142
+ function normalizeFollowingFeedSectionInput(section) {
143
+ return normalizeEnumInput(section, import_types.FOLLOWING_FEED_SECTION_VALUES, "invalid_following_feed_section");
144
+ }
145
+ function normalizeNotificationStatusInput(status) {
146
+ return normalizeEnumInput(status, import_types.NOTIFICATION_STATUS_VALUES, "invalid_notification_status");
147
+ }
148
+ function normalizeSearchKindInput(kind) {
149
+ return normalizeEnumInput(kind, import_types.SEARCH_KIND_VALUES, "invalid_search_kind");
150
+ }
151
+ function normalizeSearchModeInput(mode) {
152
+ return normalizeEnumInput(mode, import_types.SEARCH_MODE_VALUES, "invalid_search_mode");
153
+ }
154
+ function normalizeSearchAssetTypeInput(assetType) {
155
+ return normalizeEnumInput(assetType, import_types.SEARCH_ASSET_TYPE_VALUES, "invalid_search_asset_type");
156
+ }
157
+ function normalizePositiveIntegerInput(value, errorCode) {
158
+ if (!Number.isInteger(value) || value <= 0) {
159
+ throw new Error(errorCode);
132
160
  }
133
- function normalizeSearchAssetTypeInput(assetType) {
134
- return normalizeEnumInput(assetType, SEARCH_ASSET_TYPE_VALUES, 'invalid_search_asset_type');
161
+ return value;
162
+ }
163
+ function normalizeNonNegativeIntegerInput(value, errorCode) {
164
+ if (!Number.isInteger(value) || value < 0) {
165
+ throw new Error(errorCode);
135
166
  }
136
- function normalizePositiveIntegerInput(value, errorCode) {
137
- if (!Number.isInteger(value) || value <= 0) {
138
- throw new Error(errorCode);
139
- }
140
- return value;
167
+ return value;
168
+ }
169
+ function normalizeCreatorItemSlug(value, field) {
170
+ const trimmed = typeof value === "string" ? value.trim() : "";
171
+ if (!trimmed) {
172
+ throw new Error(field === "creator" ? "invalid_creator_username" : "invalid_item_name");
141
173
  }
142
- function normalizeNonNegativeIntegerInput(value, errorCode) {
143
- if (!Number.isInteger(value) || value < 0) {
144
- throw new Error(errorCode);
145
- }
146
- return value;
174
+ return trimmed;
175
+ }
176
+ function normalizeWebPushSubscriptionRequest(requestBody) {
177
+ const subscription = requestBody?.subscription;
178
+ const endpoint = typeof subscription?.endpoint === "string" ? subscription.endpoint.trim() : "";
179
+ const expirationTime = subscription?.expirationTime;
180
+ const p256dh = typeof subscription?.keys?.p256dh === "string" ? subscription.keys.p256dh.trim() : "";
181
+ const auth = typeof subscription?.keys?.auth === "string" ? subscription.keys.auth.trim() : "";
182
+ if (!endpoint || !endpoint.startsWith("https://")) {
183
+ throw new Error("invalid_web_push_subscription");
147
184
  }
148
- function normalizeCreatorItemSlug(value, field) {
149
- const trimmed = typeof value === 'string' ? value.trim() : '';
150
- if (!trimmed) {
151
- throw new Error(field === 'creator' ? 'invalid_creator_username' : 'invalid_item_name');
152
- }
153
- return trimmed;
185
+ if (expirationTime !== null && expirationTime !== void 0 && !Number.isFinite(expirationTime)) {
186
+ throw new Error("invalid_web_push_subscription");
154
187
  }
155
- function normalizeWebPushSubscriptionRequest(requestBody) {
156
- const subscription = requestBody?.subscription;
157
- const endpoint = typeof subscription?.endpoint === 'string' ? subscription.endpoint.trim() : '';
158
- const expirationTime = subscription?.expirationTime;
159
- const p256dh = typeof subscription?.keys?.p256dh === 'string' ? subscription.keys.p256dh.trim() : '';
160
- const auth = typeof subscription?.keys?.auth === 'string' ? subscription.keys.auth.trim() : '';
161
- if (!endpoint || !endpoint.startsWith('https://')) {
162
- throw new Error('invalid_web_push_subscription');
163
- }
164
- if (expirationTime !== null && expirationTime !== undefined && !Number.isFinite(expirationTime)) {
165
- throw new Error('invalid_web_push_subscription');
166
- }
167
- if (!p256dh || !auth) {
168
- throw new Error('invalid_web_push_subscription');
169
- }
170
- return {
171
- subscription: {
172
- endpoint,
173
- expirationTime: expirationTime === undefined ? null : expirationTime,
174
- keys: {
175
- p256dh,
176
- auth,
177
- },
178
- },
179
- };
188
+ if (!p256dh || !auth) {
189
+ throw new Error("invalid_web_push_subscription");
180
190
  }
181
- function normalizeApplePushDeviceRequest(requestBody) {
182
- const deviceToken = typeof requestBody?.deviceToken === 'string' ? requestBody.deviceToken.trim().toLowerCase() : '';
183
- const apnsEnvironment = requestBody?.apnsEnvironment;
184
- if (!/^[0-9a-f]+$/.test(deviceToken) || deviceToken.length < 16) {
185
- throw new Error('invalid_apple_push_device_token');
186
- }
187
- if (apnsEnvironment !== 'development' && apnsEnvironment !== 'production') {
188
- throw new Error('invalid_apple_push_environment');
191
+ return {
192
+ subscription: {
193
+ endpoint,
194
+ expirationTime: expirationTime === void 0 ? null : expirationTime,
195
+ keys: {
196
+ p256dh,
197
+ auth
189
198
  }
190
- return {
191
- deviceToken,
192
- apnsEnvironment,
193
- };
199
+ }
200
+ };
201
+ }
202
+ function normalizeApplePushDeviceRequest(requestBody) {
203
+ const deviceToken = typeof requestBody?.deviceToken === "string" ? requestBody.deviceToken.trim().toLowerCase() : "";
204
+ const apnsEnvironment = requestBody?.apnsEnvironment;
205
+ if (!/^[0-9a-f]+$/.test(deviceToken) || deviceToken.length < 16) {
206
+ throw new Error("invalid_apple_push_device_token");
194
207
  }
195
- function buildCreatorAppMutationPath(creatorUsername, appName, suffix = '') {
196
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
197
- if (!appName) {
198
- return `/creators/${encodeURIComponent(creator)}/apps${suffix}`;
199
- }
200
- const name = normalizeCreatorItemSlug(appName, 'name');
201
- return `/creators/${encodeURIComponent(creator)}/apps/${encodeURIComponent(name)}${suffix}`;
208
+ if (apnsEnvironment !== "development" && apnsEnvironment !== "production") {
209
+ throw new Error("invalid_apple_push_environment");
202
210
  }
203
- function buildCreatorAssetMutationPath(creatorUsername, assetName, suffix = '') {
204
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
205
- if (!assetName) {
206
- return `/creators/${encodeURIComponent(creator)}/assets${suffix}`;
207
- }
208
- const name = normalizeCreatorItemSlug(assetName, 'name');
209
- return `/creators/${encodeURIComponent(creator)}/assets/${encodeURIComponent(name)}${suffix}`;
211
+ return {
212
+ deviceToken,
213
+ apnsEnvironment
214
+ };
215
+ }
216
+ function buildCreatorAppMutationPath(creatorUsername, appName, suffix = "") {
217
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
218
+ if (!appName) {
219
+ return `/creators/${encodeURIComponent(creator)}/apps${suffix}`;
210
220
  }
211
- function buildCreatorAssetPackMutationPath(creatorUsername, packName, suffix = '') {
212
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
213
- if (!packName) {
214
- return `/creators/${encodeURIComponent(creator)}/asset-packs${suffix}`;
215
- }
216
- const name = normalizeCreatorItemSlug(packName, 'name');
217
- return `/creators/${encodeURIComponent(creator)}/asset-packs/${encodeURIComponent(name)}${suffix}`;
221
+ const name = normalizeCreatorItemSlug(appName, "name");
222
+ return `/creators/${encodeURIComponent(creator)}/apps/${encodeURIComponent(name)}${suffix}`;
223
+ }
224
+ function buildCreatorAssetMutationPath(creatorUsername, assetName, suffix = "") {
225
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
226
+ if (!assetName) {
227
+ return `/creators/${encodeURIComponent(creator)}/assets${suffix}`;
218
228
  }
219
- function parseContentDispositionFilename(headerValue) {
220
- if (!headerValue) {
221
- return null;
222
- }
223
- const utf8Match = /filename\*=UTF-8''([^;]+)/i.exec(headerValue);
224
- if (utf8Match && utf8Match[1]) {
225
- try {
226
- return decodeURIComponent(utf8Match[1]);
227
- }
228
- catch {
229
- return utf8Match[1];
230
- }
231
- }
232
- const plainMatch = /filename="?([^";]+)"?/i.exec(headerValue);
233
- return plainMatch?.[1] ?? null;
229
+ const name = normalizeCreatorItemSlug(assetName, "name");
230
+ return `/creators/${encodeURIComponent(creator)}/assets/${encodeURIComponent(name)}${suffix}`;
231
+ }
232
+ function buildCreatorAssetPackMutationPath(creatorUsername, packName, suffix = "") {
233
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
234
+ if (!packName) {
235
+ return `/creators/${encodeURIComponent(creator)}/asset-packs${suffix}`;
234
236
  }
235
- const request = createRequestExecutor({
236
- fetchImpl,
237
- resolveBaseUrl,
238
- resolveUrl,
239
- parseResponseBody,
240
- resolveToken,
241
- getClientHeaders,
242
- requestTimeoutMs,
243
- includeBrowserCredentials,
244
- });
245
- // Implementation of all API methods
246
- return {
247
- request,
248
- ...buildAuthApiClientMethods({
249
- request,
250
- handleApiError,
251
- }),
252
- ...buildFreeCreditsApiClientMethods({
253
- request,
254
- handleApiError,
255
- }),
256
- async me() {
257
- const response = await request({
258
- method: 'GET',
259
- path: '/me',
260
- });
261
- if (response.status !== 200) {
262
- handleApiError(response, 'me');
263
- }
264
- return response.body;
265
- },
266
- async updateProfile(updateRequest) {
267
- const response = await request({
268
- method: 'PATCH',
269
- path: '/me',
270
- body: updateRequest,
271
- });
272
- if (response.status !== 200) {
273
- handleApiError(response, 'update_profile');
274
- }
275
- return response.body;
276
- },
277
- async changePassword(changeRequest) {
278
- const response = await request({
279
- method: 'POST',
280
- path: '/me/password',
281
- body: changeRequest,
282
- });
283
- if (response.status !== 200) {
284
- handleApiError(response, 'change_password');
285
- }
286
- return response.body;
287
- },
288
- async exportPrivacyData() {
289
- const response = await request({
290
- method: 'GET',
291
- path: '/me/privacy-export',
292
- });
293
- if (response.status !== 200) {
294
- handleApiError(response, 'export_privacy_data');
295
- }
296
- return response.body;
297
- },
298
- async deleteAccount(deleteRequest) {
299
- const response = await request({
300
- method: 'DELETE',
301
- path: '/me',
302
- body: deleteRequest,
303
- });
304
- if (response.status !== 200) {
305
- handleApiError(response, 'delete_account');
306
- }
307
- return response.body;
308
- },
309
- async upgradeToCreator() {
310
- const response = await request({
311
- method: 'POST',
312
- path: '/me/upgrade-to-creator',
313
- });
314
- if (response.status !== 200) {
315
- handleApiError(response, 'upgrade_to_creator');
316
- }
317
- return response.body;
318
- },
319
- async fetchUserById(userId) {
320
- if (!Number.isFinite(userId) || userId <= 0) {
321
- throw new Error('invalid_user_id');
322
- }
323
- const response = await request({
324
- method: 'GET',
325
- path: `/users/${encodeURIComponent(String(userId))}`,
326
- });
327
- if (response.status !== 200) {
328
- handleApiError(response, 'fetch_user_by_id');
329
- }
330
- return response.body;
331
- },
332
- async fetchUserByUsername(username) {
333
- const trimmed = typeof username === 'string' ? username.trim() : '';
334
- if (!trimmed) {
335
- throw new Error('invalid_username');
336
- }
337
- const response = await request({
338
- method: 'GET',
339
- path: `/users/by-username/${encodeURIComponent(trimmed)}`,
340
- });
341
- if (response.status !== 200) {
342
- handleApiError(response, 'fetch_user_by_username');
343
- }
344
- return response.body;
345
- },
346
- async fetchOwnedProfileAssets() {
347
- const response = await request({
348
- method: 'GET',
349
- path: '/me/profile-assets',
350
- });
351
- if (response.status !== 200) {
352
- handleApiError(response, 'fetch_owned_profile_assets');
353
- }
354
- return response.body;
355
- },
356
- async saveItem(kind, creatorUsername, itemName) {
357
- const normalizedKind = normalizeSavedItemKindInput(kind);
358
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
359
- const name = normalizeCreatorItemSlug(itemName, 'name');
360
- const response = await request({
361
- method: 'PUT',
362
- path: `/me/saved-items/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
363
- });
364
- if (response.status !== 200) {
365
- handleApiError(response, 'save_item');
366
- }
367
- return response.body;
368
- },
369
- async unsaveItem(kind, creatorUsername, itemName) {
370
- const normalizedKind = normalizeSavedItemKindInput(kind);
371
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
372
- const name = normalizeCreatorItemSlug(itemName, 'name');
373
- const response = await request({
374
- method: 'DELETE',
375
- path: `/me/saved-items/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
376
- });
377
- if (response.status !== 200) {
378
- handleApiError(response, 'unsave_item');
379
- }
380
- return response.body;
381
- },
382
- async likeItem(kind, creatorUsername, itemName) {
383
- const normalizedKind = normalizeSavedItemKindInput(kind);
384
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
385
- const name = normalizeCreatorItemSlug(itemName, 'name');
386
- const response = await request({
387
- method: 'PUT',
388
- path: `/me/likes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
389
- });
390
- if (response.status !== 200) {
391
- handleApiError(response, 'like_item');
392
- }
393
- return response.body;
394
- },
395
- async unlikeItem(kind, creatorUsername, itemName) {
396
- const normalizedKind = normalizeSavedItemKindInput(kind);
397
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
398
- const name = normalizeCreatorItemSlug(itemName, 'name');
399
- const response = await request({
400
- method: 'DELETE',
401
- path: `/me/likes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
402
- });
403
- if (response.status !== 200) {
404
- handleApiError(response, 'unlike_item');
405
- }
406
- return response.body;
407
- },
408
- async dislikeItem(kind, creatorUsername, itemName) {
409
- const normalizedKind = normalizeSavedItemKindInput(kind);
410
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
411
- const name = normalizeCreatorItemSlug(itemName, 'name');
412
- const response = await request({
413
- method: 'PUT',
414
- path: `/me/dislikes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
415
- });
416
- if (response.status !== 200) {
417
- handleApiError(response, 'dislike_item');
418
- }
419
- return response.body;
420
- },
421
- async undislikeItem(kind, creatorUsername, itemName) {
422
- const normalizedKind = normalizeSavedItemKindInput(kind);
423
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
424
- const name = normalizeCreatorItemSlug(itemName, 'name');
425
- const response = await request({
426
- method: 'DELETE',
427
- path: `/me/dislikes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
428
- });
429
- if (response.status !== 200) {
430
- handleApiError(response, 'undislike_item');
431
- }
432
- return response.body;
433
- },
434
- async reportContent(kind, creatorUsername, itemName, requestBody) {
435
- const normalizedKind = normalizeSavedItemKindInput(kind);
436
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
437
- const name = normalizeCreatorItemSlug(itemName, 'name');
438
- const response = await request({
439
- method: 'POST',
440
- path: `/me/reports/content/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
441
- body: requestBody,
442
- });
443
- if (response.status !== 200) {
444
- handleApiError(response, 'report_content');
445
- }
446
- return response.body;
447
- },
448
- async reportCreator(creatorUsername, requestBody) {
449
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
450
- const response = await request({
451
- method: 'POST',
452
- path: `/me/reports/creators/${encodeURIComponent(creator)}`,
453
- body: requestBody,
454
- });
455
- if (response.status !== 200) {
456
- handleApiError(response, 'report_creator');
457
- }
458
- return response.body;
459
- },
460
- async trackEngagementEvent(payload) {
461
- const eventType = normalizeEngagementEventTypeInput(payload.eventType);
462
- const targetKind = normalizeEngagementTargetKindInput(payload.targetKind);
463
- const creatorUsername = normalizeCreatorItemSlug(payload.creatorUsername, 'creator');
464
- const itemName = payload.itemName === undefined ? undefined : normalizeCreatorItemSlug(payload.itemName, 'name');
465
- const launchContext = APP_LAUNCH_CONTEXT_VALUES.includes(payload.launchContext)
466
- ? payload.launchContext
467
- : undefined;
468
- const response = await request({
469
- method: 'POST',
470
- path: '/engagement-events',
471
- body: {
472
- eventType,
473
- targetKind,
474
- creatorUsername,
475
- ...(itemName !== undefined ? { itemName } : {}),
476
- ...(launchContext ? { launchContext } : {}),
477
- },
478
- });
479
- if (response.status !== 200) {
480
- handleApiError(response, 'track_engagement_event');
481
- }
482
- return response.body;
483
- },
484
- async fetchLibrary(options = {}) {
485
- const params = new URLSearchParams();
486
- if (options.category) {
487
- params.set('category', normalizeLibraryCategoryInput(options.category));
488
- }
489
- if (options.sort) {
490
- params.set('sort', normalizeLibrarySortInput(options.sort));
491
- }
492
- const query = params.toString();
493
- const response = await request({
494
- method: 'GET',
495
- path: `/me/library${query ? `?${query}` : ''}`,
496
- });
497
- if (response.status !== 200) {
498
- handleApiError(response, 'fetch_library');
499
- }
500
- return response.body;
501
- },
502
- async followCreator(creatorUsername) {
503
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
504
- const response = await request({
505
- method: 'PUT',
506
- path: `/me/following/${encodeURIComponent(creator)}`,
507
- });
508
- if (response.status !== 200) {
509
- handleApiError(response, 'follow_creator');
510
- }
511
- return response.body;
512
- },
513
- async unfollowCreator(creatorUsername) {
514
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
515
- const response = await request({
516
- method: 'DELETE',
517
- path: `/me/following/${encodeURIComponent(creator)}`,
518
- });
519
- if (response.status !== 200) {
520
- handleApiError(response, 'unfollow_creator');
521
- }
522
- return response.body;
523
- },
524
- async blockCreator(creatorUsername) {
525
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
526
- const response = await request({
527
- method: 'PUT',
528
- path: `/me/blocked-creators/${encodeURIComponent(creator)}`,
529
- });
530
- if (response.status !== 200) {
531
- handleApiError(response, 'block_creator');
532
- }
533
- return response.body;
534
- },
535
- async unblockCreator(creatorUsername) {
536
- const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
537
- const response = await request({
538
- method: 'DELETE',
539
- path: `/me/blocked-creators/${encodeURIComponent(creator)}`,
540
- });
541
- if (response.status !== 200) {
542
- handleApiError(response, 'unblock_creator');
543
- }
544
- return response.body;
545
- },
546
- async fetchFollowingCreators(options = {}) {
547
- const params = new URLSearchParams();
548
- if (options.sort) {
549
- params.set('sort', normalizeFollowingSortInput(options.sort));
550
- }
551
- const query = params.toString();
552
- const response = await request({
553
- method: 'GET',
554
- path: `/me/following${query ? `?${query}` : ''}`,
555
- });
556
- if (response.status !== 200) {
557
- handleApiError(response, 'fetch_following_creators');
558
- }
559
- return response.body;
560
- },
561
- async fetchFollowingFeed(options) {
562
- const params = new URLSearchParams();
563
- params.set('section', normalizeFollowingFeedSectionInput(options.section));
564
- if (options.limit !== undefined) {
565
- params.set('limit', String(normalizePositiveIntegerInput(options.limit, 'invalid_following_feed_limit')));
566
- }
567
- const response = await request({
568
- method: 'GET',
569
- path: `/me/following/feed?${params.toString()}`,
570
- });
571
- if (response.status !== 200) {
572
- handleApiError(response, 'fetch_following_feed');
573
- }
574
- return response.body;
575
- },
576
- async fetchNotifications(options = {}) {
577
- const params = new URLSearchParams();
578
- if (options.status) {
579
- params.set('status', normalizeNotificationStatusInput(options.status));
580
- }
581
- if (options.limit !== undefined) {
582
- params.set('limit', String(normalizePositiveIntegerInput(options.limit, 'invalid_notification_limit')));
583
- }
584
- if (options.offset !== undefined) {
585
- params.set('offset', String(normalizeNonNegativeIntegerInput(options.offset, 'invalid_notification_offset')));
586
- }
587
- const query = params.toString();
588
- const response = await request({
589
- method: 'GET',
590
- path: `/me/notifications${query ? `?${query}` : ''}`,
591
- });
592
- if (response.status !== 200) {
593
- handleApiError(response, 'fetch_notifications');
594
- }
595
- return response.body;
596
- },
597
- async markNotificationRead(notificationId) {
598
- if (!Number.isInteger(notificationId) || notificationId <= 0) {
599
- throw new Error('invalid_notification_id');
600
- }
601
- const response = await request({
602
- method: 'POST',
603
- path: `/me/notifications/${encodeURIComponent(String(notificationId))}/read`,
604
- });
605
- if (response.status !== 200) {
606
- handleApiError(response, 'mark_notification_read');
607
- }
608
- return response.body;
609
- },
610
- async markAllNotificationsRead() {
611
- const response = await request({
612
- method: 'POST',
613
- path: '/me/notifications/read-all',
614
- });
615
- if (response.status !== 200) {
616
- handleApiError(response, 'mark_all_notifications_read');
617
- }
618
- return response.body;
619
- },
620
- async fetchWebPushConfig() {
621
- const response = await request({
622
- method: 'GET',
623
- path: '/me/push/web/config',
624
- });
625
- if (response.status !== 200) {
626
- handleApiError(response, 'fetch_web_push_config');
627
- }
628
- return response.body;
629
- },
630
- async fetchWebPushSubscriptionStatus(requestBody) {
631
- const response = await request({
632
- method: 'POST',
633
- path: '/me/push/web/subscription/status',
634
- body: normalizeWebPushSubscriptionRequest(requestBody),
635
- });
636
- if (response.status !== 200) {
637
- handleApiError(response, 'fetch_web_push_subscription_status');
638
- }
639
- return response.body;
640
- },
641
- async upsertWebPushSubscription(requestBody) {
642
- const response = await request({
643
- method: 'PUT',
644
- path: '/me/push/web/subscription',
645
- body: normalizeWebPushSubscriptionRequest(requestBody),
646
- });
647
- if (response.status !== 200) {
648
- handleApiError(response, 'upsert_web_push_subscription');
649
- }
650
- return response.body;
651
- },
652
- async deleteWebPushSubscription(requestBody) {
653
- const response = await request({
654
- method: 'DELETE',
655
- path: '/me/push/web/subscription',
656
- body: normalizeWebPushSubscriptionRequest(requestBody),
657
- });
658
- if (response.status !== 200) {
659
- handleApiError(response, 'delete_web_push_subscription');
660
- }
661
- return response.body;
662
- },
663
- async fetchApplePushDeviceStatus(requestBody) {
664
- const response = await request({
665
- method: 'POST',
666
- path: '/me/push/apple/device/status',
667
- body: normalizeApplePushDeviceRequest(requestBody),
668
- });
669
- if (response.status !== 200) {
670
- handleApiError(response, 'fetch_apple_push_device_status');
671
- }
672
- return response.body;
673
- },
674
- async upsertApplePushDevice(requestBody) {
675
- const response = await request({
676
- method: 'PUT',
677
- path: '/me/push/apple/device',
678
- body: normalizeApplePushDeviceRequest(requestBody),
679
- });
680
- if (response.status !== 200) {
681
- handleApiError(response, 'upsert_apple_push_device');
682
- }
683
- return response.body;
684
- },
685
- async deleteApplePushDevice(requestBody) {
686
- const response = await request({
687
- method: 'DELETE',
688
- path: '/me/push/apple/device',
689
- body: normalizeApplePushDeviceRequest(requestBody),
690
- });
691
- if (response.status !== 200) {
692
- handleApiError(response, 'delete_apple_push_device');
693
- }
694
- return response.body;
695
- },
696
- ...buildSearchApiClientMethods({
697
- request,
698
- handleApiError,
699
- normalizeSearchModeInput,
700
- normalizeSearchKindInput,
701
- normalizeSearchAssetTypeInput,
702
- normalizePositiveIntegerInput,
703
- }),
704
- ...buildTagsApiClientMethods({
705
- request,
706
- handleApiError,
707
- normalizePositiveIntegerInput,
708
- }),
709
- ...buildCommentsApiClientMethods({
710
- request,
711
- handleApiError,
712
- normalizeSavedItemKindInput,
713
- normalizeCreatorItemSlug,
714
- normalizePositiveIntegerInput,
715
- }),
716
- ...buildAppsApiClientMethods({
717
- request,
718
- handleApiError,
719
- fetchImpl,
720
- includeBrowserCredentials,
721
- resolveBaseUrl,
722
- resolveUrl,
723
- parseResponseBody,
724
- resolveToken,
725
- getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
726
- buildCreatorAppMutationPath,
727
- normalizeCreatorItemSlug,
728
- normalizeSemverInput,
729
- parseContentDispositionFilename,
730
- }),
731
- ...buildPlayerMetaApiClientMethods({
732
- request,
733
- handleApiError,
734
- }),
735
- ...buildAssetsApiClientMethods({
736
- request,
737
- handleApiError,
738
- fetchImpl,
739
- includeBrowserCredentials,
740
- resolveBaseUrl,
741
- resolveUrl,
742
- parseResponseBody,
743
- resolveToken,
744
- getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
745
- buildCreatorAssetMutationPath,
746
- normalizeCreatorItemSlug,
747
- normalizeAssetRevisionInput,
748
- parseContentDispositionFilename,
749
- }),
750
- ...buildAssetPacksApiClientMethods({
751
- request,
752
- handleApiError,
753
- fetchImpl,
754
- includeBrowserCredentials,
755
- resolveBaseUrl,
756
- resolveUrl,
757
- parseResponseBody,
758
- resolveToken,
759
- getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
760
- buildCreatorAssetPackMutationPath,
761
- normalizeCreatorItemSlug,
762
- normalizeSemverInput,
763
- parseContentDispositionFilename,
764
- }),
765
- ...buildMeApiClientMethods({ request, handleApiError }),
766
- async batchUpsertGraphRelations(body) {
767
- const response = await request({
768
- method: 'POST',
769
- path: '/me/graph/relations:batchUpsert',
770
- body,
771
- });
772
- if (response.status !== 200) {
773
- handleApiError(response, 'batch_upsert_graph_relations');
774
- }
775
- return response.body;
776
- },
777
- async submitFeedback(feedbackRequest) {
778
- const response = await request({
779
- method: 'POST',
780
- path: '/feedback',
781
- body: feedbackRequest,
782
- });
783
- if (response.status !== 201 && response.status !== 200) {
784
- handleApiError(response, 'submit_feedback');
785
- }
786
- return response.body;
787
- },
788
- async listFeedback(options = {}) {
789
- const params = new URLSearchParams();
790
- if (options.limit !== undefined) {
791
- params.set('limit', String(options.limit));
792
- }
793
- if (options.offset !== undefined) {
794
- params.set('offset', String(options.offset));
795
- }
796
- if (typeof options.source === 'string' && options.source.trim().length > 0) {
797
- params.set('source', options.source.trim());
798
- }
799
- if (options.userId !== undefined) {
800
- params.set('userId', String(options.userId));
801
- }
802
- const query = params.toString();
803
- const path = `/feedback${query ? `?${query}` : ''}`;
804
- const response = await request({
805
- method: 'GET',
806
- path,
807
- });
808
- if (response.status !== 200) {
809
- handleApiError(response, 'list_feedback');
810
- }
811
- return response.body;
812
- },
813
- async deleteFeedback(id) {
814
- const response = await request({
815
- method: 'DELETE',
816
- path: `/feedback/${encodeURIComponent(String(id))}`,
817
- });
818
- if (response.status !== 200) {
819
- handleApiError(response, 'delete_feedback');
820
- }
821
- return response.body;
822
- },
823
- async setSelectedProfileAsset(profileAssetRequest) {
824
- const response = await request({
825
- method: 'POST',
826
- path: '/me/profile-asset',
827
- body: profileAssetRequest,
828
- });
829
- if (response.status !== 200) {
830
- handleApiError(response, 'set_profile_asset');
831
- }
832
- return response.body;
833
- },
834
- async fetchHome(options = {}) {
835
- const params = new URLSearchParams();
836
- if (typeof options.section === 'string' && options.section.trim().length > 0) {
837
- params.set('section', options.section.trim());
838
- }
839
- if (typeof options.limit === 'number') {
840
- params.set('limit', String(options.limit));
841
- }
842
- if (typeof options.offset === 'number') {
843
- params.set('offset', String(options.offset));
844
- }
845
- const query = params.toString();
846
- const response = await request({
847
- method: 'GET',
848
- path: `/home${query ? `?${query}` : ''}`,
849
- });
850
- if (response.status !== 200) {
851
- handleApiError(response, 'fetch_home');
852
- }
853
- return response.body;
854
- },
855
- async fetchHomeGamesCollectionPage(collectionId, options = {}) {
856
- const normalizedCollectionId = collectionId.trim();
857
- if (!normalizedCollectionId) {
858
- throw new Error('invalid_home_collection_id');
859
- }
860
- const params = new URLSearchParams();
861
- if (typeof options.limit === 'number') {
862
- params.set('limit', String(options.limit));
863
- }
864
- if (typeof options.offset === 'number') {
865
- params.set('offset', String(options.offset));
866
- }
867
- if (typeof options.auth === 'string' && options.auth.trim().length > 0) {
868
- params.set('auth', options.auth.trim());
869
- }
870
- if (typeof options.controller === 'string' && options.controller.trim().length > 0) {
871
- params.set('controller', options.controller.trim());
872
- }
873
- if (options.controllerCompatible === true) {
874
- params.set('controllerCompatible', '1');
875
- }
876
- if (typeof options.surface === 'string' && options.surface.trim().length > 0) {
877
- params.set('surface', options.surface.trim());
878
- }
879
- const query = params.toString();
880
- const response = await request({
881
- method: 'GET',
882
- path: `/home/games/collections/${encodeURIComponent(normalizedCollectionId)}${query ? `?${query}` : ''}`,
883
- });
884
- if (response.status !== 200) {
885
- handleApiError(response, 'fetch_home_games_collection_page');
886
- }
887
- return response.body;
888
- },
889
- ...buildAdminApiClientMethods({
890
- request,
891
- handleApiError,
892
- fetchImpl,
893
- includeBrowserCredentials,
894
- resolveBaseUrl,
895
- resolveUrl,
896
- parseResponseBody,
897
- resolveToken,
898
- getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
899
- }),
900
- ...buildPaymentsApiClientMethods({
901
- request,
902
- handleApiError,
903
- buildIapQuery,
904
- }),
905
- ...buildAiApiClientMethods({
906
- request,
907
- handleApiError,
908
- }),
909
- };
237
+ const name = normalizeCreatorItemSlug(packName, "name");
238
+ return `/creators/${encodeURIComponent(creator)}/asset-packs/${encodeURIComponent(name)}${suffix}`;
239
+ }
240
+ function parseContentDispositionFilename(headerValue) {
241
+ if (!headerValue) {
242
+ return null;
243
+ }
244
+ const utf8Match = /filename\*=UTF-8''([^;]+)/i.exec(headerValue);
245
+ if (utf8Match && utf8Match[1]) {
246
+ try {
247
+ return decodeURIComponent(utf8Match[1]);
248
+ } catch {
249
+ return utf8Match[1];
250
+ }
251
+ }
252
+ const plainMatch = /filename="?([^";]+)"?/i.exec(headerValue);
253
+ return plainMatch?.[1] ?? null;
254
+ }
255
+ const request = (0, import_request.createRequestExecutor)({
256
+ fetchImpl,
257
+ resolveBaseUrl,
258
+ resolveUrl: import_request.resolveUrl,
259
+ parseResponseBody: import_request.parseResponseBody,
260
+ resolveToken,
261
+ getClientHeaders,
262
+ requestTimeoutMs,
263
+ includeBrowserCredentials
264
+ });
265
+ return {
266
+ request,
267
+ ...(0, import_auth.buildAuthApiClientMethods)({
268
+ request,
269
+ handleApiError: import_errors.handleApiError
270
+ }),
271
+ ...(0, import_free_credits.buildFreeCreditsApiClientMethods)({
272
+ request,
273
+ handleApiError: import_errors.handleApiError
274
+ }),
275
+ async me() {
276
+ const response = await request({
277
+ method: "GET",
278
+ path: "/me"
279
+ });
280
+ if (response.status !== 200) {
281
+ (0, import_errors.handleApiError)(response, "me");
282
+ }
283
+ return response.body;
284
+ },
285
+ async updateProfile(updateRequest) {
286
+ const response = await request({
287
+ method: "PATCH",
288
+ path: "/me",
289
+ body: updateRequest
290
+ });
291
+ if (response.status !== 200) {
292
+ (0, import_errors.handleApiError)(response, "update_profile");
293
+ }
294
+ return response.body;
295
+ },
296
+ async changePassword(changeRequest) {
297
+ const response = await request({
298
+ method: "POST",
299
+ path: "/me/password",
300
+ body: changeRequest
301
+ });
302
+ if (response.status !== 200) {
303
+ (0, import_errors.handleApiError)(response, "change_password");
304
+ }
305
+ return response.body;
306
+ },
307
+ async exportPrivacyData() {
308
+ const response = await request({
309
+ method: "GET",
310
+ path: "/me/privacy-export"
311
+ });
312
+ if (response.status !== 200) {
313
+ (0, import_errors.handleApiError)(response, "export_privacy_data");
314
+ }
315
+ return response.body;
316
+ },
317
+ async deleteAccount(deleteRequest) {
318
+ const response = await request({
319
+ method: "DELETE",
320
+ path: "/me",
321
+ body: deleteRequest
322
+ });
323
+ if (response.status !== 200) {
324
+ (0, import_errors.handleApiError)(response, "delete_account");
325
+ }
326
+ return response.body;
327
+ },
328
+ async upgradeToCreator() {
329
+ const response = await request({
330
+ method: "POST",
331
+ path: "/me/upgrade-to-creator"
332
+ });
333
+ if (response.status !== 200) {
334
+ (0, import_errors.handleApiError)(response, "upgrade_to_creator");
335
+ }
336
+ return response.body;
337
+ },
338
+ async fetchUserById(userId) {
339
+ if (!Number.isFinite(userId) || userId <= 0) {
340
+ throw new Error("invalid_user_id");
341
+ }
342
+ const response = await request({
343
+ method: "GET",
344
+ path: `/users/${encodeURIComponent(String(userId))}`
345
+ });
346
+ if (response.status !== 200) {
347
+ (0, import_errors.handleApiError)(response, "fetch_user_by_id");
348
+ }
349
+ return response.body;
350
+ },
351
+ async fetchUserByUsername(username) {
352
+ const trimmed = typeof username === "string" ? username.trim() : "";
353
+ if (!trimmed) {
354
+ throw new Error("invalid_username");
355
+ }
356
+ const response = await request({
357
+ method: "GET",
358
+ path: `/users/by-username/${encodeURIComponent(trimmed)}`
359
+ });
360
+ if (response.status !== 200) {
361
+ (0, import_errors.handleApiError)(response, "fetch_user_by_username");
362
+ }
363
+ return response.body;
364
+ },
365
+ async fetchOwnedProfileAssets() {
366
+ const response = await request({
367
+ method: "GET",
368
+ path: "/me/profile-assets"
369
+ });
370
+ if (response.status !== 200) {
371
+ (0, import_errors.handleApiError)(response, "fetch_owned_profile_assets");
372
+ }
373
+ return response.body;
374
+ },
375
+ async saveItem(kind, creatorUsername, itemName) {
376
+ const normalizedKind = normalizeSavedItemKindInput(kind);
377
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
378
+ const name = normalizeCreatorItemSlug(itemName, "name");
379
+ const response = await request({
380
+ method: "PUT",
381
+ path: `/me/saved-items/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
382
+ });
383
+ if (response.status !== 200) {
384
+ (0, import_errors.handleApiError)(response, "save_item");
385
+ }
386
+ return response.body;
387
+ },
388
+ async unsaveItem(kind, creatorUsername, itemName) {
389
+ const normalizedKind = normalizeSavedItemKindInput(kind);
390
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
391
+ const name = normalizeCreatorItemSlug(itemName, "name");
392
+ const response = await request({
393
+ method: "DELETE",
394
+ path: `/me/saved-items/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
395
+ });
396
+ if (response.status !== 200) {
397
+ (0, import_errors.handleApiError)(response, "unsave_item");
398
+ }
399
+ return response.body;
400
+ },
401
+ async likeItem(kind, creatorUsername, itemName) {
402
+ const normalizedKind = normalizeSavedItemKindInput(kind);
403
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
404
+ const name = normalizeCreatorItemSlug(itemName, "name");
405
+ const response = await request({
406
+ method: "PUT",
407
+ path: `/me/likes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
408
+ });
409
+ if (response.status !== 200) {
410
+ (0, import_errors.handleApiError)(response, "like_item");
411
+ }
412
+ return response.body;
413
+ },
414
+ async unlikeItem(kind, creatorUsername, itemName) {
415
+ const normalizedKind = normalizeSavedItemKindInput(kind);
416
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
417
+ const name = normalizeCreatorItemSlug(itemName, "name");
418
+ const response = await request({
419
+ method: "DELETE",
420
+ path: `/me/likes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
421
+ });
422
+ if (response.status !== 200) {
423
+ (0, import_errors.handleApiError)(response, "unlike_item");
424
+ }
425
+ return response.body;
426
+ },
427
+ async dislikeItem(kind, creatorUsername, itemName) {
428
+ const normalizedKind = normalizeSavedItemKindInput(kind);
429
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
430
+ const name = normalizeCreatorItemSlug(itemName, "name");
431
+ const response = await request({
432
+ method: "PUT",
433
+ path: `/me/dislikes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
434
+ });
435
+ if (response.status !== 200) {
436
+ (0, import_errors.handleApiError)(response, "dislike_item");
437
+ }
438
+ return response.body;
439
+ },
440
+ async undislikeItem(kind, creatorUsername, itemName) {
441
+ const normalizedKind = normalizeSavedItemKindInput(kind);
442
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
443
+ const name = normalizeCreatorItemSlug(itemName, "name");
444
+ const response = await request({
445
+ method: "DELETE",
446
+ path: `/me/dislikes/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`
447
+ });
448
+ if (response.status !== 200) {
449
+ (0, import_errors.handleApiError)(response, "undislike_item");
450
+ }
451
+ return response.body;
452
+ },
453
+ async reportContent(kind, creatorUsername, itemName, requestBody) {
454
+ const normalizedKind = normalizeSavedItemKindInput(kind);
455
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
456
+ const name = normalizeCreatorItemSlug(itemName, "name");
457
+ const response = await request({
458
+ method: "POST",
459
+ path: `/me/reports/content/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
460
+ body: requestBody
461
+ });
462
+ if (response.status !== 200) {
463
+ (0, import_errors.handleApiError)(response, "report_content");
464
+ }
465
+ return response.body;
466
+ },
467
+ async reportCreator(creatorUsername, requestBody) {
468
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
469
+ const response = await request({
470
+ method: "POST",
471
+ path: `/me/reports/creators/${encodeURIComponent(creator)}`,
472
+ body: requestBody
473
+ });
474
+ if (response.status !== 200) {
475
+ (0, import_errors.handleApiError)(response, "report_creator");
476
+ }
477
+ return response.body;
478
+ },
479
+ async trackEngagementEvent(payload) {
480
+ const eventType = normalizeEngagementEventTypeInput(payload.eventType);
481
+ const targetKind = normalizeEngagementTargetKindInput(payload.targetKind);
482
+ const creatorUsername = normalizeCreatorItemSlug(payload.creatorUsername, "creator");
483
+ const itemName = payload.itemName === void 0 ? void 0 : normalizeCreatorItemSlug(payload.itemName, "name");
484
+ const launchContext = import_types.APP_LAUNCH_CONTEXT_VALUES.includes(payload.launchContext) ? payload.launchContext : void 0;
485
+ const response = await request({
486
+ method: "POST",
487
+ path: "/engagement-events",
488
+ body: {
489
+ eventType,
490
+ targetKind,
491
+ creatorUsername,
492
+ ...itemName !== void 0 ? { itemName } : {},
493
+ ...launchContext ? { launchContext } : {}
494
+ }
495
+ });
496
+ if (response.status !== 200) {
497
+ (0, import_errors.handleApiError)(response, "track_engagement_event");
498
+ }
499
+ return response.body;
500
+ },
501
+ async fetchLibrary(options = {}) {
502
+ const params = new URLSearchParams();
503
+ if (options.category) {
504
+ params.set("category", normalizeLibraryCategoryInput(options.category));
505
+ }
506
+ if (options.sort) {
507
+ params.set("sort", normalizeLibrarySortInput(options.sort));
508
+ }
509
+ const query = params.toString();
510
+ const response = await request({
511
+ method: "GET",
512
+ path: `/me/library${query ? `?${query}` : ""}`
513
+ });
514
+ if (response.status !== 200) {
515
+ (0, import_errors.handleApiError)(response, "fetch_library");
516
+ }
517
+ return response.body;
518
+ },
519
+ async followCreator(creatorUsername) {
520
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
521
+ const response = await request({
522
+ method: "PUT",
523
+ path: `/me/following/${encodeURIComponent(creator)}`
524
+ });
525
+ if (response.status !== 200) {
526
+ (0, import_errors.handleApiError)(response, "follow_creator");
527
+ }
528
+ return response.body;
529
+ },
530
+ async unfollowCreator(creatorUsername) {
531
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
532
+ const response = await request({
533
+ method: "DELETE",
534
+ path: `/me/following/${encodeURIComponent(creator)}`
535
+ });
536
+ if (response.status !== 200) {
537
+ (0, import_errors.handleApiError)(response, "unfollow_creator");
538
+ }
539
+ return response.body;
540
+ },
541
+ async blockCreator(creatorUsername) {
542
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
543
+ const response = await request({
544
+ method: "PUT",
545
+ path: `/me/blocked-creators/${encodeURIComponent(creator)}`
546
+ });
547
+ if (response.status !== 200) {
548
+ (0, import_errors.handleApiError)(response, "block_creator");
549
+ }
550
+ return response.body;
551
+ },
552
+ async unblockCreator(creatorUsername) {
553
+ const creator = normalizeCreatorItemSlug(creatorUsername, "creator");
554
+ const response = await request({
555
+ method: "DELETE",
556
+ path: `/me/blocked-creators/${encodeURIComponent(creator)}`
557
+ });
558
+ if (response.status !== 200) {
559
+ (0, import_errors.handleApiError)(response, "unblock_creator");
560
+ }
561
+ return response.body;
562
+ },
563
+ async fetchFollowingCreators(options = {}) {
564
+ const params = new URLSearchParams();
565
+ if (options.sort) {
566
+ params.set("sort", normalizeFollowingSortInput(options.sort));
567
+ }
568
+ const query = params.toString();
569
+ const response = await request({
570
+ method: "GET",
571
+ path: `/me/following${query ? `?${query}` : ""}`
572
+ });
573
+ if (response.status !== 200) {
574
+ (0, import_errors.handleApiError)(response, "fetch_following_creators");
575
+ }
576
+ return response.body;
577
+ },
578
+ async fetchFollowingFeed(options) {
579
+ const params = new URLSearchParams();
580
+ params.set("section", normalizeFollowingFeedSectionInput(options.section));
581
+ if (options.limit !== void 0) {
582
+ params.set("limit", String(normalizePositiveIntegerInput(options.limit, "invalid_following_feed_limit")));
583
+ }
584
+ const response = await request({
585
+ method: "GET",
586
+ path: `/me/following/feed?${params.toString()}`
587
+ });
588
+ if (response.status !== 200) {
589
+ (0, import_errors.handleApiError)(response, "fetch_following_feed");
590
+ }
591
+ return response.body;
592
+ },
593
+ async fetchNotifications(options = {}) {
594
+ const params = new URLSearchParams();
595
+ if (options.status) {
596
+ params.set("status", normalizeNotificationStatusInput(options.status));
597
+ }
598
+ if (options.limit !== void 0) {
599
+ params.set("limit", String(normalizePositiveIntegerInput(options.limit, "invalid_notification_limit")));
600
+ }
601
+ if (options.offset !== void 0) {
602
+ params.set("offset", String(normalizeNonNegativeIntegerInput(options.offset, "invalid_notification_offset")));
603
+ }
604
+ const query = params.toString();
605
+ const response = await request({
606
+ method: "GET",
607
+ path: `/me/notifications${query ? `?${query}` : ""}`
608
+ });
609
+ if (response.status !== 200) {
610
+ (0, import_errors.handleApiError)(response, "fetch_notifications");
611
+ }
612
+ return response.body;
613
+ },
614
+ async markNotificationRead(notificationId) {
615
+ if (!Number.isInteger(notificationId) || notificationId <= 0) {
616
+ throw new Error("invalid_notification_id");
617
+ }
618
+ const response = await request({
619
+ method: "POST",
620
+ path: `/me/notifications/${encodeURIComponent(String(notificationId))}/read`
621
+ });
622
+ if (response.status !== 200) {
623
+ (0, import_errors.handleApiError)(response, "mark_notification_read");
624
+ }
625
+ return response.body;
626
+ },
627
+ async markAllNotificationsRead() {
628
+ const response = await request({
629
+ method: "POST",
630
+ path: "/me/notifications/read-all"
631
+ });
632
+ if (response.status !== 200) {
633
+ (0, import_errors.handleApiError)(response, "mark_all_notifications_read");
634
+ }
635
+ return response.body;
636
+ },
637
+ async fetchWebPushConfig() {
638
+ const response = await request({
639
+ method: "GET",
640
+ path: "/me/push/web/config"
641
+ });
642
+ if (response.status !== 200) {
643
+ (0, import_errors.handleApiError)(response, "fetch_web_push_config");
644
+ }
645
+ return response.body;
646
+ },
647
+ async fetchWebPushSubscriptionStatus(requestBody) {
648
+ const response = await request({
649
+ method: "POST",
650
+ path: "/me/push/web/subscription/status",
651
+ body: normalizeWebPushSubscriptionRequest(requestBody)
652
+ });
653
+ if (response.status !== 200) {
654
+ (0, import_errors.handleApiError)(response, "fetch_web_push_subscription_status");
655
+ }
656
+ return response.body;
657
+ },
658
+ async upsertWebPushSubscription(requestBody) {
659
+ const response = await request({
660
+ method: "PUT",
661
+ path: "/me/push/web/subscription",
662
+ body: normalizeWebPushSubscriptionRequest(requestBody)
663
+ });
664
+ if (response.status !== 200) {
665
+ (0, import_errors.handleApiError)(response, "upsert_web_push_subscription");
666
+ }
667
+ return response.body;
668
+ },
669
+ async deleteWebPushSubscription(requestBody) {
670
+ const response = await request({
671
+ method: "DELETE",
672
+ path: "/me/push/web/subscription",
673
+ body: normalizeWebPushSubscriptionRequest(requestBody)
674
+ });
675
+ if (response.status !== 200) {
676
+ (0, import_errors.handleApiError)(response, "delete_web_push_subscription");
677
+ }
678
+ return response.body;
679
+ },
680
+ async fetchApplePushDeviceStatus(requestBody) {
681
+ const response = await request({
682
+ method: "POST",
683
+ path: "/me/push/apple/device/status",
684
+ body: normalizeApplePushDeviceRequest(requestBody)
685
+ });
686
+ if (response.status !== 200) {
687
+ (0, import_errors.handleApiError)(response, "fetch_apple_push_device_status");
688
+ }
689
+ return response.body;
690
+ },
691
+ async upsertApplePushDevice(requestBody) {
692
+ const response = await request({
693
+ method: "PUT",
694
+ path: "/me/push/apple/device",
695
+ body: normalizeApplePushDeviceRequest(requestBody)
696
+ });
697
+ if (response.status !== 200) {
698
+ (0, import_errors.handleApiError)(response, "upsert_apple_push_device");
699
+ }
700
+ return response.body;
701
+ },
702
+ async deleteApplePushDevice(requestBody) {
703
+ const response = await request({
704
+ method: "DELETE",
705
+ path: "/me/push/apple/device",
706
+ body: normalizeApplePushDeviceRequest(requestBody)
707
+ });
708
+ if (response.status !== 200) {
709
+ (0, import_errors.handleApiError)(response, "delete_apple_push_device");
710
+ }
711
+ return response.body;
712
+ },
713
+ ...(0, import_search.buildSearchApiClientMethods)({
714
+ request,
715
+ handleApiError: import_errors.handleApiError,
716
+ normalizeSearchModeInput,
717
+ normalizeSearchKindInput,
718
+ normalizeSearchAssetTypeInput,
719
+ normalizePositiveIntegerInput
720
+ }),
721
+ ...(0, import_tags.buildTagsApiClientMethods)({
722
+ request,
723
+ handleApiError: import_errors.handleApiError,
724
+ normalizePositiveIntegerInput
725
+ }),
726
+ ...(0, import_comments.buildCommentsApiClientMethods)({
727
+ request,
728
+ handleApiError: import_errors.handleApiError,
729
+ normalizeSavedItemKindInput,
730
+ normalizeCreatorItemSlug,
731
+ normalizePositiveIntegerInput
732
+ }),
733
+ ...(0, import_apps.buildAppsApiClientMethods)({
734
+ request,
735
+ handleApiError: import_errors.handleApiError,
736
+ fetchImpl,
737
+ includeBrowserCredentials,
738
+ resolveBaseUrl,
739
+ resolveUrl: import_request.resolveUrl,
740
+ parseResponseBody: import_request.parseResponseBody,
741
+ resolveToken,
742
+ getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
743
+ buildCreatorAppMutationPath,
744
+ normalizeCreatorItemSlug,
745
+ normalizeSemverInput,
746
+ parseContentDispositionFilename
747
+ }),
748
+ ...(0, import_player_meta.buildPlayerMetaApiClientMethods)({
749
+ request,
750
+ handleApiError: import_errors.handleApiError
751
+ }),
752
+ ...(0, import_assets.buildAssetsApiClientMethods)({
753
+ request,
754
+ handleApiError: import_errors.handleApiError,
755
+ fetchImpl,
756
+ includeBrowserCredentials,
757
+ resolveBaseUrl,
758
+ resolveUrl: import_request.resolveUrl,
759
+ parseResponseBody: import_request.parseResponseBody,
760
+ resolveToken,
761
+ getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
762
+ buildCreatorAssetMutationPath,
763
+ normalizeCreatorItemSlug,
764
+ normalizeAssetRevisionInput,
765
+ parseContentDispositionFilename
766
+ }),
767
+ ...(0, import_asset_packs.buildAssetPacksApiClientMethods)({
768
+ request,
769
+ handleApiError: import_errors.handleApiError,
770
+ fetchImpl,
771
+ includeBrowserCredentials,
772
+ resolveBaseUrl,
773
+ resolveUrl: import_request.resolveUrl,
774
+ parseResponseBody: import_request.parseResponseBody,
775
+ resolveToken,
776
+ getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {},
777
+ buildCreatorAssetPackMutationPath,
778
+ normalizeCreatorItemSlug,
779
+ normalizeSemverInput,
780
+ parseContentDispositionFilename
781
+ }),
782
+ ...(0, import_me.buildMeApiClientMethods)({ request, handleApiError: import_errors.handleApiError }),
783
+ async batchUpsertGraphRelations(body) {
784
+ const response = await request({
785
+ method: "POST",
786
+ path: "/me/graph/relations:batchUpsert",
787
+ body
788
+ });
789
+ if (response.status !== 200) {
790
+ (0, import_errors.handleApiError)(response, "batch_upsert_graph_relations");
791
+ }
792
+ return response.body;
793
+ },
794
+ async submitFeedback(feedbackRequest) {
795
+ const response = await request({
796
+ method: "POST",
797
+ path: "/feedback",
798
+ body: feedbackRequest
799
+ });
800
+ if (response.status !== 201 && response.status !== 200) {
801
+ (0, import_errors.handleApiError)(response, "submit_feedback");
802
+ }
803
+ return response.body;
804
+ },
805
+ async listFeedback(options = {}) {
806
+ const params = new URLSearchParams();
807
+ if (options.limit !== void 0) {
808
+ params.set("limit", String(options.limit));
809
+ }
810
+ if (options.offset !== void 0) {
811
+ params.set("offset", String(options.offset));
812
+ }
813
+ if (typeof options.source === "string" && options.source.trim().length > 0) {
814
+ params.set("source", options.source.trim());
815
+ }
816
+ if (options.userId !== void 0) {
817
+ params.set("userId", String(options.userId));
818
+ }
819
+ const query = params.toString();
820
+ const path = `/feedback${query ? `?${query}` : ""}`;
821
+ const response = await request({
822
+ method: "GET",
823
+ path
824
+ });
825
+ if (response.status !== 200) {
826
+ (0, import_errors.handleApiError)(response, "list_feedback");
827
+ }
828
+ return response.body;
829
+ },
830
+ async deleteFeedback(id) {
831
+ const response = await request({
832
+ method: "DELETE",
833
+ path: `/feedback/${encodeURIComponent(String(id))}`
834
+ });
835
+ if (response.status !== 200) {
836
+ (0, import_errors.handleApiError)(response, "delete_feedback");
837
+ }
838
+ return response.body;
839
+ },
840
+ async setSelectedProfileAsset(profileAssetRequest) {
841
+ const response = await request({
842
+ method: "POST",
843
+ path: "/me/profile-asset",
844
+ body: profileAssetRequest
845
+ });
846
+ if (response.status !== 200) {
847
+ (0, import_errors.handleApiError)(response, "set_profile_asset");
848
+ }
849
+ return response.body;
850
+ },
851
+ async fetchHome(options = {}) {
852
+ const params = new URLSearchParams();
853
+ if (typeof options.section === "string" && options.section.trim().length > 0) {
854
+ params.set("section", options.section.trim());
855
+ }
856
+ if (typeof options.limit === "number") {
857
+ params.set("limit", String(options.limit));
858
+ }
859
+ if (typeof options.offset === "number") {
860
+ params.set("offset", String(options.offset));
861
+ }
862
+ const query = params.toString();
863
+ const response = await request({
864
+ method: "GET",
865
+ path: `/home${query ? `?${query}` : ""}`
866
+ });
867
+ if (response.status !== 200) {
868
+ (0, import_errors.handleApiError)(response, "fetch_home");
869
+ }
870
+ return response.body;
871
+ },
872
+ async fetchHomeGamesCollectionPage(collectionId, options = {}) {
873
+ const normalizedCollectionId = collectionId.trim();
874
+ if (!normalizedCollectionId) {
875
+ throw new Error("invalid_home_collection_id");
876
+ }
877
+ const params = new URLSearchParams();
878
+ if (typeof options.limit === "number") {
879
+ params.set("limit", String(options.limit));
880
+ }
881
+ if (typeof options.offset === "number") {
882
+ params.set("offset", String(options.offset));
883
+ }
884
+ if (typeof options.auth === "string" && options.auth.trim().length > 0) {
885
+ params.set("auth", options.auth.trim());
886
+ }
887
+ if (typeof options.controller === "string" && options.controller.trim().length > 0) {
888
+ params.set("controller", options.controller.trim());
889
+ }
890
+ if (options.controllerCompatible === true) {
891
+ params.set("controllerCompatible", "1");
892
+ }
893
+ if (typeof options.surface === "string" && options.surface.trim().length > 0) {
894
+ params.set("surface", options.surface.trim());
895
+ }
896
+ const query = params.toString();
897
+ const response = await request({
898
+ method: "GET",
899
+ path: `/home/games/collections/${encodeURIComponent(normalizedCollectionId)}${query ? `?${query}` : ""}`
900
+ });
901
+ if (response.status !== 200) {
902
+ (0, import_errors.handleApiError)(response, "fetch_home_games_collection_page");
903
+ }
904
+ return response.body;
905
+ },
906
+ ...(0, import_admin.buildAdminApiClientMethods)({
907
+ request,
908
+ handleApiError: import_errors.handleApiError,
909
+ fetchImpl,
910
+ includeBrowserCredentials,
911
+ resolveBaseUrl,
912
+ resolveUrl: import_request.resolveUrl,
913
+ parseResponseBody: import_request.parseResponseBody,
914
+ resolveToken,
915
+ getClientHeaders: () => config.clientHeaders ? config.clientHeaders() : {}
916
+ }),
917
+ ...(0, import_payments.buildPaymentsApiClientMethods)({
918
+ request,
919
+ handleApiError: import_errors.handleApiError,
920
+ buildIapQuery
921
+ }),
922
+ ...(0, import_ai.buildAiApiClientMethods)({
923
+ request,
924
+ handleApiError: import_errors.handleApiError
925
+ })
926
+ };
910
927
  }
928
+ // Annotate the CommonJS export names for ESM import in node:
929
+ 0 && (module.exports = {
930
+ createApiClient
931
+ });