@databricks/sdk-oauth 0.1.0-dev.3 → 0.1.0-dev.5
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/README.md +28 -0
- package/dist/v1/client.d.ts +3 -3
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +44 -34
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/transport.d.ts +30 -2
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +33 -16
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +2 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +9 -5
- package/src/v1/client.ts +0 -522
- package/src/v1/index.ts +0 -30
- package/src/v1/model.ts +0 -481
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/src/v1/client.ts
DELETED
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
-
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
5
|
-
import type {Logger} from '@databricks/sdk-core/logger';
|
|
6
|
-
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
7
|
-
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
8
|
-
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
-
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
10
|
-
import {newHttpClient} from './transport';
|
|
11
|
-
import {
|
|
12
|
-
buildHttpRequest,
|
|
13
|
-
executeCall,
|
|
14
|
-
executeHttpCall,
|
|
15
|
-
marshalRequest,
|
|
16
|
-
parseResponse,
|
|
17
|
-
} from './utils';
|
|
18
|
-
import pkgJson from '../../package.json' with {type: 'json'};
|
|
19
|
-
import type {
|
|
20
|
-
CreateCustomOAuthAppIntegrationRequest,
|
|
21
|
-
CreatePublishedOAuthAppIntegrationRequest,
|
|
22
|
-
CreatePublishedOAuthAppIntegrationResponse,
|
|
23
|
-
CustomOAuthAppIntegration,
|
|
24
|
-
CustomOAuthAppIntegrationSecret,
|
|
25
|
-
DeleteCustomOAuthAppIntegrationRequest,
|
|
26
|
-
DeleteCustomOAuthAppIntegrationResponse,
|
|
27
|
-
DeletePublishedOAuthAppIntegrationRequest,
|
|
28
|
-
DeletePublishedOAuthAppIntegrationResponse,
|
|
29
|
-
GetCustomOAuthAppIntegrationRequest,
|
|
30
|
-
GetPublishedOAuthAppIntegrationRequest,
|
|
31
|
-
ListCustomOAuthAppIntegrationsRequest,
|
|
32
|
-
ListCustomOAuthAppIntegrationsResponse,
|
|
33
|
-
ListPublishedOAuthAppIntegrationsRequest,
|
|
34
|
-
ListPublishedOAuthAppIntegrationsResponse,
|
|
35
|
-
ListPublishedOAuthAppsRequest,
|
|
36
|
-
ListPublishedOAuthAppsResponse,
|
|
37
|
-
PublishedOAuthApp,
|
|
38
|
-
PublishedOAuthAppIntegration,
|
|
39
|
-
UpdateCustomOAuthAppIntegrationRequest,
|
|
40
|
-
UpdateCustomOAuthAppIntegrationResponse,
|
|
41
|
-
UpdatePublishedOAuthAppIntegrationRequest,
|
|
42
|
-
UpdatePublishedOAuthAppIntegrationResponse,
|
|
43
|
-
} from './model';
|
|
44
|
-
import {
|
|
45
|
-
marshalCreateCustomOAuthAppIntegrationRequestSchema,
|
|
46
|
-
marshalCreatePublishedOAuthAppIntegrationRequestSchema,
|
|
47
|
-
marshalUpdateCustomOAuthAppIntegrationRequestSchema,
|
|
48
|
-
marshalUpdatePublishedOAuthAppIntegrationRequestSchema,
|
|
49
|
-
unmarshalCreatePublishedOAuthAppIntegrationResponseSchema,
|
|
50
|
-
unmarshalCustomOAuthAppIntegrationSchema,
|
|
51
|
-
unmarshalCustomOAuthAppIntegrationSecretSchema,
|
|
52
|
-
unmarshalDeleteCustomOAuthAppIntegrationResponseSchema,
|
|
53
|
-
unmarshalDeletePublishedOAuthAppIntegrationResponseSchema,
|
|
54
|
-
unmarshalListCustomOAuthAppIntegrationsResponseSchema,
|
|
55
|
-
unmarshalListPublishedOAuthAppIntegrationsResponseSchema,
|
|
56
|
-
unmarshalListPublishedOAuthAppsResponseSchema,
|
|
57
|
-
unmarshalPublishedOAuthAppIntegrationSchema,
|
|
58
|
-
unmarshalUpdateCustomOAuthAppIntegrationResponseSchema,
|
|
59
|
-
unmarshalUpdatePublishedOAuthAppIntegrationResponseSchema,
|
|
60
|
-
} from './model';
|
|
61
|
-
|
|
62
|
-
// Package identity segment for this client to be used in the User-Agent header.
|
|
63
|
-
const PACKAGE_SEGMENT = {
|
|
64
|
-
key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
|
|
65
|
-
value: pkgJson.version,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export class OAuthClient {
|
|
69
|
-
private readonly host: string;
|
|
70
|
-
// Fallback for endpoints whose path contains {account_id}. If the request
|
|
71
|
-
// already carries an accountId, that value wins.
|
|
72
|
-
private readonly accountId: string | undefined;
|
|
73
|
-
private readonly httpClient: HttpClient;
|
|
74
|
-
private readonly logger: Logger;
|
|
75
|
-
// User-Agent header value. Composed once at construction from
|
|
76
|
-
// createDefault() merged with this package's identity and the active
|
|
77
|
-
// credential's name.
|
|
78
|
-
private readonly userAgent: string;
|
|
79
|
-
|
|
80
|
-
constructor(options: ClientOptions) {
|
|
81
|
-
if (options.host === undefined) {
|
|
82
|
-
throw new Error('Host is required.');
|
|
83
|
-
}
|
|
84
|
-
this.host = options.host.replace(/\/$/, '');
|
|
85
|
-
this.accountId = options.accountId;
|
|
86
|
-
this.logger = options.logger ?? new NoOpLogger();
|
|
87
|
-
const info = createDefault()
|
|
88
|
-
.with(PACKAGE_SEGMENT)
|
|
89
|
-
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
90
|
-
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
91
|
-
this.userAgent = info.toString();
|
|
92
|
-
this.httpClient = newHttpClient(options);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Create Custom OAuth App Integration.
|
|
97
|
-
*
|
|
98
|
-
* You can retrieve the custom OAuth app integration via :method:CustomAppIntegration/get.
|
|
99
|
-
*/
|
|
100
|
-
async createCustomOAuthAppIntegration(
|
|
101
|
-
req: CreateCustomOAuthAppIntegrationRequest,
|
|
102
|
-
options?: CallOptions
|
|
103
|
-
): Promise<CustomOAuthAppIntegrationSecret> {
|
|
104
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/custom-app-integrations`;
|
|
105
|
-
const body = marshalRequest(
|
|
106
|
-
req,
|
|
107
|
-
marshalCreateCustomOAuthAppIntegrationRequestSchema
|
|
108
|
-
);
|
|
109
|
-
let resp: CustomOAuthAppIntegrationSecret | undefined;
|
|
110
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
111
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
112
|
-
headers.set('User-Agent', this.userAgent);
|
|
113
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
114
|
-
const respBody = await executeHttpCall({
|
|
115
|
-
request: httpReq,
|
|
116
|
-
httpClient: this.httpClient,
|
|
117
|
-
logger: this.logger,
|
|
118
|
-
});
|
|
119
|
-
resp = parseResponse(
|
|
120
|
-
respBody,
|
|
121
|
-
unmarshalCustomOAuthAppIntegrationSecretSchema
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
await executeCall(call, options);
|
|
125
|
-
if (resp === undefined) {
|
|
126
|
-
throw new Error('operation completed without a result.');
|
|
127
|
-
}
|
|
128
|
-
return resp;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Create Published OAuth App Integration.
|
|
133
|
-
*
|
|
134
|
-
* You can retrieve the published OAuth app integration via :method:PublishedAppIntegration/get.
|
|
135
|
-
*/
|
|
136
|
-
async createPublishedOAuthAppIntegration(
|
|
137
|
-
req: CreatePublishedOAuthAppIntegrationRequest,
|
|
138
|
-
options?: CallOptions
|
|
139
|
-
): Promise<CreatePublishedOAuthAppIntegrationResponse> {
|
|
140
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/published-app-integrations`;
|
|
141
|
-
const body = marshalRequest(
|
|
142
|
-
req,
|
|
143
|
-
marshalCreatePublishedOAuthAppIntegrationRequestSchema
|
|
144
|
-
);
|
|
145
|
-
let resp: CreatePublishedOAuthAppIntegrationResponse | undefined;
|
|
146
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
147
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
148
|
-
headers.set('User-Agent', this.userAgent);
|
|
149
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
150
|
-
const respBody = await executeHttpCall({
|
|
151
|
-
request: httpReq,
|
|
152
|
-
httpClient: this.httpClient,
|
|
153
|
-
logger: this.logger,
|
|
154
|
-
});
|
|
155
|
-
resp = parseResponse(
|
|
156
|
-
respBody,
|
|
157
|
-
unmarshalCreatePublishedOAuthAppIntegrationResponseSchema
|
|
158
|
-
);
|
|
159
|
-
};
|
|
160
|
-
await executeCall(call, options);
|
|
161
|
-
if (resp === undefined) {
|
|
162
|
-
throw new Error('operation completed without a result.');
|
|
163
|
-
}
|
|
164
|
-
return resp;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Delete an existing Custom OAuth App Integration.
|
|
169
|
-
* You can retrieve the custom OAuth app integration via :method:CustomAppIntegration/get.
|
|
170
|
-
*/
|
|
171
|
-
async deleteCustomOAuthAppIntegration(
|
|
172
|
-
req: DeleteCustomOAuthAppIntegrationRequest,
|
|
173
|
-
options?: CallOptions
|
|
174
|
-
): Promise<DeleteCustomOAuthAppIntegrationResponse> {
|
|
175
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/custom-app-integrations/${req.integrationId ?? ''}`;
|
|
176
|
-
let resp: DeleteCustomOAuthAppIntegrationResponse | undefined;
|
|
177
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
178
|
-
const headers = new Headers();
|
|
179
|
-
headers.set('User-Agent', this.userAgent);
|
|
180
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
181
|
-
const respBody = await executeHttpCall({
|
|
182
|
-
request: httpReq,
|
|
183
|
-
httpClient: this.httpClient,
|
|
184
|
-
logger: this.logger,
|
|
185
|
-
});
|
|
186
|
-
resp = parseResponse(
|
|
187
|
-
respBody,
|
|
188
|
-
unmarshalDeleteCustomOAuthAppIntegrationResponseSchema
|
|
189
|
-
);
|
|
190
|
-
};
|
|
191
|
-
await executeCall(call, options);
|
|
192
|
-
if (resp === undefined) {
|
|
193
|
-
throw new Error('operation completed without a result.');
|
|
194
|
-
}
|
|
195
|
-
return resp;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Delete an existing Published OAuth App Integration.
|
|
200
|
-
* You can retrieve the published OAuth app integration via :method:PublishedAppIntegration/get.
|
|
201
|
-
*/
|
|
202
|
-
async deletePublishedOAuthAppIntegration(
|
|
203
|
-
req: DeletePublishedOAuthAppIntegrationRequest,
|
|
204
|
-
options?: CallOptions
|
|
205
|
-
): Promise<DeletePublishedOAuthAppIntegrationResponse> {
|
|
206
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/published-app-integrations/${req.integrationId ?? ''}`;
|
|
207
|
-
let resp: DeletePublishedOAuthAppIntegrationResponse | undefined;
|
|
208
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
209
|
-
const headers = new Headers();
|
|
210
|
-
headers.set('User-Agent', this.userAgent);
|
|
211
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
212
|
-
const respBody = await executeHttpCall({
|
|
213
|
-
request: httpReq,
|
|
214
|
-
httpClient: this.httpClient,
|
|
215
|
-
logger: this.logger,
|
|
216
|
-
});
|
|
217
|
-
resp = parseResponse(
|
|
218
|
-
respBody,
|
|
219
|
-
unmarshalDeletePublishedOAuthAppIntegrationResponseSchema
|
|
220
|
-
);
|
|
221
|
-
};
|
|
222
|
-
await executeCall(call, options);
|
|
223
|
-
if (resp === undefined) {
|
|
224
|
-
throw new Error('operation completed without a result.');
|
|
225
|
-
}
|
|
226
|
-
return resp;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/** Gets the Custom OAuth App Integration for the given integration id. */
|
|
230
|
-
async getCustomOAuthAppIntegration(
|
|
231
|
-
req: GetCustomOAuthAppIntegrationRequest,
|
|
232
|
-
options?: CallOptions
|
|
233
|
-
): Promise<CustomOAuthAppIntegration> {
|
|
234
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/custom-app-integrations/${req.integrationId ?? ''}`;
|
|
235
|
-
let resp: CustomOAuthAppIntegration | undefined;
|
|
236
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
237
|
-
const headers = new Headers();
|
|
238
|
-
headers.set('User-Agent', this.userAgent);
|
|
239
|
-
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
240
|
-
const respBody = await executeHttpCall({
|
|
241
|
-
request: httpReq,
|
|
242
|
-
httpClient: this.httpClient,
|
|
243
|
-
logger: this.logger,
|
|
244
|
-
});
|
|
245
|
-
resp = parseResponse(respBody, unmarshalCustomOAuthAppIntegrationSchema);
|
|
246
|
-
};
|
|
247
|
-
await executeCall(call, options);
|
|
248
|
-
if (resp === undefined) {
|
|
249
|
-
throw new Error('operation completed without a result.');
|
|
250
|
-
}
|
|
251
|
-
return resp;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/** Gets the Published OAuth App Integration for the given integration id. */
|
|
255
|
-
async getPublishedOAuthAppIntegration(
|
|
256
|
-
req: GetPublishedOAuthAppIntegrationRequest,
|
|
257
|
-
options?: CallOptions
|
|
258
|
-
): Promise<PublishedOAuthAppIntegration> {
|
|
259
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/published-app-integrations/${req.integrationId ?? ''}`;
|
|
260
|
-
let resp: PublishedOAuthAppIntegration | undefined;
|
|
261
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
262
|
-
const headers = new Headers();
|
|
263
|
-
headers.set('User-Agent', this.userAgent);
|
|
264
|
-
const httpReq = buildHttpRequest('GET', url, headers, callSignal);
|
|
265
|
-
const respBody = await executeHttpCall({
|
|
266
|
-
request: httpReq,
|
|
267
|
-
httpClient: this.httpClient,
|
|
268
|
-
logger: this.logger,
|
|
269
|
-
});
|
|
270
|
-
resp = parseResponse(
|
|
271
|
-
respBody,
|
|
272
|
-
unmarshalPublishedOAuthAppIntegrationSchema
|
|
273
|
-
);
|
|
274
|
-
};
|
|
275
|
-
await executeCall(call, options);
|
|
276
|
-
if (resp === undefined) {
|
|
277
|
-
throw new Error('operation completed without a result.');
|
|
278
|
-
}
|
|
279
|
-
return resp;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/** Get the list of custom OAuth app integrations for the specified <Account> */
|
|
283
|
-
async listCustomOAuthAppIntegrations(
|
|
284
|
-
req: ListCustomOAuthAppIntegrationsRequest,
|
|
285
|
-
options?: CallOptions
|
|
286
|
-
): Promise<ListCustomOAuthAppIntegrationsResponse> {
|
|
287
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/custom-app-integrations`;
|
|
288
|
-
const params = new URLSearchParams();
|
|
289
|
-
if (req.pageToken !== undefined) {
|
|
290
|
-
params.append('page_token', req.pageToken);
|
|
291
|
-
}
|
|
292
|
-
if (req.pageSize !== undefined) {
|
|
293
|
-
params.append('page_size', String(req.pageSize));
|
|
294
|
-
}
|
|
295
|
-
if (req.includeCreatorUsername !== undefined) {
|
|
296
|
-
params.append(
|
|
297
|
-
'include_creator_username',
|
|
298
|
-
String(req.includeCreatorUsername)
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
const query = params.toString();
|
|
302
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
303
|
-
let resp: ListCustomOAuthAppIntegrationsResponse | undefined;
|
|
304
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
305
|
-
const headers = new Headers();
|
|
306
|
-
headers.set('User-Agent', this.userAgent);
|
|
307
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
308
|
-
const respBody = await executeHttpCall({
|
|
309
|
-
request: httpReq,
|
|
310
|
-
httpClient: this.httpClient,
|
|
311
|
-
logger: this.logger,
|
|
312
|
-
});
|
|
313
|
-
resp = parseResponse(
|
|
314
|
-
respBody,
|
|
315
|
-
unmarshalListCustomOAuthAppIntegrationsResponseSchema
|
|
316
|
-
);
|
|
317
|
-
};
|
|
318
|
-
await executeCall(call, options);
|
|
319
|
-
if (resp === undefined) {
|
|
320
|
-
throw new Error('operation completed without a result.');
|
|
321
|
-
}
|
|
322
|
-
return resp;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
async *listCustomOAuthAppIntegrationsIter(
|
|
326
|
-
req: ListCustomOAuthAppIntegrationsRequest,
|
|
327
|
-
options?: CallOptions
|
|
328
|
-
): AsyncGenerator<CustomOAuthAppIntegration> {
|
|
329
|
-
const pageReq: ListCustomOAuthAppIntegrationsRequest = {...req};
|
|
330
|
-
for (;;) {
|
|
331
|
-
const resp = await this.listCustomOAuthAppIntegrations(pageReq, options);
|
|
332
|
-
for (const item of resp.apps ?? []) {
|
|
333
|
-
yield item;
|
|
334
|
-
}
|
|
335
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/** Get the list of published OAuth app integrations for the specified <Account> */
|
|
343
|
-
async listPublishedOAuthAppIntegrations(
|
|
344
|
-
req: ListPublishedOAuthAppIntegrationsRequest,
|
|
345
|
-
options?: CallOptions
|
|
346
|
-
): Promise<ListPublishedOAuthAppIntegrationsResponse> {
|
|
347
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/published-app-integrations`;
|
|
348
|
-
const params = new URLSearchParams();
|
|
349
|
-
if (req.pageToken !== undefined) {
|
|
350
|
-
params.append('page_token', req.pageToken);
|
|
351
|
-
}
|
|
352
|
-
if (req.pageSize !== undefined) {
|
|
353
|
-
params.append('page_size', String(req.pageSize));
|
|
354
|
-
}
|
|
355
|
-
const query = params.toString();
|
|
356
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
357
|
-
let resp: ListPublishedOAuthAppIntegrationsResponse | undefined;
|
|
358
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
359
|
-
const headers = new Headers();
|
|
360
|
-
headers.set('User-Agent', this.userAgent);
|
|
361
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
362
|
-
const respBody = await executeHttpCall({
|
|
363
|
-
request: httpReq,
|
|
364
|
-
httpClient: this.httpClient,
|
|
365
|
-
logger: this.logger,
|
|
366
|
-
});
|
|
367
|
-
resp = parseResponse(
|
|
368
|
-
respBody,
|
|
369
|
-
unmarshalListPublishedOAuthAppIntegrationsResponseSchema
|
|
370
|
-
);
|
|
371
|
-
};
|
|
372
|
-
await executeCall(call, options);
|
|
373
|
-
if (resp === undefined) {
|
|
374
|
-
throw new Error('operation completed without a result.');
|
|
375
|
-
}
|
|
376
|
-
return resp;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
async *listPublishedOAuthAppIntegrationsIter(
|
|
380
|
-
req: ListPublishedOAuthAppIntegrationsRequest,
|
|
381
|
-
options?: CallOptions
|
|
382
|
-
): AsyncGenerator<PublishedOAuthAppIntegration> {
|
|
383
|
-
const pageReq: ListPublishedOAuthAppIntegrationsRequest = {...req};
|
|
384
|
-
for (;;) {
|
|
385
|
-
const resp = await this.listPublishedOAuthAppIntegrations(
|
|
386
|
-
pageReq,
|
|
387
|
-
options
|
|
388
|
-
);
|
|
389
|
-
for (const item of resp.apps ?? []) {
|
|
390
|
-
yield item;
|
|
391
|
-
}
|
|
392
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/** Get all the available published OAuth apps in <Databricks>. */
|
|
400
|
-
async listPublishedOAuthApps(
|
|
401
|
-
req: ListPublishedOAuthAppsRequest,
|
|
402
|
-
options?: CallOptions
|
|
403
|
-
): Promise<ListPublishedOAuthAppsResponse> {
|
|
404
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/published-apps`;
|
|
405
|
-
const params = new URLSearchParams();
|
|
406
|
-
if (req.pageToken !== undefined) {
|
|
407
|
-
params.append('page_token', req.pageToken);
|
|
408
|
-
}
|
|
409
|
-
if (req.pageSize !== undefined) {
|
|
410
|
-
params.append('page_size', String(req.pageSize));
|
|
411
|
-
}
|
|
412
|
-
const query = params.toString();
|
|
413
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
414
|
-
let resp: ListPublishedOAuthAppsResponse | undefined;
|
|
415
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
416
|
-
const headers = new Headers();
|
|
417
|
-
headers.set('User-Agent', this.userAgent);
|
|
418
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
419
|
-
const respBody = await executeHttpCall({
|
|
420
|
-
request: httpReq,
|
|
421
|
-
httpClient: this.httpClient,
|
|
422
|
-
logger: this.logger,
|
|
423
|
-
});
|
|
424
|
-
resp = parseResponse(
|
|
425
|
-
respBody,
|
|
426
|
-
unmarshalListPublishedOAuthAppsResponseSchema
|
|
427
|
-
);
|
|
428
|
-
};
|
|
429
|
-
await executeCall(call, options);
|
|
430
|
-
if (resp === undefined) {
|
|
431
|
-
throw new Error('operation completed without a result.');
|
|
432
|
-
}
|
|
433
|
-
return resp;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
async *listPublishedOAuthAppsIter(
|
|
437
|
-
req: ListPublishedOAuthAppsRequest,
|
|
438
|
-
options?: CallOptions
|
|
439
|
-
): AsyncGenerator<PublishedOAuthApp> {
|
|
440
|
-
const pageReq: ListPublishedOAuthAppsRequest = {...req};
|
|
441
|
-
for (;;) {
|
|
442
|
-
const resp = await this.listPublishedOAuthApps(pageReq, options);
|
|
443
|
-
for (const item of resp.apps ?? []) {
|
|
444
|
-
yield item;
|
|
445
|
-
}
|
|
446
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Updates an existing custom OAuth App Integration.
|
|
455
|
-
* You can retrieve the custom OAuth app integration via :method:CustomAppIntegration/get.
|
|
456
|
-
*/
|
|
457
|
-
async updateCustomOAuthAppIntegration(
|
|
458
|
-
req: UpdateCustomOAuthAppIntegrationRequest,
|
|
459
|
-
options?: CallOptions
|
|
460
|
-
): Promise<UpdateCustomOAuthAppIntegrationResponse> {
|
|
461
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/custom-app-integrations/${req.integrationId ?? ''}`;
|
|
462
|
-
const body = marshalRequest(
|
|
463
|
-
req,
|
|
464
|
-
marshalUpdateCustomOAuthAppIntegrationRequestSchema
|
|
465
|
-
);
|
|
466
|
-
let resp: UpdateCustomOAuthAppIntegrationResponse | undefined;
|
|
467
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
468
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
469
|
-
headers.set('User-Agent', this.userAgent);
|
|
470
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
471
|
-
const respBody = await executeHttpCall({
|
|
472
|
-
request: httpReq,
|
|
473
|
-
httpClient: this.httpClient,
|
|
474
|
-
logger: this.logger,
|
|
475
|
-
});
|
|
476
|
-
resp = parseResponse(
|
|
477
|
-
respBody,
|
|
478
|
-
unmarshalUpdateCustomOAuthAppIntegrationResponseSchema
|
|
479
|
-
);
|
|
480
|
-
};
|
|
481
|
-
await executeCall(call, options);
|
|
482
|
-
if (resp === undefined) {
|
|
483
|
-
throw new Error('operation completed without a result.');
|
|
484
|
-
}
|
|
485
|
-
return resp;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Updates an existing published OAuth App Integration.
|
|
490
|
-
* You can retrieve the published OAuth app integration via :method:PublishedAppIntegration/get.
|
|
491
|
-
*/
|
|
492
|
-
async updatePublishedOAuthAppIntegration(
|
|
493
|
-
req: UpdatePublishedOAuthAppIntegrationRequest,
|
|
494
|
-
options?: CallOptions
|
|
495
|
-
): Promise<UpdatePublishedOAuthAppIntegrationResponse> {
|
|
496
|
-
const url = `${this.host}/api/2.0/accounts/${req.accountId ?? this.accountId ?? ''}/oauth2/published-app-integrations/${req.integrationId ?? ''}`;
|
|
497
|
-
const body = marshalRequest(
|
|
498
|
-
req,
|
|
499
|
-
marshalUpdatePublishedOAuthAppIntegrationRequestSchema
|
|
500
|
-
);
|
|
501
|
-
let resp: UpdatePublishedOAuthAppIntegrationResponse | undefined;
|
|
502
|
-
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
503
|
-
const headers = new Headers({'Content-Type': 'application/json'});
|
|
504
|
-
headers.set('User-Agent', this.userAgent);
|
|
505
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
506
|
-
const respBody = await executeHttpCall({
|
|
507
|
-
request: httpReq,
|
|
508
|
-
httpClient: this.httpClient,
|
|
509
|
-
logger: this.logger,
|
|
510
|
-
});
|
|
511
|
-
resp = parseResponse(
|
|
512
|
-
respBody,
|
|
513
|
-
unmarshalUpdatePublishedOAuthAppIntegrationResponseSchema
|
|
514
|
-
);
|
|
515
|
-
};
|
|
516
|
-
await executeCall(call, options);
|
|
517
|
-
if (resp === undefined) {
|
|
518
|
-
throw new Error('operation completed without a result.');
|
|
519
|
-
}
|
|
520
|
-
return resp;
|
|
521
|
-
}
|
|
522
|
-
}
|
package/src/v1/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
export {OAuthClient} from './client';
|
|
4
|
-
|
|
5
|
-
export type {
|
|
6
|
-
CreateCustomOAuthAppIntegrationRequest,
|
|
7
|
-
CreatePublishedOAuthAppIntegrationRequest,
|
|
8
|
-
CreatePublishedOAuthAppIntegrationResponse,
|
|
9
|
-
CustomOAuthAppIntegration,
|
|
10
|
-
CustomOAuthAppIntegrationSecret,
|
|
11
|
-
DeleteCustomOAuthAppIntegrationRequest,
|
|
12
|
-
DeleteCustomOAuthAppIntegrationResponse,
|
|
13
|
-
DeletePublishedOAuthAppIntegrationRequest,
|
|
14
|
-
DeletePublishedOAuthAppIntegrationResponse,
|
|
15
|
-
GetCustomOAuthAppIntegrationRequest,
|
|
16
|
-
GetPublishedOAuthAppIntegrationRequest,
|
|
17
|
-
ListCustomOAuthAppIntegrationsRequest,
|
|
18
|
-
ListCustomOAuthAppIntegrationsResponse,
|
|
19
|
-
ListPublishedOAuthAppIntegrationsRequest,
|
|
20
|
-
ListPublishedOAuthAppIntegrationsResponse,
|
|
21
|
-
ListPublishedOAuthAppsRequest,
|
|
22
|
-
ListPublishedOAuthAppsResponse,
|
|
23
|
-
PublishedOAuthApp,
|
|
24
|
-
PublishedOAuthAppIntegration,
|
|
25
|
-
TokenAccessPolicy,
|
|
26
|
-
UpdateCustomOAuthAppIntegrationRequest,
|
|
27
|
-
UpdateCustomOAuthAppIntegrationResponse,
|
|
28
|
-
UpdatePublishedOAuthAppIntegrationRequest,
|
|
29
|
-
UpdatePublishedOAuthAppIntegrationResponse,
|
|
30
|
-
} from './model';
|