@seamapi/http 0.12.0 → 0.14.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 +12 -0
- package/connect.d.ts +1 -0
- package/connect.js +1 -0
- package/connect.js.map +1 -1
- package/dist/connect.cjs +279 -50
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +70 -7
- package/lib/seam/connect/auth.js +2 -1
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/client.js +2 -2
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/index.d.ts +0 -1
- package/lib/seam/connect/index.js +0 -1
- package/lib/seam/connect/index.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +3 -0
- package/lib/seam/connect/routes/index.js +3 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/networks.d.ts +23 -0
- package/lib/seam/connect/routes/networks.js +81 -0
- package/lib/seam/connect/routes/networks.js.map +1 -0
- package/lib/seam/connect/routes/phones.d.ts +19 -0
- package/lib/seam/connect/routes/phones.js +73 -0
- package/lib/seam/connect/routes/phones.js.map +1 -0
- package/lib/seam/connect/routes/user-identities-enrollment-automations.d.ts +27 -0
- package/lib/seam/connect/routes/user-identities-enrollment-automations.js +89 -0
- package/lib/seam/connect/routes/user-identities-enrollment-automations.js.map +1 -0
- package/lib/seam/connect/routes/user-identities.d.ts +6 -0
- package/lib/seam/connect/routes/user-identities.js +12 -0
- package/lib/seam/connect/routes/user-identities.js.map +1 -1
- package/lib/seam/connect/seam-http.d.ts +3 -1
- package/lib/seam/connect/seam-http.js +7 -1
- package/lib/seam/connect/seam-http.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -3
- package/src/connect.ts +1 -0
- package/src/lib/seam/connect/auth.ts +2 -1
- package/src/lib/seam/connect/client.ts +2 -3
- package/src/lib/seam/connect/index.ts +0 -1
- package/src/lib/seam/connect/routes/index.ts +3 -0
- package/src/lib/seam/connect/routes/networks.ts +171 -0
- package/src/lib/seam/connect/routes/phones.ts +151 -0
- package/src/lib/seam/connect/routes/user-identities-enrollment-automations.ts +214 -0
- package/src/lib/seam/connect/routes/user-identities.ts +30 -0
- package/src/lib/seam/connect/seam-http.ts +10 -0
- package/src/lib/version.ts +1 -1
- package/lib/params-serializer.d.ts +0 -5
- package/lib/params-serializer.js +0 -40
- package/lib/params-serializer.js.map +0 -1
- package/src/lib/params-serializer.ts +0 -44
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Automatically generated by generate-routes.ts.
|
|
3
|
+
* Do not edit this file or add other files to this directory.
|
|
4
|
+
*/
|
|
5
|
+
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
|
+
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
|
+
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
+
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
|
+
export class SeamHttpUserIdentitiesEnrollmentAutomations {
|
|
11
|
+
constructor(apiKeyOrOptions = {}) {
|
|
12
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
14
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
15
|
+
}
|
|
16
|
+
static fromClient(client, options = {}) {
|
|
17
|
+
const constructorOptions = { ...options, client };
|
|
18
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
19
|
+
throw new SeamHttpInvalidOptionsError('Missing client');
|
|
20
|
+
}
|
|
21
|
+
return new SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
|
|
22
|
+
}
|
|
23
|
+
static fromApiKey(apiKey, options = {}) {
|
|
24
|
+
const constructorOptions = { ...options, apiKey };
|
|
25
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
26
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey');
|
|
27
|
+
}
|
|
28
|
+
return new SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
|
|
29
|
+
}
|
|
30
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
31
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
32
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
33
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken');
|
|
34
|
+
}
|
|
35
|
+
return new SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
|
|
36
|
+
}
|
|
37
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
38
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
39
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
40
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
42
|
+
}
|
|
43
|
+
const client = createClient(clientOptions);
|
|
44
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
45
|
+
const { token } = await clientSessions.getOrCreate({
|
|
46
|
+
user_identifier_key: userIdentifierKey,
|
|
47
|
+
});
|
|
48
|
+
return SeamHttpUserIdentitiesEnrollmentAutomations.fromClientSessionToken(token, options);
|
|
49
|
+
}
|
|
50
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
51
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
52
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
53
|
+
throw new SeamHttpInvalidOptionsError('Missing consoleSessionToken or workspaceId');
|
|
54
|
+
}
|
|
55
|
+
return new SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
|
|
56
|
+
}
|
|
57
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
58
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
59
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
60
|
+
throw new SeamHttpInvalidOptionsError('Missing personalAccessToken or workspaceId');
|
|
61
|
+
}
|
|
62
|
+
return new SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
|
|
63
|
+
}
|
|
64
|
+
async get(body) {
|
|
65
|
+
const { data } = await this.client.request({
|
|
66
|
+
url: '/user_identities/enrollment_automations/get',
|
|
67
|
+
method: 'post',
|
|
68
|
+
data: body,
|
|
69
|
+
});
|
|
70
|
+
return data.enrollment_automation;
|
|
71
|
+
}
|
|
72
|
+
async launch(body) {
|
|
73
|
+
const { data } = await this.client.request({
|
|
74
|
+
url: '/user_identities/enrollment_automations/launch',
|
|
75
|
+
method: 'post',
|
|
76
|
+
data: body,
|
|
77
|
+
});
|
|
78
|
+
return data.enrollment_automation;
|
|
79
|
+
}
|
|
80
|
+
async list(body) {
|
|
81
|
+
const { data } = await this.client.request({
|
|
82
|
+
url: '/user_identities/enrollment_automations/list',
|
|
83
|
+
method: 'post',
|
|
84
|
+
data: body,
|
|
85
|
+
});
|
|
86
|
+
return data.enrollment_automations;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=user-identities-enrollment-automations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-identities-enrollment-automations.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/user-identities-enrollment-automations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E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RouteRequestParams, RouteResponse } from '@seama
|
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
4
|
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
5
|
+
import { SeamHttpUserIdentitiesEnrollmentAutomations } from './user-identities-enrollment-automations.js';
|
|
5
6
|
export declare class SeamHttpUserIdentities {
|
|
6
7
|
client: Client;
|
|
7
8
|
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
@@ -12,12 +13,14 @@ export declare class SeamHttpUserIdentities {
|
|
|
12
13
|
static fromPublishableKey(publishableKey: string, userIdentifierKey: string, options?: SeamHttpFromPublishableKeyOptions): Promise<SeamHttpUserIdentities>;
|
|
13
14
|
static fromConsoleSessionToken(consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], options?: Omit<SeamHttpOptionsWithConsoleSessionToken, 'consoleSessionToken' | 'workspaceId'>): SeamHttpUserIdentities;
|
|
14
15
|
static fromPersonalAccessToken(personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], options?: Omit<SeamHttpOptionsWithPersonalAccessToken, 'personalAccessToken' | 'workspaceId'>): SeamHttpUserIdentities;
|
|
16
|
+
get enrollmentAutomations(): SeamHttpUserIdentitiesEnrollmentAutomations;
|
|
15
17
|
addAcsUser(body?: UserIdentitiesAddAcsUserBody): Promise<void>;
|
|
16
18
|
create(body?: UserIdentitiesCreateBody): Promise<UserIdentitiesCreateResponse['user_identity']>;
|
|
17
19
|
get(body?: UserIdentitiesGetParams): Promise<UserIdentitiesGetResponse['user_identity']>;
|
|
18
20
|
grantAccessToDevice(body?: UserIdentitiesGrantAccessToDeviceBody): Promise<void>;
|
|
19
21
|
list(params?: UserIdentitiesListParams): Promise<UserIdentitiesListResponse['user_identities']>;
|
|
20
22
|
listAccessibleDevices(body?: UserIdentitiesListAccessibleDevicesParams): Promise<UserIdentitiesListAccessibleDevicesResponse['accessible_devices']>;
|
|
23
|
+
listAcsSystems(body?: UserIdentitiesListAcsSystemsParams): Promise<UserIdentitiesListAcsSystemsResponse['acs_systems']>;
|
|
21
24
|
listAcsUsers(body?: UserIdentitiesListAcsUsersParams): Promise<UserIdentitiesListAcsUsersResponse['acs_users']>;
|
|
22
25
|
removeAcsUser(body?: UserIdentitiesRemoveAcsUserBody): Promise<void>;
|
|
23
26
|
revokeAccessToDevice(body?: UserIdentitiesRevokeAccessToDeviceBody): Promise<void>;
|
|
@@ -40,6 +43,9 @@ export type UserIdentitiesListOptions = never;
|
|
|
40
43
|
export type UserIdentitiesListAccessibleDevicesParams = RouteRequestBody<'/user_identities/list_accessible_devices'>;
|
|
41
44
|
export type UserIdentitiesListAccessibleDevicesResponse = SetNonNullable<Required<RouteResponse<'/user_identities/list_accessible_devices'>>>;
|
|
42
45
|
export type UserIdentitiesListAccessibleDevicesOptions = never;
|
|
46
|
+
export type UserIdentitiesListAcsSystemsParams = RouteRequestBody<'/user_identities/list_acs_systems'>;
|
|
47
|
+
export type UserIdentitiesListAcsSystemsResponse = SetNonNullable<Required<RouteResponse<'/user_identities/list_acs_systems'>>>;
|
|
48
|
+
export type UserIdentitiesListAcsSystemsOptions = never;
|
|
43
49
|
export type UserIdentitiesListAcsUsersParams = RouteRequestBody<'/user_identities/list_acs_users'>;
|
|
44
50
|
export type UserIdentitiesListAcsUsersResponse = SetNonNullable<Required<RouteResponse<'/user_identities/list_acs_users'>>>;
|
|
45
51
|
export type UserIdentitiesListAcsUsersOptions = never;
|
|
@@ -7,6 +7,7 @@ import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
8
|
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
|
+
import { SeamHttpUserIdentitiesEnrollmentAutomations } from './user-identities-enrollment-automations.js';
|
|
10
11
|
export class SeamHttpUserIdentities {
|
|
11
12
|
constructor(apiKeyOrOptions = {}) {
|
|
12
13
|
const options = parseOptions(apiKeyOrOptions);
|
|
@@ -61,6 +62,9 @@ export class SeamHttpUserIdentities {
|
|
|
61
62
|
}
|
|
62
63
|
return new SeamHttpUserIdentities(constructorOptions);
|
|
63
64
|
}
|
|
65
|
+
get enrollmentAutomations() {
|
|
66
|
+
return SeamHttpUserIdentitiesEnrollmentAutomations.fromClient(this.client, this.defaults);
|
|
67
|
+
}
|
|
64
68
|
async addAcsUser(body) {
|
|
65
69
|
await this.client.request({
|
|
66
70
|
url: '/user_identities/add_acs_user',
|
|
@@ -107,6 +111,14 @@ export class SeamHttpUserIdentities {
|
|
|
107
111
|
});
|
|
108
112
|
return data.accessible_devices;
|
|
109
113
|
}
|
|
114
|
+
async listAcsSystems(body) {
|
|
115
|
+
const { data } = await this.client.request({
|
|
116
|
+
url: '/user_identities/list_acs_systems',
|
|
117
|
+
method: 'post',
|
|
118
|
+
data: body,
|
|
119
|
+
});
|
|
120
|
+
return data.acs_systems;
|
|
121
|
+
}
|
|
110
122
|
async listAcsUsers(body) {
|
|
111
123
|
const { data } = await this.client.request({
|
|
112
124
|
url: '/user_identities/list_acs_users',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-identities.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/user-identities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"user-identities.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/user-identities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,2CAA2C,EAAE,MAAM,6CAA6C,CAAA;AAEzG,MAAM,OAAO,sBAAsB;IAIjC,YAAY,kBAA4C,EAAE;QACxD,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QAC7C,IAAI,CAAC,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC1E,IAAI,CAAC,QAAQ,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAA;IACxD,CAAC;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M,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEJ,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,IAAyC;QAEzC,MAAM,EAAE,IAAI,EAAE,GACZ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAuC;YAC9D,GAAG,EAAE,mCAAmC;YACxC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEJ,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,IAAuC;QAEvC,MAAM,EAAE,IAAI,EAAE,GACZ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqC;YAC5D,GAAG,EAAE,iCAAiC;YACtC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEJ,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAsC;QACxD,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsC;YAC7D,GAAG,EAAE,kCAAkC;YACvC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,IAA6C;QAE7C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6C;YACpE,GAAG,EAAE,0CAA0C;YAC/C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client } from './client.js';
|
|
2
2
|
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from './options.js';
|
|
3
|
-
import { SeamHttpAccessCodes, SeamHttpAcs, SeamHttpActionAttempts, SeamHttpClientSessions, SeamHttpConnectedAccounts, SeamHttpConnectWebviews, SeamHttpDevices, SeamHttpEvents, SeamHttpLocks, SeamHttpNoiseSensors, SeamHttpThermostats, SeamHttpUserIdentities, SeamHttpWebhooks, SeamHttpWorkspaces } from './routes/index.js';
|
|
3
|
+
import { SeamHttpAccessCodes, SeamHttpAcs, SeamHttpActionAttempts, SeamHttpClientSessions, SeamHttpConnectedAccounts, SeamHttpConnectWebviews, SeamHttpDevices, SeamHttpEvents, SeamHttpLocks, SeamHttpNetworks, SeamHttpNoiseSensors, SeamHttpPhones, SeamHttpThermostats, SeamHttpUserIdentities, SeamHttpWebhooks, SeamHttpWorkspaces } from './routes/index.js';
|
|
4
4
|
export declare class SeamHttp {
|
|
5
5
|
client: Client;
|
|
6
6
|
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
@@ -20,7 +20,9 @@ export declare class SeamHttp {
|
|
|
20
20
|
get devices(): SeamHttpDevices;
|
|
21
21
|
get events(): SeamHttpEvents;
|
|
22
22
|
get locks(): SeamHttpLocks;
|
|
23
|
+
get networks(): SeamHttpNetworks;
|
|
23
24
|
get noiseSensors(): SeamHttpNoiseSensors;
|
|
25
|
+
get phones(): SeamHttpPhones;
|
|
24
26
|
get thermostats(): SeamHttpThermostats;
|
|
25
27
|
get userIdentities(): SeamHttpUserIdentities;
|
|
26
28
|
get webhooks(): SeamHttpWebhooks;
|
|
@@ -2,7 +2,7 @@ import { warnOnInsecureuserIdentifierKey } from './auth.js';
|
|
|
2
2
|
import { createClient } from './client.js';
|
|
3
3
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from './options.js';
|
|
4
4
|
import { limitToSeamHttpRequestOptions, parseOptions } from './parse-options.js';
|
|
5
|
-
import { SeamHttpAccessCodes, SeamHttpAcs, SeamHttpActionAttempts, SeamHttpClientSessions, SeamHttpConnectedAccounts, SeamHttpConnectWebviews, SeamHttpDevices, SeamHttpEvents, SeamHttpLocks, SeamHttpNoiseSensors, SeamHttpThermostats, SeamHttpUserIdentities, SeamHttpWebhooks, SeamHttpWorkspaces, } from './routes/index.js';
|
|
5
|
+
import { SeamHttpAccessCodes, SeamHttpAcs, SeamHttpActionAttempts, SeamHttpClientSessions, SeamHttpConnectedAccounts, SeamHttpConnectWebviews, SeamHttpDevices, SeamHttpEvents, SeamHttpLocks, SeamHttpNetworks, SeamHttpNoiseSensors, SeamHttpPhones, SeamHttpThermostats, SeamHttpUserIdentities, SeamHttpWebhooks, SeamHttpWorkspaces, } from './routes/index.js';
|
|
6
6
|
export class SeamHttp {
|
|
7
7
|
constructor(apiKeyOrOptions = {}) {
|
|
8
8
|
const options = parseOptions(apiKeyOrOptions);
|
|
@@ -84,9 +84,15 @@ export class SeamHttp {
|
|
|
84
84
|
get locks() {
|
|
85
85
|
return SeamHttpLocks.fromClient(this.client, this.defaults);
|
|
86
86
|
}
|
|
87
|
+
get networks() {
|
|
88
|
+
return SeamHttpNetworks.fromClient(this.client, this.defaults);
|
|
89
|
+
}
|
|
87
90
|
get noiseSensors() {
|
|
88
91
|
return SeamHttpNoiseSensors.fromClient(this.client, this.defaults);
|
|
89
92
|
}
|
|
93
|
+
get phones() {
|
|
94
|
+
return SeamHttpPhones.fromClient(this.client, this.defaults);
|
|
95
|
+
}
|
|
90
96
|
get thermostats() {
|
|
91
97
|
return SeamHttpThermostats.fromClient(this.client, this.defaults);
|
|
92
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seam-http.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/seam-http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,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AAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClE,CAAC;CACF"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiJavascriptHttpVersion = "0.
|
|
1
|
+
declare const seamapiJavascriptHttpVersion = "0.14.0";
|
|
2
2
|
export default seamapiJavascriptHttpVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/http",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "JavaScript HTTP client for the Seam API written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
+
"@seamapi/url-search-params-serializer": "^1.1.0",
|
|
99
100
|
"axios": "^1.5.0",
|
|
100
101
|
"axios-better-stacktrace": "^2.1.6",
|
|
101
102
|
"axios-retry": "^4.0.0"
|
|
@@ -106,14 +107,14 @@
|
|
|
106
107
|
"@types/eslint": "^8.44.2",
|
|
107
108
|
"@types/node": "^20.8.10",
|
|
108
109
|
"ava": "^5.0.1",
|
|
109
|
-
"c8": "^
|
|
110
|
+
"c8": "^9.0.0",
|
|
110
111
|
"change-case": "^5.0.2",
|
|
111
112
|
"concurrently": "^8.2.1",
|
|
112
113
|
"del-cli": "^5.0.0",
|
|
113
114
|
"eslint": "^8.9.0",
|
|
114
115
|
"eslint-config-prettier": "^9.0.0",
|
|
115
116
|
"eslint-config-standard": "^17.1.0",
|
|
116
|
-
"eslint-config-standard-with-typescript": "^
|
|
117
|
+
"eslint-config-standard-with-typescript": "^43.0.0",
|
|
117
118
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
118
119
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
119
120
|
"execa": "^8.0.1",
|
package/src/connect.ts
CHANGED
|
@@ -63,7 +63,8 @@ export const getAuthHeaders = (options: Options): Headers => {
|
|
|
63
63
|
'clientSessionToken,',
|
|
64
64
|
'publishableKey,',
|
|
65
65
|
'consoleSessionToken',
|
|
66
|
-
'or personalAccessToken',
|
|
66
|
+
'or personalAccessToken.',
|
|
67
|
+
'Attempted reading configuration from the environment, but the environment variable SEAM_API_KEY is not set.',
|
|
67
68
|
].join(' '),
|
|
68
69
|
)
|
|
69
70
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { serializeUrlSearchParams } from '@seamapi/url-search-params-serializer'
|
|
1
2
|
import axios, { type AxiosInstance, type AxiosRequestConfig } from 'axios'
|
|
2
3
|
import axiosBetterStacktrace from 'axios-better-stacktrace'
|
|
3
4
|
import axiosRetry, { type AxiosRetry, exponentialDelay } from 'axios-retry'
|
|
4
5
|
|
|
5
|
-
import { paramsSerializer } from 'lib/params-serializer.js'
|
|
6
|
-
|
|
7
6
|
import { errorInterceptor } from './error-interceptor.js'
|
|
8
7
|
|
|
9
8
|
export type Client = AxiosInstance
|
|
@@ -17,7 +16,7 @@ type AxiosRetryConfig = Parameters<AxiosRetry>[1]
|
|
|
17
16
|
|
|
18
17
|
export const createClient = (options: ClientOptions): AxiosInstance => {
|
|
19
18
|
const client = axios.create({
|
|
20
|
-
paramsSerializer,
|
|
19
|
+
paramsSerializer: serializeUrlSearchParams,
|
|
21
20
|
...options.axiosOptions,
|
|
22
21
|
})
|
|
23
22
|
|
|
@@ -16,10 +16,13 @@ export * from './devices.js'
|
|
|
16
16
|
export * from './devices-unmanaged.js'
|
|
17
17
|
export * from './events.js'
|
|
18
18
|
export * from './locks.js'
|
|
19
|
+
export * from './networks.js'
|
|
19
20
|
export * from './noise-sensors.js'
|
|
20
21
|
export * from './noise-sensors-noise-thresholds.js'
|
|
22
|
+
export * from './phones.js'
|
|
21
23
|
export * from './thermostats.js'
|
|
22
24
|
export * from './thermostats-climate-setting-schedules.js'
|
|
23
25
|
export * from './user-identities.js'
|
|
26
|
+
export * from './user-identities-enrollment-automations.js'
|
|
24
27
|
export * from './webhooks.js'
|
|
25
28
|
export * from './workspaces.js'
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Automatically generated by generate-routes.ts.
|
|
3
|
+
* Do not edit this file or add other files to this directory.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
|
|
7
|
+
import type { SetNonNullable } from 'type-fest'
|
|
8
|
+
|
|
9
|
+
import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
|
|
10
|
+
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
17
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
18
|
+
SeamHttpInvalidOptionsError,
|
|
19
|
+
type SeamHttpOptions,
|
|
20
|
+
type SeamHttpOptionsWithApiKey,
|
|
21
|
+
type SeamHttpOptionsWithClient,
|
|
22
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
25
|
+
type SeamHttpRequestOptions,
|
|
26
|
+
} from 'lib/seam/connect/options.js'
|
|
27
|
+
import {
|
|
28
|
+
limitToSeamHttpRequestOptions,
|
|
29
|
+
parseOptions,
|
|
30
|
+
} from 'lib/seam/connect/parse-options.js'
|
|
31
|
+
|
|
32
|
+
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
33
|
+
|
|
34
|
+
export class SeamHttpNetworks {
|
|
35
|
+
client: Client
|
|
36
|
+
readonly defaults: Required<SeamHttpRequestOptions>
|
|
37
|
+
|
|
38
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
39
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
40
|
+
this.client = 'client' in options ? options.client : createClient(options)
|
|
41
|
+
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static fromClient(
|
|
45
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
46
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
47
|
+
): SeamHttpNetworks {
|
|
48
|
+
const constructorOptions = { ...options, client }
|
|
49
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
50
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
51
|
+
}
|
|
52
|
+
return new SeamHttpNetworks(constructorOptions)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static fromApiKey(
|
|
56
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
57
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
58
|
+
): SeamHttpNetworks {
|
|
59
|
+
const constructorOptions = { ...options, apiKey }
|
|
60
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
61
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
62
|
+
}
|
|
63
|
+
return new SeamHttpNetworks(constructorOptions)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static fromClientSessionToken(
|
|
67
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
68
|
+
options: Omit<
|
|
69
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
70
|
+
'clientSessionToken'
|
|
71
|
+
> = {},
|
|
72
|
+
): SeamHttpNetworks {
|
|
73
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
74
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
75
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
76
|
+
}
|
|
77
|
+
return new SeamHttpNetworks(constructorOptions)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static async fromPublishableKey(
|
|
81
|
+
publishableKey: string,
|
|
82
|
+
userIdentifierKey: string,
|
|
83
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
84
|
+
): Promise<SeamHttpNetworks> {
|
|
85
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
86
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
87
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
88
|
+
throw new SeamHttpInvalidOptionsError(
|
|
89
|
+
'The client option cannot be used with SeamHttp.fromPublishableKey',
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
const client = createClient(clientOptions)
|
|
93
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
94
|
+
const { token } = await clientSessions.getOrCreate({
|
|
95
|
+
user_identifier_key: userIdentifierKey,
|
|
96
|
+
})
|
|
97
|
+
return SeamHttpNetworks.fromClientSessionToken(token, options)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static fromConsoleSessionToken(
|
|
101
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
102
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
103
|
+
options: Omit<
|
|
104
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
105
|
+
'consoleSessionToken' | 'workspaceId'
|
|
106
|
+
> = {},
|
|
107
|
+
): SeamHttpNetworks {
|
|
108
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
109
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
110
|
+
throw new SeamHttpInvalidOptionsError(
|
|
111
|
+
'Missing consoleSessionToken or workspaceId',
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
return new SeamHttpNetworks(constructorOptions)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static fromPersonalAccessToken(
|
|
118
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
119
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
120
|
+
options: Omit<
|
|
121
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
122
|
+
'personalAccessToken' | 'workspaceId'
|
|
123
|
+
> = {},
|
|
124
|
+
): SeamHttpNetworks {
|
|
125
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
126
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
127
|
+
throw new SeamHttpInvalidOptionsError(
|
|
128
|
+
'Missing personalAccessToken or workspaceId',
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
return new SeamHttpNetworks(constructorOptions)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async get(body?: NetworksGetParams): Promise<NetworksGetResponse['network']> {
|
|
135
|
+
const { data } = await this.client.request<NetworksGetResponse>({
|
|
136
|
+
url: '/networks/get',
|
|
137
|
+
method: 'post',
|
|
138
|
+
data: body,
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
return data.network
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async list(
|
|
145
|
+
body?: NetworksListParams,
|
|
146
|
+
): Promise<NetworksListResponse['networks']> {
|
|
147
|
+
const { data } = await this.client.request<NetworksListResponse>({
|
|
148
|
+
url: '/networks/list',
|
|
149
|
+
method: 'post',
|
|
150
|
+
data: body,
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
return data.networks
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export type NetworksGetParams = RouteRequestBody<'/networks/get'>
|
|
158
|
+
|
|
159
|
+
export type NetworksGetResponse = SetNonNullable<
|
|
160
|
+
Required<RouteResponse<'/networks/get'>>
|
|
161
|
+
>
|
|
162
|
+
|
|
163
|
+
export type NetworksGetOptions = never
|
|
164
|
+
|
|
165
|
+
export type NetworksListParams = RouteRequestBody<'/networks/list'>
|
|
166
|
+
|
|
167
|
+
export type NetworksListResponse = SetNonNullable<
|
|
168
|
+
Required<RouteResponse<'/networks/list'>>
|
|
169
|
+
>
|
|
170
|
+
|
|
171
|
+
export type NetworksListOptions = never
|