@rtsdk/topia 0.19.6 → 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 +26 -15
- package/dist/index.d.ts +20 -32
- package/dist/index.js +26 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -39751,6 +39751,11 @@ class SDKController {
|
|
|
39751
39751
|
errorMessage = (error === null || error === void 0 ? void 0 : error.message) || message;
|
|
39752
39752
|
stack = `${error.stack}\n${stackTrace.stack}`;
|
|
39753
39753
|
}
|
|
39754
|
+
else if (error !== undefined && error !== null) {
|
|
39755
|
+
// Handle bare string throws and other non-Error types
|
|
39756
|
+
errorMessage = typeof error === "string" ? error : JSON.stringify(error);
|
|
39757
|
+
stack = stackTrace.stack || "empty";
|
|
39758
|
+
}
|
|
39754
39759
|
return {
|
|
39755
39760
|
data,
|
|
39756
39761
|
message: errorMessage,
|
|
@@ -42777,8 +42782,9 @@ class User extends SDKController {
|
|
|
42777
42782
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42778
42783
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42779
42784
|
try {
|
|
42780
|
-
if (!this.profileId)
|
|
42781
|
-
throw "This method requires the use of a profileId";
|
|
42785
|
+
if (!this.profileId) {
|
|
42786
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42787
|
+
}
|
|
42782
42788
|
let query = "";
|
|
42783
42789
|
if (appPublicKey)
|
|
42784
42790
|
query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
|
|
@@ -42817,8 +42823,9 @@ class User extends SDKController {
|
|
|
42817
42823
|
setDataObject(dataObject, options = {}) {
|
|
42818
42824
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42819
42825
|
try {
|
|
42820
|
-
if (!this.profileId)
|
|
42821
|
-
throw "This method requires the use of a profileId";
|
|
42826
|
+
if (!this.profileId) {
|
|
42827
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42828
|
+
}
|
|
42822
42829
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42823
42830
|
this.dataObject = dataObject || this.dataObject;
|
|
42824
42831
|
}
|
|
@@ -42851,8 +42858,9 @@ class User extends SDKController {
|
|
|
42851
42858
|
updateDataObject(dataObject, options = {}) {
|
|
42852
42859
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42853
42860
|
try {
|
|
42854
|
-
if (!this.profileId)
|
|
42855
|
-
throw "This method requires the use of a profileId";
|
|
42861
|
+
if (!this.profileId) {
|
|
42862
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42863
|
+
}
|
|
42856
42864
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42857
42865
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
42858
42866
|
}
|
|
@@ -42901,8 +42909,9 @@ class User extends SDKController {
|
|
|
42901
42909
|
fetchInventoryItems() {
|
|
42902
42910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42903
42911
|
try {
|
|
42904
|
-
if (!this.profileId)
|
|
42905
|
-
throw "This method requires the use of a profileId";
|
|
42912
|
+
if (!this.profileId) {
|
|
42913
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42914
|
+
}
|
|
42906
42915
|
const response = yield this.topiaPublicApi().get(`/user/inventory/${this.profileId}/get-user-inventory-items`, this.requestOptions);
|
|
42907
42916
|
// TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
|
|
42908
42917
|
const tempItems = [];
|
|
@@ -42915,7 +42924,7 @@ class User extends SDKController {
|
|
|
42915
42924
|
__classPrivateFieldSet(this, _User_userInventoryItems, tempItems, "f");
|
|
42916
42925
|
}
|
|
42917
42926
|
catch (error) {
|
|
42918
|
-
throw this.errorHandler({ error, sdkMethod: "
|
|
42927
|
+
throw this.errorHandler({ error, sdkMethod: "User.fetchInventoryItems" });
|
|
42919
42928
|
}
|
|
42920
42929
|
});
|
|
42921
42930
|
}
|
|
@@ -42938,8 +42947,9 @@ class User extends SDKController {
|
|
|
42938
42947
|
grantInventoryItem(item, quantity = 1) {
|
|
42939
42948
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42940
42949
|
try {
|
|
42941
|
-
if (!this.profileId)
|
|
42942
|
-
throw "This method requires the use of a profileId";
|
|
42950
|
+
if (!this.profileId) {
|
|
42951
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42952
|
+
}
|
|
42943
42953
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/grant-user-inventory-item`, { itemId: item.id, quantity }, this.requestOptions);
|
|
42944
42954
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42945
42955
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42949,7 +42959,7 @@ class User extends SDKController {
|
|
|
42949
42959
|
});
|
|
42950
42960
|
}
|
|
42951
42961
|
catch (error) {
|
|
42952
|
-
throw this.errorHandler({ error, sdkMethod: "
|
|
42962
|
+
throw this.errorHandler({ error, sdkMethod: "User.grantInventoryItem" });
|
|
42953
42963
|
}
|
|
42954
42964
|
});
|
|
42955
42965
|
}
|
|
@@ -42969,8 +42979,9 @@ class User extends SDKController {
|
|
|
42969
42979
|
modifyInventoryItemQuantity(item, quantity) {
|
|
42970
42980
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42971
42981
|
try {
|
|
42972
|
-
if (!this.profileId)
|
|
42973
|
-
throw "This method requires the use of a profileId";
|
|
42982
|
+
if (!this.profileId) {
|
|
42983
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42984
|
+
}
|
|
42974
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);
|
|
42975
42986
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42976
42987
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42980,7 +42991,7 @@ class User extends SDKController {
|
|
|
42980
42991
|
});
|
|
42981
42992
|
}
|
|
42982
42993
|
catch (error) {
|
|
42983
|
-
throw this.errorHandler({ error, sdkMethod: "
|
|
42994
|
+
throw this.errorHandler({ error, sdkMethod: "User.modifyInventoryItemQuantity" });
|
|
42984
42995
|
}
|
|
42985
42996
|
});
|
|
42986
42997
|
}
|
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
|
@@ -39749,6 +39749,11 @@ class SDKController {
|
|
|
39749
39749
|
errorMessage = (error === null || error === void 0 ? void 0 : error.message) || message;
|
|
39750
39750
|
stack = `${error.stack}\n${stackTrace.stack}`;
|
|
39751
39751
|
}
|
|
39752
|
+
else if (error !== undefined && error !== null) {
|
|
39753
|
+
// Handle bare string throws and other non-Error types
|
|
39754
|
+
errorMessage = typeof error === "string" ? error : JSON.stringify(error);
|
|
39755
|
+
stack = stackTrace.stack || "empty";
|
|
39756
|
+
}
|
|
39752
39757
|
return {
|
|
39753
39758
|
data,
|
|
39754
39759
|
message: errorMessage,
|
|
@@ -42775,8 +42780,9 @@ class User extends SDKController {
|
|
|
42775
42780
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42776
42781
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42777
42782
|
try {
|
|
42778
|
-
if (!this.profileId)
|
|
42779
|
-
throw "This method requires the use of a profileId";
|
|
42783
|
+
if (!this.profileId) {
|
|
42784
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42785
|
+
}
|
|
42780
42786
|
let query = "";
|
|
42781
42787
|
if (appPublicKey)
|
|
42782
42788
|
query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
|
|
@@ -42815,8 +42821,9 @@ class User extends SDKController {
|
|
|
42815
42821
|
setDataObject(dataObject, options = {}) {
|
|
42816
42822
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42817
42823
|
try {
|
|
42818
|
-
if (!this.profileId)
|
|
42819
|
-
throw "This method requires the use of a profileId";
|
|
42824
|
+
if (!this.profileId) {
|
|
42825
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42826
|
+
}
|
|
42820
42827
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42821
42828
|
this.dataObject = dataObject || this.dataObject;
|
|
42822
42829
|
}
|
|
@@ -42849,8 +42856,9 @@ class User extends SDKController {
|
|
|
42849
42856
|
updateDataObject(dataObject, options = {}) {
|
|
42850
42857
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42851
42858
|
try {
|
|
42852
|
-
if (!this.profileId)
|
|
42853
|
-
throw "This method requires the use of a profileId";
|
|
42859
|
+
if (!this.profileId) {
|
|
42860
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42861
|
+
}
|
|
42854
42862
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42855
42863
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
42856
42864
|
}
|
|
@@ -42899,8 +42907,9 @@ class User extends SDKController {
|
|
|
42899
42907
|
fetchInventoryItems() {
|
|
42900
42908
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42901
42909
|
try {
|
|
42902
|
-
if (!this.profileId)
|
|
42903
|
-
throw "This method requires the use of a profileId";
|
|
42910
|
+
if (!this.profileId) {
|
|
42911
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42912
|
+
}
|
|
42904
42913
|
const response = yield this.topiaPublicApi().get(`/user/inventory/${this.profileId}/get-user-inventory-items`, this.requestOptions);
|
|
42905
42914
|
// TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
|
|
42906
42915
|
const tempItems = [];
|
|
@@ -42913,7 +42922,7 @@ class User extends SDKController {
|
|
|
42913
42922
|
__classPrivateFieldSet(this, _User_userInventoryItems, tempItems, "f");
|
|
42914
42923
|
}
|
|
42915
42924
|
catch (error) {
|
|
42916
|
-
throw this.errorHandler({ error, sdkMethod: "
|
|
42925
|
+
throw this.errorHandler({ error, sdkMethod: "User.fetchInventoryItems" });
|
|
42917
42926
|
}
|
|
42918
42927
|
});
|
|
42919
42928
|
}
|
|
@@ -42936,8 +42945,9 @@ class User extends SDKController {
|
|
|
42936
42945
|
grantInventoryItem(item, quantity = 1) {
|
|
42937
42946
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42938
42947
|
try {
|
|
42939
|
-
if (!this.profileId)
|
|
42940
|
-
throw "This method requires the use of a profileId";
|
|
42948
|
+
if (!this.profileId) {
|
|
42949
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42950
|
+
}
|
|
42941
42951
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/grant-user-inventory-item`, { itemId: item.id, quantity }, this.requestOptions);
|
|
42942
42952
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42943
42953
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42947,7 +42957,7 @@ class User extends SDKController {
|
|
|
42947
42957
|
});
|
|
42948
42958
|
}
|
|
42949
42959
|
catch (error) {
|
|
42950
|
-
throw this.errorHandler({ error, sdkMethod: "
|
|
42960
|
+
throw this.errorHandler({ error, sdkMethod: "User.grantInventoryItem" });
|
|
42951
42961
|
}
|
|
42952
42962
|
});
|
|
42953
42963
|
}
|
|
@@ -42967,8 +42977,9 @@ class User extends SDKController {
|
|
|
42967
42977
|
modifyInventoryItemQuantity(item, quantity) {
|
|
42968
42978
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42969
42979
|
try {
|
|
42970
|
-
if (!this.profileId)
|
|
42971
|
-
throw "This method requires the use of a profileId";
|
|
42980
|
+
if (!this.profileId) {
|
|
42981
|
+
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42982
|
+
}
|
|
42972
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);
|
|
42973
42984
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42974
42985
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42978,7 +42989,7 @@ class User extends SDKController {
|
|
|
42978
42989
|
});
|
|
42979
42990
|
}
|
|
42980
42991
|
catch (error) {
|
|
42981
|
-
throw this.errorHandler({ error, sdkMethod: "
|
|
42992
|
+
throw this.errorHandler({ error, sdkMethod: "User.modifyInventoryItemQuantity" });
|
|
42982
42993
|
}
|
|
42983
42994
|
});
|
|
42984
42995
|
}
|
package/package.json
CHANGED