@playdrop/playdrop-cli 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/config/client-meta.json +4 -4
- package/dist/apps/upload.js +226 -80
- package/dist/assetSpecs.d.ts +1 -0
- package/dist/assetSpecs.js +22 -1
- package/dist/assets/model-artifacts.d.ts +2 -2
- package/dist/assets/model-artifacts.js +1 -1
- package/dist/captureRuntime.d.ts +1 -0
- package/dist/captureRuntime.js +3 -2
- package/dist/catalogue.d.ts +33 -8
- package/dist/catalogue.js +364 -46
- package/dist/commandContext.d.ts +5 -1
- package/dist/commandContext.js +90 -29
- package/dist/commands/browse.d.ts +3 -0
- package/dist/commands/browse.js +90 -17
- package/dist/commands/build.js +1 -1
- package/dist/commands/capture.d.ts +3 -0
- package/dist/commands/capture.js +121 -9
- package/dist/commands/captureListing.d.ts +2 -0
- package/dist/commands/captureListing.js +157 -61
- package/dist/commands/create.js +6 -28
- package/dist/commands/createRemixContent.js +4 -26
- package/dist/commands/creations.js +2 -3
- package/dist/commands/detail.js +24 -2
- package/dist/commands/dev.d.ts +8 -1
- package/dist/commands/dev.js +180 -2
- package/dist/commands/devRuntimeAssets.d.ts +34 -0
- package/dist/commands/devRuntimeAssets.js +308 -0
- package/dist/commands/devServer.d.ts +11 -0
- package/dist/commands/devServer.js +196 -13
- package/dist/commands/init.js +6 -24
- package/dist/commands/search.d.ts +4 -0
- package/dist/commands/search.js +68 -11
- package/dist/commands/upload-content.d.ts +3 -3
- package/dist/commands/upload-content.js +19 -38
- package/dist/commands/upload.js +67 -77
- package/dist/commands/validate.js +13 -20
- package/dist/commands/whoami.js +23 -26
- package/dist/devAuth.d.ts +16 -0
- package/dist/devAuth.js +60 -0
- package/dist/index.js +22 -4
- package/dist/taskSelection.js +4 -3
- package/dist/taskUtils.d.ts +2 -2
- package/dist/taskUtils.js +1 -1
- package/dist/uploadLog.d.ts +1 -1
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts +43 -114
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +22 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +11 -19
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +116 -106
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +13 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +5 -5
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +8 -8
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/search.js +24 -2
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts +13 -1
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/tags.js +52 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +25 -29
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +23 -8
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-core/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/package.json +1 -1
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/package.json +1 -1
- package/node_modules/@playdrop/types/dist/api.d.ts +124 -3
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +23 -0
- package/node_modules/@playdrop/types/dist/app-capability-filters.d.ts +24 -0
- package/node_modules/@playdrop/types/dist/app-capability-filters.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/app-capability-filters.js +72 -0
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +3 -2
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +2 -3
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.js +1 -1
- package/node_modules/@playdrop/types/dist/index.d.ts +2 -0
- package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/index.js +2 -0
- package/node_modules/@playdrop/types/dist/owned-assets.d.ts +21 -0
- package/node_modules/@playdrop/types/dist/owned-assets.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/owned-assets.js +35 -0
- package/node_modules/@playdrop/types/dist/player-meta.d.ts +28 -0
- package/node_modules/@playdrop/types/dist/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.d.ts +111 -1
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +3 -0
- package/node_modules/@playdrop/types/package.json +1 -1
- package/node_modules/@playdrop/vox-three/package.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/domains/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,OAAO,EACP,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/domains/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,iB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cA,MAAM,QAAQ,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;wCAaxC,MAAM,WAAW,MAAM,YAAY,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;EAiBvH"}
|
|
@@ -18,6 +18,17 @@ function appendNormalizedTagParams(params, tags) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
function appendAppCapabilityFilterParams(params, filters) {
|
|
22
|
+
if (typeof filters.auth === 'string' && filters.auth.trim().length > 0) {
|
|
23
|
+
params.set('auth', filters.auth.trim());
|
|
24
|
+
}
|
|
25
|
+
if (typeof filters.controller === 'string' && filters.controller.trim().length > 0) {
|
|
26
|
+
params.set('controller', filters.controller.trim());
|
|
27
|
+
}
|
|
28
|
+
if (typeof filters.surface === 'string' && filters.surface.trim().length > 0) {
|
|
29
|
+
params.set('surface', filters.surface.trim());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
21
32
|
async function buildAuthorizedHeaders(getClientHeaders, resolveToken) {
|
|
22
33
|
const headers = new Headers();
|
|
23
34
|
for (const [key, value] of Object.entries(getClientHeaders())) {
|
|
@@ -29,83 +40,6 @@ async function buildAuthorizedHeaders(getClientHeaders, resolveToken) {
|
|
|
29
40
|
}
|
|
30
41
|
return headers;
|
|
31
42
|
}
|
|
32
|
-
function buildAppVersionUploadForm(options) {
|
|
33
|
-
const form = new FormData();
|
|
34
|
-
form.append('version', options.version);
|
|
35
|
-
if (options.releaseNotes !== undefined)
|
|
36
|
-
form.append('releaseNotes', options.releaseNotes);
|
|
37
|
-
if (options.visibility !== undefined)
|
|
38
|
-
form.append('visibility', options.visibility);
|
|
39
|
-
if (options.surfaceTargets && options.surfaceTargets.length > 0) {
|
|
40
|
-
form.append('surfaceTargets', JSON.stringify(options.surfaceTargets));
|
|
41
|
-
}
|
|
42
|
-
if (options.assetSpecSupport) {
|
|
43
|
-
form.append('assetSpecSupport', JSON.stringify(options.assetSpecSupport));
|
|
44
|
-
}
|
|
45
|
-
appendAppVersionMetadataFields(form, options);
|
|
46
|
-
appendAppVersionMediaFiles(form, options);
|
|
47
|
-
return form;
|
|
48
|
-
}
|
|
49
|
-
// eslint-disable-next-line complexity
|
|
50
|
-
function appendAppVersionMetadataFields(form, options) {
|
|
51
|
-
if (options.entryPoint !== undefined)
|
|
52
|
-
form.append('entryPoint', options.entryPoint);
|
|
53
|
-
if (options.authMode !== undefined)
|
|
54
|
-
form.append('authMode', options.authMode);
|
|
55
|
-
if (options.controllerMode !== undefined)
|
|
56
|
-
form.append('controllerMode', options.controllerMode);
|
|
57
|
-
if (options.previewable !== undefined)
|
|
58
|
-
form.append('previewable', String(options.previewable));
|
|
59
|
-
if (options.setAsCurrent !== undefined)
|
|
60
|
-
form.append('setAsCurrent', String(options.setAsCurrent));
|
|
61
|
-
if (options.skipReview !== undefined)
|
|
62
|
-
form.append('skipReview', String(options.skipReview));
|
|
63
|
-
if (options.tags !== undefined)
|
|
64
|
-
form.append('tags', JSON.stringify(options.tags));
|
|
65
|
-
if (options.clearTags !== undefined)
|
|
66
|
-
form.append('clearTags', String(options.clearTags));
|
|
67
|
-
if (options.remixRef !== undefined)
|
|
68
|
-
form.append('remixRef', options.remixRef);
|
|
69
|
-
if (options.externalUrl !== undefined)
|
|
70
|
-
form.append('externalUrl', options.externalUrl);
|
|
71
|
-
if (options.displayName !== undefined)
|
|
72
|
-
form.append('displayName', options.displayName);
|
|
73
|
-
if (options.description !== undefined)
|
|
74
|
-
form.append('description', options.description);
|
|
75
|
-
if (options.type !== undefined)
|
|
76
|
-
form.append('type', options.type);
|
|
77
|
-
if (options.emoji !== undefined)
|
|
78
|
-
form.append('emoji', options.emoji);
|
|
79
|
-
if (options.color !== undefined)
|
|
80
|
-
form.append('color', options.color);
|
|
81
|
-
if (options.achievements !== undefined)
|
|
82
|
-
form.append('achievements', JSON.stringify(options.achievements));
|
|
83
|
-
if (options.leaderboards !== undefined)
|
|
84
|
-
form.append('leaderboards', JSON.stringify(options.leaderboards));
|
|
85
|
-
options.achievementIconFiles?.forEach(({ key, file }) => {
|
|
86
|
-
form.append(`achievementIcon:${key}`, file);
|
|
87
|
-
});
|
|
88
|
-
if (options.bundle)
|
|
89
|
-
form.append('bundle', options.bundle);
|
|
90
|
-
if (options.source)
|
|
91
|
-
form.append('source', options.source);
|
|
92
|
-
if (options.ecs)
|
|
93
|
-
form.append('ecs', options.ecs);
|
|
94
|
-
if (options.server)
|
|
95
|
-
form.append('server', options.server);
|
|
96
|
-
}
|
|
97
|
-
function appendAppVersionMediaFiles(form, options) {
|
|
98
|
-
if (options.icon)
|
|
99
|
-
form.append('icon', options.icon);
|
|
100
|
-
if (options.heroPortrait)
|
|
101
|
-
form.append('heroPortrait', options.heroPortrait);
|
|
102
|
-
if (options.heroLandscape)
|
|
103
|
-
form.append('heroLandscape', options.heroLandscape);
|
|
104
|
-
options.screenshotsPortrait?.forEach((screenshot) => form.append('screenshotsPortrait', screenshot));
|
|
105
|
-
options.screenshotsLandscape?.forEach((screenshot) => form.append('screenshotsLandscape', screenshot));
|
|
106
|
-
options.videosPortrait?.forEach((video) => form.append('videosPortrait', video));
|
|
107
|
-
options.videosLandscape?.forEach((video) => form.append('videosLandscape', video));
|
|
108
|
-
}
|
|
109
43
|
async function fetchAppsByCreatorRequest(request, handleApiError, creatorUsername, options = {}) {
|
|
110
44
|
const normalizedCreator = creatorUsername.trim();
|
|
111
45
|
const params = new URLSearchParams();
|
|
@@ -118,6 +52,10 @@ async function fetchAppsByCreatorRequest(request, handleApiError, creatorUsernam
|
|
|
118
52
|
if (typeof options.type === 'string' && options.type.trim().length > 0) {
|
|
119
53
|
params.set('type', options.type.trim());
|
|
120
54
|
}
|
|
55
|
+
if (typeof options.sort === 'string' && options.sort.trim().length > 0) {
|
|
56
|
+
params.set('sort', options.sort.trim());
|
|
57
|
+
}
|
|
58
|
+
appendAppCapabilityFilterParams(params, options);
|
|
121
59
|
appendNormalizedTagParams(params, options.tags);
|
|
122
60
|
const query = params.toString();
|
|
123
61
|
const response = await request({
|
|
@@ -129,23 +67,8 @@ async function fetchAppsByCreatorRequest(request, handleApiError, creatorUsernam
|
|
|
129
67
|
}
|
|
130
68
|
return response.body;
|
|
131
69
|
}
|
|
132
|
-
async function
|
|
133
|
-
|
|
134
|
-
const base = input.resolveBaseUrl();
|
|
135
|
-
const path = `${input.buildCreatorAppMutationPath(creatorUsername, appName)}/versions`;
|
|
136
|
-
const headers = await buildAuthorizedHeaders(input.getClientHeaders, input.resolveToken);
|
|
137
|
-
const response = await input.fetchImpl(input.resolveUrl(base, path), {
|
|
138
|
-
method: 'POST',
|
|
139
|
-
headers,
|
|
140
|
-
body: form,
|
|
141
|
-
...buildBrowserCredentialsInit(input.includeBrowserCredentials),
|
|
142
|
-
});
|
|
143
|
-
const parsed = await input.parseResponseBody(response);
|
|
144
|
-
const apiResponse = { status: response.status, body: parsed, headers: response.headers };
|
|
145
|
-
if (response.status !== 201) {
|
|
146
|
-
input.handleApiError(apiResponse, 'upload_app_version');
|
|
147
|
-
}
|
|
148
|
-
return parsed;
|
|
70
|
+
async function buildAppUploadAuthorizedHeaders(input) {
|
|
71
|
+
return await buildAuthorizedHeaders(input.getClientHeaders, input.resolveToken);
|
|
149
72
|
}
|
|
150
73
|
// eslint-disable-next-line max-lines-per-function
|
|
151
74
|
export function buildAppsApiClientMethods(input) {
|
|
@@ -159,6 +82,10 @@ export function buildAppsApiClientMethods(input) {
|
|
|
159
82
|
if (typeof options.offset === 'number' && Number.isFinite(options.offset)) {
|
|
160
83
|
params.set('offset', String(options.offset));
|
|
161
84
|
}
|
|
85
|
+
if (typeof options.sort === 'string' && options.sort.trim().length > 0) {
|
|
86
|
+
params.set('sort', options.sort.trim());
|
|
87
|
+
}
|
|
88
|
+
appendAppCapabilityFilterParams(params, options);
|
|
162
89
|
appendNormalizedTagParams(params, options.tags);
|
|
163
90
|
const query = params.toString();
|
|
164
91
|
const response = await request({
|
|
@@ -178,6 +105,10 @@ export function buildAppsApiClientMethods(input) {
|
|
|
178
105
|
if (typeof options.offset === 'number' && Number.isFinite(options.offset)) {
|
|
179
106
|
params.set('offset', String(options.offset));
|
|
180
107
|
}
|
|
108
|
+
if (typeof options.sort === 'string' && options.sort.trim().length > 0) {
|
|
109
|
+
params.set('sort', options.sort.trim());
|
|
110
|
+
}
|
|
111
|
+
appendAppCapabilityFilterParams(params, options);
|
|
181
112
|
appendNormalizedTagParams(params, options.tags);
|
|
182
113
|
const query = params.toString();
|
|
183
114
|
const response = await request({
|
|
@@ -245,18 +176,85 @@ export function buildAppsApiClientMethods(input) {
|
|
|
245
176
|
}
|
|
246
177
|
return response.body;
|
|
247
178
|
},
|
|
248
|
-
async
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
179
|
+
async initializeAppUpload(creatorUsername, appName, requestBody) {
|
|
180
|
+
const response = await request({
|
|
181
|
+
method: 'POST',
|
|
182
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions`,
|
|
183
|
+
body: requestBody,
|
|
184
|
+
});
|
|
185
|
+
if (response.status !== 200) {
|
|
186
|
+
handleApiError(response, 'initialize_app_upload');
|
|
187
|
+
}
|
|
188
|
+
return response.body;
|
|
189
|
+
},
|
|
190
|
+
async uploadAppSessionFile(creatorUsername, appName, sessionId, fileKey, options) {
|
|
191
|
+
const form = new FormData();
|
|
192
|
+
const filename = typeof options.filename === 'string' && options.filename.trim().length > 0
|
|
193
|
+
? options.filename.trim()
|
|
194
|
+
: 'upload.bin';
|
|
195
|
+
form.append('file', options.file, filename);
|
|
196
|
+
const base = resolveBaseUrl();
|
|
197
|
+
const headers = await buildAppUploadAuthorizedHeaders({ getClientHeaders, resolveToken });
|
|
198
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/files/${encodeURIComponent(fileKey)}`;
|
|
199
|
+
const response = await fetchImpl(resolveUrl(base, path), {
|
|
200
|
+
method: 'POST',
|
|
201
|
+
headers,
|
|
202
|
+
body: form,
|
|
203
|
+
...buildBrowserCredentialsInit(includeBrowserCredentials),
|
|
204
|
+
});
|
|
205
|
+
const parsed = await parseResponseBody(response);
|
|
206
|
+
const apiResponse = { status: response.status, body: parsed, headers: response.headers };
|
|
207
|
+
if (response.status !== 200) {
|
|
208
|
+
handleApiError(apiResponse, 'upload_app_session_file');
|
|
209
|
+
}
|
|
210
|
+
return parsed;
|
|
211
|
+
},
|
|
212
|
+
async uploadAppSessionOwnedAsset(creatorUsername, appName, sessionId, uploadKey, options) {
|
|
213
|
+
const form = new FormData();
|
|
214
|
+
for (const entry of options.files) {
|
|
215
|
+
const fieldName = typeof entry.fieldName === 'string' && entry.fieldName.trim().length > 0
|
|
216
|
+
? entry.fieldName.trim()
|
|
217
|
+
: 'file';
|
|
218
|
+
const filename = typeof entry.filename === 'string' && entry.filename.trim().length > 0
|
|
219
|
+
? entry.filename.trim()
|
|
220
|
+
: 'upload.bin';
|
|
221
|
+
form.append(fieldName, entry.file, filename);
|
|
222
|
+
}
|
|
223
|
+
const base = resolveBaseUrl();
|
|
224
|
+
const headers = await buildAppUploadAuthorizedHeaders({ getClientHeaders, resolveToken });
|
|
225
|
+
const path = `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/owned-assets/${encodeURIComponent(uploadKey)}`;
|
|
226
|
+
const response = await fetchImpl(resolveUrl(base, path), {
|
|
227
|
+
method: 'POST',
|
|
228
|
+
headers,
|
|
229
|
+
body: form,
|
|
230
|
+
...buildBrowserCredentialsInit(includeBrowserCredentials),
|
|
231
|
+
});
|
|
232
|
+
const parsed = await parseResponseBody(response);
|
|
233
|
+
const apiResponse = { status: response.status, body: parsed, headers: response.headers };
|
|
234
|
+
if (response.status !== 200) {
|
|
235
|
+
handleApiError(apiResponse, 'upload_app_session_owned_asset');
|
|
236
|
+
}
|
|
237
|
+
return parsed;
|
|
238
|
+
},
|
|
239
|
+
async finalizeAppUpload(creatorUsername, appName, sessionId) {
|
|
240
|
+
const response = await request({
|
|
241
|
+
method: 'POST',
|
|
242
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/finalize`,
|
|
243
|
+
});
|
|
244
|
+
if (response.status !== 200) {
|
|
245
|
+
handleApiError(response, 'finalize_app_upload');
|
|
246
|
+
}
|
|
247
|
+
return response.body;
|
|
248
|
+
},
|
|
249
|
+
async abortAppUpload(creatorUsername, appName, sessionId) {
|
|
250
|
+
const response = await request({
|
|
251
|
+
method: 'POST',
|
|
252
|
+
path: `${buildCreatorAppMutationPath(creatorUsername, appName)}/upload-sessions/${encodeURIComponent(sessionId)}/abort`,
|
|
253
|
+
});
|
|
254
|
+
if (response.status !== 200) {
|
|
255
|
+
handleApiError(response, 'abort_app_upload');
|
|
256
|
+
}
|
|
257
|
+
return response.body;
|
|
260
258
|
},
|
|
261
259
|
async fetchAppRelated(creatorUsername, appName) {
|
|
262
260
|
const response = await request({
|
|
@@ -321,6 +319,18 @@ export function buildAppsApiClientMethods(input) {
|
|
|
321
319
|
}
|
|
322
320
|
return response.body;
|
|
323
321
|
},
|
|
322
|
+
async fetchAppRuntimeAssets(creatorUsername, appName, version) {
|
|
323
|
+
const normalizedVersion = normalizeSemverInput(version);
|
|
324
|
+
const path = `/apps/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(appName)}/versions/${encodeURIComponent(normalizedVersion)}/runtime-assets`;
|
|
325
|
+
const response = await request({
|
|
326
|
+
method: 'GET',
|
|
327
|
+
path,
|
|
328
|
+
});
|
|
329
|
+
if (response.status !== 200) {
|
|
330
|
+
handleApiError(response, 'fetch_app_runtime_assets');
|
|
331
|
+
}
|
|
332
|
+
return response.body;
|
|
333
|
+
},
|
|
324
334
|
async downloadAppSource(creatorUsername, appName, version) {
|
|
325
335
|
const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
|
|
326
336
|
const name = normalizeCreatorItemSlug(appName, 'name');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetBrowseKind, AssetCategoriesResponse, AssetCategory, AssetDetailResponse, AssetListResponse, AssetSpecAssetsListResponse, AssetSpecAppsListResponse, AssetSpecDetailResponse, AssetSpecListResponse, AssetSpecVersionsListResponse, AssetSourceBundleResponse, AssetVersionsListResponse, ContentRemixRelationsResponse, CreateAssetSpecVersionResponse, CreateAssetVersionResponse, DeleteAssetSpecResponse, DeleteAssetSpecVersionResponse, DeleteAssetResponse, DeleteAssetVersionResponse, UpdateAssetRequest, UpdateAssetSpecVersionResponse, UpdateAssetResponse, UpdateAssetVersionRequest, UpdateAssetVersionResponse } from '@playdrop/types';
|
|
1
|
+
import type { AssetBrowseKind, AssetCategoriesResponse, AssetCategory, AssetDetailResponse, AssetListResponse, AssetSpecAssetsListResponse, AssetSpecAppsListResponse, AssetSpecDetailResponse, AssetSpecListResponse, AssetSpecVersionResponseEnvelope, AssetSpecVersionsListResponse, AssetSourceBundleResponse, AssetVersionsListResponse, ContentRemixRelationsResponse, CreateAssetSpecVersionResponse, CreateAssetVersionResponse, DeleteAssetSpecResponse, DeleteAssetSpecVersionResponse, DeleteAssetResponse, DeleteAssetVersionResponse, UpdateAssetRequest, UpdateAssetSpecVersionResponse, UpdateAssetResponse, UpdateAssetVersionRequest, UpdateAssetVersionResponse } from '@playdrop/types';
|
|
2
2
|
import type { UploadAssetSpecVersionOptions, UploadAssetVersionOptions } from '../client.js';
|
|
3
3
|
type ApiResponseLike<T> = {
|
|
4
4
|
status: number;
|
|
@@ -72,6 +72,7 @@ export declare function buildAssetsApiClientMethods(input: {
|
|
|
72
72
|
limit?: number;
|
|
73
73
|
offset?: number;
|
|
74
74
|
}): Promise<AssetSpecVersionsListResponse>;
|
|
75
|
+
fetchAssetSpecVersion(creatorUsername: string, name: string, version: string): Promise<AssetSpecVersionResponseEnvelope>;
|
|
75
76
|
listAssetsByAssetSpec(creatorUsername: string, name: string, options?: {
|
|
76
77
|
limit?: number;
|
|
77
78
|
offset?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/domains/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,yBAAyB,EAEzB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,0BAA0B,EAC1B,uBAAuB,EACvB,8BAA8B,EAC9B,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAG7F,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,KAAK,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,KAA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EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GACnI,OAAO,CAAC,8BAA8B,CAAC;4CAavB,MAAM,QACjB,MAAM,WACH,MAAM,GACd,OAAO,CAAC,8BAA8B,CAAC;qCAYvB,MAAM,QACjB,MAAM,GACX,OAAO,CAAC,uBAAuB,CAAC;uCAYhB,MAAM,aACZ,MAAM,YACP,MAAM,GAAG,MAAM,YAChB;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GACzB,OAAO,CAAC,IAAI,CAAC;yCAmCG,MAAM,aACZ,MAAM,YACP,MAAM,GAAG,MAAM,GACxB,OAAO,CAAC;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,yBAAyB,CAAA;KAAE,CAAC;EA2ClE"}
|
|
@@ -85,6 +85,9 @@ function appendAssetVersionOptionalFields(form, options) {
|
|
|
85
85
|
if (typeof options.sourceAppVersionId === 'number') {
|
|
86
86
|
form.set('sourceAppVersionId', String(options.sourceAppVersionId));
|
|
87
87
|
}
|
|
88
|
+
if (typeof options.runtimeKey === 'string' && options.runtimeKey.trim().length > 0) {
|
|
89
|
+
form.set('runtimeKey', options.runtimeKey.trim());
|
|
90
|
+
}
|
|
88
91
|
if (typeof options.sourceGenerationId === 'string' && options.sourceGenerationId.trim().length > 0) {
|
|
89
92
|
form.set('sourceGenerationId', options.sourceGenerationId.trim());
|
|
90
93
|
}
|
|
@@ -375,6 +378,16 @@ export function buildAssetsApiClientMethods(input) {
|
|
|
375
378
|
}
|
|
376
379
|
return response.body;
|
|
377
380
|
},
|
|
381
|
+
async fetchAssetSpecVersion(creatorUsername, name, version) {
|
|
382
|
+
const response = await request({
|
|
383
|
+
method: 'GET',
|
|
384
|
+
path: `/asset-specs/${encodeURIComponent(creatorUsername)}/${encodeURIComponent(name)}/versions/${encodeURIComponent(version)}`,
|
|
385
|
+
});
|
|
386
|
+
if (response.status !== 200) {
|
|
387
|
+
handleApiError(response, 'fetch_asset_spec_version');
|
|
388
|
+
}
|
|
389
|
+
return response.body;
|
|
390
|
+
},
|
|
378
391
|
async listAssetsByAssetSpec(creatorUsername, name, options = {}) {
|
|
379
392
|
const params = new URLSearchParams();
|
|
380
393
|
if (typeof options.limit === 'number') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdInterstitialShowResponse, AdLoadResponse, AdShowRequest, AdRewardedShowResponse, AssetPurchaseRequest, BoostActivationRequest, BoostBalanceResponse, BoostHistoryResponse, BoostPurchaseRequest, BoostPurchaseResponse, BoostReportQuery, BoostReportResponse, BoostStatusResponse, CreditPackCheckoutSessionRequest, CreditPackCheckoutSessionResponse, CreditPackCheckoutStatusResponse, CreatorEarningsResponse, IapPurchaseRequest, IapPurchaseResponse, IapReceiptListParams, IapReceiptResponse, IapReceiptsResponse, PurchaseResponse, ShopResponse, TransactionsResponse } from '@playdrop/types';
|
|
1
|
+
import type { AdLoadRequest, AdInterstitialShowResponse, AdLoadResponse, AdShowRequest, AdRewardedShowResponse, AssetPurchaseRequest, BoostActivationRequest, BoostBalanceResponse, BoostHistoryResponse, BoostPurchaseRequest, BoostPurchaseResponse, BoostReportQuery, BoostReportResponse, BoostStatusResponse, CreditPackCheckoutSessionRequest, CreditPackCheckoutSessionResponse, CreditPackCheckoutStatusResponse, CreatorEarningsResponse, IapPurchaseRequest, IapPurchaseResponse, IapReceiptListParams, IapReceiptResponse, IapReceiptsResponse, PurchaseResponse, ShopResponse, TransactionsResponse } from '@playdrop/types';
|
|
2
2
|
type ApiResponseLike<T> = {
|
|
3
3
|
status: number;
|
|
4
4
|
body: T;
|
|
@@ -46,12 +46,12 @@ export declare function buildPaymentsApiClientMethods(input: {
|
|
|
46
46
|
days?: number;
|
|
47
47
|
appId?: number;
|
|
48
48
|
}): Promise<CreatorEarningsResponse>;
|
|
49
|
-
loadInterstitialAd(
|
|
50
|
-
loadDevInterstitialAd(appId: number, slot: number): Promise<AdLoadResponse>;
|
|
49
|
+
loadInterstitialAd(body: AdLoadRequest): Promise<AdLoadResponse>;
|
|
50
|
+
loadDevInterstitialAd(appId: number, slot: number, body: Pick<AdLoadRequest, "viewerSurface">): Promise<AdLoadResponse>;
|
|
51
51
|
showInterstitialAd(body: AdShowRequest): Promise<AdInterstitialShowResponse>;
|
|
52
52
|
showDevInterstitialAd(appId: number, slot: number, body: AdShowRequest): Promise<AdInterstitialShowResponse>;
|
|
53
|
-
loadRewardedAd(
|
|
54
|
-
loadDevRewardedAd(appId: number, slot: number): Promise<AdLoadResponse>;
|
|
53
|
+
loadRewardedAd(body: AdLoadRequest): Promise<AdLoadResponse>;
|
|
54
|
+
loadDevRewardedAd(appId: number, slot: number, body: Pick<AdLoadRequest, "viewerSurface">): Promise<AdLoadResponse>;
|
|
55
55
|
showRewardedAd(body: AdShowRequest): Promise<AdRewardedShowResponse>;
|
|
56
56
|
showDevRewardedAd(appId: number, slot: number, body: AdShowRequest): Promise<AdRewardedShowResponse>;
|
|
57
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/domains/payments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAChC,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe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,aAAa,GAAG,OAAO,CAAC,sBAAsB,CAAC;EAY7G"}
|
|
@@ -295,22 +295,22 @@ export function buildPaymentsApiClientMethods(input) {
|
|
|
295
295
|
}
|
|
296
296
|
return response.body;
|
|
297
297
|
},
|
|
298
|
-
async loadInterstitialAd(
|
|
298
|
+
async loadInterstitialAd(body) {
|
|
299
299
|
const response = await request({
|
|
300
300
|
method: 'POST',
|
|
301
301
|
path: '/ads/interstitial/load',
|
|
302
|
-
body
|
|
302
|
+
body,
|
|
303
303
|
});
|
|
304
304
|
if (response.status !== 200) {
|
|
305
305
|
handleApiError(response, 'load_interstitial_ad');
|
|
306
306
|
}
|
|
307
307
|
return response.body;
|
|
308
308
|
},
|
|
309
|
-
async loadDevInterstitialAd(appId, slot) {
|
|
309
|
+
async loadDevInterstitialAd(appId, slot, body) {
|
|
310
310
|
const response = await request({
|
|
311
311
|
method: 'POST',
|
|
312
312
|
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/ads/interstitial/load`,
|
|
313
|
-
body
|
|
313
|
+
body,
|
|
314
314
|
});
|
|
315
315
|
if (response.status !== 200) {
|
|
316
316
|
handleApiError(response, 'load_dev_interstitial_ad');
|
|
@@ -339,22 +339,22 @@ export function buildPaymentsApiClientMethods(input) {
|
|
|
339
339
|
}
|
|
340
340
|
return response.body;
|
|
341
341
|
},
|
|
342
|
-
async loadRewardedAd(
|
|
342
|
+
async loadRewardedAd(body) {
|
|
343
343
|
const response = await request({
|
|
344
344
|
method: 'POST',
|
|
345
345
|
path: '/ads/rewarded/load',
|
|
346
|
-
body
|
|
346
|
+
body,
|
|
347
347
|
});
|
|
348
348
|
if (response.status !== 200) {
|
|
349
349
|
handleApiError(response, 'load_rewarded_ad');
|
|
350
350
|
}
|
|
351
351
|
return response.body;
|
|
352
352
|
},
|
|
353
|
-
async loadDevRewardedAd(appId, slot) {
|
|
353
|
+
async loadDevRewardedAd(appId, slot, body) {
|
|
354
354
|
const response = await request({
|
|
355
355
|
method: 'POST',
|
|
356
356
|
path: `/apps/${encodeURIComponent(String(appId))}/dev/players/${encodeURIComponent(String(slot))}/ads/rewarded/load`,
|
|
357
|
-
body
|
|
357
|
+
body,
|
|
358
358
|
});
|
|
359
359
|
if (response.status !== 200) {
|
|
360
360
|
handleApiError(response, 'load_dev_rewarded_ad');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/domains/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,KAAK,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,KAAK,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/domains/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,i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Filters(searchRequest) {
|
|
31
|
+
return typeof searchRequest.creatorUsername === 'string' && searchRequest.creatorUsername.trim().length > 0
|
|
32
|
+
|| Array.isArray(searchRequest.tags) && searchRequest.tags.length > 0
|
|
33
|
+
|| searchRequest.appType !== undefined
|
|
34
|
+
|| searchRequest.auth !== undefined
|
|
35
|
+
|| searchRequest.controller !== undefined
|
|
36
|
+
|| searchRequest.surface !== undefined
|
|
37
|
+
|| searchRequest.assetType !== undefined
|
|
38
|
+
|| searchRequest.assetCategory !== undefined
|
|
39
|
+
|| typeof searchRequest.assetSubcategory === 'string'
|
|
40
|
+
|| typeof searchRequest.assetSpec === 'string'
|
|
41
|
+
|| typeof searchRequest.assetSpecOwner === 'string'
|
|
42
|
+
|| typeof searchRequest.assetSpecName === 'string'
|
|
43
|
+
|| searchRequest.packContainsCategory !== undefined
|
|
44
|
+
|| typeof searchRequest.packContainsSubcategory === 'string';
|
|
45
|
+
}
|
|
30
46
|
export function buildSearchApiClientMethods(input) {
|
|
31
47
|
const { request, handleApiError, normalizeSearchModeInput, normalizeSearchKindInput, normalizeSearchAssetTypeInput, normalizePositiveIntegerInput, } = input;
|
|
32
48
|
return {
|
|
33
49
|
async search(searchRequest) {
|
|
34
50
|
const query = typeof searchRequest.q === 'string' ? searchRequest.q.trim() : '';
|
|
35
|
-
if (!query) {
|
|
51
|
+
if (!query && !hasSearchScopeFilters(searchRequest)) {
|
|
36
52
|
throw new Error('invalid_search_query');
|
|
37
53
|
}
|
|
38
54
|
const params = new URLSearchParams();
|
|
39
|
-
|
|
55
|
+
if (query) {
|
|
56
|
+
params.set('q', query);
|
|
57
|
+
}
|
|
40
58
|
if (searchRequest.mode) {
|
|
41
59
|
params.set('mode', normalizeSearchModeInput(searchRequest.mode));
|
|
42
60
|
}
|
|
@@ -46,11 +64,15 @@ export function buildSearchApiClientMethods(input) {
|
|
|
46
64
|
if (searchRequest.sort) {
|
|
47
65
|
params.set('sort', searchRequest.sort);
|
|
48
66
|
}
|
|
67
|
+
setNormalizedStringParam(params, 'creator', searchRequest.creatorUsername);
|
|
49
68
|
setNormalizedPositiveIntegerParam(params, 'page', searchRequest.page, normalizePositiveIntegerInput, 'invalid_search_page');
|
|
50
69
|
setNormalizedPositiveIntegerParam(params, 'pageSize', searchRequest.pageSize, normalizePositiveIntegerInput, 'invalid_search_page_size');
|
|
51
70
|
if (searchRequest.appType) {
|
|
52
71
|
params.set('appType', searchRequest.appType);
|
|
53
72
|
}
|
|
73
|
+
setNormalizedStringParam(params, 'auth', searchRequest.auth);
|
|
74
|
+
setNormalizedStringParam(params, 'controller', searchRequest.controller);
|
|
75
|
+
setNormalizedStringParam(params, 'surface', searchRequest.surface);
|
|
54
76
|
if (searchRequest.assetType) {
|
|
55
77
|
params.set('assetType', normalizeSearchAssetTypeInput(searchRequest.assetType));
|
|
56
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdminTagGroupResponse, AdminTagGroupsResponse, AdminTagResponse, CreateTagGroupRequest, CreateTagRequest, SavedItemKind, TagDetailResponse, TagListResponse, UpdateTagGroupRequest, UpdateTagRequest } from '@playdrop/types';
|
|
1
|
+
import type { AdminTagGroupResponse, AdminTagGroupsResponse, AdminTagResponse, CreateTagGroupRequest, CreateTagRequest, SavedItemKind, TagDirectoryResponse, TagDetailResponse, TagGroupDetailResponse, TagListResponse, TagGroupSort, UpdateTagGroupRequest, UpdateTagRequest } from '@playdrop/types';
|
|
2
2
|
type ApiResponseLike<T> = {
|
|
3
3
|
status: number;
|
|
4
4
|
body: T;
|
|
@@ -17,6 +17,11 @@ export declare function buildTagsApiClientMethods(input: {
|
|
|
17
17
|
handleApiError: ErrorHandler;
|
|
18
18
|
normalizePositiveIntegerInput: (value: number, errorCode: string) => number;
|
|
19
19
|
}): {
|
|
20
|
+
fetchTagDirectory(options?: {
|
|
21
|
+
limit?: number;
|
|
22
|
+
offset?: number;
|
|
23
|
+
tagLimit?: number;
|
|
24
|
+
}): Promise<TagDirectoryResponse>;
|
|
20
25
|
fetchTags(options?: {
|
|
21
26
|
targetKind?: SavedItemKind;
|
|
22
27
|
groupSlug?: string;
|
|
@@ -24,6 +29,13 @@ export declare function buildTagsApiClientMethods(input: {
|
|
|
24
29
|
offset?: number;
|
|
25
30
|
}): Promise<TagListResponse>;
|
|
26
31
|
fetchTag(groupSlug: string, tagSlug: string): Promise<TagDetailResponse>;
|
|
32
|
+
fetchTagGroup(groupSlug: string, options?: {
|
|
33
|
+
targetKind?: SavedItemKind;
|
|
34
|
+
appType?: string;
|
|
35
|
+
sort?: TagGroupSort;
|
|
36
|
+
limit?: number;
|
|
37
|
+
offset?: number;
|
|
38
|
+
}): Promise<TagGroupDetailResponse>;
|
|
27
39
|
fetchAdminTagGroups(): Promise<AdminTagGroupsResponse>;
|
|
28
40
|
createAdminTagGroup(requestBody: CreateTagGroupRequest): Promise<AdminTagGroupResponse>;
|
|
29
41
|
updateAdminTagGroup(groupSlug: string, requestBody: UpdateTagGroupRequest): Promise<AdminTagGroupResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/domains/tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAA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ACF,gBAAgB,GAC5B,OAAO,CAAC,gBAAgB,CAAC;EAiB/B"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
export function buildTagsApiClientMethods(input) {
|
|
2
2
|
const { request, handleApiError, normalizePositiveIntegerInput, } = input;
|
|
3
3
|
return {
|
|
4
|
+
async fetchTagDirectory(options = {}) {
|
|
5
|
+
const params = new URLSearchParams();
|
|
6
|
+
if (typeof options.limit === 'number') {
|
|
7
|
+
params.set('limit', String(normalizePositiveIntegerInput(options.limit, 'invalid_tags_limit')));
|
|
8
|
+
}
|
|
9
|
+
if (typeof options.offset === 'number') {
|
|
10
|
+
params.set('offset', String(normalizePositiveIntegerInput(options.offset, 'invalid_tags_offset')));
|
|
11
|
+
}
|
|
12
|
+
if (typeof options.tagLimit === 'number') {
|
|
13
|
+
params.set('tagLimit', String(normalizePositiveIntegerInput(options.tagLimit, 'invalid_tags_limit')));
|
|
14
|
+
}
|
|
15
|
+
const query = params.toString();
|
|
16
|
+
const response = await request({
|
|
17
|
+
method: 'GET',
|
|
18
|
+
path: `/tags/directory${query ? `?${query}` : ''}`,
|
|
19
|
+
});
|
|
20
|
+
if (response.status !== 200) {
|
|
21
|
+
handleApiError(response, 'fetch_tag_directory');
|
|
22
|
+
}
|
|
23
|
+
return response.body;
|
|
24
|
+
},
|
|
4
25
|
async fetchTags(options = {}) {
|
|
5
26
|
const params = new URLSearchParams();
|
|
6
27
|
if (typeof options.targetKind === 'string' && options.targetKind.trim().length > 0) {
|
|
@@ -40,6 +61,37 @@ export function buildTagsApiClientMethods(input) {
|
|
|
40
61
|
}
|
|
41
62
|
return response.body;
|
|
42
63
|
},
|
|
64
|
+
async fetchTagGroup(groupSlug, options = {}) {
|
|
65
|
+
const normalizedGroupSlug = typeof groupSlug === 'string' ? groupSlug.trim() : '';
|
|
66
|
+
if (!normalizedGroupSlug) {
|
|
67
|
+
throw new Error('invalid_tag_group_slug');
|
|
68
|
+
}
|
|
69
|
+
const params = new URLSearchParams();
|
|
70
|
+
if (typeof options.targetKind === 'string' && options.targetKind.trim().length > 0) {
|
|
71
|
+
params.set('targetKind', options.targetKind.trim());
|
|
72
|
+
}
|
|
73
|
+
if (typeof options.appType === 'string' && options.appType.trim().length > 0) {
|
|
74
|
+
params.set('appType', options.appType.trim());
|
|
75
|
+
}
|
|
76
|
+
if (typeof options.sort === 'string' && options.sort.trim().length > 0) {
|
|
77
|
+
params.set('sort', options.sort.trim());
|
|
78
|
+
}
|
|
79
|
+
if (typeof options.limit === 'number') {
|
|
80
|
+
params.set('limit', String(normalizePositiveIntegerInput(options.limit, 'invalid_tags_limit')));
|
|
81
|
+
}
|
|
82
|
+
if (typeof options.offset === 'number') {
|
|
83
|
+
params.set('offset', String(normalizePositiveIntegerInput(options.offset, 'invalid_tags_offset')));
|
|
84
|
+
}
|
|
85
|
+
const query = params.toString();
|
|
86
|
+
const response = await request({
|
|
87
|
+
method: 'GET',
|
|
88
|
+
path: `/tags/${encodeURIComponent(normalizedGroupSlug)}${query ? `?${query}` : ''}`,
|
|
89
|
+
});
|
|
90
|
+
if (response.status !== 200) {
|
|
91
|
+
handleApiError(response, 'fetch_tag_group');
|
|
92
|
+
}
|
|
93
|
+
return response.body;
|
|
94
|
+
},
|
|
43
95
|
async fetchAdminTagGroups() {
|
|
44
96
|
const response = await request({
|
|
45
97
|
method: 'GET',
|