@seamapi/http 1.111.0 → 1.112.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 +159 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +47 -2
  4. package/dist/index.cjs +161 -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/connectors/connectors.d.ts +2 -0
  8. package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.js +4 -0
  9. package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.js.map +1 -1
  10. package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.d.ts +47 -0
  11. package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.js +116 -0
  12. package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.js.map +1 -0
  13. package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/index.d.ts +1 -0
  14. package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/index.js +6 -0
  15. package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/index.js.map +1 -0
  16. package/lib/seam/connect/routes/seam/customer/v1/connectors/index.d.ts +1 -0
  17. package/lib/seam/connect/routes/seam/customer/v1/connectors/index.js +1 -0
  18. package/lib/seam/connect/routes/seam/customer/v1/connectors/index.js.map +1 -1
  19. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +4 -1
  20. package/lib/seam/connect/routes/seam-http-endpoints.js +21 -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/connectors/connectors.ts +9 -0
  26. package/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.ts +255 -0
  27. package/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/index.ts +6 -0
  28. package/src/lib/seam/connect/routes/seam/customer/v1/connectors/index.ts +1 -0
  29. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +57 -0
  30. package/src/lib/version.ts +1 -1
@@ -0,0 +1,255 @@
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 SeamHttpSeamCustomerV1ConnectorsIcal {
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
+ ): SeamHttpSeamCustomerV1ConnectorsIcal {
60
+ const constructorOptions = { ...options, client }
61
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
+ throw new SeamHttpInvalidOptionsError('Missing client')
63
+ }
64
+ return new SeamHttpSeamCustomerV1ConnectorsIcal(constructorOptions)
65
+ }
66
+
67
+ static fromApiKey(
68
+ apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
+ options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
+ ): SeamHttpSeamCustomerV1ConnectorsIcal {
71
+ const constructorOptions = { ...options, apiKey }
72
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
+ throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
+ }
75
+ return new SeamHttpSeamCustomerV1ConnectorsIcal(constructorOptions)
76
+ }
77
+
78
+ static fromClientSessionToken(
79
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
+ options: Omit<
81
+ SeamHttpOptionsWithClientSessionToken,
82
+ 'clientSessionToken'
83
+ > = {},
84
+ ): SeamHttpSeamCustomerV1ConnectorsIcal {
85
+ const constructorOptions = { ...options, clientSessionToken }
86
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
+ throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
+ }
89
+ return new SeamHttpSeamCustomerV1ConnectorsIcal(constructorOptions)
90
+ }
91
+
92
+ static async fromPublishableKey(
93
+ publishableKey: string,
94
+ userIdentifierKey: string,
95
+ options: SeamHttpFromPublishableKeyOptions = {},
96
+ ): Promise<SeamHttpSeamCustomerV1ConnectorsIcal> {
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 SeamHttpSeamCustomerV1ConnectorsIcal.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 SeamHttpSeamCustomerV1ConnectorsIcal.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
+ ): SeamHttpSeamCustomerV1ConnectorsIcal {
123
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId }
124
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
125
+ throw new SeamHttpInvalidOptionsError(
126
+ 'Missing consoleSessionToken or workspaceId',
127
+ )
128
+ }
129
+ return new SeamHttpSeamCustomerV1ConnectorsIcal(constructorOptions)
130
+ }
131
+
132
+ static fromPersonalAccessToken(
133
+ personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
134
+ workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
135
+ options: Omit<
136
+ SeamHttpOptionsWithPersonalAccessToken,
137
+ 'personalAccessToken' | 'workspaceId'
138
+ > = {},
139
+ ): SeamHttpSeamCustomerV1ConnectorsIcal {
140
+ const constructorOptions = { ...options, personalAccessToken, workspaceId }
141
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
142
+ throw new SeamHttpInvalidOptionsError(
143
+ 'Missing personalAccessToken or workspaceId',
144
+ )
145
+ }
146
+ return new SeamHttpSeamCustomerV1ConnectorsIcal(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
+ generateConfig(
175
+ parameters?: SeamCustomerV1ConnectorsIcalGenerateConfigParameters,
176
+ options: SeamCustomerV1ConnectorsIcalGenerateConfigOptions = {},
177
+ ): SeamCustomerV1ConnectorsIcalGenerateConfigRequest {
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/connectors/ical/generate-config',
185
+ method: 'POST',
186
+ body: parameters,
187
+ responseKey: 'generated_config',
188
+ options,
189
+ })
190
+ }
191
+
192
+ validateConfig(
193
+ parameters?: SeamCustomerV1ConnectorsIcalValidateConfigParameters,
194
+ options: SeamCustomerV1ConnectorsIcalValidateConfigOptions = {},
195
+ ): SeamCustomerV1ConnectorsIcalValidateConfigRequest {
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/connectors/ical/validate-config',
203
+ method: 'POST',
204
+ body: parameters,
205
+ responseKey: 'validation_result',
206
+ options,
207
+ })
208
+ }
209
+ }
210
+
211
+ export type SeamCustomerV1ConnectorsIcalGenerateConfigParameters =
212
+ RouteRequestBody<'/seam/customer/v1/connectors/ical/generate-config'>
213
+
214
+ /**
215
+ * @deprecated Use SeamCustomerV1ConnectorsIcalGenerateConfigParameters instead.
216
+ */
217
+ export type SeamCustomerV1ConnectorsIcalGenerateConfigBody =
218
+ SeamCustomerV1ConnectorsIcalGenerateConfigParameters
219
+
220
+ /**
221
+ * @deprecated Use SeamCustomerV1ConnectorsIcalGenerateConfigRequest instead.
222
+ */
223
+ export type SeamCustomerV1ConnectorsIcalGenerateConfigResponse = SetNonNullable<
224
+ Required<RouteResponse<'/seam/customer/v1/connectors/ical/generate-config'>>
225
+ >
226
+
227
+ export type SeamCustomerV1ConnectorsIcalGenerateConfigRequest = SeamHttpRequest<
228
+ SeamCustomerV1ConnectorsIcalGenerateConfigResponse,
229
+ 'generated_config'
230
+ >
231
+
232
+ export interface SeamCustomerV1ConnectorsIcalGenerateConfigOptions {}
233
+
234
+ export type SeamCustomerV1ConnectorsIcalValidateConfigParameters =
235
+ RouteRequestBody<'/seam/customer/v1/connectors/ical/validate-config'>
236
+
237
+ /**
238
+ * @deprecated Use SeamCustomerV1ConnectorsIcalValidateConfigParameters instead.
239
+ */
240
+ export type SeamCustomerV1ConnectorsIcalValidateConfigBody =
241
+ SeamCustomerV1ConnectorsIcalValidateConfigParameters
242
+
243
+ /**
244
+ * @deprecated Use SeamCustomerV1ConnectorsIcalValidateConfigRequest instead.
245
+ */
246
+ export type SeamCustomerV1ConnectorsIcalValidateConfigResponse = SetNonNullable<
247
+ Required<RouteResponse<'/seam/customer/v1/connectors/ical/validate-config'>>
248
+ >
249
+
250
+ export type SeamCustomerV1ConnectorsIcalValidateConfigRequest = SeamHttpRequest<
251
+ SeamCustomerV1ConnectorsIcalValidateConfigResponse,
252
+ 'validation_result'
253
+ >
254
+
255
+ export interface SeamCustomerV1ConnectorsIcalValidateConfigOptions {}
@@ -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 './ical.js'
@@ -4,3 +4,4 @@
4
4
  */
5
5
 
6
6
  export * from './connectors.js'
7
+ export * from './ical/index.js'
@@ -647,6 +647,15 @@ import {
647
647
  type SeamCustomerV1ConnectorCustomersListRequest,
648
648
  SeamHttpSeamCustomerV1ConnectorCustomers,
649
649
  } from './seam/customer/v1/connector-customers/index.js'
650
+ import {
651
+ type SeamCustomerV1ConnectorsIcalGenerateConfigOptions,
652
+ type SeamCustomerV1ConnectorsIcalGenerateConfigParameters,
653
+ type SeamCustomerV1ConnectorsIcalGenerateConfigRequest,
654
+ type SeamCustomerV1ConnectorsIcalValidateConfigOptions,
655
+ type SeamCustomerV1ConnectorsIcalValidateConfigParameters,
656
+ type SeamCustomerV1ConnectorsIcalValidateConfigRequest,
657
+ SeamHttpSeamCustomerV1ConnectorsIcal,
658
+ } from './seam/customer/v1/connectors/ical/index.js'
650
659
  import {
651
660
  type SeamCustomerV1ConnectorsAuthorizeOptions,
652
661
  type SeamCustomerV1ConnectorsAuthorizeParameters,
@@ -3537,6 +3546,52 @@ export class SeamHttpEndpoints {
3537
3546
  }
3538
3547
  }
3539
3548
 
3549
+ get '/seam/customer/v1/connectors/ical/generate-config'(): (
3550
+ parameters?: SeamCustomerV1ConnectorsIcalGenerateConfigParameters,
3551
+ options?: SeamCustomerV1ConnectorsIcalGenerateConfigOptions,
3552
+ ) => SeamCustomerV1ConnectorsIcalGenerateConfigRequest {
3553
+ const { client, defaults } = this
3554
+ if (!this.defaults.isUndocumentedApiEnabled) {
3555
+ throw new Error(
3556
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
3557
+ )
3558
+ }
3559
+ return function seamCustomerV1ConnectorsIcalGenerateConfig(
3560
+ ...args: Parameters<
3561
+ SeamHttpSeamCustomerV1ConnectorsIcal['generateConfig']
3562
+ >
3563
+ ): ReturnType<SeamHttpSeamCustomerV1ConnectorsIcal['generateConfig']> {
3564
+ const seam = SeamHttpSeamCustomerV1ConnectorsIcal.fromClient(
3565
+ client,
3566
+ defaults,
3567
+ )
3568
+ return seam.generateConfig(...args)
3569
+ }
3570
+ }
3571
+
3572
+ get '/seam/customer/v1/connectors/ical/validate-config'(): (
3573
+ parameters?: SeamCustomerV1ConnectorsIcalValidateConfigParameters,
3574
+ options?: SeamCustomerV1ConnectorsIcalValidateConfigOptions,
3575
+ ) => SeamCustomerV1ConnectorsIcalValidateConfigRequest {
3576
+ const { client, defaults } = this
3577
+ if (!this.defaults.isUndocumentedApiEnabled) {
3578
+ throw new Error(
3579
+ 'Cannot use undocumented API without isUndocumentedApiEnabled',
3580
+ )
3581
+ }
3582
+ return function seamCustomerV1ConnectorsIcalValidateConfig(
3583
+ ...args: Parameters<
3584
+ SeamHttpSeamCustomerV1ConnectorsIcal['validateConfig']
3585
+ >
3586
+ ): ReturnType<SeamHttpSeamCustomerV1ConnectorsIcal['validateConfig']> {
3587
+ const seam = SeamHttpSeamCustomerV1ConnectorsIcal.fromClient(
3588
+ client,
3589
+ defaults,
3590
+ )
3591
+ return seam.validateConfig(...args)
3592
+ }
3593
+ }
3594
+
3540
3595
  get '/seam/customer/v1/customers/automations/get'(): (
3541
3596
  parameters?: SeamCustomerV1CustomersAutomationsGetParameters,
3542
3597
  options?: SeamCustomerV1CustomersAutomationsGetOptions,
@@ -5297,6 +5352,8 @@ export type SeamHttpEndpointMutationPaths =
5297
5352
  | '/seam/customer/v1/connectors/delete'
5298
5353
  | '/seam/customer/v1/connectors/sync'
5299
5354
  | '/seam/customer/v1/connectors/update'
5355
+ | '/seam/customer/v1/connectors/ical/generate-config'
5356
+ | '/seam/customer/v1/connectors/ical/validate-config'
5300
5357
  | '/seam/customer/v1/customers/automations/update'
5301
5358
  | '/seam/customer/v1/customers/open_portal'
5302
5359
  | '/seam/customer/v1/portals/update'
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '1.111.0'
1
+ const seamapiJavascriptHttpVersion = '1.112.0'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion