@databricks/sdk-lakeview 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 ADDED
@@ -0,0 +1,28 @@
1
+ # @databricks/sdk-lakeview
2
+
3
+ > [!WARNING]
4
+ >
5
+ > ## PREVIEW - NOT FOR PRODUCTION USE
6
+ >
7
+ > **This SDK is in preview and is subject to change without notice.**
8
+ >
9
+ > - **Do NOT use in production environments**
10
+ > - **Breaking changes may occur at any time**
11
+ > - **APIs are experimental and unstable**
12
+ > - **Use for development and testing only**
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @databricks/sdk-lakeview
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```typescript
23
+ import {LakeviewClient} from '@databricks/sdk-lakeview/v1';
24
+
25
+ const client = new LakeviewClient({});
26
+ ```
27
+
28
+ For a full getting-started guide, see the [root README](../../README.md).
@@ -2,12 +2,12 @@ import type { CallOptions } from '@databricks/sdk-options/call';
2
2
  import type { ClientOptions } from '@databricks/sdk-options/client';
3
3
  import type { CreateDashboardRequest, CreateScheduleRequest, CreateSubscriptionRequest, Dashboard, DeleteScheduleRequest, DeleteSubscriptionRequest, GetDashboardRequest, GetPublishedDashboardRequest, GetPublishedDashboardTokenInfoRequest, GetPublishedDashboardTokenInfoResponse, GetScheduleRequest, GetSubscriptionRequest, ListDashboardsRequest, ListDashboardsResponse, ListSchedulesRequest, ListSchedulesResponse, ListSubscriptionsRequest, ListSubscriptionsResponse, MigrateDashboardRequest, PublishDashboardRequest, PublishedDashboard, RevertDashboardRequest, RevertDashboardResponse, Schedule, Subscription, TrashDashboardRequest, TrashDashboardResponse, UnpublishDashboardRequest, UnpublishDashboardResponse, UpdateDashboardRequest, UpdateScheduleRequest } from './model';
4
4
  export declare class LakeviewClient {
5
- private readonly host;
6
- private readonly workspaceId;
7
- private readonly httpClient;
5
+ private readonly options;
8
6
  private readonly logger;
9
7
  private readonly userAgent;
8
+ private config;
10
9
  constructor(options: ClientOptions);
10
+ private resolveConfig;
11
11
  /** Create a draft dashboard. */
12
12
  createDashboard(req: CreateDashboardRequest, options?: CallOptions): Promise<Dashboard>;
13
13
  /** Create dashboard schedule. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/v1/client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAWlE,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,SAAS,EACT,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,qCAAqC,EACrC,sCAAsC,EACtC,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AA2BjB,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAI9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAIhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,OAAO,EAAE,aAAa;IAelC,gCAAgC;IAC1B,eAAe,CACnB,GAAG,EAAE,sBAAsB,EAC3B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,SAAS,CAAC;IAwCr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OAAO,CAAC,QAAQ,CAAC;CAyBrB"}
package/dist/v1/client.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
3
3
  import { createDefault } from '@databricks/sdk-core/clientinfo';
4
4
  import { NoOpLogger } from '@databricks/sdk-core/logger';
5
- import { newHttpClient } from './transport';
5
+ import { resolveClientConfig } from './transport';
6
6
  import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
7
7
  import pkgJson from '../../package.json' with { type: 'json' };
8
8
  import { marshalDashboardSchema, marshalMigrateDashboardRequestSchema, marshalPublishDashboardRequestSchema, marshalRevertDashboardRequestSchema, marshalScheduleSchema, marshalSubscriptionSchema, unmarshalDashboardSchema, unmarshalGetPublishedDashboardTokenInfoResponseSchema, unmarshalListDashboardsResponseSchema, unmarshalListSchedulesResponseSchema, unmarshalListSubscriptionsResponseSchema, unmarshalPublishedDashboardSchema, unmarshalRevertDashboardResponseSchema, unmarshalScheduleSchema, unmarshalSubscriptionSchema, unmarshalTrashDashboardResponseSchema, unmarshalUnpublishDashboardResponseSchema, } from './model';
@@ -12,34 +12,33 @@ const PACKAGE_SEGMENT = {
12
12
  value: pkgJson.version,
13
13
  };
14
14
  export class LakeviewClient {
15
- host;
16
- // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
17
- // When set, workspace-level methods send X-Databricks-Org-Id on every
18
- // request.
19
- workspaceId;
20
- httpClient;
15
+ options;
21
16
  logger;
22
17
  // User-Agent header value. Composed once at construction from
23
18
  // createDefault() merged with this package's identity and the active
24
19
  // credential's name.
25
20
  userAgent;
21
+ // Memoized configuration. The profile is resolved once, lazily, on the first
22
+ // request, then reused; host, workspaceId/accountId, and credentials are
23
+ // filled from it when not set explicitly on the options.
24
+ config;
26
25
  constructor(options) {
27
- if (options.host === undefined) {
28
- throw new Error('Host is required.');
29
- }
30
- this.host = options.host.replace(/\/$/, '');
31
- this.workspaceId = options.workspaceId;
26
+ this.options = options;
32
27
  this.logger = options.logger ?? new NoOpLogger();
33
28
  const info = createDefault()
34
29
  .with(PACKAGE_SEGMENT)
35
30
  .with({ key: 'sdk-js-auth', value: AUTH_VERSION })
36
31
  .with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
37
32
  this.userAgent = info.toString();
38
- this.httpClient = newHttpClient(options);
33
+ }
34
+ resolveConfig() {
35
+ this.config ??= resolveClientConfig(this.options);
36
+ return this.config;
39
37
  }
40
38
  /** Create a draft dashboard. */
41
39
  async createDashboard(req, options) {
42
- const url = `${this.host}/api/2.0/lakeview/dashboards`;
40
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
41
+ const url = `${host}/api/2.0/lakeview/dashboards`;
43
42
  const params = new URLSearchParams();
44
43
  if (req.datasetCatalog !== undefined) {
45
44
  params.append('dataset_catalog', req.datasetCatalog);
@@ -53,14 +52,14 @@ export class LakeviewClient {
53
52
  let resp;
54
53
  const call = async (callSignal) => {
55
54
  const headers = new Headers({ 'Content-Type': 'application/json' });
56
- if (this.workspaceId !== undefined) {
57
- headers.set('X-Databricks-Org-Id', this.workspaceId);
55
+ if (workspaceId !== undefined) {
56
+ headers.set('X-Databricks-Org-Id', workspaceId);
58
57
  }
59
58
  headers.set('User-Agent', this.userAgent);
60
59
  const httpReq = buildHttpRequest('POST', fullUrl, headers, callSignal, body);
61
60
  const respBody = await executeHttpCall({
62
61
  request: httpReq,
63
- httpClient: this.httpClient,
62
+ httpClient,
64
63
  logger: this.logger,
65
64
  });
66
65
  resp = parseResponse(respBody, unmarshalDashboardSchema);
@@ -73,19 +72,20 @@ export class LakeviewClient {
73
72
  }
74
73
  /** Create dashboard schedule. */
75
74
  async createSchedule(req, options) {
76
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.schedule?.dashboardId ?? ''}/schedules`;
75
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
76
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.schedule?.dashboardId ?? ''}/schedules`;
77
77
  const body = marshalRequest(req.schedule, marshalScheduleSchema);
78
78
  let resp;
79
79
  const call = async (callSignal) => {
80
80
  const headers = new Headers({ 'Content-Type': 'application/json' });
81
- if (this.workspaceId !== undefined) {
82
- headers.set('X-Databricks-Org-Id', this.workspaceId);
81
+ if (workspaceId !== undefined) {
82
+ headers.set('X-Databricks-Org-Id', workspaceId);
83
83
  }
84
84
  headers.set('User-Agent', this.userAgent);
85
85
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
86
86
  const respBody = await executeHttpCall({
87
87
  request: httpReq,
88
- httpClient: this.httpClient,
88
+ httpClient,
89
89
  logger: this.logger,
90
90
  });
91
91
  resp = parseResponse(respBody, unmarshalScheduleSchema);
@@ -98,19 +98,20 @@ export class LakeviewClient {
98
98
  }
99
99
  /** Create schedule subscription. */
100
100
  async createSubscription(req, options) {
101
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.subscription?.dashboardId ?? ''}/schedules/${req.subscription?.scheduleId ?? ''}/subscriptions`;
101
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
102
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.subscription?.dashboardId ?? ''}/schedules/${req.subscription?.scheduleId ?? ''}/subscriptions`;
102
103
  const body = marshalRequest(req.subscription, marshalSubscriptionSchema);
103
104
  let resp;
104
105
  const call = async (callSignal) => {
105
106
  const headers = new Headers({ 'Content-Type': 'application/json' });
106
- if (this.workspaceId !== undefined) {
107
- headers.set('X-Databricks-Org-Id', this.workspaceId);
107
+ if (workspaceId !== undefined) {
108
+ headers.set('X-Databricks-Org-Id', workspaceId);
108
109
  }
109
110
  headers.set('User-Agent', this.userAgent);
110
111
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
111
112
  const respBody = await executeHttpCall({
112
113
  request: httpReq,
113
- httpClient: this.httpClient,
114
+ httpClient,
114
115
  logger: this.logger,
115
116
  });
116
117
  resp = parseResponse(respBody, unmarshalSubscriptionSchema);
@@ -123,7 +124,8 @@ export class LakeviewClient {
123
124
  }
124
125
  /** Delete dashboard schedule. */
125
126
  async deleteSchedule(req, options) {
126
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}`;
127
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
128
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}`;
127
129
  const params = new URLSearchParams();
128
130
  if (req.etag !== undefined) {
129
131
  params.append('etag', req.etag);
@@ -132,14 +134,14 @@ export class LakeviewClient {
132
134
  const fullUrl = query !== '' ? `${url}?${query}` : url;
133
135
  const call = async (callSignal) => {
134
136
  const headers = new Headers();
135
- if (this.workspaceId !== undefined) {
136
- headers.set('X-Databricks-Org-Id', this.workspaceId);
137
+ if (workspaceId !== undefined) {
138
+ headers.set('X-Databricks-Org-Id', workspaceId);
137
139
  }
138
140
  headers.set('User-Agent', this.userAgent);
139
141
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
140
142
  await executeHttpCall({
141
143
  request: httpReq,
142
- httpClient: this.httpClient,
144
+ httpClient,
143
145
  logger: this.logger,
144
146
  });
145
147
  };
@@ -147,7 +149,8 @@ export class LakeviewClient {
147
149
  }
148
150
  /** Delete schedule subscription. */
149
151
  async deleteSubscription(req, options) {
150
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}/subscriptions/${req.subscriptionId ?? ''}`;
152
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
153
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}/subscriptions/${req.subscriptionId ?? ''}`;
151
154
  const params = new URLSearchParams();
152
155
  if (req.etag !== undefined) {
153
156
  params.append('etag', req.etag);
@@ -156,14 +159,14 @@ export class LakeviewClient {
156
159
  const fullUrl = query !== '' ? `${url}?${query}` : url;
157
160
  const call = async (callSignal) => {
158
161
  const headers = new Headers();
159
- if (this.workspaceId !== undefined) {
160
- headers.set('X-Databricks-Org-Id', this.workspaceId);
162
+ if (workspaceId !== undefined) {
163
+ headers.set('X-Databricks-Org-Id', workspaceId);
161
164
  }
162
165
  headers.set('User-Agent', this.userAgent);
163
166
  const httpReq = buildHttpRequest('DELETE', fullUrl, headers, callSignal);
164
167
  await executeHttpCall({
165
168
  request: httpReq,
166
- httpClient: this.httpClient,
169
+ httpClient,
167
170
  logger: this.logger,
168
171
  });
169
172
  };
@@ -171,18 +174,19 @@ export class LakeviewClient {
171
174
  }
172
175
  /** Get a draft dashboard. */
173
176
  async getDashboard(req, options) {
174
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}`;
177
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
178
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}`;
175
179
  let resp;
176
180
  const call = async (callSignal) => {
177
181
  const headers = new Headers();
178
- if (this.workspaceId !== undefined) {
179
- headers.set('X-Databricks-Org-Id', this.workspaceId);
182
+ if (workspaceId !== undefined) {
183
+ headers.set('X-Databricks-Org-Id', workspaceId);
180
184
  }
181
185
  headers.set('User-Agent', this.userAgent);
182
186
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
183
187
  const respBody = await executeHttpCall({
184
188
  request: httpReq,
185
- httpClient: this.httpClient,
189
+ httpClient,
186
190
  logger: this.logger,
187
191
  });
188
192
  resp = parseResponse(respBody, unmarshalDashboardSchema);
@@ -195,18 +199,19 @@ export class LakeviewClient {
195
199
  }
196
200
  /** Get the current published dashboard. */
197
201
  async getPublishedDashboard(req, options) {
198
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published`;
202
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
203
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published`;
199
204
  let resp;
200
205
  const call = async (callSignal) => {
201
206
  const headers = new Headers();
202
- if (this.workspaceId !== undefined) {
203
- headers.set('X-Databricks-Org-Id', this.workspaceId);
207
+ if (workspaceId !== undefined) {
208
+ headers.set('X-Databricks-Org-Id', workspaceId);
204
209
  }
205
210
  headers.set('User-Agent', this.userAgent);
206
211
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
207
212
  const respBody = await executeHttpCall({
208
213
  request: httpReq,
209
- httpClient: this.httpClient,
214
+ httpClient,
210
215
  logger: this.logger,
211
216
  });
212
217
  resp = parseResponse(respBody, unmarshalPublishedDashboardSchema);
@@ -219,7 +224,8 @@ export class LakeviewClient {
219
224
  }
220
225
  /** Get a required authorization details and scopes of a published dashboard to mint an OAuth token. */
221
226
  async getPublishedDashboardTokenInfo(req, options) {
222
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published/tokeninfo`;
227
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
228
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published/tokeninfo`;
223
229
  const params = new URLSearchParams();
224
230
  if (req.externalValue !== undefined) {
225
231
  params.append('external_value', req.externalValue);
@@ -232,14 +238,14 @@ export class LakeviewClient {
232
238
  let resp;
233
239
  const call = async (callSignal) => {
234
240
  const headers = new Headers();
235
- if (this.workspaceId !== undefined) {
236
- headers.set('X-Databricks-Org-Id', this.workspaceId);
241
+ if (workspaceId !== undefined) {
242
+ headers.set('X-Databricks-Org-Id', workspaceId);
237
243
  }
238
244
  headers.set('User-Agent', this.userAgent);
239
245
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
240
246
  const respBody = await executeHttpCall({
241
247
  request: httpReq,
242
- httpClient: this.httpClient,
248
+ httpClient,
243
249
  logger: this.logger,
244
250
  });
245
251
  resp = parseResponse(respBody, unmarshalGetPublishedDashboardTokenInfoResponseSchema);
@@ -252,18 +258,19 @@ export class LakeviewClient {
252
258
  }
253
259
  /** Get dashboard schedule. */
254
260
  async getSchedule(req, options) {
255
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}`;
261
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
262
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}`;
256
263
  let resp;
257
264
  const call = async (callSignal) => {
258
265
  const headers = new Headers();
259
- if (this.workspaceId !== undefined) {
260
- headers.set('X-Databricks-Org-Id', this.workspaceId);
266
+ if (workspaceId !== undefined) {
267
+ headers.set('X-Databricks-Org-Id', workspaceId);
261
268
  }
262
269
  headers.set('User-Agent', this.userAgent);
263
270
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
264
271
  const respBody = await executeHttpCall({
265
272
  request: httpReq,
266
- httpClient: this.httpClient,
273
+ httpClient,
267
274
  logger: this.logger,
268
275
  });
269
276
  resp = parseResponse(respBody, unmarshalScheduleSchema);
@@ -276,18 +283,19 @@ export class LakeviewClient {
276
283
  }
277
284
  /** Get schedule subscription. */
278
285
  async getSubscription(req, options) {
279
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}/subscriptions/${req.subscriptionId ?? ''}`;
286
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
287
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}/subscriptions/${req.subscriptionId ?? ''}`;
280
288
  let resp;
281
289
  const call = async (callSignal) => {
282
290
  const headers = new Headers();
283
- if (this.workspaceId !== undefined) {
284
- headers.set('X-Databricks-Org-Id', this.workspaceId);
291
+ if (workspaceId !== undefined) {
292
+ headers.set('X-Databricks-Org-Id', workspaceId);
285
293
  }
286
294
  headers.set('User-Agent', this.userAgent);
287
295
  const httpReq = buildHttpRequest('GET', url, headers, callSignal);
288
296
  const respBody = await executeHttpCall({
289
297
  request: httpReq,
290
- httpClient: this.httpClient,
298
+ httpClient,
291
299
  logger: this.logger,
292
300
  });
293
301
  resp = parseResponse(respBody, unmarshalSubscriptionSchema);
@@ -300,7 +308,8 @@ export class LakeviewClient {
300
308
  }
301
309
  /** List dashboards. */
302
310
  async listDashboards(req, options) {
303
- const url = `${this.host}/api/2.0/lakeview/dashboards`;
311
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
312
+ const url = `${host}/api/2.0/lakeview/dashboards`;
304
313
  const params = new URLSearchParams();
305
314
  if (req.pageSize !== undefined) {
306
315
  params.append('page_size', String(req.pageSize));
@@ -319,14 +328,14 @@ export class LakeviewClient {
319
328
  let resp;
320
329
  const call = async (callSignal) => {
321
330
  const headers = new Headers();
322
- if (this.workspaceId !== undefined) {
323
- headers.set('X-Databricks-Org-Id', this.workspaceId);
331
+ if (workspaceId !== undefined) {
332
+ headers.set('X-Databricks-Org-Id', workspaceId);
324
333
  }
325
334
  headers.set('User-Agent', this.userAgent);
326
335
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
327
336
  const respBody = await executeHttpCall({
328
337
  request: httpReq,
329
- httpClient: this.httpClient,
338
+ httpClient,
330
339
  logger: this.logger,
331
340
  });
332
341
  resp = parseResponse(respBody, unmarshalListDashboardsResponseSchema);
@@ -352,7 +361,8 @@ export class LakeviewClient {
352
361
  }
353
362
  /** List dashboard schedules. */
354
363
  async listSchedules(req, options) {
355
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules`;
364
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
365
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules`;
356
366
  const params = new URLSearchParams();
357
367
  if (req.pageSize !== undefined) {
358
368
  params.append('page_size', String(req.pageSize));
@@ -365,14 +375,14 @@ export class LakeviewClient {
365
375
  let resp;
366
376
  const call = async (callSignal) => {
367
377
  const headers = new Headers();
368
- if (this.workspaceId !== undefined) {
369
- headers.set('X-Databricks-Org-Id', this.workspaceId);
378
+ if (workspaceId !== undefined) {
379
+ headers.set('X-Databricks-Org-Id', workspaceId);
370
380
  }
371
381
  headers.set('User-Agent', this.userAgent);
372
382
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
373
383
  const respBody = await executeHttpCall({
374
384
  request: httpReq,
375
- httpClient: this.httpClient,
385
+ httpClient,
376
386
  logger: this.logger,
377
387
  });
378
388
  resp = parseResponse(respBody, unmarshalListSchedulesResponseSchema);
@@ -398,7 +408,8 @@ export class LakeviewClient {
398
408
  }
399
409
  /** List schedule subscriptions. */
400
410
  async listSubscriptions(req, options) {
401
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}/subscriptions`;
411
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
412
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/schedules/${req.scheduleId ?? ''}/subscriptions`;
402
413
  const params = new URLSearchParams();
403
414
  if (req.pageSize !== undefined) {
404
415
  params.append('page_size', String(req.pageSize));
@@ -411,14 +422,14 @@ export class LakeviewClient {
411
422
  let resp;
412
423
  const call = async (callSignal) => {
413
424
  const headers = new Headers();
414
- if (this.workspaceId !== undefined) {
415
- headers.set('X-Databricks-Org-Id', this.workspaceId);
425
+ if (workspaceId !== undefined) {
426
+ headers.set('X-Databricks-Org-Id', workspaceId);
416
427
  }
417
428
  headers.set('User-Agent', this.userAgent);
418
429
  const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
419
430
  const respBody = await executeHttpCall({
420
431
  request: httpReq,
421
- httpClient: this.httpClient,
432
+ httpClient,
422
433
  logger: this.logger,
423
434
  });
424
435
  resp = parseResponse(respBody, unmarshalListSubscriptionsResponseSchema);
@@ -444,19 +455,20 @@ export class LakeviewClient {
444
455
  }
445
456
  /** Migrates a classic SQL dashboard to Lakeview. */
446
457
  async migrateDashboard(req, options) {
447
- const url = `${this.host}/api/2.0/lakeview/dashboards/migrate`;
458
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
459
+ const url = `${host}/api/2.0/lakeview/dashboards/migrate`;
448
460
  const body = marshalRequest(req, marshalMigrateDashboardRequestSchema);
449
461
  let resp;
450
462
  const call = async (callSignal) => {
451
463
  const headers = new Headers({ 'Content-Type': 'application/json' });
452
- if (this.workspaceId !== undefined) {
453
- headers.set('X-Databricks-Org-Id', this.workspaceId);
464
+ if (workspaceId !== undefined) {
465
+ headers.set('X-Databricks-Org-Id', workspaceId);
454
466
  }
455
467
  headers.set('User-Agent', this.userAgent);
456
468
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
457
469
  const respBody = await executeHttpCall({
458
470
  request: httpReq,
459
- httpClient: this.httpClient,
471
+ httpClient,
460
472
  logger: this.logger,
461
473
  });
462
474
  resp = parseResponse(respBody, unmarshalDashboardSchema);
@@ -469,19 +481,20 @@ export class LakeviewClient {
469
481
  }
470
482
  /** Publish the current draft dashboard. */
471
483
  async publishDashboard(req, options) {
472
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published`;
484
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
485
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published`;
473
486
  const body = marshalRequest(req, marshalPublishDashboardRequestSchema);
474
487
  let resp;
475
488
  const call = async (callSignal) => {
476
489
  const headers = new Headers({ 'Content-Type': 'application/json' });
477
- if (this.workspaceId !== undefined) {
478
- headers.set('X-Databricks-Org-Id', this.workspaceId);
490
+ if (workspaceId !== undefined) {
491
+ headers.set('X-Databricks-Org-Id', workspaceId);
479
492
  }
480
493
  headers.set('User-Agent', this.userAgent);
481
494
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
482
495
  const respBody = await executeHttpCall({
483
496
  request: httpReq,
484
- httpClient: this.httpClient,
497
+ httpClient,
485
498
  logger: this.logger,
486
499
  });
487
500
  resp = parseResponse(respBody, unmarshalPublishedDashboardSchema);
@@ -494,19 +507,20 @@ export class LakeviewClient {
494
507
  }
495
508
  /** Revert a dashboard's definition in draft mode to the last published version. */
496
509
  async revertDashboard(req, options) {
497
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/revert`;
510
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
511
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/revert`;
498
512
  const body = marshalRequest(req, marshalRevertDashboardRequestSchema);
499
513
  let resp;
500
514
  const call = async (callSignal) => {
501
515
  const headers = new Headers({ 'Content-Type': 'application/json' });
502
- if (this.workspaceId !== undefined) {
503
- headers.set('X-Databricks-Org-Id', this.workspaceId);
516
+ if (workspaceId !== undefined) {
517
+ headers.set('X-Databricks-Org-Id', workspaceId);
504
518
  }
505
519
  headers.set('User-Agent', this.userAgent);
506
520
  const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
507
521
  const respBody = await executeHttpCall({
508
522
  request: httpReq,
509
- httpClient: this.httpClient,
523
+ httpClient,
510
524
  logger: this.logger,
511
525
  });
512
526
  resp = parseResponse(respBody, unmarshalRevertDashboardResponseSchema);
@@ -519,18 +533,19 @@ export class LakeviewClient {
519
533
  }
520
534
  /** Trash a dashboard. */
521
535
  async trashDashboard(req, options) {
522
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}`;
536
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
537
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}`;
523
538
  let resp;
524
539
  const call = async (callSignal) => {
525
540
  const headers = new Headers();
526
- if (this.workspaceId !== undefined) {
527
- headers.set('X-Databricks-Org-Id', this.workspaceId);
541
+ if (workspaceId !== undefined) {
542
+ headers.set('X-Databricks-Org-Id', workspaceId);
528
543
  }
529
544
  headers.set('User-Agent', this.userAgent);
530
545
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
531
546
  const respBody = await executeHttpCall({
532
547
  request: httpReq,
533
- httpClient: this.httpClient,
548
+ httpClient,
534
549
  logger: this.logger,
535
550
  });
536
551
  resp = parseResponse(respBody, unmarshalTrashDashboardResponseSchema);
@@ -543,18 +558,19 @@ export class LakeviewClient {
543
558
  }
544
559
  /** Unpublish the dashboard. */
545
560
  async unpublishDashboard(req, options) {
546
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published`;
561
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
562
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboardId ?? ''}/published`;
547
563
  let resp;
548
564
  const call = async (callSignal) => {
549
565
  const headers = new Headers();
550
- if (this.workspaceId !== undefined) {
551
- headers.set('X-Databricks-Org-Id', this.workspaceId);
566
+ if (workspaceId !== undefined) {
567
+ headers.set('X-Databricks-Org-Id', workspaceId);
552
568
  }
553
569
  headers.set('User-Agent', this.userAgent);
554
570
  const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
555
571
  const respBody = await executeHttpCall({
556
572
  request: httpReq,
557
- httpClient: this.httpClient,
573
+ httpClient,
558
574
  logger: this.logger,
559
575
  });
560
576
  resp = parseResponse(respBody, unmarshalUnpublishDashboardResponseSchema);
@@ -567,7 +583,8 @@ export class LakeviewClient {
567
583
  }
568
584
  /** Update a draft dashboard. */
569
585
  async updateDashboard(req, options) {
570
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.dashboard?.dashboardId ?? ''}`;
586
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
587
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.dashboard?.dashboardId ?? ''}`;
571
588
  const params = new URLSearchParams();
572
589
  if (req.datasetCatalog !== undefined) {
573
590
  params.append('dataset_catalog', req.datasetCatalog);
@@ -581,14 +598,14 @@ export class LakeviewClient {
581
598
  let resp;
582
599
  const call = async (callSignal) => {
583
600
  const headers = new Headers({ 'Content-Type': 'application/json' });
584
- if (this.workspaceId !== undefined) {
585
- headers.set('X-Databricks-Org-Id', this.workspaceId);
601
+ if (workspaceId !== undefined) {
602
+ headers.set('X-Databricks-Org-Id', workspaceId);
586
603
  }
587
604
  headers.set('User-Agent', this.userAgent);
588
605
  const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
589
606
  const respBody = await executeHttpCall({
590
607
  request: httpReq,
591
- httpClient: this.httpClient,
608
+ httpClient,
592
609
  logger: this.logger,
593
610
  });
594
611
  resp = parseResponse(respBody, unmarshalDashboardSchema);
@@ -601,19 +618,20 @@ export class LakeviewClient {
601
618
  }
602
619
  /** Update dashboard schedule. */
603
620
  async updateSchedule(req, options) {
604
- const url = `${this.host}/api/2.0/lakeview/dashboards/${req.schedule?.dashboardId ?? ''}/schedules/${req.schedule?.scheduleId ?? ''}`;
621
+ const { host, workspaceId, httpClient } = await this.resolveConfig();
622
+ const url = `${host}/api/2.0/lakeview/dashboards/${req.schedule?.dashboardId ?? ''}/schedules/${req.schedule?.scheduleId ?? ''}`;
605
623
  const body = marshalRequest(req.schedule, marshalScheduleSchema);
606
624
  let resp;
607
625
  const call = async (callSignal) => {
608
626
  const headers = new Headers({ 'Content-Type': 'application/json' });
609
- if (this.workspaceId !== undefined) {
610
- headers.set('X-Databricks-Org-Id', this.workspaceId);
627
+ if (workspaceId !== undefined) {
628
+ headers.set('X-Databricks-Org-Id', workspaceId);
611
629
  }
612
630
  headers.set('User-Agent', this.userAgent);
613
631
  const httpReq = buildHttpRequest('PUT', url, headers, callSignal, body);
614
632
  const respBody = await executeHttpCall({
615
633
  request: httpReq,
616
- httpClient: this.httpClient,
634
+ httpClient,
617
635
  logger: this.logger,
618
636
  });
619
637
  resp = parseResponse(respBody, unmarshalScheduleSchema);