@seamapi/http 1.96.0 → 1.98.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.
Files changed (34) hide show
  1. package/dist/connect.cjs +143 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +49 -4
  4. package/dist/index.cjs +145 -0
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +1 -1
  7. package/lib/seam/connect/routes/acs/access-groups/access-groups.d.ts +13 -0
  8. package/lib/seam/connect/routes/acs/access-groups/access-groups.js +9 -0
  9. package/lib/seam/connect/routes/acs/access-groups/access-groups.js.map +1 -1
  10. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.d.ts +34 -0
  11. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.js +104 -0
  12. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.js.map +1 -0
  13. package/lib/seam/connect/routes/seam/customer/v1/customers/index.d.ts +1 -0
  14. package/lib/seam/connect/routes/seam/customer/v1/customers/index.js +6 -0
  15. package/lib/seam/connect/routes/seam/customer/v1/customers/index.js.map +1 -0
  16. package/lib/seam/connect/routes/seam/customer/v1/index.d.ts +1 -0
  17. package/lib/seam/connect/routes/seam/customer/v1/index.js +1 -0
  18. package/lib/seam/connect/routes/seam/customer/v1/index.js.map +1 -1
  19. package/lib/seam/connect/routes/seam/customer/v1/v1.d.ts +2 -0
  20. package/lib/seam/connect/routes/seam/customer/v1/v1.js +4 -0
  21. package/lib/seam/connect/routes/seam/customer/v1/v1.js.map +1 -1
  22. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +7 -4
  23. package/lib/seam/connect/routes/seam-http-endpoints.js +18 -0
  24. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  25. package/lib/version.d.ts +1 -1
  26. package/lib/version.js +1 -1
  27. package/package.json +3 -3
  28. package/src/lib/seam/connect/routes/acs/access-groups/access-groups.ts +32 -0
  29. package/src/lib/seam/connect/routes/seam/customer/v1/customers/customers.ts +214 -0
  30. package/src/lib/seam/connect/routes/seam/customer/v1/customers/index.ts +6 -0
  31. package/src/lib/seam/connect/routes/seam/customer/v1/index.ts +1 -0
  32. package/src/lib/seam/connect/routes/seam/customer/v1/v1.ts +8 -0
  33. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +43 -0
  34. package/src/lib/version.ts +1 -1
@@ -0,0 +1,214 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.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
+
8
+ import { seamApiLtsVersion } from 'lib/lts-version.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
13
+ import { type Client, createClient } from 'lib/seam/connect/client.js'
14
+ import {
15
+ isSeamHttpOptionsWithApiKey,
16
+ isSeamHttpOptionsWithClient,
17
+ isSeamHttpOptionsWithClientSessionToken,
18
+ isSeamHttpOptionsWithConsoleSessionToken,
19
+ isSeamHttpOptionsWithPersonalAccessToken,
20
+ type SeamHttpFromPublishableKeyOptions,
21
+ SeamHttpInvalidOptionsError,
22
+ type SeamHttpOptions,
23
+ type SeamHttpOptionsWithApiKey,
24
+ type SeamHttpOptionsWithClient,
25
+ type SeamHttpOptionsWithClientSessionToken,
26
+ type SeamHttpOptionsWithConsoleSessionToken,
27
+ type SeamHttpOptionsWithPersonalAccessToken,
28
+ type SeamHttpRequestOptions,
29
+ } from 'lib/seam/connect/options.js'
30
+ import {
31
+ limitToSeamHttpRequestOptions,
32
+ parseOptions,
33
+ } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js'
35
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
36
+ import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
37
+ import type { SetNonNullable } from 'lib/types.js'
38
+
39
+ export class SeamHttpSeamCustomerV1Customers {
40
+ client: Client
41
+ readonly defaults: Required<SeamHttpRequestOptions>
42
+ readonly ltsVersion = seamApiLtsVersion
43
+ static ltsVersion = seamApiLtsVersion
44
+
45
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
46
+ const options = parseOptions(apiKeyOrOptions)
47
+ if (!options.isUndocumentedApiEnabled) {
48
+ throw new Error(
49
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
50
+ )
51
+ }
52
+ this.client = 'client' in options ? options.client : createClient(options)
53
+ this.defaults = limitToSeamHttpRequestOptions(options)
54
+ }
55
+
56
+ static fromClient(
57
+ client: SeamHttpOptionsWithClient['client'],
58
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
59
+ ): SeamHttpSeamCustomerV1Customers {
60
+ const constructorOptions = { ...options, client }
61
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
+ throw new SeamHttpInvalidOptionsError('Missing client')
63
+ }
64
+ return new SeamHttpSeamCustomerV1Customers(constructorOptions)
65
+ }
66
+
67
+ static fromApiKey(
68
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
+ ): SeamHttpSeamCustomerV1Customers {
71
+ const constructorOptions = { ...options, apiKey }
72
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
+ }
75
+ return new SeamHttpSeamCustomerV1Customers(constructorOptions)
76
+ }
77
+
78
+ static fromClientSessionToken(
79
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
+ options: Omit<
81
+ SeamHttpOptionsWithClientSessionToken,
82
+ 'clientSessionToken'
83
+ > = {},
84
+ ): SeamHttpSeamCustomerV1Customers {
85
+ const constructorOptions = { ...options, clientSessionToken }
86
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
+ }
89
+ return new SeamHttpSeamCustomerV1Customers(constructorOptions)
90
+ }
91
+
92
+ static async fromPublishableKey(
93
+ publishableKey: string,
94
+ userIdentifierKey: string,
95
+ options: SeamHttpFromPublishableKeyOptions = {},
96
+ ): Promise<SeamHttpSeamCustomerV1Customers> {
97
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
98
+ const clientOptions = parseOptions({ ...options, publishableKey })
99
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
100
+ throw new SeamHttpInvalidOptionsError(
101
+ 'The client option cannot be used with SeamHttpSeamCustomerV1Customers.fromPublishableKey',
102
+ )
103
+ }
104
+ const client = createClient(clientOptions)
105
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
106
+ const { token } = await clientSessions.getOrCreate({
107
+ user_identifier_key: userIdentifierKey,
108
+ })
109
+ return SeamHttpSeamCustomerV1Customers.fromClientSessionToken(
110
+ token,
111
+ options,
112
+ )
113
+ }
114
+
115
+ static fromConsoleSessionToken(
116
+ consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
117
+ workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
118
+ options: Omit<
119
+ SeamHttpOptionsWithConsoleSessionToken,
120
+ 'consoleSessionToken' | 'workspaceId'
121
+ > = {},
122
+ ): SeamHttpSeamCustomerV1Customers {
123
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
124
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
125
+ throw new SeamHttpInvalidOptionsError(
126
+ 'Missing consoleSessionToken or workspaceId',
127
+ )
128
+ }
129
+ return new SeamHttpSeamCustomerV1Customers(constructorOptions)
130
+ }
131
+
132
+ static fromPersonalAccessToken(
133
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
134
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
135
+ options: Omit<
136
+ SeamHttpOptionsWithPersonalAccessToken,
137
+ 'personalAccessToken' | 'workspaceId'
138
+ > = {},
139
+ ): SeamHttpSeamCustomerV1Customers {
140
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
141
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
142
+ throw new SeamHttpInvalidOptionsError(
143
+ 'Missing personalAccessToken or workspaceId',
144
+ )
145
+ }
146
+ return new SeamHttpSeamCustomerV1Customers(constructorOptions)
147
+ }
148
+
149
+ createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
150
+ request: SeamHttpRequest<TResponse, TResponseKey>,
151
+ ): SeamPaginator<TResponse, TResponseKey> {
152
+ return new SeamPaginator<TResponse, TResponseKey>(this, request)
153
+ }
154
+
155
+ async updateClientSessionToken(
156
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
157
+ ): Promise<void> {
158
+ const { headers } = this.client.defaults
159
+ const authHeaders = getAuthHeadersForClientSessionToken({
160
+ clientSessionToken,
161
+ })
162
+ for (const key of Object.keys(authHeaders)) {
163
+ if (headers[key] == null) {
164
+ throw new Error(
165
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
166
+ )
167
+ }
168
+ }
169
+ this.client.defaults.headers = { ...headers, ...authHeaders }
170
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
171
+ await clientSessions.get()
172
+ }
173
+
174
+ list(
175
+ parameters?: SeamCustomerV1CustomersListParameters,
176
+ options: SeamCustomerV1CustomersListOptions = {},
177
+ ): SeamCustomerV1CustomersListRequest {
178
+ if (!this.defaults.isUndocumentedApiEnabled) {
179
+ throw new Error(
180
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
181
+ )
182
+ }
183
+ return new SeamHttpRequest(this, {
184
+ pathname: '/seam/customer/v1/customers/list',
185
+ method: 'POST',
186
+ body: parameters,
187
+ responseKey: 'customers',
188
+ options,
189
+ })
190
+ }
191
+ }
192
+
193
+ export type SeamCustomerV1CustomersListParameters =
194
+ RouteRequestBody<'/seam/customer/v1/customers/list'>
195
+
196
+ /**
197
+ * @deprecated Use SeamCustomerV1CustomersListParameters instead.
198
+ */
199
+ export type SeamCustomerV1CustomersListParams =
200
+ SeamCustomerV1CustomersListParameters
201
+
202
+ /**
203
+ * @deprecated Use SeamCustomerV1CustomersListRequest instead.
204
+ */
205
+ export type SeamCustomerV1CustomersListResponse = SetNonNullable<
206
+ Required<RouteResponse<'/seam/customer/v1/customers/list'>>
207
+ >
208
+
209
+ export type SeamCustomerV1CustomersListRequest = SeamHttpRequest<
210
+ SeamCustomerV1CustomersListResponse,
211
+ 'customers'
212
+ >
213
+
214
+ export interface SeamCustomerV1CustomersListOptions {}
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ export * from './customers.js'
@@ -7,6 +7,7 @@ export * from './access-grants/index.js'
7
7
  export * from './automation-runs/index.js'
8
8
  export * from './automations/index.js'
9
9
  export * from './connectors/index.js'
10
+ export * from './customers/index.js'
10
11
  export * from './events/index.js'
11
12
  export * from './portals/index.js'
12
13
  export * from './reservations/index.js'
@@ -37,6 +37,7 @@ import { SeamHttpSeamCustomerV1AccessGrants } from './access-grants/index.js'
37
37
  import { SeamHttpSeamCustomerV1AutomationRuns } from './automation-runs/index.js'
38
38
  import { SeamHttpSeamCustomerV1Automations } from './automations/index.js'
39
39
  import { SeamHttpSeamCustomerV1Connectors } from './connectors/index.js'
40
+ import { SeamHttpSeamCustomerV1Customers } from './customers/index.js'
40
41
  import { SeamHttpSeamCustomerV1Events } from './events/index.js'
41
42
  import { SeamHttpSeamCustomerV1Portals } from './portals/index.js'
42
43
  import { SeamHttpSeamCustomerV1Reservations } from './reservations/index.js'
@@ -204,6 +205,13 @@ export class SeamHttpSeamCustomerV1 {
204
205
  )
205
206
  }
206
207
 
208
+ get customers(): SeamHttpSeamCustomerV1Customers {
209
+ return SeamHttpSeamCustomerV1Customers.fromClient(
210
+ this.client,
211
+ this.defaults,
212
+ )
213
+ }
214
+
207
215
  get events(): SeamHttpSeamCustomerV1Events {
208
216
  return SeamHttpSeamCustomerV1Events.fromClient(this.client, this.defaults)
209
217
  }
@@ -156,6 +156,9 @@ import {
156
156
  type AcsAccessGroupsAddUserOptions,
157
157
  type AcsAccessGroupsAddUserParameters,
158
158
  type AcsAccessGroupsAddUserRequest,
159
+ type AcsAccessGroupsDeleteOptions,
160
+ type AcsAccessGroupsDeleteParameters,
161
+ type AcsAccessGroupsDeleteRequest,
159
162
  type AcsAccessGroupsGetOptions,
160
163
  type AcsAccessGroupsGetParameters,
161
164
  type AcsAccessGroupsGetRequest,
@@ -638,6 +641,12 @@ import {
638
641
  type SeamCustomerV1ConnectorsUpdateRequest,
639
642
  SeamHttpSeamCustomerV1Connectors,
640
643
  } from './seam/customer/v1/connectors/index.js'
644
+ import {
645
+ type SeamCustomerV1CustomersListOptions,
646
+ type SeamCustomerV1CustomersListParameters,
647
+ type SeamCustomerV1CustomersListRequest,
648
+ SeamHttpSeamCustomerV1Customers,
649
+ } from './seam/customer/v1/customers/index.js'
641
650
  import {
642
651
  type SeamCustomerV1EventsListOptions,
643
652
  type SeamCustomerV1EventsListParameters,
@@ -1528,6 +1537,19 @@ export class SeamHttpEndpoints {
1528
1537
  }
1529
1538
  }
1530
1539
 
1540
+ get '/acs/access_groups/delete'(): (
1541
+ parameters?: AcsAccessGroupsDeleteParameters,
1542
+ options?: AcsAccessGroupsDeleteOptions,
1543
+ ) => AcsAccessGroupsDeleteRequest {
1544
+ const { client, defaults } = this
1545
+ return function acsAccessGroupsDelete(
1546
+ ...args: Parameters<SeamHttpAcsAccessGroups['delete']>
1547
+ ): ReturnType<SeamHttpAcsAccessGroups['delete']> {
1548
+ const seam = SeamHttpAcsAccessGroups.fromClient(client, defaults)
1549
+ return seam.delete(...args)
1550
+ }
1551
+ }
1552
+
1531
1553
  get '/acs/access_groups/get'(): (
1532
1554
  parameters?: AcsAccessGroupsGetParameters,
1533
1555
  options?: AcsAccessGroupsGetOptions,
@@ -3324,6 +3346,24 @@ export class SeamHttpEndpoints {
3324
3346
  }
3325
3347
  }
3326
3348
 
3349
+ get '/seam/customer/v1/customers/list'(): (
3350
+ parameters?: SeamCustomerV1CustomersListParameters,
3351
+ options?: SeamCustomerV1CustomersListOptions,
3352
+ ) => SeamCustomerV1CustomersListRequest {
3353
+ const { client, defaults } = this
3354
+ if (!this.defaults.isUndocumentedApiEnabled) {
3355
+ throw new Error(
3356
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
3357
+ )
3358
+ }
3359
+ return function seamCustomerV1CustomersList(
3360
+ ...args: Parameters<SeamHttpSeamCustomerV1Customers['list']>
3361
+ ): ReturnType<SeamHttpSeamCustomerV1Customers['list']> {
3362
+ const seam = SeamHttpSeamCustomerV1Customers.fromClient(client, defaults)
3363
+ return seam.list(...args)
3364
+ }
3365
+ }
3366
+
3327
3367
  get '/seam/customer/v1/events/list'(): (
3328
3368
  parameters?: SeamCustomerV1EventsListParameters,
3329
3369
  options?: SeamCustomerV1EventsListOptions,
@@ -4730,6 +4770,7 @@ export type SeamHttpEndpointQueryPaths =
4730
4770
  | '/seam/customer/v1/connectors/authorize'
4731
4771
  | '/seam/customer/v1/connectors/connector_types'
4732
4772
  | '/seam/customer/v1/connectors/list'
4773
+ | '/seam/customer/v1/customers/list'
4733
4774
  | '/seam/customer/v1/events/list'
4734
4775
  | '/seam/customer/v1/portals/get'
4735
4776
  | '/seam/customer/v1/reservations/get'
@@ -4779,6 +4820,7 @@ export type SeamHttpEndpointPaginatedQueryPaths =
4779
4820
  | '/devices/unmanaged/list'
4780
4821
  | '/seam/console/v1/timelines/get'
4781
4822
  | '/seam/customer/v1/automation_runs/list'
4823
+ | '/seam/customer/v1/customers/list'
4782
4824
  | '/seam/customer/v1/reservations/list'
4783
4825
  | '/seam/customer/v1/staff_members/list'
4784
4826
  | '/user_identities/list'
@@ -4804,6 +4846,7 @@ export type SeamHttpEndpointMutationPaths =
4804
4846
  | '/access_methods/delete'
4805
4847
  | '/access_methods/encode'
4806
4848
  | '/acs/access_groups/add_user'
4849
+ | '/acs/access_groups/delete'
4807
4850
  | '/acs/access_groups/remove_user'
4808
4851
  | '/acs/credential_provisioning_automations/launch'
4809
4852
  | '/acs/credentials/assign'
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.96.0'
1
+ const seamapiJavascriptHttpVersion = '1.98.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion