@seamapi/http 0.14.0 → 0.15.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/README.md +3 -3
- package/dist/connect.cjs +35 -16
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +16 -12
- package/lib/seam/connect/parse-options.js +9 -0
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/routes/acs-users.d.ts +4 -0
- package/lib/seam/connect/routes/acs-users.js +8 -0
- package/lib/seam/connect/routes/acs-users.js.map +1 -1
- package/lib/seam/connect/routes/connected-accounts.d.ts +3 -3
- package/lib/seam/connect/routes/connected-accounts.js +3 -3
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +1 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +2 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
- package/lib/seam/connect/routes/user-identities.d.ts +3 -3
- package/lib/seam/connect/routes/user-identities.js +3 -3
- package/lib/seam/connect/routes/user-identities.js.map +1 -1
- package/lib/seam/connect/routes/webhooks.d.ts +3 -3
- package/lib/seam/connect/routes/webhooks.js +3 -3
- package/lib/seam/connect/routes/webhooks.js.map +1 -1
- package/lib/seam/connect/routes/workspaces.d.ts +5 -5
- package/lib/seam/connect/routes/workspaces.js +6 -6
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/lib/seam/connect/parse-options.ts +17 -0
- package/src/lib/seam/connect/routes/acs-users.ts +22 -0
- package/src/lib/seam/connect/routes/connected-accounts.ts +5 -9
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +11 -6
- package/src/lib/seam/connect/routes/user-identities.ts +5 -10
- package/src/lib/seam/connect/routes/webhooks.ts +5 -9
- package/src/lib/seam/connect/routes/workspaces.ts +9 -13
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/http",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "JavaScript HTTP client for the Seam API written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"npm": ">= 9.0.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@seamapi/types": "^1.
|
|
87
|
+
"@seamapi/types": "^1.88.0",
|
|
88
88
|
"type-fest": "^4.0.0"
|
|
89
89
|
},
|
|
90
90
|
"peerDependenciesMeta": {
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@seamapi/fake-seam-connect": "^1.44.2",
|
|
106
|
-
"@seamapi/types": "^1.
|
|
106
|
+
"@seamapi/types": "^1.88.0",
|
|
107
107
|
"@types/eslint": "^8.44.2",
|
|
108
108
|
"@types/node": "^20.8.10",
|
|
109
109
|
"ava": "^5.0.1",
|
|
@@ -97,6 +97,23 @@ const getApiKeyFromEnv = (
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
const getEndpointFromEnv = (): string | null | undefined => {
|
|
100
|
+
if (globalThis.process?.env?.SEAM_API_URL != null) {
|
|
101
|
+
// eslint-disable-next-line no-console
|
|
102
|
+
console.warn(
|
|
103
|
+
'Using the SEAM_API_URL environment variable is deprecated. Support will be remove in a later major version. Use SEAM_ENDPOINT instead.',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (
|
|
108
|
+
globalThis.process?.env?.SEAM_API_URL != null &&
|
|
109
|
+
globalThis.process?.env?.SEAM_ENDPOINT != null
|
|
110
|
+
) {
|
|
111
|
+
// eslint-disable-next-line no-console
|
|
112
|
+
console.warn(
|
|
113
|
+
'Detected both the SEAM_API_URL and SEAM_ENDPOINT environment variables. Using SEAM_ENDPOINT.',
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
100
117
|
return (
|
|
101
118
|
globalThis.process?.env?.SEAM_ENDPOINT ??
|
|
102
119
|
globalThis.process?.env?.SEAM_API_URL
|
|
@@ -183,6 +183,19 @@ export class SeamHttpAcsUsers {
|
|
|
183
183
|
return data.acs_users
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
async listAccessibleEntrances(
|
|
187
|
+
body?: AcsUsersListAccessibleEntrancesParams,
|
|
188
|
+
): Promise<AcsUsersListAccessibleEntrancesResponse['acs_entrances']> {
|
|
189
|
+
const { data } =
|
|
190
|
+
await this.client.request<AcsUsersListAccessibleEntrancesResponse>({
|
|
191
|
+
url: '/acs/users/list_accessible_entrances',
|
|
192
|
+
method: 'post',
|
|
193
|
+
data: body,
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
return data.acs_entrances
|
|
197
|
+
}
|
|
198
|
+
|
|
186
199
|
async removeFromAccessGroup(
|
|
187
200
|
body?: AcsUsersRemoveFromAccessGroupBody,
|
|
188
201
|
): Promise<void> {
|
|
@@ -259,6 +272,15 @@ export type AcsUsersListResponse = SetNonNullable<
|
|
|
259
272
|
|
|
260
273
|
export type AcsUsersListOptions = never
|
|
261
274
|
|
|
275
|
+
export type AcsUsersListAccessibleEntrancesParams =
|
|
276
|
+
RouteRequestBody<'/acs/users/list_accessible_entrances'>
|
|
277
|
+
|
|
278
|
+
export type AcsUsersListAccessibleEntrancesResponse = SetNonNullable<
|
|
279
|
+
Required<RouteResponse<'/acs/users/list_accessible_entrances'>>
|
|
280
|
+
>
|
|
281
|
+
|
|
282
|
+
export type AcsUsersListAccessibleEntrancesOptions = never
|
|
283
|
+
|
|
262
284
|
export type AcsUsersRemoveFromAccessGroupBody =
|
|
263
285
|
RouteRequestBody<'/acs/users/remove_from_access_group'>
|
|
264
286
|
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* Do not edit this file or add other files to this directory.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
RouteRequestBody,
|
|
8
|
-
RouteRequestParams,
|
|
9
|
-
RouteResponse,
|
|
10
|
-
} from '@seamapi/types/connect'
|
|
6
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
|
|
11
7
|
import type { SetNonNullable } from 'type-fest'
|
|
12
8
|
|
|
13
9
|
import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
|
|
@@ -156,12 +152,12 @@ export class SeamHttpConnectedAccounts {
|
|
|
156
152
|
}
|
|
157
153
|
|
|
158
154
|
async list(
|
|
159
|
-
|
|
155
|
+
body?: ConnectedAccountsListParams,
|
|
160
156
|
): Promise<ConnectedAccountsListResponse['connected_accounts']> {
|
|
161
157
|
const { data } = await this.client.request<ConnectedAccountsListResponse>({
|
|
162
158
|
url: '/connected_accounts/list',
|
|
163
|
-
method: '
|
|
164
|
-
|
|
159
|
+
method: 'post',
|
|
160
|
+
data: body,
|
|
165
161
|
})
|
|
166
162
|
|
|
167
163
|
return data.connected_accounts
|
|
@@ -201,7 +197,7 @@ export type ConnectedAccountsGetResponse = SetNonNullable<
|
|
|
201
197
|
export type ConnectedAccountsGetOptions = never
|
|
202
198
|
|
|
203
199
|
export type ConnectedAccountsListParams =
|
|
204
|
-
|
|
200
|
+
RouteRequestBody<'/connected_accounts/list'>
|
|
205
201
|
|
|
206
202
|
export type ConnectedAccountsListResponse = SetNonNullable<
|
|
207
203
|
Required<RouteResponse<'/connected_accounts/list'>>
|
|
@@ -134,12 +134,17 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
134
134
|
return new SeamHttpNoiseSensorsNoiseThresholds(constructorOptions)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
async create(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
async create(
|
|
138
|
+
body?: NoiseSensorsNoiseThresholdsCreateBody,
|
|
139
|
+
): Promise<NoiseSensorsNoiseThresholdsCreateResponse['noise_threshold']> {
|
|
140
|
+
const { data } =
|
|
141
|
+
await this.client.request<NoiseSensorsNoiseThresholdsCreateResponse>({
|
|
142
|
+
url: '/noise_sensors/noise_thresholds/create',
|
|
143
|
+
method: 'post',
|
|
144
|
+
data: body,
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
return data.noise_threshold
|
|
143
148
|
}
|
|
144
149
|
|
|
145
150
|
async delete(body?: NoiseSensorsNoiseThresholdsDeleteBody): Promise<void> {
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* Do not edit this file or add other files to this directory.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
RouteRequestBody,
|
|
8
|
-
RouteRequestParams,
|
|
9
|
-
RouteResponse,
|
|
10
|
-
} from '@seamapi/types/connect'
|
|
6
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
|
|
11
7
|
import type { SetNonNullable } from 'type-fest'
|
|
12
8
|
|
|
13
9
|
import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
|
|
@@ -186,12 +182,12 @@ export class SeamHttpUserIdentities {
|
|
|
186
182
|
}
|
|
187
183
|
|
|
188
184
|
async list(
|
|
189
|
-
|
|
185
|
+
body?: UserIdentitiesListParams,
|
|
190
186
|
): Promise<UserIdentitiesListResponse['user_identities']> {
|
|
191
187
|
const { data } = await this.client.request<UserIdentitiesListResponse>({
|
|
192
188
|
url: '/user_identities/list',
|
|
193
|
-
method: '
|
|
194
|
-
|
|
189
|
+
method: 'post',
|
|
190
|
+
data: body,
|
|
195
191
|
})
|
|
196
192
|
|
|
197
193
|
return data.user_identities
|
|
@@ -292,8 +288,7 @@ export type UserIdentitiesGrantAccessToDeviceResponse = SetNonNullable<
|
|
|
292
288
|
|
|
293
289
|
export type UserIdentitiesGrantAccessToDeviceOptions = never
|
|
294
290
|
|
|
295
|
-
export type UserIdentitiesListParams =
|
|
296
|
-
RouteRequestParams<'/user_identities/list'>
|
|
291
|
+
export type UserIdentitiesListParams = RouteRequestBody<'/user_identities/list'>
|
|
297
292
|
|
|
298
293
|
export type UserIdentitiesListResponse = SetNonNullable<
|
|
299
294
|
Required<RouteResponse<'/user_identities/list'>>
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* Do not edit this file or add other files to this directory.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
RouteRequestBody,
|
|
8
|
-
RouteRequestParams,
|
|
9
|
-
RouteResponse,
|
|
10
|
-
} from '@seamapi/types/connect'
|
|
6
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
|
|
11
7
|
import type { SetNonNullable } from 'type-fest'
|
|
12
8
|
|
|
13
9
|
import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
|
|
@@ -166,12 +162,12 @@ export class SeamHttpWebhooks {
|
|
|
166
162
|
}
|
|
167
163
|
|
|
168
164
|
async list(
|
|
169
|
-
|
|
165
|
+
body?: WebhooksListParams,
|
|
170
166
|
): Promise<WebhooksListResponse['webhooks']> {
|
|
171
167
|
const { data } = await this.client.request<WebhooksListResponse>({
|
|
172
168
|
url: '/webhooks/list',
|
|
173
|
-
method: '
|
|
174
|
-
|
|
169
|
+
method: 'post',
|
|
170
|
+
data: body,
|
|
175
171
|
})
|
|
176
172
|
|
|
177
173
|
return data.webhooks
|
|
@@ -202,7 +198,7 @@ export type WebhooksGetResponse = SetNonNullable<
|
|
|
202
198
|
|
|
203
199
|
export type WebhooksGetOptions = never
|
|
204
200
|
|
|
205
|
-
export type WebhooksListParams =
|
|
201
|
+
export type WebhooksListParams = RouteRequestBody<'/webhooks/list'>
|
|
206
202
|
|
|
207
203
|
export type WebhooksListResponse = SetNonNullable<
|
|
208
204
|
Required<RouteResponse<'/webhooks/list'>>
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* Do not edit this file or add other files to this directory.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
RouteRequestBody,
|
|
8
|
-
RouteRequestParams,
|
|
9
|
-
RouteResponse,
|
|
10
|
-
} from '@seamapi/types/connect'
|
|
6
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
|
|
11
7
|
import type { SetNonNullable } from 'type-fest'
|
|
12
8
|
|
|
13
9
|
import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
|
|
@@ -148,24 +144,24 @@ export class SeamHttpWorkspaces {
|
|
|
148
144
|
}
|
|
149
145
|
|
|
150
146
|
async get(
|
|
151
|
-
|
|
147
|
+
body?: WorkspacesGetParams,
|
|
152
148
|
): Promise<WorkspacesGetResponse['workspace']> {
|
|
153
149
|
const { data } = await this.client.request<WorkspacesGetResponse>({
|
|
154
150
|
url: '/workspaces/get',
|
|
155
|
-
method: '
|
|
156
|
-
|
|
151
|
+
method: 'post',
|
|
152
|
+
data: body,
|
|
157
153
|
})
|
|
158
154
|
|
|
159
155
|
return data.workspace
|
|
160
156
|
}
|
|
161
157
|
|
|
162
158
|
async list(
|
|
163
|
-
|
|
159
|
+
body?: WorkspacesListParams,
|
|
164
160
|
): Promise<WorkspacesListResponse['workspaces']> {
|
|
165
161
|
const { data } = await this.client.request<WorkspacesListResponse>({
|
|
166
162
|
url: '/workspaces/list',
|
|
167
|
-
method: '
|
|
168
|
-
|
|
163
|
+
method: 'post',
|
|
164
|
+
data: body,
|
|
169
165
|
})
|
|
170
166
|
|
|
171
167
|
return data.workspaces
|
|
@@ -188,7 +184,7 @@ export type WorkspacesCreateResponse = SetNonNullable<
|
|
|
188
184
|
|
|
189
185
|
export type WorkspacesCreateOptions = never
|
|
190
186
|
|
|
191
|
-
export type WorkspacesGetParams =
|
|
187
|
+
export type WorkspacesGetParams = RouteRequestBody<'/workspaces/get'>
|
|
192
188
|
|
|
193
189
|
export type WorkspacesGetResponse = SetNonNullable<
|
|
194
190
|
Required<RouteResponse<'/workspaces/get'>>
|
|
@@ -196,7 +192,7 @@ export type WorkspacesGetResponse = SetNonNullable<
|
|
|
196
192
|
|
|
197
193
|
export type WorkspacesGetOptions = never
|
|
198
194
|
|
|
199
|
-
export type WorkspacesListParams =
|
|
195
|
+
export type WorkspacesListParams = RouteRequestBody<'/workspaces/list'>
|
|
200
196
|
|
|
201
197
|
export type WorkspacesListResponse = SetNonNullable<
|
|
202
198
|
Required<RouteResponse<'/workspaces/list'>>
|
package/src/lib/version.ts
CHANGED