@databricks/sdk-marketplaces 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/src/v1/client.ts DELETED
@@ -1,2253 +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
- flattenQueryParams,
18
- } from './utils';
19
- import pkgJson from '../../package.json' with {type: 'json'};
20
- import type {
21
- AddExchangeForListingRequest,
22
- AddExchangeForListingResponse,
23
- BatchGetListingsRequest,
24
- BatchGetListingsResponse,
25
- BatchGetProvidersRequest,
26
- BatchGetProvidersResponse,
27
- CreateExchangeFilterRequest,
28
- CreateExchangeFilterResponse,
29
- CreateExchangeRequest,
30
- CreateExchangeResponse,
31
- CreateFileRequest,
32
- CreateFileResponse,
33
- CreateInstallationResponse,
34
- CreateListingRequest,
35
- CreateListingResponse,
36
- CreatePersonalizationRequest,
37
- CreatePersonalizationResponse,
38
- CreateProviderAnalyticsDashboardRequest,
39
- CreateProviderAnalyticsDashboardResponse,
40
- CreateProviderRequest,
41
- CreateProviderResponse,
42
- DeleteExchangeFilterRequest,
43
- DeleteExchangeFilterResponse,
44
- DeleteExchangeRequest,
45
- DeleteExchangeResponse,
46
- DeleteFileRequest,
47
- DeleteFileResponse,
48
- DeleteInstallationResponse,
49
- DeleteListingRequest,
50
- DeleteListingResponse,
51
- DeleteProviderRequest,
52
- DeleteProviderResponse,
53
- Exchange,
54
- ExchangeFilter,
55
- ExchangeListing,
56
- FileInfo,
57
- GetAllPersonalizationRequestsForConsumerResponse,
58
- GetExchangeRequest,
59
- GetExchangeResponse,
60
- GetFileRequest,
61
- GetFileResponse,
62
- GetInstallationDetails,
63
- GetLatestVersionProviderAnalyticsDashboardRequest,
64
- GetLatestVersionProviderAnalyticsDashboardResponse,
65
- GetListingContent,
66
- GetListingContentMetadataResponse,
67
- GetListingRequest,
68
- GetListingResponse,
69
- GetListingsResponse,
70
- GetPersonalizationRequestsForConsumer,
71
- GetPersonalizationRequestsForConsumerResponse,
72
- GetPersonalizationRequestsForProviderRequest,
73
- GetPersonalizationRequestsForProviderResponse,
74
- GetProviderRequest,
75
- GetProviderResponse,
76
- GetPublishedListingForConsumer,
77
- GetPublishedListingForConsumerResponse,
78
- GetPublishedListingsForConsumerResponse,
79
- GetPublishedProviderForConsumer,
80
- GetPublishedProviderForConsumerResponse,
81
- InstallListing,
82
- InstallationDetail,
83
- ListAllInstallationsResponse,
84
- ListExchangeFiltersRequest,
85
- ListExchangeFiltersResponse,
86
- ListExchangesForListingRequest,
87
- ListExchangesForListingResponse,
88
- ListExchangesRequest,
89
- ListExchangesResponse,
90
- ListFilesRequest,
91
- ListFilesResponse,
92
- ListFulfillmentsResponse,
93
- ListInstallationsRequest,
94
- ListInstallationsResponse,
95
- ListListingFulfillmentsRequest,
96
- ListListingsForExchangeRequest,
97
- ListListingsForExchangeResponse,
98
- ListListingsRequest,
99
- ListPersonalizationRequestsForConsumerRequest,
100
- ListProviderAnalyticsDashboardRequest,
101
- ListProviderAnalyticsDashboardResponse,
102
- ListProvidersRequest,
103
- ListProvidersResponse,
104
- ListPublishedListingsForConsumerRequest,
105
- ListPublishedProvidersForConsumer,
106
- ListPublishedProvidersForConsumerResponse,
107
- Listing,
108
- ListingFulfillment,
109
- PersonalizationRequest,
110
- ProviderInfo,
111
- RemoveExchangeForListingRequest,
112
- RemoveExchangeForListingResponse,
113
- SearchPublishedListingsForConsumer,
114
- SearchPublishedListingsForConsumerResponse,
115
- SharedDataObject,
116
- UninstallListing,
117
- UpdateExchangeFilterRequest,
118
- UpdateExchangeFilterResponse,
119
- UpdateExchangeRequest,
120
- UpdateExchangeResponse,
121
- UpdateInstallationDetail,
122
- UpdateInstallationResponse,
123
- UpdateListingRequest,
124
- UpdateListingResponse,
125
- UpdatePersonalizationRequestStatusRequest,
126
- UpdatePersonalizationRequestStatusResponse,
127
- UpdateProviderAnalyticsDashboardRequest,
128
- UpdateProviderAnalyticsDashboardResponse,
129
- UpdateProviderRequest,
130
- UpdateProviderResponse,
131
- } from './model';
132
- import {
133
- marshalAddExchangeForListingRequestSchema,
134
- marshalCreateExchangeFilterRequestSchema,
135
- marshalCreateExchangeRequestSchema,
136
- marshalCreateFileRequestSchema,
137
- marshalCreateListingRequestSchema,
138
- marshalCreatePersonalizationRequestSchema,
139
- marshalCreateProviderAnalyticsDashboardRequestSchema,
140
- marshalCreateProviderRequestSchema,
141
- marshalFileParentSchema,
142
- marshalInstallListingSchema,
143
- marshalListingTagSchema,
144
- marshalUpdateExchangeFilterRequestSchema,
145
- marshalUpdateExchangeRequestSchema,
146
- marshalUpdateInstallationDetailSchema,
147
- marshalUpdateListingRequestSchema,
148
- marshalUpdatePersonalizationRequestStatusRequestSchema,
149
- marshalUpdateProviderAnalyticsDashboardRequestSchema,
150
- marshalUpdateProviderRequestSchema,
151
- unmarshalAddExchangeForListingResponseSchema,
152
- unmarshalBatchGetListingsResponseSchema,
153
- unmarshalBatchGetProvidersResponseSchema,
154
- unmarshalCreateExchangeFilterResponseSchema,
155
- unmarshalCreateExchangeResponseSchema,
156
- unmarshalCreateFileResponseSchema,
157
- unmarshalCreateInstallationResponseSchema,
158
- unmarshalCreateListingResponseSchema,
159
- unmarshalCreatePersonalizationResponseSchema,
160
- unmarshalCreateProviderAnalyticsDashboardResponseSchema,
161
- unmarshalCreateProviderResponseSchema,
162
- unmarshalDeleteExchangeFilterResponseSchema,
163
- unmarshalDeleteExchangeResponseSchema,
164
- unmarshalDeleteFileResponseSchema,
165
- unmarshalDeleteInstallationResponseSchema,
166
- unmarshalDeleteListingResponseSchema,
167
- unmarshalDeleteProviderResponseSchema,
168
- unmarshalGetAllPersonalizationRequestsForConsumerResponseSchema,
169
- unmarshalGetExchangeResponseSchema,
170
- unmarshalGetFileResponseSchema,
171
- unmarshalGetLatestVersionProviderAnalyticsDashboardResponseSchema,
172
- unmarshalGetListingContentMetadataResponseSchema,
173
- unmarshalGetListingResponseSchema,
174
- unmarshalGetListingsResponseSchema,
175
- unmarshalGetPersonalizationRequestsForConsumerResponseSchema,
176
- unmarshalGetPersonalizationRequestsForProviderResponseSchema,
177
- unmarshalGetProviderResponseSchema,
178
- unmarshalGetPublishedListingForConsumerResponseSchema,
179
- unmarshalGetPublishedListingsForConsumerResponseSchema,
180
- unmarshalGetPublishedProviderForConsumerResponseSchema,
181
- unmarshalListAllInstallationsResponseSchema,
182
- unmarshalListExchangeFiltersResponseSchema,
183
- unmarshalListExchangesForListingResponseSchema,
184
- unmarshalListExchangesResponseSchema,
185
- unmarshalListFilesResponseSchema,
186
- unmarshalListFulfillmentsResponseSchema,
187
- unmarshalListInstallationsResponseSchema,
188
- unmarshalListListingsForExchangeResponseSchema,
189
- unmarshalListProviderAnalyticsDashboardResponseSchema,
190
- unmarshalListProvidersResponseSchema,
191
- unmarshalListPublishedProvidersForConsumerResponseSchema,
192
- unmarshalRemoveExchangeForListingResponseSchema,
193
- unmarshalSearchPublishedListingsForConsumerResponseSchema,
194
- unmarshalUpdateExchangeFilterResponseSchema,
195
- unmarshalUpdateExchangeResponseSchema,
196
- unmarshalUpdateInstallationResponseSchema,
197
- unmarshalUpdateListingResponseSchema,
198
- unmarshalUpdatePersonalizationRequestStatusResponseSchema,
199
- unmarshalUpdateProviderAnalyticsDashboardResponseSchema,
200
- unmarshalUpdateProviderResponseSchema,
201
- } from './model';
202
-
203
- // Package identity segment for this client to be used in the User-Agent header.
204
- const PACKAGE_SEGMENT = {
205
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
206
- value: pkgJson.version,
207
- };
208
-
209
- export class MarketplacesClient {
210
- private readonly host: string;
211
- // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
212
- // When set, workspace-level methods send X-Databricks-Org-Id on every
213
- // request.
214
- private readonly workspaceId: string | undefined;
215
- private readonly httpClient: HttpClient;
216
- private readonly logger: Logger;
217
- // User-Agent header value. Composed once at construction from
218
- // createDefault() merged with this package's identity and the active
219
- // credential's name.
220
- private readonly userAgent: string;
221
-
222
- constructor(options: ClientOptions) {
223
- if (options.host === undefined) {
224
- throw new Error('Host is required.');
225
- }
226
- this.host = options.host.replace(/\/$/, '');
227
- this.workspaceId = options.workspaceId;
228
- this.logger = options.logger ?? new NoOpLogger();
229
- const info = createDefault()
230
- .with(PACKAGE_SEGMENT)
231
- .with({key: 'sdk-js-auth', value: AUTH_VERSION})
232
- .with({key: 'auth', value: options.credentials?.name() ?? 'default'});
233
- this.userAgent = info.toString();
234
- this.httpClient = newHttpClient(options);
235
- }
236
-
237
- /** Batch get a published listing in the Databricks Marketplace that the consumer has access to. */
238
- async batchGetListings(
239
- req: BatchGetListingsRequest,
240
- options?: CallOptions
241
- ): Promise<BatchGetListingsResponse> {
242
- const url = `${this.host}/api/2.1/marketplace-consumer/listings:batchGet`;
243
- const params = new URLSearchParams();
244
- if (req.ids !== undefined) {
245
- params.append('ids', String(req.ids));
246
- }
247
- const query = params.toString();
248
- const fullUrl = query !== '' ? `${url}?${query}` : url;
249
- let resp: BatchGetListingsResponse | undefined;
250
- const call = async (callSignal?: AbortSignal): Promise<void> => {
251
- const headers = new Headers();
252
- if (this.workspaceId !== undefined) {
253
- headers.set('X-Databricks-Org-Id', this.workspaceId);
254
- }
255
- headers.set('User-Agent', this.userAgent);
256
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
257
- const respBody = await executeHttpCall({
258
- request: httpReq,
259
- httpClient: this.httpClient,
260
- logger: this.logger,
261
- });
262
- resp = parseResponse(respBody, unmarshalBatchGetListingsResponseSchema);
263
- };
264
- await executeCall(call, options);
265
- if (resp === undefined) {
266
- throw new Error('operation completed without a result.');
267
- }
268
- return resp;
269
- }
270
-
271
- /** Batch get a provider in the Databricks Marketplace with at least one visible listing. */
272
- async batchGetProviders(
273
- req: BatchGetProvidersRequest,
274
- options?: CallOptions
275
- ): Promise<BatchGetProvidersResponse> {
276
- const url = `${this.host}/api/2.1/marketplace-consumer/providers:batchGet`;
277
- const params = new URLSearchParams();
278
- if (req.ids !== undefined) {
279
- params.append('ids', String(req.ids));
280
- }
281
- const query = params.toString();
282
- const fullUrl = query !== '' ? `${url}?${query}` : url;
283
- let resp: BatchGetProvidersResponse | undefined;
284
- const call = async (callSignal?: AbortSignal): Promise<void> => {
285
- const headers = new Headers();
286
- if (this.workspaceId !== undefined) {
287
- headers.set('X-Databricks-Org-Id', this.workspaceId);
288
- }
289
- headers.set('User-Agent', this.userAgent);
290
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
291
- const respBody = await executeHttpCall({
292
- request: httpReq,
293
- httpClient: this.httpClient,
294
- logger: this.logger,
295
- });
296
- resp = parseResponse(respBody, unmarshalBatchGetProvidersResponseSchema);
297
- };
298
- await executeCall(call, options);
299
- if (resp === undefined) {
300
- throw new Error('operation completed without a result.');
301
- }
302
- return resp;
303
- }
304
-
305
- /** Create a personalization request for a listing. */
306
- async createPersonalizationRequest(
307
- req: CreatePersonalizationRequest,
308
- options?: CallOptions
309
- ): Promise<CreatePersonalizationResponse> {
310
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/personalization-requests`;
311
- const body = marshalRequest(req, marshalCreatePersonalizationRequestSchema);
312
- let resp: CreatePersonalizationResponse | undefined;
313
- const call = async (callSignal?: AbortSignal): Promise<void> => {
314
- const headers = new Headers({'Content-Type': 'application/json'});
315
- if (this.workspaceId !== undefined) {
316
- headers.set('X-Databricks-Org-Id', this.workspaceId);
317
- }
318
- headers.set('User-Agent', this.userAgent);
319
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
320
- const respBody = await executeHttpCall({
321
- request: httpReq,
322
- httpClient: this.httpClient,
323
- logger: this.logger,
324
- });
325
- resp = parseResponse(
326
- respBody,
327
- unmarshalCreatePersonalizationResponseSchema
328
- );
329
- };
330
- await executeCall(call, options);
331
- if (resp === undefined) {
332
- throw new Error('operation completed without a result.');
333
- }
334
- return resp;
335
- }
336
-
337
- /** List all installations for a particular listing. */
338
- async getInstallationDetails(
339
- req: GetInstallationDetails,
340
- options?: CallOptions
341
- ): Promise<ListInstallationsResponse> {
342
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/installations`;
343
- const params = new URLSearchParams();
344
- if (req.pageToken !== undefined) {
345
- params.append('page_token', req.pageToken);
346
- }
347
- if (req.pageSize !== undefined) {
348
- params.append('page_size', String(req.pageSize));
349
- }
350
- const query = params.toString();
351
- const fullUrl = query !== '' ? `${url}?${query}` : url;
352
- let resp: ListInstallationsResponse | undefined;
353
- const call = async (callSignal?: AbortSignal): Promise<void> => {
354
- const headers = new Headers();
355
- if (this.workspaceId !== undefined) {
356
- headers.set('X-Databricks-Org-Id', this.workspaceId);
357
- }
358
- headers.set('User-Agent', this.userAgent);
359
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
360
- const respBody = await executeHttpCall({
361
- request: httpReq,
362
- httpClient: this.httpClient,
363
- logger: this.logger,
364
- });
365
- resp = parseResponse(respBody, unmarshalListInstallationsResponseSchema);
366
- };
367
- await executeCall(call, options);
368
- if (resp === undefined) {
369
- throw new Error('operation completed without a result.');
370
- }
371
- return resp;
372
- }
373
-
374
- async *getInstallationDetailsIter(
375
- req: GetInstallationDetails,
376
- options?: CallOptions
377
- ): AsyncGenerator<InstallationDetail> {
378
- const pageReq: GetInstallationDetails = {...req};
379
- for (;;) {
380
- const resp = await this.getInstallationDetails(pageReq, options);
381
- for (const item of resp.installations ?? []) {
382
- yield item;
383
- }
384
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
385
- return;
386
- }
387
- pageReq.pageToken = resp.nextPageToken;
388
- }
389
- }
390
-
391
- /** Get a high level preview of the metadata of listing installable content. */
392
- async getListingContent(
393
- req: GetListingContent,
394
- options?: CallOptions
395
- ): Promise<GetListingContentMetadataResponse> {
396
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/content`;
397
- const params = new URLSearchParams();
398
- if (req.pageToken !== undefined) {
399
- params.append('page_token', req.pageToken);
400
- }
401
- if (req.pageSize !== undefined) {
402
- params.append('page_size', String(req.pageSize));
403
- }
404
- const query = params.toString();
405
- const fullUrl = query !== '' ? `${url}?${query}` : url;
406
- let resp: GetListingContentMetadataResponse | undefined;
407
- const call = async (callSignal?: AbortSignal): Promise<void> => {
408
- const headers = new Headers();
409
- if (this.workspaceId !== undefined) {
410
- headers.set('X-Databricks-Org-Id', this.workspaceId);
411
- }
412
- headers.set('User-Agent', this.userAgent);
413
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
414
- const respBody = await executeHttpCall({
415
- request: httpReq,
416
- httpClient: this.httpClient,
417
- logger: this.logger,
418
- });
419
- resp = parseResponse(
420
- respBody,
421
- unmarshalGetListingContentMetadataResponseSchema
422
- );
423
- };
424
- await executeCall(call, options);
425
- if (resp === undefined) {
426
- throw new Error('operation completed without a result.');
427
- }
428
- return resp;
429
- }
430
-
431
- async *getListingContentIter(
432
- req: GetListingContent,
433
- options?: CallOptions
434
- ): AsyncGenerator<SharedDataObject> {
435
- const pageReq: GetListingContent = {...req};
436
- for (;;) {
437
- const resp = await this.getListingContent(pageReq, options);
438
- for (const item of resp.sharedDataObjects ?? []) {
439
- yield item;
440
- }
441
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
442
- return;
443
- }
444
- pageReq.pageToken = resp.nextPageToken;
445
- }
446
- }
447
-
448
- /** Get the personalization request for a listing. Each consumer can make at *most* one personalization request for a listing. */
449
- async getPersonalizationRequestsForConsumer(
450
- req: GetPersonalizationRequestsForConsumer,
451
- options?: CallOptions
452
- ): Promise<GetPersonalizationRequestsForConsumerResponse> {
453
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/personalization-requests`;
454
- let resp: GetPersonalizationRequestsForConsumerResponse | undefined;
455
- const call = async (callSignal?: AbortSignal): Promise<void> => {
456
- const headers = new Headers();
457
- if (this.workspaceId !== undefined) {
458
- headers.set('X-Databricks-Org-Id', this.workspaceId);
459
- }
460
- headers.set('User-Agent', this.userAgent);
461
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
462
- const respBody = await executeHttpCall({
463
- request: httpReq,
464
- httpClient: this.httpClient,
465
- logger: this.logger,
466
- });
467
- resp = parseResponse(
468
- respBody,
469
- unmarshalGetPersonalizationRequestsForConsumerResponseSchema
470
- );
471
- };
472
- await executeCall(call, options);
473
- if (resp === undefined) {
474
- throw new Error('operation completed without a result.');
475
- }
476
- return resp;
477
- }
478
-
479
- /** Get a published listing in the Databricks Marketplace that the consumer has access to. */
480
- async getPublishedListingForConsumer(
481
- req: GetPublishedListingForConsumer,
482
- options?: CallOptions
483
- ): Promise<GetPublishedListingForConsumerResponse> {
484
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.id ?? ''}`;
485
- let resp: GetPublishedListingForConsumerResponse | undefined;
486
- const call = async (callSignal?: AbortSignal): Promise<void> => {
487
- const headers = new Headers();
488
- if (this.workspaceId !== undefined) {
489
- headers.set('X-Databricks-Org-Id', this.workspaceId);
490
- }
491
- headers.set('User-Agent', this.userAgent);
492
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
493
- const respBody = await executeHttpCall({
494
- request: httpReq,
495
- httpClient: this.httpClient,
496
- logger: this.logger,
497
- });
498
- resp = parseResponse(
499
- respBody,
500
- unmarshalGetPublishedListingForConsumerResponseSchema
501
- );
502
- };
503
- await executeCall(call, options);
504
- if (resp === undefined) {
505
- throw new Error('operation completed without a result.');
506
- }
507
- return resp;
508
- }
509
-
510
- /** Get a provider in the Databricks Marketplace with at least one visible listing. */
511
- async getPublishedProviderForConsumer(
512
- req: GetPublishedProviderForConsumer,
513
- options?: CallOptions
514
- ): Promise<GetPublishedProviderForConsumerResponse> {
515
- const url = `${this.host}/api/2.0/marketplace-consumer/providers/${req.id ?? ''}`;
516
- let resp: GetPublishedProviderForConsumerResponse | undefined;
517
- const call = async (callSignal?: AbortSignal): Promise<void> => {
518
- const headers = new Headers();
519
- if (this.workspaceId !== undefined) {
520
- headers.set('X-Databricks-Org-Id', this.workspaceId);
521
- }
522
- headers.set('User-Agent', this.userAgent);
523
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
524
- const respBody = await executeHttpCall({
525
- request: httpReq,
526
- httpClient: this.httpClient,
527
- logger: this.logger,
528
- });
529
- resp = parseResponse(
530
- respBody,
531
- unmarshalGetPublishedProviderForConsumerResponseSchema
532
- );
533
- };
534
- await executeCall(call, options);
535
- if (resp === undefined) {
536
- throw new Error('operation completed without a result.');
537
- }
538
- return resp;
539
- }
540
-
541
- /** Install payload associated with a Databricks Marketplace listing. */
542
- async installListing(
543
- req: InstallListing,
544
- options?: CallOptions
545
- ): Promise<CreateInstallationResponse> {
546
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/installations`;
547
- const body = marshalRequest(req, marshalInstallListingSchema);
548
- let resp: CreateInstallationResponse | undefined;
549
- const call = async (callSignal?: AbortSignal): Promise<void> => {
550
- const headers = new Headers({'Content-Type': 'application/json'});
551
- if (this.workspaceId !== undefined) {
552
- headers.set('X-Databricks-Org-Id', this.workspaceId);
553
- }
554
- headers.set('User-Agent', this.userAgent);
555
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
556
- const respBody = await executeHttpCall({
557
- request: httpReq,
558
- httpClient: this.httpClient,
559
- logger: this.logger,
560
- });
561
- resp = parseResponse(respBody, unmarshalCreateInstallationResponseSchema);
562
- };
563
- await executeCall(call, options);
564
- if (resp === undefined) {
565
- throw new Error('operation completed without a result.');
566
- }
567
- return resp;
568
- }
569
-
570
- /** List all installations across all listings. */
571
- async listInstallations(
572
- req: ListInstallationsRequest,
573
- options?: CallOptions
574
- ): Promise<ListAllInstallationsResponse> {
575
- const url = `${this.host}/api/2.0/marketplace-consumer/installations`;
576
- const params = new URLSearchParams();
577
- if (req.pageToken !== undefined) {
578
- params.append('page_token', req.pageToken);
579
- }
580
- if (req.pageSize !== undefined) {
581
- params.append('page_size', String(req.pageSize));
582
- }
583
- const query = params.toString();
584
- const fullUrl = query !== '' ? `${url}?${query}` : url;
585
- let resp: ListAllInstallationsResponse | undefined;
586
- const call = async (callSignal?: AbortSignal): Promise<void> => {
587
- const headers = new Headers();
588
- if (this.workspaceId !== undefined) {
589
- headers.set('X-Databricks-Org-Id', this.workspaceId);
590
- }
591
- headers.set('User-Agent', this.userAgent);
592
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
593
- const respBody = await executeHttpCall({
594
- request: httpReq,
595
- httpClient: this.httpClient,
596
- logger: this.logger,
597
- });
598
- resp = parseResponse(
599
- respBody,
600
- unmarshalListAllInstallationsResponseSchema
601
- );
602
- };
603
- await executeCall(call, options);
604
- if (resp === undefined) {
605
- throw new Error('operation completed without a result.');
606
- }
607
- return resp;
608
- }
609
-
610
- async *listInstallationsIter(
611
- req: ListInstallationsRequest,
612
- options?: CallOptions
613
- ): AsyncGenerator<InstallationDetail> {
614
- const pageReq: ListInstallationsRequest = {...req};
615
- for (;;) {
616
- const resp = await this.listInstallations(pageReq, options);
617
- for (const item of resp.installations ?? []) {
618
- yield item;
619
- }
620
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
621
- return;
622
- }
623
- pageReq.pageToken = resp.nextPageToken;
624
- }
625
- }
626
-
627
- /**
628
- * Get all listings fulfillments associated with a listing. A _fulfillment_ is a potential installation.
629
- * Standard installations contain metadata about the attached share or git repo. Only one of these fields will be present.
630
- * Personalized installations contain metadata about the attached share or git repo, as well as the Delta Sharing recipient type.
631
- */
632
- async listListingFulfillments(
633
- req: ListListingFulfillmentsRequest,
634
- options?: CallOptions
635
- ): Promise<ListFulfillmentsResponse> {
636
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/fulfillments`;
637
- const params = new URLSearchParams();
638
- if (req.pageToken !== undefined) {
639
- params.append('page_token', req.pageToken);
640
- }
641
- if (req.pageSize !== undefined) {
642
- params.append('page_size', String(req.pageSize));
643
- }
644
- const query = params.toString();
645
- const fullUrl = query !== '' ? `${url}?${query}` : url;
646
- let resp: ListFulfillmentsResponse | undefined;
647
- const call = async (callSignal?: AbortSignal): Promise<void> => {
648
- const headers = new Headers();
649
- if (this.workspaceId !== undefined) {
650
- headers.set('X-Databricks-Org-Id', this.workspaceId);
651
- }
652
- headers.set('User-Agent', this.userAgent);
653
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
654
- const respBody = await executeHttpCall({
655
- request: httpReq,
656
- httpClient: this.httpClient,
657
- logger: this.logger,
658
- });
659
- resp = parseResponse(respBody, unmarshalListFulfillmentsResponseSchema);
660
- };
661
- await executeCall(call, options);
662
- if (resp === undefined) {
663
- throw new Error('operation completed without a result.');
664
- }
665
- return resp;
666
- }
667
-
668
- async *listListingFulfillmentsIter(
669
- req: ListListingFulfillmentsRequest,
670
- options?: CallOptions
671
- ): AsyncGenerator<ListingFulfillment> {
672
- const pageReq: ListListingFulfillmentsRequest = {...req};
673
- for (;;) {
674
- const resp = await this.listListingFulfillments(pageReq, options);
675
- for (const item of resp.fulfillments ?? []) {
676
- yield item;
677
- }
678
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
679
- return;
680
- }
681
- pageReq.pageToken = resp.nextPageToken;
682
- }
683
- }
684
-
685
- /** List personalization requests for a consumer across all listings. */
686
- async listPersonalizationRequestsForConsumer(
687
- req: ListPersonalizationRequestsForConsumerRequest,
688
- options?: CallOptions
689
- ): Promise<GetAllPersonalizationRequestsForConsumerResponse> {
690
- const url = `${this.host}/api/2.0/marketplace-consumer/personalization-requests`;
691
- const params = new URLSearchParams();
692
- if (req.pageToken !== undefined) {
693
- params.append('page_token', req.pageToken);
694
- }
695
- if (req.pageSize !== undefined) {
696
- params.append('page_size', String(req.pageSize));
697
- }
698
- const query = params.toString();
699
- const fullUrl = query !== '' ? `${url}?${query}` : url;
700
- let resp: GetAllPersonalizationRequestsForConsumerResponse | undefined;
701
- const call = async (callSignal?: AbortSignal): Promise<void> => {
702
- const headers = new Headers();
703
- if (this.workspaceId !== undefined) {
704
- headers.set('X-Databricks-Org-Id', this.workspaceId);
705
- }
706
- headers.set('User-Agent', this.userAgent);
707
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
708
- const respBody = await executeHttpCall({
709
- request: httpReq,
710
- httpClient: this.httpClient,
711
- logger: this.logger,
712
- });
713
- resp = parseResponse(
714
- respBody,
715
- unmarshalGetAllPersonalizationRequestsForConsumerResponseSchema
716
- );
717
- };
718
- await executeCall(call, options);
719
- if (resp === undefined) {
720
- throw new Error('operation completed without a result.');
721
- }
722
- return resp;
723
- }
724
-
725
- async *listPersonalizationRequestsForConsumerIter(
726
- req: ListPersonalizationRequestsForConsumerRequest,
727
- options?: CallOptions
728
- ): AsyncGenerator<PersonalizationRequest> {
729
- const pageReq: ListPersonalizationRequestsForConsumerRequest = {...req};
730
- for (;;) {
731
- const resp = await this.listPersonalizationRequestsForConsumer(
732
- pageReq,
733
- options
734
- );
735
- for (const item of resp.personalizationRequests ?? []) {
736
- yield item;
737
- }
738
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
739
- return;
740
- }
741
- pageReq.pageToken = resp.nextPageToken;
742
- }
743
- }
744
-
745
- /** List all published listings in the Databricks Marketplace that the consumer has access to. */
746
- async listPublishedListingsForConsumer(
747
- req: ListPublishedListingsForConsumerRequest,
748
- options?: CallOptions
749
- ): Promise<GetPublishedListingsForConsumerResponse> {
750
- const url = `${this.host}/api/2.0/marketplace-consumer/listings`;
751
- const params = new URLSearchParams();
752
- if (req.pageToken !== undefined) {
753
- params.append('page_token', req.pageToken);
754
- }
755
- if (req.pageSize !== undefined) {
756
- params.append('page_size', String(req.pageSize));
757
- }
758
- if (req.assets !== undefined) {
759
- params.append('assets', String(req.assets));
760
- }
761
- if (req.categories !== undefined) {
762
- params.append('categories', String(req.categories));
763
- }
764
- if (req.tags !== undefined) {
765
- flattenQueryParams(
766
- 'tags',
767
- marshalListingTagSchema.parse(req.tags),
768
- params
769
- );
770
- }
771
- if (req.isFree !== undefined) {
772
- params.append('is_free', String(req.isFree));
773
- }
774
- if (req.isPrivateExchange !== undefined) {
775
- params.append('is_private_exchange', String(req.isPrivateExchange));
776
- }
777
- if (req.isStaffPick !== undefined) {
778
- params.append('is_staff_pick', String(req.isStaffPick));
779
- }
780
- if (req.providerIds !== undefined) {
781
- params.append('provider_ids', String(req.providerIds));
782
- }
783
- const query = params.toString();
784
- const fullUrl = query !== '' ? `${url}?${query}` : url;
785
- let resp: GetPublishedListingsForConsumerResponse | undefined;
786
- const call = async (callSignal?: AbortSignal): Promise<void> => {
787
- const headers = new Headers();
788
- if (this.workspaceId !== undefined) {
789
- headers.set('X-Databricks-Org-Id', this.workspaceId);
790
- }
791
- headers.set('User-Agent', this.userAgent);
792
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
793
- const respBody = await executeHttpCall({
794
- request: httpReq,
795
- httpClient: this.httpClient,
796
- logger: this.logger,
797
- });
798
- resp = parseResponse(
799
- respBody,
800
- unmarshalGetPublishedListingsForConsumerResponseSchema
801
- );
802
- };
803
- await executeCall(call, options);
804
- if (resp === undefined) {
805
- throw new Error('operation completed without a result.');
806
- }
807
- return resp;
808
- }
809
-
810
- async *listPublishedListingsForConsumerIter(
811
- req: ListPublishedListingsForConsumerRequest,
812
- options?: CallOptions
813
- ): AsyncGenerator<Listing> {
814
- const pageReq: ListPublishedListingsForConsumerRequest = {...req};
815
- for (;;) {
816
- const resp = await this.listPublishedListingsForConsumer(
817
- pageReq,
818
- options
819
- );
820
- for (const item of resp.listings ?? []) {
821
- yield item;
822
- }
823
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
824
- return;
825
- }
826
- pageReq.pageToken = resp.nextPageToken;
827
- }
828
- }
829
-
830
- /** List all providers in the Databricks Marketplace with at least one visible listing. */
831
- async listPublishedProvidersForConsumer(
832
- req: ListPublishedProvidersForConsumer,
833
- options?: CallOptions
834
- ): Promise<ListPublishedProvidersForConsumerResponse> {
835
- const url = `${this.host}/api/2.0/marketplace-consumer/providers`;
836
- const params = new URLSearchParams();
837
- if (req.pageToken !== undefined) {
838
- params.append('page_token', req.pageToken);
839
- }
840
- if (req.pageSize !== undefined) {
841
- params.append('page_size', String(req.pageSize));
842
- }
843
- if (req.isFeatured !== undefined) {
844
- params.append('is_featured', String(req.isFeatured));
845
- }
846
- const query = params.toString();
847
- const fullUrl = query !== '' ? `${url}?${query}` : url;
848
- let resp: ListPublishedProvidersForConsumerResponse | undefined;
849
- const call = async (callSignal?: AbortSignal): Promise<void> => {
850
- const headers = new Headers();
851
- if (this.workspaceId !== undefined) {
852
- headers.set('X-Databricks-Org-Id', this.workspaceId);
853
- }
854
- headers.set('User-Agent', this.userAgent);
855
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
856
- const respBody = await executeHttpCall({
857
- request: httpReq,
858
- httpClient: this.httpClient,
859
- logger: this.logger,
860
- });
861
- resp = parseResponse(
862
- respBody,
863
- unmarshalListPublishedProvidersForConsumerResponseSchema
864
- );
865
- };
866
- await executeCall(call, options);
867
- if (resp === undefined) {
868
- throw new Error('operation completed without a result.');
869
- }
870
- return resp;
871
- }
872
-
873
- async *listPublishedProvidersForConsumerIter(
874
- req: ListPublishedProvidersForConsumer,
875
- options?: CallOptions
876
- ): AsyncGenerator<ProviderInfo> {
877
- const pageReq: ListPublishedProvidersForConsumer = {...req};
878
- for (;;) {
879
- const resp = await this.listPublishedProvidersForConsumer(
880
- pageReq,
881
- options
882
- );
883
- for (const item of resp.providers ?? []) {
884
- yield item;
885
- }
886
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
887
- return;
888
- }
889
- pageReq.pageToken = resp.nextPageToken;
890
- }
891
- }
892
-
893
- /**
894
- * Search published listings in the Databricks Marketplace that the consumer has access to.
895
- * This query supports a variety of different search parameters and performs fuzzy matching.
896
- */
897
- async searchPublishedListingsForConsumer(
898
- req: SearchPublishedListingsForConsumer,
899
- options?: CallOptions
900
- ): Promise<SearchPublishedListingsForConsumerResponse> {
901
- const url = `${this.host}/api/2.0/marketplace-consumer/search-listings`;
902
- const params = new URLSearchParams();
903
- if (req.query !== undefined) {
904
- params.append('query', req.query);
905
- }
906
- if (req.isFree !== undefined) {
907
- params.append('is_free', String(req.isFree));
908
- }
909
- if (req.isPrivateExchange !== undefined) {
910
- params.append('is_private_exchange', String(req.isPrivateExchange));
911
- }
912
- if (req.providerIds !== undefined) {
913
- params.append('provider_ids', String(req.providerIds));
914
- }
915
- if (req.categories !== undefined) {
916
- params.append('categories', String(req.categories));
917
- }
918
- if (req.assets !== undefined) {
919
- params.append('assets', String(req.assets));
920
- }
921
- if (req.pageToken !== undefined) {
922
- params.append('page_token', req.pageToken);
923
- }
924
- if (req.pageSize !== undefined) {
925
- params.append('page_size', String(req.pageSize));
926
- }
927
- const query = params.toString();
928
- const fullUrl = query !== '' ? `${url}?${query}` : url;
929
- let resp: SearchPublishedListingsForConsumerResponse | undefined;
930
- const call = async (callSignal?: AbortSignal): Promise<void> => {
931
- const headers = new Headers();
932
- if (this.workspaceId !== undefined) {
933
- headers.set('X-Databricks-Org-Id', this.workspaceId);
934
- }
935
- headers.set('User-Agent', this.userAgent);
936
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
937
- const respBody = await executeHttpCall({
938
- request: httpReq,
939
- httpClient: this.httpClient,
940
- logger: this.logger,
941
- });
942
- resp = parseResponse(
943
- respBody,
944
- unmarshalSearchPublishedListingsForConsumerResponseSchema
945
- );
946
- };
947
- await executeCall(call, options);
948
- if (resp === undefined) {
949
- throw new Error('operation completed without a result.');
950
- }
951
- return resp;
952
- }
953
-
954
- async *searchPublishedListingsForConsumerIter(
955
- req: SearchPublishedListingsForConsumer,
956
- options?: CallOptions
957
- ): AsyncGenerator<Listing> {
958
- const pageReq: SearchPublishedListingsForConsumer = {...req};
959
- for (;;) {
960
- const resp = await this.searchPublishedListingsForConsumer(
961
- pageReq,
962
- options
963
- );
964
- for (const item of resp.listings ?? []) {
965
- yield item;
966
- }
967
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
968
- return;
969
- }
970
- pageReq.pageToken = resp.nextPageToken;
971
- }
972
- }
973
-
974
- /** Uninstall an installation associated with a Databricks Marketplace listing. */
975
- async uninstallListing(
976
- req: UninstallListing,
977
- options?: CallOptions
978
- ): Promise<DeleteInstallationResponse> {
979
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/installations/${req.installationId ?? ''}`;
980
- let resp: DeleteInstallationResponse | undefined;
981
- const call = async (callSignal?: AbortSignal): Promise<void> => {
982
- const headers = new Headers();
983
- if (this.workspaceId !== undefined) {
984
- headers.set('X-Databricks-Org-Id', this.workspaceId);
985
- }
986
- headers.set('User-Agent', this.userAgent);
987
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
988
- const respBody = await executeHttpCall({
989
- request: httpReq,
990
- httpClient: this.httpClient,
991
- logger: this.logger,
992
- });
993
- resp = parseResponse(respBody, unmarshalDeleteInstallationResponseSchema);
994
- };
995
- await executeCall(call, options);
996
- if (resp === undefined) {
997
- throw new Error('operation completed without a result.');
998
- }
999
- return resp;
1000
- }
1001
-
1002
- /**
1003
- * This is a update API that will update the part of the fields defined in the installation table as well
1004
- * as interact with external services according to the fields not included in the installation table
1005
- * 1. the token will be rotate if the rotateToken flag is true
1006
- * 2. the token will be forcibly rotate if the rotateToken flag is true and the tokenInfo field is empty
1007
- */
1008
- async updateInstallationDetail(
1009
- req: UpdateInstallationDetail,
1010
- options?: CallOptions
1011
- ): Promise<UpdateInstallationResponse> {
1012
- const url = `${this.host}/api/2.0/marketplace-consumer/listings/${req.listingId ?? ''}/installations/${req.installationId ?? ''}`;
1013
- const body = marshalRequest(req, marshalUpdateInstallationDetailSchema);
1014
- let resp: UpdateInstallationResponse | undefined;
1015
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1016
- const headers = new Headers({'Content-Type': 'application/json'});
1017
- if (this.workspaceId !== undefined) {
1018
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1019
- }
1020
- headers.set('User-Agent', this.userAgent);
1021
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
1022
- const respBody = await executeHttpCall({
1023
- request: httpReq,
1024
- httpClient: this.httpClient,
1025
- logger: this.logger,
1026
- });
1027
- resp = parseResponse(respBody, unmarshalUpdateInstallationResponseSchema);
1028
- };
1029
- await executeCall(call, options);
1030
- if (resp === undefined) {
1031
- throw new Error('operation completed without a result.');
1032
- }
1033
- return resp;
1034
- }
1035
-
1036
- /** Associate an exchange with a listing */
1037
- async addExchangeForListing(
1038
- req: AddExchangeForListingRequest,
1039
- options?: CallOptions
1040
- ): Promise<AddExchangeForListingResponse> {
1041
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges-for-listing`;
1042
- const body = marshalRequest(req, marshalAddExchangeForListingRequestSchema);
1043
- let resp: AddExchangeForListingResponse | undefined;
1044
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1045
- const headers = new Headers({'Content-Type': 'application/json'});
1046
- if (this.workspaceId !== undefined) {
1047
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1048
- }
1049
- headers.set('User-Agent', this.userAgent);
1050
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1051
- const respBody = await executeHttpCall({
1052
- request: httpReq,
1053
- httpClient: this.httpClient,
1054
- logger: this.logger,
1055
- });
1056
- resp = parseResponse(
1057
- respBody,
1058
- unmarshalAddExchangeForListingResponseSchema
1059
- );
1060
- };
1061
- await executeCall(call, options);
1062
- if (resp === undefined) {
1063
- throw new Error('operation completed without a result.');
1064
- }
1065
- return resp;
1066
- }
1067
-
1068
- /** Create an exchange */
1069
- async createExchange(
1070
- req: CreateExchangeRequest,
1071
- options?: CallOptions
1072
- ): Promise<CreateExchangeResponse> {
1073
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges`;
1074
- const body = marshalRequest(req, marshalCreateExchangeRequestSchema);
1075
- let resp: CreateExchangeResponse | undefined;
1076
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1077
- const headers = new Headers({'Content-Type': 'application/json'});
1078
- if (this.workspaceId !== undefined) {
1079
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1080
- }
1081
- headers.set('User-Agent', this.userAgent);
1082
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1083
- const respBody = await executeHttpCall({
1084
- request: httpReq,
1085
- httpClient: this.httpClient,
1086
- logger: this.logger,
1087
- });
1088
- resp = parseResponse(respBody, unmarshalCreateExchangeResponseSchema);
1089
- };
1090
- await executeCall(call, options);
1091
- if (resp === undefined) {
1092
- throw new Error('operation completed without a result.');
1093
- }
1094
- return resp;
1095
- }
1096
-
1097
- /** Add an exchange filter. */
1098
- async createExchangeFilter(
1099
- req: CreateExchangeFilterRequest,
1100
- options?: CallOptions
1101
- ): Promise<CreateExchangeFilterResponse> {
1102
- const url = `${this.host}/api/2.0/marketplace-exchange/filters`;
1103
- const body = marshalRequest(req, marshalCreateExchangeFilterRequestSchema);
1104
- let resp: CreateExchangeFilterResponse | undefined;
1105
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1106
- const headers = new Headers({'Content-Type': 'application/json'});
1107
- if (this.workspaceId !== undefined) {
1108
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1109
- }
1110
- headers.set('User-Agent', this.userAgent);
1111
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1112
- const respBody = await executeHttpCall({
1113
- request: httpReq,
1114
- httpClient: this.httpClient,
1115
- logger: this.logger,
1116
- });
1117
- resp = parseResponse(
1118
- respBody,
1119
- unmarshalCreateExchangeFilterResponseSchema
1120
- );
1121
- };
1122
- await executeCall(call, options);
1123
- if (resp === undefined) {
1124
- throw new Error('operation completed without a result.');
1125
- }
1126
- return resp;
1127
- }
1128
-
1129
- /** Create a file. Currently, only provider icons and attached notebooks are supported. */
1130
- async createFile(
1131
- req: CreateFileRequest,
1132
- options?: CallOptions
1133
- ): Promise<CreateFileResponse> {
1134
- const url = `${this.host}/api/2.0/marketplace-provider/files`;
1135
- const body = marshalRequest(req, marshalCreateFileRequestSchema);
1136
- let resp: CreateFileResponse | undefined;
1137
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1138
- const headers = new Headers({'Content-Type': 'application/json'});
1139
- if (this.workspaceId !== undefined) {
1140
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1141
- }
1142
- headers.set('User-Agent', this.userAgent);
1143
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1144
- const respBody = await executeHttpCall({
1145
- request: httpReq,
1146
- httpClient: this.httpClient,
1147
- logger: this.logger,
1148
- });
1149
- resp = parseResponse(respBody, unmarshalCreateFileResponseSchema);
1150
- };
1151
- await executeCall(call, options);
1152
- if (resp === undefined) {
1153
- throw new Error('operation completed without a result.');
1154
- }
1155
- return resp;
1156
- }
1157
-
1158
- /** Create a new listing */
1159
- async createListing(
1160
- req: CreateListingRequest,
1161
- options?: CallOptions
1162
- ): Promise<CreateListingResponse> {
1163
- const url = `${this.host}/api/2.0/marketplace-provider/listing`;
1164
- const body = marshalRequest(req, marshalCreateListingRequestSchema);
1165
- let resp: CreateListingResponse | undefined;
1166
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1167
- const headers = new Headers({'Content-Type': 'application/json'});
1168
- if (this.workspaceId !== undefined) {
1169
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1170
- }
1171
- headers.set('User-Agent', this.userAgent);
1172
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1173
- const respBody = await executeHttpCall({
1174
- request: httpReq,
1175
- httpClient: this.httpClient,
1176
- logger: this.logger,
1177
- });
1178
- resp = parseResponse(respBody, unmarshalCreateListingResponseSchema);
1179
- };
1180
- await executeCall(call, options);
1181
- if (resp === undefined) {
1182
- throw new Error('operation completed without a result.');
1183
- }
1184
- return resp;
1185
- }
1186
-
1187
- /** Create a provider */
1188
- async createProvider(
1189
- req: CreateProviderRequest,
1190
- options?: CallOptions
1191
- ): Promise<CreateProviderResponse> {
1192
- const url = `${this.host}/api/2.0/marketplace-provider/provider`;
1193
- const body = marshalRequest(req, marshalCreateProviderRequestSchema);
1194
- let resp: CreateProviderResponse | undefined;
1195
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1196
- const headers = new Headers({'Content-Type': 'application/json'});
1197
- if (this.workspaceId !== undefined) {
1198
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1199
- }
1200
- headers.set('User-Agent', this.userAgent);
1201
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1202
- const respBody = await executeHttpCall({
1203
- request: httpReq,
1204
- httpClient: this.httpClient,
1205
- logger: this.logger,
1206
- });
1207
- resp = parseResponse(respBody, unmarshalCreateProviderResponseSchema);
1208
- };
1209
- await executeCall(call, options);
1210
- if (resp === undefined) {
1211
- throw new Error('operation completed without a result.');
1212
- }
1213
- return resp;
1214
- }
1215
-
1216
- /** Create provider analytics dashboard. Returns Marketplace specific `id`. Not to be confused with the Lakeview dashboard id. */
1217
- async createProviderAnalyticsDashboard(
1218
- req: CreateProviderAnalyticsDashboardRequest,
1219
- options?: CallOptions
1220
- ): Promise<CreateProviderAnalyticsDashboardResponse> {
1221
- const url = `${this.host}/api/2.0/marketplace-provider/analytics_dashboard`;
1222
- const body = marshalRequest(
1223
- req,
1224
- marshalCreateProviderAnalyticsDashboardRequestSchema
1225
- );
1226
- let resp: CreateProviderAnalyticsDashboardResponse | undefined;
1227
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1228
- const headers = new Headers({'Content-Type': 'application/json'});
1229
- if (this.workspaceId !== undefined) {
1230
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1231
- }
1232
- headers.set('User-Agent', this.userAgent);
1233
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
1234
- const respBody = await executeHttpCall({
1235
- request: httpReq,
1236
- httpClient: this.httpClient,
1237
- logger: this.logger,
1238
- });
1239
- resp = parseResponse(
1240
- respBody,
1241
- unmarshalCreateProviderAnalyticsDashboardResponseSchema
1242
- );
1243
- };
1244
- await executeCall(call, options);
1245
- if (resp === undefined) {
1246
- throw new Error('operation completed without a result.');
1247
- }
1248
- return resp;
1249
- }
1250
-
1251
- /** This removes a listing from marketplace. */
1252
- async deleteExchange(
1253
- req: DeleteExchangeRequest,
1254
- options?: CallOptions
1255
- ): Promise<DeleteExchangeResponse> {
1256
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges/${req.id ?? ''}`;
1257
- let resp: DeleteExchangeResponse | undefined;
1258
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1259
- const headers = new Headers();
1260
- if (this.workspaceId !== undefined) {
1261
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1262
- }
1263
- headers.set('User-Agent', this.userAgent);
1264
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1265
- const respBody = await executeHttpCall({
1266
- request: httpReq,
1267
- httpClient: this.httpClient,
1268
- logger: this.logger,
1269
- });
1270
- resp = parseResponse(respBody, unmarshalDeleteExchangeResponseSchema);
1271
- };
1272
- await executeCall(call, options);
1273
- if (resp === undefined) {
1274
- throw new Error('operation completed without a result.');
1275
- }
1276
- return resp;
1277
- }
1278
-
1279
- /** Delete an exchange filter */
1280
- async deleteExchangeFilter(
1281
- req: DeleteExchangeFilterRequest,
1282
- options?: CallOptions
1283
- ): Promise<DeleteExchangeFilterResponse> {
1284
- const url = `${this.host}/api/2.0/marketplace-exchange/filters/${req.id ?? ''}`;
1285
- let resp: DeleteExchangeFilterResponse | undefined;
1286
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1287
- const headers = new Headers();
1288
- if (this.workspaceId !== undefined) {
1289
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1290
- }
1291
- headers.set('User-Agent', this.userAgent);
1292
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1293
- const respBody = await executeHttpCall({
1294
- request: httpReq,
1295
- httpClient: this.httpClient,
1296
- logger: this.logger,
1297
- });
1298
- resp = parseResponse(
1299
- respBody,
1300
- unmarshalDeleteExchangeFilterResponseSchema
1301
- );
1302
- };
1303
- await executeCall(call, options);
1304
- if (resp === undefined) {
1305
- throw new Error('operation completed without a result.');
1306
- }
1307
- return resp;
1308
- }
1309
-
1310
- /** Delete a file */
1311
- async deleteFile(
1312
- req: DeleteFileRequest,
1313
- options?: CallOptions
1314
- ): Promise<DeleteFileResponse> {
1315
- const url = `${this.host}/api/2.0/marketplace-provider/files/${req.fileId ?? ''}`;
1316
- let resp: DeleteFileResponse | undefined;
1317
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1318
- const headers = new Headers();
1319
- if (this.workspaceId !== undefined) {
1320
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1321
- }
1322
- headers.set('User-Agent', this.userAgent);
1323
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1324
- const respBody = await executeHttpCall({
1325
- request: httpReq,
1326
- httpClient: this.httpClient,
1327
- logger: this.logger,
1328
- });
1329
- resp = parseResponse(respBody, unmarshalDeleteFileResponseSchema);
1330
- };
1331
- await executeCall(call, options);
1332
- if (resp === undefined) {
1333
- throw new Error('operation completed without a result.');
1334
- }
1335
- return resp;
1336
- }
1337
-
1338
- /** Delete a listing */
1339
- async deleteListing(
1340
- req: DeleteListingRequest,
1341
- options?: CallOptions
1342
- ): Promise<DeleteListingResponse> {
1343
- const url = `${this.host}/api/2.0/marketplace-provider/listings/${req.id ?? ''}`;
1344
- let resp: DeleteListingResponse | undefined;
1345
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1346
- const headers = new Headers();
1347
- if (this.workspaceId !== undefined) {
1348
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1349
- }
1350
- headers.set('User-Agent', this.userAgent);
1351
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1352
- const respBody = await executeHttpCall({
1353
- request: httpReq,
1354
- httpClient: this.httpClient,
1355
- logger: this.logger,
1356
- });
1357
- resp = parseResponse(respBody, unmarshalDeleteListingResponseSchema);
1358
- };
1359
- await executeCall(call, options);
1360
- if (resp === undefined) {
1361
- throw new Error('operation completed without a result.');
1362
- }
1363
- return resp;
1364
- }
1365
-
1366
- /** Delete provider */
1367
- async deleteProvider(
1368
- req: DeleteProviderRequest,
1369
- options?: CallOptions
1370
- ): Promise<DeleteProviderResponse> {
1371
- const url = `${this.host}/api/2.0/marketplace-provider/providers/${req.id ?? ''}`;
1372
- let resp: DeleteProviderResponse | undefined;
1373
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1374
- const headers = new Headers();
1375
- if (this.workspaceId !== undefined) {
1376
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1377
- }
1378
- headers.set('User-Agent', this.userAgent);
1379
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
1380
- const respBody = await executeHttpCall({
1381
- request: httpReq,
1382
- httpClient: this.httpClient,
1383
- logger: this.logger,
1384
- });
1385
- resp = parseResponse(respBody, unmarshalDeleteProviderResponseSchema);
1386
- };
1387
- await executeCall(call, options);
1388
- if (resp === undefined) {
1389
- throw new Error('operation completed without a result.');
1390
- }
1391
- return resp;
1392
- }
1393
-
1394
- /** Get an exchange. */
1395
- async getExchange(
1396
- req: GetExchangeRequest,
1397
- options?: CallOptions
1398
- ): Promise<GetExchangeResponse> {
1399
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges/${req.id ?? ''}`;
1400
- let resp: GetExchangeResponse | undefined;
1401
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1402
- const headers = new Headers();
1403
- if (this.workspaceId !== undefined) {
1404
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1405
- }
1406
- headers.set('User-Agent', this.userAgent);
1407
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1408
- const respBody = await executeHttpCall({
1409
- request: httpReq,
1410
- httpClient: this.httpClient,
1411
- logger: this.logger,
1412
- });
1413
- resp = parseResponse(respBody, unmarshalGetExchangeResponseSchema);
1414
- };
1415
- await executeCall(call, options);
1416
- if (resp === undefined) {
1417
- throw new Error('operation completed without a result.');
1418
- }
1419
- return resp;
1420
- }
1421
-
1422
- /** Get a file */
1423
- async getFile(
1424
- req: GetFileRequest,
1425
- options?: CallOptions
1426
- ): Promise<GetFileResponse> {
1427
- const url = `${this.host}/api/2.0/marketplace-provider/files/${req.fileId ?? ''}`;
1428
- let resp: GetFileResponse | undefined;
1429
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1430
- const headers = new Headers();
1431
- if (this.workspaceId !== undefined) {
1432
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1433
- }
1434
- headers.set('User-Agent', this.userAgent);
1435
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1436
- const respBody = await executeHttpCall({
1437
- request: httpReq,
1438
- httpClient: this.httpClient,
1439
- logger: this.logger,
1440
- });
1441
- resp = parseResponse(respBody, unmarshalGetFileResponseSchema);
1442
- };
1443
- await executeCall(call, options);
1444
- if (resp === undefined) {
1445
- throw new Error('operation completed without a result.');
1446
- }
1447
- return resp;
1448
- }
1449
-
1450
- /** Get latest version of provider analytics dashboard. */
1451
- async getLatestVersionProviderAnalyticsDashboard(
1452
- _req: GetLatestVersionProviderAnalyticsDashboardRequest,
1453
- options?: CallOptions
1454
- ): Promise<GetLatestVersionProviderAnalyticsDashboardResponse> {
1455
- const url = `${this.host}/api/2.0/marketplace-provider/analytics_dashboard/latest`;
1456
- let resp: GetLatestVersionProviderAnalyticsDashboardResponse | undefined;
1457
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1458
- const headers = new Headers();
1459
- if (this.workspaceId !== undefined) {
1460
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1461
- }
1462
- headers.set('User-Agent', this.userAgent);
1463
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1464
- const respBody = await executeHttpCall({
1465
- request: httpReq,
1466
- httpClient: this.httpClient,
1467
- logger: this.logger,
1468
- });
1469
- resp = parseResponse(
1470
- respBody,
1471
- unmarshalGetLatestVersionProviderAnalyticsDashboardResponseSchema
1472
- );
1473
- };
1474
- await executeCall(call, options);
1475
- if (resp === undefined) {
1476
- throw new Error('operation completed without a result.');
1477
- }
1478
- return resp;
1479
- }
1480
-
1481
- /** Get a listing */
1482
- async getListing(
1483
- req: GetListingRequest,
1484
- options?: CallOptions
1485
- ): Promise<GetListingResponse> {
1486
- const url = `${this.host}/api/2.0/marketplace-provider/listings/${req.id ?? ''}`;
1487
- let resp: GetListingResponse | undefined;
1488
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1489
- const headers = new Headers();
1490
- if (this.workspaceId !== undefined) {
1491
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1492
- }
1493
- headers.set('User-Agent', this.userAgent);
1494
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1495
- const respBody = await executeHttpCall({
1496
- request: httpReq,
1497
- httpClient: this.httpClient,
1498
- logger: this.logger,
1499
- });
1500
- resp = parseResponse(respBody, unmarshalGetListingResponseSchema);
1501
- };
1502
- await executeCall(call, options);
1503
- if (resp === undefined) {
1504
- throw new Error('operation completed without a result.');
1505
- }
1506
- return resp;
1507
- }
1508
-
1509
- /**
1510
- * List personalization requests to this provider.
1511
- * This will return all personalization requests, regardless of which listing they are for.
1512
- */
1513
- async getPersonalizationRequestsForProvider(
1514
- req: GetPersonalizationRequestsForProviderRequest,
1515
- options?: CallOptions
1516
- ): Promise<GetPersonalizationRequestsForProviderResponse> {
1517
- const url = `${this.host}/api/2.0/marketplace-provider/personalization-requests`;
1518
- const params = new URLSearchParams();
1519
- if (req.pageToken !== undefined) {
1520
- params.append('page_token', req.pageToken);
1521
- }
1522
- if (req.pageSize !== undefined) {
1523
- params.append('page_size', String(req.pageSize));
1524
- }
1525
- const query = params.toString();
1526
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1527
- let resp: GetPersonalizationRequestsForProviderResponse | undefined;
1528
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1529
- const headers = new Headers();
1530
- if (this.workspaceId !== undefined) {
1531
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1532
- }
1533
- headers.set('User-Agent', this.userAgent);
1534
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1535
- const respBody = await executeHttpCall({
1536
- request: httpReq,
1537
- httpClient: this.httpClient,
1538
- logger: this.logger,
1539
- });
1540
- resp = parseResponse(
1541
- respBody,
1542
- unmarshalGetPersonalizationRequestsForProviderResponseSchema
1543
- );
1544
- };
1545
- await executeCall(call, options);
1546
- if (resp === undefined) {
1547
- throw new Error('operation completed without a result.');
1548
- }
1549
- return resp;
1550
- }
1551
-
1552
- async *getPersonalizationRequestsForProviderIter(
1553
- req: GetPersonalizationRequestsForProviderRequest,
1554
- options?: CallOptions
1555
- ): AsyncGenerator<PersonalizationRequest> {
1556
- const pageReq: GetPersonalizationRequestsForProviderRequest = {...req};
1557
- for (;;) {
1558
- const resp = await this.getPersonalizationRequestsForProvider(
1559
- pageReq,
1560
- options
1561
- );
1562
- for (const item of resp.personalizationRequests ?? []) {
1563
- yield item;
1564
- }
1565
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1566
- return;
1567
- }
1568
- pageReq.pageToken = resp.nextPageToken;
1569
- }
1570
- }
1571
-
1572
- /** Get provider profile */
1573
- async getProvider(
1574
- req: GetProviderRequest,
1575
- options?: CallOptions
1576
- ): Promise<GetProviderResponse> {
1577
- const url = `${this.host}/api/2.0/marketplace-provider/providers/${req.id ?? ''}`;
1578
- let resp: GetProviderResponse | undefined;
1579
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1580
- const headers = new Headers();
1581
- if (this.workspaceId !== undefined) {
1582
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1583
- }
1584
- headers.set('User-Agent', this.userAgent);
1585
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1586
- const respBody = await executeHttpCall({
1587
- request: httpReq,
1588
- httpClient: this.httpClient,
1589
- logger: this.logger,
1590
- });
1591
- resp = parseResponse(respBody, unmarshalGetProviderResponseSchema);
1592
- };
1593
- await executeCall(call, options);
1594
- if (resp === undefined) {
1595
- throw new Error('operation completed without a result.');
1596
- }
1597
- return resp;
1598
- }
1599
-
1600
- /** List exchange filter */
1601
- async listExchangeFilters(
1602
- req: ListExchangeFiltersRequest,
1603
- options?: CallOptions
1604
- ): Promise<ListExchangeFiltersResponse> {
1605
- const url = `${this.host}/api/2.0/marketplace-exchange/filters`;
1606
- const params = new URLSearchParams();
1607
- if (req.exchangeId !== undefined) {
1608
- params.append('exchange_id', req.exchangeId);
1609
- }
1610
- if (req.pageToken !== undefined) {
1611
- params.append('page_token', req.pageToken);
1612
- }
1613
- if (req.pageSize !== undefined) {
1614
- params.append('page_size', String(req.pageSize));
1615
- }
1616
- const query = params.toString();
1617
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1618
- let resp: ListExchangeFiltersResponse | undefined;
1619
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1620
- const headers = new Headers();
1621
- if (this.workspaceId !== undefined) {
1622
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1623
- }
1624
- headers.set('User-Agent', this.userAgent);
1625
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1626
- const respBody = await executeHttpCall({
1627
- request: httpReq,
1628
- httpClient: this.httpClient,
1629
- logger: this.logger,
1630
- });
1631
- resp = parseResponse(
1632
- respBody,
1633
- unmarshalListExchangeFiltersResponseSchema
1634
- );
1635
- };
1636
- await executeCall(call, options);
1637
- if (resp === undefined) {
1638
- throw new Error('operation completed without a result.');
1639
- }
1640
- return resp;
1641
- }
1642
-
1643
- async *listExchangeFiltersIter(
1644
- req: ListExchangeFiltersRequest,
1645
- options?: CallOptions
1646
- ): AsyncGenerator<ExchangeFilter> {
1647
- const pageReq: ListExchangeFiltersRequest = {...req};
1648
- for (;;) {
1649
- const resp = await this.listExchangeFilters(pageReq, options);
1650
- for (const item of resp.filters ?? []) {
1651
- yield item;
1652
- }
1653
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1654
- return;
1655
- }
1656
- pageReq.pageToken = resp.nextPageToken;
1657
- }
1658
- }
1659
-
1660
- /** List exchanges visible to provider */
1661
- async listExchanges(
1662
- req: ListExchangesRequest,
1663
- options?: CallOptions
1664
- ): Promise<ListExchangesResponse> {
1665
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges`;
1666
- const params = new URLSearchParams();
1667
- if (req.pageToken !== undefined) {
1668
- params.append('page_token', req.pageToken);
1669
- }
1670
- if (req.pageSize !== undefined) {
1671
- params.append('page_size', String(req.pageSize));
1672
- }
1673
- const query = params.toString();
1674
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1675
- let resp: ListExchangesResponse | undefined;
1676
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1677
- const headers = new Headers();
1678
- if (this.workspaceId !== undefined) {
1679
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1680
- }
1681
- headers.set('User-Agent', this.userAgent);
1682
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1683
- const respBody = await executeHttpCall({
1684
- request: httpReq,
1685
- httpClient: this.httpClient,
1686
- logger: this.logger,
1687
- });
1688
- resp = parseResponse(respBody, unmarshalListExchangesResponseSchema);
1689
- };
1690
- await executeCall(call, options);
1691
- if (resp === undefined) {
1692
- throw new Error('operation completed without a result.');
1693
- }
1694
- return resp;
1695
- }
1696
-
1697
- async *listExchangesIter(
1698
- req: ListExchangesRequest,
1699
- options?: CallOptions
1700
- ): AsyncGenerator<Exchange> {
1701
- const pageReq: ListExchangesRequest = {...req};
1702
- for (;;) {
1703
- const resp = await this.listExchanges(pageReq, options);
1704
- for (const item of resp.exchanges ?? []) {
1705
- yield item;
1706
- }
1707
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1708
- return;
1709
- }
1710
- pageReq.pageToken = resp.nextPageToken;
1711
- }
1712
- }
1713
-
1714
- /** List exchanges associated with a listing */
1715
- async listExchangesForListing(
1716
- req: ListExchangesForListingRequest,
1717
- options?: CallOptions
1718
- ): Promise<ListExchangesForListingResponse> {
1719
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges-for-listing`;
1720
- const params = new URLSearchParams();
1721
- if (req.listingId !== undefined) {
1722
- params.append('listing_id', req.listingId);
1723
- }
1724
- if (req.pageToken !== undefined) {
1725
- params.append('page_token', req.pageToken);
1726
- }
1727
- if (req.pageSize !== undefined) {
1728
- params.append('page_size', String(req.pageSize));
1729
- }
1730
- const query = params.toString();
1731
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1732
- let resp: ListExchangesForListingResponse | undefined;
1733
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1734
- const headers = new Headers();
1735
- if (this.workspaceId !== undefined) {
1736
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1737
- }
1738
- headers.set('User-Agent', this.userAgent);
1739
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1740
- const respBody = await executeHttpCall({
1741
- request: httpReq,
1742
- httpClient: this.httpClient,
1743
- logger: this.logger,
1744
- });
1745
- resp = parseResponse(
1746
- respBody,
1747
- unmarshalListExchangesForListingResponseSchema
1748
- );
1749
- };
1750
- await executeCall(call, options);
1751
- if (resp === undefined) {
1752
- throw new Error('operation completed without a result.');
1753
- }
1754
- return resp;
1755
- }
1756
-
1757
- async *listExchangesForListingIter(
1758
- req: ListExchangesForListingRequest,
1759
- options?: CallOptions
1760
- ): AsyncGenerator<ExchangeListing> {
1761
- const pageReq: ListExchangesForListingRequest = {...req};
1762
- for (;;) {
1763
- const resp = await this.listExchangesForListing(pageReq, options);
1764
- for (const item of resp.exchangeListing ?? []) {
1765
- yield item;
1766
- }
1767
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1768
- return;
1769
- }
1770
- pageReq.pageToken = resp.nextPageToken;
1771
- }
1772
- }
1773
-
1774
- /** List files attached to a parent entity. */
1775
- async listFiles(
1776
- req: ListFilesRequest,
1777
- options?: CallOptions
1778
- ): Promise<ListFilesResponse> {
1779
- const url = `${this.host}/api/2.0/marketplace-provider/files`;
1780
- const params = new URLSearchParams();
1781
- if (req.fileParent !== undefined) {
1782
- flattenQueryParams(
1783
- 'file_parent',
1784
- marshalFileParentSchema.parse(req.fileParent),
1785
- params
1786
- );
1787
- }
1788
- if (req.pageToken !== undefined) {
1789
- params.append('page_token', req.pageToken);
1790
- }
1791
- if (req.pageSize !== undefined) {
1792
- params.append('page_size', String(req.pageSize));
1793
- }
1794
- const query = params.toString();
1795
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1796
- let resp: ListFilesResponse | undefined;
1797
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1798
- const headers = new Headers();
1799
- if (this.workspaceId !== undefined) {
1800
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1801
- }
1802
- headers.set('User-Agent', this.userAgent);
1803
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1804
- const respBody = await executeHttpCall({
1805
- request: httpReq,
1806
- httpClient: this.httpClient,
1807
- logger: this.logger,
1808
- });
1809
- resp = parseResponse(respBody, unmarshalListFilesResponseSchema);
1810
- };
1811
- await executeCall(call, options);
1812
- if (resp === undefined) {
1813
- throw new Error('operation completed without a result.');
1814
- }
1815
- return resp;
1816
- }
1817
-
1818
- async *listFilesIter(
1819
- req: ListFilesRequest,
1820
- options?: CallOptions
1821
- ): AsyncGenerator<FileInfo> {
1822
- const pageReq: ListFilesRequest = {...req};
1823
- for (;;) {
1824
- const resp = await this.listFiles(pageReq, options);
1825
- for (const item of resp.fileInfos ?? []) {
1826
- yield item;
1827
- }
1828
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1829
- return;
1830
- }
1831
- pageReq.pageToken = resp.nextPageToken;
1832
- }
1833
- }
1834
-
1835
- /** List listings owned by this provider */
1836
- async listListings(
1837
- req: ListListingsRequest,
1838
- options?: CallOptions
1839
- ): Promise<GetListingsResponse> {
1840
- const url = `${this.host}/api/2.0/marketplace-provider/listings`;
1841
- const params = new URLSearchParams();
1842
- if (req.pageToken !== undefined) {
1843
- params.append('page_token', req.pageToken);
1844
- }
1845
- if (req.pageSize !== undefined) {
1846
- params.append('page_size', String(req.pageSize));
1847
- }
1848
- const query = params.toString();
1849
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1850
- let resp: GetListingsResponse | undefined;
1851
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1852
- const headers = new Headers();
1853
- if (this.workspaceId !== undefined) {
1854
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1855
- }
1856
- headers.set('User-Agent', this.userAgent);
1857
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1858
- const respBody = await executeHttpCall({
1859
- request: httpReq,
1860
- httpClient: this.httpClient,
1861
- logger: this.logger,
1862
- });
1863
- resp = parseResponse(respBody, unmarshalGetListingsResponseSchema);
1864
- };
1865
- await executeCall(call, options);
1866
- if (resp === undefined) {
1867
- throw new Error('operation completed without a result.');
1868
- }
1869
- return resp;
1870
- }
1871
-
1872
- async *listListingsIter(
1873
- req: ListListingsRequest,
1874
- options?: CallOptions
1875
- ): AsyncGenerator<Listing> {
1876
- const pageReq: ListListingsRequest = {...req};
1877
- for (;;) {
1878
- const resp = await this.listListings(pageReq, options);
1879
- for (const item of resp.listings ?? []) {
1880
- yield item;
1881
- }
1882
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1883
- return;
1884
- }
1885
- pageReq.pageToken = resp.nextPageToken;
1886
- }
1887
- }
1888
-
1889
- /** List listings associated with an exchange */
1890
- async listListingsForExchange(
1891
- req: ListListingsForExchangeRequest,
1892
- options?: CallOptions
1893
- ): Promise<ListListingsForExchangeResponse> {
1894
- const url = `${this.host}/api/2.0/marketplace-exchange/listings-for-exchange`;
1895
- const params = new URLSearchParams();
1896
- if (req.exchangeId !== undefined) {
1897
- params.append('exchange_id', req.exchangeId);
1898
- }
1899
- if (req.pageToken !== undefined) {
1900
- params.append('page_token', req.pageToken);
1901
- }
1902
- if (req.pageSize !== undefined) {
1903
- params.append('page_size', String(req.pageSize));
1904
- }
1905
- const query = params.toString();
1906
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1907
- let resp: ListListingsForExchangeResponse | undefined;
1908
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1909
- const headers = new Headers();
1910
- if (this.workspaceId !== undefined) {
1911
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1912
- }
1913
- headers.set('User-Agent', this.userAgent);
1914
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
1915
- const respBody = await executeHttpCall({
1916
- request: httpReq,
1917
- httpClient: this.httpClient,
1918
- logger: this.logger,
1919
- });
1920
- resp = parseResponse(
1921
- respBody,
1922
- unmarshalListListingsForExchangeResponseSchema
1923
- );
1924
- };
1925
- await executeCall(call, options);
1926
- if (resp === undefined) {
1927
- throw new Error('operation completed without a result.');
1928
- }
1929
- return resp;
1930
- }
1931
-
1932
- async *listListingsForExchangeIter(
1933
- req: ListListingsForExchangeRequest,
1934
- options?: CallOptions
1935
- ): AsyncGenerator<ExchangeListing> {
1936
- const pageReq: ListListingsForExchangeRequest = {...req};
1937
- for (;;) {
1938
- const resp = await this.listListingsForExchange(pageReq, options);
1939
- for (const item of resp.exchangeListings ?? []) {
1940
- yield item;
1941
- }
1942
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
1943
- return;
1944
- }
1945
- pageReq.pageToken = resp.nextPageToken;
1946
- }
1947
- }
1948
-
1949
- /** Get provider analytics dashboard. */
1950
- async listProviderAnalyticsDashboard(
1951
- _req: ListProviderAnalyticsDashboardRequest,
1952
- options?: CallOptions
1953
- ): Promise<ListProviderAnalyticsDashboardResponse> {
1954
- const url = `${this.host}/api/2.0/marketplace-provider/analytics_dashboard`;
1955
- let resp: ListProviderAnalyticsDashboardResponse | undefined;
1956
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1957
- const headers = new Headers();
1958
- if (this.workspaceId !== undefined) {
1959
- headers.set('X-Databricks-Org-Id', this.workspaceId);
1960
- }
1961
- headers.set('User-Agent', this.userAgent);
1962
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
1963
- const respBody = await executeHttpCall({
1964
- request: httpReq,
1965
- httpClient: this.httpClient,
1966
- logger: this.logger,
1967
- });
1968
- resp = parseResponse(
1969
- respBody,
1970
- unmarshalListProviderAnalyticsDashboardResponseSchema
1971
- );
1972
- };
1973
- await executeCall(call, options);
1974
- if (resp === undefined) {
1975
- throw new Error('operation completed without a result.');
1976
- }
1977
- return resp;
1978
- }
1979
-
1980
- /** List provider profiles for account. */
1981
- async listProviders(
1982
- req: ListProvidersRequest,
1983
- options?: CallOptions
1984
- ): Promise<ListProvidersResponse> {
1985
- const url = `${this.host}/api/2.0/marketplace-provider/providers`;
1986
- const params = new URLSearchParams();
1987
- if (req.pageToken !== undefined) {
1988
- params.append('page_token', req.pageToken);
1989
- }
1990
- if (req.pageSize !== undefined) {
1991
- params.append('page_size', String(req.pageSize));
1992
- }
1993
- const query = params.toString();
1994
- const fullUrl = query !== '' ? `${url}?${query}` : url;
1995
- let resp: ListProvidersResponse | undefined;
1996
- const call = async (callSignal?: AbortSignal): Promise<void> => {
1997
- const headers = new Headers();
1998
- if (this.workspaceId !== undefined) {
1999
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2000
- }
2001
- headers.set('User-Agent', this.userAgent);
2002
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
2003
- const respBody = await executeHttpCall({
2004
- request: httpReq,
2005
- httpClient: this.httpClient,
2006
- logger: this.logger,
2007
- });
2008
- resp = parseResponse(respBody, unmarshalListProvidersResponseSchema);
2009
- };
2010
- await executeCall(call, options);
2011
- if (resp === undefined) {
2012
- throw new Error('operation completed without a result.');
2013
- }
2014
- return resp;
2015
- }
2016
-
2017
- async *listProvidersIter(
2018
- req: ListProvidersRequest,
2019
- options?: CallOptions
2020
- ): AsyncGenerator<ProviderInfo> {
2021
- const pageReq: ListProvidersRequest = {...req};
2022
- for (;;) {
2023
- const resp = await this.listProviders(pageReq, options);
2024
- for (const item of resp.providers ?? []) {
2025
- yield item;
2026
- }
2027
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
2028
- return;
2029
- }
2030
- pageReq.pageToken = resp.nextPageToken;
2031
- }
2032
- }
2033
-
2034
- /** Disassociate an exchange with a listing */
2035
- async removeExchangeForListing(
2036
- req: RemoveExchangeForListingRequest,
2037
- options?: CallOptions
2038
- ): Promise<RemoveExchangeForListingResponse> {
2039
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges-for-listing/${req.id ?? ''}`;
2040
- let resp: RemoveExchangeForListingResponse | undefined;
2041
- const call = async (callSignal?: AbortSignal): Promise<void> => {
2042
- const headers = new Headers();
2043
- if (this.workspaceId !== undefined) {
2044
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2045
- }
2046
- headers.set('User-Agent', this.userAgent);
2047
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
2048
- const respBody = await executeHttpCall({
2049
- request: httpReq,
2050
- httpClient: this.httpClient,
2051
- logger: this.logger,
2052
- });
2053
- resp = parseResponse(
2054
- respBody,
2055
- unmarshalRemoveExchangeForListingResponseSchema
2056
- );
2057
- };
2058
- await executeCall(call, options);
2059
- if (resp === undefined) {
2060
- throw new Error('operation completed without a result.');
2061
- }
2062
- return resp;
2063
- }
2064
-
2065
- /** Update an exchange */
2066
- async updateExchange(
2067
- req: UpdateExchangeRequest,
2068
- options?: CallOptions
2069
- ): Promise<UpdateExchangeResponse> {
2070
- const url = `${this.host}/api/2.0/marketplace-exchange/exchanges/${req.id ?? ''}`;
2071
- const body = marshalRequest(req, marshalUpdateExchangeRequestSchema);
2072
- let resp: UpdateExchangeResponse | undefined;
2073
- const call = async (callSignal?: AbortSignal): Promise<void> => {
2074
- const headers = new Headers({'Content-Type': 'application/json'});
2075
- if (this.workspaceId !== undefined) {
2076
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2077
- }
2078
- headers.set('User-Agent', this.userAgent);
2079
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
2080
- const respBody = await executeHttpCall({
2081
- request: httpReq,
2082
- httpClient: this.httpClient,
2083
- logger: this.logger,
2084
- });
2085
- resp = parseResponse(respBody, unmarshalUpdateExchangeResponseSchema);
2086
- };
2087
- await executeCall(call, options);
2088
- if (resp === undefined) {
2089
- throw new Error('operation completed without a result.');
2090
- }
2091
- return resp;
2092
- }
2093
-
2094
- /** Update an exchange filter. */
2095
- async updateExchangeFilter(
2096
- req: UpdateExchangeFilterRequest,
2097
- options?: CallOptions
2098
- ): Promise<UpdateExchangeFilterResponse> {
2099
- const url = `${this.host}/api/2.0/marketplace-exchange/filters/${req.id ?? ''}`;
2100
- const body = marshalRequest(req, marshalUpdateExchangeFilterRequestSchema);
2101
- let resp: UpdateExchangeFilterResponse | undefined;
2102
- const call = async (callSignal?: AbortSignal): Promise<void> => {
2103
- const headers = new Headers({'Content-Type': 'application/json'});
2104
- if (this.workspaceId !== undefined) {
2105
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2106
- }
2107
- headers.set('User-Agent', this.userAgent);
2108
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
2109
- const respBody = await executeHttpCall({
2110
- request: httpReq,
2111
- httpClient: this.httpClient,
2112
- logger: this.logger,
2113
- });
2114
- resp = parseResponse(
2115
- respBody,
2116
- unmarshalUpdateExchangeFilterResponseSchema
2117
- );
2118
- };
2119
- await executeCall(call, options);
2120
- if (resp === undefined) {
2121
- throw new Error('operation completed without a result.');
2122
- }
2123
- return resp;
2124
- }
2125
-
2126
- /** Update a listing */
2127
- async updateListing(
2128
- req: UpdateListingRequest,
2129
- options?: CallOptions
2130
- ): Promise<UpdateListingResponse> {
2131
- const url = `${this.host}/api/2.0/marketplace-provider/listings/${req.id ?? ''}`;
2132
- const body = marshalRequest(req, marshalUpdateListingRequestSchema);
2133
- let resp: UpdateListingResponse | undefined;
2134
- const call = async (callSignal?: AbortSignal): Promise<void> => {
2135
- const headers = new Headers({'Content-Type': 'application/json'});
2136
- if (this.workspaceId !== undefined) {
2137
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2138
- }
2139
- headers.set('User-Agent', this.userAgent);
2140
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
2141
- const respBody = await executeHttpCall({
2142
- request: httpReq,
2143
- httpClient: this.httpClient,
2144
- logger: this.logger,
2145
- });
2146
- resp = parseResponse(respBody, unmarshalUpdateListingResponseSchema);
2147
- };
2148
- await executeCall(call, options);
2149
- if (resp === undefined) {
2150
- throw new Error('operation completed without a result.');
2151
- }
2152
- return resp;
2153
- }
2154
-
2155
- /** Update personalization request. This method only permits updating the status of the request. */
2156
- async updatePersonalizationRequestStatus(
2157
- req: UpdatePersonalizationRequestStatusRequest,
2158
- options?: CallOptions
2159
- ): Promise<UpdatePersonalizationRequestStatusResponse> {
2160
- const url = `${this.host}/api/2.0/marketplace-provider/listings/${req.listingId ?? ''}/personalization-requests/${req.requestId ?? ''}/request-status`;
2161
- const body = marshalRequest(
2162
- req,
2163
- marshalUpdatePersonalizationRequestStatusRequestSchema
2164
- );
2165
- let resp: UpdatePersonalizationRequestStatusResponse | undefined;
2166
- const call = async (callSignal?: AbortSignal): Promise<void> => {
2167
- const headers = new Headers({'Content-Type': 'application/json'});
2168
- if (this.workspaceId !== undefined) {
2169
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2170
- }
2171
- headers.set('User-Agent', this.userAgent);
2172
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
2173
- const respBody = await executeHttpCall({
2174
- request: httpReq,
2175
- httpClient: this.httpClient,
2176
- logger: this.logger,
2177
- });
2178
- resp = parseResponse(
2179
- respBody,
2180
- unmarshalUpdatePersonalizationRequestStatusResponseSchema
2181
- );
2182
- };
2183
- await executeCall(call, options);
2184
- if (resp === undefined) {
2185
- throw new Error('operation completed without a result.');
2186
- }
2187
- return resp;
2188
- }
2189
-
2190
- /** Update provider profile */
2191
- async updateProvider(
2192
- req: UpdateProviderRequest,
2193
- options?: CallOptions
2194
- ): Promise<UpdateProviderResponse> {
2195
- const url = `${this.host}/api/2.0/marketplace-provider/providers/${req.id ?? ''}`;
2196
- const body = marshalRequest(req, marshalUpdateProviderRequestSchema);
2197
- let resp: UpdateProviderResponse | undefined;
2198
- const call = async (callSignal?: AbortSignal): Promise<void> => {
2199
- const headers = new Headers({'Content-Type': 'application/json'});
2200
- if (this.workspaceId !== undefined) {
2201
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2202
- }
2203
- headers.set('User-Agent', this.userAgent);
2204
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
2205
- const respBody = await executeHttpCall({
2206
- request: httpReq,
2207
- httpClient: this.httpClient,
2208
- logger: this.logger,
2209
- });
2210
- resp = parseResponse(respBody, unmarshalUpdateProviderResponseSchema);
2211
- };
2212
- await executeCall(call, options);
2213
- if (resp === undefined) {
2214
- throw new Error('operation completed without a result.');
2215
- }
2216
- return resp;
2217
- }
2218
-
2219
- /** Update provider analytics dashboard. */
2220
- async updateProviderAnalyticsDashboard(
2221
- req: UpdateProviderAnalyticsDashboardRequest,
2222
- options?: CallOptions
2223
- ): Promise<UpdateProviderAnalyticsDashboardResponse> {
2224
- const url = `${this.host}/api/2.0/marketplace-provider/analytics_dashboard/${req.id ?? ''}`;
2225
- const body = marshalRequest(
2226
- req,
2227
- marshalUpdateProviderAnalyticsDashboardRequestSchema
2228
- );
2229
- let resp: UpdateProviderAnalyticsDashboardResponse | undefined;
2230
- const call = async (callSignal?: AbortSignal): Promise<void> => {
2231
- const headers = new Headers({'Content-Type': 'application/json'});
2232
- if (this.workspaceId !== undefined) {
2233
- headers.set('X-Databricks-Org-Id', this.workspaceId);
2234
- }
2235
- headers.set('User-Agent', this.userAgent);
2236
- const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
2237
- const respBody = await executeHttpCall({
2238
- request: httpReq,
2239
- httpClient: this.httpClient,
2240
- logger: this.logger,
2241
- });
2242
- resp = parseResponse(
2243
- respBody,
2244
- unmarshalUpdateProviderAnalyticsDashboardResponseSchema
2245
- );
2246
- };
2247
- await executeCall(call, options);
2248
- if (resp === undefined) {
2249
- throw new Error('operation completed without a result.');
2250
- }
2251
- return resp;
2252
- }
2253
- }