@seamapi/http 1.116.0 → 1.118.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.
- package/dist/connect.cjs +364 -16
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +146 -17
- package/dist/index.cjs +368 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/lib/seam/connect/routes/access-methods/access-methods.d.ts +24 -0
- package/lib/seam/connect/routes/access-methods/access-methods.js +18 -0
- package/lib/seam/connect/routes/access-methods/access-methods.js.map +1 -1
- package/lib/seam/connect/routes/acs/encoders/encoders.d.ts +12 -0
- package/lib/seam/connect/routes/acs/encoders/encoders.js +9 -0
- package/lib/seam/connect/routes/acs/encoders/encoders.js.map +1 -1
- package/lib/seam/connect/routes/seam/console/v1/index.d.ts +1 -0
- package/lib/seam/connect/routes/seam/console/v1/index.js +1 -0
- package/lib/seam/connect/routes/seam/console/v1/index.js.map +1 -1
- package/lib/seam/connect/routes/seam/console/v1/sites/index.d.ts +1 -0
- package/lib/seam/connect/routes/seam/console/v1/sites/index.js +6 -0
- package/lib/seam/connect/routes/seam/console/v1/sites/index.js.map +1 -0
- package/lib/seam/connect/routes/seam/console/v1/sites/sites.d.ts +73 -0
- package/lib/seam/connect/routes/seam/console/v1/sites/sites.js +140 -0
- package/lib/seam/connect/routes/seam/console/v1/sites/sites.js.map +1 -0
- package/lib/seam/connect/routes/seam/console/v1/v1.d.ts +2 -0
- package/lib/seam/connect/routes/seam/console/v1/v1.js +4 -0
- package/lib/seam/connect/routes/seam/console/v1/v1.js.map +1 -1
- package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.d.ts +2 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.js +4 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.js.map +1 -1
- package/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/external-sites.d.ts +34 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/external-sites.js +104 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/external-sites.js.map +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/index.d.ts +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/index.js +6 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/index.js.map +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.d.ts +0 -13
- package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.js +0 -12
- package/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.js.map +1 -1
- package/lib/seam/connect/routes/seam/customer/v1/connectors/index.d.ts +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/index.js +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/index.js.map +1 -1
- package/lib/seam/connect/routes/seam-http-endpoints.d.ts +15 -6
- package/lib/seam/connect/routes/seam-http-endpoints.js +67 -4
- package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/lib/seam/connect/routes/access-methods/access-methods.ts +76 -0
- package/src/lib/seam/connect/routes/acs/encoders/encoders.ts +39 -0
- package/src/lib/seam/connect/routes/seam/console/v1/index.ts +1 -0
- package/src/lib/seam/connect/routes/seam/console/v1/sites/index.ts +6 -0
- package/src/lib/seam/connect/routes/seam/console/v1/sites/sites.ts +327 -0
- package/src/lib/seam/connect/routes/seam/console/v1/v1.ts +5 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.ts +8 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/external-sites.ts +214 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/index.ts +6 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/connectors/ical/ical.ts +0 -41
- package/src/lib/seam/connect/routes/seam/customer/v1/connectors/index.ts +1 -0
- package/src/lib/seam/connect/routes/seam-http-endpoints.ts +158 -15
- package/src/lib/version.ts +1 -1
|
@@ -0,0 +1,327 @@
|
|
|
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 SeamHttpSeamConsoleV1Sites {
|
|
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
|
+
): SeamHttpSeamConsoleV1Sites {
|
|
60
|
+
const constructorOptions = { ...options, client }
|
|
61
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
62
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
63
|
+
}
|
|
64
|
+
return new SeamHttpSeamConsoleV1Sites(constructorOptions)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static fromApiKey(
|
|
68
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
69
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
70
|
+
): SeamHttpSeamConsoleV1Sites {
|
|
71
|
+
const constructorOptions = { ...options, apiKey }
|
|
72
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
73
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
74
|
+
}
|
|
75
|
+
return new SeamHttpSeamConsoleV1Sites(constructorOptions)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static fromClientSessionToken(
|
|
79
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
80
|
+
options: Omit<
|
|
81
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
82
|
+
'clientSessionToken'
|
|
83
|
+
> = {},
|
|
84
|
+
): SeamHttpSeamConsoleV1Sites {
|
|
85
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
86
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
87
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
88
|
+
}
|
|
89
|
+
return new SeamHttpSeamConsoleV1Sites(constructorOptions)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static async fromPublishableKey(
|
|
93
|
+
publishableKey: string,
|
|
94
|
+
userIdentifierKey: string,
|
|
95
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
96
|
+
): Promise<SeamHttpSeamConsoleV1Sites> {
|
|
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 SeamHttpSeamConsoleV1Sites.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 SeamHttpSeamConsoleV1Sites.fromClientSessionToken(token, options)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static fromConsoleSessionToken(
|
|
113
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
114
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
115
|
+
options: Omit<
|
|
116
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
117
|
+
'consoleSessionToken' | 'workspaceId'
|
|
118
|
+
> = {},
|
|
119
|
+
): SeamHttpSeamConsoleV1Sites {
|
|
120
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
121
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
122
|
+
throw new SeamHttpInvalidOptionsError(
|
|
123
|
+
'Missing consoleSessionToken or workspaceId',
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
return new SeamHttpSeamConsoleV1Sites(constructorOptions)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static fromPersonalAccessToken(
|
|
130
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
131
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
132
|
+
options: Omit<
|
|
133
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
134
|
+
'personalAccessToken' | 'workspaceId'
|
|
135
|
+
> = {},
|
|
136
|
+
): SeamHttpSeamConsoleV1Sites {
|
|
137
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
138
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
139
|
+
throw new SeamHttpInvalidOptionsError(
|
|
140
|
+
'Missing personalAccessToken or workspaceId',
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
return new SeamHttpSeamConsoleV1Sites(constructorOptions)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
147
|
+
request: SeamHttpRequest<TResponse, TResponseKey>,
|
|
148
|
+
): SeamPaginator<TResponse, TResponseKey> {
|
|
149
|
+
return new SeamPaginator<TResponse, TResponseKey>(this, request)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async updateClientSessionToken(
|
|
153
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
154
|
+
): Promise<void> {
|
|
155
|
+
const { headers } = this.client.defaults
|
|
156
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
157
|
+
clientSessionToken,
|
|
158
|
+
})
|
|
159
|
+
for (const key of Object.keys(authHeaders)) {
|
|
160
|
+
if (headers[key] == null) {
|
|
161
|
+
throw new Error(
|
|
162
|
+
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
167
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
168
|
+
await clientSessions.get()
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
create(
|
|
172
|
+
parameters?: SeamConsoleV1SitesCreateParameters,
|
|
173
|
+
options: SeamConsoleV1SitesCreateOptions = {},
|
|
174
|
+
): SeamConsoleV1SitesCreateRequest {
|
|
175
|
+
if (!this.defaults.isUndocumentedApiEnabled) {
|
|
176
|
+
throw new Error(
|
|
177
|
+
'Cannot use undocumented API without isUndocumentedApiEnabled',
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
return new SeamHttpRequest(this, {
|
|
181
|
+
pathname: '/seam/console/v1/sites/create',
|
|
182
|
+
method: 'POST',
|
|
183
|
+
body: parameters,
|
|
184
|
+
responseKey: 'site',
|
|
185
|
+
options,
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
delete(
|
|
190
|
+
parameters?: SeamConsoleV1SitesDeleteParameters,
|
|
191
|
+
options: SeamConsoleV1SitesDeleteOptions = {},
|
|
192
|
+
): SeamConsoleV1SitesDeleteRequest {
|
|
193
|
+
if (!this.defaults.isUndocumentedApiEnabled) {
|
|
194
|
+
throw new Error(
|
|
195
|
+
'Cannot use undocumented API without isUndocumentedApiEnabled',
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
return new SeamHttpRequest(this, {
|
|
199
|
+
pathname: '/seam/console/v1/sites/delete',
|
|
200
|
+
method: 'POST',
|
|
201
|
+
body: parameters,
|
|
202
|
+
responseKey: undefined,
|
|
203
|
+
options,
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
list(
|
|
208
|
+
parameters?: SeamConsoleV1SitesListParameters,
|
|
209
|
+
options: SeamConsoleV1SitesListOptions = {},
|
|
210
|
+
): SeamConsoleV1SitesListRequest {
|
|
211
|
+
if (!this.defaults.isUndocumentedApiEnabled) {
|
|
212
|
+
throw new Error(
|
|
213
|
+
'Cannot use undocumented API without isUndocumentedApiEnabled',
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
return new SeamHttpRequest(this, {
|
|
217
|
+
pathname: '/seam/console/v1/sites/list',
|
|
218
|
+
method: 'POST',
|
|
219
|
+
body: parameters,
|
|
220
|
+
responseKey: 'sites',
|
|
221
|
+
options,
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
update(
|
|
226
|
+
parameters?: SeamConsoleV1SitesUpdateParameters,
|
|
227
|
+
options: SeamConsoleV1SitesUpdateOptions = {},
|
|
228
|
+
): SeamConsoleV1SitesUpdateRequest {
|
|
229
|
+
if (!this.defaults.isUndocumentedApiEnabled) {
|
|
230
|
+
throw new Error(
|
|
231
|
+
'Cannot use undocumented API without isUndocumentedApiEnabled',
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
return new SeamHttpRequest(this, {
|
|
235
|
+
pathname: '/seam/console/v1/sites/update',
|
|
236
|
+
method: 'PATCH',
|
|
237
|
+
body: parameters,
|
|
238
|
+
responseKey: 'site',
|
|
239
|
+
options,
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export type SeamConsoleV1SitesCreateParameters =
|
|
245
|
+
RouteRequestBody<'/seam/console/v1/sites/create'>
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @deprecated Use SeamConsoleV1SitesCreateParameters instead.
|
|
249
|
+
*/
|
|
250
|
+
export type SeamConsoleV1SitesCreateBody = SeamConsoleV1SitesCreateParameters
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @deprecated Use SeamConsoleV1SitesCreateRequest instead.
|
|
254
|
+
*/
|
|
255
|
+
export type SeamConsoleV1SitesCreateResponse = SetNonNullable<
|
|
256
|
+
Required<RouteResponse<'/seam/console/v1/sites/create'>>
|
|
257
|
+
>
|
|
258
|
+
|
|
259
|
+
export type SeamConsoleV1SitesCreateRequest = SeamHttpRequest<
|
|
260
|
+
SeamConsoleV1SitesCreateResponse,
|
|
261
|
+
'site'
|
|
262
|
+
>
|
|
263
|
+
|
|
264
|
+
export interface SeamConsoleV1SitesCreateOptions {}
|
|
265
|
+
|
|
266
|
+
export type SeamConsoleV1SitesDeleteParameters =
|
|
267
|
+
RouteRequestBody<'/seam/console/v1/sites/delete'>
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @deprecated Use SeamConsoleV1SitesDeleteParameters instead.
|
|
271
|
+
*/
|
|
272
|
+
export type SeamConsoleV1SitesDeleteParams = SeamConsoleV1SitesDeleteParameters
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @deprecated Use SeamConsoleV1SitesDeleteRequest instead.
|
|
276
|
+
*/
|
|
277
|
+
export type SeamConsoleV1SitesDeleteResponse = SetNonNullable<
|
|
278
|
+
Required<RouteResponse<'/seam/console/v1/sites/delete'>>
|
|
279
|
+
>
|
|
280
|
+
|
|
281
|
+
export type SeamConsoleV1SitesDeleteRequest = SeamHttpRequest<void, undefined>
|
|
282
|
+
|
|
283
|
+
export interface SeamConsoleV1SitesDeleteOptions {}
|
|
284
|
+
|
|
285
|
+
export type SeamConsoleV1SitesListParameters =
|
|
286
|
+
RouteRequestBody<'/seam/console/v1/sites/list'>
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated Use SeamConsoleV1SitesListParameters instead.
|
|
290
|
+
*/
|
|
291
|
+
export type SeamConsoleV1SitesListParams = SeamConsoleV1SitesListParameters
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* @deprecated Use SeamConsoleV1SitesListRequest instead.
|
|
295
|
+
*/
|
|
296
|
+
export type SeamConsoleV1SitesListResponse = SetNonNullable<
|
|
297
|
+
Required<RouteResponse<'/seam/console/v1/sites/list'>>
|
|
298
|
+
>
|
|
299
|
+
|
|
300
|
+
export type SeamConsoleV1SitesListRequest = SeamHttpRequest<
|
|
301
|
+
SeamConsoleV1SitesListResponse,
|
|
302
|
+
'sites'
|
|
303
|
+
>
|
|
304
|
+
|
|
305
|
+
export interface SeamConsoleV1SitesListOptions {}
|
|
306
|
+
|
|
307
|
+
export type SeamConsoleV1SitesUpdateParameters =
|
|
308
|
+
RouteRequestBody<'/seam/console/v1/sites/update'>
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @deprecated Use SeamConsoleV1SitesUpdateParameters instead.
|
|
312
|
+
*/
|
|
313
|
+
export type SeamConsoleV1SitesUpdateBody = SeamConsoleV1SitesUpdateParameters
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated Use SeamConsoleV1SitesUpdateRequest instead.
|
|
317
|
+
*/
|
|
318
|
+
export type SeamConsoleV1SitesUpdateResponse = SetNonNullable<
|
|
319
|
+
Required<RouteResponse<'/seam/console/v1/sites/update'>>
|
|
320
|
+
>
|
|
321
|
+
|
|
322
|
+
export type SeamConsoleV1SitesUpdateRequest = SeamHttpRequest<
|
|
323
|
+
SeamConsoleV1SitesUpdateResponse,
|
|
324
|
+
'site'
|
|
325
|
+
>
|
|
326
|
+
|
|
327
|
+
export interface SeamConsoleV1SitesUpdateOptions {}
|
|
@@ -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 { SeamHttpSeamConsoleV1Sites } from './sites/index.js'
|
|
39
40
|
import { SeamHttpSeamConsoleV1Timelines } from './timelines/index.js'
|
|
40
41
|
|
|
41
42
|
export class SeamHttpSeamConsoleV1 {
|
|
@@ -170,6 +171,10 @@ export class SeamHttpSeamConsoleV1 {
|
|
|
170
171
|
await clientSessions.get()
|
|
171
172
|
}
|
|
172
173
|
|
|
174
|
+
get sites(): SeamHttpSeamConsoleV1Sites {
|
|
175
|
+
return SeamHttpSeamConsoleV1Sites.fromClient(this.client, this.defaults)
|
|
176
|
+
}
|
|
177
|
+
|
|
173
178
|
get timelines(): SeamHttpSeamConsoleV1Timelines {
|
|
174
179
|
return SeamHttpSeamConsoleV1Timelines.fromClient(this.client, this.defaults)
|
|
175
180
|
}
|
|
@@ -40,6 +40,7 @@ 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 { SeamHttpSeamCustomerV1ConnectorsExternalSites } from './external-sites/index.js'
|
|
43
44
|
import { SeamHttpSeamCustomerV1ConnectorsIcal } from './ical/index.js'
|
|
44
45
|
|
|
45
46
|
export class SeamHttpSeamCustomerV1Connectors {
|
|
@@ -177,6 +178,13 @@ export class SeamHttpSeamCustomerV1Connectors {
|
|
|
177
178
|
await clientSessions.get()
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
get externalSites(): SeamHttpSeamCustomerV1ConnectorsExternalSites {
|
|
182
|
+
return SeamHttpSeamCustomerV1ConnectorsExternalSites.fromClient(
|
|
183
|
+
this.client,
|
|
184
|
+
this.defaults,
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
180
188
|
get ical(): SeamHttpSeamCustomerV1ConnectorsIcal {
|
|
181
189
|
return SeamHttpSeamCustomerV1ConnectorsIcal.fromClient(
|
|
182
190
|
this.client,
|
package/src/lib/seam/connect/routes/seam/customer/v1/connectors/external-sites/external-sites.ts
ADDED
|
@@ -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 SeamHttpSeamCustomerV1ConnectorsExternalSites {
|
|
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
|
+
): SeamHttpSeamCustomerV1ConnectorsExternalSites {
|
|
60
|
+
const constructorOptions = { ...options, client }
|
|
61
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
62
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
63
|
+
}
|
|
64
|
+
return new SeamHttpSeamCustomerV1ConnectorsExternalSites(constructorOptions)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static fromApiKey(
|
|
68
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
69
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
70
|
+
): SeamHttpSeamCustomerV1ConnectorsExternalSites {
|
|
71
|
+
const constructorOptions = { ...options, apiKey }
|
|
72
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
73
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
74
|
+
}
|
|
75
|
+
return new SeamHttpSeamCustomerV1ConnectorsExternalSites(constructorOptions)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static fromClientSessionToken(
|
|
79
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
80
|
+
options: Omit<
|
|
81
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
82
|
+
'clientSessionToken'
|
|
83
|
+
> = {},
|
|
84
|
+
): SeamHttpSeamCustomerV1ConnectorsExternalSites {
|
|
85
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
86
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
87
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
88
|
+
}
|
|
89
|
+
return new SeamHttpSeamCustomerV1ConnectorsExternalSites(constructorOptions)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static async fromPublishableKey(
|
|
93
|
+
publishableKey: string,
|
|
94
|
+
userIdentifierKey: string,
|
|
95
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
96
|
+
): Promise<SeamHttpSeamCustomerV1ConnectorsExternalSites> {
|
|
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 SeamHttpSeamCustomerV1ConnectorsExternalSites.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 SeamHttpSeamCustomerV1ConnectorsExternalSites.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
|
+
): SeamHttpSeamCustomerV1ConnectorsExternalSites {
|
|
123
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
124
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
125
|
+
throw new SeamHttpInvalidOptionsError(
|
|
126
|
+
'Missing consoleSessionToken or workspaceId',
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
return new SeamHttpSeamCustomerV1ConnectorsExternalSites(constructorOptions)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static fromPersonalAccessToken(
|
|
133
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
134
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
135
|
+
options: Omit<
|
|
136
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
137
|
+
'personalAccessToken' | 'workspaceId'
|
|
138
|
+
> = {},
|
|
139
|
+
): SeamHttpSeamCustomerV1ConnectorsExternalSites {
|
|
140
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
141
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
142
|
+
throw new SeamHttpInvalidOptionsError(
|
|
143
|
+
'Missing personalAccessToken or workspaceId',
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
return new SeamHttpSeamCustomerV1ConnectorsExternalSites(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?: SeamCustomerV1ConnectorsExternalSitesListParameters,
|
|
176
|
+
options: SeamCustomerV1ConnectorsExternalSitesListOptions = {},
|
|
177
|
+
): SeamCustomerV1ConnectorsExternalSitesListRequest {
|
|
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/external_sites/list',
|
|
185
|
+
method: 'POST',
|
|
186
|
+
body: parameters,
|
|
187
|
+
responseKey: 'external_sites',
|
|
188
|
+
options,
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export type SeamCustomerV1ConnectorsExternalSitesListParameters =
|
|
194
|
+
RouteRequestBody<'/seam/customer/v1/connectors/external_sites/list'>
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @deprecated Use SeamCustomerV1ConnectorsExternalSitesListParameters instead.
|
|
198
|
+
*/
|
|
199
|
+
export type SeamCustomerV1ConnectorsExternalSitesListParams =
|
|
200
|
+
SeamCustomerV1ConnectorsExternalSitesListParameters
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated Use SeamCustomerV1ConnectorsExternalSitesListRequest instead.
|
|
204
|
+
*/
|
|
205
|
+
export type SeamCustomerV1ConnectorsExternalSitesListResponse = SetNonNullable<
|
|
206
|
+
Required<RouteResponse<'/seam/customer/v1/connectors/external_sites/list'>>
|
|
207
|
+
>
|
|
208
|
+
|
|
209
|
+
export type SeamCustomerV1ConnectorsExternalSitesListRequest = SeamHttpRequest<
|
|
210
|
+
SeamCustomerV1ConnectorsExternalSitesListResponse,
|
|
211
|
+
'external_sites'
|
|
212
|
+
>
|
|
213
|
+
|
|
214
|
+
export interface SeamCustomerV1ConnectorsExternalSitesListOptions {}
|
|
@@ -171,24 +171,6 @@ export class SeamHttpSeamCustomerV1ConnectorsIcal {
|
|
|
171
171
|
await clientSessions.get()
|
|
172
172
|
}
|
|
173
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
174
|
validateConfig(
|
|
193
175
|
parameters?: SeamCustomerV1ConnectorsIcalValidateConfigParameters,
|
|
194
176
|
options: SeamCustomerV1ConnectorsIcalValidateConfigOptions = {},
|
|
@@ -208,29 +190,6 @@ export class SeamHttpSeamCustomerV1ConnectorsIcal {
|
|
|
208
190
|
}
|
|
209
191
|
}
|
|
210
192
|
|
|
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
193
|
export type SeamCustomerV1ConnectorsIcalValidateConfigParameters =
|
|
235
194
|
RouteRequestBody<'/seam/customer/v1/connectors/ical/validate-config'>
|
|
236
195
|
|