@seamapi/http 1.105.1 → 1.106.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 (30) hide show
  1. package/dist/connect.cjs +134 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +48 -3
  4. package/dist/index.cjs +136 -0
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +1 -1
  7. package/lib/seam/connect/routes/seam/customer/v1/customers/automations/automations.d.ts +47 -0
  8. package/lib/seam/connect/routes/seam/customer/v1/customers/automations/automations.js +107 -0
  9. package/lib/seam/connect/routes/seam/customer/v1/customers/automations/automations.js.map +1 -0
  10. package/lib/seam/connect/routes/seam/customer/v1/customers/automations/index.d.ts +1 -0
  11. package/lib/seam/connect/routes/seam/customer/v1/customers/automations/index.js +6 -0
  12. package/lib/seam/connect/routes/seam/customer/v1/customers/automations/index.js.map +1 -0
  13. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.d.ts +2 -0
  14. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.js +4 -0
  15. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.js.map +1 -1
  16. package/lib/seam/connect/routes/seam/customer/v1/customers/index.d.ts +1 -0
  17. package/lib/seam/connect/routes/seam/customer/v1/customers/index.js +1 -0
  18. package/lib/seam/connect/routes/seam/customer/v1/customers/index.js.map +1 -1
  19. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +5 -2
  20. package/lib/seam/connect/routes/seam-http-endpoints.js +15 -0
  21. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  22. package/lib/version.d.ts +1 -1
  23. package/lib/version.js +1 -1
  24. package/package.json +3 -3
  25. package/src/lib/seam/connect/routes/seam/customer/v1/customers/automations/automations.ts +240 -0
  26. package/src/lib/seam/connect/routes/seam/customer/v1/customers/automations/index.ts +6 -0
  27. package/src/lib/seam/connect/routes/seam/customer/v1/customers/customers.ts +9 -0
  28. package/src/lib/seam/connect/routes/seam/customer/v1/customers/index.ts +1 -0
  29. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +43 -0
  30. package/src/lib/version.ts +1 -1
@@ -0,0 +1,240 @@
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 SeamHttpSeamCustomerV1CustomersAutomations {
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
+ this.client = 'client' in options ? options.client : createClient(options)
48
+ this.defaults = limitToSeamHttpRequestOptions(options)
49
+ }
50
+
51
+ static fromClient(
52
+ client: SeamHttpOptionsWithClient['client'],
53
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
54
+ ): SeamHttpSeamCustomerV1CustomersAutomations {
55
+ const constructorOptions = { ...options, client }
56
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
57
+ throw new SeamHttpInvalidOptionsError('Missing client')
58
+ }
59
+ return new SeamHttpSeamCustomerV1CustomersAutomations(constructorOptions)
60
+ }
61
+
62
+ static fromApiKey(
63
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
64
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
65
+ ): SeamHttpSeamCustomerV1CustomersAutomations {
66
+ const constructorOptions = { ...options, apiKey }
67
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
68
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
69
+ }
70
+ return new SeamHttpSeamCustomerV1CustomersAutomations(constructorOptions)
71
+ }
72
+
73
+ static fromClientSessionToken(
74
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
75
+ options: Omit<
76
+ SeamHttpOptionsWithClientSessionToken,
77
+ 'clientSessionToken'
78
+ > = {},
79
+ ): SeamHttpSeamCustomerV1CustomersAutomations {
80
+ const constructorOptions = { ...options, clientSessionToken }
81
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
82
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
83
+ }
84
+ return new SeamHttpSeamCustomerV1CustomersAutomations(constructorOptions)
85
+ }
86
+
87
+ static async fromPublishableKey(
88
+ publishableKey: string,
89
+ userIdentifierKey: string,
90
+ options: SeamHttpFromPublishableKeyOptions = {},
91
+ ): Promise<SeamHttpSeamCustomerV1CustomersAutomations> {
92
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
93
+ const clientOptions = parseOptions({ ...options, publishableKey })
94
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
95
+ throw new SeamHttpInvalidOptionsError(
96
+ 'The client option cannot be used with SeamHttpSeamCustomerV1CustomersAutomations.fromPublishableKey',
97
+ )
98
+ }
99
+ const client = createClient(clientOptions)
100
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
101
+ const { token } = await clientSessions.getOrCreate({
102
+ user_identifier_key: userIdentifierKey,
103
+ })
104
+ return SeamHttpSeamCustomerV1CustomersAutomations.fromClientSessionToken(
105
+ token,
106
+ options,
107
+ )
108
+ }
109
+
110
+ static fromConsoleSessionToken(
111
+ consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
112
+ workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
113
+ options: Omit<
114
+ SeamHttpOptionsWithConsoleSessionToken,
115
+ 'consoleSessionToken' | 'workspaceId'
116
+ > = {},
117
+ ): SeamHttpSeamCustomerV1CustomersAutomations {
118
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
119
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
120
+ throw new SeamHttpInvalidOptionsError(
121
+ 'Missing consoleSessionToken or workspaceId',
122
+ )
123
+ }
124
+ return new SeamHttpSeamCustomerV1CustomersAutomations(constructorOptions)
125
+ }
126
+
127
+ static fromPersonalAccessToken(
128
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
129
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
130
+ options: Omit<
131
+ SeamHttpOptionsWithPersonalAccessToken,
132
+ 'personalAccessToken' | 'workspaceId'
133
+ > = {},
134
+ ): SeamHttpSeamCustomerV1CustomersAutomations {
135
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
136
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
137
+ throw new SeamHttpInvalidOptionsError(
138
+ 'Missing personalAccessToken or workspaceId',
139
+ )
140
+ }
141
+ return new SeamHttpSeamCustomerV1CustomersAutomations(constructorOptions)
142
+ }
143
+
144
+ createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
145
+ request: SeamHttpRequest<TResponse, TResponseKey>,
146
+ ): SeamPaginator<TResponse, TResponseKey> {
147
+ return new SeamPaginator<TResponse, TResponseKey>(this, request)
148
+ }
149
+
150
+ async updateClientSessionToken(
151
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
152
+ ): Promise<void> {
153
+ const { headers } = this.client.defaults
154
+ const authHeaders = getAuthHeadersForClientSessionToken({
155
+ clientSessionToken,
156
+ })
157
+ for (const key of Object.keys(authHeaders)) {
158
+ if (headers[key] == null) {
159
+ throw new Error(
160
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
161
+ )
162
+ }
163
+ }
164
+ this.client.defaults.headers = { ...headers, ...authHeaders }
165
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
166
+ await clientSessions.get()
167
+ }
168
+
169
+ get(
170
+ parameters?: SeamCustomerV1CustomersAutomationsGetParameters,
171
+ options: SeamCustomerV1CustomersAutomationsGetOptions = {},
172
+ ): SeamCustomerV1CustomersAutomationsGetRequest {
173
+ return new SeamHttpRequest(this, {
174
+ pathname: '/seam/customer/v1/customers/automations/get',
175
+ method: 'POST',
176
+ body: parameters,
177
+ responseKey: 'automation',
178
+ options,
179
+ })
180
+ }
181
+
182
+ update(
183
+ parameters?: SeamCustomerV1CustomersAutomationsUpdateParameters,
184
+ options: SeamCustomerV1CustomersAutomationsUpdateOptions = {},
185
+ ): SeamCustomerV1CustomersAutomationsUpdateRequest {
186
+ return new SeamHttpRequest(this, {
187
+ pathname: '/seam/customer/v1/customers/automations/update',
188
+ method: 'PATCH',
189
+ body: parameters,
190
+ responseKey: undefined,
191
+ options,
192
+ })
193
+ }
194
+ }
195
+
196
+ export type SeamCustomerV1CustomersAutomationsGetParameters =
197
+ RouteRequestBody<'/seam/customer/v1/customers/automations/get'>
198
+
199
+ /**
200
+ * @deprecated Use SeamCustomerV1CustomersAutomationsGetParameters instead.
201
+ */
202
+ export type SeamCustomerV1CustomersAutomationsGetParams =
203
+ SeamCustomerV1CustomersAutomationsGetParameters
204
+
205
+ /**
206
+ * @deprecated Use SeamCustomerV1CustomersAutomationsGetRequest instead.
207
+ */
208
+ export type SeamCustomerV1CustomersAutomationsGetResponse = SetNonNullable<
209
+ Required<RouteResponse<'/seam/customer/v1/customers/automations/get'>>
210
+ >
211
+
212
+ export type SeamCustomerV1CustomersAutomationsGetRequest = SeamHttpRequest<
213
+ SeamCustomerV1CustomersAutomationsGetResponse,
214
+ 'automation'
215
+ >
216
+
217
+ export interface SeamCustomerV1CustomersAutomationsGetOptions {}
218
+
219
+ export type SeamCustomerV1CustomersAutomationsUpdateParameters =
220
+ RouteRequestBody<'/seam/customer/v1/customers/automations/update'>
221
+
222
+ /**
223
+ * @deprecated Use SeamCustomerV1CustomersAutomationsUpdateParameters instead.
224
+ */
225
+ export type SeamCustomerV1CustomersAutomationsUpdateBody =
226
+ SeamCustomerV1CustomersAutomationsUpdateParameters
227
+
228
+ /**
229
+ * @deprecated Use SeamCustomerV1CustomersAutomationsUpdateRequest instead.
230
+ */
231
+ export type SeamCustomerV1CustomersAutomationsUpdateResponse = SetNonNullable<
232
+ Required<RouteResponse<'/seam/customer/v1/customers/automations/update'>>
233
+ >
234
+
235
+ export type SeamCustomerV1CustomersAutomationsUpdateRequest = SeamHttpRequest<
236
+ void,
237
+ undefined
238
+ >
239
+
240
+ export interface SeamCustomerV1CustomersAutomationsUpdateOptions {}
@@ -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 './automations.js'
@@ -40,6 +40,8 @@ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
40
40
  import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
41
41
  import type { SetNonNullable } from 'lib/types.js'
42
42
 
43
+ import { SeamHttpSeamCustomerV1CustomersAutomations } from './automations/index.js'
44
+
43
45
  export class SeamHttpSeamCustomerV1Customers {
44
46
  client: Client
45
47
  readonly defaults: Required<SeamHttpRequestOptions>
@@ -170,6 +172,13 @@ export class SeamHttpSeamCustomerV1Customers {
170
172
  await clientSessions.get()
171
173
  }
172
174
 
175
+ get automations(): SeamHttpSeamCustomerV1CustomersAutomations {
176
+ return SeamHttpSeamCustomerV1CustomersAutomations.fromClient(
177
+ this.client,
178
+ this.defaults,
179
+ )
180
+ }
181
+
173
182
  list(
174
183
  parameters?: SeamCustomerV1CustomersListParameters,
175
184
  options: SeamCustomerV1CustomersListOptions = {},
@@ -3,4 +3,5 @@
3
3
  * Do not edit this file or add other files to this directory.
4
4
  */
5
5
 
6
+ export * from './automations/index.js'
6
7
  export * from './customers.js'
@@ -665,6 +665,15 @@ import {
665
665
  type SeamCustomerV1ConnectorsUpdateRequest,
666
666
  SeamHttpSeamCustomerV1Connectors,
667
667
  } from './seam/customer/v1/connectors/index.js'
668
+ import {
669
+ type SeamCustomerV1CustomersAutomationsGetOptions,
670
+ type SeamCustomerV1CustomersAutomationsGetParameters,
671
+ type SeamCustomerV1CustomersAutomationsGetRequest,
672
+ type SeamCustomerV1CustomersAutomationsUpdateOptions,
673
+ type SeamCustomerV1CustomersAutomationsUpdateParameters,
674
+ type SeamCustomerV1CustomersAutomationsUpdateRequest,
675
+ SeamHttpSeamCustomerV1CustomersAutomations,
676
+ } from './seam/customer/v1/customers/automations/index.js'
668
677
  import {
669
678
  type SeamCustomerV1CustomersListOptions,
670
679
  type SeamCustomerV1CustomersListParameters,
@@ -3480,6 +3489,38 @@ export class SeamHttpEndpoints {
3480
3489
  }
3481
3490
  }
3482
3491
 
3492
+ get '/seam/customer/v1/customers/automations/get'(): (
3493
+ parameters?: SeamCustomerV1CustomersAutomationsGetParameters,
3494
+ options?: SeamCustomerV1CustomersAutomationsGetOptions,
3495
+ ) => SeamCustomerV1CustomersAutomationsGetRequest {
3496
+ const { client, defaults } = this
3497
+ return function seamCustomerV1CustomersAutomationsGet(
3498
+ ...args: Parameters<SeamHttpSeamCustomerV1CustomersAutomations['get']>
3499
+ ): ReturnType<SeamHttpSeamCustomerV1CustomersAutomations['get']> {
3500
+ const seam = SeamHttpSeamCustomerV1CustomersAutomations.fromClient(
3501
+ client,
3502
+ defaults,
3503
+ )
3504
+ return seam.get(...args)
3505
+ }
3506
+ }
3507
+
3508
+ get '/seam/customer/v1/customers/automations/update'(): (
3509
+ parameters?: SeamCustomerV1CustomersAutomationsUpdateParameters,
3510
+ options?: SeamCustomerV1CustomersAutomationsUpdateOptions,
3511
+ ) => SeamCustomerV1CustomersAutomationsUpdateRequest {
3512
+ const { client, defaults } = this
3513
+ return function seamCustomerV1CustomersAutomationsUpdate(
3514
+ ...args: Parameters<SeamHttpSeamCustomerV1CustomersAutomations['update']>
3515
+ ): ReturnType<SeamHttpSeamCustomerV1CustomersAutomations['update']> {
3516
+ const seam = SeamHttpSeamCustomerV1CustomersAutomations.fromClient(
3517
+ client,
3518
+ defaults,
3519
+ )
3520
+ return seam.update(...args)
3521
+ }
3522
+ }
3523
+
3483
3524
  get '/seam/customer/v1/customers/list'(): (
3484
3525
  parameters?: SeamCustomerV1CustomersListParameters,
3485
3526
  options?: SeamCustomerV1CustomersListOptions,
@@ -4994,6 +5035,7 @@ export type SeamHttpEndpointQueryPaths =
4994
5035
  | '/seam/customer/v1/connectors/authorize'
4995
5036
  | '/seam/customer/v1/connectors/connector_types'
4996
5037
  | '/seam/customer/v1/connectors/list'
5038
+ | '/seam/customer/v1/customers/automations/get'
4997
5039
  | '/seam/customer/v1/customers/list'
4998
5040
  | '/seam/customer/v1/customers/me'
4999
5041
  | '/seam/customer/v1/encoders/list'
@@ -5142,6 +5184,7 @@ export type SeamHttpEndpointMutationPaths =
5142
5184
  | '/seam/customer/v1/connectors/delete'
5143
5185
  | '/seam/customer/v1/connectors/sync'
5144
5186
  | '/seam/customer/v1/connectors/update'
5187
+ | '/seam/customer/v1/customers/automations/update'
5145
5188
  | '/seam/customer/v1/customers/open_portal'
5146
5189
  | '/seam/customer/v1/settings/update'
5147
5190
  | '/seam/customer/v1/spaces/create'
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.105.1'
1
+ const seamapiJavascriptHttpVersion = '1.106.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion