@seamapi/http 1.118.0 → 1.120.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 (46) hide show
  1. package/dist/connect.cjs +385 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +122 -4
  4. package/dist/index.cjs +389 -0
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +1 -1
  7. package/lib/seam/connect/routes/seam/console/v1/index.d.ts +2 -0
  8. package/lib/seam/connect/routes/seam/console/v1/index.js +2 -0
  9. package/lib/seam/connect/routes/seam/console/v1/index.js.map +1 -1
  10. package/lib/seam/connect/routes/seam/console/v1/lynx-migration/index.d.ts +1 -0
  11. package/lib/seam/connect/routes/seam/console/v1/lynx-migration/index.js +6 -0
  12. package/lib/seam/connect/routes/seam/console/v1/lynx-migration/index.js.map +1 -0
  13. package/lib/seam/connect/routes/seam/console/v1/lynx-migration/lynx-migration.d.ts +73 -0
  14. package/lib/seam/connect/routes/seam/console/v1/lynx-migration/lynx-migration.js +140 -0
  15. package/lib/seam/connect/routes/seam/console/v1/lynx-migration/lynx-migration.js.map +1 -0
  16. package/lib/seam/connect/routes/seam/console/v1/v1.d.ts +2 -0
  17. package/lib/seam/connect/routes/seam/console/v1/v1.js +4 -0
  18. package/lib/seam/connect/routes/seam/console/v1/v1.js.map +1 -1
  19. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.d.ts +47 -0
  20. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.js +116 -0
  21. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.js.map +1 -0
  22. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.d.ts +1 -0
  23. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.js +6 -0
  24. package/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.js.map +1 -0
  25. package/lib/seam/connect/routes/seam/console/v1/workspace/index.d.ts +1 -0
  26. package/lib/seam/connect/routes/seam/console/v1/workspace/index.js +6 -0
  27. package/lib/seam/connect/routes/seam/console/v1/workspace/index.js.map +1 -0
  28. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.d.ts +3 -1
  29. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js +11 -0
  30. package/lib/seam/connect/routes/seam-http-endpoints-without-workspace.js.map +1 -1
  31. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +10 -2
  32. package/lib/seam/connect/routes/seam-http-endpoints.js +62 -0
  33. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  34. package/lib/version.d.ts +1 -1
  35. package/lib/version.js +1 -1
  36. package/package.json +3 -3
  37. package/src/lib/seam/connect/routes/seam/console/v1/index.ts +2 -0
  38. package/src/lib/seam/connect/routes/seam/console/v1/lynx-migration/index.ts +6 -0
  39. package/src/lib/seam/connect/routes/seam/console/v1/lynx-migration/lynx-migration.ts +350 -0
  40. package/src/lib/seam/connect/routes/seam/console/v1/v1.ts +8 -0
  41. package/src/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/feature-flags.ts +259 -0
  42. package/src/lib/seam/connect/routes/seam/console/v1/workspace/feature-flags/index.ts +6 -0
  43. package/src/lib/seam/connect/routes/seam/console/v1/workspace/index.ts +6 -0
  44. package/src/lib/seam/connect/routes/seam-http-endpoints-without-workspace.ts +28 -0
  45. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +168 -0
  46. package/src/lib/version.ts +1 -1
@@ -0,0 +1,350 @@
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 SeamHttpSeamConsoleV1LynxMigration {
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
+ ): SeamHttpSeamConsoleV1LynxMigration {
60
+ const constructorOptions = { ...options, client }
61
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
+ throw new SeamHttpInvalidOptionsError('Missing client')
63
+ }
64
+ return new SeamHttpSeamConsoleV1LynxMigration(constructorOptions)
65
+ }
66
+
67
+ static fromApiKey(
68
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
+ ): SeamHttpSeamConsoleV1LynxMigration {
71
+ const constructorOptions = { ...options, apiKey }
72
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
+ }
75
+ return new SeamHttpSeamConsoleV1LynxMigration(constructorOptions)
76
+ }
77
+
78
+ static fromClientSessionToken(
79
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
+ options: Omit<
81
+ SeamHttpOptionsWithClientSessionToken,
82
+ 'clientSessionToken'
83
+ > = {},
84
+ ): SeamHttpSeamConsoleV1LynxMigration {
85
+ const constructorOptions = { ...options, clientSessionToken }
86
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
+ }
89
+ return new SeamHttpSeamConsoleV1LynxMigration(constructorOptions)
90
+ }
91
+
92
+ static async fromPublishableKey(
93
+ publishableKey: string,
94
+ userIdentifierKey: string,
95
+ options: SeamHttpFromPublishableKeyOptions = {},
96
+ ): Promise<SeamHttpSeamConsoleV1LynxMigration> {
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 SeamHttpSeamConsoleV1LynxMigration.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 SeamHttpSeamConsoleV1LynxMigration.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
+ ): SeamHttpSeamConsoleV1LynxMigration {
123
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
124
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
125
+ throw new SeamHttpInvalidOptionsError(
126
+ 'Missing consoleSessionToken or workspaceId',
127
+ )
128
+ }
129
+ return new SeamHttpSeamConsoleV1LynxMigration(constructorOptions)
130
+ }
131
+
132
+ static fromPersonalAccessToken(
133
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
134
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
135
+ options: Omit<
136
+ SeamHttpOptionsWithPersonalAccessToken,
137
+ 'personalAccessToken' | 'workspaceId'
138
+ > = {},
139
+ ): SeamHttpSeamConsoleV1LynxMigration {
140
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
141
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
142
+ throw new SeamHttpInvalidOptionsError(
143
+ 'Missing personalAccessToken or workspaceId',
144
+ )
145
+ }
146
+ return new SeamHttpSeamConsoleV1LynxMigration(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
+ getPropertyMigrationStatus(
175
+ parameters?: SeamConsoleV1LynxMigrationGetPropertyMigrationStatusParameters,
176
+ options: SeamConsoleV1LynxMigrationGetPropertyMigrationStatusOptions = {},
177
+ ): SeamConsoleV1LynxMigrationGetPropertyMigrationStatusRequest {
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/console/v1/lynx_migration/get_property_migration_status',
185
+ method: 'POST',
186
+ body: parameters,
187
+ responseKey: 'lynx_migration_property_run',
188
+ options,
189
+ })
190
+ }
191
+
192
+ getReservationMigrationStatus(
193
+ parameters?: SeamConsoleV1LynxMigrationGetReservationMigrationStatusParameters,
194
+ options: SeamConsoleV1LynxMigrationGetReservationMigrationStatusOptions = {},
195
+ ): SeamConsoleV1LynxMigrationGetReservationMigrationStatusRequest {
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:
203
+ '/seam/console/v1/lynx_migration/get_reservation_migration_status',
204
+ method: 'POST',
205
+ body: parameters,
206
+ responseKey: 'lynx_migration_reservation_run',
207
+ options,
208
+ })
209
+ }
210
+
211
+ listPropertyReservations(
212
+ parameters?: SeamConsoleV1LynxMigrationListPropertyReservationsParameters,
213
+ options: SeamConsoleV1LynxMigrationListPropertyReservationsOptions = {},
214
+ ): SeamConsoleV1LynxMigrationListPropertyReservationsRequest {
215
+ if (!this.defaults.isUndocumentedApiEnabled) {
216
+ throw new Error(
217
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
218
+ )
219
+ }
220
+ return new SeamHttpRequest(this, {
221
+ pathname: '/seam/console/v1/lynx_migration/list_property_reservations',
222
+ method: 'POST',
223
+ body: parameters,
224
+ responseKey: 'lynx_migration_property_plan',
225
+ options,
226
+ })
227
+ }
228
+
229
+ migrateProperty(
230
+ parameters?: SeamConsoleV1LynxMigrationMigratePropertyParameters,
231
+ options: SeamConsoleV1LynxMigrationMigratePropertyOptions = {},
232
+ ): SeamConsoleV1LynxMigrationMigratePropertyRequest {
233
+ if (!this.defaults.isUndocumentedApiEnabled) {
234
+ throw new Error(
235
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
236
+ )
237
+ }
238
+ return new SeamHttpRequest(this, {
239
+ pathname: '/seam/console/v1/lynx_migration/migrate_property',
240
+ method: 'POST',
241
+ body: parameters,
242
+ responseKey: 'lynx_migration_property_run',
243
+ options,
244
+ })
245
+ }
246
+ }
247
+
248
+ export type SeamConsoleV1LynxMigrationGetPropertyMigrationStatusParameters =
249
+ RouteRequestBody<'/seam/console/v1/lynx_migration/get_property_migration_status'>
250
+
251
+ /**
252
+ * @deprecated Use SeamConsoleV1LynxMigrationGetPropertyMigrationStatusParameters instead.
253
+ */
254
+ export type SeamConsoleV1LynxMigrationGetPropertyMigrationStatusParams =
255
+ SeamConsoleV1LynxMigrationGetPropertyMigrationStatusParameters
256
+
257
+ /**
258
+ * @deprecated Use SeamConsoleV1LynxMigrationGetPropertyMigrationStatusRequest instead.
259
+ */
260
+ export type SeamConsoleV1LynxMigrationGetPropertyMigrationStatusResponse =
261
+ SetNonNullable<
262
+ Required<
263
+ RouteResponse<'/seam/console/v1/lynx_migration/get_property_migration_status'>
264
+ >
265
+ >
266
+
267
+ export type SeamConsoleV1LynxMigrationGetPropertyMigrationStatusRequest =
268
+ SeamHttpRequest<
269
+ SeamConsoleV1LynxMigrationGetPropertyMigrationStatusResponse,
270
+ 'lynx_migration_property_run'
271
+ >
272
+
273
+ export interface SeamConsoleV1LynxMigrationGetPropertyMigrationStatusOptions {}
274
+
275
+ export type SeamConsoleV1LynxMigrationGetReservationMigrationStatusParameters =
276
+ RouteRequestBody<'/seam/console/v1/lynx_migration/get_reservation_migration_status'>
277
+
278
+ /**
279
+ * @deprecated Use SeamConsoleV1LynxMigrationGetReservationMigrationStatusParameters instead.
280
+ */
281
+ export type SeamConsoleV1LynxMigrationGetReservationMigrationStatusParams =
282
+ SeamConsoleV1LynxMigrationGetReservationMigrationStatusParameters
283
+
284
+ /**
285
+ * @deprecated Use SeamConsoleV1LynxMigrationGetReservationMigrationStatusRequest instead.
286
+ */
287
+ export type SeamConsoleV1LynxMigrationGetReservationMigrationStatusResponse =
288
+ SetNonNullable<
289
+ Required<
290
+ RouteResponse<'/seam/console/v1/lynx_migration/get_reservation_migration_status'>
291
+ >
292
+ >
293
+
294
+ export type SeamConsoleV1LynxMigrationGetReservationMigrationStatusRequest =
295
+ SeamHttpRequest<
296
+ SeamConsoleV1LynxMigrationGetReservationMigrationStatusResponse,
297
+ 'lynx_migration_reservation_run'
298
+ >
299
+
300
+ export interface SeamConsoleV1LynxMigrationGetReservationMigrationStatusOptions {}
301
+
302
+ export type SeamConsoleV1LynxMigrationListPropertyReservationsParameters =
303
+ RouteRequestBody<'/seam/console/v1/lynx_migration/list_property_reservations'>
304
+
305
+ /**
306
+ * @deprecated Use SeamConsoleV1LynxMigrationListPropertyReservationsParameters instead.
307
+ */
308
+ export type SeamConsoleV1LynxMigrationListPropertyReservationsParams =
309
+ SeamConsoleV1LynxMigrationListPropertyReservationsParameters
310
+
311
+ /**
312
+ * @deprecated Use SeamConsoleV1LynxMigrationListPropertyReservationsRequest instead.
313
+ */
314
+ export type SeamConsoleV1LynxMigrationListPropertyReservationsResponse =
315
+ SetNonNullable<
316
+ Required<
317
+ RouteResponse<'/seam/console/v1/lynx_migration/list_property_reservations'>
318
+ >
319
+ >
320
+
321
+ export type SeamConsoleV1LynxMigrationListPropertyReservationsRequest =
322
+ SeamHttpRequest<
323
+ SeamConsoleV1LynxMigrationListPropertyReservationsResponse,
324
+ 'lynx_migration_property_plan'
325
+ >
326
+
327
+ export interface SeamConsoleV1LynxMigrationListPropertyReservationsOptions {}
328
+
329
+ export type SeamConsoleV1LynxMigrationMigratePropertyParameters =
330
+ RouteRequestBody<'/seam/console/v1/lynx_migration/migrate_property'>
331
+
332
+ /**
333
+ * @deprecated Use SeamConsoleV1LynxMigrationMigratePropertyParameters instead.
334
+ */
335
+ export type SeamConsoleV1LynxMigrationMigratePropertyBody =
336
+ SeamConsoleV1LynxMigrationMigratePropertyParameters
337
+
338
+ /**
339
+ * @deprecated Use SeamConsoleV1LynxMigrationMigratePropertyRequest instead.
340
+ */
341
+ export type SeamConsoleV1LynxMigrationMigratePropertyResponse = SetNonNullable<
342
+ Required<RouteResponse<'/seam/console/v1/lynx_migration/migrate_property'>>
343
+ >
344
+
345
+ export type SeamConsoleV1LynxMigrationMigratePropertyRequest = SeamHttpRequest<
346
+ SeamConsoleV1LynxMigrationMigratePropertyResponse,
347
+ 'lynx_migration_property_run'
348
+ >
349
+
350
+ export interface SeamConsoleV1LynxMigrationMigratePropertyOptions {}
@@ -36,6 +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
+ import { SeamHttpSeamConsoleV1LynxMigration } from './lynx-migration/index.js'
39
40
  import { SeamHttpSeamConsoleV1Sites } from './sites/index.js'
40
41
  import { SeamHttpSeamConsoleV1Timelines } from './timelines/index.js'
41
42
 
@@ -171,6 +172,13 @@ export class SeamHttpSeamConsoleV1 {
171
172
  await clientSessions.get()
172
173
  }
173
174
 
175
+ get lynxMigration(): SeamHttpSeamConsoleV1LynxMigration {
176
+ return SeamHttpSeamConsoleV1LynxMigration.fromClient(
177
+ this.client,
178
+ this.defaults,
179
+ )
180
+ }
181
+
174
182
  get sites(): SeamHttpSeamConsoleV1Sites {
175
183
  return SeamHttpSeamConsoleV1Sites.fromClient(this.client, this.defaults)
176
184
  }
@@ -0,0 +1,259 @@
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 {
7
+ RouteRequestBody,
8
+ RouteRequestParams,
9
+ RouteResponse,
10
+ } from '@seamapi/types/connect'
11
+
12
+ import { seamApiLtsVersion } from 'lib/lts-version.js'
13
+ import {
14
+ getAuthHeadersForClientSessionToken,
15
+ warnOnInsecureuserIdentifierKey,
16
+ } from 'lib/seam/connect/auth.js'
17
+ import { type Client, createClient } from 'lib/seam/connect/client.js'
18
+ import {
19
+ isSeamHttpOptionsWithApiKey,
20
+ isSeamHttpOptionsWithClient,
21
+ isSeamHttpOptionsWithClientSessionToken,
22
+ isSeamHttpOptionsWithConsoleSessionToken,
23
+ isSeamHttpOptionsWithPersonalAccessToken,
24
+ type SeamHttpFromPublishableKeyOptions,
25
+ SeamHttpInvalidOptionsError,
26
+ type SeamHttpOptions,
27
+ type SeamHttpOptionsWithApiKey,
28
+ type SeamHttpOptionsWithClient,
29
+ type SeamHttpOptionsWithClientSessionToken,
30
+ type SeamHttpOptionsWithConsoleSessionToken,
31
+ type SeamHttpOptionsWithPersonalAccessToken,
32
+ type SeamHttpRequestOptions,
33
+ } from 'lib/seam/connect/options.js'
34
+ import {
35
+ limitToSeamHttpRequestOptions,
36
+ parseOptions,
37
+ } from 'lib/seam/connect/parse-options.js'
38
+ import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js'
39
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
40
+ import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
41
+ import type { SetNonNullable } from 'lib/types.js'
42
+
43
+ export class SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
44
+ client: Client
45
+ readonly defaults: Required<SeamHttpRequestOptions>
46
+ readonly ltsVersion = seamApiLtsVersion
47
+ static ltsVersion = seamApiLtsVersion
48
+
49
+ constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
50
+ const options = parseOptions(apiKeyOrOptions)
51
+ if (!options.isUndocumentedApiEnabled) {
52
+ throw new Error(
53
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
54
+ )
55
+ }
56
+ this.client = 'client' in options ? options.client : createClient(options)
57
+ this.defaults = limitToSeamHttpRequestOptions(options)
58
+ }
59
+
60
+ static fromClient(
61
+ client: SeamHttpOptionsWithClient['client'],
62
+ options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
63
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
64
+ const constructorOptions = { ...options, client }
65
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
66
+ throw new SeamHttpInvalidOptionsError('Missing client')
67
+ }
68
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
69
+ }
70
+
71
+ static fromApiKey(
72
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
73
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
74
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
75
+ const constructorOptions = { ...options, apiKey }
76
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
77
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
78
+ }
79
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
80
+ }
81
+
82
+ static fromClientSessionToken(
83
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
84
+ options: Omit<
85
+ SeamHttpOptionsWithClientSessionToken,
86
+ 'clientSessionToken'
87
+ > = {},
88
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
89
+ const constructorOptions = { ...options, clientSessionToken }
90
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
91
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
92
+ }
93
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
94
+ }
95
+
96
+ static async fromPublishableKey(
97
+ publishableKey: string,
98
+ userIdentifierKey: string,
99
+ options: SeamHttpFromPublishableKeyOptions = {},
100
+ ): Promise<SeamHttpSeamConsoleV1WorkspaceFeatureFlags> {
101
+ warnOnInsecureuserIdentifierKey(userIdentifierKey)
102
+ const clientOptions = parseOptions({ ...options, publishableKey })
103
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
104
+ throw new SeamHttpInvalidOptionsError(
105
+ 'The client option cannot be used with SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromPublishableKey',
106
+ )
107
+ }
108
+ const client = createClient(clientOptions)
109
+ const clientSessions = SeamHttpClientSessions.fromClient(client)
110
+ const { token } = await clientSessions.getOrCreate({
111
+ user_identifier_key: userIdentifierKey,
112
+ })
113
+ return SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromClientSessionToken(
114
+ token,
115
+ options,
116
+ )
117
+ }
118
+
119
+ static fromConsoleSessionToken(
120
+ consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
121
+ workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
122
+ options: Omit<
123
+ SeamHttpOptionsWithConsoleSessionToken,
124
+ 'consoleSessionToken' | 'workspaceId'
125
+ > = {},
126
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
127
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
128
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
129
+ throw new SeamHttpInvalidOptionsError(
130
+ 'Missing consoleSessionToken or workspaceId',
131
+ )
132
+ }
133
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
134
+ }
135
+
136
+ static fromPersonalAccessToken(
137
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
138
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
139
+ options: Omit<
140
+ SeamHttpOptionsWithPersonalAccessToken,
141
+ 'personalAccessToken' | 'workspaceId'
142
+ > = {},
143
+ ): SeamHttpSeamConsoleV1WorkspaceFeatureFlags {
144
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
145
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
146
+ throw new SeamHttpInvalidOptionsError(
147
+ 'Missing personalAccessToken or workspaceId',
148
+ )
149
+ }
150
+ return new SeamHttpSeamConsoleV1WorkspaceFeatureFlags(constructorOptions)
151
+ }
152
+
153
+ createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
154
+ request: SeamHttpRequest<TResponse, TResponseKey>,
155
+ ): SeamPaginator<TResponse, TResponseKey> {
156
+ return new SeamPaginator<TResponse, TResponseKey>(this, request)
157
+ }
158
+
159
+ async updateClientSessionToken(
160
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
161
+ ): Promise<void> {
162
+ const { headers } = this.client.defaults
163
+ const authHeaders = getAuthHeadersForClientSessionToken({
164
+ clientSessionToken,
165
+ })
166
+ for (const key of Object.keys(authHeaders)) {
167
+ if (headers[key] == null) {
168
+ throw new Error(
169
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
170
+ )
171
+ }
172
+ }
173
+ this.client.defaults.headers = { ...headers, ...authHeaders }
174
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
175
+ await clientSessions.get()
176
+ }
177
+
178
+ list(
179
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsListParameters,
180
+ options: SeamConsoleV1WorkspaceFeatureFlagsListOptions = {},
181
+ ): SeamConsoleV1WorkspaceFeatureFlagsListRequest {
182
+ if (!this.defaults.isUndocumentedApiEnabled) {
183
+ throw new Error(
184
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
185
+ )
186
+ }
187
+ return new SeamHttpRequest(this, {
188
+ pathname: '/seam/console/v1/workspace/feature_flags/list',
189
+ method: 'GET',
190
+ params: parameters,
191
+ responseKey: 'feature_flags',
192
+ options,
193
+ })
194
+ }
195
+
196
+ update(
197
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters,
198
+ options: SeamConsoleV1WorkspaceFeatureFlagsUpdateOptions = {},
199
+ ): SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest {
200
+ if (!this.defaults.isUndocumentedApiEnabled) {
201
+ throw new Error(
202
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
203
+ )
204
+ }
205
+ return new SeamHttpRequest(this, {
206
+ pathname: '/seam/console/v1/workspace/feature_flags/update',
207
+ method: 'POST',
208
+ body: parameters,
209
+ responseKey: 'feature_flag',
210
+ options,
211
+ })
212
+ }
213
+ }
214
+
215
+ export type SeamConsoleV1WorkspaceFeatureFlagsListParameters =
216
+ RouteRequestParams<'/seam/console/v1/workspace/feature_flags/list'>
217
+
218
+ /**
219
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsListParameters instead.
220
+ */
221
+ export type SeamConsoleV1WorkspaceFeatureFlagsListParams =
222
+ SeamConsoleV1WorkspaceFeatureFlagsListParameters
223
+
224
+ /**
225
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsListRequest instead.
226
+ */
227
+ export type SeamConsoleV1WorkspaceFeatureFlagsListResponse = SetNonNullable<
228
+ Required<RouteResponse<'/seam/console/v1/workspace/feature_flags/list'>>
229
+ >
230
+
231
+ export type SeamConsoleV1WorkspaceFeatureFlagsListRequest = SeamHttpRequest<
232
+ SeamConsoleV1WorkspaceFeatureFlagsListResponse,
233
+ 'feature_flags'
234
+ >
235
+
236
+ export interface SeamConsoleV1WorkspaceFeatureFlagsListOptions {}
237
+
238
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters =
239
+ RouteRequestBody<'/seam/console/v1/workspace/feature_flags/update'>
240
+
241
+ /**
242
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters instead.
243
+ */
244
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateBody =
245
+ SeamConsoleV1WorkspaceFeatureFlagsUpdateParameters
246
+
247
+ /**
248
+ * @deprecated Use SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest instead.
249
+ */
250
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateResponse = SetNonNullable<
251
+ Required<RouteResponse<'/seam/console/v1/workspace/feature_flags/update'>>
252
+ >
253
+
254
+ export type SeamConsoleV1WorkspaceFeatureFlagsUpdateRequest = SeamHttpRequest<
255
+ SeamConsoleV1WorkspaceFeatureFlagsUpdateResponse,
256
+ 'feature_flag'
257
+ >
258
+
259
+ export interface SeamConsoleV1WorkspaceFeatureFlagsUpdateOptions {}
@@ -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 './feature-flags.js'
@@ -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 './feature-flags/index.js'
@@ -21,6 +21,12 @@ import {
21
21
  parseOptions,
22
22
  } from 'lib/seam/connect/parse-options.js'
23
23
 
24
+ import {
25
+ type SeamConsoleV1WorkspaceFeatureFlagsListOptions,
26
+ type SeamConsoleV1WorkspaceFeatureFlagsListParameters,
27
+ type SeamConsoleV1WorkspaceFeatureFlagsListRequest,
28
+ SeamHttpSeamConsoleV1WorkspaceFeatureFlags,
29
+ } from './seam/console/v1/workspace/feature-flags/index.js'
24
30
  import {
25
31
  type SeamCustomerV1ConnectorsAuthorizeOptions,
26
32
  type SeamCustomerV1ConnectorsAuthorizeParameters,
@@ -100,6 +106,27 @@ export class SeamHttpEndpointsWithoutWorkspace {
100
106
  return new SeamHttpEndpointsWithoutWorkspace(constructorOptions)
101
107
  }
102
108
 
109
+ get '/seam/console/v1/workspace/feature_flags/list'(): (
110
+ parameters?: SeamConsoleV1WorkspaceFeatureFlagsListParameters,
111
+ options?: SeamConsoleV1WorkspaceFeatureFlagsListOptions,
112
+ ) => SeamConsoleV1WorkspaceFeatureFlagsListRequest {
113
+ const { client, defaults } = this
114
+ if (!this.defaults.isUndocumentedApiEnabled) {
115
+ throw new Error(
116
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
117
+ )
118
+ }
119
+ return function seamConsoleV1WorkspaceFeatureFlagsList(
120
+ ...args: Parameters<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['list']>
121
+ ): ReturnType<SeamHttpSeamConsoleV1WorkspaceFeatureFlags['list']> {
122
+ const seam = SeamHttpSeamConsoleV1WorkspaceFeatureFlags.fromClient(
123
+ client,
124
+ defaults,
125
+ )
126
+ return seam.list(...args)
127
+ }
128
+ }
129
+
103
130
  get '/seam/customer/v1/connectors/authorize'(): (
104
131
  parameters?: SeamCustomerV1ConnectorsAuthorizeParameters,
105
132
  options?: SeamCustomerV1ConnectorsAuthorizeOptions,
@@ -146,6 +173,7 @@ export class SeamHttpEndpointsWithoutWorkspace {
146
173
  }
147
174
 
148
175
  export type SeamHttpEndpointWithoutWorkspaceQueryPaths =
176
+ | '/seam/console/v1/workspace/feature_flags/list'
149
177
  | '/seam/customer/v1/connectors/authorize'
150
178
  | '/workspaces/list'
151
179