@smartico/public-api 0.0.388 → 0.0.389
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/dist/SmarticoAPI.d.ts +0 -1
- package/dist/WSAPI/WSAPIAvatars.d.ts +1 -4
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +4 -5
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SmarticoAPI.ts +2 -2
- package/src/WSAPI/WSAPIAvatars.ts +2 -5
package/package.json
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -1600,7 +1600,6 @@ class SmarticoAPI {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
|
|
1602
1602
|
public async avatarsCustomize(params: {
|
|
1603
|
-
label_id: number;
|
|
1604
1603
|
user_id: number;
|
|
1605
1604
|
prompt_id: number;
|
|
1606
1605
|
avatar_url: string;
|
|
@@ -1609,7 +1608,8 @@ class SmarticoAPI {
|
|
|
1609
1608
|
return this.sendAvatarApi<AvatarCustomizeResponse>({
|
|
1610
1609
|
method: 'avatar-customize',
|
|
1611
1610
|
body: {
|
|
1612
|
-
label_id
|
|
1611
|
+
// The server resolves label_id from label_api_key.
|
|
1612
|
+
label_api_key: this.label_api_key,
|
|
1613
1613
|
user_id: params.user_id,
|
|
1614
1614
|
user_ext_id: this.tracker?.getExtUserId(),
|
|
1615
1615
|
brand_key: this.brand_api_key || this.tracker?.params?.brand_key,
|
|
@@ -404,7 +404,6 @@ export class WSAPIAvatars extends WSAPIMiniGames {
|
|
|
404
404
|
*
|
|
405
405
|
* **Visitor mode**: not supported (throws).
|
|
406
406
|
*
|
|
407
|
-
* @param props.label_id Numeric Smartico label (brand) ID the user belongs to.
|
|
408
407
|
* @param props.user_id Numeric Smartico user ID.
|
|
409
408
|
* @param props.prompt_id Style-prompt ID (`prompt_id`) from {@link getAvatarPrompts}.
|
|
410
409
|
* @param props.avatar_url CDN URL of the base avatar to customize.
|
|
@@ -414,13 +413,12 @@ export class WSAPIAvatars extends WSAPIMiniGames {
|
|
|
414
413
|
*
|
|
415
414
|
* @example
|
|
416
415
|
* ```ts
|
|
417
|
-
* //
|
|
416
|
+
* // user_id identifies the Smartico user being customized.
|
|
418
417
|
* const prompts = await window._smartico.api.getAvatarPrompts();
|
|
419
418
|
* const prompt = prompts[0];
|
|
420
419
|
*
|
|
421
420
|
* console.log('[smartico] generating avatar — show a spinner for ~5-20s and disable the Generate button');
|
|
422
421
|
* const result = await window._smartico.api.avatarsCustomize({
|
|
423
|
-
* label_id,
|
|
424
422
|
* user_id,
|
|
425
423
|
* prompt_id: prompt.prompt_id,
|
|
426
424
|
* avatar_url: baseAvatar.avatar_url,
|
|
@@ -440,13 +438,12 @@ export class WSAPIAvatars extends WSAPIMiniGames {
|
|
|
440
438
|
* ```
|
|
441
439
|
*/
|
|
442
440
|
public async avatarsCustomize(props: {
|
|
443
|
-
label_id: number;
|
|
444
441
|
user_id: number;
|
|
445
442
|
prompt_id: number;
|
|
446
443
|
avatar_url: string;
|
|
447
444
|
avatar_real_id: number;
|
|
448
445
|
}): Promise<AvatarCustomizeResponse> {
|
|
449
|
-
const required: (keyof typeof props)[] = ['
|
|
446
|
+
const required: (keyof typeof props)[] = ['user_id', 'prompt_id', 'avatar_url', 'avatar_real_id'];
|
|
450
447
|
for (const field of required) {
|
|
451
448
|
if (!props[field]) {
|
|
452
449
|
throw new Error(`${field} is required`);
|