@seamapi/http 0.0.2 → 0.2.0
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/connect.cjs +1807 -96
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +472 -15
- package/lib/params-serializer.d.ts +5 -0
- package/lib/params-serializer.js +42 -0
- package/lib/params-serializer.js.map +1 -0
- package/lib/seam/connect/auth.d.ts +4 -3
- package/lib/seam/connect/auth.js +59 -8
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/client.d.ts +10 -10
- package/lib/seam/connect/client.js +16 -49
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/index.d.ts +2 -1
- package/lib/seam/connect/index.js +2 -1
- package/lib/seam/connect/index.js.map +1 -1
- package/lib/seam/connect/options.d.ts +23 -0
- package/lib/seam/connect/options.js +39 -0
- package/lib/seam/connect/options.js.map +1 -0
- package/lib/seam/connect/parse-options.d.ts +6 -2
- package/lib/seam/connect/parse-options.js +35 -10
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +27 -0
- package/lib/seam/connect/routes/access-codes-unmanaged.js +84 -0
- package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -0
- package/lib/seam/connect/routes/access-codes.d.ts +38 -0
- package/lib/seam/connect/routes/access-codes.js +113 -0
- package/lib/seam/connect/routes/access-codes.js.map +1 -0
- package/lib/seam/connect/routes/acs-access-groups.d.ts +36 -0
- package/lib/seam/connect/routes/acs-access-groups.js +107 -0
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -0
- package/lib/seam/connect/routes/acs-credentials.d.ts +24 -0
- package/lib/seam/connect/routes/acs-credentials.js +78 -0
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -0
- package/lib/seam/connect/routes/acs-systems.d.ts +18 -0
- package/lib/seam/connect/routes/acs-systems.js +63 -0
- package/lib/seam/connect/routes/acs-systems.js.map +1 -0
- package/lib/seam/connect/routes/acs-users.d.ts +39 -0
- package/lib/seam/connect/routes/acs-users.js +113 -0
- package/lib/seam/connect/routes/acs-users.js.map +1 -0
- package/lib/seam/connect/routes/acs.d.ts +18 -0
- package/lib/seam/connect/routes/acs.js +63 -0
- package/lib/seam/connect/routes/acs.js.map +1 -0
- package/lib/seam/connect/routes/action-attempts.d.ts +18 -0
- package/lib/seam/connect/routes/action-attempts.js +63 -0
- package/lib/seam/connect/routes/action-attempts.js.map +1 -0
- package/lib/seam/connect/routes/client-sessions.d.ts +30 -0
- package/lib/seam/connect/routes/client-sessions.js +93 -0
- package/lib/seam/connect/routes/client-sessions.js.map +1 -0
- package/lib/seam/connect/routes/connect-webviews.d.ts +27 -0
- package/lib/seam/connect/routes/connect-webviews.js +85 -0
- package/lib/seam/connect/routes/connect-webviews.js.map +1 -0
- package/lib/seam/connect/routes/connected-accounts.d.ts +21 -0
- package/lib/seam/connect/routes/connected-accounts.js +70 -0
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -0
- package/lib/seam/connect/routes/devices-unmanaged.d.ts +21 -0
- package/lib/seam/connect/routes/devices-unmanaged.js +70 -0
- package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -0
- package/lib/seam/connect/routes/devices.d.ts +29 -0
- package/lib/seam/connect/routes/devices.js +89 -0
- package/lib/seam/connect/routes/devices.js.map +1 -0
- package/lib/seam/connect/routes/events.d.ts +18 -0
- package/lib/seam/connect/routes/events.js +63 -0
- package/lib/seam/connect/routes/events.js.map +1 -0
- package/lib/seam/connect/routes/index.d.ts +21 -0
- package/lib/seam/connect/routes/index.js +22 -0
- package/lib/seam/connect/routes/index.js.map +1 -0
- package/lib/seam/connect/routes/locks.d.ts +24 -0
- package/lib/seam/connect/routes/locks.js +79 -0
- package/lib/seam/connect/routes/locks.js.map +1 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +27 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +84 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -0
- package/lib/seam/connect/routes/noise-sensors.d.ts +12 -0
- package/lib/seam/connect/routes/noise-sensors.js +51 -0
- package/lib/seam/connect/routes/noise-sensors.js.map +1 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +27 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +85 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -0
- package/lib/seam/connect/routes/thermostats.d.ts +38 -0
- package/lib/seam/connect/routes/thermostats.js +109 -0
- package/lib/seam/connect/routes/thermostats.js.map +1 -0
- package/lib/seam/connect/routes/webhooks.d.ts +24 -0
- package/lib/seam/connect/routes/webhooks.js +78 -0
- package/lib/seam/connect/routes/webhooks.js.map +1 -0
- package/lib/seam/connect/routes/workspaces.d.ts +17 -7
- package/lib/seam/connect/routes/workspaces.js +61 -11
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/seam/connect/seam-http.d.ts +24 -0
- package/lib/seam/connect/seam-http.js +82 -0
- package/lib/seam/connect/seam-http.js.map +1 -0
- package/package.json +9 -3
- package/src/lib/params-serializer.ts +55 -0
- package/src/lib/seam/connect/auth.ts +101 -13
- package/src/lib/seam/connect/client.ts +30 -62
- package/src/lib/seam/connect/env.d.ts +11 -0
- package/src/lib/seam/connect/index.ts +2 -1
- package/src/lib/seam/connect/{client-options.ts → options.ts} +37 -15
- package/src/lib/seam/connect/parse-options.ts +55 -14
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +170 -0
- package/src/lib/seam/connect/routes/access-codes.ts +226 -0
- package/src/lib/seam/connect/routes/acs-access-groups.ts +216 -0
- package/src/lib/seam/connect/routes/acs-credentials.ts +151 -0
- package/src/lib/seam/connect/routes/acs-systems.ts +118 -0
- package/src/lib/seam/connect/routes/acs-users.ts +221 -0
- package/src/lib/seam/connect/routes/acs.ts +101 -0
- package/src/lib/seam/connect/routes/action-attempts.ts +118 -0
- package/src/lib/seam/connect/routes/client-sessions.ts +187 -0
- package/src/lib/seam/connect/routes/connect-webviews.ts +170 -0
- package/src/lib/seam/connect/routes/connected-accounts.ts +139 -0
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +134 -0
- package/src/lib/seam/connect/routes/devices.ts +166 -0
- package/src/lib/seam/connect/routes/events.ts +114 -0
- package/src/lib/seam/connect/routes/index.ts +21 -0
- package/src/lib/seam/connect/routes/locks.ts +148 -0
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +170 -0
- package/src/lib/seam/connect/routes/noise-sensors.ts +86 -0
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +192 -0
- package/src/lib/seam/connect/routes/thermostats.ts +208 -0
- package/src/lib/seam/connect/routes/webhooks.ts +151 -0
- package/src/lib/seam/connect/routes/workspaces.ts +118 -22
- package/src/lib/seam/connect/seam-http.ts +141 -0
- package/lib/seam/connect/axios.d.ts +0 -3
- package/lib/seam/connect/axios.js +0 -17
- package/lib/seam/connect/axios.js.map +0 -1
- package/lib/seam/connect/client-options.d.ts +0 -19
- package/lib/seam/connect/client-options.js +0 -29
- package/lib/seam/connect/client-options.js.map +0 -1
- package/lib/seam/connect/legacy/workspaces.d.ts +0 -8
- package/lib/seam/connect/legacy/workspaces.js +0 -10
- package/lib/seam/connect/legacy/workspaces.js.map +0 -1
- package/src/lib/seam/connect/axios.ts +0 -23
- package/src/lib/seam/connect/legacy/workspaces.ts +0 -26
package/dist/connect.cjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
|
+
var axiosRetry = require('axios-retry');
|
|
4
5
|
|
|
5
6
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
7
|
|
|
7
8
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
9
|
+
var axiosRetry__default = /*#__PURE__*/_interopDefault(axiosRetry);
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
25
|
-
return value;
|
|
11
|
+
// src/lib/seam/connect/options.ts
|
|
12
|
+
var isSeamHttpOptionsWithClient = (options) => {
|
|
13
|
+
if (!("client" in options))
|
|
14
|
+
return false;
|
|
15
|
+
if (options.client == null)
|
|
16
|
+
return false;
|
|
17
|
+
const keys = Object.keys(options).filter((k) => k !== "client");
|
|
18
|
+
if (keys.length > 0) {
|
|
19
|
+
throw new SeamHttpInvalidOptionsError(
|
|
20
|
+
`The client option cannot be used with any other option, but received: ${keys.join(
|
|
21
|
+
", "
|
|
22
|
+
)}`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
// src/lib/seam/connect/client-options.ts
|
|
29
27
|
var isSeamHttpOptionsWithApiKey = (options) => {
|
|
30
28
|
if (!("apiKey" in options))
|
|
31
29
|
return false;
|
|
30
|
+
if (options.apiKey == null)
|
|
31
|
+
return false;
|
|
32
32
|
if ("clientSessionToken" in options && options.clientSessionToken != null) {
|
|
33
|
-
throw new
|
|
34
|
-
"The clientSessionToken option cannot be used with the apiKey option
|
|
33
|
+
throw new SeamHttpInvalidOptionsError(
|
|
34
|
+
"The clientSessionToken option cannot be used with the apiKey option"
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
return true;
|
|
@@ -39,14 +39,16 @@ var isSeamHttpOptionsWithApiKey = (options) => {
|
|
|
39
39
|
var isSeamHttpOptionsWithClientSessionToken = (options) => {
|
|
40
40
|
if (!("clientSessionToken" in options))
|
|
41
41
|
return false;
|
|
42
|
+
if (options.clientSessionToken == null)
|
|
43
|
+
return false;
|
|
42
44
|
if ("apiKey" in options && options.apiKey != null) {
|
|
43
|
-
throw new
|
|
44
|
-
"The clientSessionToken option cannot be used with the apiKey option
|
|
45
|
+
throw new SeamHttpInvalidOptionsError(
|
|
46
|
+
"The clientSessionToken option cannot be used with the apiKey option"
|
|
45
47
|
);
|
|
46
48
|
}
|
|
47
49
|
return true;
|
|
48
50
|
};
|
|
49
|
-
var
|
|
51
|
+
var SeamHttpInvalidOptionsError = class extends Error {
|
|
50
52
|
constructor(message) {
|
|
51
53
|
super(`SeamHttp received invalid options: ${message}`);
|
|
52
54
|
this.name = this.constructor.name;
|
|
@@ -56,31 +58,42 @@ var InvalidSeamHttpOptionsError = class extends Error {
|
|
|
56
58
|
|
|
57
59
|
// src/lib/seam/connect/auth.ts
|
|
58
60
|
var getAuthHeaders = (options) => {
|
|
61
|
+
if ("publishableKey" in options) {
|
|
62
|
+
return getAuthHeadersForPublishableKey(options.publishableKey);
|
|
63
|
+
}
|
|
59
64
|
if (isSeamHttpOptionsWithApiKey(options)) {
|
|
60
65
|
return getAuthHeadersForApiKey(options);
|
|
61
66
|
}
|
|
62
67
|
if (isSeamHttpOptionsWithClientSessionToken(options)) {
|
|
63
68
|
return getAuthHeadersForClientSessionToken(options);
|
|
64
69
|
}
|
|
65
|
-
throw new
|
|
66
|
-
"Must specify an apiKey or
|
|
70
|
+
throw new SeamHttpInvalidOptionsError(
|
|
71
|
+
"Must specify an apiKey, clientSessionToken, or publishableKey"
|
|
67
72
|
);
|
|
68
73
|
};
|
|
69
74
|
var getAuthHeadersForApiKey = ({
|
|
70
75
|
apiKey
|
|
71
76
|
}) => {
|
|
72
77
|
if (isClientSessionToken(apiKey)) {
|
|
73
|
-
throw new
|
|
78
|
+
throw new SeamHttpInvalidTokenError(
|
|
74
79
|
"A Client Session Token cannot be used as an apiKey"
|
|
75
80
|
);
|
|
76
81
|
}
|
|
82
|
+
if (isJwt(apiKey)) {
|
|
83
|
+
throw new SeamHttpInvalidTokenError("A JWT cannot be used as an apiKey");
|
|
84
|
+
}
|
|
77
85
|
if (isAccessToken(apiKey)) {
|
|
78
|
-
throw new
|
|
79
|
-
"An
|
|
86
|
+
throw new SeamHttpInvalidTokenError(
|
|
87
|
+
"An Access Token cannot be used as an apiKey"
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
if (isPublishableKey(apiKey)) {
|
|
91
|
+
throw new SeamHttpInvalidTokenError(
|
|
92
|
+
"A Publishable Key cannot be used as an apiKey"
|
|
80
93
|
);
|
|
81
94
|
}
|
|
82
|
-
if (
|
|
83
|
-
throw new
|
|
95
|
+
if (!isSeamToken(apiKey)) {
|
|
96
|
+
throw new SeamHttpInvalidTokenError(
|
|
84
97
|
`Unknown or invalid apiKey format, expected token to start with ${tokenPrefix}`
|
|
85
98
|
);
|
|
86
99
|
}
|
|
@@ -91,8 +104,23 @@ var getAuthHeadersForApiKey = ({
|
|
|
91
104
|
var getAuthHeadersForClientSessionToken = ({
|
|
92
105
|
clientSessionToken
|
|
93
106
|
}) => {
|
|
107
|
+
if (isJwt(clientSessionToken)) {
|
|
108
|
+
throw new SeamHttpInvalidTokenError(
|
|
109
|
+
"A JWT cannot be used as a clientSessionToken"
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (isAccessToken(clientSessionToken)) {
|
|
113
|
+
throw new SeamHttpInvalidTokenError(
|
|
114
|
+
"An Access Token cannot be used as a clientSessionToken"
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (isPublishableKey(clientSessionToken)) {
|
|
118
|
+
throw new SeamHttpInvalidTokenError(
|
|
119
|
+
"A Publishable Key cannot be used as a clientSessionToken"
|
|
120
|
+
);
|
|
121
|
+
}
|
|
94
122
|
if (!isClientSessionToken(clientSessionToken)) {
|
|
95
|
-
throw new
|
|
123
|
+
throw new SeamHttpInvalidTokenError(
|
|
96
124
|
`Unknown or invalid clientSessionToken format, expected token to start with ${clientSessionTokenPrefix}`
|
|
97
125
|
);
|
|
98
126
|
}
|
|
@@ -101,119 +129,1802 @@ var getAuthHeadersForClientSessionToken = ({
|
|
|
101
129
|
"client-session-token": clientSessionToken
|
|
102
130
|
};
|
|
103
131
|
};
|
|
104
|
-
var
|
|
132
|
+
var getAuthHeadersForPublishableKey = (publishableKey) => {
|
|
133
|
+
if (isJwt(publishableKey)) {
|
|
134
|
+
throw new SeamHttpInvalidTokenError(
|
|
135
|
+
"A JWT cannot be used as a publishableKey"
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
if (isAccessToken(publishableKey)) {
|
|
139
|
+
throw new SeamHttpInvalidTokenError(
|
|
140
|
+
"An Access Token cannot be used as a publishableKey"
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
if (isClientSessionToken(publishableKey)) {
|
|
144
|
+
throw new SeamHttpInvalidTokenError(
|
|
145
|
+
"A Client Session Token Key cannot be used as a publishableKey"
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (!isPublishableKey(publishableKey)) {
|
|
149
|
+
throw new SeamHttpInvalidTokenError(
|
|
150
|
+
`Unknown or invalid publishableKey format, expected token to start with ${publishableKeyTokenPrefix}`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
"seam-publishable-key": publishableKey
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
var SeamHttpInvalidTokenError = class extends Error {
|
|
105
158
|
constructor(message) {
|
|
106
159
|
super(`SeamHttp received an invalid token: ${message}`);
|
|
107
160
|
this.name = this.constructor.name;
|
|
108
161
|
Error.captureStackTrace(this, this.constructor);
|
|
109
162
|
}
|
|
110
163
|
};
|
|
164
|
+
var warnOnInsecureuserIdentifierKey = (userIdentifierKey) => {
|
|
165
|
+
if (isEmail(userIdentifierKey)) {
|
|
166
|
+
console.warn(
|
|
167
|
+
...[
|
|
168
|
+
"Using an email for the userIdentifierKey is insecure and may return an error in the future!",
|
|
169
|
+
"This is insecure because an email is common knowledge or easily guessed.",
|
|
170
|
+
"Use something with sufficient entropy known only to the owner of the client session.",
|
|
171
|
+
"For help choosing a user identifier key see",
|
|
172
|
+
"https://docs.seam.co/latest/seam-components/overview/get-started-with-client-side-components#3-select-a-user-identifier-key"
|
|
173
|
+
]
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
111
177
|
var tokenPrefix = "seam_";
|
|
112
178
|
var clientSessionTokenPrefix = "seam_cst";
|
|
179
|
+
var publishableKeyTokenPrefix = "seam_pk";
|
|
113
180
|
var isClientSessionToken = (token) => token.startsWith(clientSessionTokenPrefix);
|
|
114
181
|
var isAccessToken = (token) => token.startsWith("seam_at");
|
|
115
182
|
var isJwt = (token) => token.startsWith("ey");
|
|
116
183
|
var isSeamToken = (token) => token.startsWith(tokenPrefix);
|
|
184
|
+
var isPublishableKey = (token) => token.startsWith(publishableKeyTokenPrefix);
|
|
185
|
+
var isEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
117
186
|
|
|
118
|
-
// src/lib/
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
187
|
+
// src/lib/params-serializer.ts
|
|
188
|
+
var paramsSerializer = (params) => {
|
|
189
|
+
const searchParams = new URLSearchParams();
|
|
190
|
+
for (const [name, value] of Object.entries(params)) {
|
|
191
|
+
if (value == null)
|
|
192
|
+
continue;
|
|
193
|
+
if (Array.isArray(value)) {
|
|
194
|
+
if (value.length === 0)
|
|
195
|
+
searchParams.set(name, "");
|
|
196
|
+
if (value.length === 1 && value[0] === "") {
|
|
197
|
+
throw new UnserializableParamError(
|
|
198
|
+
name,
|
|
199
|
+
`is a single element array containing the empty string which is unsupported because it serializes to the empty array`
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
for (const v of value) {
|
|
203
|
+
throwIfUnserializable(name, v);
|
|
204
|
+
searchParams.append(name, v);
|
|
205
|
+
}
|
|
206
|
+
continue;
|
|
128
207
|
}
|
|
208
|
+
throwIfUnserializable(name, value);
|
|
209
|
+
searchParams.set(name, value);
|
|
210
|
+
}
|
|
211
|
+
searchParams.sort();
|
|
212
|
+
return searchParams.toString();
|
|
213
|
+
};
|
|
214
|
+
var throwIfUnserializable = (k, v) => {
|
|
215
|
+
if (v == null) {
|
|
216
|
+
throw new UnserializableParamError(k, `is ${v} or contains ${v}`);
|
|
217
|
+
}
|
|
218
|
+
if (typeof v === "function") {
|
|
219
|
+
throw new UnserializableParamError(
|
|
220
|
+
k,
|
|
221
|
+
"is a function or contains a function"
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
if (typeof v === "object") {
|
|
225
|
+
throw new UnserializableParamError(k, "is an object or contains an object");
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
var UnserializableParamError = class extends Error {
|
|
229
|
+
constructor(name, message) {
|
|
230
|
+
super(`Could not serialize parameter: '${name}' ${message}`);
|
|
231
|
+
this.name = this.constructor.name;
|
|
232
|
+
Error.captureStackTrace(this, this.constructor);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// src/lib/seam/connect/client.ts
|
|
237
|
+
var createClient = (options) => {
|
|
238
|
+
if (options.client != null)
|
|
239
|
+
return options.client;
|
|
240
|
+
const client = axios__default.default.create({
|
|
241
|
+
paramsSerializer,
|
|
242
|
+
...options.axiosOptions
|
|
243
|
+
});
|
|
244
|
+
axiosRetry__default.default(client, {
|
|
245
|
+
retries: 2,
|
|
246
|
+
retryDelay: axiosRetry.exponentialDelay,
|
|
247
|
+
...options.axiosRetryOptions
|
|
129
248
|
});
|
|
249
|
+
return client;
|
|
130
250
|
};
|
|
131
251
|
|
|
132
252
|
// src/lib/seam/connect/parse-options.ts
|
|
253
|
+
var defaultEndpoint = "https://connect.getseam.com";
|
|
133
254
|
var parseOptions = (apiKeyOrOptions) => {
|
|
255
|
+
const options = getNormalizedOptions(apiKeyOrOptions);
|
|
256
|
+
if (isSeamHttpOptionsWithClient(options))
|
|
257
|
+
return options;
|
|
258
|
+
return {
|
|
259
|
+
axiosOptions: {
|
|
260
|
+
baseURL: options.endpoint ?? getEndpointFromEnv() ?? defaultEndpoint,
|
|
261
|
+
withCredentials: isSeamHttpOptionsWithClientSessionToken(options),
|
|
262
|
+
...options.axiosOptions,
|
|
263
|
+
headers: {
|
|
264
|
+
...getAuthHeaders(options),
|
|
265
|
+
...options.axiosOptions?.headers
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
axiosRetryOptions: {
|
|
269
|
+
...options.axiosRetryOptions
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
var getNormalizedOptions = (apiKeyOrOptions) => {
|
|
134
274
|
const options = typeof apiKeyOrOptions === "string" ? { apiKey: apiKeyOrOptions } : apiKeyOrOptions;
|
|
135
|
-
|
|
136
|
-
|
|
275
|
+
if (isSeamHttpOptionsWithClient(options))
|
|
276
|
+
return options;
|
|
277
|
+
const apiKey = "apiKey" in options ? options.apiKey : getApiKeyFromEnv(options);
|
|
137
278
|
return {
|
|
138
279
|
...options,
|
|
139
|
-
...apiKey != null ? { apiKey } : {}
|
|
140
|
-
endpoint,
|
|
141
|
-
axiosOptions: options.axiosOptions ?? {},
|
|
142
|
-
enableLegacyMethodBehaivor: false
|
|
280
|
+
...apiKey != null ? { apiKey } : {}
|
|
143
281
|
};
|
|
144
282
|
};
|
|
283
|
+
var getApiKeyFromEnv = (options) => {
|
|
284
|
+
if ("clientSessionToken" in options && options.clientSessionToken != null) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
return globalThis.process?.env?.SEAM_API_KEY;
|
|
288
|
+
};
|
|
289
|
+
var getEndpointFromEnv = () => {
|
|
290
|
+
return globalThis.process?.env?.SEAM_ENDPOINT ?? globalThis.process?.env?.SEAM_API_URL;
|
|
291
|
+
};
|
|
145
292
|
|
|
146
|
-
// src/lib/seam/connect/routes/
|
|
147
|
-
var
|
|
148
|
-
constructor(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
293
|
+
// src/lib/seam/connect/routes/client-sessions.ts
|
|
294
|
+
var SeamHttpClientSessions = class _SeamHttpClientSessions {
|
|
295
|
+
constructor(apiKeyOrOptions = {}) {
|
|
296
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
297
|
+
this.client = createClient(clientOptions);
|
|
298
|
+
}
|
|
299
|
+
static fromClient(client, options = {}) {
|
|
300
|
+
const constructorOptions = { ...options, client };
|
|
301
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
302
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
303
|
+
}
|
|
304
|
+
return new _SeamHttpClientSessions(constructorOptions);
|
|
305
|
+
}
|
|
306
|
+
static fromApiKey(apiKey, options = {}) {
|
|
307
|
+
const constructorOptions = { ...options, apiKey };
|
|
308
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
309
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
310
|
+
}
|
|
311
|
+
return new _SeamHttpClientSessions(constructorOptions);
|
|
312
|
+
}
|
|
313
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
314
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
315
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
316
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
317
|
+
}
|
|
318
|
+
return new _SeamHttpClientSessions(constructorOptions);
|
|
319
|
+
}
|
|
320
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
321
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
322
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
323
|
+
const client = createClient(clientOptions);
|
|
324
|
+
const clientSessions = _SeamHttpClientSessions.fromClient(client);
|
|
325
|
+
const { token } = await clientSessions.getOrCreate({
|
|
326
|
+
user_identifier_key: userIdentifierKey
|
|
327
|
+
});
|
|
328
|
+
return _SeamHttpClientSessions.fromClientSessionToken(token, options);
|
|
329
|
+
}
|
|
330
|
+
async create(body) {
|
|
331
|
+
const { data } = await this.client.request({
|
|
332
|
+
url: "/client_sessions/create",
|
|
333
|
+
method: "post",
|
|
334
|
+
data: body
|
|
335
|
+
});
|
|
336
|
+
return data.client_session;
|
|
337
|
+
}
|
|
338
|
+
async delete(body) {
|
|
339
|
+
await this.client.request({
|
|
340
|
+
url: "/client_sessions/delete",
|
|
341
|
+
method: "post",
|
|
342
|
+
data: body
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
async get(body) {
|
|
346
|
+
const { data } = await this.client.request({
|
|
347
|
+
url: "/client_sessions/get",
|
|
348
|
+
method: "post",
|
|
349
|
+
data: body
|
|
350
|
+
});
|
|
351
|
+
return data.client_session;
|
|
352
|
+
}
|
|
353
|
+
async getOrCreate(body) {
|
|
354
|
+
const { data } = await this.client.request({
|
|
355
|
+
url: "/client_sessions/get_or_create",
|
|
356
|
+
method: "post",
|
|
357
|
+
data: body
|
|
358
|
+
});
|
|
359
|
+
return data.client_session;
|
|
360
|
+
}
|
|
361
|
+
async grantAccess(body) {
|
|
362
|
+
const { data } = await this.client.request({
|
|
363
|
+
url: "/client_sessions/grant_access",
|
|
364
|
+
method: "post",
|
|
365
|
+
data: body
|
|
366
|
+
});
|
|
367
|
+
return data.client_session;
|
|
368
|
+
}
|
|
369
|
+
async list(body) {
|
|
370
|
+
const { data } = await this.client.request({
|
|
371
|
+
url: "/client_sessions/list",
|
|
372
|
+
method: "post",
|
|
373
|
+
data: body
|
|
374
|
+
});
|
|
375
|
+
return data.client_sessions;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
// src/lib/seam/connect/routes/access-codes-unmanaged.ts
|
|
380
|
+
var SeamHttpAccessCodesUnmanaged = class _SeamHttpAccessCodesUnmanaged {
|
|
381
|
+
constructor(apiKeyOrOptions = {}) {
|
|
382
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
383
|
+
this.client = createClient(clientOptions);
|
|
384
|
+
}
|
|
385
|
+
static fromClient(client, options = {}) {
|
|
386
|
+
const constructorOptions = { ...options, client };
|
|
387
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
388
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
389
|
+
}
|
|
390
|
+
return new _SeamHttpAccessCodesUnmanaged(constructorOptions);
|
|
391
|
+
}
|
|
392
|
+
static fromApiKey(apiKey, options = {}) {
|
|
393
|
+
const constructorOptions = { ...options, apiKey };
|
|
394
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
395
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
396
|
+
}
|
|
397
|
+
return new _SeamHttpAccessCodesUnmanaged(constructorOptions);
|
|
398
|
+
}
|
|
399
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
400
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
401
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
402
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
403
|
+
}
|
|
404
|
+
return new _SeamHttpAccessCodesUnmanaged(constructorOptions);
|
|
405
|
+
}
|
|
406
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
407
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
408
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
409
|
+
const client = createClient(clientOptions);
|
|
410
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
411
|
+
const { token } = await clientSessions.getOrCreate({
|
|
412
|
+
user_identifier_key: userIdentifierKey
|
|
413
|
+
});
|
|
414
|
+
return _SeamHttpAccessCodesUnmanaged.fromClientSessionToken(token, options);
|
|
415
|
+
}
|
|
416
|
+
async convertToManaged(body) {
|
|
417
|
+
await this.client.request({
|
|
418
|
+
url: "/access_codes/unmanaged/convert_to_managed",
|
|
419
|
+
method: "post",
|
|
420
|
+
data: body
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
async delete(body) {
|
|
424
|
+
await this.client.request({
|
|
425
|
+
url: "/access_codes/unmanaged/delete",
|
|
426
|
+
method: "post",
|
|
427
|
+
data: body
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
async get(body) {
|
|
431
|
+
const { data } = await this.client.request(
|
|
159
432
|
{
|
|
160
|
-
|
|
433
|
+
url: "/access_codes/unmanaged/get",
|
|
434
|
+
method: "post",
|
|
435
|
+
data: body
|
|
161
436
|
}
|
|
162
437
|
);
|
|
163
|
-
return data.
|
|
438
|
+
return data.access_code;
|
|
439
|
+
}
|
|
440
|
+
async list(body) {
|
|
441
|
+
const { data } = await this.client.request({
|
|
442
|
+
url: "/access_codes/unmanaged/list",
|
|
443
|
+
method: "post",
|
|
444
|
+
data: body
|
|
445
|
+
});
|
|
446
|
+
return data.access_codes;
|
|
447
|
+
}
|
|
448
|
+
async update(body) {
|
|
449
|
+
await this.client.request({
|
|
450
|
+
url: "/access_codes/unmanaged/update",
|
|
451
|
+
method: "post",
|
|
452
|
+
data: body
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// src/lib/seam/connect/routes/access-codes.ts
|
|
458
|
+
var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
|
|
459
|
+
constructor(apiKeyOrOptions = {}) {
|
|
460
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
461
|
+
this.client = createClient(clientOptions);
|
|
462
|
+
}
|
|
463
|
+
static fromClient(client, options = {}) {
|
|
464
|
+
const constructorOptions = { ...options, client };
|
|
465
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
466
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
467
|
+
}
|
|
468
|
+
return new _SeamHttpAccessCodes(constructorOptions);
|
|
469
|
+
}
|
|
470
|
+
static fromApiKey(apiKey, options = {}) {
|
|
471
|
+
const constructorOptions = { ...options, apiKey };
|
|
472
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
473
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
474
|
+
}
|
|
475
|
+
return new _SeamHttpAccessCodes(constructorOptions);
|
|
476
|
+
}
|
|
477
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
478
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
479
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
480
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
481
|
+
}
|
|
482
|
+
return new _SeamHttpAccessCodes(constructorOptions);
|
|
483
|
+
}
|
|
484
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
485
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
486
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
487
|
+
const client = createClient(clientOptions);
|
|
488
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
489
|
+
const { token } = await clientSessions.getOrCreate({
|
|
490
|
+
user_identifier_key: userIdentifierKey
|
|
491
|
+
});
|
|
492
|
+
return _SeamHttpAccessCodes.fromClientSessionToken(token, options);
|
|
493
|
+
}
|
|
494
|
+
get unmanaged() {
|
|
495
|
+
return SeamHttpAccessCodesUnmanaged.fromClient(this.client);
|
|
496
|
+
}
|
|
497
|
+
async create(body) {
|
|
498
|
+
const { data } = await this.client.request({
|
|
499
|
+
url: "/access_codes/create",
|
|
500
|
+
method: "post",
|
|
501
|
+
data: body
|
|
502
|
+
});
|
|
503
|
+
return data.access_code;
|
|
504
|
+
}
|
|
505
|
+
async createMultiple(body) {
|
|
506
|
+
const { data } = await this.client.request({
|
|
507
|
+
url: "/access_codes/create_multiple",
|
|
508
|
+
method: "post",
|
|
509
|
+
data: body
|
|
510
|
+
});
|
|
511
|
+
return data.access_codes;
|
|
512
|
+
}
|
|
513
|
+
async delete(body) {
|
|
514
|
+
await this.client.request({
|
|
515
|
+
url: "/access_codes/delete",
|
|
516
|
+
method: "post",
|
|
517
|
+
data: body
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
async generateCode(body) {
|
|
521
|
+
const { data } = await this.client.request(
|
|
522
|
+
{
|
|
523
|
+
url: "/access_codes/generate_code",
|
|
524
|
+
method: "post",
|
|
525
|
+
data: body
|
|
526
|
+
}
|
|
527
|
+
);
|
|
528
|
+
return data.generated_code;
|
|
529
|
+
}
|
|
530
|
+
async get(body) {
|
|
531
|
+
const { data } = await this.client.request({
|
|
532
|
+
url: "/access_codes/get",
|
|
533
|
+
method: "post",
|
|
534
|
+
data: body
|
|
535
|
+
});
|
|
536
|
+
return data.access_code;
|
|
537
|
+
}
|
|
538
|
+
async list(body) {
|
|
539
|
+
const { data } = await this.client.request({
|
|
540
|
+
url: "/access_codes/list",
|
|
541
|
+
method: "post",
|
|
542
|
+
data: body
|
|
543
|
+
});
|
|
544
|
+
return data.access_codes;
|
|
545
|
+
}
|
|
546
|
+
async pullBackupAccessCode(body) {
|
|
547
|
+
const { data } = await this.client.request({
|
|
548
|
+
url: "/access_codes/pull_backup_access_code",
|
|
549
|
+
method: "post",
|
|
550
|
+
data: body
|
|
551
|
+
});
|
|
552
|
+
return data.backup_access_code;
|
|
553
|
+
}
|
|
554
|
+
async update(body) {
|
|
555
|
+
await this.client.request({
|
|
556
|
+
url: "/access_codes/update",
|
|
557
|
+
method: "post",
|
|
558
|
+
data: body
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
// src/lib/seam/connect/routes/acs-access-groups.ts
|
|
564
|
+
var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
|
|
565
|
+
constructor(apiKeyOrOptions = {}) {
|
|
566
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
567
|
+
this.client = createClient(clientOptions);
|
|
568
|
+
}
|
|
569
|
+
static fromClient(client, options = {}) {
|
|
570
|
+
const constructorOptions = { ...options, client };
|
|
571
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
572
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
573
|
+
}
|
|
574
|
+
return new _SeamHttpAcsAccessGroups(constructorOptions);
|
|
575
|
+
}
|
|
576
|
+
static fromApiKey(apiKey, options = {}) {
|
|
577
|
+
const constructorOptions = { ...options, apiKey };
|
|
578
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
579
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
580
|
+
}
|
|
581
|
+
return new _SeamHttpAcsAccessGroups(constructorOptions);
|
|
582
|
+
}
|
|
583
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
584
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
585
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
586
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
587
|
+
}
|
|
588
|
+
return new _SeamHttpAcsAccessGroups(constructorOptions);
|
|
589
|
+
}
|
|
590
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
591
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
592
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
593
|
+
const client = createClient(clientOptions);
|
|
594
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
595
|
+
const { token } = await clientSessions.getOrCreate({
|
|
596
|
+
user_identifier_key: userIdentifierKey
|
|
597
|
+
});
|
|
598
|
+
return _SeamHttpAcsAccessGroups.fromClientSessionToken(token, options);
|
|
599
|
+
}
|
|
600
|
+
async addUser(body) {
|
|
601
|
+
await this.client.request({
|
|
602
|
+
url: "/acs/access_groups/add_user",
|
|
603
|
+
method: "post",
|
|
604
|
+
data: body
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
async create(body) {
|
|
608
|
+
const { data } = await this.client.request({
|
|
609
|
+
url: "/acs/access_groups/create",
|
|
610
|
+
method: "post",
|
|
611
|
+
data: body
|
|
612
|
+
});
|
|
613
|
+
return data.acs_access_group;
|
|
614
|
+
}
|
|
615
|
+
async delete(body) {
|
|
616
|
+
await this.client.request({
|
|
617
|
+
url: "/acs/access_groups/delete",
|
|
618
|
+
method: "post",
|
|
619
|
+
data: body
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
async get(body) {
|
|
623
|
+
const { data } = await this.client.request({
|
|
624
|
+
url: "/acs/access_groups/get",
|
|
625
|
+
method: "post",
|
|
626
|
+
data: body
|
|
627
|
+
});
|
|
628
|
+
return data.acs_access_group;
|
|
629
|
+
}
|
|
630
|
+
async list(body) {
|
|
631
|
+
const { data } = await this.client.request({
|
|
632
|
+
url: "/acs/access_groups/list",
|
|
633
|
+
method: "post",
|
|
634
|
+
data: body
|
|
635
|
+
});
|
|
636
|
+
return data.acs_access_groups;
|
|
637
|
+
}
|
|
638
|
+
async listUsers(body) {
|
|
639
|
+
const { data } = await this.client.request({
|
|
640
|
+
url: "/acs/access_groups/list_users",
|
|
641
|
+
method: "post",
|
|
642
|
+
data: body
|
|
643
|
+
});
|
|
644
|
+
return data.acs_users;
|
|
645
|
+
}
|
|
646
|
+
async removeUser(body) {
|
|
647
|
+
await this.client.request({
|
|
648
|
+
url: "/acs/access_groups/remove_user",
|
|
649
|
+
method: "post",
|
|
650
|
+
data: body
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
async update(body) {
|
|
654
|
+
await this.client.request({
|
|
655
|
+
url: "/acs/access_groups/update",
|
|
656
|
+
method: "post",
|
|
657
|
+
data: body
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
// src/lib/seam/connect/routes/acs-credentials.ts
|
|
663
|
+
var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
|
|
664
|
+
constructor(apiKeyOrOptions = {}) {
|
|
665
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
666
|
+
this.client = createClient(clientOptions);
|
|
667
|
+
}
|
|
668
|
+
static fromClient(client, options = {}) {
|
|
669
|
+
const constructorOptions = { ...options, client };
|
|
670
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
671
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
672
|
+
}
|
|
673
|
+
return new _SeamHttpAcsCredentials(constructorOptions);
|
|
674
|
+
}
|
|
675
|
+
static fromApiKey(apiKey, options = {}) {
|
|
676
|
+
const constructorOptions = { ...options, apiKey };
|
|
677
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
678
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
679
|
+
}
|
|
680
|
+
return new _SeamHttpAcsCredentials(constructorOptions);
|
|
681
|
+
}
|
|
682
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
683
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
684
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
685
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
686
|
+
}
|
|
687
|
+
return new _SeamHttpAcsCredentials(constructorOptions);
|
|
688
|
+
}
|
|
689
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
690
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
691
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
692
|
+
const client = createClient(clientOptions);
|
|
693
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
694
|
+
const { token } = await clientSessions.getOrCreate({
|
|
695
|
+
user_identifier_key: userIdentifierKey
|
|
696
|
+
});
|
|
697
|
+
return _SeamHttpAcsCredentials.fromClientSessionToken(token, options);
|
|
698
|
+
}
|
|
699
|
+
async create(body) {
|
|
700
|
+
const { data } = await this.client.request({
|
|
701
|
+
url: "/acs/credentials/create",
|
|
702
|
+
method: "post",
|
|
703
|
+
data: body
|
|
704
|
+
});
|
|
705
|
+
return data.acs_credential;
|
|
706
|
+
}
|
|
707
|
+
async delete(body) {
|
|
708
|
+
await this.client.request({
|
|
709
|
+
url: "/acs/credentials/delete",
|
|
710
|
+
method: "post",
|
|
711
|
+
data: body
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
async get(body) {
|
|
715
|
+
const { data } = await this.client.request({
|
|
716
|
+
url: "/acs/credentials/get",
|
|
717
|
+
method: "post",
|
|
718
|
+
data: body
|
|
719
|
+
});
|
|
720
|
+
return data.acs_credential;
|
|
721
|
+
}
|
|
722
|
+
async list(body) {
|
|
723
|
+
const { data } = await this.client.request({
|
|
724
|
+
url: "/acs/credentials/list",
|
|
725
|
+
method: "post",
|
|
726
|
+
data: body
|
|
727
|
+
});
|
|
728
|
+
return data.acs_credentials;
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// src/lib/seam/connect/routes/acs-systems.ts
|
|
733
|
+
var SeamHttpAcsSystems = class _SeamHttpAcsSystems {
|
|
734
|
+
constructor(apiKeyOrOptions = {}) {
|
|
735
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
736
|
+
this.client = createClient(clientOptions);
|
|
737
|
+
}
|
|
738
|
+
static fromClient(client, options = {}) {
|
|
739
|
+
const constructorOptions = { ...options, client };
|
|
740
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
741
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
742
|
+
}
|
|
743
|
+
return new _SeamHttpAcsSystems(constructorOptions);
|
|
744
|
+
}
|
|
745
|
+
static fromApiKey(apiKey, options = {}) {
|
|
746
|
+
const constructorOptions = { ...options, apiKey };
|
|
747
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
748
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
749
|
+
}
|
|
750
|
+
return new _SeamHttpAcsSystems(constructorOptions);
|
|
751
|
+
}
|
|
752
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
753
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
754
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
755
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
756
|
+
}
|
|
757
|
+
return new _SeamHttpAcsSystems(constructorOptions);
|
|
758
|
+
}
|
|
759
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
760
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
761
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
762
|
+
const client = createClient(clientOptions);
|
|
763
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
764
|
+
const { token } = await clientSessions.getOrCreate({
|
|
765
|
+
user_identifier_key: userIdentifierKey
|
|
766
|
+
});
|
|
767
|
+
return _SeamHttpAcsSystems.fromClientSessionToken(token, options);
|
|
768
|
+
}
|
|
769
|
+
async get(body) {
|
|
770
|
+
const { data } = await this.client.request({
|
|
771
|
+
url: "/acs/systems/get",
|
|
772
|
+
method: "post",
|
|
773
|
+
data: body
|
|
774
|
+
});
|
|
775
|
+
return data.acs_system;
|
|
776
|
+
}
|
|
777
|
+
async list(body) {
|
|
778
|
+
const { data } = await this.client.request({
|
|
779
|
+
url: "/acs/systems/list",
|
|
780
|
+
method: "post",
|
|
781
|
+
data: body
|
|
782
|
+
});
|
|
783
|
+
return data.acs_systems;
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// src/lib/seam/connect/routes/acs-users.ts
|
|
788
|
+
var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
|
|
789
|
+
constructor(apiKeyOrOptions = {}) {
|
|
790
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
791
|
+
this.client = createClient(clientOptions);
|
|
792
|
+
}
|
|
793
|
+
static fromClient(client, options = {}) {
|
|
794
|
+
const constructorOptions = { ...options, client };
|
|
795
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
796
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
797
|
+
}
|
|
798
|
+
return new _SeamHttpAcsUsers(constructorOptions);
|
|
799
|
+
}
|
|
800
|
+
static fromApiKey(apiKey, options = {}) {
|
|
801
|
+
const constructorOptions = { ...options, apiKey };
|
|
802
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
803
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
804
|
+
}
|
|
805
|
+
return new _SeamHttpAcsUsers(constructorOptions);
|
|
806
|
+
}
|
|
807
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
808
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
809
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
810
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
811
|
+
}
|
|
812
|
+
return new _SeamHttpAcsUsers(constructorOptions);
|
|
813
|
+
}
|
|
814
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
815
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
816
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
817
|
+
const client = createClient(clientOptions);
|
|
818
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
819
|
+
const { token } = await clientSessions.getOrCreate({
|
|
820
|
+
user_identifier_key: userIdentifierKey
|
|
821
|
+
});
|
|
822
|
+
return _SeamHttpAcsUsers.fromClientSessionToken(token, options);
|
|
823
|
+
}
|
|
824
|
+
async addToAccessGroup(body) {
|
|
825
|
+
await this.client.request({
|
|
826
|
+
url: "/acs/users/add_to_access_group",
|
|
827
|
+
method: "post",
|
|
828
|
+
data: body
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
async create(body) {
|
|
832
|
+
const { data } = await this.client.request({
|
|
833
|
+
url: "/acs/users/create",
|
|
834
|
+
method: "post",
|
|
835
|
+
data: body
|
|
836
|
+
});
|
|
837
|
+
return data.acs_user;
|
|
838
|
+
}
|
|
839
|
+
async delete(body) {
|
|
840
|
+
await this.client.request({
|
|
841
|
+
url: "/acs/users/delete",
|
|
842
|
+
method: "post",
|
|
843
|
+
data: body
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
async get(body) {
|
|
847
|
+
const { data } = await this.client.request({
|
|
848
|
+
url: "/acs/users/get",
|
|
849
|
+
method: "post",
|
|
850
|
+
data: body
|
|
851
|
+
});
|
|
852
|
+
return data.acs_user;
|
|
853
|
+
}
|
|
854
|
+
async list(body) {
|
|
855
|
+
const { data } = await this.client.request({
|
|
856
|
+
url: "/acs/users/list",
|
|
857
|
+
method: "post",
|
|
858
|
+
data: body
|
|
859
|
+
});
|
|
860
|
+
return data.acs_users;
|
|
861
|
+
}
|
|
862
|
+
async removeFromAccessGroup(body) {
|
|
863
|
+
await this.client.request({
|
|
864
|
+
url: "/acs/users/remove_from_access_group",
|
|
865
|
+
method: "post",
|
|
866
|
+
data: body
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
async suspend(body) {
|
|
870
|
+
await this.client.request({
|
|
871
|
+
url: "/acs/users/suspend",
|
|
872
|
+
method: "post",
|
|
873
|
+
data: body
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
async unsuspend(body) {
|
|
877
|
+
await this.client.request({
|
|
878
|
+
url: "/acs/users/unsuspend",
|
|
879
|
+
method: "post",
|
|
880
|
+
data: body
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
async update(body) {
|
|
884
|
+
await this.client.request({
|
|
885
|
+
url: "/acs/users/update",
|
|
886
|
+
method: "post",
|
|
887
|
+
data: body
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
// src/lib/seam/connect/routes/acs.ts
|
|
893
|
+
var SeamHttpAcs = class _SeamHttpAcs {
|
|
894
|
+
constructor(apiKeyOrOptions = {}) {
|
|
895
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
896
|
+
this.client = createClient(clientOptions);
|
|
897
|
+
}
|
|
898
|
+
static fromClient(client, options = {}) {
|
|
899
|
+
const constructorOptions = { ...options, client };
|
|
900
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
901
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
902
|
+
}
|
|
903
|
+
return new _SeamHttpAcs(constructorOptions);
|
|
904
|
+
}
|
|
905
|
+
static fromApiKey(apiKey, options = {}) {
|
|
906
|
+
const constructorOptions = { ...options, apiKey };
|
|
907
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
908
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
909
|
+
}
|
|
910
|
+
return new _SeamHttpAcs(constructorOptions);
|
|
911
|
+
}
|
|
912
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
913
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
914
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
915
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
916
|
+
}
|
|
917
|
+
return new _SeamHttpAcs(constructorOptions);
|
|
918
|
+
}
|
|
919
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
920
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
921
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
922
|
+
const client = createClient(clientOptions);
|
|
923
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
924
|
+
const { token } = await clientSessions.getOrCreate({
|
|
925
|
+
user_identifier_key: userIdentifierKey
|
|
926
|
+
});
|
|
927
|
+
return _SeamHttpAcs.fromClientSessionToken(token, options);
|
|
928
|
+
}
|
|
929
|
+
get accessGroups() {
|
|
930
|
+
return SeamHttpAcsAccessGroups.fromClient(this.client);
|
|
931
|
+
}
|
|
932
|
+
get credentials() {
|
|
933
|
+
return SeamHttpAcsCredentials.fromClient(this.client);
|
|
934
|
+
}
|
|
935
|
+
get systems() {
|
|
936
|
+
return SeamHttpAcsSystems.fromClient(this.client);
|
|
937
|
+
}
|
|
938
|
+
get users() {
|
|
939
|
+
return SeamHttpAcsUsers.fromClient(this.client);
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
// src/lib/seam/connect/routes/action-attempts.ts
|
|
944
|
+
var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
|
|
945
|
+
constructor(apiKeyOrOptions = {}) {
|
|
946
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
947
|
+
this.client = createClient(clientOptions);
|
|
948
|
+
}
|
|
949
|
+
static fromClient(client, options = {}) {
|
|
950
|
+
const constructorOptions = { ...options, client };
|
|
951
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
952
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
953
|
+
}
|
|
954
|
+
return new _SeamHttpActionAttempts(constructorOptions);
|
|
955
|
+
}
|
|
956
|
+
static fromApiKey(apiKey, options = {}) {
|
|
957
|
+
const constructorOptions = { ...options, apiKey };
|
|
958
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
959
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
960
|
+
}
|
|
961
|
+
return new _SeamHttpActionAttempts(constructorOptions);
|
|
962
|
+
}
|
|
963
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
964
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
965
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
966
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
967
|
+
}
|
|
968
|
+
return new _SeamHttpActionAttempts(constructorOptions);
|
|
969
|
+
}
|
|
970
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
971
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
972
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
973
|
+
const client = createClient(clientOptions);
|
|
974
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
975
|
+
const { token } = await clientSessions.getOrCreate({
|
|
976
|
+
user_identifier_key: userIdentifierKey
|
|
977
|
+
});
|
|
978
|
+
return _SeamHttpActionAttempts.fromClientSessionToken(token, options);
|
|
979
|
+
}
|
|
980
|
+
async get(body) {
|
|
981
|
+
const { data } = await this.client.request({
|
|
982
|
+
url: "/action_attempts/get",
|
|
983
|
+
method: "post",
|
|
984
|
+
data: body
|
|
985
|
+
});
|
|
986
|
+
return data.action_attempt;
|
|
987
|
+
}
|
|
988
|
+
async list(body) {
|
|
989
|
+
const { data } = await this.client.request({
|
|
990
|
+
url: "/action_attempts/list",
|
|
991
|
+
method: "post",
|
|
992
|
+
data: body
|
|
993
|
+
});
|
|
994
|
+
return data.action_attempts;
|
|
164
995
|
}
|
|
165
996
|
};
|
|
166
997
|
|
|
167
|
-
// src/lib/seam/connect/
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
998
|
+
// src/lib/seam/connect/routes/connect-webviews.ts
|
|
999
|
+
var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
|
|
1000
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1001
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1002
|
+
this.client = createClient(clientOptions);
|
|
1003
|
+
}
|
|
1004
|
+
static fromClient(client, options = {}) {
|
|
1005
|
+
const constructorOptions = { ...options, client };
|
|
1006
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1007
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1008
|
+
}
|
|
1009
|
+
return new _SeamHttpConnectWebviews(constructorOptions);
|
|
1010
|
+
}
|
|
1011
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1012
|
+
const constructorOptions = { ...options, apiKey };
|
|
1013
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1014
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1015
|
+
}
|
|
1016
|
+
return new _SeamHttpConnectWebviews(constructorOptions);
|
|
1017
|
+
}
|
|
1018
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1019
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1020
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1021
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1022
|
+
}
|
|
1023
|
+
return new _SeamHttpConnectWebviews(constructorOptions);
|
|
1024
|
+
}
|
|
1025
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1026
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1027
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1028
|
+
const client = createClient(clientOptions);
|
|
1029
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1030
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1031
|
+
user_identifier_key: userIdentifierKey
|
|
1032
|
+
});
|
|
1033
|
+
return _SeamHttpConnectWebviews.fromClientSessionToken(token, options);
|
|
1034
|
+
}
|
|
1035
|
+
async create(body) {
|
|
1036
|
+
const { data } = await this.client.request({
|
|
1037
|
+
url: "/connect_webviews/create",
|
|
1038
|
+
method: "post",
|
|
1039
|
+
data: body
|
|
1040
|
+
});
|
|
1041
|
+
return data.connect_webview;
|
|
1042
|
+
}
|
|
1043
|
+
async delete(body) {
|
|
1044
|
+
await this.client.request({
|
|
1045
|
+
url: "/connect_webviews/delete",
|
|
1046
|
+
method: "post",
|
|
1047
|
+
data: body
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
async get(body) {
|
|
1051
|
+
const { data } = await this.client.request({
|
|
1052
|
+
url: "/connect_webviews/get",
|
|
1053
|
+
method: "post",
|
|
1054
|
+
data: body
|
|
1055
|
+
});
|
|
1056
|
+
return data.connect_webview;
|
|
1057
|
+
}
|
|
1058
|
+
async list(body) {
|
|
1059
|
+
const { data } = await this.client.request({
|
|
1060
|
+
url: "/connect_webviews/list",
|
|
1061
|
+
method: "post",
|
|
1062
|
+
data: body
|
|
1063
|
+
});
|
|
1064
|
+
return data.connect_webviews;
|
|
1065
|
+
}
|
|
1066
|
+
async view(params) {
|
|
1067
|
+
await this.client.request({
|
|
1068
|
+
url: "/connect_webviews/view",
|
|
1069
|
+
method: "get",
|
|
1070
|
+
params
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
// src/lib/seam/connect/routes/connected-accounts.ts
|
|
1076
|
+
var SeamHttpConnectedAccounts = class _SeamHttpConnectedAccounts {
|
|
1077
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1078
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1079
|
+
this.client = createClient(clientOptions);
|
|
1080
|
+
}
|
|
1081
|
+
static fromClient(client, options = {}) {
|
|
1082
|
+
const constructorOptions = { ...options, client };
|
|
1083
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1084
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1085
|
+
}
|
|
1086
|
+
return new _SeamHttpConnectedAccounts(constructorOptions);
|
|
1087
|
+
}
|
|
1088
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1089
|
+
const constructorOptions = { ...options, apiKey };
|
|
1090
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1091
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1092
|
+
}
|
|
1093
|
+
return new _SeamHttpConnectedAccounts(constructorOptions);
|
|
1094
|
+
}
|
|
1095
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1096
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1097
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1098
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1099
|
+
}
|
|
1100
|
+
return new _SeamHttpConnectedAccounts(constructorOptions);
|
|
1101
|
+
}
|
|
1102
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1103
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1104
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1105
|
+
const client = createClient(clientOptions);
|
|
1106
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1107
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1108
|
+
user_identifier_key: userIdentifierKey
|
|
1109
|
+
});
|
|
1110
|
+
return _SeamHttpConnectedAccounts.fromClientSessionToken(token, options);
|
|
1111
|
+
}
|
|
1112
|
+
async delete(body) {
|
|
1113
|
+
await this.client.request({
|
|
1114
|
+
url: "/connected_accounts/delete",
|
|
1115
|
+
method: "post",
|
|
1116
|
+
data: body
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
async get(body) {
|
|
1120
|
+
const { data } = await this.client.request({
|
|
1121
|
+
url: "/connected_accounts/get",
|
|
1122
|
+
method: "post",
|
|
1123
|
+
data: body
|
|
1124
|
+
});
|
|
1125
|
+
return data.connected_account;
|
|
1126
|
+
}
|
|
1127
|
+
async list(params) {
|
|
1128
|
+
const { data } = await this.client.request({
|
|
1129
|
+
url: "/connected_accounts/list",
|
|
1130
|
+
method: "get",
|
|
1131
|
+
params
|
|
1132
|
+
});
|
|
1133
|
+
return data.connected_accounts;
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
// src/lib/seam/connect/routes/devices-unmanaged.ts
|
|
1138
|
+
var SeamHttpDevicesUnmanaged = class _SeamHttpDevicesUnmanaged {
|
|
1139
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1140
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1141
|
+
this.client = createClient(clientOptions);
|
|
1142
|
+
}
|
|
1143
|
+
static fromClient(client, options = {}) {
|
|
1144
|
+
const constructorOptions = { ...options, client };
|
|
1145
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1146
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1147
|
+
}
|
|
1148
|
+
return new _SeamHttpDevicesUnmanaged(constructorOptions);
|
|
1149
|
+
}
|
|
1150
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1151
|
+
const constructorOptions = { ...options, apiKey };
|
|
1152
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1153
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1154
|
+
}
|
|
1155
|
+
return new _SeamHttpDevicesUnmanaged(constructorOptions);
|
|
1156
|
+
}
|
|
1157
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1158
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1159
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1160
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1161
|
+
}
|
|
1162
|
+
return new _SeamHttpDevicesUnmanaged(constructorOptions);
|
|
1163
|
+
}
|
|
1164
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1165
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1166
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1167
|
+
const client = createClient(clientOptions);
|
|
1168
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1169
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1170
|
+
user_identifier_key: userIdentifierKey
|
|
1171
|
+
});
|
|
1172
|
+
return _SeamHttpDevicesUnmanaged.fromClientSessionToken(token, options);
|
|
1173
|
+
}
|
|
1174
|
+
async get(body) {
|
|
1175
|
+
const { data } = await this.client.request({
|
|
1176
|
+
url: "/devices/unmanaged/get",
|
|
1177
|
+
method: "post",
|
|
1178
|
+
data: body
|
|
1179
|
+
});
|
|
1180
|
+
return data.device;
|
|
1181
|
+
}
|
|
1182
|
+
async list(body) {
|
|
1183
|
+
const { data } = await this.client.request({
|
|
1184
|
+
url: "/devices/unmanaged/list",
|
|
1185
|
+
method: "post",
|
|
1186
|
+
data: body
|
|
1187
|
+
});
|
|
1188
|
+
return data.devices;
|
|
1189
|
+
}
|
|
1190
|
+
async update(body) {
|
|
1191
|
+
await this.client.request({
|
|
1192
|
+
url: "/devices/unmanaged/update",
|
|
1193
|
+
method: "post",
|
|
1194
|
+
data: body
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
|
|
1199
|
+
// src/lib/seam/connect/routes/devices.ts
|
|
1200
|
+
var SeamHttpDevices = class _SeamHttpDevices {
|
|
1201
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1202
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1203
|
+
this.client = createClient(clientOptions);
|
|
1204
|
+
}
|
|
1205
|
+
static fromClient(client, options = {}) {
|
|
1206
|
+
const constructorOptions = { ...options, client };
|
|
1207
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1208
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1209
|
+
}
|
|
1210
|
+
return new _SeamHttpDevices(constructorOptions);
|
|
1211
|
+
}
|
|
1212
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1213
|
+
const constructorOptions = { ...options, apiKey };
|
|
1214
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1215
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1216
|
+
}
|
|
1217
|
+
return new _SeamHttpDevices(constructorOptions);
|
|
1218
|
+
}
|
|
1219
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1220
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1221
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1222
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1223
|
+
}
|
|
1224
|
+
return new _SeamHttpDevices(constructorOptions);
|
|
1225
|
+
}
|
|
1226
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1227
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1228
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1229
|
+
const client = createClient(clientOptions);
|
|
1230
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1231
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1232
|
+
user_identifier_key: userIdentifierKey
|
|
1233
|
+
});
|
|
1234
|
+
return _SeamHttpDevices.fromClientSessionToken(token, options);
|
|
1235
|
+
}
|
|
1236
|
+
get unmanaged() {
|
|
1237
|
+
return SeamHttpDevicesUnmanaged.fromClient(this.client);
|
|
1238
|
+
}
|
|
1239
|
+
async delete(body) {
|
|
1240
|
+
await this.client.request({
|
|
1241
|
+
url: "/devices/delete",
|
|
1242
|
+
method: "post",
|
|
1243
|
+
data: body
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
async get(body) {
|
|
1247
|
+
const { data } = await this.client.request({
|
|
1248
|
+
url: "/devices/get",
|
|
1249
|
+
method: "post",
|
|
1250
|
+
data: body
|
|
1251
|
+
});
|
|
1252
|
+
return data.device;
|
|
1253
|
+
}
|
|
1254
|
+
async list(body) {
|
|
1255
|
+
const { data } = await this.client.request({
|
|
1256
|
+
url: "/devices/list",
|
|
1257
|
+
method: "post",
|
|
1258
|
+
data: body
|
|
1259
|
+
});
|
|
1260
|
+
return data.devices;
|
|
1261
|
+
}
|
|
1262
|
+
async listDeviceProviders(body) {
|
|
1263
|
+
const { data } = await this.client.request({
|
|
1264
|
+
url: "/devices/list_device_providers",
|
|
1265
|
+
method: "post",
|
|
1266
|
+
data: body
|
|
1267
|
+
});
|
|
1268
|
+
return data.device_providers;
|
|
1269
|
+
}
|
|
1270
|
+
async update(body) {
|
|
1271
|
+
await this.client.request({
|
|
1272
|
+
url: "/devices/update",
|
|
1273
|
+
method: "post",
|
|
1274
|
+
data: body
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
// src/lib/seam/connect/routes/events.ts
|
|
1280
|
+
var SeamHttpEvents = class _SeamHttpEvents {
|
|
1281
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1282
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1283
|
+
this.client = createClient(clientOptions);
|
|
1284
|
+
}
|
|
1285
|
+
static fromClient(client, options = {}) {
|
|
1286
|
+
const constructorOptions = { ...options, client };
|
|
1287
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1288
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1289
|
+
}
|
|
1290
|
+
return new _SeamHttpEvents(constructorOptions);
|
|
1291
|
+
}
|
|
1292
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1293
|
+
const constructorOptions = { ...options, apiKey };
|
|
1294
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1295
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1296
|
+
}
|
|
1297
|
+
return new _SeamHttpEvents(constructorOptions);
|
|
1298
|
+
}
|
|
1299
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1300
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1301
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1302
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1303
|
+
}
|
|
1304
|
+
return new _SeamHttpEvents(constructorOptions);
|
|
1305
|
+
}
|
|
1306
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1307
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1308
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1309
|
+
const client = createClient(clientOptions);
|
|
1310
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1311
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1312
|
+
user_identifier_key: userIdentifierKey
|
|
1313
|
+
});
|
|
1314
|
+
return _SeamHttpEvents.fromClientSessionToken(token, options);
|
|
1315
|
+
}
|
|
1316
|
+
async get(body) {
|
|
1317
|
+
const { data } = await this.client.request({
|
|
1318
|
+
url: "/events/get",
|
|
1319
|
+
method: "post",
|
|
1320
|
+
data: body
|
|
1321
|
+
});
|
|
1322
|
+
return data.event;
|
|
1323
|
+
}
|
|
1324
|
+
async list(body) {
|
|
1325
|
+
const { data } = await this.client.request({
|
|
1326
|
+
url: "/events/list",
|
|
1327
|
+
method: "post",
|
|
1328
|
+
data: body
|
|
1329
|
+
});
|
|
1330
|
+
return data.events;
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
// src/lib/seam/connect/routes/locks.ts
|
|
1335
|
+
var SeamHttpLocks = class _SeamHttpLocks {
|
|
1336
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1337
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1338
|
+
this.client = createClient(clientOptions);
|
|
1339
|
+
}
|
|
1340
|
+
static fromClient(client, options = {}) {
|
|
1341
|
+
const constructorOptions = { ...options, client };
|
|
1342
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1343
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1344
|
+
}
|
|
1345
|
+
return new _SeamHttpLocks(constructorOptions);
|
|
1346
|
+
}
|
|
1347
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1348
|
+
const constructorOptions = { ...options, apiKey };
|
|
1349
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1350
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1351
|
+
}
|
|
1352
|
+
return new _SeamHttpLocks(constructorOptions);
|
|
1353
|
+
}
|
|
1354
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1355
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1356
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1357
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1358
|
+
}
|
|
1359
|
+
return new _SeamHttpLocks(constructorOptions);
|
|
1360
|
+
}
|
|
1361
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1362
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1363
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1364
|
+
const client = createClient(clientOptions);
|
|
1365
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1366
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1367
|
+
user_identifier_key: userIdentifierKey
|
|
1368
|
+
});
|
|
1369
|
+
return _SeamHttpLocks.fromClientSessionToken(token, options);
|
|
1370
|
+
}
|
|
1371
|
+
async get(body) {
|
|
1372
|
+
const { data } = await this.client.request({
|
|
1373
|
+
url: "/locks/get",
|
|
1374
|
+
method: "post",
|
|
1375
|
+
data: body
|
|
1376
|
+
});
|
|
1377
|
+
return data.device;
|
|
1378
|
+
}
|
|
1379
|
+
async list(body) {
|
|
1380
|
+
const { data } = await this.client.request({
|
|
1381
|
+
url: "/locks/list",
|
|
1382
|
+
method: "post",
|
|
1383
|
+
data: body
|
|
1384
|
+
});
|
|
1385
|
+
return data.devices;
|
|
1386
|
+
}
|
|
1387
|
+
async lockDoor(body) {
|
|
1388
|
+
const { data } = await this.client.request({
|
|
1389
|
+
url: "/locks/lock_door",
|
|
1390
|
+
method: "post",
|
|
1391
|
+
data: body
|
|
1392
|
+
});
|
|
1393
|
+
return data.action_attempt;
|
|
1394
|
+
}
|
|
1395
|
+
async unlockDoor(body) {
|
|
1396
|
+
const { data } = await this.client.request({
|
|
1397
|
+
url: "/locks/unlock_door",
|
|
1398
|
+
method: "post",
|
|
1399
|
+
data: body
|
|
1400
|
+
});
|
|
1401
|
+
return data.action_attempt;
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
// src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts
|
|
1406
|
+
var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresholds {
|
|
1407
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1408
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1409
|
+
this.client = createClient(clientOptions);
|
|
1410
|
+
}
|
|
1411
|
+
static fromClient(client, options = {}) {
|
|
1412
|
+
const constructorOptions = { ...options, client };
|
|
1413
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1414
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1415
|
+
}
|
|
1416
|
+
return new _SeamHttpNoiseSensorsNoiseThresholds(constructorOptions);
|
|
1417
|
+
}
|
|
1418
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1419
|
+
const constructorOptions = { ...options, apiKey };
|
|
1420
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1421
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1422
|
+
}
|
|
1423
|
+
return new _SeamHttpNoiseSensorsNoiseThresholds(constructorOptions);
|
|
1424
|
+
}
|
|
1425
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1426
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1427
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1428
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1429
|
+
}
|
|
1430
|
+
return new _SeamHttpNoiseSensorsNoiseThresholds(constructorOptions);
|
|
1431
|
+
}
|
|
1432
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1433
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1434
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1435
|
+
const client = createClient(clientOptions);
|
|
1436
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1437
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1438
|
+
user_identifier_key: userIdentifierKey
|
|
1439
|
+
});
|
|
1440
|
+
return _SeamHttpNoiseSensorsNoiseThresholds.fromClientSessionToken(
|
|
1441
|
+
token,
|
|
1442
|
+
options
|
|
1443
|
+
);
|
|
1444
|
+
}
|
|
1445
|
+
async create(body) {
|
|
1446
|
+
await this.client.request({
|
|
1447
|
+
url: "/noise_sensors/noise_thresholds/create",
|
|
1448
|
+
method: "post",
|
|
1449
|
+
data: body
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
async delete(body) {
|
|
1453
|
+
await this.client.request({
|
|
1454
|
+
url: "/noise_sensors/noise_thresholds/delete",
|
|
1455
|
+
method: "post",
|
|
1456
|
+
data: body
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
async get(body) {
|
|
1460
|
+
const { data } = await this.client.request({
|
|
1461
|
+
url: "/noise_sensors/noise_thresholds/get",
|
|
1462
|
+
method: "post",
|
|
1463
|
+
data: body
|
|
1464
|
+
});
|
|
1465
|
+
return data.noise_threshold;
|
|
1466
|
+
}
|
|
1467
|
+
async list(body) {
|
|
1468
|
+
const { data } = await this.client.request({
|
|
1469
|
+
url: "/noise_sensors/noise_thresholds/list",
|
|
1470
|
+
method: "post",
|
|
1471
|
+
data: body
|
|
1472
|
+
});
|
|
1473
|
+
return data.noise_thresholds;
|
|
1474
|
+
}
|
|
1475
|
+
async update(body) {
|
|
1476
|
+
await this.client.request({
|
|
1477
|
+
url: "/noise_sensors/noise_thresholds/update",
|
|
1478
|
+
method: "post",
|
|
1479
|
+
data: body
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1484
|
+
// src/lib/seam/connect/routes/noise-sensors.ts
|
|
1485
|
+
var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
|
|
1486
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1487
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1488
|
+
this.client = createClient(clientOptions);
|
|
1489
|
+
}
|
|
1490
|
+
static fromClient(client, options = {}) {
|
|
1491
|
+
const constructorOptions = { ...options, client };
|
|
1492
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1493
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1494
|
+
}
|
|
1495
|
+
return new _SeamHttpNoiseSensors(constructorOptions);
|
|
1496
|
+
}
|
|
1497
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1498
|
+
const constructorOptions = { ...options, apiKey };
|
|
1499
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1500
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1501
|
+
}
|
|
1502
|
+
return new _SeamHttpNoiseSensors(constructorOptions);
|
|
1503
|
+
}
|
|
1504
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1505
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1506
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1507
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1508
|
+
}
|
|
1509
|
+
return new _SeamHttpNoiseSensors(constructorOptions);
|
|
1510
|
+
}
|
|
1511
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1512
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1513
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1514
|
+
const client = createClient(clientOptions);
|
|
1515
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1516
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1517
|
+
user_identifier_key: userIdentifierKey
|
|
1518
|
+
});
|
|
1519
|
+
return _SeamHttpNoiseSensors.fromClientSessionToken(token, options);
|
|
1520
|
+
}
|
|
1521
|
+
get noiseThresholds() {
|
|
1522
|
+
return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client);
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
// src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts
|
|
1527
|
+
var SeamHttpThermostatsClimateSettingSchedules = class _SeamHttpThermostatsClimateSettingSchedules {
|
|
1528
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1529
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1530
|
+
this.client = createClient(clientOptions);
|
|
1531
|
+
}
|
|
1532
|
+
static fromClient(client, options = {}) {
|
|
1533
|
+
const constructorOptions = { ...options, client };
|
|
1534
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1535
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1536
|
+
}
|
|
1537
|
+
return new _SeamHttpThermostatsClimateSettingSchedules(constructorOptions);
|
|
1538
|
+
}
|
|
1539
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1540
|
+
const constructorOptions = { ...options, apiKey };
|
|
1541
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1542
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1543
|
+
}
|
|
1544
|
+
return new _SeamHttpThermostatsClimateSettingSchedules(constructorOptions);
|
|
1545
|
+
}
|
|
1546
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1547
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1548
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1549
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1550
|
+
}
|
|
1551
|
+
return new _SeamHttpThermostatsClimateSettingSchedules(constructorOptions);
|
|
1552
|
+
}
|
|
1553
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1554
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1555
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1556
|
+
const client = createClient(clientOptions);
|
|
1557
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1558
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1559
|
+
user_identifier_key: userIdentifierKey
|
|
1560
|
+
});
|
|
1561
|
+
return _SeamHttpThermostatsClimateSettingSchedules.fromClientSessionToken(
|
|
1562
|
+
token,
|
|
1563
|
+
options
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
async create(body) {
|
|
1567
|
+
const { data } = await this.client.request(
|
|
172
1568
|
{
|
|
173
|
-
|
|
1569
|
+
url: "/thermostats/climate_setting_schedules/create",
|
|
1570
|
+
method: "post",
|
|
1571
|
+
data: body
|
|
174
1572
|
}
|
|
175
1573
|
);
|
|
1574
|
+
return data.climate_setting_schedule;
|
|
1575
|
+
}
|
|
1576
|
+
async delete(body) {
|
|
1577
|
+
await this.client.request(
|
|
1578
|
+
{
|
|
1579
|
+
url: "/thermostats/climate_setting_schedules/delete",
|
|
1580
|
+
method: "post",
|
|
1581
|
+
data: body
|
|
1582
|
+
}
|
|
1583
|
+
);
|
|
1584
|
+
}
|
|
1585
|
+
async get(body) {
|
|
1586
|
+
const { data } = await this.client.request({
|
|
1587
|
+
url: "/thermostats/climate_setting_schedules/get",
|
|
1588
|
+
method: "post",
|
|
1589
|
+
data: body
|
|
1590
|
+
});
|
|
1591
|
+
return data.climate_setting_schedule;
|
|
1592
|
+
}
|
|
1593
|
+
async list(body) {
|
|
1594
|
+
const { data } = await this.client.request(
|
|
1595
|
+
{
|
|
1596
|
+
url: "/thermostats/climate_setting_schedules/list",
|
|
1597
|
+
method: "post",
|
|
1598
|
+
data: body
|
|
1599
|
+
}
|
|
1600
|
+
);
|
|
1601
|
+
return data.climate_setting_schedules;
|
|
1602
|
+
}
|
|
1603
|
+
async update(body) {
|
|
1604
|
+
await this.client.request(
|
|
1605
|
+
{
|
|
1606
|
+
url: "/thermostats/climate_setting_schedules/update",
|
|
1607
|
+
method: "post",
|
|
1608
|
+
data: body
|
|
1609
|
+
}
|
|
1610
|
+
);
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
// src/lib/seam/connect/routes/thermostats.ts
|
|
1615
|
+
var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
1616
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1617
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1618
|
+
this.client = createClient(clientOptions);
|
|
1619
|
+
}
|
|
1620
|
+
static fromClient(client, options = {}) {
|
|
1621
|
+
const constructorOptions = { ...options, client };
|
|
1622
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1623
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1624
|
+
}
|
|
1625
|
+
return new _SeamHttpThermostats(constructorOptions);
|
|
1626
|
+
}
|
|
1627
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1628
|
+
const constructorOptions = { ...options, apiKey };
|
|
1629
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1630
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1631
|
+
}
|
|
1632
|
+
return new _SeamHttpThermostats(constructorOptions);
|
|
1633
|
+
}
|
|
1634
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1635
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1636
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1637
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1638
|
+
}
|
|
1639
|
+
return new _SeamHttpThermostats(constructorOptions);
|
|
1640
|
+
}
|
|
1641
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1642
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1643
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1644
|
+
const client = createClient(clientOptions);
|
|
1645
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1646
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1647
|
+
user_identifier_key: userIdentifierKey
|
|
1648
|
+
});
|
|
1649
|
+
return _SeamHttpThermostats.fromClientSessionToken(token, options);
|
|
1650
|
+
}
|
|
1651
|
+
get climateSettingSchedules() {
|
|
1652
|
+
return SeamHttpThermostatsClimateSettingSchedules.fromClient(this.client);
|
|
1653
|
+
}
|
|
1654
|
+
async cool(body) {
|
|
1655
|
+
await this.client.request({
|
|
1656
|
+
url: "/thermostats/cool",
|
|
1657
|
+
method: "post",
|
|
1658
|
+
data: body
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
async get(body) {
|
|
1662
|
+
const { data } = await this.client.request({
|
|
1663
|
+
url: "/thermostats/get",
|
|
1664
|
+
method: "post",
|
|
1665
|
+
data: body
|
|
1666
|
+
});
|
|
1667
|
+
return data.thermostat;
|
|
1668
|
+
}
|
|
1669
|
+
async heat(body) {
|
|
1670
|
+
await this.client.request({
|
|
1671
|
+
url: "/thermostats/heat",
|
|
1672
|
+
method: "post",
|
|
1673
|
+
data: body
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
async heatCool(body) {
|
|
1677
|
+
await this.client.request({
|
|
1678
|
+
url: "/thermostats/heat_cool",
|
|
1679
|
+
method: "post",
|
|
1680
|
+
data: body
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
async list(body) {
|
|
1684
|
+
const { data } = await this.client.request({
|
|
1685
|
+
url: "/thermostats/list",
|
|
1686
|
+
method: "post",
|
|
1687
|
+
data: body
|
|
1688
|
+
});
|
|
1689
|
+
return data.thermostats;
|
|
1690
|
+
}
|
|
1691
|
+
async off(body) {
|
|
1692
|
+
await this.client.request({
|
|
1693
|
+
url: "/thermostats/off",
|
|
1694
|
+
method: "post",
|
|
1695
|
+
data: body
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
async setFanMode(body) {
|
|
1699
|
+
await this.client.request({
|
|
1700
|
+
url: "/thermostats/set_fan_mode",
|
|
1701
|
+
method: "post",
|
|
1702
|
+
data: body
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
async update(body) {
|
|
1706
|
+
await this.client.request({
|
|
1707
|
+
url: "/thermostats/update",
|
|
1708
|
+
method: "post",
|
|
1709
|
+
data: body
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1714
|
+
// src/lib/seam/connect/routes/webhooks.ts
|
|
1715
|
+
var SeamHttpWebhooks = class _SeamHttpWebhooks {
|
|
1716
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1717
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1718
|
+
this.client = createClient(clientOptions);
|
|
1719
|
+
}
|
|
1720
|
+
static fromClient(client, options = {}) {
|
|
1721
|
+
const constructorOptions = { ...options, client };
|
|
1722
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1723
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1724
|
+
}
|
|
1725
|
+
return new _SeamHttpWebhooks(constructorOptions);
|
|
1726
|
+
}
|
|
1727
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1728
|
+
const constructorOptions = { ...options, apiKey };
|
|
1729
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1730
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1731
|
+
}
|
|
1732
|
+
return new _SeamHttpWebhooks(constructorOptions);
|
|
1733
|
+
}
|
|
1734
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1735
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1736
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1737
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1738
|
+
}
|
|
1739
|
+
return new _SeamHttpWebhooks(constructorOptions);
|
|
1740
|
+
}
|
|
1741
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1742
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1743
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1744
|
+
const client = createClient(clientOptions);
|
|
1745
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1746
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1747
|
+
user_identifier_key: userIdentifierKey
|
|
1748
|
+
});
|
|
1749
|
+
return _SeamHttpWebhooks.fromClientSessionToken(token, options);
|
|
1750
|
+
}
|
|
1751
|
+
async create(body) {
|
|
1752
|
+
const { data } = await this.client.request({
|
|
1753
|
+
url: "/webhooks/create",
|
|
1754
|
+
method: "post",
|
|
1755
|
+
data: body
|
|
1756
|
+
});
|
|
1757
|
+
return data.webhook;
|
|
1758
|
+
}
|
|
1759
|
+
async delete(body) {
|
|
1760
|
+
await this.client.request({
|
|
1761
|
+
url: "/webhooks/delete",
|
|
1762
|
+
method: "post",
|
|
1763
|
+
data: body
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
async get(body) {
|
|
1767
|
+
const { data } = await this.client.request({
|
|
1768
|
+
url: "/webhooks/get",
|
|
1769
|
+
method: "post",
|
|
1770
|
+
data: body
|
|
1771
|
+
});
|
|
1772
|
+
return data.webhook;
|
|
1773
|
+
}
|
|
1774
|
+
async list(params) {
|
|
1775
|
+
const { data } = await this.client.request({
|
|
1776
|
+
url: "/webhooks/list",
|
|
1777
|
+
method: "get",
|
|
1778
|
+
params
|
|
1779
|
+
});
|
|
1780
|
+
return data.webhooks;
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
// src/lib/seam/connect/routes/workspaces.ts
|
|
1785
|
+
var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
|
|
1786
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1787
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1788
|
+
this.client = createClient(clientOptions);
|
|
1789
|
+
}
|
|
1790
|
+
static fromClient(client, options = {}) {
|
|
1791
|
+
const constructorOptions = { ...options, client };
|
|
1792
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1793
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1794
|
+
}
|
|
1795
|
+
return new _SeamHttpWorkspaces(constructorOptions);
|
|
1796
|
+
}
|
|
1797
|
+
static fromApiKey(apiKey, options = {}) {
|
|
1798
|
+
const constructorOptions = { ...options, apiKey };
|
|
1799
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1800
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
1801
|
+
}
|
|
1802
|
+
return new _SeamHttpWorkspaces(constructorOptions);
|
|
1803
|
+
}
|
|
1804
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
1805
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1806
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1807
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
1808
|
+
}
|
|
1809
|
+
return new _SeamHttpWorkspaces(constructorOptions);
|
|
1810
|
+
}
|
|
1811
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1812
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1813
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1814
|
+
const client = createClient(clientOptions);
|
|
1815
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1816
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1817
|
+
user_identifier_key: userIdentifierKey
|
|
1818
|
+
});
|
|
1819
|
+
return _SeamHttpWorkspaces.fromClientSessionToken(token, options);
|
|
1820
|
+
}
|
|
1821
|
+
async get(params) {
|
|
1822
|
+
const { data } = await this.client.request({
|
|
1823
|
+
url: "/workspaces/get",
|
|
1824
|
+
method: "get",
|
|
1825
|
+
params
|
|
1826
|
+
});
|
|
176
1827
|
return data.workspace;
|
|
177
1828
|
}
|
|
1829
|
+
async list(params) {
|
|
1830
|
+
const { data } = await this.client.request({
|
|
1831
|
+
url: "/workspaces/list",
|
|
1832
|
+
method: "get",
|
|
1833
|
+
params
|
|
1834
|
+
});
|
|
1835
|
+
return data.workspaces;
|
|
1836
|
+
}
|
|
1837
|
+
async resetSandbox(body) {
|
|
1838
|
+
await this.client.request({
|
|
1839
|
+
url: "/workspaces/reset_sandbox",
|
|
1840
|
+
method: "post",
|
|
1841
|
+
data: body
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
178
1844
|
};
|
|
179
1845
|
|
|
180
|
-
// src/lib/seam/connect/
|
|
181
|
-
var
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
1846
|
+
// src/lib/seam/connect/seam-http.ts
|
|
1847
|
+
var SeamHttp = class _SeamHttp {
|
|
1848
|
+
constructor(apiKeyOrOptions = {}) {
|
|
1849
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
1850
|
+
this.client = createClient(clientOptions);
|
|
1851
|
+
}
|
|
1852
|
+
static fromClient(client, options = {}) {
|
|
1853
|
+
const constructorOptions = { ...options, client };
|
|
1854
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
1855
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
1856
|
+
}
|
|
1857
|
+
return new _SeamHttp(constructorOptions);
|
|
188
1858
|
}
|
|
189
1859
|
static fromApiKey(apiKey, options = {}) {
|
|
190
|
-
const
|
|
191
|
-
if (!isSeamHttpOptionsWithApiKey(
|
|
192
|
-
throw new
|
|
1860
|
+
const constructorOptions = { ...options, apiKey };
|
|
1861
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
1862
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
193
1863
|
}
|
|
194
|
-
return new _SeamHttp(
|
|
1864
|
+
return new _SeamHttp(constructorOptions);
|
|
195
1865
|
}
|
|
196
1866
|
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
197
|
-
const
|
|
198
|
-
if (!isSeamHttpOptionsWithClientSessionToken(
|
|
199
|
-
throw new
|
|
1867
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
1868
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
1869
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
200
1870
|
}
|
|
201
|
-
return new _SeamHttp(
|
|
1871
|
+
return new _SeamHttp(constructorOptions);
|
|
1872
|
+
}
|
|
1873
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
1874
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
1875
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
1876
|
+
const client = createClient(clientOptions);
|
|
1877
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
1878
|
+
const { token } = await clientSessions.getOrCreate({
|
|
1879
|
+
user_identifier_key: userIdentifierKey
|
|
1880
|
+
});
|
|
1881
|
+
return _SeamHttp.fromClientSessionToken(token, options);
|
|
1882
|
+
}
|
|
1883
|
+
get accessCodes() {
|
|
1884
|
+
return SeamHttpAccessCodes.fromClient(this.client);
|
|
1885
|
+
}
|
|
1886
|
+
get acs() {
|
|
1887
|
+
return SeamHttpAcs.fromClient(this.client);
|
|
1888
|
+
}
|
|
1889
|
+
get actionAttempts() {
|
|
1890
|
+
return SeamHttpActionAttempts.fromClient(this.client);
|
|
1891
|
+
}
|
|
1892
|
+
get clientSessions() {
|
|
1893
|
+
return SeamHttpClientSessions.fromClient(this.client);
|
|
1894
|
+
}
|
|
1895
|
+
get connectedAccounts() {
|
|
1896
|
+
return SeamHttpConnectedAccounts.fromClient(this.client);
|
|
1897
|
+
}
|
|
1898
|
+
get connectWebviews() {
|
|
1899
|
+
return SeamHttpConnectWebviews.fromClient(this.client);
|
|
1900
|
+
}
|
|
1901
|
+
get devices() {
|
|
1902
|
+
return SeamHttpDevices.fromClient(this.client);
|
|
1903
|
+
}
|
|
1904
|
+
get events() {
|
|
1905
|
+
return SeamHttpEvents.fromClient(this.client);
|
|
1906
|
+
}
|
|
1907
|
+
get locks() {
|
|
1908
|
+
return SeamHttpLocks.fromClient(this.client);
|
|
1909
|
+
}
|
|
1910
|
+
get noiseSensors() {
|
|
1911
|
+
return SeamHttpNoiseSensors.fromClient(this.client);
|
|
1912
|
+
}
|
|
1913
|
+
get thermostats() {
|
|
1914
|
+
return SeamHttpThermostats.fromClient(this.client);
|
|
1915
|
+
}
|
|
1916
|
+
get webhooks() {
|
|
1917
|
+
return SeamHttpWebhooks.fromClient(this.client);
|
|
202
1918
|
}
|
|
203
|
-
// TODO
|
|
204
|
-
// static fromPublishableKey and deprecate getClientSessionToken
|
|
205
|
-
// TODO: Should we keep makeRequest?
|
|
206
|
-
// Better to implement error handling and wrapping in an error handler.
|
|
207
|
-
// makeRequest
|
|
208
1919
|
get workspaces() {
|
|
209
|
-
|
|
210
|
-
return new LegacyWorkspacesHttp(this.client);
|
|
211
|
-
return new WorkspacesHttp(this.client);
|
|
1920
|
+
return SeamHttpWorkspaces.fromClient(this.client);
|
|
212
1921
|
}
|
|
213
1922
|
};
|
|
214
|
-
_legacy = new WeakMap();
|
|
215
|
-
var SeamHttp = _SeamHttp;
|
|
216
1923
|
|
|
217
1924
|
exports.SeamHttp = SeamHttp;
|
|
1925
|
+
exports.SeamHttpInvalidOptionsError = SeamHttpInvalidOptionsError;
|
|
1926
|
+
exports.isSeamHttpOptionsWithApiKey = isSeamHttpOptionsWithApiKey;
|
|
1927
|
+
exports.isSeamHttpOptionsWithClient = isSeamHttpOptionsWithClient;
|
|
1928
|
+
exports.isSeamHttpOptionsWithClientSessionToken = isSeamHttpOptionsWithClientSessionToken;
|
|
218
1929
|
//# sourceMappingURL=out.js.map
|
|
219
1930
|
//# sourceMappingURL=connect.cjs.map
|