@rtsdk/topia 0.0.31 → 0.1.1
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 +43 -13
- package/dist/index.js +43 -13
- package/dist/types/example.d.ts +6 -0
- package/dist/types/src/__mocks__/assets.d.ts +99 -0
- package/dist/{src/__mocks__/index.js → types/src/__mocks__/index.d.ts} +4 -4
- package/dist/types/src/__mocks__/scenes.d.ts +79 -0
- package/dist/types/src/__mocks__/visitors.d.ts +83 -0
- package/dist/types/src/__mocks__/worlds.d.ts +73 -0
- package/dist/types/src/controllers/Asset.d.ts +20 -0
- package/dist/types/src/controllers/DroppedAsset.d.ts +285 -0
- package/dist/types/src/controllers/SDKController.d.ts +48 -0
- package/dist/types/src/controllers/Scene.d.ts +19 -0
- package/dist/types/src/controllers/Topia.d.ts +33 -0
- package/dist/types/src/controllers/User.d.ts +58 -0
- package/dist/types/src/controllers/Visitor.d.ts +50 -0
- package/dist/types/src/controllers/World.d.ts +143 -0
- package/dist/types/src/controllers/WorldActivity.d.ts +83 -0
- package/dist/{src/interfaces/AssetInterfaces.js → types/src/controllers/__tests__/asset.test.d.ts} +1 -1
- package/dist/{src/interfaces/DroppedAssetInterfaces.js → types/src/controllers/__tests__/droppedAsset.test.d.ts} +1 -1
- package/dist/{src/interfaces/SDKInterfaces.js → types/src/controllers/__tests__/scene.test.d.ts} +1 -1
- package/dist/{src/interfaces/SceneInterfaces.js → types/src/controllers/__tests__/user.test.d.ts} +1 -1
- package/dist/types/src/controllers/__tests__/visitor.test.d.ts +1 -0
- package/dist/types/src/controllers/__tests__/world.test.d.ts +1 -0
- package/dist/types/src/controllers/__tests__/worldActivity.test.d.ts +1 -0
- package/dist/{src/controllers/index.js → types/src/controllers/index.d.ts} +9 -9
- package/dist/types/src/factories/AssetFactory.d.ts +8 -0
- package/dist/types/src/factories/DroppedAssetFactory.d.ts +16 -0
- package/dist/types/src/factories/SceneFactory.d.ts +9 -0
- package/dist/types/src/factories/UserFactory.d.ts +8 -0
- package/dist/types/src/factories/VisitorFactory.d.ts +9 -0
- package/dist/types/src/factories/WorldActivityFactory.d.ts +8 -0
- package/dist/types/src/factories/WorldFactory.d.ts +8 -0
- package/dist/{src/factories/index.js → types/src/factories/index.d.ts} +7 -7
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/interfaces/AssetInterfaces.d.ts +26 -0
- package/dist/types/src/interfaces/DroppedAssetInterfaces.d.ts +102 -0
- package/dist/types/src/interfaces/SDKInterfaces.d.ts +8 -0
- package/dist/types/src/interfaces/SceneInterfaces.d.ts +27 -0
- package/dist/types/src/interfaces/TopiaInterfaces.d.ts +10 -0
- package/dist/types/src/interfaces/UserInterfaces.d.ts +6 -0
- package/dist/types/src/interfaces/VisitorInterfaces.d.ts +37 -0
- package/dist/types/src/interfaces/WorldActivityInterfaces.d.ts +11 -0
- package/dist/types/src/interfaces/WorldInterfaces.d.ts +32 -0
- package/dist/{src/interfaces/index.js → types/src/interfaces/index.d.ts} +9 -9
- package/dist/types/src/types/DroppedAssetTypes.d.ts +10 -0
- package/dist/types/src/types/InteractiveCredentialsTypes.d.ts +8 -0
- package/dist/types/src/types/OptionsTypes.d.ts +21 -0
- package/dist/types/src/types/ResponseTypes.d.ts +4 -0
- package/dist/types/src/types/VisitorTypes.d.ts +33 -0
- package/dist/{src/types/index.js → types/src/types/index.d.ts} +5 -4
- package/dist/types/src/utils/__tests__/removeUndefined.test.d.ts +1 -0
- package/dist/types/src/utils/__tests__/scatterVisitors.test.d.ts +1 -0
- package/dist/types/src/utils/getBrowserWarning.d.ts +1 -0
- package/dist/{src/utils/index.js → types/src/utils/index.d.ts} +3 -3
- package/dist/types/src/utils/removeUndefined.d.ts +8 -0
- package/dist/types/src/utils/scatterVisitors.d.ts +4 -0
- package/package.json +3 -2
- package/dist/example.js +0 -32
- package/dist/src/__mocks__/assets.js +0 -249
- package/dist/src/__mocks__/scenes.js +0 -104
- package/dist/src/__mocks__/visitors.js +0 -83
- package/dist/src/__mocks__/worlds.js +0 -52
- package/dist/src/controllers/Asset.js +0 -39
- package/dist/src/controllers/DroppedAsset.js +0 -443
- package/dist/src/controllers/SDKController.js +0 -76
- package/dist/src/controllers/Scene.js +0 -39
- package/dist/src/controllers/Topia.js +0 -39
- package/dist/src/controllers/User.js +0 -139
- package/dist/src/controllers/Visitor.js +0 -92
- package/dist/src/controllers/World.js +0 -257
- package/dist/src/controllers/WorldActivity.js +0 -162
- package/dist/src/controllers/__tests__/asset.test.js +0 -37
- package/dist/src/controllers/__tests__/droppedAsset.test.js +0 -98
- package/dist/src/controllers/__tests__/scene.test.js +0 -38
- package/dist/src/controllers/__tests__/user.test.js +0 -49
- package/dist/src/controllers/__tests__/visitor.test.js +0 -47
- package/dist/src/controllers/__tests__/world.test.js +0 -51
- package/dist/src/controllers/__tests__/worldActivity.test.js +0 -63
- package/dist/src/factories/AssetFactory.js +0 -11
- package/dist/src/factories/DroppedAssetFactory.js +0 -42
- package/dist/src/factories/SceneFactory.js +0 -27
- package/dist/src/factories/UserFactory.js +0 -10
- package/dist/src/factories/VisitorFactory.js +0 -26
- package/dist/src/factories/WorldActivityFactory.js +0 -10
- package/dist/src/factories/WorldFactory.js +0 -10
- package/dist/src/index.js +0 -23
- package/dist/src/interfaces/TopiaInterfaces.js +0 -1
- package/dist/src/interfaces/UserInterfaces.js +0 -1
- package/dist/src/interfaces/VisitorInterfaces.js +0 -1
- package/dist/src/interfaces/WorldActivityInterfaces.js +0 -1
- package/dist/src/interfaces/WorldInterfaces.js +0 -1
- package/dist/src/types/DroppedAssetTypes.js +0 -12
- package/dist/src/types/InteractiveCredentialsTypes.js +0 -1
- package/dist/src/types/OptionsTypes.js +0 -1
- package/dist/src/types/ResponseTypes.js +0 -1
- package/dist/src/types/VisitorTypes.js +0 -1
- package/dist/src/utils/__tests__/removeUndefined.test.js +0 -10
- package/dist/src/utils/__tests__/scatterVisitors.test.js +0 -11
- package/dist/src/utils/getBrowserWarning.js +0 -5
- package/dist/src/utils/removeUndefined.js +0 -11
- package/dist/src/utils/scatterVisitors.js +0 -8
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
2
|
+
import { Asset } from "controllers/Asset";
|
|
3
|
+
import { Topia } from "controllers/Topia";
|
|
4
|
+
import { DroppedAssetInterface, DroppedAssetOptionalInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface } from "interfaces";
|
|
5
|
+
import { ResponseType } from "types";
|
|
6
|
+
/**
|
|
7
|
+
* @summary
|
|
8
|
+
* Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", { attributes: { text: "" }, credentials: { assetId: "1giFZb0sQ3X27L7uGyQX" } } });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class DroppedAsset extends Asset implements DroppedAssetInterface {
|
|
16
|
+
#private;
|
|
17
|
+
dataObject?: object | null;
|
|
18
|
+
readonly id?: string | undefined;
|
|
19
|
+
text?: string | null | undefined;
|
|
20
|
+
urlSlug: string;
|
|
21
|
+
isInteractive?: boolean | null;
|
|
22
|
+
interactivePublicKey?: string | null;
|
|
23
|
+
constructor(topia: Topia, id: string, urlSlug: string, options?: DroppedAssetOptionalInterface);
|
|
24
|
+
/**
|
|
25
|
+
* @summary
|
|
26
|
+
* Retrieves dropped asset details.
|
|
27
|
+
*
|
|
28
|
+
* @usage
|
|
29
|
+
* ```ts
|
|
30
|
+
* await droppedAsset.fetchDroppedAssetById();
|
|
31
|
+
* const { assetName } = droppedAsset;
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
fetchDroppedAssetById(): Promise<void | ResponseType>;
|
|
35
|
+
/**
|
|
36
|
+
* @summary
|
|
37
|
+
* Delete dropped asset.
|
|
38
|
+
*
|
|
39
|
+
* @usage
|
|
40
|
+
* ```ts
|
|
41
|
+
* await droppedAsset.deleteDroppedAsset();
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
deleteDroppedAsset(): Promise<void | ResponseType>;
|
|
45
|
+
/**
|
|
46
|
+
* @summary
|
|
47
|
+
* Retrieves the data object for a dropped asset.
|
|
48
|
+
*
|
|
49
|
+
* @usage
|
|
50
|
+
* ```ts
|
|
51
|
+
* await droppedAsset.fetchDroppedAssetDataObject();
|
|
52
|
+
* const { dataObject } = droppedAsset;
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
fetchDroppedAssetDataObject(): Promise<void | ResponseType>;
|
|
56
|
+
/**
|
|
57
|
+
* @summary
|
|
58
|
+
* Sets the data object for a dropped asset.
|
|
59
|
+
*
|
|
60
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
61
|
+
*
|
|
62
|
+
* @usage
|
|
63
|
+
* ```ts
|
|
64
|
+
* await droppedAsset.setDroppedAssetDataObject({
|
|
65
|
+
* "exampleKey": "exampleValue",
|
|
66
|
+
* });
|
|
67
|
+
* const { dataObject } = droppedAsset;
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
setDroppedAssetDataObject(dataObject: object, options?: {
|
|
71
|
+
lock?: {
|
|
72
|
+
lockId: string;
|
|
73
|
+
releaseLock?: boolean;
|
|
74
|
+
};
|
|
75
|
+
}): Promise<void | ResponseType>;
|
|
76
|
+
/**
|
|
77
|
+
* @summary
|
|
78
|
+
* Updates the data object for a dropped asset.
|
|
79
|
+
*
|
|
80
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
81
|
+
*
|
|
82
|
+
* @usage
|
|
83
|
+
* ```ts
|
|
84
|
+
* await droppedAsset.updateDroppedAssetDataObject({
|
|
85
|
+
* "exampleKey": "exampleValue",
|
|
86
|
+
* });
|
|
87
|
+
* const { dataObject } = droppedAsset;
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
updateDroppedAssetDataObject(dataObject: object, options?: {
|
|
91
|
+
lock?: {
|
|
92
|
+
lockId: string;
|
|
93
|
+
releaseLock?: boolean;
|
|
94
|
+
};
|
|
95
|
+
}): Promise<void | ResponseType>;
|
|
96
|
+
/**
|
|
97
|
+
* @summary
|
|
98
|
+
* Updates broadcast options for a dropped asset.
|
|
99
|
+
*
|
|
100
|
+
* @usage
|
|
101
|
+
* ```ts
|
|
102
|
+
* await droppedAsset.updateBroadcast({
|
|
103
|
+
* assetBroadcast: true,
|
|
104
|
+
* assetBroadcastAll: true,
|
|
105
|
+
* broadcasterEmail: "example@email.com"
|
|
106
|
+
* });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }: UpdateBroadcastInterface): Promise<void | ResponseType>;
|
|
110
|
+
/**
|
|
111
|
+
* @summary
|
|
112
|
+
* Updates click options for a dropped asset.
|
|
113
|
+
*
|
|
114
|
+
* @usage
|
|
115
|
+
* ```ts
|
|
116
|
+
* await droppedAsset.updateClickType({
|
|
117
|
+
* "clickType": "portal",
|
|
118
|
+
* "clickableLink": "https://topia.io",
|
|
119
|
+
* "clickableLinkTitle": "My awesome link!",
|
|
120
|
+
* "clickableDisplayTextDescription": "Description",
|
|
121
|
+
* "clickableDisplayTextHeadline": "Title",
|
|
122
|
+
* "position": {
|
|
123
|
+
* "x": 0,
|
|
124
|
+
* "y": 0
|
|
125
|
+
* },
|
|
126
|
+
* "portalName": "community"
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, portalName, position, }: UpdateClickTypeInterface): Promise<void | ResponseType>;
|
|
131
|
+
/**
|
|
132
|
+
* @summary
|
|
133
|
+
* Updates text and style of a dropped asset.
|
|
134
|
+
*
|
|
135
|
+
* @usage
|
|
136
|
+
* ```ts
|
|
137
|
+
* const style = {
|
|
138
|
+
* "textColor": "#abc123",
|
|
139
|
+
* "textFontFamily": "Arial",
|
|
140
|
+
* "textSize": 40,
|
|
141
|
+
* "textWeight": "normal",
|
|
142
|
+
* "textWidth": 200
|
|
143
|
+
* };
|
|
144
|
+
* await droppedAsset.updateCustomTextAsset(style, "hello world");
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
updateCustomTextAsset(style: object, text: string | null | undefined): Promise<void | ResponseType>;
|
|
148
|
+
/**
|
|
149
|
+
* @summary
|
|
150
|
+
* Updates media options for a dropped asset.
|
|
151
|
+
*
|
|
152
|
+
* @usage
|
|
153
|
+
* ```ts
|
|
154
|
+
* await droppedAsset.updateMediaType({
|
|
155
|
+
* "mediaType": "link",
|
|
156
|
+
* "mediaLink": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
|
157
|
+
* "isVideo": true,
|
|
158
|
+
* "syncUserMedia": true,
|
|
159
|
+
* "audioSliderVolume: 30"
|
|
160
|
+
* "portalName": "community",
|
|
161
|
+
* "audioRadius": 0,
|
|
162
|
+
* "mediaName": "string"
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }: UpdateMediaTypeInterface): Promise<void | ResponseType>;
|
|
167
|
+
/**
|
|
168
|
+
* @summary
|
|
169
|
+
* Updates mute zone options for a dropped asset.
|
|
170
|
+
*
|
|
171
|
+
* @usage
|
|
172
|
+
* ```ts
|
|
173
|
+
* await droppedAsset.updateMuteZone(true);
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
updateMuteZone(isMutezone: boolean): Promise<void | ResponseType>;
|
|
177
|
+
/**
|
|
178
|
+
* @summary
|
|
179
|
+
* Updates webhook zone options for a dropped asset.
|
|
180
|
+
*
|
|
181
|
+
* @usage
|
|
182
|
+
* ```ts
|
|
183
|
+
* await droppedAsset.updateWebhookZone(true);
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
updateWebhookZone(isWebhookZoneEnabled: boolean): Promise<void | ResponseType>;
|
|
187
|
+
/**
|
|
188
|
+
* @summary
|
|
189
|
+
* Moves a dropped asset to specified coordinates.
|
|
190
|
+
*
|
|
191
|
+
* @usage
|
|
192
|
+
* ```ts
|
|
193
|
+
* await droppedAsset.updatePosition(100,200);
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
updatePosition(x: number, y: number): Promise<void | ResponseType>;
|
|
197
|
+
/**
|
|
198
|
+
* @summary
|
|
199
|
+
* Updates private zone options for a dropped asset.
|
|
200
|
+
*
|
|
201
|
+
* @usage
|
|
202
|
+
* ```ts
|
|
203
|
+
* await droppedAsset.updatePrivateZone({
|
|
204
|
+
* "isPrivateZone": false,
|
|
205
|
+
* "isPrivateZoneChatDisabled": true,
|
|
206
|
+
* "privateZoneUserCap": 10
|
|
207
|
+
* });
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }: UpdatePrivateZoneInterface): Promise<void | ResponseType>;
|
|
211
|
+
/**
|
|
212
|
+
* @summary
|
|
213
|
+
* Updates the size of a dropped asset.
|
|
214
|
+
*
|
|
215
|
+
* @usage
|
|
216
|
+
* ```ts
|
|
217
|
+
* await droppedAsset.assetScale(.5);
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
updateScale(assetScale: number): Promise<void | ResponseType>;
|
|
221
|
+
/**
|
|
222
|
+
* @summary
|
|
223
|
+
* Change or remove media embedded in a dropped asset.
|
|
224
|
+
*
|
|
225
|
+
* @usage
|
|
226
|
+
* ```ts
|
|
227
|
+
* await droppedAsset.updateUploadedMediaSelected("LVWyxwNxI96eLjnXWwYO");
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
updateUploadedMediaSelected(mediaId: string): Promise<void | ResponseType>;
|
|
231
|
+
/**
|
|
232
|
+
* @summary
|
|
233
|
+
* Change or remove top and bottom layers of a dropped asset.
|
|
234
|
+
*
|
|
235
|
+
* @usage
|
|
236
|
+
* ```ts
|
|
237
|
+
* await droppedAsset.updateWebImageLayers("","https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg");
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
updateWebImageLayers(bottom: string, top: string): Promise<void | ResponseType>;
|
|
241
|
+
/**
|
|
242
|
+
* @summary
|
|
243
|
+
* Add a webhook to a dropped asset
|
|
244
|
+
*
|
|
245
|
+
* @usage
|
|
246
|
+
* ```ts
|
|
247
|
+
* await droppedAsset.addWebhook({
|
|
248
|
+
* active: true,
|
|
249
|
+
* dataObject: {},
|
|
250
|
+
* description: "Webhook desc",
|
|
251
|
+
* enteredBy: "you",
|
|
252
|
+
* isUniqueOnly: false,
|
|
253
|
+
* title: "title",
|
|
254
|
+
* type: "type",
|
|
255
|
+
* url: "https://url.com",
|
|
256
|
+
* urlSlug: "world",
|
|
257
|
+
* });
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
addWebhook({ dataObject, description, isUniqueOnly, title, type, url, }: {
|
|
261
|
+
dataObject: object;
|
|
262
|
+
description: string;
|
|
263
|
+
isUniqueOnly: boolean;
|
|
264
|
+
title: string;
|
|
265
|
+
type: string;
|
|
266
|
+
url: string;
|
|
267
|
+
}): Promise<void | AxiosResponse>;
|
|
268
|
+
/**
|
|
269
|
+
* @summary
|
|
270
|
+
* Set the interactive settings on a dropped asset
|
|
271
|
+
*
|
|
272
|
+
* @usage
|
|
273
|
+
* ```ts
|
|
274
|
+
* await droppedAsset.setInteractiveSettings({
|
|
275
|
+
* isInteractive: true,
|
|
276
|
+
* interactivePublicKey: "xyz"
|
|
277
|
+
* });
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
setInteractiveSettings({ isInteractive, interactivePublicKey, }: {
|
|
281
|
+
isInteractive?: boolean;
|
|
282
|
+
interactivePublicKey: string;
|
|
283
|
+
}): Promise<void | ResponseType>;
|
|
284
|
+
}
|
|
285
|
+
export default DroppedAsset;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Topia } from "controllers/Topia";
|
|
2
|
+
import { SDKInterface } from "interfaces";
|
|
3
|
+
import { InteractiveCredentials } from "types";
|
|
4
|
+
import { AxiosError } from "axios";
|
|
5
|
+
/**
|
|
6
|
+
* @summary
|
|
7
|
+
* Create an instance of SDKController class with credentials.
|
|
8
|
+
*
|
|
9
|
+
* @usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* const credentials = {
|
|
12
|
+
* assetId: "exampleAsset",
|
|
13
|
+
* interactiveNonce: "exampleNonce"
|
|
14
|
+
* interactivePublicKey: "examplePublicKey",
|
|
15
|
+
* visitorId: 1,
|
|
16
|
+
* url: "https://topia.io",
|
|
17
|
+
* }
|
|
18
|
+
* const topia = await new Topia({
|
|
19
|
+
* apiDomain: "api.topia.io",
|
|
20
|
+
* apiKey: "exampleKey",
|
|
21
|
+
* interactiveKey: "key",
|
|
22
|
+
* interactiveSecret: "secret",
|
|
23
|
+
* }
|
|
24
|
+
* await new SDKController({ credentials, topia });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class SDKController implements SDKInterface {
|
|
28
|
+
credentials: InteractiveCredentials | undefined;
|
|
29
|
+
jwt?: string;
|
|
30
|
+
requestOptions: object;
|
|
31
|
+
topia: Topia;
|
|
32
|
+
constructor(topia: Topia, credentials?: InteractiveCredentials);
|
|
33
|
+
topiaPublicApi(): import("axios").AxiosInstance;
|
|
34
|
+
errorHandler({ error, message, }: {
|
|
35
|
+
error?: Error | AxiosError | unknown;
|
|
36
|
+
message?: string;
|
|
37
|
+
}): {
|
|
38
|
+
data: {};
|
|
39
|
+
message: string;
|
|
40
|
+
method: string;
|
|
41
|
+
stack: string;
|
|
42
|
+
stackTrace: Error;
|
|
43
|
+
status: number;
|
|
44
|
+
success: boolean;
|
|
45
|
+
url: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export default SDKController;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SDKController } from "controllers/SDKController";
|
|
2
|
+
import { Topia } from "controllers/Topia";
|
|
3
|
+
import { SceneInterface, SceneOptionalInterface } from "interfaces";
|
|
4
|
+
import { ResponseType } from "types";
|
|
5
|
+
/**
|
|
6
|
+
* @summary
|
|
7
|
+
* Create an instance of Scene class with a given scene id and optional attributes and session credentials.
|
|
8
|
+
*
|
|
9
|
+
* @usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* await new Scene(topia, "sceneId", { attributes: { name: "My Scene" } });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare class Scene extends SDKController implements SceneInterface {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
constructor(topia: Topia, id: string, options?: SceneOptionalInterface);
|
|
17
|
+
fetchSceneById(): Promise<void | ResponseType>;
|
|
18
|
+
}
|
|
19
|
+
export default Scene;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { TopiaInterface } from "interfaces";
|
|
3
|
+
import jwt from "jsonwebtoken";
|
|
4
|
+
/**
|
|
5
|
+
* @summary
|
|
6
|
+
* Create a single instance of Topia axios used for all calls to the public API in all classes
|
|
7
|
+
*
|
|
8
|
+
* @usage
|
|
9
|
+
* ```ts
|
|
10
|
+
* const topia = await new Topia({
|
|
11
|
+
* apiDomain: "api.topia.io",
|
|
12
|
+
* apiKey: "exampleKey",
|
|
13
|
+
* interactiveKey: "key",
|
|
14
|
+
* interactiveSecret: "secret",
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class Topia implements TopiaInterface {
|
|
19
|
+
axios: AxiosInstance;
|
|
20
|
+
apiDomain?: string;
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
apiProtocol?: string;
|
|
23
|
+
interactiveKey?: string;
|
|
24
|
+
interactiveSecret?: jwt.Secret;
|
|
25
|
+
constructor({ apiDomain, apiKey, apiProtocol, interactiveKey, interactiveSecret, }: {
|
|
26
|
+
apiDomain?: string;
|
|
27
|
+
apiKey?: string;
|
|
28
|
+
apiProtocol?: string;
|
|
29
|
+
interactiveKey?: string;
|
|
30
|
+
interactiveSecret?: jwt.Secret;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export default Topia;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Asset } from "controllers/Asset";
|
|
2
|
+
import { Scene } from "controllers/Scene";
|
|
3
|
+
import { SDKController } from "controllers/SDKController";
|
|
4
|
+
import { Topia } from "controllers/Topia";
|
|
5
|
+
import { World } from "controllers/World";
|
|
6
|
+
import { UserOptionalInterface } from "interfaces";
|
|
7
|
+
import { ResponseType } from "types";
|
|
8
|
+
/**
|
|
9
|
+
* @summary
|
|
10
|
+
* Create an instance of User class with optional session credentials.
|
|
11
|
+
*
|
|
12
|
+
* @usage
|
|
13
|
+
* ```ts
|
|
14
|
+
* await new User(topia, { interactiveNonce: "exampleNonce", interactivePublicKey: "examplePublicKey", visitorId: 1 });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class User extends SDKController {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(topia: Topia, options?: UserOptionalInterface);
|
|
20
|
+
get assets(): {
|
|
21
|
+
[key: string]: Asset;
|
|
22
|
+
};
|
|
23
|
+
get scenes(): {
|
|
24
|
+
[key: string]: Scene;
|
|
25
|
+
};
|
|
26
|
+
get worlds(): {
|
|
27
|
+
[key: string]: World;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @summary
|
|
31
|
+
* Returns all assets owned by User when an email address is provided.
|
|
32
|
+
*/
|
|
33
|
+
fetchAssets(): Promise<void | ResponseType>;
|
|
34
|
+
/**
|
|
35
|
+
* @summary
|
|
36
|
+
* Returns all scenes owned by User
|
|
37
|
+
*/
|
|
38
|
+
fetchScenes(): Promise<void | ResponseType>;
|
|
39
|
+
/**
|
|
40
|
+
* @summary
|
|
41
|
+
* Retrieves all worlds owned by user with matching API Key,
|
|
42
|
+
* creates a new World object for each,
|
|
43
|
+
* and creates new map of Worlds accessible via user.worlds.
|
|
44
|
+
*
|
|
45
|
+
* @usage
|
|
46
|
+
* ```ts
|
|
47
|
+
* await user.fetchWorldsByKey();
|
|
48
|
+
* const userWorlds = user.worlds;
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @result
|
|
52
|
+
* ```ts
|
|
53
|
+
* { urlSlug: new World({ apiKey, worldArgs, urlSlug }) }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
fetchWorldsByKey(): Promise<void | ResponseType>;
|
|
57
|
+
}
|
|
58
|
+
export default User;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Topia } from "controllers/Topia";
|
|
2
|
+
import { User } from "controllers/User";
|
|
3
|
+
import { MoveVisitorInterface, VisitorInterface, VisitorOptionalInterface } from "interfaces";
|
|
4
|
+
import { ResponseType } from "types";
|
|
5
|
+
/**
|
|
6
|
+
* @summary
|
|
7
|
+
* Create an instance of Visitor class with a given id and optional attributes and session credentials.
|
|
8
|
+
*
|
|
9
|
+
* @usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } } });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare class Visitor extends User implements VisitorInterface {
|
|
15
|
+
readonly id: number;
|
|
16
|
+
urlSlug: string;
|
|
17
|
+
user?: User;
|
|
18
|
+
constructor(topia: Topia, id: number, urlSlug: string, options?: VisitorOptionalInterface);
|
|
19
|
+
/**
|
|
20
|
+
* @summary
|
|
21
|
+
* Get a single visitor from a world
|
|
22
|
+
*
|
|
23
|
+
* @usage
|
|
24
|
+
* ```ts
|
|
25
|
+
* await visitor.fetchVisitor();
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @result
|
|
29
|
+
* Returns details for a visitor in a world by id and urlSlug
|
|
30
|
+
*/
|
|
31
|
+
fetchVisitor(): Promise<void | ResponseType>;
|
|
32
|
+
/**
|
|
33
|
+
* @summary
|
|
34
|
+
* Teleport or walk a visitor currently in a world to a single set of coordinates.
|
|
35
|
+
*
|
|
36
|
+
* @usage
|
|
37
|
+
* ```ts
|
|
38
|
+
* await visitor.moveVisitor({
|
|
39
|
+
* shouldTeleportVisitor: true,
|
|
40
|
+
* x: 100,
|
|
41
|
+
* y: 100,
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @result
|
|
46
|
+
* Updates each Visitor instance and world.visitors map.
|
|
47
|
+
*/
|
|
48
|
+
moveVisitor({ shouldTeleportVisitor, x, y }: MoveVisitorInterface): Promise<void | ResponseType>;
|
|
49
|
+
}
|
|
50
|
+
export default Visitor;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { DroppedAsset } from "controllers/DroppedAsset";
|
|
2
|
+
import { SDKController } from "controllers/SDKController";
|
|
3
|
+
import { Topia } from "controllers/Topia";
|
|
4
|
+
import { WorldInterface, WorldOptionalInterface } from "interfaces";
|
|
5
|
+
import { ResponseType } from "types";
|
|
6
|
+
/**
|
|
7
|
+
* @summary
|
|
8
|
+
* Create an instance of World class with a given url slug and optional attributes and session credentials.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* await new World(topia, "exampleWorld", { attributes: { name: "Example World" } });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class World extends SDKController implements WorldInterface {
|
|
16
|
+
#private;
|
|
17
|
+
urlSlug: string;
|
|
18
|
+
constructor(topia: Topia, urlSlug: string, options?: WorldOptionalInterface);
|
|
19
|
+
get droppedAssets(): {
|
|
20
|
+
[key: string]: DroppedAsset;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @summary
|
|
24
|
+
* Retrieves details of a world.
|
|
25
|
+
*
|
|
26
|
+
* @usage
|
|
27
|
+
* ```ts
|
|
28
|
+
* await world.fetchDetails();
|
|
29
|
+
* const { name } = world;
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
fetchDetails(): Promise<void | ResponseType>;
|
|
33
|
+
/**
|
|
34
|
+
* @summary
|
|
35
|
+
* Update details of a world.
|
|
36
|
+
*
|
|
37
|
+
* @usage
|
|
38
|
+
* ```ts
|
|
39
|
+
* await world.updateDetails({
|
|
40
|
+
* controls: {
|
|
41
|
+
* allowMuteAll: true,
|
|
42
|
+
* disableHideVideo: true,
|
|
43
|
+
* isMobileDisabled: false,
|
|
44
|
+
* isShowingCurrentGuests: false,
|
|
45
|
+
* },
|
|
46
|
+
* description: 'Welcome to my world.',
|
|
47
|
+
* forceAuthOnLogin: false,
|
|
48
|
+
* height: 2000,
|
|
49
|
+
* name: 'Example',
|
|
50
|
+
* spawnPosition: { x: 100, y: 100 },
|
|
51
|
+
* width: 2000
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldInterface): Promise<void | ResponseType>;
|
|
56
|
+
/**
|
|
57
|
+
* @summary
|
|
58
|
+
* Retrieve all assets dropped in a world.
|
|
59
|
+
*
|
|
60
|
+
* @usage
|
|
61
|
+
* ```ts
|
|
62
|
+
* await world.fetchDroppedAssets();
|
|
63
|
+
* const assets = world.droppedAssets;
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
fetchDroppedAssets(): Promise<void | ResponseType>;
|
|
67
|
+
/**
|
|
68
|
+
* @summary
|
|
69
|
+
* Retrieve all assets dropped in a world matching uniqueName.
|
|
70
|
+
*
|
|
71
|
+
* @usage
|
|
72
|
+
* ```ts
|
|
73
|
+
* await world.fetchDroppedAssets();
|
|
74
|
+
* const assets = world.droppedAssets;
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
fetchDroppedAssetsWithUniqueName({ uniqueName, isPartial, isReversed, }: {
|
|
78
|
+
uniqueName: string;
|
|
79
|
+
isPartial?: boolean;
|
|
80
|
+
isReversed?: boolean;
|
|
81
|
+
}): Promise<DroppedAsset[]>;
|
|
82
|
+
/**
|
|
83
|
+
* @summary
|
|
84
|
+
* Update multiple custom text dropped assets with a single style while preserving text for specified dropped assets only.
|
|
85
|
+
*
|
|
86
|
+
* @usage
|
|
87
|
+
* ```ts
|
|
88
|
+
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]];
|
|
89
|
+
* const style = {
|
|
90
|
+
* "textColor": "#abc123",
|
|
91
|
+
* "textFontFamily": "Arial",
|
|
92
|
+
* "textSize": 40,
|
|
93
|
+
* "textWeight": "normal",
|
|
94
|
+
* "textWidth": 200
|
|
95
|
+
* };
|
|
96
|
+
* await world.updateCustomText(droppedAssetsToUpdate, style);
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @result
|
|
100
|
+
* Updates each DroppedAsset instance and world.droppedAssets map.
|
|
101
|
+
*/
|
|
102
|
+
updateCustomTextDroppedAssets(droppedAssetsToUpdate: Array<DroppedAsset>, style: object): Promise<object>;
|
|
103
|
+
/**
|
|
104
|
+
* @summary
|
|
105
|
+
* Drop a scene in a world.
|
|
106
|
+
*
|
|
107
|
+
* @usage
|
|
108
|
+
* ```ts
|
|
109
|
+
* await world.dropScene({
|
|
110
|
+
* "sceneId": "string",
|
|
111
|
+
* "position": {
|
|
112
|
+
* "x": 0,
|
|
113
|
+
* "y": 0
|
|
114
|
+
* },
|
|
115
|
+
* "assetSuffix": "string"
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
dropScene({ assetSuffix, position, sceneId, }: {
|
|
120
|
+
assetSuffix: string;
|
|
121
|
+
position: object;
|
|
122
|
+
sceneId: string;
|
|
123
|
+
}): Promise<void | ResponseType>;
|
|
124
|
+
/**
|
|
125
|
+
* @summary
|
|
126
|
+
* Replace the current scene of a world.
|
|
127
|
+
*
|
|
128
|
+
* @usage
|
|
129
|
+
* ```ts
|
|
130
|
+
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]]
|
|
131
|
+
* const style = {
|
|
132
|
+
* "textColor": "#abc123",
|
|
133
|
+
* "textFontFamily": "Arial",
|
|
134
|
+
* "textSize": 40,
|
|
135
|
+
* "textWeight": "normal",
|
|
136
|
+
* "textWidth": 200
|
|
137
|
+
* }
|
|
138
|
+
* await world.replaceScene(SCENE_ID);
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
replaceScene(sceneId: string): Promise<void | ResponseType>;
|
|
142
|
+
}
|
|
143
|
+
export default World;
|