@seamapi/http 1.25.1 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connect.cjs +0 -536
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +88 -207
- package/lib/seam/connect/resolve-action-attempt.d.ts +116 -116
- package/lib/seam/connect/routes/acs-access-groups.d.ts +0 -2
- package/lib/seam/connect/routes/acs-access-groups.js +0 -4
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
- package/lib/seam/connect/routes/acs-credentials.d.ts +0 -6
- package/lib/seam/connect/routes/acs-credentials.js +0 -12
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
- package/lib/seam/connect/routes/acs-users.d.ts +0 -2
- package/lib/seam/connect/routes/acs-users.js +0 -4
- package/lib/seam/connect/routes/acs-users.js.map +1 -1
- package/lib/seam/connect/routes/acs.d.ts +0 -4
- package/lib/seam/connect/routes/acs.js +0 -8
- package/lib/seam/connect/routes/acs.js.map +1 -1
- package/lib/seam/connect/routes/devices.d.ts +0 -4
- package/lib/seam/connect/routes/devices.js +0 -8
- package/lib/seam/connect/routes/devices.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +0 -5
- package/lib/seam/connect/routes/index.js +0 -5
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/thermostats.d.ts +0 -4
- package/lib/seam/connect/routes/thermostats.js +0 -8
- package/lib/seam/connect/routes/thermostats.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/acs-access-groups.ts +0 -8
- package/src/lib/seam/connect/routes/acs-credentials.ts +0 -31
- package/src/lib/seam/connect/routes/acs-users.ts +0 -5
- package/src/lib/seam/connect/routes/acs.ts +0 -13
- package/src/lib/seam/connect/routes/devices.ts +0 -17
- package/src/lib/seam/connect/routes/index.ts +0 -5
- package/src/lib/seam/connect/routes/thermostats.ts +0 -19
- package/src/lib/version.ts +1 -1
- package/lib/seam/connect/routes/acs-access-groups-unmanaged.d.ts +0 -27
- package/lib/seam/connect/routes/acs-access-groups-unmanaged.js +0 -100
- package/lib/seam/connect/routes/acs-access-groups-unmanaged.js.map +0 -1
- package/lib/seam/connect/routes/acs-credential-pools.d.ts +0 -23
- package/lib/seam/connect/routes/acs-credential-pools.js +0 -92
- package/lib/seam/connect/routes/acs-credential-pools.js.map +0 -1
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +0 -23
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +0 -92
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +0 -1
- package/lib/seam/connect/routes/acs-credentials-unmanaged.d.ts +0 -27
- package/lib/seam/connect/routes/acs-credentials-unmanaged.js +0 -100
- package/lib/seam/connect/routes/acs-credentials-unmanaged.js.map +0 -1
- package/lib/seam/connect/routes/acs-users-unmanaged.d.ts +0 -27
- package/lib/seam/connect/routes/acs-users-unmanaged.js +0 -100
- package/lib/seam/connect/routes/acs-users-unmanaged.js.map +0 -1
- package/src/lib/seam/connect/routes/acs-access-groups-unmanaged.ts +0 -209
- package/src/lib/seam/connect/routes/acs-credential-pools.ts +0 -183
- package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +0 -189
- package/src/lib/seam/connect/routes/acs-credentials-unmanaged.ts +0 -206
- package/src/lib/seam/connect/routes/acs-users-unmanaged.ts +0 -203
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Automatically generated by generate-routes.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 {
|
|
9
|
-
getAuthHeadersForClientSessionToken,
|
|
10
|
-
warnOnInsecureuserIdentifierKey,
|
|
11
|
-
} from 'lib/seam/connect/auth.js'
|
|
12
|
-
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
13
|
-
import {
|
|
14
|
-
isSeamHttpOptionsWithApiKey,
|
|
15
|
-
isSeamHttpOptionsWithClient,
|
|
16
|
-
isSeamHttpOptionsWithClientSessionToken,
|
|
17
|
-
isSeamHttpOptionsWithConsoleSessionToken,
|
|
18
|
-
isSeamHttpOptionsWithPersonalAccessToken,
|
|
19
|
-
type SeamHttpFromPublishableKeyOptions,
|
|
20
|
-
SeamHttpInvalidOptionsError,
|
|
21
|
-
type SeamHttpOptions,
|
|
22
|
-
type SeamHttpOptionsWithApiKey,
|
|
23
|
-
type SeamHttpOptionsWithClient,
|
|
24
|
-
type SeamHttpOptionsWithClientSessionToken,
|
|
25
|
-
type SeamHttpOptionsWithConsoleSessionToken,
|
|
26
|
-
type SeamHttpOptionsWithPersonalAccessToken,
|
|
27
|
-
type SeamHttpRequestOptions,
|
|
28
|
-
} from 'lib/seam/connect/options.js'
|
|
29
|
-
import {
|
|
30
|
-
limitToSeamHttpRequestOptions,
|
|
31
|
-
parseOptions,
|
|
32
|
-
} from 'lib/seam/connect/parse-options.js'
|
|
33
|
-
import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
|
|
34
|
-
import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
|
|
35
|
-
import type { SetNonNullable } from 'lib/types.js'
|
|
36
|
-
|
|
37
|
-
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
38
|
-
|
|
39
|
-
export class SeamHttpAcsCredentialProvisioningAutomations {
|
|
40
|
-
client: Client
|
|
41
|
-
readonly defaults: Required<SeamHttpRequestOptions>
|
|
42
|
-
|
|
43
|
-
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
44
|
-
const options = parseOptions(apiKeyOrOptions)
|
|
45
|
-
this.client = 'client' in options ? options.client : createClient(options)
|
|
46
|
-
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static fromClient(
|
|
50
|
-
client: SeamHttpOptionsWithClient['client'],
|
|
51
|
-
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
52
|
-
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
53
|
-
const constructorOptions = { ...options, client }
|
|
54
|
-
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
55
|
-
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
56
|
-
}
|
|
57
|
-
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static fromApiKey(
|
|
61
|
-
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
62
|
-
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
63
|
-
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
64
|
-
const constructorOptions = { ...options, apiKey }
|
|
65
|
-
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
66
|
-
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
67
|
-
}
|
|
68
|
-
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
static fromClientSessionToken(
|
|
72
|
-
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
73
|
-
options: Omit<
|
|
74
|
-
SeamHttpOptionsWithClientSessionToken,
|
|
75
|
-
'clientSessionToken'
|
|
76
|
-
> = {},
|
|
77
|
-
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
78
|
-
const constructorOptions = { ...options, clientSessionToken }
|
|
79
|
-
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
80
|
-
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
81
|
-
}
|
|
82
|
-
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
static async fromPublishableKey(
|
|
86
|
-
publishableKey: string,
|
|
87
|
-
userIdentifierKey: string,
|
|
88
|
-
options: SeamHttpFromPublishableKeyOptions = {},
|
|
89
|
-
): Promise<SeamHttpAcsCredentialProvisioningAutomations> {
|
|
90
|
-
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
91
|
-
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
92
|
-
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
93
|
-
throw new SeamHttpInvalidOptionsError(
|
|
94
|
-
'The client option cannot be used with SeamHttp.fromPublishableKey',
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
const client = createClient(clientOptions)
|
|
98
|
-
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
99
|
-
const { token } = await clientSessions.getOrCreate({
|
|
100
|
-
user_identifier_key: userIdentifierKey,
|
|
101
|
-
})
|
|
102
|
-
return SeamHttpAcsCredentialProvisioningAutomations.fromClientSessionToken(
|
|
103
|
-
token,
|
|
104
|
-
options,
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static fromConsoleSessionToken(
|
|
109
|
-
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
110
|
-
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
111
|
-
options: Omit<
|
|
112
|
-
SeamHttpOptionsWithConsoleSessionToken,
|
|
113
|
-
'consoleSessionToken' | 'workspaceId'
|
|
114
|
-
> = {},
|
|
115
|
-
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
116
|
-
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
117
|
-
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
118
|
-
throw new SeamHttpInvalidOptionsError(
|
|
119
|
-
'Missing consoleSessionToken or workspaceId',
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
static fromPersonalAccessToken(
|
|
126
|
-
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
127
|
-
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
128
|
-
options: Omit<
|
|
129
|
-
SeamHttpOptionsWithPersonalAccessToken,
|
|
130
|
-
'personalAccessToken' | 'workspaceId'
|
|
131
|
-
> = {},
|
|
132
|
-
): SeamHttpAcsCredentialProvisioningAutomations {
|
|
133
|
-
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
134
|
-
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
135
|
-
throw new SeamHttpInvalidOptionsError(
|
|
136
|
-
'Missing personalAccessToken or workspaceId',
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
return new SeamHttpAcsCredentialProvisioningAutomations(constructorOptions)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
143
|
-
request: SeamHttpRequest<TResponse, TResponseKey>,
|
|
144
|
-
): SeamPaginator<TResponse, TResponseKey> {
|
|
145
|
-
return new SeamPaginator<TResponse, TResponseKey>(this, request)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async updateClientSessionToken(
|
|
149
|
-
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
150
|
-
): Promise<void> {
|
|
151
|
-
const { headers } = this.client.defaults
|
|
152
|
-
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
153
|
-
clientSessionToken,
|
|
154
|
-
})
|
|
155
|
-
for (const key of Object.keys(authHeaders)) {
|
|
156
|
-
if (headers[key] == null) {
|
|
157
|
-
throw new Error(
|
|
158
|
-
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
163
|
-
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
164
|
-
await clientSessions.get()
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
launch(
|
|
168
|
-
body?: AcsCredentialProvisioningAutomationsLaunchBody,
|
|
169
|
-
): SeamHttpRequest<
|
|
170
|
-
AcsCredentialProvisioningAutomationsLaunchResponse,
|
|
171
|
-
'acs_credential_provisioning_automation'
|
|
172
|
-
> {
|
|
173
|
-
return new SeamHttpRequest(this, {
|
|
174
|
-
pathname: '/acs/credential_provisioning_automations/launch',
|
|
175
|
-
method: 'post',
|
|
176
|
-
body,
|
|
177
|
-
responseKey: 'acs_credential_provisioning_automation',
|
|
178
|
-
})
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export type AcsCredentialProvisioningAutomationsLaunchBody =
|
|
183
|
-
RouteRequestBody<'/acs/credential_provisioning_automations/launch'>
|
|
184
|
-
|
|
185
|
-
export type AcsCredentialProvisioningAutomationsLaunchResponse = SetNonNullable<
|
|
186
|
-
Required<RouteResponse<'/acs/credential_provisioning_automations/launch'>>
|
|
187
|
-
>
|
|
188
|
-
|
|
189
|
-
export type AcsCredentialProvisioningAutomationsLaunchOptions = never
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Automatically generated by generate-routes.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 {
|
|
9
|
-
getAuthHeadersForClientSessionToken,
|
|
10
|
-
warnOnInsecureuserIdentifierKey,
|
|
11
|
-
} from 'lib/seam/connect/auth.js'
|
|
12
|
-
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
13
|
-
import {
|
|
14
|
-
isSeamHttpOptionsWithApiKey,
|
|
15
|
-
isSeamHttpOptionsWithClient,
|
|
16
|
-
isSeamHttpOptionsWithClientSessionToken,
|
|
17
|
-
isSeamHttpOptionsWithConsoleSessionToken,
|
|
18
|
-
isSeamHttpOptionsWithPersonalAccessToken,
|
|
19
|
-
type SeamHttpFromPublishableKeyOptions,
|
|
20
|
-
SeamHttpInvalidOptionsError,
|
|
21
|
-
type SeamHttpOptions,
|
|
22
|
-
type SeamHttpOptionsWithApiKey,
|
|
23
|
-
type SeamHttpOptionsWithClient,
|
|
24
|
-
type SeamHttpOptionsWithClientSessionToken,
|
|
25
|
-
type SeamHttpOptionsWithConsoleSessionToken,
|
|
26
|
-
type SeamHttpOptionsWithPersonalAccessToken,
|
|
27
|
-
type SeamHttpRequestOptions,
|
|
28
|
-
} from 'lib/seam/connect/options.js'
|
|
29
|
-
import {
|
|
30
|
-
limitToSeamHttpRequestOptions,
|
|
31
|
-
parseOptions,
|
|
32
|
-
} from 'lib/seam/connect/parse-options.js'
|
|
33
|
-
import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
|
|
34
|
-
import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
|
|
35
|
-
import type { SetNonNullable } from 'lib/types.js'
|
|
36
|
-
|
|
37
|
-
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
38
|
-
|
|
39
|
-
export class SeamHttpAcsCredentialsUnmanaged {
|
|
40
|
-
client: Client
|
|
41
|
-
readonly defaults: Required<SeamHttpRequestOptions>
|
|
42
|
-
|
|
43
|
-
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
44
|
-
const options = parseOptions(apiKeyOrOptions)
|
|
45
|
-
this.client = 'client' in options ? options.client : createClient(options)
|
|
46
|
-
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static fromClient(
|
|
50
|
-
client: SeamHttpOptionsWithClient['client'],
|
|
51
|
-
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
52
|
-
): SeamHttpAcsCredentialsUnmanaged {
|
|
53
|
-
const constructorOptions = { ...options, client }
|
|
54
|
-
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
55
|
-
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
56
|
-
}
|
|
57
|
-
return new SeamHttpAcsCredentialsUnmanaged(constructorOptions)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static fromApiKey(
|
|
61
|
-
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
62
|
-
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
63
|
-
): SeamHttpAcsCredentialsUnmanaged {
|
|
64
|
-
const constructorOptions = { ...options, apiKey }
|
|
65
|
-
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
66
|
-
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
67
|
-
}
|
|
68
|
-
return new SeamHttpAcsCredentialsUnmanaged(constructorOptions)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
static fromClientSessionToken(
|
|
72
|
-
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
73
|
-
options: Omit<
|
|
74
|
-
SeamHttpOptionsWithClientSessionToken,
|
|
75
|
-
'clientSessionToken'
|
|
76
|
-
> = {},
|
|
77
|
-
): SeamHttpAcsCredentialsUnmanaged {
|
|
78
|
-
const constructorOptions = { ...options, clientSessionToken }
|
|
79
|
-
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
80
|
-
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
81
|
-
}
|
|
82
|
-
return new SeamHttpAcsCredentialsUnmanaged(constructorOptions)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
static async fromPublishableKey(
|
|
86
|
-
publishableKey: string,
|
|
87
|
-
userIdentifierKey: string,
|
|
88
|
-
options: SeamHttpFromPublishableKeyOptions = {},
|
|
89
|
-
): Promise<SeamHttpAcsCredentialsUnmanaged> {
|
|
90
|
-
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
91
|
-
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
92
|
-
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
93
|
-
throw new SeamHttpInvalidOptionsError(
|
|
94
|
-
'The client option cannot be used with SeamHttp.fromPublishableKey',
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
const client = createClient(clientOptions)
|
|
98
|
-
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
99
|
-
const { token } = await clientSessions.getOrCreate({
|
|
100
|
-
user_identifier_key: userIdentifierKey,
|
|
101
|
-
})
|
|
102
|
-
return SeamHttpAcsCredentialsUnmanaged.fromClientSessionToken(
|
|
103
|
-
token,
|
|
104
|
-
options,
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static fromConsoleSessionToken(
|
|
109
|
-
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
110
|
-
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
111
|
-
options: Omit<
|
|
112
|
-
SeamHttpOptionsWithConsoleSessionToken,
|
|
113
|
-
'consoleSessionToken' | 'workspaceId'
|
|
114
|
-
> = {},
|
|
115
|
-
): SeamHttpAcsCredentialsUnmanaged {
|
|
116
|
-
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
117
|
-
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
118
|
-
throw new SeamHttpInvalidOptionsError(
|
|
119
|
-
'Missing consoleSessionToken or workspaceId',
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
return new SeamHttpAcsCredentialsUnmanaged(constructorOptions)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
static fromPersonalAccessToken(
|
|
126
|
-
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
127
|
-
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
128
|
-
options: Omit<
|
|
129
|
-
SeamHttpOptionsWithPersonalAccessToken,
|
|
130
|
-
'personalAccessToken' | 'workspaceId'
|
|
131
|
-
> = {},
|
|
132
|
-
): SeamHttpAcsCredentialsUnmanaged {
|
|
133
|
-
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
134
|
-
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
135
|
-
throw new SeamHttpInvalidOptionsError(
|
|
136
|
-
'Missing personalAccessToken or workspaceId',
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
return new SeamHttpAcsCredentialsUnmanaged(constructorOptions)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
143
|
-
request: SeamHttpRequest<TResponse, TResponseKey>,
|
|
144
|
-
): SeamPaginator<TResponse, TResponseKey> {
|
|
145
|
-
return new SeamPaginator<TResponse, TResponseKey>(this, request)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async updateClientSessionToken(
|
|
149
|
-
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
150
|
-
): Promise<void> {
|
|
151
|
-
const { headers } = this.client.defaults
|
|
152
|
-
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
153
|
-
clientSessionToken,
|
|
154
|
-
})
|
|
155
|
-
for (const key of Object.keys(authHeaders)) {
|
|
156
|
-
if (headers[key] == null) {
|
|
157
|
-
throw new Error(
|
|
158
|
-
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
163
|
-
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
164
|
-
await clientSessions.get()
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
get(
|
|
168
|
-
body?: AcsCredentialsUnmanagedGetParams,
|
|
169
|
-
): SeamHttpRequest<AcsCredentialsUnmanagedGetResponse, 'acs_credential'> {
|
|
170
|
-
return new SeamHttpRequest(this, {
|
|
171
|
-
pathname: '/acs/credentials/unmanaged/get',
|
|
172
|
-
method: 'post',
|
|
173
|
-
body,
|
|
174
|
-
responseKey: 'acs_credential',
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
list(
|
|
179
|
-
body?: AcsCredentialsUnmanagedListParams,
|
|
180
|
-
): SeamHttpRequest<AcsCredentialsUnmanagedListResponse, 'acs_credentials'> {
|
|
181
|
-
return new SeamHttpRequest(this, {
|
|
182
|
-
pathname: '/acs/credentials/unmanaged/list',
|
|
183
|
-
method: 'post',
|
|
184
|
-
body,
|
|
185
|
-
responseKey: 'acs_credentials',
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export type AcsCredentialsUnmanagedGetParams =
|
|
191
|
-
RouteRequestBody<'/acs/credentials/unmanaged/get'>
|
|
192
|
-
|
|
193
|
-
export type AcsCredentialsUnmanagedGetResponse = SetNonNullable<
|
|
194
|
-
Required<RouteResponse<'/acs/credentials/unmanaged/get'>>
|
|
195
|
-
>
|
|
196
|
-
|
|
197
|
-
export type AcsCredentialsUnmanagedGetOptions = never
|
|
198
|
-
|
|
199
|
-
export type AcsCredentialsUnmanagedListParams =
|
|
200
|
-
RouteRequestBody<'/acs/credentials/unmanaged/list'>
|
|
201
|
-
|
|
202
|
-
export type AcsCredentialsUnmanagedListResponse = SetNonNullable<
|
|
203
|
-
Required<RouteResponse<'/acs/credentials/unmanaged/list'>>
|
|
204
|
-
>
|
|
205
|
-
|
|
206
|
-
export type AcsCredentialsUnmanagedListOptions = never
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Automatically generated by generate-routes.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 {
|
|
9
|
-
getAuthHeadersForClientSessionToken,
|
|
10
|
-
warnOnInsecureuserIdentifierKey,
|
|
11
|
-
} from 'lib/seam/connect/auth.js'
|
|
12
|
-
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
13
|
-
import {
|
|
14
|
-
isSeamHttpOptionsWithApiKey,
|
|
15
|
-
isSeamHttpOptionsWithClient,
|
|
16
|
-
isSeamHttpOptionsWithClientSessionToken,
|
|
17
|
-
isSeamHttpOptionsWithConsoleSessionToken,
|
|
18
|
-
isSeamHttpOptionsWithPersonalAccessToken,
|
|
19
|
-
type SeamHttpFromPublishableKeyOptions,
|
|
20
|
-
SeamHttpInvalidOptionsError,
|
|
21
|
-
type SeamHttpOptions,
|
|
22
|
-
type SeamHttpOptionsWithApiKey,
|
|
23
|
-
type SeamHttpOptionsWithClient,
|
|
24
|
-
type SeamHttpOptionsWithClientSessionToken,
|
|
25
|
-
type SeamHttpOptionsWithConsoleSessionToken,
|
|
26
|
-
type SeamHttpOptionsWithPersonalAccessToken,
|
|
27
|
-
type SeamHttpRequestOptions,
|
|
28
|
-
} from 'lib/seam/connect/options.js'
|
|
29
|
-
import {
|
|
30
|
-
limitToSeamHttpRequestOptions,
|
|
31
|
-
parseOptions,
|
|
32
|
-
} from 'lib/seam/connect/parse-options.js'
|
|
33
|
-
import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
|
|
34
|
-
import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js'
|
|
35
|
-
import type { SetNonNullable } from 'lib/types.js'
|
|
36
|
-
|
|
37
|
-
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
38
|
-
|
|
39
|
-
export class SeamHttpAcsUsersUnmanaged {
|
|
40
|
-
client: Client
|
|
41
|
-
readonly defaults: Required<SeamHttpRequestOptions>
|
|
42
|
-
|
|
43
|
-
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
44
|
-
const options = parseOptions(apiKeyOrOptions)
|
|
45
|
-
this.client = 'client' in options ? options.client : createClient(options)
|
|
46
|
-
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static fromClient(
|
|
50
|
-
client: SeamHttpOptionsWithClient['client'],
|
|
51
|
-
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
52
|
-
): SeamHttpAcsUsersUnmanaged {
|
|
53
|
-
const constructorOptions = { ...options, client }
|
|
54
|
-
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
55
|
-
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
56
|
-
}
|
|
57
|
-
return new SeamHttpAcsUsersUnmanaged(constructorOptions)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static fromApiKey(
|
|
61
|
-
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
62
|
-
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
63
|
-
): SeamHttpAcsUsersUnmanaged {
|
|
64
|
-
const constructorOptions = { ...options, apiKey }
|
|
65
|
-
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
66
|
-
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
67
|
-
}
|
|
68
|
-
return new SeamHttpAcsUsersUnmanaged(constructorOptions)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
static fromClientSessionToken(
|
|
72
|
-
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
73
|
-
options: Omit<
|
|
74
|
-
SeamHttpOptionsWithClientSessionToken,
|
|
75
|
-
'clientSessionToken'
|
|
76
|
-
> = {},
|
|
77
|
-
): SeamHttpAcsUsersUnmanaged {
|
|
78
|
-
const constructorOptions = { ...options, clientSessionToken }
|
|
79
|
-
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
80
|
-
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
81
|
-
}
|
|
82
|
-
return new SeamHttpAcsUsersUnmanaged(constructorOptions)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
static async fromPublishableKey(
|
|
86
|
-
publishableKey: string,
|
|
87
|
-
userIdentifierKey: string,
|
|
88
|
-
options: SeamHttpFromPublishableKeyOptions = {},
|
|
89
|
-
): Promise<SeamHttpAcsUsersUnmanaged> {
|
|
90
|
-
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
91
|
-
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
92
|
-
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
93
|
-
throw new SeamHttpInvalidOptionsError(
|
|
94
|
-
'The client option cannot be used with SeamHttp.fromPublishableKey',
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
const client = createClient(clientOptions)
|
|
98
|
-
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
99
|
-
const { token } = await clientSessions.getOrCreate({
|
|
100
|
-
user_identifier_key: userIdentifierKey,
|
|
101
|
-
})
|
|
102
|
-
return SeamHttpAcsUsersUnmanaged.fromClientSessionToken(token, options)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
static fromConsoleSessionToken(
|
|
106
|
-
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
107
|
-
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
108
|
-
options: Omit<
|
|
109
|
-
SeamHttpOptionsWithConsoleSessionToken,
|
|
110
|
-
'consoleSessionToken' | 'workspaceId'
|
|
111
|
-
> = {},
|
|
112
|
-
): SeamHttpAcsUsersUnmanaged {
|
|
113
|
-
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
114
|
-
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
115
|
-
throw new SeamHttpInvalidOptionsError(
|
|
116
|
-
'Missing consoleSessionToken or workspaceId',
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
return new SeamHttpAcsUsersUnmanaged(constructorOptions)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static fromPersonalAccessToken(
|
|
123
|
-
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
124
|
-
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
125
|
-
options: Omit<
|
|
126
|
-
SeamHttpOptionsWithPersonalAccessToken,
|
|
127
|
-
'personalAccessToken' | 'workspaceId'
|
|
128
|
-
> = {},
|
|
129
|
-
): SeamHttpAcsUsersUnmanaged {
|
|
130
|
-
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
131
|
-
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
132
|
-
throw new SeamHttpInvalidOptionsError(
|
|
133
|
-
'Missing personalAccessToken or workspaceId',
|
|
134
|
-
)
|
|
135
|
-
}
|
|
136
|
-
return new SeamHttpAcsUsersUnmanaged(constructorOptions)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
140
|
-
request: SeamHttpRequest<TResponse, TResponseKey>,
|
|
141
|
-
): SeamPaginator<TResponse, TResponseKey> {
|
|
142
|
-
return new SeamPaginator<TResponse, TResponseKey>(this, request)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async updateClientSessionToken(
|
|
146
|
-
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
147
|
-
): Promise<void> {
|
|
148
|
-
const { headers } = this.client.defaults
|
|
149
|
-
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
150
|
-
clientSessionToken,
|
|
151
|
-
})
|
|
152
|
-
for (const key of Object.keys(authHeaders)) {
|
|
153
|
-
if (headers[key] == null) {
|
|
154
|
-
throw new Error(
|
|
155
|
-
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
160
|
-
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
161
|
-
await clientSessions.get()
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
get(
|
|
165
|
-
body?: AcsUsersUnmanagedGetParams,
|
|
166
|
-
): SeamHttpRequest<AcsUsersUnmanagedGetResponse, 'acs_user'> {
|
|
167
|
-
return new SeamHttpRequest(this, {
|
|
168
|
-
pathname: '/acs/users/unmanaged/get',
|
|
169
|
-
method: 'post',
|
|
170
|
-
body,
|
|
171
|
-
responseKey: 'acs_user',
|
|
172
|
-
})
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
list(
|
|
176
|
-
body?: AcsUsersUnmanagedListParams,
|
|
177
|
-
): SeamHttpRequest<AcsUsersUnmanagedListResponse, 'acs_users'> {
|
|
178
|
-
return new SeamHttpRequest(this, {
|
|
179
|
-
pathname: '/acs/users/unmanaged/list',
|
|
180
|
-
method: 'post',
|
|
181
|
-
body,
|
|
182
|
-
responseKey: 'acs_users',
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export type AcsUsersUnmanagedGetParams =
|
|
188
|
-
RouteRequestBody<'/acs/users/unmanaged/get'>
|
|
189
|
-
|
|
190
|
-
export type AcsUsersUnmanagedGetResponse = SetNonNullable<
|
|
191
|
-
Required<RouteResponse<'/acs/users/unmanaged/get'>>
|
|
192
|
-
>
|
|
193
|
-
|
|
194
|
-
export type AcsUsersUnmanagedGetOptions = never
|
|
195
|
-
|
|
196
|
-
export type AcsUsersUnmanagedListParams =
|
|
197
|
-
RouteRequestBody<'/acs/users/unmanaged/list'>
|
|
198
|
-
|
|
199
|
-
export type AcsUsersUnmanagedListResponse = SetNonNullable<
|
|
200
|
-
Required<RouteResponse<'/acs/users/unmanaged/list'>>
|
|
201
|
-
>
|
|
202
|
-
|
|
203
|
-
export type AcsUsersUnmanagedListOptions = never
|