@rtsdk/topia 0.0.21 → 0.0.23
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/LICENSE.md +15 -0
- package/README.md +26 -0
- package/dist/example.js +2 -2
- package/dist/index.js +40884 -4
- package/dist/src/controllers/Topia.js +1 -0
- package/package.json +3 -3
- package/dist/src/utils/getErrorResponse.js +0 -22
package/LICENSE.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, metaversecloud.com | topia.io
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
- 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.
|
|
11
|
+
|
|
12
|
+
- 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.
|
|
13
|
+
|
|
14
|
+
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
|
|
15
|
+
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.
|
package/README.md
CHANGED
|
@@ -8,6 +8,32 @@ The Topia Client Library leverages the Topia Public API and allows users to inte
|
|
|
8
8
|
|
|
9
9
|
A Topia provided API Key can be included with every object initialization as a parameter named `apiKey`. This API Key is used to in authorization headers in all calls to the Public API.
|
|
10
10
|
|
|
11
|
+
### Want to build interactive assets? This is how you can get started:
|
|
12
|
+
|
|
13
|
+
- Email developers@metaversecloud.com and Topia wil send you a Public/Private key pair.
|
|
14
|
+
- When you want to make an asset “interactive” add your PUBLIC key to the integrations page of the asset editor. Now webhooks that fire from this asset and iframes that open from this asset include the following values:
|
|
15
|
+
- assetId
|
|
16
|
+
- interactivePublicKey
|
|
17
|
+
- interactiveNonce
|
|
18
|
+
- visitorId
|
|
19
|
+
- urlSlug
|
|
20
|
+
- The above values are included in the query params of the iframe URL as well as payload of the webhook.
|
|
21
|
+
- Once you have the above values you can pass them as credentials into the factory classes when creating class instances.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
await DroppedAsset.get(assetId, urlSlug, {
|
|
25
|
+
credentials: {
|
|
26
|
+
assetId,
|
|
27
|
+
interactivePublicKey,
|
|
28
|
+
interactiveNonce,
|
|
29
|
+
visitorId,
|
|
30
|
+
urlSlug,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
<br />
|
|
36
|
+
|
|
11
37
|
### Need an API Key to test locally? This is how you can create one:
|
|
12
38
|
|
|
13
39
|
- While logged in to [topia.io](https://topia.io/), click on your image (or gray circle) in the top left of the screen to open My Account
|
package/dist/example.js
CHANGED
|
@@ -20,13 +20,13 @@ const DroppedAsset = new DroppedAssetFactory(myTopiaInstance);
|
|
|
20
20
|
const TopiaWorld = new TopiaWorldFactory(myTopiaInstance);
|
|
21
21
|
export default { myTopiaInstance, DroppedAsset, TopiaWorld };
|
|
22
22
|
const setTextOnAsset = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
const asset = yield DroppedAsset.get(req.body.assetId, req.body.urlSlug, {
|
|
23
|
+
const asset = yield DroppedAsset.get(req.body.assetId, req.body.urlSlug, { credentials: req.body });
|
|
24
24
|
yield asset.setAssetText(req.body.text);
|
|
25
25
|
});
|
|
26
26
|
import { myTopiaInterface } from "./src";
|
|
27
27
|
const setTextOnAsset = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
28
|
const asset = yield new DroppedAssetFactory(myTopiaInterface).get(req.body.assetId, req.body.urlSlug, {
|
|
29
|
-
|
|
29
|
+
credentials: req.body,
|
|
30
30
|
});
|
|
31
31
|
yield asset.setAssetText(req.body.text);
|
|
32
32
|
});
|