@formant/data-sdk 1.5.3 → 1.5.4
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/data-sdk.cjs.js +2 -2
- package/dist/data-sdk.cjs.js.map +1 -1
- package/dist/data-sdk.es.js +391 -366
- package/dist/data-sdk.es.js.map +1 -1
- package/dist/data-sdk.es6.js +49 -24
- package/dist/data-sdk.umd.js +1 -1
- package/dist/types/data-sdk/src/api/createDevice.d.ts +2 -0
- package/dist/types/data-sdk/src/api/getDevicesData.d.ts +2 -0
- package/dist/types/data-sdk/src/api/patchDevice.d.ts +2 -0
- package/dist/types/data-sdk/src/api/queryDevicesData.d.ts +3 -0
- package/dist/types/data-sdk/src/devices/Device.d.ts +8 -3
- package/dist/types/data-sdk/src/main.d.ts +6 -0
- package/package.json +1 -1
package/dist/data-sdk.es6.js
CHANGED
|
@@ -22779,6 +22779,54 @@ async function getPeers() {
|
|
|
22779
22779
|
await e.shutdown();
|
|
22780
22780
|
}
|
|
22781
22781
|
}
|
|
22782
|
+
async function createDevice(e) {
|
|
22783
|
+
if (!Authentication.token)
|
|
22784
|
+
throw new Error("Not authenticated");
|
|
22785
|
+
return await (await fetch(`${FORMANT_API_URL}/v1/admin/devices`, {
|
|
22786
|
+
method: "POST",
|
|
22787
|
+
body: JSON.stringify(e),
|
|
22788
|
+
headers: {
|
|
22789
|
+
"Content-Type": "application/json",
|
|
22790
|
+
Authorization: "Bearer " + Authentication.token
|
|
22791
|
+
}
|
|
22792
|
+
})).json();
|
|
22793
|
+
}
|
|
22794
|
+
async function patchDevice(e, t) {
|
|
22795
|
+
if (!Authentication.token)
|
|
22796
|
+
throw new Error("Not authenticated");
|
|
22797
|
+
return await (await fetch(`${FORMANT_API_URL}/v1/admin/devices/${e}`, {
|
|
22798
|
+
method: "PATCH",
|
|
22799
|
+
body: JSON.stringify(t),
|
|
22800
|
+
headers: {
|
|
22801
|
+
"Content-Type": "application/json",
|
|
22802
|
+
Authorization: "Bearer " + Authentication.token
|
|
22803
|
+
}
|
|
22804
|
+
})).json();
|
|
22805
|
+
}
|
|
22806
|
+
async function getDevicesData() {
|
|
22807
|
+
if (!Authentication.token)
|
|
22808
|
+
throw new Error("Not authenticated");
|
|
22809
|
+
return (await (await fetch(`${FORMANT_API_URL}/v1/admin/device-details/query`, {
|
|
22810
|
+
method: "POST",
|
|
22811
|
+
body: JSON.stringify({ enabled: !0, type: "default" }),
|
|
22812
|
+
headers: {
|
|
22813
|
+
"Content-Type": "application/json",
|
|
22814
|
+
Authorization: "Bearer " + Authentication.token
|
|
22815
|
+
}
|
|
22816
|
+
})).json()).items;
|
|
22817
|
+
}
|
|
22818
|
+
async function queryDevicesData(e) {
|
|
22819
|
+
if (!Authentication.token)
|
|
22820
|
+
throw new Error("Not authenticated");
|
|
22821
|
+
return (await (await fetch(`${FORMANT_API_URL}/v1/admin/devices/query`, {
|
|
22822
|
+
method: "POST",
|
|
22823
|
+
body: JSON.stringify(e),
|
|
22824
|
+
headers: {
|
|
22825
|
+
"Content-Type": "application/json",
|
|
22826
|
+
Authorization: "Bearer " + Authentication.token
|
|
22827
|
+
}
|
|
22828
|
+
})).json()).items;
|
|
22829
|
+
}
|
|
22782
22830
|
class Device extends BaseDevice {
|
|
22783
22831
|
constructor(t, n, r, o) {
|
|
22784
22832
|
super(), this.id = t, this.name = n, this.organizationId = r, this.tags = o;
|
|
@@ -23106,31 +23154,8 @@ class Device extends BaseDevice {
|
|
|
23106
23154
|
async createShareLink(t, n) {
|
|
23107
23155
|
return t.scope.deviceIds = [this.id], await createShareLink(t, n);
|
|
23108
23156
|
}
|
|
23109
|
-
async createDevice(t) {
|
|
23110
|
-
if (!Authentication.token)
|
|
23111
|
-
throw new Error("Not authenticated");
|
|
23112
|
-
return await (await fetch(`${FORMANT_API_URL}/v1/admin/devices`, {
|
|
23113
|
-
method: "POST",
|
|
23114
|
-
body: JSON.stringify(t),
|
|
23115
|
-
headers: {
|
|
23116
|
-
"Content-Type": "application/json",
|
|
23117
|
-
Authorization: "Bearer " + Authentication.token
|
|
23118
|
-
}
|
|
23119
|
-
})).json();
|
|
23120
|
-
}
|
|
23121
|
-
async patchDevice(t, n) {
|
|
23122
|
-
if (!Authentication.token)
|
|
23123
|
-
throw new Error("Not authenticated");
|
|
23124
|
-
return await (await fetch(`${FORMANT_API_URL}/v1/admin/devices/${t}`, {
|
|
23125
|
-
method: "PATCH",
|
|
23126
|
-
body: JSON.stringify(n),
|
|
23127
|
-
headers: {
|
|
23128
|
-
"Content-Type": "application/json",
|
|
23129
|
-
Authorization: "Bearer " + Authentication.token
|
|
23130
|
-
}
|
|
23131
|
-
})).json();
|
|
23132
|
-
}
|
|
23133
23157
|
}
|
|
23158
|
+
be(Device, "createDevice", createDevice), be(Device, "patchDevice", patchDevice), be(Device, "getDevicesData", getDevicesData), be(Device, "queryDevicesData", queryDevicesData);
|
|
23134
23159
|
class PeerDevice extends BaseDevice {
|
|
23135
23160
|
constructor(n) {
|
|
23136
23161
|
super();
|