@seamapi/http 1.56.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 (38) hide show
  1. package/dist/connect.cjs +0 -370
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +3 -135
  4. package/dist/index.cjs +0 -374
  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 -72
  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/version.d.ts +1 -1
  17. package/lib/version.js +1 -1
  18. package/package.json +3 -3
  19. package/src/lib/seam/connect/routes/index.ts +0 -2
  20. package/src/lib/seam/connect/routes/seam-http-endpoints.ts +0 -160
  21. package/src/lib/seam/connect/routes/seam-http.ts +0 -10
  22. package/src/lib/version.ts +1 -1
  23. package/lib/seam/connect/routes/unstable-access-grants/index.d.ts +0 -1
  24. package/lib/seam/connect/routes/unstable-access-grants/index.js +0 -6
  25. package/lib/seam/connect/routes/unstable-access-grants/index.js.map +0 -1
  26. package/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.d.ts +0 -73
  27. package/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.js +0 -138
  28. package/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.js.map +0 -1
  29. package/lib/seam/connect/routes/unstable-access-methods/index.d.ts +0 -1
  30. package/lib/seam/connect/routes/unstable-access-methods/index.js +0 -6
  31. package/lib/seam/connect/routes/unstable-access-methods/index.js.map +0 -1
  32. package/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.d.ts +0 -60
  33. package/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.js +0 -126
  34. package/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.js.map +0 -1
  35. package/src/lib/seam/connect/routes/unstable-access-grants/index.ts +0 -6
  36. package/src/lib/seam/connect/routes/unstable-access-grants/unstable-access-grants.ts +0 -333
  37. package/src/lib/seam/connect/routes/unstable-access-methods/index.ts +0 -6
  38. package/src/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.ts +0 -295
@@ -1,126 +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
- import { seamApiLtsVersion } from '../../../../../lib/lts-version.js';
6
- import { getAuthHeadersForClientSessionToken, warnOnInsecureuserIdentifierKey, } from '../../../../../lib/seam/connect/auth.js';
7
- import { createClient } from '../../../../../lib/seam/connect/client.js';
8
- import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../../lib/seam/connect/options.js';
9
- import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../../lib/seam/connect/parse-options.js';
10
- import { SeamHttpClientSessions } from '../../../../../lib/seam/connect/routes/client-sessions/index.js';
11
- import { SeamHttpRequest } from '../../../../../lib/seam/connect/seam-http-request.js';
12
- import { SeamPaginator } from '../../../../../lib/seam/connect/seam-paginator.js';
13
- export class SeamHttpUnstableAccessMethods {
14
- constructor(apiKeyOrOptions = {}) {
15
- this.ltsVersion = seamApiLtsVersion;
16
- const options = parseOptions(apiKeyOrOptions);
17
- if (!options.isUndocumentedApiEnabled) {
18
- throw new Error('Cannot use undocumented API without isUndocumentedApiEnabled');
19
- }
20
- this.client = 'client' in options ? options.client : createClient(options);
21
- this.defaults = limitToSeamHttpRequestOptions(options);
22
- }
23
- static fromClient(client, options = {}) {
24
- const constructorOptions = { ...options, client };
25
- if (!isSeamHttpOptionsWithClient(constructorOptions)) {
26
- throw new SeamHttpInvalidOptionsError('Missing client');
27
- }
28
- return new SeamHttpUnstableAccessMethods(constructorOptions);
29
- }
30
- static fromApiKey(apiKey, options = {}) {
31
- const constructorOptions = { ...options, apiKey };
32
- if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
33
- throw new SeamHttpInvalidOptionsError('Missing apiKey');
34
- }
35
- return new SeamHttpUnstableAccessMethods(constructorOptions);
36
- }
37
- static fromClientSessionToken(clientSessionToken, options = {}) {
38
- const constructorOptions = { ...options, clientSessionToken };
39
- if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
40
- throw new SeamHttpInvalidOptionsError('Missing clientSessionToken');
41
- }
42
- return new SeamHttpUnstableAccessMethods(constructorOptions);
43
- }
44
- static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
45
- warnOnInsecureuserIdentifierKey(userIdentifierKey);
46
- const clientOptions = parseOptions({ ...options, publishableKey });
47
- if (isSeamHttpOptionsWithClient(clientOptions)) {
48
- throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttpUnstableAccessMethods.fromPublishableKey');
49
- }
50
- const client = createClient(clientOptions);
51
- const clientSessions = SeamHttpClientSessions.fromClient(client);
52
- const { token } = await clientSessions.getOrCreate({
53
- user_identifier_key: userIdentifierKey,
54
- });
55
- return SeamHttpUnstableAccessMethods.fromClientSessionToken(token, options);
56
- }
57
- static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
58
- const constructorOptions = { ...options, consoleSessionToken, workspaceId };
59
- if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
60
- throw new SeamHttpInvalidOptionsError('Missing consoleSessionToken or workspaceId');
61
- }
62
- return new SeamHttpUnstableAccessMethods(constructorOptions);
63
- }
64
- static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
65
- const constructorOptions = { ...options, personalAccessToken, workspaceId };
66
- if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
67
- throw new SeamHttpInvalidOptionsError('Missing personalAccessToken or workspaceId');
68
- }
69
- return new SeamHttpUnstableAccessMethods(constructorOptions);
70
- }
71
- createPaginator(request) {
72
- return new SeamPaginator(this, request);
73
- }
74
- async updateClientSessionToken(clientSessionToken) {
75
- const { headers } = this.client.defaults;
76
- const authHeaders = getAuthHeadersForClientSessionToken({
77
- clientSessionToken,
78
- });
79
- for (const key of Object.keys(authHeaders)) {
80
- if (headers[key] == null) {
81
- throw new Error('Cannot update a clientSessionToken on a client created without a clientSessionToken');
82
- }
83
- }
84
- this.client.defaults.headers = { ...headers, ...authHeaders };
85
- const clientSessions = SeamHttpClientSessions.fromClient(this.client);
86
- await clientSessions.get();
87
- }
88
- delete(parameters, options = {}) {
89
- if (!this.defaults.isUndocumentedApiEnabled) {
90
- throw new Error('Cannot use undocumented API without isUndocumentedApiEnabled');
91
- }
92
- return new SeamHttpRequest(this, {
93
- pathname: '/unstable_access_methods/delete',
94
- method: 'POST',
95
- body: parameters,
96
- responseKey: undefined,
97
- options,
98
- });
99
- }
100
- get(parameters, options = {}) {
101
- if (!this.defaults.isUndocumentedApiEnabled) {
102
- throw new Error('Cannot use undocumented API without isUndocumentedApiEnabled');
103
- }
104
- return new SeamHttpRequest(this, {
105
- pathname: '/unstable_access_methods/get',
106
- method: 'POST',
107
- body: parameters,
108
- responseKey: 'access_method',
109
- options,
110
- });
111
- }
112
- list(parameters, options = {}) {
113
- if (!this.defaults.isUndocumentedApiEnabled) {
114
- throw new Error('Cannot use undocumented API without isUndocumentedApiEnabled');
115
- }
116
- return new SeamHttpRequest(this, {
117
- pathname: '/unstable_access_methods/list',
118
- method: 'POST',
119
- body: parameters,
120
- responseKey: 'access_methods',
121
- options,
122
- });
123
- }
124
- }
125
- SeamHttpUnstableAccessMethods.ltsVersion = seamApiLtsVersion;
126
- //# sourceMappingURL=unstable-access-methods.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unstable-access-methods.js","sourceRoot":"","sources":["../../../../../src/lib/seam/connect/routes/unstable-access-methods/unstable-access-methods.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EACL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAGlE,MAAM,OAAO,6BAA6B;IAMxC,YAAY,kBAA4C,EAAE;QAHjD,eAAU,GAAG,iBAAiB,CAAA;QAIrC,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QAC7C,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAA;QACH,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC1E,IAAI,CAAC,QAAQ,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,CAAC,UAAU,CACf,MAA2C,EAC3C,UAAqD,EAAE;QAEvD,MAAM,kBAAkB,GAAG,EAAE,GAAG,OAAO,E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C,QAAQ,CAAC,wBAAwB,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAA;QACH,CAAC;QACD,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE;YAC/B,QAAQ,EAAE,+BAA+B;YACzC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,gBAAgB;YAC7B,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;;AApLM,wCAAU,GAAG,iBAAiB,AAApB,CAAoB"}
@@ -1,6 +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
- export * from './unstable-access-grants.js'
@@ -1,333 +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 SeamHttpUnstableAccessGrants {
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
- ): SeamHttpUnstableAccessGrants {
60
- const constructorOptions = { ...options, client }
61
- if (!isSeamHttpOptionsWithClient(constructorOptions)) {
62
- throw new SeamHttpInvalidOptionsError('Missing client')
63
- }
64
- return new SeamHttpUnstableAccessGrants(constructorOptions)
65
- }
66
-
67
- static fromApiKey(
68
- apiKey: SeamHttpOptionsWithApiKey['apiKey'],
69
- options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
70
- ): SeamHttpUnstableAccessGrants {
71
- const constructorOptions = { ...options, apiKey }
72
- if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
73
- throw new SeamHttpInvalidOptionsError('Missing apiKey')
74
- }
75
- return new SeamHttpUnstableAccessGrants(constructorOptions)
76
- }
77
-
78
- static fromClientSessionToken(
79
- clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
80
- options: Omit<
81
- SeamHttpOptionsWithClientSessionToken,
82
- 'clientSessionToken'
83
- > = {},
84
- ): SeamHttpUnstableAccessGrants {
85
- const constructorOptions = { ...options, clientSessionToken }
86
- if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
87
- throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
88
- }
89
- return new SeamHttpUnstableAccessGrants(constructorOptions)
90
- }
91
-
92
- static async fromPublishableKey(
93
- publishableKey: string,
94
- userIdentifierKey: string,
95
- options: SeamHttpFromPublishableKeyOptions = {},
96
- ): Promise<SeamHttpUnstableAccessGrants> {
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 SeamHttpUnstableAccessGrants.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 SeamHttpUnstableAccessGrants.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
- ): SeamHttpUnstableAccessGrants {
120
- const constructorOptions = { ...options, consoleSessionToken, workspaceId }
121
- if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
122
- throw new SeamHttpInvalidOptionsError(
123
- 'Missing consoleSessionToken or workspaceId',
124
- )
125
- }
126
- return new SeamHttpUnstableAccessGrants(constructorOptions)
127
- }
128
-
129
- static fromPersonalAccessToken(
130
- personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
131
- workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
132
- options: Omit<
133
- SeamHttpOptionsWithPersonalAccessToken,
134
- 'personalAccessToken' | 'workspaceId'
135
- > = {},
136
- ): SeamHttpUnstableAccessGrants {
137
- const constructorOptions = { ...options, personalAccessToken, workspaceId }
138
- if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
139
- throw new SeamHttpInvalidOptionsError(
140
- 'Missing personalAccessToken or workspaceId',
141
- )
142
- }
143
- return new SeamHttpUnstableAccessGrants(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?: UnstableAccessGrantsCreateParameters,
173
- options: UnstableAccessGrantsCreateOptions = {},
174
- ): UnstableAccessGrantsCreateRequest {
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_grants/create',
182
- method: 'POST',
183
- body: parameters,
184
- responseKey: 'access_grant',
185
- options,
186
- })
187
- }
188
-
189
- delete(
190
- parameters?: UnstableAccessGrantsDeleteParameters,
191
- options: UnstableAccessGrantsDeleteOptions = {},
192
- ): UnstableAccessGrantsDeleteRequest {
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_grants/delete',
200
- method: 'POST',
201
- body: parameters,
202
- responseKey: undefined,
203
- options,
204
- })
205
- }
206
-
207
- get(
208
- parameters?: UnstableAccessGrantsGetParameters,
209
- options: UnstableAccessGrantsGetOptions = {},
210
- ): UnstableAccessGrantsGetRequest {
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_grants/get',
218
- method: 'POST',
219
- body: parameters,
220
- responseKey: 'access_grant',
221
- options,
222
- })
223
- }
224
-
225
- list(
226
- parameters?: UnstableAccessGrantsListParameters,
227
- options: UnstableAccessGrantsListOptions = {},
228
- ): UnstableAccessGrantsListRequest {
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: '/unstable_access_grants/list',
236
- method: 'POST',
237
- body: parameters,
238
- responseKey: 'access_grants',
239
- options,
240
- })
241
- }
242
- }
243
-
244
- export type UnstableAccessGrantsCreateParameters =
245
- RouteRequestBody<'/unstable_access_grants/create'>
246
-
247
- /**
248
- * @deprecated Use UnstableAccessGrantsCreateParameters instead.
249
- */
250
- export type UnstableAccessGrantsCreateBody =
251
- UnstableAccessGrantsCreateParameters
252
-
253
- /**
254
- * @deprecated Use UnstableAccessGrantsCreateRequest instead.
255
- */
256
- export type UnstableAccessGrantsCreateResponse = SetNonNullable<
257
- Required<RouteResponse<'/unstable_access_grants/create'>>
258
- >
259
-
260
- export type UnstableAccessGrantsCreateRequest = SeamHttpRequest<
261
- UnstableAccessGrantsCreateResponse,
262
- 'access_grant'
263
- >
264
-
265
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
266
- export interface UnstableAccessGrantsCreateOptions {}
267
-
268
- export type UnstableAccessGrantsDeleteParameters =
269
- RouteRequestBody<'/unstable_access_grants/delete'>
270
-
271
- /**
272
- * @deprecated Use UnstableAccessGrantsDeleteParameters instead.
273
- */
274
- export type UnstableAccessGrantsDeleteParams =
275
- UnstableAccessGrantsDeleteParameters
276
-
277
- /**
278
- * @deprecated Use UnstableAccessGrantsDeleteRequest instead.
279
- */
280
- export type UnstableAccessGrantsDeleteResponse = SetNonNullable<
281
- Required<RouteResponse<'/unstable_access_grants/delete'>>
282
- >
283
-
284
- export type UnstableAccessGrantsDeleteRequest = SeamHttpRequest<void, undefined>
285
-
286
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
287
- export interface UnstableAccessGrantsDeleteOptions {}
288
-
289
- export type UnstableAccessGrantsGetParameters =
290
- RouteRequestBody<'/unstable_access_grants/get'>
291
-
292
- /**
293
- * @deprecated Use UnstableAccessGrantsGetParameters instead.
294
- */
295
- export type UnstableAccessGrantsGetParams = UnstableAccessGrantsGetParameters
296
-
297
- /**
298
- * @deprecated Use UnstableAccessGrantsGetRequest instead.
299
- */
300
- export type UnstableAccessGrantsGetResponse = SetNonNullable<
301
- Required<RouteResponse<'/unstable_access_grants/get'>>
302
- >
303
-
304
- export type UnstableAccessGrantsGetRequest = SeamHttpRequest<
305
- UnstableAccessGrantsGetResponse,
306
- 'access_grant'
307
- >
308
-
309
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
310
- export interface UnstableAccessGrantsGetOptions {}
311
-
312
- export type UnstableAccessGrantsListParameters =
313
- RouteRequestBody<'/unstable_access_grants/list'>
314
-
315
- /**
316
- * @deprecated Use UnstableAccessGrantsListParameters instead.
317
- */
318
- export type UnstableAccessGrantsListParams = UnstableAccessGrantsListParameters
319
-
320
- /**
321
- * @deprecated Use UnstableAccessGrantsListRequest instead.
322
- */
323
- export type UnstableAccessGrantsListResponse = SetNonNullable<
324
- Required<RouteResponse<'/unstable_access_grants/list'>>
325
- >
326
-
327
- export type UnstableAccessGrantsListRequest = SeamHttpRequest<
328
- UnstableAccessGrantsListResponse,
329
- 'access_grants'
330
- >
331
-
332
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
333
- export interface UnstableAccessGrantsListOptions {}
@@ -1,6 +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
- export * from './unstable-access-methods.js'