@rtsdk/topia 0.0.10 → 0.0.11
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/README.md +19 -0
- package/dist/controllers/User.js +28 -0
- package/dist/index.js +2 -18283
- package/package.json +3 -1
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Javascript RTSDK - Topia Client Library
|
|
2
|
+
|
|
3
|
+
The Topia Client Library leverages the Topia Public API and allows users to interact with the topia systems and modify their world programmatically.
|
|
4
|
+
|
|
5
|
+
## Get Started
|
|
6
|
+
|
|
7
|
+
Run `yarn add @rtsdk/topia` or `npm install @rtsdk/topia`
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
A Topia provided API Key should 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.
|
|
12
|
+
|
|
13
|
+
## Testing
|
|
14
|
+
|
|
15
|
+
We use Jest for testing and take advantage of dependency injection to pass mock data into our services.
|
|
16
|
+
|
|
17
|
+
To run the test suite, please run:
|
|
18
|
+
|
|
19
|
+
`yarn test`
|
package/dist/controllers/User.js
CHANGED
|
@@ -12,6 +12,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _User_worldsMap;
|
|
13
13
|
import { World } from "controllers/World";
|
|
14
14
|
import { getErrorMessage, publicAPI } from "utils";
|
|
15
|
+
/**
|
|
16
|
+
* Create an instance of User class with a given apiKey
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* await new User({ apiKey: API_KEY, email: "example@email.io" })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
15
22
|
export class User {
|
|
16
23
|
constructor({ apiKey, email }) {
|
|
17
24
|
_User_worldsMap.set(this, void 0);
|
|
@@ -22,6 +29,10 @@ export class User {
|
|
|
22
29
|
get worlds() {
|
|
23
30
|
return __classPrivateFieldGet(this, _User_worldsMap, "f");
|
|
24
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @summary
|
|
34
|
+
* Returns all scenes owned by User when an email address is provided
|
|
35
|
+
*/
|
|
25
36
|
fetchScenesByEmail() {
|
|
26
37
|
return new Promise((resolve, reject) => {
|
|
27
38
|
if (!this.email)
|
|
@@ -36,6 +47,23 @@ export class User {
|
|
|
36
47
|
});
|
|
37
48
|
});
|
|
38
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @summary
|
|
52
|
+
* Retrieves all worlds owned by user with matching API Key,
|
|
53
|
+
* creates a new World object for each,
|
|
54
|
+
* and creates new map of Worlds accessible via user.worlds
|
|
55
|
+
*
|
|
56
|
+
* @usage
|
|
57
|
+
* ```ts
|
|
58
|
+
* await user.fetchWorldsByKey();
|
|
59
|
+
* const userWorlds = user.worlds;
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @result
|
|
63
|
+
* ```ts
|
|
64
|
+
* { urlSlug: new World({ apiKey, worldArgs, urlSlug }) }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
39
67
|
fetchWorldsByKey() {
|
|
40
68
|
return new Promise((resolve, reject) => {
|
|
41
69
|
publicAPI(this.apiKey)
|