@rtsdk/topia 0.2.2 → 0.2.3
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 +1179 -41168
- package/dist/index.d.ts +1251 -0
- package/dist/index.js +194 -101
- package/package.json +5 -2
- package/dist/types/example.d.ts +0 -6
- package/dist/types/src/__mocks__/assets.d.ts +0 -99
- package/dist/types/src/__mocks__/index.d.ts +0 -4
- package/dist/types/src/__mocks__/scenes.d.ts +0 -79
- package/dist/types/src/__mocks__/visitors.d.ts +0 -83
- package/dist/types/src/__mocks__/worlds.d.ts +0 -73
- package/dist/types/src/controllers/Asset.d.ts +0 -20
- package/dist/types/src/controllers/DroppedAsset.d.ts +0 -285
- package/dist/types/src/controllers/SDKController.d.ts +0 -48
- package/dist/types/src/controllers/Scene.d.ts +0 -19
- package/dist/types/src/controllers/Topia.d.ts +0 -33
- package/dist/types/src/controllers/User.d.ts +0 -112
- package/dist/types/src/controllers/Visitor.d.ts +0 -102
- package/dist/types/src/controllers/World.d.ts +0 -143
- package/dist/types/src/controllers/WorldActivity.d.ts +0 -83
- package/dist/types/src/controllers/__tests__/asset.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/droppedAsset.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/scene.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/user.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/visitor.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/world.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/worldActivity.test.d.ts +0 -1
- package/dist/types/src/controllers/index.d.ts +0 -9
- package/dist/types/src/factories/AssetFactory.d.ts +0 -8
- package/dist/types/src/factories/DroppedAssetFactory.d.ts +0 -16
- package/dist/types/src/factories/SceneFactory.d.ts +0 -9
- package/dist/types/src/factories/UserFactory.d.ts +0 -8
- package/dist/types/src/factories/VisitorFactory.d.ts +0 -9
- package/dist/types/src/factories/WorldActivityFactory.d.ts +0 -8
- package/dist/types/src/factories/WorldFactory.d.ts +0 -8
- package/dist/types/src/factories/index.d.ts +0 -7
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/interfaces/AssetInterfaces.d.ts +0 -26
- package/dist/types/src/interfaces/DroppedAssetInterfaces.d.ts +0 -104
- package/dist/types/src/interfaces/SDKInterfaces.d.ts +0 -8
- package/dist/types/src/interfaces/SceneInterfaces.d.ts +0 -27
- package/dist/types/src/interfaces/TopiaInterfaces.d.ts +0 -10
- package/dist/types/src/interfaces/UserInterfaces.d.ts +0 -7
- package/dist/types/src/interfaces/VisitorInterfaces.d.ts +0 -37
- package/dist/types/src/interfaces/WorldActivityInterfaces.d.ts +0 -11
- package/dist/types/src/interfaces/WorldInterfaces.d.ts +0 -32
- package/dist/types/src/interfaces/index.d.ts +0 -9
- package/dist/types/src/types/DroppedAssetTypes.d.ts +0 -10
- package/dist/types/src/types/InteractiveCredentialsTypes.d.ts +0 -9
- package/dist/types/src/types/OptionsTypes.d.ts +0 -21
- package/dist/types/src/types/ResponseTypes.d.ts +0 -4
- package/dist/types/src/types/VisitorTypes.d.ts +0 -33
- package/dist/types/src/types/index.d.ts +0 -5
- package/dist/types/src/utils/__tests__/removeUndefined.test.d.ts +0 -1
- package/dist/types/src/utils/__tests__/scatterVisitors.test.d.ts +0 -1
- package/dist/types/src/utils/getBrowserWarning.d.ts +0 -1
- package/dist/types/src/utils/index.d.ts +0 -3
- package/dist/types/src/utils/removeUndefined.d.ts +0 -8
- package/dist/types/src/utils/scatterVisitors.d.ts +0 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2023, metaversecloud.com | topia.io
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
8
|
+
*
|
|
9
|
+
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
10
|
+
*
|
|
11
|
+
* - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
12
|
+
*
|
|
13
|
+
* - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
14
|
+
*
|
|
15
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import * as axios from 'axios';
|
|
19
|
+
import { AxiosResponse, AxiosInstance, AxiosError } from 'axios';
|
|
20
|
+
import jwt from 'jsonwebtoken';
|
|
21
|
+
|
|
22
|
+
declare enum DroppedAssetClickType {
|
|
23
|
+
NONE = "none",
|
|
24
|
+
LINK = "link",
|
|
25
|
+
PORTAL = "portal",
|
|
26
|
+
TELEPORT = "teleport"
|
|
27
|
+
}
|
|
28
|
+
declare enum DroppedAssetMediaType {
|
|
29
|
+
NONE = "none",
|
|
30
|
+
LINK = "link"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type InteractiveCredentials = {
|
|
34
|
+
assetId?: string;
|
|
35
|
+
interactiveNonce?: string;
|
|
36
|
+
interactivePublicKey?: string;
|
|
37
|
+
visitorId?: number;
|
|
38
|
+
urlSlug?: string;
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
profileId?: string | null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type AssetOptions = {
|
|
44
|
+
attributes?: AssetInterface | undefined;
|
|
45
|
+
credentials?: InteractiveCredentials | undefined;
|
|
46
|
+
};
|
|
47
|
+
type DroppedAssetOptions = {
|
|
48
|
+
attributes?: DroppedAssetInterface | undefined;
|
|
49
|
+
credentials?: InteractiveCredentials | undefined;
|
|
50
|
+
};
|
|
51
|
+
type UserOptions = {
|
|
52
|
+
credentials?: InteractiveCredentials | undefined;
|
|
53
|
+
};
|
|
54
|
+
type VisitorOptions = {
|
|
55
|
+
attributes?: VisitorInterface | undefined;
|
|
56
|
+
credentials?: InteractiveCredentials | undefined;
|
|
57
|
+
};
|
|
58
|
+
type WorldOptions = {
|
|
59
|
+
attributes?: WorldInterface | undefined;
|
|
60
|
+
credentials?: InteractiveCredentials | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type ResponseType = {
|
|
64
|
+
message: string;
|
|
65
|
+
success: boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @summary
|
|
70
|
+
* Create an instance of Scene class with a given scene id and optional attributes and session credentials.
|
|
71
|
+
*
|
|
72
|
+
* @usage
|
|
73
|
+
* ```ts
|
|
74
|
+
* await new Scene(topia, "sceneId", { attributes: { name: "My Scene" } });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare class Scene extends SDKController implements SceneInterface {
|
|
78
|
+
readonly id: string;
|
|
79
|
+
constructor(topia: Topia, id: string, options?: SceneOptionalInterface);
|
|
80
|
+
fetchSceneById(): Promise<void | ResponseType>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @summary
|
|
85
|
+
* Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
|
|
86
|
+
*
|
|
87
|
+
* @usage
|
|
88
|
+
* ```ts
|
|
89
|
+
* await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", { attributes: { text: "" }, credentials: { assetId: "1giFZb0sQ3X27L7uGyQX" } } });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare class DroppedAsset extends Asset implements DroppedAssetInterface {
|
|
93
|
+
#private;
|
|
94
|
+
dataObject?: object | null;
|
|
95
|
+
readonly id?: string | undefined;
|
|
96
|
+
text?: string | null | undefined;
|
|
97
|
+
urlSlug: string;
|
|
98
|
+
isInteractive?: boolean | null;
|
|
99
|
+
interactivePublicKey?: string | null;
|
|
100
|
+
constructor(topia: Topia, id: string, urlSlug: string, options?: DroppedAssetOptionalInterface);
|
|
101
|
+
/**
|
|
102
|
+
* @summary
|
|
103
|
+
* Retrieves dropped asset details.
|
|
104
|
+
*
|
|
105
|
+
* @usage
|
|
106
|
+
* ```ts
|
|
107
|
+
* await droppedAsset.fetchDroppedAssetById();
|
|
108
|
+
* const { assetName } = droppedAsset;
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
fetchDroppedAssetById(): Promise<void | ResponseType>;
|
|
112
|
+
/**
|
|
113
|
+
* @summary
|
|
114
|
+
* Delete dropped asset.
|
|
115
|
+
*
|
|
116
|
+
* @usage
|
|
117
|
+
* ```ts
|
|
118
|
+
* await droppedAsset.deleteDroppedAsset();
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
deleteDroppedAsset(): Promise<void | ResponseType>;
|
|
122
|
+
/**
|
|
123
|
+
* @summary
|
|
124
|
+
* Retrieves the data object for a dropped asset.
|
|
125
|
+
*
|
|
126
|
+
* @usage
|
|
127
|
+
* ```ts
|
|
128
|
+
* await droppedAsset.fetchDataObject();
|
|
129
|
+
* const { dataObject } = droppedAsset;
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
fetchDataObject(): Promise<void | ResponseType>;
|
|
133
|
+
/**
|
|
134
|
+
* @summary
|
|
135
|
+
* Sets the data object for a dropped asset.
|
|
136
|
+
*
|
|
137
|
+
* 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
|
|
138
|
+
*
|
|
139
|
+
* @usage
|
|
140
|
+
* ```ts
|
|
141
|
+
* await droppedAsset.setDataObject({
|
|
142
|
+
* "exampleKey": "exampleValue",
|
|
143
|
+
* });
|
|
144
|
+
* const { dataObject } = droppedAsset;
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
setDataObject(dataObject: object, options?: {
|
|
148
|
+
lock?: {
|
|
149
|
+
lockId: string;
|
|
150
|
+
releaseLock?: boolean;
|
|
151
|
+
};
|
|
152
|
+
}): Promise<void | ResponseType>;
|
|
153
|
+
/**
|
|
154
|
+
* @summary
|
|
155
|
+
* Updates the data object for a dropped asset.
|
|
156
|
+
*
|
|
157
|
+
* 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
|
|
158
|
+
*
|
|
159
|
+
* @usage
|
|
160
|
+
* ```ts
|
|
161
|
+
* await droppedAsset.updateDataObject({
|
|
162
|
+
* "exampleKey": "exampleValue",
|
|
163
|
+
* });
|
|
164
|
+
* const { dataObject } = droppedAsset;
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
updateDroppedAssetDataObject(dataObject: object, options?: {
|
|
168
|
+
lock?: {
|
|
169
|
+
lockId: string;
|
|
170
|
+
releaseLock?: boolean;
|
|
171
|
+
};
|
|
172
|
+
}): Promise<void | ResponseType>;
|
|
173
|
+
/**
|
|
174
|
+
* @summary
|
|
175
|
+
* Updates broadcast options for a dropped asset.
|
|
176
|
+
*
|
|
177
|
+
* @usage
|
|
178
|
+
* ```ts
|
|
179
|
+
* await droppedAsset.updateBroadcast({
|
|
180
|
+
* assetBroadcast: true,
|
|
181
|
+
* assetBroadcastAll: true,
|
|
182
|
+
* broadcasterEmail: "example@email.com"
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }: UpdateBroadcastInterface): Promise<void | ResponseType>;
|
|
187
|
+
/**
|
|
188
|
+
* @summary
|
|
189
|
+
* Updates click options for a dropped asset.
|
|
190
|
+
*
|
|
191
|
+
* @usage
|
|
192
|
+
* ```ts
|
|
193
|
+
* await droppedAsset.updateClickType({
|
|
194
|
+
* "clickType": "portal",
|
|
195
|
+
* "clickableLink": "https://topia.io",
|
|
196
|
+
* "clickableLinkTitle": "My awesome link!",
|
|
197
|
+
* "clickableDisplayTextDescription": "Description",
|
|
198
|
+
* "clickableDisplayTextHeadline": "Title",
|
|
199
|
+
* "position": {
|
|
200
|
+
* "x": 0,
|
|
201
|
+
* "y": 0
|
|
202
|
+
* },
|
|
203
|
+
* "portalName": "community"
|
|
204
|
+
* });
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }: UpdateClickTypeInterface): Promise<void | ResponseType>;
|
|
208
|
+
/**
|
|
209
|
+
* @summary
|
|
210
|
+
* Updates text and style of a dropped asset.
|
|
211
|
+
*
|
|
212
|
+
* @usage
|
|
213
|
+
* ```ts
|
|
214
|
+
* const style = {
|
|
215
|
+
* "textColor": "#abc123",
|
|
216
|
+
* "textFontFamily": "Arial",
|
|
217
|
+
* "textSize": 40,
|
|
218
|
+
* "textWeight": "normal",
|
|
219
|
+
* "textWidth": 200
|
|
220
|
+
* };
|
|
221
|
+
* await droppedAsset.updateCustomTextAsset(style, "hello world");
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
updateCustomTextAsset(style: object | undefined | null, text: string | null | undefined): Promise<void | ResponseType>;
|
|
225
|
+
/**
|
|
226
|
+
* @summary
|
|
227
|
+
* Updates media options for a dropped asset.
|
|
228
|
+
*
|
|
229
|
+
* @usage
|
|
230
|
+
* ```ts
|
|
231
|
+
* await droppedAsset.updateMediaType({
|
|
232
|
+
* "mediaType": "link",
|
|
233
|
+
* "mediaLink": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
|
234
|
+
* "isVideo": true,
|
|
235
|
+
* "syncUserMedia": true,
|
|
236
|
+
* "audioSliderVolume: 30"
|
|
237
|
+
* "portalName": "community",
|
|
238
|
+
* "audioRadius": 0,
|
|
239
|
+
* "mediaName": "string"
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }: UpdateMediaTypeInterface): Promise<void | ResponseType>;
|
|
244
|
+
/**
|
|
245
|
+
* @summary
|
|
246
|
+
* Updates mute zone options for a dropped asset.
|
|
247
|
+
*
|
|
248
|
+
* @usage
|
|
249
|
+
* ```ts
|
|
250
|
+
* await droppedAsset.updateMuteZone(true);
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
updateMuteZone(isMutezone: boolean): Promise<void | ResponseType>;
|
|
254
|
+
/**
|
|
255
|
+
* @summary
|
|
256
|
+
* Updates webhook zone options for a dropped asset.
|
|
257
|
+
*
|
|
258
|
+
* @usage
|
|
259
|
+
* ```ts
|
|
260
|
+
* await droppedAsset.updateWebhookZone(true);
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
updateWebhookZone(isWebhookZoneEnabled: boolean): Promise<void | ResponseType>;
|
|
264
|
+
/**
|
|
265
|
+
* @summary
|
|
266
|
+
* Moves a dropped asset to specified coordinates.
|
|
267
|
+
*
|
|
268
|
+
* @usage
|
|
269
|
+
* ```ts
|
|
270
|
+
* await droppedAsset.updatePosition(100,200);
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
updatePosition(x: number, y: number): Promise<void | ResponseType>;
|
|
274
|
+
/**
|
|
275
|
+
* @summary
|
|
276
|
+
* Updates private zone options for a dropped asset.
|
|
277
|
+
*
|
|
278
|
+
* @usage
|
|
279
|
+
* ```ts
|
|
280
|
+
* await droppedAsset.updatePrivateZone({
|
|
281
|
+
* "isPrivateZone": false,
|
|
282
|
+
* "isPrivateZoneChatDisabled": true,
|
|
283
|
+
* "privateZoneUserCap": 10
|
|
284
|
+
* });
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }: UpdatePrivateZoneInterface): Promise<void | ResponseType>;
|
|
288
|
+
/**
|
|
289
|
+
* @summary
|
|
290
|
+
* Updates the size of a dropped asset.
|
|
291
|
+
*
|
|
292
|
+
* @usage
|
|
293
|
+
* ```ts
|
|
294
|
+
* await droppedAsset.assetScale(.5);
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
updateScale(assetScale: number): Promise<void | ResponseType>;
|
|
298
|
+
/**
|
|
299
|
+
* @summary
|
|
300
|
+
* Change or remove media embedded in a dropped asset.
|
|
301
|
+
*
|
|
302
|
+
* @usage
|
|
303
|
+
* ```ts
|
|
304
|
+
* await droppedAsset.updateUploadedMediaSelected("LVWyxwNxI96eLjnXWwYO");
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
updateUploadedMediaSelected(mediaId: string): Promise<void | ResponseType>;
|
|
308
|
+
/**
|
|
309
|
+
* @summary
|
|
310
|
+
* Change or remove top and bottom layers of a dropped asset.
|
|
311
|
+
*
|
|
312
|
+
* @usage
|
|
313
|
+
* ```ts
|
|
314
|
+
* await droppedAsset.updateWebImageLayers("","https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg");
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
updateWebImageLayers(bottom: string, top: string): Promise<void | ResponseType>;
|
|
318
|
+
/**
|
|
319
|
+
* @summary
|
|
320
|
+
* Add a webhook to a dropped asset
|
|
321
|
+
*
|
|
322
|
+
* @usage
|
|
323
|
+
* ```ts
|
|
324
|
+
* await droppedAsset.addWebhook({
|
|
325
|
+
* active: true,
|
|
326
|
+
* dataObject: {},
|
|
327
|
+
* description: "Webhook desc",
|
|
328
|
+
* enteredBy: "you",
|
|
329
|
+
* isUniqueOnly: false,
|
|
330
|
+
* title: "title",
|
|
331
|
+
* type: "type",
|
|
332
|
+
* url: "https://url.com",
|
|
333
|
+
* urlSlug: "world",
|
|
334
|
+
* });
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
addWebhook({ dataObject, description, isUniqueOnly, title, type, url, }: {
|
|
338
|
+
dataObject: object;
|
|
339
|
+
description: string;
|
|
340
|
+
isUniqueOnly: boolean;
|
|
341
|
+
title: string;
|
|
342
|
+
type: string;
|
|
343
|
+
url: string;
|
|
344
|
+
}): Promise<void | AxiosResponse>;
|
|
345
|
+
/**
|
|
346
|
+
* @summary
|
|
347
|
+
* Set the interactive settings on a dropped asset
|
|
348
|
+
*
|
|
349
|
+
* @usage
|
|
350
|
+
* ```ts
|
|
351
|
+
* await droppedAsset.setInteractiveSettings({
|
|
352
|
+
* isInteractive: true,
|
|
353
|
+
* interactivePublicKey: "xyz"
|
|
354
|
+
* });
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
setInteractiveSettings({ isInteractive, interactivePublicKey, }: {
|
|
358
|
+
isInteractive?: boolean;
|
|
359
|
+
interactivePublicKey: string;
|
|
360
|
+
}): Promise<void | ResponseType>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @summary
|
|
365
|
+
* Create an instance of World class with a given url slug and optional attributes and session credentials.
|
|
366
|
+
*
|
|
367
|
+
* @usage
|
|
368
|
+
* ```ts
|
|
369
|
+
* await new World(topia, "exampleWorld", { attributes: { name: "Example World" } });
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
declare class World extends SDKController implements WorldInterface {
|
|
373
|
+
#private;
|
|
374
|
+
urlSlug: string;
|
|
375
|
+
constructor(topia: Topia, urlSlug: string, options?: WorldOptionalInterface);
|
|
376
|
+
get droppedAssets(): {
|
|
377
|
+
[key: string]: DroppedAsset;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* @summary
|
|
381
|
+
* Retrieves details of a world.
|
|
382
|
+
*
|
|
383
|
+
* @usage
|
|
384
|
+
* ```ts
|
|
385
|
+
* await world.fetchDetails();
|
|
386
|
+
* const { name } = world;
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
fetchDetails(): Promise<void | ResponseType>;
|
|
390
|
+
/**
|
|
391
|
+
* @summary
|
|
392
|
+
* Update details of a world.
|
|
393
|
+
*
|
|
394
|
+
* @usage
|
|
395
|
+
* ```ts
|
|
396
|
+
* await world.updateDetails({
|
|
397
|
+
* controls: {
|
|
398
|
+
* allowMuteAll: true,
|
|
399
|
+
* disableHideVideo: true,
|
|
400
|
+
* isMobileDisabled: false,
|
|
401
|
+
* isShowingCurrentGuests: false,
|
|
402
|
+
* },
|
|
403
|
+
* description: 'Welcome to my world.',
|
|
404
|
+
* forceAuthOnLogin: false,
|
|
405
|
+
* height: 2000,
|
|
406
|
+
* name: 'Example',
|
|
407
|
+
* spawnPosition: { x: 100, y: 100 },
|
|
408
|
+
* width: 2000
|
|
409
|
+
* });
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldInterface): Promise<void | ResponseType>;
|
|
413
|
+
/**
|
|
414
|
+
* @summary
|
|
415
|
+
* Retrieve all assets dropped in a world.
|
|
416
|
+
*
|
|
417
|
+
* @usage
|
|
418
|
+
* ```ts
|
|
419
|
+
* await world.fetchDroppedAssets();
|
|
420
|
+
* const assets = world.droppedAssets;
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
fetchDroppedAssets(): Promise<void | ResponseType>;
|
|
424
|
+
/**
|
|
425
|
+
* @summary
|
|
426
|
+
* Retrieve all assets dropped in a world matching uniqueName.
|
|
427
|
+
*
|
|
428
|
+
* @usage
|
|
429
|
+
* ```ts
|
|
430
|
+
* await world.fetchDroppedAssets();
|
|
431
|
+
* const assets = world.droppedAssets;
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
fetchDroppedAssetsWithUniqueName({ uniqueName, isPartial, isReversed, }: {
|
|
435
|
+
uniqueName: string;
|
|
436
|
+
isPartial?: boolean;
|
|
437
|
+
isReversed?: boolean;
|
|
438
|
+
}): Promise<DroppedAsset[]>;
|
|
439
|
+
/**
|
|
440
|
+
* @summary
|
|
441
|
+
* Update multiple custom text dropped assets with a single style while preserving text for specified dropped assets only.
|
|
442
|
+
*
|
|
443
|
+
* @usage
|
|
444
|
+
* ```ts
|
|
445
|
+
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]];
|
|
446
|
+
* const style = {
|
|
447
|
+
* "textColor": "#abc123",
|
|
448
|
+
* "textFontFamily": "Arial",
|
|
449
|
+
* "textSize": 40,
|
|
450
|
+
* "textWeight": "normal",
|
|
451
|
+
* "textWidth": 200
|
|
452
|
+
* };
|
|
453
|
+
* await world.updateCustomText(droppedAssetsToUpdate, style);
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* @result
|
|
457
|
+
* Updates each DroppedAsset instance and world.droppedAssets map.
|
|
458
|
+
*/
|
|
459
|
+
updateCustomTextDroppedAssets(droppedAssetsToUpdate: Array<DroppedAsset>, style: object): Promise<object>;
|
|
460
|
+
/**
|
|
461
|
+
* @summary
|
|
462
|
+
* Drop a scene in a world.
|
|
463
|
+
*
|
|
464
|
+
* @usage
|
|
465
|
+
* ```ts
|
|
466
|
+
* await world.dropScene({
|
|
467
|
+
* "sceneId": "string",
|
|
468
|
+
* "position": {
|
|
469
|
+
* "x": 0,
|
|
470
|
+
* "y": 0
|
|
471
|
+
* },
|
|
472
|
+
* "assetSuffix": "string"
|
|
473
|
+
* });
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
dropScene({ assetSuffix, position, sceneId, }: {
|
|
477
|
+
assetSuffix: string;
|
|
478
|
+
position: object;
|
|
479
|
+
sceneId: string;
|
|
480
|
+
}): Promise<void | ResponseType>;
|
|
481
|
+
/**
|
|
482
|
+
* @summary
|
|
483
|
+
* Replace the current scene of a world.
|
|
484
|
+
*
|
|
485
|
+
* @usage
|
|
486
|
+
* ```ts
|
|
487
|
+
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]]
|
|
488
|
+
* const style = {
|
|
489
|
+
* "textColor": "#abc123",
|
|
490
|
+
* "textFontFamily": "Arial",
|
|
491
|
+
* "textSize": 40,
|
|
492
|
+
* "textWeight": "normal",
|
|
493
|
+
* "textWidth": 200
|
|
494
|
+
* }
|
|
495
|
+
* await world.replaceScene(SCENE_ID);
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
replaceScene(sceneId: string): Promise<void | ResponseType>;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* @summary
|
|
503
|
+
* Create an instance of User class with optional session credentials.
|
|
504
|
+
*
|
|
505
|
+
* @usage
|
|
506
|
+
* ```ts
|
|
507
|
+
* await new User(topia, { interactiveNonce: "exampleNonce", interactivePublicKey: "examplePublicKey", visitorId: 1 });
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
declare class User extends SDKController {
|
|
511
|
+
#private;
|
|
512
|
+
profileId?: string | null;
|
|
513
|
+
dataObject?: object | null | undefined;
|
|
514
|
+
profile?: Record<string, any>;
|
|
515
|
+
constructor(topia: Topia, options?: UserOptionalInterface);
|
|
516
|
+
get assets(): {
|
|
517
|
+
[key: string]: Asset;
|
|
518
|
+
};
|
|
519
|
+
get scenes(): {
|
|
520
|
+
[key: string]: Scene;
|
|
521
|
+
};
|
|
522
|
+
get worlds(): {
|
|
523
|
+
[key: string]: World;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* @summary
|
|
527
|
+
* Returns all assets owned by User when an email address is provided.
|
|
528
|
+
*/
|
|
529
|
+
fetchAssets(): Promise<void | ResponseType>;
|
|
530
|
+
/**
|
|
531
|
+
* @summary
|
|
532
|
+
* Returns all scenes owned by User
|
|
533
|
+
*/
|
|
534
|
+
fetchScenes(): Promise<void | ResponseType>;
|
|
535
|
+
/**
|
|
536
|
+
* @summary
|
|
537
|
+
* Retrieves all worlds owned by user with matching API Key,
|
|
538
|
+
* creates a new World object for each,
|
|
539
|
+
* and creates new map of Worlds accessible via user.worlds.
|
|
540
|
+
*
|
|
541
|
+
* @usage
|
|
542
|
+
* ```ts
|
|
543
|
+
* await user.fetchWorldsByKey();
|
|
544
|
+
* const userWorlds = user.worlds;
|
|
545
|
+
* ```
|
|
546
|
+
*
|
|
547
|
+
* @result
|
|
548
|
+
* ```ts
|
|
549
|
+
* { urlSlug: new World({ apiKey, worldArgs, urlSlug }) }
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
fetchWorldsByKey(): Promise<void | ResponseType>;
|
|
553
|
+
/**
|
|
554
|
+
* @summary
|
|
555
|
+
* Retrieves the data object for a user.
|
|
556
|
+
*
|
|
557
|
+
* @usage
|
|
558
|
+
* ```ts
|
|
559
|
+
* await droppedAsset.fetchDataObject();
|
|
560
|
+
* const { dataObject } = droppedAsset;
|
|
561
|
+
* ```
|
|
562
|
+
*/
|
|
563
|
+
fetchDataObject(): Promise<void | ResponseType>;
|
|
564
|
+
/**
|
|
565
|
+
* @summary
|
|
566
|
+
* Sets the data object for a user.
|
|
567
|
+
*
|
|
568
|
+
* 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
|
|
569
|
+
*
|
|
570
|
+
* @usage
|
|
571
|
+
* ```ts
|
|
572
|
+
* await droppedAsset.setDataObject({
|
|
573
|
+
* "exampleKey": "exampleValue",
|
|
574
|
+
* });
|
|
575
|
+
* const { dataObject } = droppedAsset;
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
setDataObject(dataObject: object | null | undefined, options?: {
|
|
579
|
+
lock?: {
|
|
580
|
+
lockId: string;
|
|
581
|
+
releaseLock?: boolean;
|
|
582
|
+
};
|
|
583
|
+
}): Promise<void | ResponseType>;
|
|
584
|
+
/**
|
|
585
|
+
* @summary
|
|
586
|
+
* Updates the data object for a user.
|
|
587
|
+
*
|
|
588
|
+
* 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
|
|
589
|
+
*
|
|
590
|
+
* @usage
|
|
591
|
+
* ```ts
|
|
592
|
+
* await droppedAsset.updateUserDataObject({
|
|
593
|
+
* "exampleKey": "exampleValue",
|
|
594
|
+
* });
|
|
595
|
+
* const { dataObject } = droppedAsset;
|
|
596
|
+
* ```
|
|
597
|
+
*/
|
|
598
|
+
updateDataObject(dataObject: object, options?: {
|
|
599
|
+
lock?: {
|
|
600
|
+
lockId: string;
|
|
601
|
+
releaseLock?: boolean;
|
|
602
|
+
};
|
|
603
|
+
}): Promise<void | ResponseType>;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* @summary
|
|
608
|
+
* Create an instance of Visitor class with a given id and optional attributes and session credentials.
|
|
609
|
+
*
|
|
610
|
+
* @usage
|
|
611
|
+
* ```ts
|
|
612
|
+
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } } });
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
declare class Visitor extends User implements VisitorInterface {
|
|
616
|
+
#private;
|
|
617
|
+
readonly id: number;
|
|
618
|
+
urlSlug: string;
|
|
619
|
+
user?: User;
|
|
620
|
+
constructor(topia: Topia, id: number, urlSlug: string, options?: VisitorOptionalInterface);
|
|
621
|
+
/**
|
|
622
|
+
* @summary
|
|
623
|
+
* Get a single visitor from a world
|
|
624
|
+
*
|
|
625
|
+
* @usage
|
|
626
|
+
* ```ts
|
|
627
|
+
* await visitor.fetchVisitor();
|
|
628
|
+
* ```
|
|
629
|
+
*
|
|
630
|
+
* @result
|
|
631
|
+
* Returns details for a visitor in a world by id and urlSlug
|
|
632
|
+
*/
|
|
633
|
+
fetchVisitor(): Promise<void | ResponseType>;
|
|
634
|
+
/**
|
|
635
|
+
* @summary
|
|
636
|
+
* Teleport or walk a visitor currently in a world to a single set of coordinates.
|
|
637
|
+
*
|
|
638
|
+
* @usage
|
|
639
|
+
* ```ts
|
|
640
|
+
* await visitor.moveVisitor({
|
|
641
|
+
* shouldTeleportVisitor: true,
|
|
642
|
+
* x: 100,
|
|
643
|
+
* y: 100,
|
|
644
|
+
* });
|
|
645
|
+
* ```
|
|
646
|
+
*
|
|
647
|
+
* @result
|
|
648
|
+
* Updates each Visitor instance and world.visitors map.
|
|
649
|
+
*/
|
|
650
|
+
moveVisitor({ shouldTeleportVisitor, x, y }: MoveVisitorInterface): Promise<void | ResponseType>;
|
|
651
|
+
/**
|
|
652
|
+
* @summary
|
|
653
|
+
* Display a message via a toast to a visitor currently in a world.
|
|
654
|
+
*
|
|
655
|
+
* @usage
|
|
656
|
+
* ```ts
|
|
657
|
+
* await visitor.fireToast({
|
|
658
|
+
* groupId: "custom-message",
|
|
659
|
+
* title: "Hello World",
|
|
660
|
+
* text: "Thank you for participating!",
|
|
661
|
+
* });
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
fireToast({ groupId, title, text }: FireToastInterface): Promise<void | ResponseType>;
|
|
665
|
+
/**
|
|
666
|
+
* @summary
|
|
667
|
+
* Open an iframe in a drawer or modal for a visitor currently in a world.
|
|
668
|
+
*
|
|
669
|
+
* @usage
|
|
670
|
+
* ```ts
|
|
671
|
+
* await visitor.openIframe({
|
|
672
|
+
* link: "https://topia.io",
|
|
673
|
+
* shouldOpenInDrawer: true,
|
|
674
|
+
* title: "Hello World",
|
|
675
|
+
* });
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
openIframe({ link, shouldOpenInDrawer, title }: OpenIframeInterface): Promise<void | ResponseType>;
|
|
679
|
+
/**
|
|
680
|
+
* @summary
|
|
681
|
+
* Retrieves the data object for a visitor.
|
|
682
|
+
*
|
|
683
|
+
* @usage
|
|
684
|
+
* ```ts
|
|
685
|
+
* await droppedAsset.fetchVisitorDataObject();
|
|
686
|
+
* const { dataObject } = droppedAsset;
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
fetchDataObject(): Promise<void | ResponseType>;
|
|
690
|
+
/**
|
|
691
|
+
* @summary
|
|
692
|
+
* Sets the data object for a visitor.
|
|
693
|
+
*
|
|
694
|
+
* 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
|
|
695
|
+
*
|
|
696
|
+
* @usage
|
|
697
|
+
* ```ts
|
|
698
|
+
* await droppedAsset.setVisitorDataObject({
|
|
699
|
+
* "exampleKey": "exampleValue",
|
|
700
|
+
* });
|
|
701
|
+
* const { dataObject } = droppedAsset;
|
|
702
|
+
* ```
|
|
703
|
+
*/
|
|
704
|
+
setDataObject(dataObject: object | null | undefined, options?: {
|
|
705
|
+
lock?: {
|
|
706
|
+
lockId: string;
|
|
707
|
+
releaseLock?: boolean;
|
|
708
|
+
};
|
|
709
|
+
}): Promise<void | ResponseType>;
|
|
710
|
+
/**
|
|
711
|
+
* @summary
|
|
712
|
+
* Updates the data object for a visitor.
|
|
713
|
+
*
|
|
714
|
+
* 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
|
|
715
|
+
*
|
|
716
|
+
* @usage
|
|
717
|
+
* ```ts
|
|
718
|
+
* await droppedAsset.updateVisitorDataObject({
|
|
719
|
+
* "exampleKey": "exampleValue",
|
|
720
|
+
* });
|
|
721
|
+
* const { dataObject } = droppedAsset;
|
|
722
|
+
* ```
|
|
723
|
+
*/
|
|
724
|
+
updateDataObject(dataObject: object, options?: {
|
|
725
|
+
lock?: {
|
|
726
|
+
lockId: string;
|
|
727
|
+
releaseLock?: boolean;
|
|
728
|
+
};
|
|
729
|
+
}): Promise<void | ResponseType>;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
type VisitorType = {
|
|
733
|
+
visitorId: number;
|
|
734
|
+
color: string;
|
|
735
|
+
displayName: string;
|
|
736
|
+
gestureType: number;
|
|
737
|
+
hidden: boolean;
|
|
738
|
+
isAdmin: boolean;
|
|
739
|
+
isBackground: boolean;
|
|
740
|
+
isMobile: boolean;
|
|
741
|
+
isRecording: boolean;
|
|
742
|
+
isRecordingBot: boolean;
|
|
743
|
+
lastUpdate: number;
|
|
744
|
+
moveFrom: object;
|
|
745
|
+
movedOn: number;
|
|
746
|
+
moveTo: {
|
|
747
|
+
x: number;
|
|
748
|
+
y: number;
|
|
749
|
+
};
|
|
750
|
+
muted: boolean;
|
|
751
|
+
performer: boolean;
|
|
752
|
+
performerNear: boolean;
|
|
753
|
+
shareScreen: boolean;
|
|
754
|
+
sitting: boolean;
|
|
755
|
+
username: string;
|
|
756
|
+
};
|
|
757
|
+
type VisitorsToMoveType = {
|
|
758
|
+
visitorObj: Visitor;
|
|
759
|
+
shouldTeleportVisitor: boolean;
|
|
760
|
+
x: number;
|
|
761
|
+
y: number;
|
|
762
|
+
};
|
|
763
|
+
type VisitorsToMoveArrayType = Array<VisitorsToMoveType>;
|
|
764
|
+
|
|
765
|
+
interface SDKInterface {
|
|
766
|
+
credentials?: InteractiveCredentials;
|
|
767
|
+
jwt?: string;
|
|
768
|
+
requestOptions: object;
|
|
769
|
+
topia: Topia;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
interface AssetInterface extends SDKInterface {
|
|
773
|
+
fetchPlatformAssets(): Promise<object>;
|
|
774
|
+
addedOn?: string;
|
|
775
|
+
assetName?: string;
|
|
776
|
+
creatorTags?: object;
|
|
777
|
+
readonly id?: string;
|
|
778
|
+
isPublic?: boolean;
|
|
779
|
+
library?: string;
|
|
780
|
+
originalAssetId?: string;
|
|
781
|
+
originalKit?: string;
|
|
782
|
+
ownerId?: string;
|
|
783
|
+
ownerName?: string;
|
|
784
|
+
platformAsset?: boolean;
|
|
785
|
+
purchased?: boolean;
|
|
786
|
+
purchaseDate?: string;
|
|
787
|
+
purchasedFrom?: string;
|
|
788
|
+
specialType?: string | null;
|
|
789
|
+
transactionId?: string;
|
|
790
|
+
type?: string;
|
|
791
|
+
}
|
|
792
|
+
type AssetOptionalInterface = {
|
|
793
|
+
attributes?: AssetInterface | object;
|
|
794
|
+
credentials?: InteractiveCredentials | object;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
interface DroppedAssetInterface extends AssetInterface {
|
|
798
|
+
id?: string;
|
|
799
|
+
assetId?: string;
|
|
800
|
+
assetScale?: number | null;
|
|
801
|
+
assetPodium?: boolean | null;
|
|
802
|
+
audioRadius?: number | null;
|
|
803
|
+
assetBroadcastAll?: boolean | null;
|
|
804
|
+
assetPrivateConversation?: boolean | null;
|
|
805
|
+
assetPrivateZoneChannelDisabled?: boolean | null;
|
|
806
|
+
assetPrivateConversationCap?: number | null;
|
|
807
|
+
audioSliderVolume?: number | null;
|
|
808
|
+
broadcasterEmail?: string | null;
|
|
809
|
+
clickType?: string | null;
|
|
810
|
+
clickableLink?: string | null;
|
|
811
|
+
clickableLinkTitle?: string | null;
|
|
812
|
+
clickablePortal?: string | null;
|
|
813
|
+
creationDatetime?: number;
|
|
814
|
+
contractAddress?: string | null;
|
|
815
|
+
dataObject?: object | null;
|
|
816
|
+
clickableDisplayTextDescription?: string | null;
|
|
817
|
+
clickableDisplayTextHeadline?: string | null;
|
|
818
|
+
existingKey?: string | null;
|
|
819
|
+
interactivePublicKey?: string | null;
|
|
820
|
+
isInteractive?: boolean | null;
|
|
821
|
+
isVideoPlayer?: boolean | null;
|
|
822
|
+
kitId?: string | null;
|
|
823
|
+
layer0?: string | null;
|
|
824
|
+
layer1?: string | null;
|
|
825
|
+
mediaLink?: string | null;
|
|
826
|
+
mediaPlayTime?: number | null;
|
|
827
|
+
mediaType?: string | null;
|
|
828
|
+
mediaName?: string | null;
|
|
829
|
+
muteZone?: boolean | null;
|
|
830
|
+
mediaUploadedId?: string | null;
|
|
831
|
+
mediaUploadedLink?: string | null;
|
|
832
|
+
metaName?: string | null;
|
|
833
|
+
position?: {
|
|
834
|
+
x?: number;
|
|
835
|
+
y?: number;
|
|
836
|
+
};
|
|
837
|
+
portalCoordsX?: number | null;
|
|
838
|
+
portalCoordsY?: number | null;
|
|
839
|
+
showMediaAsIfPeer?: boolean | null;
|
|
840
|
+
syncUserMedia?: boolean | null;
|
|
841
|
+
urlSlug: string;
|
|
842
|
+
tagJson?: string | null;
|
|
843
|
+
text?: string | null;
|
|
844
|
+
textColor?: string | null;
|
|
845
|
+
textSize?: number | null;
|
|
846
|
+
textWidth?: number | null;
|
|
847
|
+
textWeight?: string | null;
|
|
848
|
+
textFont?: string | null;
|
|
849
|
+
textFontFamily?: string | null;
|
|
850
|
+
teleportX?: number | null;
|
|
851
|
+
teleportY?: number | null;
|
|
852
|
+
tokenSymbol?: string | null;
|
|
853
|
+
tokenName?: string | null;
|
|
854
|
+
worldId?: string | null;
|
|
855
|
+
walletAddress?: string | null;
|
|
856
|
+
yOrderAdjust?: number | null;
|
|
857
|
+
}
|
|
858
|
+
interface DroppedAssetOptionalInterface {
|
|
859
|
+
attributes?: DroppedAssetInterface | {
|
|
860
|
+
text: string;
|
|
861
|
+
urlSlug?: string;
|
|
862
|
+
};
|
|
863
|
+
credentials?: InteractiveCredentials | object;
|
|
864
|
+
}
|
|
865
|
+
interface UpdateBroadcastInterface {
|
|
866
|
+
assetBroadcast?: boolean;
|
|
867
|
+
assetBroadcastAll?: boolean;
|
|
868
|
+
broadcasterEmail?: string;
|
|
869
|
+
}
|
|
870
|
+
interface UpdateClickTypeInterface {
|
|
871
|
+
clickType: DroppedAssetClickType;
|
|
872
|
+
clickableLink: string;
|
|
873
|
+
clickableLinkTitle: string;
|
|
874
|
+
clickableDisplayTextDescription: string;
|
|
875
|
+
clickableDisplayTextHeadline: string;
|
|
876
|
+
isForceLinkInIframe?: boolean;
|
|
877
|
+
isOpenLinkInDrawer?: boolean;
|
|
878
|
+
portalName: string;
|
|
879
|
+
position: {
|
|
880
|
+
x: number;
|
|
881
|
+
y: number;
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
interface UpdateMediaTypeInterface {
|
|
885
|
+
audioRadius: number;
|
|
886
|
+
audioSliderVolume: number;
|
|
887
|
+
isVideo: boolean;
|
|
888
|
+
mediaLink: string;
|
|
889
|
+
mediaName: string;
|
|
890
|
+
mediaType: DroppedAssetMediaType;
|
|
891
|
+
portalName: string;
|
|
892
|
+
syncUserMedia: boolean;
|
|
893
|
+
}
|
|
894
|
+
interface UpdatePrivateZoneInterface {
|
|
895
|
+
isPrivateZone: boolean;
|
|
896
|
+
isPrivateZoneChatDisabled: boolean;
|
|
897
|
+
privateZoneUserCap: number;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
interface SceneInterface {
|
|
901
|
+
id: string;
|
|
902
|
+
background?: null;
|
|
903
|
+
description?: string;
|
|
904
|
+
created?: {
|
|
905
|
+
_seconds?: number;
|
|
906
|
+
_nanoseconds?: number;
|
|
907
|
+
};
|
|
908
|
+
height?: number;
|
|
909
|
+
kitWorldOwner?: string;
|
|
910
|
+
name?: string;
|
|
911
|
+
price?: number;
|
|
912
|
+
spawnPosition?: {
|
|
913
|
+
radius?: number;
|
|
914
|
+
y?: number;
|
|
915
|
+
x?: number;
|
|
916
|
+
};
|
|
917
|
+
timesUsed?: number;
|
|
918
|
+
urlSlug?: string;
|
|
919
|
+
width?: number;
|
|
920
|
+
worldCenteredAtZero?: boolean;
|
|
921
|
+
}
|
|
922
|
+
type SceneOptionalInterface = {
|
|
923
|
+
attributes?: SceneInterface | object;
|
|
924
|
+
credentials?: InteractiveCredentials | object;
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
interface TopiaInterface {
|
|
928
|
+
apiDomain?: string;
|
|
929
|
+
apiKey?: string;
|
|
930
|
+
apiProtocol?: string;
|
|
931
|
+
axios: AxiosInstance;
|
|
932
|
+
interactiveKey?: string;
|
|
933
|
+
interactiveSecret?: jwt.Secret;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
interface UserOptionalInterface {
|
|
937
|
+
credentials?: InteractiveCredentials | object;
|
|
938
|
+
profileId?: string | null;
|
|
939
|
+
visitorId?: number | null;
|
|
940
|
+
urlSlug?: string;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
interface VisitorInterface extends SDKInterface {
|
|
944
|
+
color?: string;
|
|
945
|
+
dataObject?: object | null | undefined;
|
|
946
|
+
displayName?: string;
|
|
947
|
+
gestureType?: number;
|
|
948
|
+
hidden?: boolean;
|
|
949
|
+
isAdmin?: boolean;
|
|
950
|
+
isBackground?: boolean;
|
|
951
|
+
isMobile?: boolean;
|
|
952
|
+
isRecording?: boolean;
|
|
953
|
+
isRecordingBot?: boolean;
|
|
954
|
+
lastUpdate?: number | undefined;
|
|
955
|
+
moveFrom?: object;
|
|
956
|
+
movedOn?: number | undefined;
|
|
957
|
+
moveTo?: {
|
|
958
|
+
x?: number;
|
|
959
|
+
y?: number;
|
|
960
|
+
};
|
|
961
|
+
muted?: boolean;
|
|
962
|
+
performer?: boolean;
|
|
963
|
+
performerNear?: boolean;
|
|
964
|
+
id?: number | undefined;
|
|
965
|
+
shareScreen?: boolean;
|
|
966
|
+
sitting?: boolean;
|
|
967
|
+
urlSlug: string;
|
|
968
|
+
username?: string | undefined;
|
|
969
|
+
}
|
|
970
|
+
interface VisitorOptionalInterface {
|
|
971
|
+
attributes?: VisitorInterface | object;
|
|
972
|
+
credentials?: InteractiveCredentials | object;
|
|
973
|
+
}
|
|
974
|
+
interface MoveVisitorInterface {
|
|
975
|
+
shouldTeleportVisitor: boolean;
|
|
976
|
+
x: number;
|
|
977
|
+
y: number;
|
|
978
|
+
}
|
|
979
|
+
interface FireToastInterface {
|
|
980
|
+
groupId?: string;
|
|
981
|
+
title: string;
|
|
982
|
+
text?: string;
|
|
983
|
+
}
|
|
984
|
+
interface OpenIframeInterface {
|
|
985
|
+
link: string;
|
|
986
|
+
shouldOpenInDrawer?: boolean;
|
|
987
|
+
title?: string;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
interface WorldActivityOptionalInterface {
|
|
991
|
+
credentials?: InteractiveCredentials | object;
|
|
992
|
+
}
|
|
993
|
+
interface MoveAllVisitorsInterface {
|
|
994
|
+
shouldFetchVisitors?: boolean;
|
|
995
|
+
shouldTeleportVisitors?: boolean;
|
|
996
|
+
scatterVisitorsBy?: number;
|
|
997
|
+
x: number;
|
|
998
|
+
y: number;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
interface WorldInterface extends SDKInterface {
|
|
1002
|
+
background?: string | null;
|
|
1003
|
+
controls?: {
|
|
1004
|
+
allowMuteAll?: boolean;
|
|
1005
|
+
disableHideVideo?: boolean;
|
|
1006
|
+
isMobileDisabled?: boolean;
|
|
1007
|
+
isShowingCurrentGuests?: boolean;
|
|
1008
|
+
};
|
|
1009
|
+
created?: object;
|
|
1010
|
+
description?: string;
|
|
1011
|
+
enforceWhitelistOnLogin?: boolean;
|
|
1012
|
+
forceAuthOnLogin?: boolean;
|
|
1013
|
+
height?: number;
|
|
1014
|
+
heroImage?: string;
|
|
1015
|
+
mapExists?: boolean;
|
|
1016
|
+
name?: string;
|
|
1017
|
+
redirectTo?: string | null;
|
|
1018
|
+
spawnPosition?: {
|
|
1019
|
+
x?: number;
|
|
1020
|
+
y?: number;
|
|
1021
|
+
};
|
|
1022
|
+
tileBackgroundEverywhere?: boolean | null;
|
|
1023
|
+
urlSlug: string;
|
|
1024
|
+
useTopiaPassword?: boolean;
|
|
1025
|
+
width?: number;
|
|
1026
|
+
}
|
|
1027
|
+
interface WorldOptionalInterface {
|
|
1028
|
+
attributes?: WorldInterface | object;
|
|
1029
|
+
credentials?: InteractiveCredentials | object;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* @summary
|
|
1034
|
+
* Create a single instance of Topia axios used for all calls to the public API in all classes
|
|
1035
|
+
*
|
|
1036
|
+
* @usage
|
|
1037
|
+
* ```ts
|
|
1038
|
+
* const topia = await new Topia({
|
|
1039
|
+
* apiDomain: "api.topia.io",
|
|
1040
|
+
* apiKey: "exampleKey",
|
|
1041
|
+
* interactiveKey: "key",
|
|
1042
|
+
* interactiveSecret: "secret",
|
|
1043
|
+
* });
|
|
1044
|
+
* ```
|
|
1045
|
+
*/
|
|
1046
|
+
declare class Topia implements TopiaInterface {
|
|
1047
|
+
axios: AxiosInstance;
|
|
1048
|
+
apiDomain?: string;
|
|
1049
|
+
apiKey?: string;
|
|
1050
|
+
apiProtocol?: string;
|
|
1051
|
+
interactiveKey?: string;
|
|
1052
|
+
interactiveSecret?: jwt.Secret;
|
|
1053
|
+
constructor({ apiDomain, apiKey, apiProtocol, interactiveKey, interactiveSecret, }: {
|
|
1054
|
+
apiDomain?: string;
|
|
1055
|
+
apiKey?: string;
|
|
1056
|
+
apiProtocol?: string;
|
|
1057
|
+
interactiveKey?: string;
|
|
1058
|
+
interactiveSecret?: jwt.Secret;
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* @summary
|
|
1064
|
+
* Create an instance of SDKController class with credentials.
|
|
1065
|
+
*
|
|
1066
|
+
* @usage
|
|
1067
|
+
* ```ts
|
|
1068
|
+
* const credentials = {
|
|
1069
|
+
* assetId: "exampleAsset",
|
|
1070
|
+
* interactiveNonce: "exampleNonce"
|
|
1071
|
+
* interactivePublicKey: "examplePublicKey",
|
|
1072
|
+
* visitorId: 1,
|
|
1073
|
+
* url: "https://topia.io",
|
|
1074
|
+
* }
|
|
1075
|
+
* const topia = await new Topia({
|
|
1076
|
+
* apiDomain: "api.topia.io",
|
|
1077
|
+
* apiKey: "exampleKey",
|
|
1078
|
+
* interactiveKey: "key",
|
|
1079
|
+
* interactiveSecret: "secret",
|
|
1080
|
+
* }
|
|
1081
|
+
* await new SDKController({ credentials, topia });
|
|
1082
|
+
* ```
|
|
1083
|
+
*/
|
|
1084
|
+
declare class SDKController implements SDKInterface {
|
|
1085
|
+
credentials: InteractiveCredentials | undefined;
|
|
1086
|
+
jwt?: string;
|
|
1087
|
+
requestOptions: object;
|
|
1088
|
+
topia: Topia;
|
|
1089
|
+
constructor(topia: Topia, credentials?: InteractiveCredentials);
|
|
1090
|
+
topiaPublicApi(): axios.AxiosInstance;
|
|
1091
|
+
errorHandler({ error, message, }: {
|
|
1092
|
+
error?: Error | AxiosError | unknown;
|
|
1093
|
+
message?: string;
|
|
1094
|
+
}): {
|
|
1095
|
+
data: {};
|
|
1096
|
+
message: string;
|
|
1097
|
+
method: string;
|
|
1098
|
+
stack: string;
|
|
1099
|
+
stackTrace: Error;
|
|
1100
|
+
status: number;
|
|
1101
|
+
success: boolean;
|
|
1102
|
+
url: string;
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* @summary
|
|
1108
|
+
* Create an instance of Asset class with a given asset id and optional attributes and session credentials.
|
|
1109
|
+
*
|
|
1110
|
+
* @usage
|
|
1111
|
+
* ```ts
|
|
1112
|
+
* await new Asset(topia, "assetId", { attributes: { assetName: "My Asset", isPublic: false } });
|
|
1113
|
+
* ```
|
|
1114
|
+
*/
|
|
1115
|
+
declare class Asset extends SDKController implements AssetInterface {
|
|
1116
|
+
readonly id?: string;
|
|
1117
|
+
constructor(topia: Topia, id: string, options?: AssetOptionalInterface);
|
|
1118
|
+
fetchPlatformAssets(): Promise<object | ResponseType>;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* @summary
|
|
1123
|
+
* Create an instance of WorldActivity class with a given url slug and optional attributes and session credentials.
|
|
1124
|
+
*
|
|
1125
|
+
* This class is responsible for all activity of a specified world including editing dropped assets, moving current visitors, etc.
|
|
1126
|
+
*
|
|
1127
|
+
* @usage
|
|
1128
|
+
* ```ts
|
|
1129
|
+
* await new WorldActivity(topia, "exampleWorld", { attributes: { name: "Example World" } });
|
|
1130
|
+
* ```
|
|
1131
|
+
*/
|
|
1132
|
+
declare class WorldActivity extends SDKController {
|
|
1133
|
+
#private;
|
|
1134
|
+
urlSlug: string;
|
|
1135
|
+
constructor(topia: Topia, urlSlug: string, options?: WorldActivityOptionalInterface);
|
|
1136
|
+
get visitors(): {
|
|
1137
|
+
[key: string]: Visitor;
|
|
1138
|
+
};
|
|
1139
|
+
private fetchVisitors;
|
|
1140
|
+
/**
|
|
1141
|
+
* @summary
|
|
1142
|
+
* Retrieve all visitors currently in a world.
|
|
1143
|
+
*
|
|
1144
|
+
* @usage
|
|
1145
|
+
* ```ts
|
|
1146
|
+
* const visitors = await world.currentVisitors();
|
|
1147
|
+
* ```
|
|
1148
|
+
*/
|
|
1149
|
+
currentVisitors(): Promise<unknown>;
|
|
1150
|
+
/**
|
|
1151
|
+
* @summary
|
|
1152
|
+
* Move all visitors currently in a world to a single set of coordinates.
|
|
1153
|
+
* Optionally refetch visitors, teleport or walk visitors to new location,
|
|
1154
|
+
* and scatter visitors by any number so that they don't all move to the exact same location.
|
|
1155
|
+
*
|
|
1156
|
+
* @usage
|
|
1157
|
+
* ```ts
|
|
1158
|
+
* await world.moveAllVisitors({
|
|
1159
|
+
* shouldFetchVisitors: true,
|
|
1160
|
+
* shouldTeleportVisitors: true,
|
|
1161
|
+
* scatterVisitorsBy: 40,
|
|
1162
|
+
* x: 100,
|
|
1163
|
+
* y: 100,
|
|
1164
|
+
* });
|
|
1165
|
+
* ```
|
|
1166
|
+
*
|
|
1167
|
+
* @result
|
|
1168
|
+
* Updates each Visitor instance and world.visitors map.
|
|
1169
|
+
*/
|
|
1170
|
+
moveAllVisitors({ shouldFetchVisitors, shouldTeleportVisitors, scatterVisitorsBy, x, y, }: MoveAllVisitorsInterface): Promise<(void | ResponseType)[] | undefined>;
|
|
1171
|
+
/**
|
|
1172
|
+
* @summary
|
|
1173
|
+
* Teleport or walk a list of visitors currently in a world to various coordinates.
|
|
1174
|
+
*
|
|
1175
|
+
* @usage
|
|
1176
|
+
* ```ts
|
|
1177
|
+
* const visitorsToMove = [
|
|
1178
|
+
* {
|
|
1179
|
+
* visitorObj: world.visitors["1"],
|
|
1180
|
+
* shouldTeleportVisitor: true,
|
|
1181
|
+
* x: 100,
|
|
1182
|
+
* y: 100
|
|
1183
|
+
* }, {
|
|
1184
|
+
* visitorObj: world.visitors["2"],
|
|
1185
|
+
* shouldTeleportVisitor: false,
|
|
1186
|
+
* x: 100,
|
|
1187
|
+
* y: 100
|
|
1188
|
+
* }
|
|
1189
|
+
* ];
|
|
1190
|
+
* await world.moveVisitors(visitorsToMove);
|
|
1191
|
+
* ```
|
|
1192
|
+
*
|
|
1193
|
+
* @result
|
|
1194
|
+
* Updates each Visitor instance and world.visitors map.
|
|
1195
|
+
*/
|
|
1196
|
+
moveVisitors(visitorsToMove: VisitorsToMoveArrayType): Promise<(void | ResponseType)[]>;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
declare class AssetFactory {
|
|
1200
|
+
topia: Topia;
|
|
1201
|
+
constructor(topia: Topia);
|
|
1202
|
+
create(id: string, options?: AssetOptionalInterface): Asset;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
declare class DroppedAssetFactory extends SDKController {
|
|
1206
|
+
constructor(topia: Topia);
|
|
1207
|
+
create(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): DroppedAsset;
|
|
1208
|
+
get(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): Promise<DroppedAsset>;
|
|
1209
|
+
drop(asset: Asset, { position: { x, y }, uniqueName, urlSlug, }: {
|
|
1210
|
+
position: {
|
|
1211
|
+
x: number;
|
|
1212
|
+
y: number;
|
|
1213
|
+
};
|
|
1214
|
+
uniqueName?: string;
|
|
1215
|
+
urlSlug: string;
|
|
1216
|
+
}): Promise<DroppedAsset>;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
declare class SceneFactory {
|
|
1220
|
+
topia: Topia;
|
|
1221
|
+
constructor(topia: Topia);
|
|
1222
|
+
create(id: string, options?: SceneOptionalInterface): Scene;
|
|
1223
|
+
get(id: string, options?: SceneOptionalInterface): Promise<Scene>;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
declare class UserFactory {
|
|
1227
|
+
topia: Topia;
|
|
1228
|
+
constructor(topia: Topia);
|
|
1229
|
+
create(options?: UserOptionalInterface): User;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
declare class VisitorFactory {
|
|
1233
|
+
topia: Topia;
|
|
1234
|
+
constructor(topia: Topia);
|
|
1235
|
+
create(id: number, urlSlug: string, options?: VisitorOptionalInterface): Visitor;
|
|
1236
|
+
get(id: number, urlSlug: string, options?: VisitorOptionalInterface): Promise<Visitor>;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
declare class WorldActivityFactory {
|
|
1240
|
+
topia: Topia;
|
|
1241
|
+
constructor(topia: Topia);
|
|
1242
|
+
create(urlSlug: string, options?: WorldOptionalInterface): WorldActivity;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
declare class WorldFactory {
|
|
1246
|
+
topia: Topia;
|
|
1247
|
+
constructor(topia: Topia);
|
|
1248
|
+
create(urlSlug: string, options?: WorldOptionalInterface): World;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
export { AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType, SDKInterface, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, UserFactory, UserOptionalInterface, UserOptions, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WorldActivityFactory, WorldActivityOptionalInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions };
|