@seamapi/http 1.95.1 → 1.97.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/devices/devices.d.ts +13 -0
  8. package/lib/seam/connect/routes/devices/devices.js +9 -0
  9. package/lib/seam/connect/routes/devices/devices.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/devices/devices.ts +36 -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
  }
@@ -444,6 +444,9 @@ import {
444
444
  type DevicesListOptions,
445
445
  type DevicesListParameters,
446
446
  type DevicesListRequest,
447
+ type DevicesReportProviderMetadataOptions,
448
+ type DevicesReportProviderMetadataParameters,
449
+ type DevicesReportProviderMetadataRequest,
447
450
  type DevicesUpdateOptions,
448
451
  type DevicesUpdateParameters,
449
452
  type DevicesUpdateRequest,
@@ -635,6 +638,12 @@ import {
635
638
  type SeamCustomerV1ConnectorsUpdateRequest,
636
639
  SeamHttpSeamCustomerV1Connectors,
637
640
  } from './seam/customer/v1/connectors/index.js'
641
+ import {
642
+ type SeamCustomerV1CustomersListOptions,
643
+ type SeamCustomerV1CustomersListParameters,
644
+ type SeamCustomerV1CustomersListRequest,
645
+ SeamHttpSeamCustomerV1Customers,
646
+ } from './seam/customer/v1/customers/index.js'
638
647
  import {
639
648
  type SeamCustomerV1EventsListOptions,
640
649
  type SeamCustomerV1EventsListParameters,
@@ -2610,6 +2619,19 @@ export class SeamHttpEndpoints {
2610
2619
  }
2611
2620
  }
2612
2621
 
2622
+ get '/devices/report_provider_metadata'(): (
2623
+ parameters?: DevicesReportProviderMetadataParameters,
2624
+ options?: DevicesReportProviderMetadataOptions,
2625
+ ) => DevicesReportProviderMetadataRequest {
2626
+ const { client, defaults } = this
2627
+ return function devicesReportProviderMetadata(
2628
+ ...args: Parameters<SeamHttpDevices['reportProviderMetadata']>
2629
+ ): ReturnType<SeamHttpDevices['reportProviderMetadata']> {
2630
+ const seam = SeamHttpDevices.fromClient(client, defaults)
2631
+ return seam.reportProviderMetadata(...args)
2632
+ }
2633
+ }
2634
+
2613
2635
  get '/devices/update'(): (
2614
2636
  parameters?: DevicesUpdateParameters,
2615
2637
  options?: DevicesUpdateOptions,
@@ -3308,6 +3330,24 @@ export class SeamHttpEndpoints {
3308
3330
  }
3309
3331
  }
3310
3332
 
3333
+ get '/seam/customer/v1/customers/list'(): (
3334
+ parameters?: SeamCustomerV1CustomersListParameters,
3335
+ options?: SeamCustomerV1CustomersListOptions,
3336
+ ) => SeamCustomerV1CustomersListRequest {
3337
+ const { client, defaults } = this
3338
+ if (!this.defaults.isUndocumentedApiEnabled) {
3339
+ throw new Error(
3340
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
3341
+ )
3342
+ }
3343
+ return function seamCustomerV1CustomersList(
3344
+ ...args: Parameters<SeamHttpSeamCustomerV1Customers['list']>
3345
+ ): ReturnType<SeamHttpSeamCustomerV1Customers['list']> {
3346
+ const seam = SeamHttpSeamCustomerV1Customers.fromClient(client, defaults)
3347
+ return seam.list(...args)
3348
+ }
3349
+ }
3350
+
3311
3351
  get '/seam/customer/v1/events/list'(): (
3312
3352
  parameters?: SeamCustomerV1EventsListParameters,
3313
3353
  options?: SeamCustomerV1EventsListOptions,
@@ -4714,6 +4754,7 @@ export type SeamHttpEndpointQueryPaths =
4714
4754
  | '/seam/customer/v1/connectors/authorize'
4715
4755
  | '/seam/customer/v1/connectors/connector_types'
4716
4756
  | '/seam/customer/v1/connectors/list'
4757
+ | '/seam/customer/v1/customers/list'
4717
4758
  | '/seam/customer/v1/events/list'
4718
4759
  | '/seam/customer/v1/portals/get'
4719
4760
  | '/seam/customer/v1/reservations/get'
@@ -4763,6 +4804,7 @@ export type SeamHttpEndpointPaginatedQueryPaths =
4763
4804
  | '/devices/unmanaged/list'
4764
4805
  | '/seam/console/v1/timelines/get'
4765
4806
  | '/seam/customer/v1/automation_runs/list'
4807
+ | '/seam/customer/v1/customers/list'
4766
4808
  | '/seam/customer/v1/reservations/list'
4767
4809
  | '/seam/customer/v1/staff_members/list'
4768
4810
  | '/user_identities/list'
@@ -4827,6 +4869,7 @@ export type SeamHttpEndpointMutationPaths =
4827
4869
  | '/customers/delete_data'
4828
4870
  | '/customers/push_data'
4829
4871
  | '/devices/delete'
4872
+ | '/devices/report_provider_metadata'
4830
4873
  | '/devices/update'
4831
4874
  | '/devices/simulate/connect'
4832
4875
  | '/devices/simulate/connect_to_hub'
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.95.1'
1
+ const seamapiJavascriptHttpVersion = '1.97.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion