@rtsdk/topia 0.19.7 → 0.19.8
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/index.cjs +12 -14
- package/dist/index.d.ts +20 -32
- package/dist/index.js +12 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42263,7 +42263,6 @@ AI RULES for code assistants
|
|
|
42263
42263
|
*/
|
|
42264
42264
|
class User extends SDKController {
|
|
42265
42265
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
42266
|
-
var _a;
|
|
42267
42266
|
super(topia, Object.assign({ profileId: options === null || options === void 0 ? void 0 : options.profileId }, options.credentials));
|
|
42268
42267
|
_User_userInventoryItems.set(this, void 0);
|
|
42269
42268
|
_User_adminWorldsMap.set(this, void 0);
|
|
@@ -42271,13 +42270,6 @@ class User extends SDKController {
|
|
|
42271
42270
|
_User_scenesMap.set(this, void 0);
|
|
42272
42271
|
_User_worldsMap.set(this, void 0);
|
|
42273
42272
|
this.profileId = options === null || options === void 0 ? void 0 : options.profileId;
|
|
42274
|
-
// Warn devs about common mistake: passing profileId only inside credentials
|
|
42275
|
-
if (!this.profileId && ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.profileId)) {
|
|
42276
|
-
console.warn(`[@rtsdk/topia] User created without top-level profileId. ` +
|
|
42277
|
-
`You passed profileId inside credentials but not in options. ` +
|
|
42278
|
-
`Methods like grantInventoryItem will fail. ` +
|
|
42279
|
-
`Fix: User.create({ profileId: "${options.credentials.profileId}", credentials: { ... } })`);
|
|
42280
|
-
}
|
|
42281
42273
|
this.dataObject = {};
|
|
42282
42274
|
this.profile = {};
|
|
42283
42275
|
__classPrivateFieldSet(this, _User_adminWorldsMap, {}, "f");
|
|
@@ -42790,8 +42782,9 @@ class User extends SDKController {
|
|
|
42790
42782
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42791
42783
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42792
42784
|
try {
|
|
42793
|
-
if (!this.profileId)
|
|
42785
|
+
if (!this.profileId) {
|
|
42794
42786
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42787
|
+
}
|
|
42795
42788
|
let query = "";
|
|
42796
42789
|
if (appPublicKey)
|
|
42797
42790
|
query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
|
|
@@ -42830,8 +42823,9 @@ class User extends SDKController {
|
|
|
42830
42823
|
setDataObject(dataObject, options = {}) {
|
|
42831
42824
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42832
42825
|
try {
|
|
42833
|
-
if (!this.profileId)
|
|
42826
|
+
if (!this.profileId) {
|
|
42834
42827
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42828
|
+
}
|
|
42835
42829
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42836
42830
|
this.dataObject = dataObject || this.dataObject;
|
|
42837
42831
|
}
|
|
@@ -42864,8 +42858,9 @@ class User extends SDKController {
|
|
|
42864
42858
|
updateDataObject(dataObject, options = {}) {
|
|
42865
42859
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42866
42860
|
try {
|
|
42867
|
-
if (!this.profileId)
|
|
42861
|
+
if (!this.profileId) {
|
|
42868
42862
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42863
|
+
}
|
|
42869
42864
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42870
42865
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
42871
42866
|
}
|
|
@@ -42914,8 +42909,9 @@ class User extends SDKController {
|
|
|
42914
42909
|
fetchInventoryItems() {
|
|
42915
42910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42916
42911
|
try {
|
|
42917
|
-
if (!this.profileId)
|
|
42912
|
+
if (!this.profileId) {
|
|
42918
42913
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42914
|
+
}
|
|
42919
42915
|
const response = yield this.topiaPublicApi().get(`/user/inventory/${this.profileId}/get-user-inventory-items`, this.requestOptions);
|
|
42920
42916
|
// TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
|
|
42921
42917
|
const tempItems = [];
|
|
@@ -42951,8 +42947,9 @@ class User extends SDKController {
|
|
|
42951
42947
|
grantInventoryItem(item, quantity = 1) {
|
|
42952
42948
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42953
42949
|
try {
|
|
42954
|
-
if (!this.profileId)
|
|
42950
|
+
if (!this.profileId) {
|
|
42955
42951
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42952
|
+
}
|
|
42956
42953
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/grant-user-inventory-item`, { itemId: item.id, quantity }, this.requestOptions);
|
|
42957
42954
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42958
42955
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42982,8 +42979,9 @@ class User extends SDKController {
|
|
|
42982
42979
|
modifyInventoryItemQuantity(item, quantity) {
|
|
42983
42980
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42984
42981
|
try {
|
|
42985
|
-
if (!this.profileId)
|
|
42982
|
+
if (!this.profileId) {
|
|
42986
42983
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42984
|
+
}
|
|
42987
42985
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/update-user-inventory-item-quantity`, { userItemId: item.id, itemId: item.item_id, quantity }, this.requestOptions);
|
|
42988
42986
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42989
42987
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
package/dist/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ type DroppedAssetLinkType = {
|
|
|
74
74
|
linkSamlQueryParams?: string;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
type InteractiveCredentials
|
|
77
|
+
type InteractiveCredentials = {
|
|
78
78
|
apiKey?: string;
|
|
79
79
|
assetId?: string;
|
|
80
80
|
interactiveNonce?: string;
|
|
@@ -88,22 +88,22 @@ type InteractiveCredentials$1 = {
|
|
|
88
88
|
|
|
89
89
|
type AssetOptions = {
|
|
90
90
|
attributes?: AssetInterface | undefined;
|
|
91
|
-
credentials?: InteractiveCredentials
|
|
91
|
+
credentials?: InteractiveCredentials | undefined;
|
|
92
92
|
};
|
|
93
93
|
type DroppedAssetOptions = {
|
|
94
94
|
attributes?: DroppedAssetInterface | undefined;
|
|
95
|
-
credentials?: InteractiveCredentials
|
|
95
|
+
credentials?: InteractiveCredentials | undefined;
|
|
96
96
|
};
|
|
97
97
|
type UserOptions = {
|
|
98
|
-
credentials?: InteractiveCredentials
|
|
98
|
+
credentials?: InteractiveCredentials | undefined;
|
|
99
99
|
};
|
|
100
100
|
type VisitorOptions = {
|
|
101
101
|
attributes?: VisitorInterface | undefined;
|
|
102
|
-
credentials?: InteractiveCredentials
|
|
102
|
+
credentials?: InteractiveCredentials | undefined;
|
|
103
103
|
};
|
|
104
104
|
type WorldOptions = {
|
|
105
105
|
attributes?: WorldDetailsInterface | undefined;
|
|
106
|
-
credentials?: InteractiveCredentials
|
|
106
|
+
credentials?: InteractiveCredentials | undefined;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
type ResponseType = {
|
|
@@ -2343,7 +2343,7 @@ declare enum WorldActivityType {
|
|
|
2343
2343
|
}
|
|
2344
2344
|
|
|
2345
2345
|
interface SDKInterface {
|
|
2346
|
-
credentials?: InteractiveCredentials
|
|
2346
|
+
credentials?: InteractiveCredentials;
|
|
2347
2347
|
jwt?: string;
|
|
2348
2348
|
requestOptions: object;
|
|
2349
2349
|
topia: Topia;
|
|
@@ -2380,7 +2380,7 @@ interface AssetInterface extends SDKInterface {
|
|
|
2380
2380
|
}
|
|
2381
2381
|
type AssetOptionalInterface = {
|
|
2382
2382
|
attributes?: AssetInterface | object;
|
|
2383
|
-
credentials?: InteractiveCredentials
|
|
2383
|
+
credentials?: InteractiveCredentials;
|
|
2384
2384
|
};
|
|
2385
2385
|
|
|
2386
2386
|
interface DroppedAssetInterface extends AssetInterface {
|
|
@@ -2502,7 +2502,7 @@ interface DroppedAssetOptionalInterface {
|
|
|
2502
2502
|
text?: string;
|
|
2503
2503
|
urlSlug?: string;
|
|
2504
2504
|
};
|
|
2505
|
-
credentials?: InteractiveCredentials
|
|
2505
|
+
credentials?: InteractiveCredentials | object;
|
|
2506
2506
|
}
|
|
2507
2507
|
interface UpdateBroadcastInterface {
|
|
2508
2508
|
assetBroadcast?: boolean;
|
|
@@ -2594,7 +2594,7 @@ interface EcosystemInterface extends SDKInterface {
|
|
|
2594
2594
|
incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
|
|
2595
2595
|
}
|
|
2596
2596
|
interface EcosystemOptionalInterface {
|
|
2597
|
-
credentials?: InteractiveCredentials
|
|
2597
|
+
credentials?: InteractiveCredentials;
|
|
2598
2598
|
}
|
|
2599
2599
|
|
|
2600
2600
|
interface SceneInterface {
|
|
@@ -2622,7 +2622,7 @@ interface SceneInterface {
|
|
|
2622
2622
|
}
|
|
2623
2623
|
type SceneOptionalInterface = {
|
|
2624
2624
|
attributes?: SceneInterface | object;
|
|
2625
|
-
credentials?: InteractiveCredentials
|
|
2625
|
+
credentials?: InteractiveCredentials;
|
|
2626
2626
|
};
|
|
2627
2627
|
|
|
2628
2628
|
interface FireToastInterface {
|
|
@@ -2670,7 +2670,7 @@ interface UserInterface {
|
|
|
2670
2670
|
dataObject?: object | null;
|
|
2671
2671
|
}
|
|
2672
2672
|
interface UserOptionalInterface {
|
|
2673
|
-
credentials?: InteractiveCredentials
|
|
2673
|
+
credentials?: InteractiveCredentials;
|
|
2674
2674
|
profileId?: string | null;
|
|
2675
2675
|
visitorId?: number | null;
|
|
2676
2676
|
urlSlug?: string;
|
|
@@ -2746,7 +2746,7 @@ interface VisitorInterface extends SDKInterface {
|
|
|
2746
2746
|
}
|
|
2747
2747
|
interface VisitorOptionalInterface {
|
|
2748
2748
|
attributes?: VisitorInterface | object;
|
|
2749
|
-
credentials?: InteractiveCredentials
|
|
2749
|
+
credentials?: InteractiveCredentials;
|
|
2750
2750
|
}
|
|
2751
2751
|
interface MoveVisitorInterface {
|
|
2752
2752
|
shouldTeleportVisitor: boolean;
|
|
@@ -2812,12 +2812,12 @@ interface WebRTCConnectorInterface {
|
|
|
2812
2812
|
getTwilioConfig(): Promise<void | ResponseType>;
|
|
2813
2813
|
}
|
|
2814
2814
|
interface WebRTCConnectorOptionalInterface {
|
|
2815
|
-
credentials?: InteractiveCredentials
|
|
2815
|
+
credentials?: InteractiveCredentials;
|
|
2816
2816
|
twilioConfig?: object;
|
|
2817
2817
|
}
|
|
2818
2818
|
|
|
2819
2819
|
interface WorldActivityOptionalInterface {
|
|
2820
|
-
credentials?: InteractiveCredentials
|
|
2820
|
+
credentials?: InteractiveCredentials;
|
|
2821
2821
|
}
|
|
2822
2822
|
interface MoveAllVisitorsInterface {
|
|
2823
2823
|
shouldFetchVisitors?: boolean;
|
|
@@ -2907,24 +2907,12 @@ interface WorldInterface extends SDKInterface, WorldDetailsInterface {
|
|
|
2907
2907
|
}
|
|
2908
2908
|
interface WorldOptionalInterface {
|
|
2909
2909
|
attributes?: WorldDetailsInterface | object;
|
|
2910
|
-
credentials?: InteractiveCredentials
|
|
2910
|
+
credentials?: InteractiveCredentials;
|
|
2911
2911
|
}
|
|
2912
2912
|
interface WorldWebhooksInterface {
|
|
2913
2913
|
webhooks: Array<WebhookInterface>;
|
|
2914
2914
|
}
|
|
2915
2915
|
|
|
2916
|
-
type InteractiveCredentials = {
|
|
2917
|
-
apiKey?: string;
|
|
2918
|
-
assetId?: string;
|
|
2919
|
-
interactiveNonce?: string;
|
|
2920
|
-
interactivePublicKey?: string;
|
|
2921
|
-
profileId?: string | null;
|
|
2922
|
-
urlSlug?: string;
|
|
2923
|
-
visitorId?: number;
|
|
2924
|
-
iframeId?: string;
|
|
2925
|
-
gameEngineId?: string;
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
2916
|
/**
|
|
2929
2917
|
* Interface for an inventory item.
|
|
2930
2918
|
*/
|
|
@@ -3041,11 +3029,11 @@ declare class Topia implements TopiaInterface {
|
|
|
3041
3029
|
* ```
|
|
3042
3030
|
*/
|
|
3043
3031
|
declare abstract class SDKController implements SDKInterface {
|
|
3044
|
-
credentials: InteractiveCredentials
|
|
3032
|
+
credentials: InteractiveCredentials | undefined;
|
|
3045
3033
|
jwt?: string;
|
|
3046
3034
|
requestOptions: object;
|
|
3047
3035
|
topia: Topia;
|
|
3048
|
-
constructor(topia: Topia, credentials?: InteractiveCredentials
|
|
3036
|
+
constructor(topia: Topia, credentials?: InteractiveCredentials);
|
|
3049
3037
|
/**
|
|
3050
3038
|
* Returns the configured Axios instance for making API calls to Topia's Public API.
|
|
3051
3039
|
*
|
|
@@ -3685,7 +3673,7 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
3685
3673
|
*
|
|
3686
3674
|
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties already fetched.
|
|
3687
3675
|
*/
|
|
3688
|
-
getWithUniqueName(uniqueName: string, urlSlug: string, interactiveSecret: string, credentials: InteractiveCredentials
|
|
3676
|
+
getWithUniqueName(uniqueName: string, urlSlug: string, interactiveSecret: string, credentials: InteractiveCredentials): Promise<DroppedAsset>;
|
|
3689
3677
|
/**
|
|
3690
3678
|
* Drops an asset in a world and returns a new instance of DroppedAsset class with all properties.
|
|
3691
3679
|
*
|
|
@@ -4267,4 +4255,4 @@ declare class WorldFactory extends SDKController {
|
|
|
4267
4255
|
}>;
|
|
4268
4256
|
}
|
|
4269
4257
|
|
|
4270
|
-
export { AnalyticType, AnimationMetaType, Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, CreateNpcOptions, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetLinkType, DroppedAssetMediaType, DroppedAssetMediaVolumeRadius, DroppedAssetOptionalInterface, DroppedAssetOptions, Ecosystem, EcosystemFactory, EcosystemInterface, EcosystemOptionalInterface, FireToastInterface, FrameType, InteractiveCredentials
|
|
4258
|
+
export { AnalyticType, AnimationMetaType, Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, CreateNpcOptions, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetLinkType, DroppedAssetMediaType, DroppedAssetMediaVolumeRadius, DroppedAssetOptionalInterface, DroppedAssetOptions, Ecosystem, EcosystemFactory, EcosystemInterface, EcosystemOptionalInterface, FireToastInterface, FrameType, InteractiveCredentials, InventoryItemInterface, InventoryItemOptionalInterface, MoveAllVisitorsInterface, MoveVisitorInterface, NpcVoiceConfigInterface, OpenIframeInterface, RemoveClickableLinkInterface, ResponseType, SDKController, SDKInterface, Scene, SceneFactory, SceneInterface, SceneOptionalInterface, SetClickableLinkMultiInterface, SpawnEffectConfig, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateClickableLinkMultiInterface, UpdateDroppedAssetInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, User, UserFactory, UserInterface, UserInventoryItemInterface, UserInventoryItemMetadataType, UserInventoryItemOptionalInterface, UserOptionalInterface, UserOptions, Visitor, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WebRTCConnector, WebRTCConnectorFactory, WebRTCConnectorInterface, WebRTCConnectorOptionalInterface, WebhookInterface, World, WorldActivity, WorldActivityFactory, WorldActivityOptionalInterface, WorldActivityType, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions, WorldWebhooksInterface };
|
package/dist/index.js
CHANGED
|
@@ -42261,7 +42261,6 @@ AI RULES for code assistants
|
|
|
42261
42261
|
*/
|
|
42262
42262
|
class User extends SDKController {
|
|
42263
42263
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
42264
|
-
var _a;
|
|
42265
42264
|
super(topia, Object.assign({ profileId: options === null || options === void 0 ? void 0 : options.profileId }, options.credentials));
|
|
42266
42265
|
_User_userInventoryItems.set(this, void 0);
|
|
42267
42266
|
_User_adminWorldsMap.set(this, void 0);
|
|
@@ -42269,13 +42268,6 @@ class User extends SDKController {
|
|
|
42269
42268
|
_User_scenesMap.set(this, void 0);
|
|
42270
42269
|
_User_worldsMap.set(this, void 0);
|
|
42271
42270
|
this.profileId = options === null || options === void 0 ? void 0 : options.profileId;
|
|
42272
|
-
// Warn devs about common mistake: passing profileId only inside credentials
|
|
42273
|
-
if (!this.profileId && ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.profileId)) {
|
|
42274
|
-
console.warn(`[@rtsdk/topia] User created without top-level profileId. ` +
|
|
42275
|
-
`You passed profileId inside credentials but not in options. ` +
|
|
42276
|
-
`Methods like grantInventoryItem will fail. ` +
|
|
42277
|
-
`Fix: User.create({ profileId: "${options.credentials.profileId}", credentials: { ... } })`);
|
|
42278
|
-
}
|
|
42279
42271
|
this.dataObject = {};
|
|
42280
42272
|
this.profile = {};
|
|
42281
42273
|
__classPrivateFieldSet(this, _User_adminWorldsMap, {}, "f");
|
|
@@ -42788,8 +42780,9 @@ class User extends SDKController {
|
|
|
42788
42780
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42789
42781
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42790
42782
|
try {
|
|
42791
|
-
if (!this.profileId)
|
|
42783
|
+
if (!this.profileId) {
|
|
42792
42784
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42785
|
+
}
|
|
42793
42786
|
let query = "";
|
|
42794
42787
|
if (appPublicKey)
|
|
42795
42788
|
query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
|
|
@@ -42828,8 +42821,9 @@ class User extends SDKController {
|
|
|
42828
42821
|
setDataObject(dataObject, options = {}) {
|
|
42829
42822
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42830
42823
|
try {
|
|
42831
|
-
if (!this.profileId)
|
|
42824
|
+
if (!this.profileId) {
|
|
42832
42825
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42826
|
+
}
|
|
42833
42827
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42834
42828
|
this.dataObject = dataObject || this.dataObject;
|
|
42835
42829
|
}
|
|
@@ -42862,8 +42856,9 @@ class User extends SDKController {
|
|
|
42862
42856
|
updateDataObject(dataObject, options = {}) {
|
|
42863
42857
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42864
42858
|
try {
|
|
42865
|
-
if (!this.profileId)
|
|
42859
|
+
if (!this.profileId) {
|
|
42866
42860
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42861
|
+
}
|
|
42867
42862
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42868
42863
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
42869
42864
|
}
|
|
@@ -42912,8 +42907,9 @@ class User extends SDKController {
|
|
|
42912
42907
|
fetchInventoryItems() {
|
|
42913
42908
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42914
42909
|
try {
|
|
42915
|
-
if (!this.profileId)
|
|
42910
|
+
if (!this.profileId) {
|
|
42916
42911
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42912
|
+
}
|
|
42917
42913
|
const response = yield this.topiaPublicApi().get(`/user/inventory/${this.profileId}/get-user-inventory-items`, this.requestOptions);
|
|
42918
42914
|
// TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
|
|
42919
42915
|
const tempItems = [];
|
|
@@ -42949,8 +42945,9 @@ class User extends SDKController {
|
|
|
42949
42945
|
grantInventoryItem(item, quantity = 1) {
|
|
42950
42946
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42951
42947
|
try {
|
|
42952
|
-
if (!this.profileId)
|
|
42948
|
+
if (!this.profileId) {
|
|
42953
42949
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42950
|
+
}
|
|
42954
42951
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/grant-user-inventory-item`, { itemId: item.id, quantity }, this.requestOptions);
|
|
42955
42952
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42956
42953
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42980,8 +42977,9 @@ class User extends SDKController {
|
|
|
42980
42977
|
modifyInventoryItemQuantity(item, quantity) {
|
|
42981
42978
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42982
42979
|
try {
|
|
42983
|
-
if (!this.profileId)
|
|
42980
|
+
if (!this.profileId) {
|
|
42984
42981
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42982
|
+
}
|
|
42985
42983
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/update-user-inventory-item-quantity`, { userItemId: item.id, itemId: item.item_id, quantity }, this.requestOptions);
|
|
42986
42984
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42987
42985
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
package/package.json
CHANGED