@seamapi/http 1.101.0 → 1.105.1

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 (109) hide show
  1. package/README.md +0 -1
  2. package/dist/connect.cjs +790 -294
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +215 -52
  5. package/dist/index.cjs +800 -298
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +1 -1
  8. package/lib/seam/connect/routes/access-codes/access-codes.d.ts +13 -0
  9. package/lib/seam/connect/routes/access-codes/access-codes.js +9 -0
  10. package/lib/seam/connect/routes/access-codes/access-codes.js.map +1 -1
  11. package/lib/seam/connect/routes/access-methods/access-methods.d.ts +2 -2
  12. package/lib/seam/connect/routes/access-methods/access-methods.js +2 -2
  13. package/lib/seam/connect/routes/access-methods/access-methods.js.map +1 -1
  14. package/lib/seam/connect/routes/customers/customers.d.ts +2 -0
  15. package/lib/seam/connect/routes/customers/customers.js +4 -0
  16. package/lib/seam/connect/routes/customers/customers.js.map +1 -1
  17. package/lib/seam/connect/routes/customers/index.d.ts +1 -0
  18. package/lib/seam/connect/routes/customers/index.js +1 -0
  19. package/lib/seam/connect/routes/customers/index.js.map +1 -1
  20. package/lib/seam/connect/routes/customers/reservations/index.d.ts +1 -0
  21. package/lib/seam/connect/routes/{seam/v1 → customers/reservations}/index.js +1 -2
  22. package/lib/seam/connect/routes/customers/reservations/index.js.map +1 -0
  23. package/lib/seam/connect/routes/{seam/v1/v1.d.ts → customers/reservations/reservations.d.ts} +23 -10
  24. package/lib/seam/connect/routes/{seam/v1/v1.js → customers/reservations/reservations.js} +18 -12
  25. package/lib/seam/connect/routes/customers/reservations/reservations.js.map +1 -0
  26. package/lib/seam/connect/routes/seam/customer/v1/access-grants/access-grants.d.ts +13 -0
  27. package/lib/seam/connect/routes/seam/customer/v1/access-grants/access-grants.js +12 -0
  28. package/lib/seam/connect/routes/seam/customer/v1/access-grants/access-grants.js.map +1 -1
  29. package/lib/seam/connect/routes/seam/customer/v1/access-methods/access-methods.d.ts +33 -0
  30. package/lib/seam/connect/routes/seam/customer/v1/access-methods/access-methods.js +104 -0
  31. package/lib/seam/connect/routes/seam/customer/v1/access-methods/access-methods.js.map +1 -0
  32. package/lib/seam/connect/routes/seam/customer/v1/access-methods/index.d.ts +1 -0
  33. package/lib/seam/connect/routes/seam/customer/v1/access-methods/index.js +6 -0
  34. package/lib/seam/connect/routes/seam/customer/v1/access-methods/index.js.map +1 -0
  35. package/lib/seam/connect/routes/seam/customer/v1/connector-customers/connector-customers.d.ts +34 -0
  36. package/lib/seam/connect/routes/seam/customer/v1/connector-customers/connector-customers.js +104 -0
  37. package/lib/seam/connect/routes/seam/customer/v1/connector-customers/connector-customers.js.map +1 -0
  38. package/lib/seam/connect/routes/seam/customer/v1/connector-customers/index.d.ts +1 -0
  39. package/lib/seam/connect/routes/seam/customer/v1/connector-customers/index.js +6 -0
  40. package/lib/seam/connect/routes/seam/customer/v1/connector-customers/index.js.map +1 -0
  41. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.d.ts +14 -1
  42. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.js +9 -3
  43. package/lib/seam/connect/routes/seam/customer/v1/customers/customers.js.map +1 -1
  44. package/lib/seam/connect/routes/seam/{v1/customers/customers.d.ts → customer/v1/encoders/encoders.d.ts} +20 -20
  45. package/lib/seam/connect/routes/seam/{v1/customers/customers.js → customer/v1/encoders/encoders.js} +26 -20
  46. package/lib/seam/connect/routes/seam/customer/v1/encoders/encoders.js.map +1 -0
  47. package/lib/seam/connect/routes/seam/customer/v1/encoders/index.d.ts +1 -0
  48. package/lib/seam/connect/routes/seam/{v1/customers → customer/v1/encoders}/index.js +1 -1
  49. package/lib/seam/connect/routes/seam/customer/v1/encoders/index.js.map +1 -0
  50. package/lib/seam/connect/routes/seam/customer/v1/index.d.ts +3 -0
  51. package/lib/seam/connect/routes/seam/customer/v1/index.js +3 -0
  52. package/lib/seam/connect/routes/seam/customer/v1/index.js.map +1 -1
  53. package/lib/seam/connect/routes/seam/customer/v1/settings/index.d.ts +1 -0
  54. package/lib/seam/connect/routes/seam/customer/v1/settings/index.js +1 -0
  55. package/lib/seam/connect/routes/seam/customer/v1/settings/index.js.map +1 -1
  56. package/lib/seam/connect/routes/seam/customer/v1/settings/settings.d.ts +2 -0
  57. package/lib/seam/connect/routes/seam/customer/v1/settings/settings.js +4 -0
  58. package/lib/seam/connect/routes/seam/customer/v1/settings/settings.js.map +1 -1
  59. package/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/index.d.ts +1 -0
  60. package/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/index.js +6 -0
  61. package/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/index.js.map +1 -0
  62. package/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/vertical-resource-aliases.d.ts +34 -0
  63. package/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/vertical-resource-aliases.js +104 -0
  64. package/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/vertical-resource-aliases.js.map +1 -0
  65. package/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.d.ts +13 -0
  66. package/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.js +9 -3
  67. package/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.js.map +1 -1
  68. package/lib/seam/connect/routes/seam/customer/v1/v1.d.ts +6 -0
  69. package/lib/seam/connect/routes/seam/customer/v1/v1.js +12 -3
  70. package/lib/seam/connect/routes/seam/customer/v1/v1.js.map +1 -1
  71. package/lib/seam/connect/routes/seam/index.d.ts +0 -1
  72. package/lib/seam/connect/routes/seam/index.js +0 -1
  73. package/lib/seam/connect/routes/seam/index.js.map +1 -1
  74. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +21 -9
  75. package/lib/seam/connect/routes/seam-http-endpoints.js +83 -8
  76. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  77. package/lib/version.d.ts +1 -1
  78. package/lib/version.js +1 -1
  79. package/package.json +6 -6
  80. package/src/lib/seam/connect/routes/access-codes/access-codes.ts +35 -0
  81. package/src/lib/seam/connect/routes/access-methods/access-methods.ts +8 -4
  82. package/src/lib/seam/connect/routes/customers/customers.ts +6 -0
  83. package/src/lib/seam/connect/routes/customers/index.ts +1 -0
  84. package/src/lib/seam/connect/routes/{seam/v1 → customers/reservations}/index.ts +1 -2
  85. package/src/lib/seam/connect/routes/{seam/v1/customers/customers.ts → customers/reservations/reservations.ts} +33 -29
  86. package/src/lib/seam/connect/routes/seam/customer/v1/access-grants/access-grants.ts +41 -0
  87. package/src/lib/seam/connect/routes/seam/customer/v1/access-methods/access-methods.ts +217 -0
  88. package/src/lib/seam/connect/routes/seam/customer/v1/access-methods/index.ts +6 -0
  89. package/src/lib/seam/connect/routes/seam/customer/v1/connector-customers/connector-customers.ts +214 -0
  90. package/src/lib/seam/connect/routes/seam/customer/v1/connector-customers/index.ts +6 -0
  91. package/src/lib/seam/connect/routes/seam/customer/v1/customers/customers.ts +38 -6
  92. package/src/lib/seam/connect/routes/seam/{v1/v1.ts → customer/v1/encoders/encoders.ts} +62 -19
  93. package/src/lib/seam/connect/routes/seam/{v1/customers → customer/v1/encoders}/index.ts +1 -1
  94. package/src/lib/seam/connect/routes/seam/customer/v1/index.ts +3 -0
  95. package/src/lib/seam/connect/routes/seam/customer/v1/settings/index.ts +1 -0
  96. package/src/lib/seam/connect/routes/seam/customer/v1/settings/settings.ts +9 -0
  97. package/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/index.ts +6 -0
  98. package/src/lib/seam/connect/routes/seam/customer/v1/settings/vertical-resource-aliases/vertical-resource-aliases.ts +228 -0
  99. package/src/lib/seam/connect/routes/seam/customer/v1/spaces/spaces.ts +36 -5
  100. package/src/lib/seam/connect/routes/seam/customer/v1/v1.ts +21 -5
  101. package/src/lib/seam/connect/routes/seam/index.ts +0 -1
  102. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +210 -21
  103. package/src/lib/version.ts +1 -1
  104. package/lib/seam/connect/routes/seam/v1/customers/customers.js.map +0 -1
  105. package/lib/seam/connect/routes/seam/v1/customers/index.d.ts +0 -1
  106. package/lib/seam/connect/routes/seam/v1/customers/index.js.map +0 -1
  107. package/lib/seam/connect/routes/seam/v1/index.d.ts +0 -2
  108. package/lib/seam/connect/routes/seam/v1/index.js.map +0 -1
  109. package/lib/seam/connect/routes/seam/v1/v1.js.map +0 -1
@@ -36,7 +36,7 @@ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
36
36
  import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
37
37
  import type { SetNonNullable } from 'lib/types.js'
38
38
 
39
- export class SeamHttpSeamV1Customers {
39
+ export class SeamHttpCustomersReservations {
40
40
  client: Client
41
41
  readonly defaults: Required<SeamHttpRequestOptions>
42
42
  readonly ltsVersion = seamApiLtsVersion
@@ -51,23 +51,23 @@ export class SeamHttpSeamV1Customers {
51
51
  static fromClient(
52
52
  client: SeamHttpOptionsWithClient['client'],
53
53
  options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
54
- ): SeamHttpSeamV1Customers {
54
+ ): SeamHttpCustomersReservations {
55
55
  const constructorOptions = { ...options, client }
56
56
  if (!isSeamHttpOptionsWithClient(constructorOptions)) {
57
57
  throw new SeamHttpInvalidOptionsError('Missing client')
58
58
  }
59
- return new SeamHttpSeamV1Customers(constructorOptions)
59
+ return new SeamHttpCustomersReservations(constructorOptions)
60
60
  }
61
61
 
62
62
  static fromApiKey(
63
63
  apiKey: SeamHttpOptionsWithApiKey['apiKey'],
64
64
  options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
65
- ): SeamHttpSeamV1Customers {
65
+ ): SeamHttpCustomersReservations {
66
66
  const constructorOptions = { ...options, apiKey }
67
67
  if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
68
68
  throw new SeamHttpInvalidOptionsError('Missing apiKey')
69
69
  }
70
- return new SeamHttpSeamV1Customers(constructorOptions)
70
+ return new SeamHttpCustomersReservations(constructorOptions)
71
71
  }
72
72
 
73
73
  static fromClientSessionToken(
@@ -76,24 +76,24 @@ export class SeamHttpSeamV1Customers {
76
76
  SeamHttpOptionsWithClientSessionToken,
77
77
  'clientSessionToken'
78
78
  > = {},
79
- ): SeamHttpSeamV1Customers {
79
+ ): SeamHttpCustomersReservations {
80
80
  const constructorOptions = { ...options, clientSessionToken }
81
81
  if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
82
82
  throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
83
83
  }
84
- return new SeamHttpSeamV1Customers(constructorOptions)
84
+ return new SeamHttpCustomersReservations(constructorOptions)
85
85
  }
86
86
 
87
87
  static async fromPublishableKey(
88
88
  publishableKey: string,
89
89
  userIdentifierKey: string,
90
90
  options: SeamHttpFromPublishableKeyOptions = {},
91
- ): Promise<SeamHttpSeamV1Customers> {
91
+ ): Promise<SeamHttpCustomersReservations> {
92
92
  warnOnInsecureuserIdentifierKey(userIdentifierKey)
93
93
  const clientOptions = parseOptions({ ...options, publishableKey })
94
94
  if (isSeamHttpOptionsWithClient(clientOptions)) {
95
95
  throw new SeamHttpInvalidOptionsError(
96
- 'The client option cannot be used with SeamHttpSeamV1Customers.fromPublishableKey',
96
+ 'The client option cannot be used with SeamHttpCustomersReservations.fromPublishableKey',
97
97
  )
98
98
  }
99
99
  const client = createClient(clientOptions)
@@ -101,7 +101,7 @@ export class SeamHttpSeamV1Customers {
101
101
  const { token } = await clientSessions.getOrCreate({
102
102
  user_identifier_key: userIdentifierKey,
103
103
  })
104
- return SeamHttpSeamV1Customers.fromClientSessionToken(token, options)
104
+ return SeamHttpCustomersReservations.fromClientSessionToken(token, options)
105
105
  }
106
106
 
107
107
  static fromConsoleSessionToken(
@@ -111,14 +111,14 @@ export class SeamHttpSeamV1Customers {
111
111
  SeamHttpOptionsWithConsoleSessionToken,
112
112
  'consoleSessionToken' | 'workspaceId'
113
113
  > = {},
114
- ): SeamHttpSeamV1Customers {
114
+ ): SeamHttpCustomersReservations {
115
115
  const constructorOptions = { ...options, consoleSessionToken, workspaceId }
116
116
  if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
117
117
  throw new SeamHttpInvalidOptionsError(
118
118
  'Missing consoleSessionToken or workspaceId',
119
119
  )
120
120
  }
121
- return new SeamHttpSeamV1Customers(constructorOptions)
121
+ return new SeamHttpCustomersReservations(constructorOptions)
122
122
  }
123
123
 
124
124
  static fromPersonalAccessToken(
@@ -128,14 +128,14 @@ export class SeamHttpSeamV1Customers {
128
128
  SeamHttpOptionsWithPersonalAccessToken,
129
129
  'personalAccessToken' | 'workspaceId'
130
130
  > = {},
131
- ): SeamHttpSeamV1Customers {
131
+ ): SeamHttpCustomersReservations {
132
132
  const constructorOptions = { ...options, personalAccessToken, workspaceId }
133
133
  if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
134
134
  throw new SeamHttpInvalidOptionsError(
135
135
  'Missing personalAccessToken or workspaceId',
136
136
  )
137
137
  }
138
- return new SeamHttpSeamV1Customers(constructorOptions)
138
+ return new SeamHttpCustomersReservations(constructorOptions)
139
139
  }
140
140
 
141
141
  createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
@@ -163,35 +163,39 @@ export class SeamHttpSeamV1Customers {
163
163
  await clientSessions.get()
164
164
  }
165
165
 
166
- pushData(
167
- parameters?: SeamV1CustomersPushDataParameters,
168
- options: SeamV1CustomersPushDataOptions = {},
169
- ): SeamV1CustomersPushDataRequest {
166
+ createDeepLink(
167
+ parameters?: CustomersReservationsCreateDeepLinkParameters,
168
+ options: CustomersReservationsCreateDeepLinkOptions = {},
169
+ ): CustomersReservationsCreateDeepLinkRequest {
170
170
  return new SeamHttpRequest(this, {
171
- pathname: '/seam/v1/customers/push_data',
171
+ pathname: '/customers/reservations/create_deep_link',
172
172
  method: 'POST',
173
173
  body: parameters,
174
- responseKey: undefined,
174
+ responseKey: 'deep_link',
175
175
  options,
176
176
  })
177
177
  }
178
178
  }
179
179
 
180
- export type SeamV1CustomersPushDataParameters =
181
- RouteRequestBody<'/seam/v1/customers/push_data'>
180
+ export type CustomersReservationsCreateDeepLinkParameters =
181
+ RouteRequestBody<'/customers/reservations/create_deep_link'>
182
182
 
183
183
  /**
184
- * @deprecated Use SeamV1CustomersPushDataParameters instead.
184
+ * @deprecated Use CustomersReservationsCreateDeepLinkParameters instead.
185
185
  */
186
- export type SeamV1CustomersPushDataBody = SeamV1CustomersPushDataParameters
186
+ export type CustomersReservationsCreateDeepLinkBody =
187
+ CustomersReservationsCreateDeepLinkParameters
187
188
 
188
189
  /**
189
- * @deprecated Use SeamV1CustomersPushDataRequest instead.
190
+ * @deprecated Use CustomersReservationsCreateDeepLinkRequest instead.
190
191
  */
191
- export type SeamV1CustomersPushDataResponse = SetNonNullable<
192
- Required<RouteResponse<'/seam/v1/customers/push_data'>>
192
+ export type CustomersReservationsCreateDeepLinkResponse = SetNonNullable<
193
+ Required<RouteResponse<'/customers/reservations/create_deep_link'>>
193
194
  >
194
195
 
195
- export type SeamV1CustomersPushDataRequest = SeamHttpRequest<void, undefined>
196
+ export type CustomersReservationsCreateDeepLinkRequest = SeamHttpRequest<
197
+ CustomersReservationsCreateDeepLinkResponse,
198
+ 'deep_link'
199
+ >
196
200
 
197
- export interface SeamV1CustomersPushDataOptions {}
201
+ export interface CustomersReservationsCreateDeepLinkOptions {}
@@ -188,6 +188,24 @@ export class SeamHttpSeamCustomerV1AccessGrants {
188
188
  options,
189
189
  })
190
190
  }
191
+
192
+ update(
193
+ parameters?: SeamCustomerV1AccessGrantsUpdateParameters,
194
+ options: SeamCustomerV1AccessGrantsUpdateOptions = {},
195
+ ): SeamCustomerV1AccessGrantsUpdateRequest {
196
+ if (!this.defaults.isUndocumentedApiEnabled) {
197
+ throw new Error(
198
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
199
+ )
200
+ }
201
+ return new SeamHttpRequest(this, {
202
+ pathname: '/seam/customer/v1/access_grants/update',
203
+ method: 'PATCH',
204
+ body: parameters,
205
+ responseKey: undefined,
206
+ options,
207
+ })
208
+ }
191
209
  }
192
210
 
193
211
  export type SeamCustomerV1AccessGrantsListParameters =
@@ -212,3 +230,26 @@ export type SeamCustomerV1AccessGrantsListRequest = SeamHttpRequest<
212
230
  >
213
231
 
214
232
  export interface SeamCustomerV1AccessGrantsListOptions {}
233
+
234
+ export type SeamCustomerV1AccessGrantsUpdateParameters =
235
+ RouteRequestBody<'/seam/customer/v1/access_grants/update'>
236
+
237
+ /**
238
+ * @deprecated Use SeamCustomerV1AccessGrantsUpdateParameters instead.
239
+ */
240
+ export type SeamCustomerV1AccessGrantsUpdateBody =
241
+ SeamCustomerV1AccessGrantsUpdateParameters
242
+
243
+ /**
244
+ * @deprecated Use SeamCustomerV1AccessGrantsUpdateRequest instead.
245
+ */
246
+ export type SeamCustomerV1AccessGrantsUpdateResponse = SetNonNullable<
247
+ Required<RouteResponse<'/seam/customer/v1/access_grants/update'>>
248
+ >
249
+
250
+ export type SeamCustomerV1AccessGrantsUpdateRequest = SeamHttpRequest<
251
+ void,
252
+ undefined
253
+ >
254
+
255
+ export interface SeamCustomerV1AccessGrantsUpdateOptions {}
@@ -0,0 +1,217 @@
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 SeamHttpSeamCustomerV1AccessMethods {
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
+ ): SeamHttpSeamCustomerV1AccessMethods {
60
+ const constructorOptions = { ...options, client }
61
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
+ throw new SeamHttpInvalidOptionsError('Missing client')
63
+ }
64
+ return new SeamHttpSeamCustomerV1AccessMethods(constructorOptions)
65
+ }
66
+
67
+ static fromApiKey(
68
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
+ ): SeamHttpSeamCustomerV1AccessMethods {
71
+ const constructorOptions = { ...options, apiKey }
72
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
+ }
75
+ return new SeamHttpSeamCustomerV1AccessMethods(constructorOptions)
76
+ }
77
+
78
+ static fromClientSessionToken(
79
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
+ options: Omit<
81
+ SeamHttpOptionsWithClientSessionToken,
82
+ 'clientSessionToken'
83
+ > = {},
84
+ ): SeamHttpSeamCustomerV1AccessMethods {
85
+ const constructorOptions = { ...options, clientSessionToken }
86
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
+ }
89
+ return new SeamHttpSeamCustomerV1AccessMethods(constructorOptions)
90
+ }
91
+
92
+ static async fromPublishableKey(
93
+ publishableKey: string,
94
+ userIdentifierKey: string,
95
+ options: SeamHttpFromPublishableKeyOptions = {},
96
+ ): Promise<SeamHttpSeamCustomerV1AccessMethods> {
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 SeamHttpSeamCustomerV1AccessMethods.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 SeamHttpSeamCustomerV1AccessMethods.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
+ ): SeamHttpSeamCustomerV1AccessMethods {
123
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
124
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
125
+ throw new SeamHttpInvalidOptionsError(
126
+ 'Missing consoleSessionToken or workspaceId',
127
+ )
128
+ }
129
+ return new SeamHttpSeamCustomerV1AccessMethods(constructorOptions)
130
+ }
131
+
132
+ static fromPersonalAccessToken(
133
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
134
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
135
+ options: Omit<
136
+ SeamHttpOptionsWithPersonalAccessToken,
137
+ 'personalAccessToken' | 'workspaceId'
138
+ > = {},
139
+ ): SeamHttpSeamCustomerV1AccessMethods {
140
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
141
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
142
+ throw new SeamHttpInvalidOptionsError(
143
+ 'Missing personalAccessToken or workspaceId',
144
+ )
145
+ }
146
+ return new SeamHttpSeamCustomerV1AccessMethods(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
+ encode(
175
+ parameters?: SeamCustomerV1AccessMethodsEncodeParameters,
176
+ options: SeamCustomerV1AccessMethodsEncodeOptions = {},
177
+ ): SeamCustomerV1AccessMethodsEncodeRequest {
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/access_methods/encode',
185
+ method: 'POST',
186
+ body: parameters,
187
+ responseKey: 'action_attempt',
188
+ options,
189
+ })
190
+ }
191
+ }
192
+
193
+ export type SeamCustomerV1AccessMethodsEncodeParameters =
194
+ RouteRequestBody<'/seam/customer/v1/access_methods/encode'>
195
+
196
+ /**
197
+ * @deprecated Use SeamCustomerV1AccessMethodsEncodeParameters instead.
198
+ */
199
+ export type SeamCustomerV1AccessMethodsEncodeBody =
200
+ SeamCustomerV1AccessMethodsEncodeParameters
201
+
202
+ /**
203
+ * @deprecated Use SeamCustomerV1AccessMethodsEncodeRequest instead.
204
+ */
205
+ export type SeamCustomerV1AccessMethodsEncodeResponse = SetNonNullable<
206
+ Required<RouteResponse<'/seam/customer/v1/access_methods/encode'>>
207
+ >
208
+
209
+ export type SeamCustomerV1AccessMethodsEncodeRequest = SeamHttpRequest<
210
+ SeamCustomerV1AccessMethodsEncodeResponse,
211
+ 'action_attempt'
212
+ >
213
+
214
+ export type SeamCustomerV1AccessMethodsEncodeOptions = Pick<
215
+ SeamHttpRequestOptions,
216
+ 'waitForActionAttempt'
217
+ >
@@ -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 './access-methods.js'
@@ -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 SeamHttpSeamCustomerV1ConnectorCustomers {
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
+ ): SeamHttpSeamCustomerV1ConnectorCustomers {
60
+ const constructorOptions = { ...options, client }
61
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
+ throw new SeamHttpInvalidOptionsError('Missing client')
63
+ }
64
+ return new SeamHttpSeamCustomerV1ConnectorCustomers(constructorOptions)
65
+ }
66
+
67
+ static fromApiKey(
68
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
+ ): SeamHttpSeamCustomerV1ConnectorCustomers {
71
+ const constructorOptions = { ...options, apiKey }
72
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
+ }
75
+ return new SeamHttpSeamCustomerV1ConnectorCustomers(constructorOptions)
76
+ }
77
+
78
+ static fromClientSessionToken(
79
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
+ options: Omit<
81
+ SeamHttpOptionsWithClientSessionToken,
82
+ 'clientSessionToken'
83
+ > = {},
84
+ ): SeamHttpSeamCustomerV1ConnectorCustomers {
85
+ const constructorOptions = { ...options, clientSessionToken }
86
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
+ }
89
+ return new SeamHttpSeamCustomerV1ConnectorCustomers(constructorOptions)
90
+ }
91
+
92
+ static async fromPublishableKey(
93
+ publishableKey: string,
94
+ userIdentifierKey: string,
95
+ options: SeamHttpFromPublishableKeyOptions = {},
96
+ ): Promise<SeamHttpSeamCustomerV1ConnectorCustomers> {
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 SeamHttpSeamCustomerV1ConnectorCustomers.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 SeamHttpSeamCustomerV1ConnectorCustomers.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
+ ): SeamHttpSeamCustomerV1ConnectorCustomers {
123
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
124
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
125
+ throw new SeamHttpInvalidOptionsError(
126
+ 'Missing consoleSessionToken or workspaceId',
127
+ )
128
+ }
129
+ return new SeamHttpSeamCustomerV1ConnectorCustomers(constructorOptions)
130
+ }
131
+
132
+ static fromPersonalAccessToken(
133
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
134
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
135
+ options: Omit<
136
+ SeamHttpOptionsWithPersonalAccessToken,
137
+ 'personalAccessToken' | 'workspaceId'
138
+ > = {},
139
+ ): SeamHttpSeamCustomerV1ConnectorCustomers {
140
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
141
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
142
+ throw new SeamHttpInvalidOptionsError(
143
+ 'Missing personalAccessToken or workspaceId',
144
+ )
145
+ }
146
+ return new SeamHttpSeamCustomerV1ConnectorCustomers(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?: SeamCustomerV1ConnectorCustomersListParameters,
176
+ options: SeamCustomerV1ConnectorCustomersListOptions = {},
177
+ ): SeamCustomerV1ConnectorCustomersListRequest {
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/connector_customers/list',
185
+ method: 'POST',
186
+ body: parameters,
187
+ responseKey: 'connector_customers',
188
+ options,
189
+ })
190
+ }
191
+ }
192
+
193
+ export type SeamCustomerV1ConnectorCustomersListParameters =
194
+ RouteRequestBody<'/seam/customer/v1/connector_customers/list'>
195
+
196
+ /**
197
+ * @deprecated Use SeamCustomerV1ConnectorCustomersListParameters instead.
198
+ */
199
+ export type SeamCustomerV1ConnectorCustomersListParams =
200
+ SeamCustomerV1ConnectorCustomersListParameters
201
+
202
+ /**
203
+ * @deprecated Use SeamCustomerV1ConnectorCustomersListRequest instead.
204
+ */
205
+ export type SeamCustomerV1ConnectorCustomersListResponse = SetNonNullable<
206
+ Required<RouteResponse<'/seam/customer/v1/connector_customers/list'>>
207
+ >
208
+
209
+ export type SeamCustomerV1ConnectorCustomersListRequest = SeamHttpRequest<
210
+ SeamCustomerV1ConnectorCustomersListResponse,
211
+ 'connector_customers'
212
+ >
213
+
214
+ export interface SeamCustomerV1ConnectorCustomersListOptions {}
@@ -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 './connector-customers.js'