@space-df/sdk 0.0.1-dev.3.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/LICENSE +7 -0
- package/README.md +382 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +72 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +89 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +89 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +82 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +237 -0
- package/core.d.ts.map +1 -0
- package/core.js +855 -0
- package/core.js.map +1 -0
- package/core.mjs +829 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +53 -0
- package/error.d.ts.map +1 -0
- package/error.js +143 -0
- package/error.js.map +1 -0
- package/error.mjs +127 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +123 -0
- package/index.d.ts +123 -0
- package/index.d.ts.map +1 -0
- package/index.js +123 -0
- package/index.js.map +1 -0
- package/index.mjs +95 -0
- package/index.mjs.map +1 -0
- package/libs/utils.d.ts +34 -0
- package/libs/utils.d.ts.map +1 -0
- package/libs/utils.js +67 -0
- package/libs/utils.js.map +1 -0
- package/libs/utils.mjs +59 -0
- package/libs/utils.mjs.map +1 -0
- package/package.json +101 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +10 -0
- package/resource.js.map +1 -0
- package/resource.mjs +6 -0
- package/resource.mjs.map +1 -0
- package/resources/auth/auth.d.ts +51 -0
- package/resources/auth/auth.d.ts.map +1 -0
- package/resources/auth/auth.js +26 -0
- package/resources/auth/auth.js.map +1 -0
- package/resources/auth/auth.mjs +22 -0
- package/resources/auth/auth.mjs.map +1 -0
- package/resources/auth/credentials.d.ts +9 -0
- package/resources/auth/credentials.d.ts.map +1 -0
- package/resources/auth/credentials.js +11 -0
- package/resources/auth/credentials.js.map +1 -0
- package/resources/auth/credentials.mjs +7 -0
- package/resources/auth/credentials.mjs.map +1 -0
- package/resources/auth/index.d.ts +7 -0
- package/resources/auth/index.d.ts.map +1 -0
- package/resources/auth/index.js +23 -0
- package/resources/auth/index.js.map +1 -0
- package/resources/auth/index.mjs +7 -0
- package/resources/auth/index.mjs.map +1 -0
- package/resources/auth/space-policies.d.ts +20 -0
- package/resources/auth/space-policies.d.ts.map +1 -0
- package/resources/auth/space-policies.js +18 -0
- package/resources/auth/space-policies.js.map +1 -0
- package/resources/auth/space-policies.mjs +14 -0
- package/resources/auth/space-policies.mjs.map +1 -0
- package/resources/auth/space-role-users.d.ts +17 -0
- package/resources/auth/space-role-users.d.ts.map +1 -0
- package/resources/auth/space-role-users.js +28 -0
- package/resources/auth/space-role-users.js.map +1 -0
- package/resources/auth/space-role-users.mjs +24 -0
- package/resources/auth/space-role-users.mjs.map +1 -0
- package/resources/auth/space-roles.d.ts +41 -0
- package/resources/auth/space-roles.d.ts.map +1 -0
- package/resources/auth/space-roles.js +52 -0
- package/resources/auth/space-roles.js.map +1 -0
- package/resources/auth/space-roles.mjs +48 -0
- package/resources/auth/space-roles.mjs.map +1 -0
- package/resources/auth/spaces.d.ts +61 -0
- package/resources/auth/spaces.d.ts.map +1 -0
- package/resources/auth/spaces.js +45 -0
- package/resources/auth/spaces.js.map +1 -0
- package/resources/auth/spaces.mjs +41 -0
- package/resources/auth/spaces.mjs.map +1 -0
- package/resources/console/index.d.ts +2 -0
- package/resources/console/index.d.ts.map +1 -0
- package/resources/console/index.js +18 -0
- package/resources/console/index.js.map +1 -0
- package/resources/console/index.mjs +2 -0
- package/resources/console/index.mjs.map +1 -0
- package/resources/console/oauth2.d.ts +53 -0
- package/resources/console/oauth2.d.ts.map +1 -0
- package/resources/console/oauth2.js +20 -0
- package/resources/console/oauth2.js.map +1 -0
- package/resources/console/oauth2.mjs +16 -0
- package/resources/console/oauth2.mjs.map +1 -0
- package/resources/dashboard/dashboards.d.ts +67 -0
- package/resources/dashboard/dashboards.d.ts.map +1 -0
- package/resources/dashboard/dashboards.js +96 -0
- package/resources/dashboard/dashboards.js.map +1 -0
- package/resources/dashboard/dashboards.mjs +92 -0
- package/resources/dashboard/dashboards.mjs.map +1 -0
- package/resources/dashboard/device-states.d.ts +69 -0
- package/resources/dashboard/device-states.d.ts.map +1 -0
- package/resources/dashboard/device-states.js +40 -0
- package/resources/dashboard/device-states.js.map +1 -0
- package/resources/dashboard/device-states.mjs +36 -0
- package/resources/dashboard/device-states.mjs.map +1 -0
- package/resources/dashboard/index.d.ts +3 -0
- package/resources/dashboard/index.d.ts.map +1 -0
- package/resources/dashboard/index.js +19 -0
- package/resources/dashboard/index.js.map +1 -0
- package/resources/dashboard/index.mjs +3 -0
- package/resources/dashboard/index.mjs.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +23 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +4 -0
- package/resources/index.mjs.map +1 -0
- package/shims/node.d.ts +30 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +72 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +78 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +60 -0
- package/src/_shims/web-runtime.ts +91 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1061 -0
- package/src/error.ts +134 -0
- package/src/index.ts +206 -0
- package/src/libs/utils.ts +66 -0
- package/src/resource.ts +9 -0
- package/src/resources/auth/auth.ts +92 -0
- package/src/resources/auth/credentials.ts +12 -0
- package/src/resources/auth/index.ts +6 -0
- package/src/resources/auth/space-policies.ts +55 -0
- package/src/resources/auth/space-role-users.ts +42 -0
- package/src/resources/auth/space-roles.ts +95 -0
- package/src/resources/auth/spaces.ts +118 -0
- package/src/resources/console/index.ts +1 -0
- package/src/resources/console/oauth2.ts +83 -0
- package/src/resources/dashboard/dashboards.ts +171 -0
- package/src/resources/dashboard/device-states.ts +142 -0
- package/src/resources/dashboard/index.ts +2 -0
- package/src/resources/index.ts +6 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/types/api.ts +31 -0
- package/src/types/jwt.ts +12 -0
- package/src/version.ts +1 -0
- package/types/api.d.ts +25 -0
- package/types/api.d.ts.map +1 -0
- package/types/api.js +3 -0
- package/types/api.js.map +1 -0
- package/types/api.mjs +2 -0
- package/types/api.mjs.map +1 -0
- package/types/jwt.d.ts +13 -0
- package/types/jwt.d.ts.map +1 -0
- package/types/jwt.js +3 -0
- package/types/jwt.js.map +1 -0
- package/types/jwt.mjs +2 -0
- package/types/jwt.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { APIResource } from '../../resource';
|
|
2
|
+
import { ListParamsResponse, ListResponse } from '../../types/api';
|
|
3
|
+
import * as Core from '../../core';
|
|
4
|
+
|
|
5
|
+
export class SpaceRoles extends APIResource {
|
|
6
|
+
create(params: SpaceRoleCreateParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRole> {
|
|
7
|
+
const { ...body } = params;
|
|
8
|
+
return this._client.post(`/space-roles`, {
|
|
9
|
+
body,
|
|
10
|
+
...options,
|
|
11
|
+
headers: { ...options?.headers },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
retrieve(id: number, options?: Core.RequestOptions): Core.APIPromise<SpaceRole> {
|
|
16
|
+
return this._client.get(`/space-roles/${id}`, {
|
|
17
|
+
...options,
|
|
18
|
+
headers: { ...options?.headers },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
update(id: number, params: SpaceRoleUpdateParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRole> {
|
|
23
|
+
const { ...body } = params;
|
|
24
|
+
return this._client.put(`/space-roles/${id}`, {
|
|
25
|
+
body,
|
|
26
|
+
...options,
|
|
27
|
+
headers: { ...options?.headers },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
partialUpdate(id: number, params: SpaceRoleUpdateParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRole> {
|
|
32
|
+
const { ...body } = params;
|
|
33
|
+
return this._client.patch(`/space-roles/${id}`, {
|
|
34
|
+
body,
|
|
35
|
+
...options,
|
|
36
|
+
headers: { ...options?.headers },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<SpaceRoleListResponse> {
|
|
41
|
+
const { ...query } = params;
|
|
42
|
+
return this._client.get(`/space-roles`, {
|
|
43
|
+
query,
|
|
44
|
+
...options,
|
|
45
|
+
headers: { ...options?.headers },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
delete(id: number, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
50
|
+
return this._client.delete(`/space-roles/${id}`, {
|
|
51
|
+
...options,
|
|
52
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface SpaceRole {
|
|
58
|
+
name: string;
|
|
59
|
+
|
|
60
|
+
policies: Array<number>;
|
|
61
|
+
|
|
62
|
+
id?: number;
|
|
63
|
+
|
|
64
|
+
readonly created_at?: string;
|
|
65
|
+
|
|
66
|
+
space?: number;
|
|
67
|
+
|
|
68
|
+
updated_at?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type SpaceRoleListResponse = ListResponse<SpaceRole>;
|
|
72
|
+
|
|
73
|
+
export interface SpaceRoleCreateParams {
|
|
74
|
+
/**
|
|
75
|
+
* Body param:
|
|
76
|
+
*/
|
|
77
|
+
name: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Body param:
|
|
81
|
+
*/
|
|
82
|
+
policies: Array<number>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface SpaceRoleUpdateParams {
|
|
86
|
+
/**
|
|
87
|
+
* Body param:
|
|
88
|
+
*/
|
|
89
|
+
name: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Body param:
|
|
93
|
+
*/
|
|
94
|
+
policies: Array<number>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { APIResource } from '../../resource';
|
|
2
|
+
import { isRequestOptions } from '../../core';
|
|
3
|
+
import { ListParamsResponse, ListResponse } from '../../types/api';
|
|
4
|
+
import * as Core from '../../core';
|
|
5
|
+
|
|
6
|
+
export class Spaces extends APIResource {
|
|
7
|
+
create(body: SpaceCreateParams, options?: Core.RequestOptions): Core.APIPromise<Space> {
|
|
8
|
+
return this._client.post(`/spaces`, { body, ...options });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
update(params: SpaceUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Space> {
|
|
12
|
+
const { ...body } = params;
|
|
13
|
+
return this._client.put(`/spaces`, {
|
|
14
|
+
body,
|
|
15
|
+
...options,
|
|
16
|
+
headers: { ...options?.headers },
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
partialUpdate(params: SpaceUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Space> {
|
|
21
|
+
const { ...body } = params;
|
|
22
|
+
return this._client.patch(`/spaces`, {
|
|
23
|
+
body,
|
|
24
|
+
...options,
|
|
25
|
+
headers: { ...options?.headers },
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
list(params?: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<SpaceListResponse>;
|
|
30
|
+
list(options?: Core.RequestOptions): Core.APIPromise<SpaceListResponse>;
|
|
31
|
+
list(params: ListParamsResponse | Core.RequestOptions = {}, options?: Core.RequestOptions): Core.APIPromise<SpaceListResponse> {
|
|
32
|
+
if (isRequestOptions(params)) {
|
|
33
|
+
return this.list({}, params);
|
|
34
|
+
}
|
|
35
|
+
const { ...query } = params;
|
|
36
|
+
return this._client.get(`/spaces`, {
|
|
37
|
+
query,
|
|
38
|
+
...options,
|
|
39
|
+
headers: { ...options?.headers },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
delete(options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
44
|
+
return this._client.delete(`/spaces`, {
|
|
45
|
+
...options,
|
|
46
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface Space {
|
|
52
|
+
logo: string;
|
|
53
|
+
|
|
54
|
+
name: string;
|
|
55
|
+
|
|
56
|
+
slug_name: string;
|
|
57
|
+
|
|
58
|
+
id?: number;
|
|
59
|
+
|
|
60
|
+
created_by?: number | null;
|
|
61
|
+
|
|
62
|
+
is_active?: boolean;
|
|
63
|
+
|
|
64
|
+
total_devices: number;
|
|
65
|
+
|
|
66
|
+
readonly created_at?: string;
|
|
67
|
+
|
|
68
|
+
readonly updated_at?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type SpaceListResponse = ListResponse<Space>;
|
|
72
|
+
|
|
73
|
+
export interface SpaceCreateParams {
|
|
74
|
+
logo: string;
|
|
75
|
+
|
|
76
|
+
name: string;
|
|
77
|
+
|
|
78
|
+
slug_name: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface SpaceUpdateParams {
|
|
82
|
+
/**
|
|
83
|
+
* Body param:
|
|
84
|
+
*/
|
|
85
|
+
logo: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Body param:
|
|
89
|
+
*/
|
|
90
|
+
name: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Body param:
|
|
94
|
+
*/
|
|
95
|
+
slug_name: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface SpaceUpdateParams {
|
|
99
|
+
/**
|
|
100
|
+
* Body param:
|
|
101
|
+
*/
|
|
102
|
+
logo: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Body param:
|
|
106
|
+
*/
|
|
107
|
+
name: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Body param:
|
|
111
|
+
*/
|
|
112
|
+
slug_name: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Body param:
|
|
116
|
+
*/
|
|
117
|
+
is_active?: boolean;
|
|
118
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './oauth2';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { APIResource } from '../../resource';
|
|
2
|
+
import * as Core from '../../core';
|
|
3
|
+
import { rstripBase64, toBase64, toSHA256, uuid4 } from '../../libs/utils';
|
|
4
|
+
|
|
5
|
+
export class OAuth2 extends APIResource {
|
|
6
|
+
async authorize(body: OAuth2AuthorizeParams, options?: Core.RequestOptions): Promise<OAuth2Authorize> {
|
|
7
|
+
const verifier = rstripBase64(toBase64(uuid4()));
|
|
8
|
+
const codeChallenge = rstripBase64(toBase64(await toSHA256(verifier)));
|
|
9
|
+
|
|
10
|
+
const oAuth2AuthorizeBody: OAuth2Authorize = {
|
|
11
|
+
...body,
|
|
12
|
+
response_type: 'code',
|
|
13
|
+
code_challenge: codeChallenge,
|
|
14
|
+
code_challenge_method: 'S256',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
this._client.post(`/auth/login`, { body: oAuth2AuthorizeBody, ...options }) as Core.APIPromise<{
|
|
19
|
+
data: OAuth2Authorize;
|
|
20
|
+
}>
|
|
21
|
+
)._thenUnwrap((obj) => ({ ...obj.data, verifier }));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type OAuth2AuthorizeParams = Pick<OAuth2Authorize, 'client_id' | 'redirect_uri' | 'scopes'>;
|
|
26
|
+
|
|
27
|
+
export interface OAuth2Authorize {
|
|
28
|
+
/**
|
|
29
|
+
* Response type
|
|
30
|
+
*/
|
|
31
|
+
response_type: 'code';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Code challenge, require min length > 1
|
|
35
|
+
*/
|
|
36
|
+
code_challenge: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Code challenge method
|
|
40
|
+
*/
|
|
41
|
+
code_challenge_method: 'plain' | 'S256';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Client id
|
|
45
|
+
*/
|
|
46
|
+
client_id: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Redirect uri
|
|
50
|
+
*/
|
|
51
|
+
redirect_uri: string;
|
|
52
|
+
|
|
53
|
+
scopes: Array<'organization'>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface OAuth2Token {
|
|
57
|
+
/**
|
|
58
|
+
* Client id
|
|
59
|
+
*/
|
|
60
|
+
client_id: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Client secret
|
|
64
|
+
*/
|
|
65
|
+
client_secret: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Code
|
|
69
|
+
*/
|
|
70
|
+
code: string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Code verifier
|
|
74
|
+
*/
|
|
75
|
+
code_verifier: string;
|
|
76
|
+
|
|
77
|
+
readonly scopes?: Array<'organization'>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Id token
|
|
81
|
+
*/
|
|
82
|
+
readonly id_token?: string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { APIResource } from '../../resource';
|
|
2
|
+
import * as Core from '../../core';
|
|
3
|
+
import { ListParamsResponse, ListResponse } from '../../types/api';
|
|
4
|
+
|
|
5
|
+
export class Dashboards extends APIResource {
|
|
6
|
+
create(params: DashboardCreateParams, options?: Core.RequestOptions): Core.APIPromise<Dashboard> {
|
|
7
|
+
const { ...body } = params;
|
|
8
|
+
return this._client.post(`/dashboards`, {
|
|
9
|
+
body,
|
|
10
|
+
...options,
|
|
11
|
+
headers: { ...options?.headers },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
retrieve(id: number, options?: Core.RequestOptions): Core.APIPromise<Dashboard> {
|
|
16
|
+
return this._client.get(`/dashboards/${id}`, {
|
|
17
|
+
...options,
|
|
18
|
+
headers: { ...options?.headers },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
update(id: number, params: DashboardUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Dashboard> {
|
|
23
|
+
const { ...body } = params;
|
|
24
|
+
return this._client.put(`/dashboards/${id}`, {
|
|
25
|
+
body,
|
|
26
|
+
...options,
|
|
27
|
+
headers: { ...options?.headers },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
partialUpdate(id: number, params: DashboardUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Dashboard> {
|
|
32
|
+
const { ...body } = params;
|
|
33
|
+
return this._client.patch(`/dashboards/${id}`, {
|
|
34
|
+
body,
|
|
35
|
+
...options,
|
|
36
|
+
headers: { ...options?.headers },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<DashboardListResponse> {
|
|
41
|
+
const { ...query } = params;
|
|
42
|
+
return this._client.get(`/dashboards`, {
|
|
43
|
+
query,
|
|
44
|
+
...options,
|
|
45
|
+
headers: { ...options?.headers },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
delete(id: number, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
50
|
+
return this._client.delete(`/dashboards/${id}`, {
|
|
51
|
+
...options,
|
|
52
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
createWidget(dashboardId: string, params: WidgetCreateParams, options?: Core.RequestOptions): Core.APIPromise<Widget> {
|
|
57
|
+
const { ...body } = params;
|
|
58
|
+
return this._client.post(`/dashboards/${dashboardId}/widgets`, {
|
|
59
|
+
body,
|
|
60
|
+
...options,
|
|
61
|
+
headers: { ...options?.headers },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
retrieveWidget(dashboardId: string, id: number, options?: Core.RequestOptions): Core.APIPromise<Widget> {
|
|
66
|
+
return this._client.get(`/dashboards/${dashboardId}/widgets/${id}`, {
|
|
67
|
+
...options,
|
|
68
|
+
headers: { ...options?.headers },
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
updateWidget(dashboardId: string, id: number, params: WidgetUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Widget> {
|
|
73
|
+
const { ...body } = params;
|
|
74
|
+
return this._client.put(`/dashboards/${dashboardId}/widgets/${id}`, {
|
|
75
|
+
body,
|
|
76
|
+
...options,
|
|
77
|
+
headers: { ...options?.headers },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
partialUpdateWidget(dashboardId: string, id: number, params: WidgetUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Widget> {
|
|
82
|
+
const { ...body } = params;
|
|
83
|
+
return this._client.patch(`/dashboards/${dashboardId}/widgets/${id}`, {
|
|
84
|
+
body,
|
|
85
|
+
...options,
|
|
86
|
+
headers: { ...options?.headers },
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
listWidgets(dashboardId: string, params: WidgetListParams, options?: Core.RequestOptions): Core.APIPromise<WidgetListResponse> {
|
|
91
|
+
const { ...query } = params;
|
|
92
|
+
return this._client.get(`/dashboards/${dashboardId}/widgets`, {
|
|
93
|
+
query,
|
|
94
|
+
...options,
|
|
95
|
+
headers: { ...options?.headers },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
deleteWidget(dashboardId: string, id: number, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
100
|
+
return this._client.delete(`/dashboards/${dashboardId}/widgets/${id}`, {
|
|
101
|
+
...options,
|
|
102
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface Dashboard {
|
|
108
|
+
name: string;
|
|
109
|
+
|
|
110
|
+
id?: number;
|
|
111
|
+
|
|
112
|
+
space?: number;
|
|
113
|
+
|
|
114
|
+
readonly created_at?: string;
|
|
115
|
+
|
|
116
|
+
readonly updated_at?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type DashboardListResponse = ListResponse<Dashboard>;
|
|
120
|
+
|
|
121
|
+
export interface DashboardCreateParams {
|
|
122
|
+
/**
|
|
123
|
+
* Body param:
|
|
124
|
+
*/
|
|
125
|
+
name: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface DashboardUpdateParams {
|
|
129
|
+
/**
|
|
130
|
+
* Body param:
|
|
131
|
+
*/
|
|
132
|
+
name: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** ------------------------------------
|
|
136
|
+
* Widget type
|
|
137
|
+
---------------------------------------*/
|
|
138
|
+
export interface Widget {
|
|
139
|
+
readonly id?: number;
|
|
140
|
+
|
|
141
|
+
configuration: any;
|
|
142
|
+
|
|
143
|
+
readonly dashboard?: number;
|
|
144
|
+
|
|
145
|
+
readonly created_at?: string;
|
|
146
|
+
|
|
147
|
+
readonly updated_at?: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export type WidgetListResponse = Array<Widget>;
|
|
151
|
+
|
|
152
|
+
export interface WidgetCreateParams {
|
|
153
|
+
/**
|
|
154
|
+
* Body param:
|
|
155
|
+
*/
|
|
156
|
+
configuration: any;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface WidgetUpdateParams {
|
|
160
|
+
/**
|
|
161
|
+
* Body param:
|
|
162
|
+
*/
|
|
163
|
+
configuration: any;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface WidgetListParams {
|
|
167
|
+
/**
|
|
168
|
+
* Query param: Which field to use when ordering the results.
|
|
169
|
+
*/
|
|
170
|
+
ordering?: string;
|
|
171
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { APIResource } from '../../resource';
|
|
2
|
+
import { ListParamsResponse, ListResponse } from '../../types/api';
|
|
3
|
+
import * as Core from '../../core';
|
|
4
|
+
|
|
5
|
+
export class DeviceStates extends APIResource {
|
|
6
|
+
retrieveDaily(params: DailyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<DailyRetrieveResponse> {
|
|
7
|
+
const { ...query } = params;
|
|
8
|
+
return this._client.get(`/device-states/daily`, {
|
|
9
|
+
query,
|
|
10
|
+
...options,
|
|
11
|
+
headers: { ...options?.headers },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
retrieveHourly(params: HourlyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<HourlyRetrieveResponse> {
|
|
16
|
+
const { ...query } = params;
|
|
17
|
+
return this._client.get(`/device-states/hourly`, {
|
|
18
|
+
query,
|
|
19
|
+
...options,
|
|
20
|
+
headers: { ...options?.headers },
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
retrieveMinutely(params: MinutelyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<MinutelyRetrieveResponse> {
|
|
25
|
+
const { ...query } = params;
|
|
26
|
+
return this._client.get(`/device-states/minutely`, {
|
|
27
|
+
query,
|
|
28
|
+
...options,
|
|
29
|
+
headers: { ...options?.headers },
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
retrieveMonthly(params: MonthlyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<MonthlyRetrieveResponse> {
|
|
34
|
+
const { ...query } = params;
|
|
35
|
+
return this._client.get(`/device-states/monthly`, {
|
|
36
|
+
query,
|
|
37
|
+
...options,
|
|
38
|
+
headers: { ...options?.headers },
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type DeviceStateListResponse<T> = ListResponse<T>;
|
|
44
|
+
|
|
45
|
+
export interface DeviceStateListParams extends Omit<ListParamsResponse, 'search'> {
|
|
46
|
+
/**
|
|
47
|
+
* Query param: device_slug_name
|
|
48
|
+
*/
|
|
49
|
+
device_slug_name?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Query param: state_name
|
|
53
|
+
*/
|
|
54
|
+
state_name?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type DailyRetrieveResponse = DeviceStateListResponse<DailyRetrieveResult>;
|
|
58
|
+
|
|
59
|
+
export interface DailyRetrieveResult {
|
|
60
|
+
device_slug_name: string;
|
|
61
|
+
|
|
62
|
+
from_timestamp: string;
|
|
63
|
+
|
|
64
|
+
space: number;
|
|
65
|
+
|
|
66
|
+
state_name: string;
|
|
67
|
+
|
|
68
|
+
value: string;
|
|
69
|
+
|
|
70
|
+
id?: number;
|
|
71
|
+
|
|
72
|
+
readonly created_at?: string;
|
|
73
|
+
|
|
74
|
+
readonly updated_at?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type DailyRetrieveParams = DeviceStateListParams;
|
|
78
|
+
|
|
79
|
+
export type MinutelyRetrieveResponse = ListResponse<MinutelyRetrieveResult>;
|
|
80
|
+
|
|
81
|
+
export interface MinutelyRetrieveResult {
|
|
82
|
+
device_slug_name: string;
|
|
83
|
+
|
|
84
|
+
from_timestamp: string;
|
|
85
|
+
|
|
86
|
+
space: number;
|
|
87
|
+
|
|
88
|
+
state_name: string;
|
|
89
|
+
|
|
90
|
+
value: string;
|
|
91
|
+
|
|
92
|
+
id?: number;
|
|
93
|
+
|
|
94
|
+
readonly created_at?: string;
|
|
95
|
+
|
|
96
|
+
readonly updated_at?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type MinutelyRetrieveParams = DeviceStateListParams;
|
|
100
|
+
|
|
101
|
+
export type MonthlyRetrieveResponse = ListResponse<MonthlyRetrieveResult>;
|
|
102
|
+
|
|
103
|
+
export interface MonthlyRetrieveResult {
|
|
104
|
+
device_slug_name: string;
|
|
105
|
+
|
|
106
|
+
from_timestamp: string;
|
|
107
|
+
|
|
108
|
+
space: number;
|
|
109
|
+
|
|
110
|
+
state_name: string;
|
|
111
|
+
|
|
112
|
+
value: string;
|
|
113
|
+
|
|
114
|
+
id?: number;
|
|
115
|
+
|
|
116
|
+
readonly created_at?: string;
|
|
117
|
+
|
|
118
|
+
readonly updated_at?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type MonthlyRetrieveParams = DeviceStateListParams;
|
|
122
|
+
|
|
123
|
+
export type HourlyRetrieveResponse = ListResponse<HourlyRetrieveResult>;
|
|
124
|
+
export interface HourlyRetrieveResult {
|
|
125
|
+
device_slug_name: string;
|
|
126
|
+
|
|
127
|
+
from_timestamp: string;
|
|
128
|
+
|
|
129
|
+
space: number;
|
|
130
|
+
|
|
131
|
+
state_name: string;
|
|
132
|
+
|
|
133
|
+
value: string;
|
|
134
|
+
|
|
135
|
+
id?: number;
|
|
136
|
+
|
|
137
|
+
readonly created_at?: string;
|
|
138
|
+
|
|
139
|
+
readonly updated_at?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export type HourlyRetrieveParams = DeviceStateListParams;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as types from '../_shims/node-types';
|
|
3
|
+
import { setShims } from '../_shims/registry';
|
|
4
|
+
import { getRuntime } from '../_shims/node-runtime';
|
|
5
|
+
setShims(getRuntime());
|
|
6
|
+
|
|
7
|
+
declare module '../_shims/manual-types' {
|
|
8
|
+
export namespace manual {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
export type Agent = types.Agent;
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
export import fetch = types.fetch;
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
export type Request = types.Request;
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
export type RequestInfo = types.RequestInfo;
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
export type RequestInit = types.RequestInit;
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
export type Response = types.Response;
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
export type ResponseInit = types.ResponseInit;
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
export type ResponseType = types.ResponseType;
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
export type BodyInit = types.BodyInit;
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
export type Headers = types.Headers;
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
export type HeadersInit = types.HeadersInit;
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
export type BlobPropertyBag = types.BlobPropertyBag;
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
export type FilePropertyBag = types.FilePropertyBag;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
export type FileFromPathOptions = types.FileFromPathOptions;
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
export import FormData = types.FormData;
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
export import File = types.File;
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
export import Blob = types.Blob;
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
export type Readable = types.Readable;
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
export type FsReadStream = types.FsReadStream;
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
export import ReadableStream = types.ReadableStream;
|
|
49
|
+
}
|
|
50
|
+
}
|