@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
|
@@ -0,0 +1,113 @@
|
|
|
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, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
+
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
+
import { SeamHttpAccessCodesUnmanaged } from './access-codes-unmanaged.js';
|
|
10
|
+
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
11
|
+
export class SeamHttpAccessCodes {
|
|
12
|
+
constructor(apiKeyOrOptions = {}) {
|
|
13
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
14
|
+
this.client = createClient(clientOptions);
|
|
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 SeamHttpAccessCodes(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 SeamHttpAccessCodes(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 SeamHttpAccessCodes(constructorOptions);
|
|
36
|
+
}
|
|
37
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
38
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
39
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
40
|
+
const client = createClient(clientOptions);
|
|
41
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
42
|
+
const { token } = await clientSessions.getOrCreate({
|
|
43
|
+
user_identifier_key: userIdentifierKey,
|
|
44
|
+
});
|
|
45
|
+
return SeamHttpAccessCodes.fromClientSessionToken(token, options);
|
|
46
|
+
}
|
|
47
|
+
get unmanaged() {
|
|
48
|
+
return SeamHttpAccessCodesUnmanaged.fromClient(this.client);
|
|
49
|
+
}
|
|
50
|
+
async create(body) {
|
|
51
|
+
const { data } = await this.client.request({
|
|
52
|
+
url: '/access_codes/create',
|
|
53
|
+
method: 'post',
|
|
54
|
+
data: body,
|
|
55
|
+
});
|
|
56
|
+
return data.access_code;
|
|
57
|
+
}
|
|
58
|
+
async createMultiple(body) {
|
|
59
|
+
const { data } = await this.client.request({
|
|
60
|
+
url: '/access_codes/create_multiple',
|
|
61
|
+
method: 'post',
|
|
62
|
+
data: body,
|
|
63
|
+
});
|
|
64
|
+
return data.access_codes;
|
|
65
|
+
}
|
|
66
|
+
async delete(body) {
|
|
67
|
+
await this.client.request({
|
|
68
|
+
url: '/access_codes/delete',
|
|
69
|
+
method: 'post',
|
|
70
|
+
data: body,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async generateCode(body) {
|
|
74
|
+
const { data } = await this.client.request({
|
|
75
|
+
url: '/access_codes/generate_code',
|
|
76
|
+
method: 'post',
|
|
77
|
+
data: body,
|
|
78
|
+
});
|
|
79
|
+
return data.generated_code;
|
|
80
|
+
}
|
|
81
|
+
async get(body) {
|
|
82
|
+
const { data } = await this.client.request({
|
|
83
|
+
url: '/access_codes/get',
|
|
84
|
+
method: 'post',
|
|
85
|
+
data: body,
|
|
86
|
+
});
|
|
87
|
+
return data.access_code;
|
|
88
|
+
}
|
|
89
|
+
async list(body) {
|
|
90
|
+
const { data } = await this.client.request({
|
|
91
|
+
url: '/access_codes/list',
|
|
92
|
+
method: 'post',
|
|
93
|
+
data: body,
|
|
94
|
+
});
|
|
95
|
+
return data.access_codes;
|
|
96
|
+
}
|
|
97
|
+
async pullBackupAccessCode(body) {
|
|
98
|
+
const { data } = await this.client.request({
|
|
99
|
+
url: '/access_codes/pull_backup_access_code',
|
|
100
|
+
method: 'post',
|
|
101
|
+
data: body,
|
|
102
|
+
});
|
|
103
|
+
return data.backup_access_code;
|
|
104
|
+
}
|
|
105
|
+
async update(body) {
|
|
106
|
+
await this.client.request({
|
|
107
|
+
url: '/access_codes/update',
|
|
108
|
+
method: 'post',
|
|
109
|
+
data: body,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=access-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-codes.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/access-codes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EAEvC,2BAA2B,GAK5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAEhE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,mBAAmB;IAG9B,YAAY,kBAA4C,EAAE;QACxD,MAAM,aAAa,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,CAAC,UAAU,CACf,MAA2C,EAC3C,UAAqD,EAAE;QAEvD,MAAM,kBAAkB,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAA;QACjD,IAAI,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,EAAE;YACp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E,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,IAAI,CACR,IAAyB;QAEzB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0B;YAClE,GAAG,EAAE,oBAAoB;YACzB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,IAAyC;QAEzC,MAAM,EAAE,IAAI,EAAE,GACZ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0C;YACjE,GAAG,EAAE,uCAAuC;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACJ,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAA2B;QACtC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA4B;YACnD,GAAG,EAAE,sBAAsB;YAC3B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
|
+
import type { SetNonNullable } from 'type-fest';
|
|
3
|
+
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken } from '../../../../lib/seam/connect/options.js';
|
|
5
|
+
export declare class SeamHttpAcsAccessGroups {
|
|
6
|
+
client: Client;
|
|
7
|
+
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
|
+
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpAcsAccessGroups;
|
|
9
|
+
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsAccessGroups;
|
|
10
|
+
static fromClientSessionToken(clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], options?: Omit<SeamHttpOptionsWithClientSessionToken, 'clientSessionToken'>): SeamHttpAcsAccessGroups;
|
|
11
|
+
static fromPublishableKey(publishableKey: string, userIdentifierKey: string, options?: SeamHttpFromPublishableKeyOptions): Promise<SeamHttpAcsAccessGroups>;
|
|
12
|
+
addUser(body: AcsAccessGroupsAddUserBody): Promise<void>;
|
|
13
|
+
create(body: AcsAccessGroupsCreateBody): Promise<AcsAccessGroupsCreateResponse['acs_access_group']>;
|
|
14
|
+
delete(body: AcsAccessGroupsDeleteBody): Promise<void>;
|
|
15
|
+
get(body: AcsAccessGroupsGetBody): Promise<AcsAccessGroupsGetResponse['acs_access_group']>;
|
|
16
|
+
list(body: AcsAccessGroupsListBody): Promise<AcsAccessGroupsListResponse['acs_access_groups']>;
|
|
17
|
+
listUsers(body: AcsAccessGroupsListUsersBody): Promise<AcsAccessGroupsListUsersResponse['acs_users']>;
|
|
18
|
+
removeUser(body: AcsAccessGroupsRemoveUserBody): Promise<void>;
|
|
19
|
+
update(body: AcsAccessGroupsUpdateBody): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export type AcsAccessGroupsAddUserBody = RouteRequestBody<'/acs/access_groups/add_user'>;
|
|
22
|
+
export type AcsAccessGroupsAddUserResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/add_user'>>>;
|
|
23
|
+
export type AcsAccessGroupsCreateBody = RouteRequestBody<'/acs/access_groups/create'>;
|
|
24
|
+
export type AcsAccessGroupsCreateResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/create'>>>;
|
|
25
|
+
export type AcsAccessGroupsDeleteBody = RouteRequestBody<'/acs/access_groups/delete'>;
|
|
26
|
+
export type AcsAccessGroupsDeleteResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/delete'>>>;
|
|
27
|
+
export type AcsAccessGroupsGetBody = RouteRequestBody<'/acs/access_groups/get'>;
|
|
28
|
+
export type AcsAccessGroupsGetResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/get'>>>;
|
|
29
|
+
export type AcsAccessGroupsListBody = RouteRequestBody<'/acs/access_groups/list'>;
|
|
30
|
+
export type AcsAccessGroupsListResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/list'>>>;
|
|
31
|
+
export type AcsAccessGroupsListUsersBody = RouteRequestBody<'/acs/access_groups/list_users'>;
|
|
32
|
+
export type AcsAccessGroupsListUsersResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/list_users'>>>;
|
|
33
|
+
export type AcsAccessGroupsRemoveUserBody = RouteRequestBody<'/acs/access_groups/remove_user'>;
|
|
34
|
+
export type AcsAccessGroupsRemoveUserResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/remove_user'>>>;
|
|
35
|
+
export type AcsAccessGroupsUpdateBody = RouteRequestBody<'/acs/access_groups/update'>;
|
|
36
|
+
export type AcsAccessGroupsUpdateResponse = SetNonNullable<Required<RouteResponse<'/acs/access_groups/update'>>>;
|
|
@@ -0,0 +1,107 @@
|
|
|
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, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
+
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
+
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
|
+
export class SeamHttpAcsAccessGroups {
|
|
11
|
+
constructor(apiKeyOrOptions = {}) {
|
|
12
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = createClient(clientOptions);
|
|
14
|
+
}
|
|
15
|
+
static fromClient(client, options = {}) {
|
|
16
|
+
const constructorOptions = { ...options, client };
|
|
17
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
18
|
+
throw new SeamHttpInvalidOptionsError('Missing client');
|
|
19
|
+
}
|
|
20
|
+
return new SeamHttpAcsAccessGroups(constructorOptions);
|
|
21
|
+
}
|
|
22
|
+
static fromApiKey(apiKey, options = {}) {
|
|
23
|
+
const constructorOptions = { ...options, apiKey };
|
|
24
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
25
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey');
|
|
26
|
+
}
|
|
27
|
+
return new SeamHttpAcsAccessGroups(constructorOptions);
|
|
28
|
+
}
|
|
29
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
30
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
31
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
32
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken');
|
|
33
|
+
}
|
|
34
|
+
return new SeamHttpAcsAccessGroups(constructorOptions);
|
|
35
|
+
}
|
|
36
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
39
|
+
const client = createClient(clientOptions);
|
|
40
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
|
+
const { token } = await clientSessions.getOrCreate({
|
|
42
|
+
user_identifier_key: userIdentifierKey,
|
|
43
|
+
});
|
|
44
|
+
return SeamHttpAcsAccessGroups.fromClientSessionToken(token, options);
|
|
45
|
+
}
|
|
46
|
+
async addUser(body) {
|
|
47
|
+
await this.client.request({
|
|
48
|
+
url: '/acs/access_groups/add_user',
|
|
49
|
+
method: 'post',
|
|
50
|
+
data: body,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async create(body) {
|
|
54
|
+
const { data } = await this.client.request({
|
|
55
|
+
url: '/acs/access_groups/create',
|
|
56
|
+
method: 'post',
|
|
57
|
+
data: body,
|
|
58
|
+
});
|
|
59
|
+
return data.acs_access_group;
|
|
60
|
+
}
|
|
61
|
+
async delete(body) {
|
|
62
|
+
await this.client.request({
|
|
63
|
+
url: '/acs/access_groups/delete',
|
|
64
|
+
method: 'post',
|
|
65
|
+
data: body,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async get(body) {
|
|
69
|
+
const { data } = await this.client.request({
|
|
70
|
+
url: '/acs/access_groups/get',
|
|
71
|
+
method: 'post',
|
|
72
|
+
data: body,
|
|
73
|
+
});
|
|
74
|
+
return data.acs_access_group;
|
|
75
|
+
}
|
|
76
|
+
async list(body) {
|
|
77
|
+
const { data } = await this.client.request({
|
|
78
|
+
url: '/acs/access_groups/list',
|
|
79
|
+
method: 'post',
|
|
80
|
+
data: body,
|
|
81
|
+
});
|
|
82
|
+
return data.acs_access_groups;
|
|
83
|
+
}
|
|
84
|
+
async listUsers(body) {
|
|
85
|
+
const { data } = await this.client.request({
|
|
86
|
+
url: '/acs/access_groups/list_users',
|
|
87
|
+
method: 'post',
|
|
88
|
+
data: body,
|
|
89
|
+
});
|
|
90
|
+
return data.acs_users;
|
|
91
|
+
}
|
|
92
|
+
async removeUser(body) {
|
|
93
|
+
await this.client.request({
|
|
94
|
+
url: '/acs/access_groups/remove_user',
|
|
95
|
+
method: 'post',
|
|
96
|
+
data: body,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async update(body) {
|
|
100
|
+
await this.client.request({
|
|
101
|
+
url: '/acs/access_groups/update',
|
|
102
|
+
method: 'post',
|
|
103
|
+
data: body,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=acs-access-groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acs-access-groups.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-access-groups.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EAEvC,2BAA2B,GAK5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,uBAAuB;IAGlC,YAAY,kBAA4C,EAAE;QACxD,MAAM,aAAa,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,CAAC,UAAU,CACf,MAA2C,EAC3C,UAAqD,EAAE;QAEvD,MAAM,kBAAkB,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAA;QACjD,IAAI,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,EAAE;YACpD,MAAM,IAAI,2BAA2B,CAAC,gBAAgB,CAAC,CAAA;SACxD;QACD,OAAO,IAAI,uBAAuB,CAAC,kBAAkB,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,CAAC,UAAU,CACf,MAA2C,EAC3C,UAAqD,EAAE;QAEvD,MAAM,kBAAkB,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAA;QACjD,IAAI,CAAC,2BAA2B,CA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O,CAAoC;YAC3D,GAAG,EAAE,gCAAgC;YACrC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAA+B;QAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgC;YACvD,GAAG,EAAE,2BAA2B;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
|
+
import type { SetNonNullable } from 'type-fest';
|
|
3
|
+
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken } from '../../../../lib/seam/connect/options.js';
|
|
5
|
+
export declare class SeamHttpAcsCredentials {
|
|
6
|
+
client: Client;
|
|
7
|
+
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
|
+
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpAcsCredentials;
|
|
9
|
+
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsCredentials;
|
|
10
|
+
static fromClientSessionToken(clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], options?: Omit<SeamHttpOptionsWithClientSessionToken, 'clientSessionToken'>): SeamHttpAcsCredentials;
|
|
11
|
+
static fromPublishableKey(publishableKey: string, userIdentifierKey: string, options?: SeamHttpFromPublishableKeyOptions): Promise<SeamHttpAcsCredentials>;
|
|
12
|
+
create(body: AcsCredentialsCreateBody): Promise<AcsCredentialsCreateResponse['acs_credential']>;
|
|
13
|
+
delete(body: AcsCredentialsDeleteBody): Promise<void>;
|
|
14
|
+
get(body: AcsCredentialsGetBody): Promise<AcsCredentialsGetResponse['acs_credential']>;
|
|
15
|
+
list(body: AcsCredentialsListBody): Promise<AcsCredentialsListResponse['acs_credentials']>;
|
|
16
|
+
}
|
|
17
|
+
export type AcsCredentialsCreateBody = RouteRequestBody<'/acs/credentials/create'>;
|
|
18
|
+
export type AcsCredentialsCreateResponse = SetNonNullable<Required<RouteResponse<'/acs/credentials/create'>>>;
|
|
19
|
+
export type AcsCredentialsDeleteBody = RouteRequestBody<'/acs/credentials/delete'>;
|
|
20
|
+
export type AcsCredentialsDeleteResponse = SetNonNullable<Required<RouteResponse<'/acs/credentials/delete'>>>;
|
|
21
|
+
export type AcsCredentialsGetBody = RouteRequestBody<'/acs/credentials/get'>;
|
|
22
|
+
export type AcsCredentialsGetResponse = SetNonNullable<Required<RouteResponse<'/acs/credentials/get'>>>;
|
|
23
|
+
export type AcsCredentialsListBody = RouteRequestBody<'/acs/credentials/list'>;
|
|
24
|
+
export type AcsCredentialsListResponse = SetNonNullable<Required<RouteResponse<'/acs/credentials/list'>>>;
|
|
@@ -0,0 +1,78 @@
|
|
|
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, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
+
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
+
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
|
+
export class SeamHttpAcsCredentials {
|
|
11
|
+
constructor(apiKeyOrOptions = {}) {
|
|
12
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = createClient(clientOptions);
|
|
14
|
+
}
|
|
15
|
+
static fromClient(client, options = {}) {
|
|
16
|
+
const constructorOptions = { ...options, client };
|
|
17
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
18
|
+
throw new SeamHttpInvalidOptionsError('Missing client');
|
|
19
|
+
}
|
|
20
|
+
return new SeamHttpAcsCredentials(constructorOptions);
|
|
21
|
+
}
|
|
22
|
+
static fromApiKey(apiKey, options = {}) {
|
|
23
|
+
const constructorOptions = { ...options, apiKey };
|
|
24
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
25
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey');
|
|
26
|
+
}
|
|
27
|
+
return new SeamHttpAcsCredentials(constructorOptions);
|
|
28
|
+
}
|
|
29
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
30
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
31
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
32
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken');
|
|
33
|
+
}
|
|
34
|
+
return new SeamHttpAcsCredentials(constructorOptions);
|
|
35
|
+
}
|
|
36
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
39
|
+
const client = createClient(clientOptions);
|
|
40
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
|
+
const { token } = await clientSessions.getOrCreate({
|
|
42
|
+
user_identifier_key: userIdentifierKey,
|
|
43
|
+
});
|
|
44
|
+
return SeamHttpAcsCredentials.fromClientSessionToken(token, options);
|
|
45
|
+
}
|
|
46
|
+
async create(body) {
|
|
47
|
+
const { data } = await this.client.request({
|
|
48
|
+
url: '/acs/credentials/create',
|
|
49
|
+
method: 'post',
|
|
50
|
+
data: body,
|
|
51
|
+
});
|
|
52
|
+
return data.acs_credential;
|
|
53
|
+
}
|
|
54
|
+
async delete(body) {
|
|
55
|
+
await this.client.request({
|
|
56
|
+
url: '/acs/credentials/delete',
|
|
57
|
+
method: 'post',
|
|
58
|
+
data: body,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async get(body) {
|
|
62
|
+
const { data } = await this.client.request({
|
|
63
|
+
url: '/acs/credentials/get',
|
|
64
|
+
method: 'post',
|
|
65
|
+
data: body,
|
|
66
|
+
});
|
|
67
|
+
return data.acs_credential;
|
|
68
|
+
}
|
|
69
|
+
async list(body) {
|
|
70
|
+
const { data } = await this.client.request({
|
|
71
|
+
url: '/acs/credentials/list',
|
|
72
|
+
method: 'post',
|
|
73
|
+
data: body,
|
|
74
|
+
});
|
|
75
|
+
return data.acs_credentials;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=acs-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acs-credentials.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-credentials.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EAEvC,2BAA2B,GAK5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,sBAAsB;IAGjC,YAAY,kBAA4C,EAAE;QACxD,MAAM,aAAa,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA;IAC3C,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Response } from '@seamapi/types/connect';
|
|
2
|
+
import type { SetNonNullable } from 'type-fest';
|
|
3
|
+
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken } from '../../../../lib/seam/connect/options.js';
|
|
5
|
+
export declare class SeamHttpAcsSystems {
|
|
6
|
+
client: Client;
|
|
7
|
+
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
|
+
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpAcsSystems;
|
|
9
|
+
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsSystems;
|
|
10
|
+
static fromClientSessionToken(clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], options?: Omit<SeamHttpOptionsWithClientSessionToken, 'clientSessionToken'>): SeamHttpAcsSystems;
|
|
11
|
+
static fromPublishableKey(publishableKey: string, userIdentifierKey: string, options?: SeamHttpFromPublishableKeyOptions): Promise<SeamHttpAcsSystems>;
|
|
12
|
+
get(body: AcsSystemsGetBody): Promise<AcsSystemsGetResponse['acs_system']>;
|
|
13
|
+
list(body: AcsSystemsListBody): Promise<AcsSystemsListResponse['acs_systems']>;
|
|
14
|
+
}
|
|
15
|
+
export type AcsSystemsGetBody = RouteRequestBody<'/acs/systems/get'>;
|
|
16
|
+
export type AcsSystemsGetResponse = SetNonNullable<Required<RouteResponse<'/acs/systems/get'>>>;
|
|
17
|
+
export type AcsSystemsListBody = RouteRequestBody<'/acs/systems/list'>;
|
|
18
|
+
export type AcsSystemsListResponse = SetNonNullable<Required<RouteResponse<'/acs/systems/list'>>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
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, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
+
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
+
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
|
+
export class SeamHttpAcsSystems {
|
|
11
|
+
constructor(apiKeyOrOptions = {}) {
|
|
12
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = createClient(clientOptions);
|
|
14
|
+
}
|
|
15
|
+
static fromClient(client, options = {}) {
|
|
16
|
+
const constructorOptions = { ...options, client };
|
|
17
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
18
|
+
throw new SeamHttpInvalidOptionsError('Missing client');
|
|
19
|
+
}
|
|
20
|
+
return new SeamHttpAcsSystems(constructorOptions);
|
|
21
|
+
}
|
|
22
|
+
static fromApiKey(apiKey, options = {}) {
|
|
23
|
+
const constructorOptions = { ...options, apiKey };
|
|
24
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
25
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey');
|
|
26
|
+
}
|
|
27
|
+
return new SeamHttpAcsSystems(constructorOptions);
|
|
28
|
+
}
|
|
29
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
30
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
31
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
32
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken');
|
|
33
|
+
}
|
|
34
|
+
return new SeamHttpAcsSystems(constructorOptions);
|
|
35
|
+
}
|
|
36
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
39
|
+
const client = createClient(clientOptions);
|
|
40
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
|
+
const { token } = await clientSessions.getOrCreate({
|
|
42
|
+
user_identifier_key: userIdentifierKey,
|
|
43
|
+
});
|
|
44
|
+
return SeamHttpAcsSystems.fromClientSessionToken(token, options);
|
|
45
|
+
}
|
|
46
|
+
async get(body) {
|
|
47
|
+
const { data } = await this.client.request({
|
|
48
|
+
url: '/acs/systems/get',
|
|
49
|
+
method: 'post',
|
|
50
|
+
data: body,
|
|
51
|
+
});
|
|
52
|
+
return data.acs_system;
|
|
53
|
+
}
|
|
54
|
+
async list(body) {
|
|
55
|
+
const { data } = await this.client.request({
|
|
56
|
+
url: '/acs/systems/list',
|
|
57
|
+
method: 'post',
|
|
58
|
+
data: body,
|
|
59
|
+
});
|
|
60
|
+
return data.acs_systems;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=acs-systems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acs-systems.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-systems.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EAEvC,2BAA2B,GAK5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,kBAAkB;IAG7B,YAAY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O,EAAE,cAAc,EAAE,CAAC,CAAA;QAClE,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA;QAC1C,MAAM,cAAc,GAAG,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAChE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC;YACjD,mBAAmB,EAAE,iBAAiB;SACvC,CAAC,CAAA;QACF,OAAO,kBAAkB,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClE,CAAC;IAED,KAAK,CAAC,GAAG,CACP,IAAuB;QAEvB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAwB;YAChE,GAAG,EAAE,kBAAkB;YACvB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,IAAI,CACR,IAAwB;QAExB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyB;YACjE,GAAG,EAAE,mBAAmB;YACxB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
|
+
import type { SetNonNullable } from 'type-fest';
|
|
3
|
+
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken } from '../../../../lib/seam/connect/options.js';
|
|
5
|
+
export declare class SeamHttpAcsUsers {
|
|
6
|
+
client: Client;
|
|
7
|
+
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
|
+
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpAcsUsers;
|
|
9
|
+
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsUsers;
|
|
10
|
+
static fromClientSessionToken(clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], options?: Omit<SeamHttpOptionsWithClientSessionToken, 'clientSessionToken'>): SeamHttpAcsUsers;
|
|
11
|
+
static fromPublishableKey(publishableKey: string, userIdentifierKey: string, options?: SeamHttpFromPublishableKeyOptions): Promise<SeamHttpAcsUsers>;
|
|
12
|
+
addToAccessGroup(body: AcsUsersAddToAccessGroupBody): Promise<void>;
|
|
13
|
+
create(body: AcsUsersCreateBody): Promise<AcsUsersCreateResponse['acs_user']>;
|
|
14
|
+
delete(body: AcsUsersDeleteBody): Promise<void>;
|
|
15
|
+
get(body: AcsUsersGetBody): Promise<AcsUsersGetResponse['acs_user']>;
|
|
16
|
+
list(body: AcsUsersListBody): Promise<AcsUsersListResponse['acs_users']>;
|
|
17
|
+
removeFromAccessGroup(body: AcsUsersRemoveFromAccessGroupBody): Promise<void>;
|
|
18
|
+
suspend(body: AcsUsersSuspendBody): Promise<void>;
|
|
19
|
+
unsuspend(body: AcsUsersUnsuspendBody): Promise<void>;
|
|
20
|
+
update(body: AcsUsersUpdateBody): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export type AcsUsersAddToAccessGroupBody = RouteRequestBody<'/acs/users/add_to_access_group'>;
|
|
23
|
+
export type AcsUsersAddToAccessGroupResponse = SetNonNullable<Required<RouteResponse<'/acs/users/add_to_access_group'>>>;
|
|
24
|
+
export type AcsUsersCreateBody = RouteRequestBody<'/acs/users/create'>;
|
|
25
|
+
export type AcsUsersCreateResponse = SetNonNullable<Required<RouteResponse<'/acs/users/create'>>>;
|
|
26
|
+
export type AcsUsersDeleteBody = RouteRequestBody<'/acs/users/delete'>;
|
|
27
|
+
export type AcsUsersDeleteResponse = SetNonNullable<Required<RouteResponse<'/acs/users/delete'>>>;
|
|
28
|
+
export type AcsUsersGetBody = RouteRequestBody<'/acs/users/get'>;
|
|
29
|
+
export type AcsUsersGetResponse = SetNonNullable<Required<RouteResponse<'/acs/users/get'>>>;
|
|
30
|
+
export type AcsUsersListBody = RouteRequestBody<'/acs/users/list'>;
|
|
31
|
+
export type AcsUsersListResponse = SetNonNullable<Required<RouteResponse<'/acs/users/list'>>>;
|
|
32
|
+
export type AcsUsersRemoveFromAccessGroupBody = RouteRequestBody<'/acs/users/remove_from_access_group'>;
|
|
33
|
+
export type AcsUsersRemoveFromAccessGroupResponse = SetNonNullable<Required<RouteResponse<'/acs/users/remove_from_access_group'>>>;
|
|
34
|
+
export type AcsUsersSuspendBody = RouteRequestBody<'/acs/users/suspend'>;
|
|
35
|
+
export type AcsUsersSuspendResponse = SetNonNullable<Required<RouteResponse<'/acs/users/suspend'>>>;
|
|
36
|
+
export type AcsUsersUnsuspendBody = RouteRequestBody<'/acs/users/unsuspend'>;
|
|
37
|
+
export type AcsUsersUnsuspendResponse = SetNonNullable<Required<RouteResponse<'/acs/users/unsuspend'>>>;
|
|
38
|
+
export type AcsUsersUpdateBody = RouteRequestBody<'/acs/users/update'>;
|
|
39
|
+
export type AcsUsersUpdateResponse = SetNonNullable<Required<RouteResponse<'/acs/users/update'>>>;
|
|
@@ -0,0 +1,113 @@
|
|
|
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, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
+
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
+
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
|
+
export class SeamHttpAcsUsers {
|
|
11
|
+
constructor(apiKeyOrOptions = {}) {
|
|
12
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = createClient(clientOptions);
|
|
14
|
+
}
|
|
15
|
+
static fromClient(client, options = {}) {
|
|
16
|
+
const constructorOptions = { ...options, client };
|
|
17
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
18
|
+
throw new SeamHttpInvalidOptionsError('Missing client');
|
|
19
|
+
}
|
|
20
|
+
return new SeamHttpAcsUsers(constructorOptions);
|
|
21
|
+
}
|
|
22
|
+
static fromApiKey(apiKey, options = {}) {
|
|
23
|
+
const constructorOptions = { ...options, apiKey };
|
|
24
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
25
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey');
|
|
26
|
+
}
|
|
27
|
+
return new SeamHttpAcsUsers(constructorOptions);
|
|
28
|
+
}
|
|
29
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
30
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
31
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
32
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken');
|
|
33
|
+
}
|
|
34
|
+
return new SeamHttpAcsUsers(constructorOptions);
|
|
35
|
+
}
|
|
36
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
39
|
+
const client = createClient(clientOptions);
|
|
40
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
|
+
const { token } = await clientSessions.getOrCreate({
|
|
42
|
+
user_identifier_key: userIdentifierKey,
|
|
43
|
+
});
|
|
44
|
+
return SeamHttpAcsUsers.fromClientSessionToken(token, options);
|
|
45
|
+
}
|
|
46
|
+
async addToAccessGroup(body) {
|
|
47
|
+
await this.client.request({
|
|
48
|
+
url: '/acs/users/add_to_access_group',
|
|
49
|
+
method: 'post',
|
|
50
|
+
data: body,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async create(body) {
|
|
54
|
+
const { data } = await this.client.request({
|
|
55
|
+
url: '/acs/users/create',
|
|
56
|
+
method: 'post',
|
|
57
|
+
data: body,
|
|
58
|
+
});
|
|
59
|
+
return data.acs_user;
|
|
60
|
+
}
|
|
61
|
+
async delete(body) {
|
|
62
|
+
await this.client.request({
|
|
63
|
+
url: '/acs/users/delete',
|
|
64
|
+
method: 'post',
|
|
65
|
+
data: body,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async get(body) {
|
|
69
|
+
const { data } = await this.client.request({
|
|
70
|
+
url: '/acs/users/get',
|
|
71
|
+
method: 'post',
|
|
72
|
+
data: body,
|
|
73
|
+
});
|
|
74
|
+
return data.acs_user;
|
|
75
|
+
}
|
|
76
|
+
async list(body) {
|
|
77
|
+
const { data } = await this.client.request({
|
|
78
|
+
url: '/acs/users/list',
|
|
79
|
+
method: 'post',
|
|
80
|
+
data: body,
|
|
81
|
+
});
|
|
82
|
+
return data.acs_users;
|
|
83
|
+
}
|
|
84
|
+
async removeFromAccessGroup(body) {
|
|
85
|
+
await this.client.request({
|
|
86
|
+
url: '/acs/users/remove_from_access_group',
|
|
87
|
+
method: 'post',
|
|
88
|
+
data: body,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async suspend(body) {
|
|
92
|
+
await this.client.request({
|
|
93
|
+
url: '/acs/users/suspend',
|
|
94
|
+
method: 'post',
|
|
95
|
+
data: body,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
async unsuspend(body) {
|
|
99
|
+
await this.client.request({
|
|
100
|
+
url: '/acs/users/unsuspend',
|
|
101
|
+
method: 'post',
|
|
102
|
+
data: body,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async update(body) {
|
|
106
|
+
await this.client.request({
|
|
107
|
+
url: '/acs/users/update',
|
|
108
|
+
method: 'post',
|
|
109
|
+
data: body,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=acs-users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acs-users.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-users.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EAEvC,2BAA2B,GAK5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,gBAAgB;IAG3B,YAAY,kBAA4C,EAAE;QACxD,MAAM,aAAa,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,CAAC,UAAU,CACf,MAA2C,EAC3C,UAAqD,EAAE;QAEvD,MAAM,kBAAkB,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAA;QACjD,IAAI,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,EAAE;YACpD,MAAM,IAAI,2BAA2B,CAAC,gBAAgB,CAAC,CAAA;SACxD;QACD,OAAO,IAAI,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;IACjD,CAAC;IAED,M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