@seamapi/http 1.55.0 → 1.57.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 (44) hide show
  1. package/dist/connect.cjs +0 -415
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +3 -135
  4. package/dist/index.cjs +0 -419
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +1 -1
  7. package/lib/seam/connect/routes/index.d.ts +0 -2
  8. package/lib/seam/connect/routes/index.js +0 -2
  9. package/lib/seam/connect/routes/index.js.map +1 -1
  10. package/lib/seam/connect/routes/seam-http-endpoints.d.ts +2 -11
  11. package/lib/seam/connect/routes/seam-http-endpoints.js +0 -84
  12. package/lib/seam/connect/routes/seam-http-endpoints.js.map +1 -1
  13. package/lib/seam/connect/routes/seam-http.d.ts +0 -4
  14. package/lib/seam/connect/routes/seam-http.js +0 -8
  15. package/lib/seam/connect/routes/seam-http.js.map +1 -1
  16. package/lib/seam/connect/routes/thermostats/daily-programs/daily-programs.js +0 -12
  17. package/lib/seam/connect/routes/thermostats/daily-programs/daily-programs.js.map +1 -1
  18. package/lib/seam/connect/routes/thermostats/thermostats.js +0 -3
  19. package/lib/seam/connect/routes/thermostats/thermostats.js.map +1 -1
  20. package/lib/version.d.ts +1 -1
  21. package/lib/version.js +1 -1
  22. package/package.json +3 -3
  23. package/src/lib/seam/connect/routes/index.ts +0 -2
  24. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +0 -180
  25. package/src/lib/seam/connect/routes/seam-http.ts +0 -10
  26. package/src/lib/seam/connect/routes/thermostats/daily-programs/daily-programs.ts +0 -20
  27. package/src/lib/seam/connect/routes/thermostats/thermostats.ts +0 -5
  28. package/src/lib/version.ts +1 -1
  29. package/lib/seam/connect/routes/unstable-access-grants/index.d.ts +0 -1
  30. package/lib/seam/connect/routes/unstable-access-grants/index.js +0 -6
  31. package/lib/seam/connect/routes/unstable-access-grants/index.js.map +0 -1
  32. package/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.d.ts +0 -73
  33. package/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.js +0 -138
  34. package/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.js.map +0 -1
  35. package/lib/seam/connect/routes/unstable-access-methods/index.d.ts +0 -1
  36. package/lib/seam/connect/routes/unstable-access-methods/index.js +0 -6
  37. package/lib/seam/connect/routes/unstable-access-methods/index.js.map +0 -1
  38. package/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.d.ts +0 -60
  39. package/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.js +0 -126
  40. package/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.js.map +0 -1
  41. package/src/lib/seam/connect/routes/unstable-access-grants/index.ts +0 -6
  42. package/src/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.ts +0 -333
  43. package/src/lib/seam/connect/routes/unstable-access-methods/index.ts +0 -6
  44. package/src/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.ts +0 -295
@@ -1,295 +0,0 @@
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 SeamHttpUnstableAccessMethods {
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
- ): SeamHttpUnstableAccessMethods {
60
- const constructorOptions = { ...options, client }
61
- if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
- throw new SeamHttpInvalidOptionsError('Missing client')
63
- }
64
- return new SeamHttpUnstableAccessMethods(constructorOptions)
65
- }
66
-
67
- static fromApiKey(
68
- apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
- options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
- ): SeamHttpUnstableAccessMethods {
71
- const constructorOptions = { ...options, apiKey }
72
- if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
- throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
- }
75
- return new SeamHttpUnstableAccessMethods(constructorOptions)
76
- }
77
-
78
- static fromClientSessionToken(
79
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
- options: Omit<
81
- SeamHttpOptionsWithClientSessionToken,
82
- 'clientSessionToken'
83
- > = {},
84
- ): SeamHttpUnstableAccessMethods {
85
- const constructorOptions = { ...options, clientSessionToken }
86
- if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
- throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
- }
89
- return new SeamHttpUnstableAccessMethods(constructorOptions)
90
- }
91
-
92
- static async fromPublishableKey(
93
- publishableKey: string,
94
- userIdentifierKey: string,
95
- options: SeamHttpFromPublishableKeyOptions = {},
96
- ): Promise<SeamHttpUnstableAccessMethods> {
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 SeamHttpUnstableAccessMethods.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 SeamHttpUnstableAccessMethods.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
- ): SeamHttpUnstableAccessMethods {
120
- const constructorOptions = { ...options, consoleSessionToken, workspaceId }
121
- if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
122
- throw new SeamHttpInvalidOptionsError(
123
- 'Missing consoleSessionToken or workspaceId',
124
- )
125
- }
126
- return new SeamHttpUnstableAccessMethods(constructorOptions)
127
- }
128
-
129
- static fromPersonalAccessToken(
130
- personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
131
- workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
132
- options: Omit<
133
- SeamHttpOptionsWithPersonalAccessToken,
134
- 'personalAccessToken' | 'workspaceId'
135
- > = {},
136
- ): SeamHttpUnstableAccessMethods {
137
- const constructorOptions = { ...options, personalAccessToken, workspaceId }
138
- if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
139
- throw new SeamHttpInvalidOptionsError(
140
- 'Missing personalAccessToken or workspaceId',
141
- )
142
- }
143
- return new SeamHttpUnstableAccessMethods(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
- delete(
172
- parameters?: UnstableAccessMethodsDeleteParameters,
173
- options: UnstableAccessMethodsDeleteOptions = {},
174
- ): UnstableAccessMethodsDeleteRequest {
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: '/unstable_access_methods/delete',
182
- method: 'POST',
183
- body: parameters,
184
- responseKey: undefined,
185
- options,
186
- })
187
- }
188
-
189
- get(
190
- parameters?: UnstableAccessMethodsGetParameters,
191
- options: UnstableAccessMethodsGetOptions = {},
192
- ): UnstableAccessMethodsGetRequest {
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: '/unstable_access_methods/get',
200
- method: 'POST',
201
- body: parameters,
202
- responseKey: 'access_method',
203
- options,
204
- })
205
- }
206
-
207
- list(
208
- parameters?: UnstableAccessMethodsListParameters,
209
- options: UnstableAccessMethodsListOptions = {},
210
- ): UnstableAccessMethodsListRequest {
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: '/unstable_access_methods/list',
218
- method: 'POST',
219
- body: parameters,
220
- responseKey: 'access_methods',
221
- options,
222
- })
223
- }
224
- }
225
-
226
- export type UnstableAccessMethodsDeleteParameters =
227
- RouteRequestBody<'/unstable_access_methods/delete'>
228
-
229
- /**
230
- * @deprecated Use UnstableAccessMethodsDeleteParameters instead.
231
- */
232
- export type UnstableAccessMethodsDeleteParams =
233
- UnstableAccessMethodsDeleteParameters
234
-
235
- /**
236
- * @deprecated Use UnstableAccessMethodsDeleteRequest instead.
237
- */
238
- export type UnstableAccessMethodsDeleteResponse = SetNonNullable<
239
- Required<RouteResponse<'/unstable_access_methods/delete'>>
240
- >
241
-
242
- export type UnstableAccessMethodsDeleteRequest = SeamHttpRequest<
243
- void,
244
- undefined
245
- >
246
-
247
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
248
- export interface UnstableAccessMethodsDeleteOptions {}
249
-
250
- export type UnstableAccessMethodsGetParameters =
251
- RouteRequestBody<'/unstable_access_methods/get'>
252
-
253
- /**
254
- * @deprecated Use UnstableAccessMethodsGetParameters instead.
255
- */
256
- export type UnstableAccessMethodsGetParams = UnstableAccessMethodsGetParameters
257
-
258
- /**
259
- * @deprecated Use UnstableAccessMethodsGetRequest instead.
260
- */
261
- export type UnstableAccessMethodsGetResponse = SetNonNullable<
262
- Required<RouteResponse<'/unstable_access_methods/get'>>
263
- >
264
-
265
- export type UnstableAccessMethodsGetRequest = SeamHttpRequest<
266
- UnstableAccessMethodsGetResponse,
267
- 'access_method'
268
- >
269
-
270
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
271
- export interface UnstableAccessMethodsGetOptions {}
272
-
273
- export type UnstableAccessMethodsListParameters =
274
- RouteRequestBody<'/unstable_access_methods/list'>
275
-
276
- /**
277
- * @deprecated Use UnstableAccessMethodsListParameters instead.
278
- */
279
- export type UnstableAccessMethodsListParams =
280
- UnstableAccessMethodsListParameters
281
-
282
- /**
283
- * @deprecated Use UnstableAccessMethodsListRequest instead.
284
- */
285
- export type UnstableAccessMethodsListResponse = SetNonNullable<
286
- Required<RouteResponse<'/unstable_access_methods/list'>>
287
- >
288
-
289
- export type UnstableAccessMethodsListRequest = SeamHttpRequest<
290
- UnstableAccessMethodsListResponse,
291
- 'access_methods'
292
- >
293
-
294
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
295
- export interface UnstableAccessMethodsListOptions {}