whio-api-sdk 1.0.0 → 1.0.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/exampleuse.d.ts +1 -0
- package/dist/exampleuse.js +59 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- /package/src/{index.ts → exampleuse.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const sdk_1 = require("./sdk");
|
|
13
|
+
const keepAlive = setInterval(() => { }, 1000);
|
|
14
|
+
class storage {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.items = {};
|
|
17
|
+
console.log("Storage initialized");
|
|
18
|
+
}
|
|
19
|
+
getItem(key) {
|
|
20
|
+
return this.items[key] || null;
|
|
21
|
+
}
|
|
22
|
+
setItem(key, value) {
|
|
23
|
+
this.items[key] = value;
|
|
24
|
+
}
|
|
25
|
+
removeItem(key) {
|
|
26
|
+
delete this.items[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const config = {
|
|
30
|
+
baseUrl: 'http://localhost:3000',
|
|
31
|
+
storage: new storage(),
|
|
32
|
+
};
|
|
33
|
+
const loginCredentials = {
|
|
34
|
+
email: "rimu.boddy@make.nz",
|
|
35
|
+
password: "cbr400rr",
|
|
36
|
+
};
|
|
37
|
+
const sdk = new sdk_1.ApiSDK(config);
|
|
38
|
+
function main() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
yield sdk.login(loginCredentials);
|
|
41
|
+
const user = sdk.getCurrentUser();
|
|
42
|
+
const newUser = yield sdk.createEditorUser("Rimu", "Rimu", "chiscs2snw2@bread.com", "cbr400rr");
|
|
43
|
+
const team = yield sdk.createTeam("best team ever", "this is the best team ever");
|
|
44
|
+
console.log(team);
|
|
45
|
+
const assignRes = yield sdk.addUserToTeam(team.id, newUser.id, "admin");
|
|
46
|
+
const template = yield sdk.createTemplate("Test Template", "This is a test template");
|
|
47
|
+
const updatedTemplate = yield sdk.updateTemplate("Updated Template", "This is an updated test template", template.id);
|
|
48
|
+
const userTemplate = yield sdk.createUserTemplate("User Template", "This is a user template", template.id);
|
|
49
|
+
const updatedUserTemplate = yield sdk.updateUserTemplate("User templated updated", "This is an updated user template", userTemplate.id);
|
|
50
|
+
//console.log("Usertemplate", userTemplate);
|
|
51
|
+
//console.log("Updated User Template", updatedUserTemplate);
|
|
52
|
+
const templates = yield sdk.getTemplates();
|
|
53
|
+
const userTemplates = yield sdk.getUserTemplates();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
main().catch((error) => {
|
|
57
|
+
console.error("Error:", error);
|
|
58
|
+
});
|
|
59
|
+
//make sure no exit
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ApiSDK as WhioSDK } from "./src/sdk";
|
package/package.json
CHANGED
|
File without changes
|