@seamapi/http 1.78.0 → 1.80.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 +279 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +105 -2
- package/dist/index.cjs +283 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/lib/seam/connect/routes/access-grants/unmanaged/unmanaged.d.ts +13 -0
- package/lib/seam/connect/routes/access-grants/unmanaged/unmanaged.js +9 -0
- package/lib/seam/connect/routes/access-grants/unmanaged/unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.d.ts +47 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.js +107 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.js.map +1 -0
- 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 +6 -0
- package/lib/seam/connect/routes/seam/customer/v1/connectors/index.js.map +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/index.d.ts +2 -0
- package/lib/seam/connect/routes/seam/customer/v1/index.js +2 -0
- package/lib/seam/connect/routes/seam/customer/v1/index.js.map +1 -1
- package/lib/seam/connect/routes/seam/customer/v1/v1.d.ts +2 -0
- package/lib/seam/connect/routes/seam/customer/v1/v1.js +4 -0
- package/lib/seam/connect/routes/seam/customer/v1/v1.js.map +1 -1
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/index.d.ts +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/index.js +6 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/index.js.map +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/index.d.ts +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/index.js +6 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/index.js.map +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/workspace-id.d.ts +34 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/workspace-id.js +98 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/workspace-id.js.map +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/index.d.ts +1 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/index.js +6 -0
- package/lib/seam/connect/routes/seam/customer/v1/webhooks/index.js.map +1 -0
- package/lib/seam/connect/routes/seam-http-endpoints.d.ts +10 -3
- package/lib/seam/connect/routes/seam-http-endpoints.js +37 -0
- package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
- package/lib/seam/connect/routes/user-identities/unmanaged/unmanaged.d.ts +13 -0
- package/lib/seam/connect/routes/user-identities/unmanaged/unmanaged.js +9 -0
- package/lib/seam/connect/routes/user-identities/unmanaged/unmanaged.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-grants/unmanaged/unmanaged.ts +36 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/connectors/connectors.ts +240 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/connectors/index.ts +6 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/index.ts +2 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/v1.ts +8 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/index.ts +6 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/index.ts +6 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/webhooks/connectors/workspace-id/workspace-id.ts +216 -0
- package/src/lib/seam/connect/routes/seam/customer/v1/webhooks/index.ts +6 -0
- package/src/lib/seam/connect/routes/seam-http-endpoints.ts +99 -0
- package/src/lib/seam/connect/routes/user-identities/unmanaged/unmanaged.ts +36 -0
- package/src/lib/version.ts +1 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Automatically generated by codegen/smith.ts.
|
|
3
|
+
* Do not edit this file or add other files to this directory.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
|
|
7
|
+
|
|
8
|
+
import { seamApiLtsVersion } from 'lib/lts-version.js'
|
|
9
|
+
import {
|
|
10
|
+
getAuthHeadersForClientSessionToken,
|
|
11
|
+
warnOnInsecureuserIdentifierKey,
|
|
12
|
+
} from 'lib/seam/connect/auth.js'
|
|
13
|
+
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
14
|
+
import {
|
|
15
|
+
isSeamHttpOptionsWithApiKey,
|
|
16
|
+
isSeamHttpOptionsWithClient,
|
|
17
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
18
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
19
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
20
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
21
|
+
SeamHttpInvalidOptionsError,
|
|
22
|
+
type SeamHttpOptions,
|
|
23
|
+
type SeamHttpOptionsWithApiKey,
|
|
24
|
+
type SeamHttpOptionsWithClient,
|
|
25
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
26
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
27
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
28
|
+
type SeamHttpRequestOptions,
|
|
29
|
+
} from 'lib/seam/connect/options.js'
|
|
30
|
+
import {
|
|
31
|
+
limitToSeamHttpRequestOptions,
|
|
32
|
+
parseOptions,
|
|
33
|
+
} from 'lib/seam/connect/parse-options.js'
|
|
34
|
+
import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js'
|
|
35
|
+
import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
|
|
36
|
+
import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
|
|
37
|
+
import type { SetNonNullable } from 'lib/types.js'
|
|
38
|
+
|
|
39
|
+
export class SeamHttpSeamCustomerV1Connectors {
|
|
40
|
+
client: Client
|
|
41
|
+
readonly defaults: Required<SeamHttpRequestOptions>
|
|
42
|
+
readonly ltsVersion = seamApiLtsVersion
|
|
43
|
+
static ltsVersion = seamApiLtsVersion
|
|
44
|
+
|
|
45
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
46
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
47
|
+
this.client = 'client' in options ? options.client : createClient(options)
|
|
48
|
+
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static fromClient(
|
|
52
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
53
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
54
|
+
): SeamHttpSeamCustomerV1Connectors {
|
|
55
|
+
const constructorOptions = { ...options, client }
|
|
56
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
57
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
58
|
+
}
|
|
59
|
+
return new SeamHttpSeamCustomerV1Connectors(constructorOptions)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static fromApiKey(
|
|
63
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
64
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
65
|
+
): SeamHttpSeamCustomerV1Connectors {
|
|
66
|
+
const constructorOptions = { ...options, apiKey }
|
|
67
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
68
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
69
|
+
}
|
|
70
|
+
return new SeamHttpSeamCustomerV1Connectors(constructorOptions)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static fromClientSessionToken(
|
|
74
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
75
|
+
options: Omit<
|
|
76
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
77
|
+
'clientSessionToken'
|
|
78
|
+
> = {},
|
|
79
|
+
): SeamHttpSeamCustomerV1Connectors {
|
|
80
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
81
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
82
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
83
|
+
}
|
|
84
|
+
return new SeamHttpSeamCustomerV1Connectors(constructorOptions)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static async fromPublishableKey(
|
|
88
|
+
publishableKey: string,
|
|
89
|
+
userIdentifierKey: string,
|
|
90
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
91
|
+
): Promise<SeamHttpSeamCustomerV1Connectors> {
|
|
92
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
93
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
94
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
95
|
+
throw new SeamHttpInvalidOptionsError(
|
|
96
|
+
'The client option cannot be used with SeamHttpSeamCustomerV1Connectors.fromPublishableKey',
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
const client = createClient(clientOptions)
|
|
100
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
101
|
+
const { token } = await clientSessions.getOrCreate({
|
|
102
|
+
user_identifier_key: userIdentifierKey,
|
|
103
|
+
})
|
|
104
|
+
return SeamHttpSeamCustomerV1Connectors.fromClientSessionToken(
|
|
105
|
+
token,
|
|
106
|
+
options,
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static fromConsoleSessionToken(
|
|
111
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
112
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
113
|
+
options: Omit<
|
|
114
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
115
|
+
'consoleSessionToken' | 'workspaceId'
|
|
116
|
+
> = {},
|
|
117
|
+
): SeamHttpSeamCustomerV1Connectors {
|
|
118
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
119
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
120
|
+
throw new SeamHttpInvalidOptionsError(
|
|
121
|
+
'Missing consoleSessionToken or workspaceId',
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
return new SeamHttpSeamCustomerV1Connectors(constructorOptions)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
static fromPersonalAccessToken(
|
|
128
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
129
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
130
|
+
options: Omit<
|
|
131
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
132
|
+
'personalAccessToken' | 'workspaceId'
|
|
133
|
+
> = {},
|
|
134
|
+
): SeamHttpSeamCustomerV1Connectors {
|
|
135
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
136
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
137
|
+
throw new SeamHttpInvalidOptionsError(
|
|
138
|
+
'Missing personalAccessToken or workspaceId',
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
return new SeamHttpSeamCustomerV1Connectors(constructorOptions)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
145
|
+
request: SeamHttpRequest<TResponse, TResponseKey>,
|
|
146
|
+
): SeamPaginator<TResponse, TResponseKey> {
|
|
147
|
+
return new SeamPaginator<TResponse, TResponseKey>(this, request)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async updateClientSessionToken(
|
|
151
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
152
|
+
): Promise<void> {
|
|
153
|
+
const { headers } = this.client.defaults
|
|
154
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
155
|
+
clientSessionToken,
|
|
156
|
+
})
|
|
157
|
+
for (const key of Object.keys(authHeaders)) {
|
|
158
|
+
if (headers[key] == null) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
165
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
166
|
+
await clientSessions.get()
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
create(
|
|
170
|
+
parameters?: SeamCustomerV1ConnectorsCreateParameters,
|
|
171
|
+
options: SeamCustomerV1ConnectorsCreateOptions = {},
|
|
172
|
+
): SeamCustomerV1ConnectorsCreateRequest {
|
|
173
|
+
return new SeamHttpRequest(this, {
|
|
174
|
+
pathname: '/seam/customer/v1/connectors/create',
|
|
175
|
+
method: 'POST',
|
|
176
|
+
body: parameters,
|
|
177
|
+
responseKey: 'connector',
|
|
178
|
+
options,
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
sync(
|
|
183
|
+
parameters?: SeamCustomerV1ConnectorsSyncParameters,
|
|
184
|
+
options: SeamCustomerV1ConnectorsSyncOptions = {},
|
|
185
|
+
): SeamCustomerV1ConnectorsSyncRequest {
|
|
186
|
+
return new SeamHttpRequest(this, {
|
|
187
|
+
pathname: '/seam/customer/v1/connectors/sync',
|
|
188
|
+
method: 'POST',
|
|
189
|
+
body: parameters,
|
|
190
|
+
responseKey: 'connector_sync',
|
|
191
|
+
options,
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export type SeamCustomerV1ConnectorsCreateParameters =
|
|
197
|
+
RouteRequestBody<'/seam/customer/v1/connectors/create'>
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @deprecated Use SeamCustomerV1ConnectorsCreateParameters instead.
|
|
201
|
+
*/
|
|
202
|
+
export type SeamCustomerV1ConnectorsCreateBody =
|
|
203
|
+
SeamCustomerV1ConnectorsCreateParameters
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @deprecated Use SeamCustomerV1ConnectorsCreateRequest instead.
|
|
207
|
+
*/
|
|
208
|
+
export type SeamCustomerV1ConnectorsCreateResponse = SetNonNullable<
|
|
209
|
+
Required<RouteResponse<'/seam/customer/v1/connectors/create'>>
|
|
210
|
+
>
|
|
211
|
+
|
|
212
|
+
export type SeamCustomerV1ConnectorsCreateRequest = SeamHttpRequest<
|
|
213
|
+
SeamCustomerV1ConnectorsCreateResponse,
|
|
214
|
+
'connector'
|
|
215
|
+
>
|
|
216
|
+
|
|
217
|
+
export interface SeamCustomerV1ConnectorsCreateOptions {}
|
|
218
|
+
|
|
219
|
+
export type SeamCustomerV1ConnectorsSyncParameters =
|
|
220
|
+
RouteRequestBody<'/seam/customer/v1/connectors/sync'>
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @deprecated Use SeamCustomerV1ConnectorsSyncParameters instead.
|
|
224
|
+
*/
|
|
225
|
+
export type SeamCustomerV1ConnectorsSyncBody =
|
|
226
|
+
SeamCustomerV1ConnectorsSyncParameters
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated Use SeamCustomerV1ConnectorsSyncRequest instead.
|
|
230
|
+
*/
|
|
231
|
+
export type SeamCustomerV1ConnectorsSyncResponse = SetNonNullable<
|
|
232
|
+
Required<RouteResponse<'/seam/customer/v1/connectors/sync'>>
|
|
233
|
+
>
|
|
234
|
+
|
|
235
|
+
export type SeamCustomerV1ConnectorsSyncRequest = SeamHttpRequest<
|
|
236
|
+
SeamCustomerV1ConnectorsSyncResponse,
|
|
237
|
+
'connector_sync'
|
|
238
|
+
>
|
|
239
|
+
|
|
240
|
+
export interface SeamCustomerV1ConnectorsSyncOptions {}
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
export * from './automation-runs/index.js'
|
|
7
7
|
export * from './automations/index.js'
|
|
8
|
+
export * from './connectors/index.js'
|
|
8
9
|
export * from './events/index.js'
|
|
9
10
|
export * from './portals/index.js'
|
|
10
11
|
export * from './reservations/index.js'
|
|
11
12
|
export * from './settings/index.js'
|
|
12
13
|
export * from './spaces/index.js'
|
|
13
14
|
export * from './v1.js'
|
|
15
|
+
export * from './webhooks/index.js'
|
|
@@ -35,6 +35,7 @@ import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
|
|
|
35
35
|
|
|
36
36
|
import { SeamHttpSeamCustomerV1AutomationRuns } from './automation-runs/index.js'
|
|
37
37
|
import { SeamHttpSeamCustomerV1Automations } from './automations/index.js'
|
|
38
|
+
import { SeamHttpSeamCustomerV1Connectors } from './connectors/index.js'
|
|
38
39
|
import { SeamHttpSeamCustomerV1Events } from './events/index.js'
|
|
39
40
|
import { SeamHttpSeamCustomerV1Portals } from './portals/index.js'
|
|
40
41
|
import { SeamHttpSeamCustomerV1Reservations } from './reservations/index.js'
|
|
@@ -182,6 +183,13 @@ export class SeamHttpSeamCustomerV1 {
|
|
|
182
183
|
)
|
|
183
184
|
}
|
|
184
185
|
|
|
186
|
+
get connectors(): SeamHttpSeamCustomerV1Connectors {
|
|
187
|
+
return SeamHttpSeamCustomerV1Connectors.fromClient(
|
|
188
|
+
this.client,
|
|
189
|
+
this.defaults,
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
185
193
|
get events(): SeamHttpSeamCustomerV1Events {
|
|
186
194
|
return SeamHttpSeamCustomerV1Events.fromClient(this.client, this.defaults)
|
|
187
195
|
}
|
|
@@ -0,0 +1,216 @@
|
|
|
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 SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId {
|
|
40
|
+
client: Client
|
|
41
|
+
readonly defaults: Required<SeamHttpRequestOptions>
|
|
42
|
+
readonly ltsVersion = seamApiLtsVersion
|
|
43
|
+
static ltsVersion = seamApiLtsVersion
|
|
44
|
+
|
|
45
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
46
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
47
|
+
this.client = 'client' in options ? options.client : createClient(options)
|
|
48
|
+
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static fromClient(
|
|
52
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
53
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
54
|
+
): SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId {
|
|
55
|
+
const constructorOptions = { ...options, client }
|
|
56
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
57
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
58
|
+
}
|
|
59
|
+
return new SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId(
|
|
60
|
+
constructorOptions,
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static fromApiKey(
|
|
65
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
66
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
67
|
+
): SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId {
|
|
68
|
+
const constructorOptions = { ...options, apiKey }
|
|
69
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
70
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
71
|
+
}
|
|
72
|
+
return new SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId(
|
|
73
|
+
constructorOptions,
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static fromClientSessionToken(
|
|
78
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
79
|
+
options: Omit<
|
|
80
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
81
|
+
'clientSessionToken'
|
|
82
|
+
> = {},
|
|
83
|
+
): SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId {
|
|
84
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
85
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
86
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
87
|
+
}
|
|
88
|
+
return new SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId(
|
|
89
|
+
constructorOptions,
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static async fromPublishableKey(
|
|
94
|
+
publishableKey: string,
|
|
95
|
+
userIdentifierKey: string,
|
|
96
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
97
|
+
): Promise<SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId> {
|
|
98
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
99
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
100
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
101
|
+
throw new SeamHttpInvalidOptionsError(
|
|
102
|
+
'The client option cannot be used with SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId.fromPublishableKey',
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
const client = createClient(clientOptions)
|
|
106
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
107
|
+
const { token } = await clientSessions.getOrCreate({
|
|
108
|
+
user_identifier_key: userIdentifierKey,
|
|
109
|
+
})
|
|
110
|
+
return SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId.fromClientSessionToken(
|
|
111
|
+
token,
|
|
112
|
+
options,
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static fromConsoleSessionToken(
|
|
117
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
118
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
119
|
+
options: Omit<
|
|
120
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
121
|
+
'consoleSessionToken' | 'workspaceId'
|
|
122
|
+
> = {},
|
|
123
|
+
): SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId {
|
|
124
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
125
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
126
|
+
throw new SeamHttpInvalidOptionsError(
|
|
127
|
+
'Missing consoleSessionToken or workspaceId',
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
return new SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId(
|
|
131
|
+
constructorOptions,
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static fromPersonalAccessToken(
|
|
136
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
137
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
138
|
+
options: Omit<
|
|
139
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
140
|
+
'personalAccessToken' | 'workspaceId'
|
|
141
|
+
> = {},
|
|
142
|
+
): SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId {
|
|
143
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
144
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
145
|
+
throw new SeamHttpInvalidOptionsError(
|
|
146
|
+
'Missing personalAccessToken or workspaceId',
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
return new SeamHttpSeamCustomerV1WebhooksConnectorsWorkspaceId(
|
|
150
|
+
constructorOptions,
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
155
|
+
request: SeamHttpRequest<TResponse, TResponseKey>,
|
|
156
|
+
): SeamPaginator<TResponse, TResponseKey> {
|
|
157
|
+
return new SeamPaginator<TResponse, TResponseKey>(this, request)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async updateClientSessionToken(
|
|
161
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
162
|
+
): Promise<void> {
|
|
163
|
+
const { headers } = this.client.defaults
|
|
164
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
165
|
+
clientSessionToken,
|
|
166
|
+
})
|
|
167
|
+
for (const key of Object.keys(authHeaders)) {
|
|
168
|
+
if (headers[key] == null) {
|
|
169
|
+
throw new Error(
|
|
170
|
+
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
175
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
176
|
+
await clientSessions.get()
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
connectorId(
|
|
180
|
+
parameters?: SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdParameters,
|
|
181
|
+
options: SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdOptions = {},
|
|
182
|
+
): SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdRequest {
|
|
183
|
+
return new SeamHttpRequest(this, {
|
|
184
|
+
pathname:
|
|
185
|
+
'/seam/customer/v1/webhooks/connectors/[workspace_id]/[connector_id]',
|
|
186
|
+
method: 'POST',
|
|
187
|
+
body: parameters,
|
|
188
|
+
responseKey: undefined,
|
|
189
|
+
options,
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export type SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdParameters =
|
|
195
|
+
RouteRequestBody<'/seam/customer/v1/webhooks/connectors/[workspace_id]/[connector_id]'>
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated Use SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdParameters instead.
|
|
199
|
+
*/
|
|
200
|
+
export type SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdBody =
|
|
201
|
+
SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdParameters
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated Use SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdRequest instead.
|
|
205
|
+
*/
|
|
206
|
+
export type SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdResponse =
|
|
207
|
+
SetNonNullable<
|
|
208
|
+
Required<
|
|
209
|
+
RouteResponse<'/seam/customer/v1/webhooks/connectors/[workspace_id]/[connector_id]'>
|
|
210
|
+
>
|
|
211
|
+
>
|
|
212
|
+
|
|
213
|
+
export type SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdRequest =
|
|
214
|
+
SeamHttpRequest<void, undefined>
|
|
215
|
+
|
|
216
|
+
export interface SeamCustomerV1WebhooksConnectorsWorkspaceIdConnectorIdOptions {}
|