@dynatrace-sdk/client-query 1.10.1 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js CHANGED
@@ -118,6 +118,8 @@ function serializeData(data) {
118
118
  function getMessagesFromErrorDetails(details) {
119
119
  const messages = [];
120
120
  Object.entries(details).forEach(([name, data]) => {
121
+ if (!data)
122
+ return;
121
123
  const serializedData = serializeData(data);
122
124
  switch (name) {
123
125
  case "missingScopes":
@@ -1333,10 +1335,10 @@ function isVerifyRequest(value) {
1333
1335
  if (Array.isArray(value)) {
1334
1336
  return false;
1335
1337
  }
1336
- const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions"]);
1338
+ const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions", "generateCanonicalQuery"]);
1337
1339
  const hasAdditionalProperties = false;
1338
1340
  const requiredKeys = ["query"];
1339
- const optionalKeys = ["timezone", "locale", "queryOptions"];
1341
+ const optionalKeys = ["timezone", "locale", "queryOptions", "generateCanonicalQuery"];
1340
1342
  const valKeys = new Set(Object.keys(value));
1341
1343
  const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1342
1344
  const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
@@ -1353,10 +1355,10 @@ function isJson18(value) {
1353
1355
  if (Array.isArray(value)) {
1354
1356
  return false;
1355
1357
  }
1356
- const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions"]);
1358
+ const modelKeys = /* @__PURE__ */ new Set(["query", "timezone", "locale", "queryOptions", "generateCanonicalQuery"]);
1357
1359
  const hasAdditionalProperties = false;
1358
1360
  const requiredKeys = ["query"];
1359
- const optionalKeys = ["timezone", "locale", "queryOptions"];
1361
+ const optionalKeys = ["timezone", "locale", "queryOptions", "generateCanonicalQuery"];
1360
1362
  const valKeys = new Set(Object.keys(value));
1361
1363
  const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1362
1364
  const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
@@ -1364,21 +1366,23 @@ function isJson18(value) {
1364
1366
  return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1365
1367
  }
1366
1368
  function fromJson18($model) {
1367
- const { query, timezone, locale, queryOptions } = $model;
1369
+ const { query, timezone, locale, queryOptions, generateCanonicalQuery } = $model;
1368
1370
  return {
1369
1371
  query,
1370
1372
  timezone,
1371
1373
  locale,
1372
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0
1374
+ queryOptions: queryOptions !== void 0 && queryOptions !== null ? fromJson(queryOptions) : void 0,
1375
+ generateCanonicalQuery
1373
1376
  };
1374
1377
  }
1375
1378
  function toJson18($model) {
1376
- const { query, timezone, locale, queryOptions } = $model;
1379
+ const { query, timezone, locale, queryOptions, generateCanonicalQuery } = $model;
1377
1380
  return {
1378
1381
  query,
1379
1382
  timezone,
1380
1383
  locale,
1381
- queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0
1384
+ queryOptions: queryOptions !== void 0 && queryOptions !== null ? toJson(queryOptions) : void 0,
1385
+ generateCanonicalQuery
1382
1386
  };
1383
1387
  }
1384
1388
 
@@ -1523,10 +1527,10 @@ function isVerifyResponse(value) {
1523
1527
  if (Array.isArray(value)) {
1524
1528
  return false;
1525
1529
  }
1526
- const modelKeys = /* @__PURE__ */ new Set(["valid", "notifications"]);
1530
+ const modelKeys = /* @__PURE__ */ new Set(["valid", "canonicalQuery", "notifications"]);
1527
1531
  const hasAdditionalProperties = false;
1528
1532
  const requiredKeys = ["valid"];
1529
- const optionalKeys = ["notifications"];
1533
+ const optionalKeys = ["canonicalQuery", "notifications"];
1530
1534
  const valKeys = new Set(Object.keys(value));
1531
1535
  const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1532
1536
  const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
@@ -1543,10 +1547,10 @@ function isJson20(value) {
1543
1547
  if (Array.isArray(value)) {
1544
1548
  return false;
1545
1549
  }
1546
- const modelKeys = /* @__PURE__ */ new Set(["valid", "notifications"]);
1550
+ const modelKeys = /* @__PURE__ */ new Set(["valid", "canonicalQuery", "notifications"]);
1547
1551
  const hasAdditionalProperties = false;
1548
1552
  const requiredKeys = ["valid"];
1549
- const optionalKeys = ["notifications"];
1553
+ const optionalKeys = ["canonicalQuery", "notifications"];
1550
1554
  const valKeys = new Set(Object.keys(value));
1551
1555
  const containsRequiredOrOptionalKeys = requiredKeys.length > 0 ? requiredKeys.every((reqKey) => valKeys.has(reqKey)) : optionalKeys.some((key) => valKeys.has(key)) || hasAdditionalProperties;
1552
1556
  const doesNotContainExtraKeys = [...valKeys].every((key) => modelKeys.has(key)) || hasAdditionalProperties;
@@ -1554,16 +1558,18 @@ function isJson20(value) {
1554
1558
  return containsRequiredOrOptionalKeys && doesNotContainExtraKeys && allPropertiesMatchFormat;
1555
1559
  }
1556
1560
  function fromJson20($model) {
1557
- const { valid, notifications } = $model;
1561
+ const { valid, canonicalQuery, notifications } = $model;
1558
1562
  return {
1559
1563
  valid,
1564
+ canonicalQuery,
1560
1565
  notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => fromJson19(innerValue)) : void 0
1561
1566
  };
1562
1567
  }
1563
1568
  function toJson20($model) {
1564
- const { valid, notifications } = $model;
1569
+ const { valid, canonicalQuery, notifications } = $model;
1565
1570
  return {
1566
1571
  valid,
1572
+ canonicalQuery,
1567
1573
  notifications: notifications !== void 0 && notifications !== null ? notifications?.map((innerValue) => toJson19(innerValue)) : void 0
1568
1574
  };
1569
1575
  }
@@ -1580,9 +1586,6 @@ var QueryAssistanceClient = class {
1580
1586
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
1581
1587
  }
1582
1588
  const encodedBody = toJson18(config.body);
1583
- const headerParameters = {
1584
- ...config.authorization !== void 0 && { Authorization: String(config.authorization) }
1585
- };
1586
1589
  try {
1587
1590
  const response = await this.httpClient.send({
1588
1591
  url: `/platform/storage/query/v1/query:verify`,
@@ -1591,8 +1594,7 @@ var QueryAssistanceClient = class {
1591
1594
  body: encodedBody,
1592
1595
  headers: {
1593
1596
  "Content-Type": "application/json",
1594
- Accept: "application/json",
1595
- ...headerParameters
1597
+ Accept: "application/json"
1596
1598
  },
1597
1599
  abortSignal: config.abortSignal,
1598
1600
  statusValidator: (status) => {
@@ -1625,7 +1627,7 @@ var QueryAssistanceClient = class {
1625
1627
  try {
1626
1628
  const errorBody = fromJson16(responseValue);
1627
1629
  throw new ErrorEnvelopeError(
1628
- "400",
1630
+ `400`,
1629
1631
  response,
1630
1632
  errorBody,
1631
1633
  getErrorMessage(errorBody, "The supplied request is wrong."),
@@ -1649,7 +1651,7 @@ var QueryAssistanceClient = class {
1649
1651
  try {
1650
1652
  const errorBody = fromJson16(responseValue);
1651
1653
  throw new ErrorEnvelopeError(
1652
- "500",
1654
+ `500`,
1653
1655
  response,
1654
1656
  errorBody,
1655
1657
  getErrorMessage(errorBody, "An internal server error has occurred."),
@@ -1686,9 +1688,6 @@ var QueryAssistanceClient = class {
1686
1688
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
1687
1689
  }
1688
1690
  const encodedBody = toJson17(config.body);
1689
- const headerParameters = {
1690
- ...config.authorization !== void 0 && { Authorization: String(config.authorization) }
1691
- };
1692
1691
  try {
1693
1692
  const response = await this.httpClient.send({
1694
1693
  url: `/platform/storage/query/v1/query:parse`,
@@ -1697,8 +1696,7 @@ var QueryAssistanceClient = class {
1697
1696
  body: encodedBody,
1698
1697
  headers: {
1699
1698
  "Content-Type": "application/json",
1700
- Accept: "application/json",
1701
- ...headerParameters
1699
+ Accept: "application/json"
1702
1700
  },
1703
1701
  abortSignal: config.abortSignal,
1704
1702
  statusValidator: (status) => {
@@ -1731,7 +1729,7 @@ var QueryAssistanceClient = class {
1731
1729
  try {
1732
1730
  const errorBody = fromJson16(responseValue);
1733
1731
  throw new ErrorEnvelopeError(
1734
- "400",
1732
+ `400`,
1735
1733
  response,
1736
1734
  errorBody,
1737
1735
  getErrorMessage(
@@ -1758,7 +1756,7 @@ var QueryAssistanceClient = class {
1758
1756
  try {
1759
1757
  const errorBody = fromJson16(responseValue);
1760
1758
  throw new ErrorEnvelopeError(
1761
- "500",
1759
+ `500`,
1762
1760
  response,
1763
1761
  errorBody,
1764
1762
  getErrorMessage(errorBody, "An internal server error has occurred."),
@@ -1795,9 +1793,6 @@ var QueryAssistanceClient = class {
1795
1793
  throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
1796
1794
  }
1797
1795
  const encodedBody = toJson2(config.body);
1798
- const headerParameters = {
1799
- ...config.authorization !== void 0 && { Authorization: String(config.authorization) }
1800
- };
1801
1796
  try {
1802
1797
  const response = await this.httpClient.send({
1803
1798
  url: `/platform/storage/query/v1/query:autocomplete`,
@@ -1806,8 +1801,7 @@ var QueryAssistanceClient = class {
1806
1801
  body: encodedBody,
1807
1802
  headers: {
1808
1803
  "Content-Type": "application/json",
1809
- Accept: "application/json",
1810
- ...headerParameters
1804
+ Accept: "application/json"
1811
1805
  },
1812
1806
  abortSignal: config.abortSignal,
1813
1807
  statusValidator: (status) => {
@@ -1840,7 +1834,7 @@ var QueryAssistanceClient = class {
1840
1834
  try {
1841
1835
  const errorBody = fromJson16(responseValue);
1842
1836
  throw new ErrorEnvelopeError(
1843
- "400",
1837
+ `400`,
1844
1838
  response,
1845
1839
  errorBody,
1846
1840
  getErrorMessage(
@@ -1867,7 +1861,7 @@ var QueryAssistanceClient = class {
1867
1861
  try {
1868
1862
  const errorBody = fromJson16(responseValue);
1869
1863
  throw new ErrorEnvelopeError(
1870
- "500",
1864
+ `500`,
1871
1865
  response,
1872
1866
  errorBody,
1873
1867
  getErrorMessage(errorBody, "An internal server error has occurred."),
@@ -3287,7 +3281,7 @@ var QueryExecutionClient = class {
3287
3281
  try {
3288
3282
  const errorBody = fromJson16(responseValue);
3289
3283
  throw new ErrorEnvelopeError(
3290
- "400",
3284
+ `400`,
3291
3285
  response,
3292
3286
  errorBody,
3293
3287
  getErrorMessage(
@@ -3323,7 +3317,7 @@ var QueryExecutionClient = class {
3323
3317
  try {
3324
3318
  const errorBody = fromJson16(responseValue);
3325
3319
  throw new ErrorEnvelopeError(
3326
- "500",
3320
+ `500`,
3327
3321
  response,
3328
3322
  errorBody,
3329
3323
  getErrorMessage(errorBody, "An internal server error has occurred."),
@@ -3361,9 +3355,6 @@ var QueryExecutionClient = class {
3361
3355
  }
3362
3356
  const encodedBody = toJson21(config.body);
3363
3357
  const query = toQueryString({ enrich: config.enrich });
3364
- const headerParameters = {
3365
- ...config.authorization !== void 0 && { Authorization: String(config.authorization) }
3366
- };
3367
3358
  try {
3368
3359
  const response = await this.httpClient.send({
3369
3360
  url: `/platform/storage/query/v1/query:execute${query}`,
@@ -3372,8 +3363,7 @@ var QueryExecutionClient = class {
3372
3363
  body: encodedBody,
3373
3364
  headers: {
3374
3365
  "Content-Type": "application/json",
3375
- Accept: "application/json",
3376
- ...headerParameters
3366
+ Accept: "application/json"
3377
3367
  },
3378
3368
  abortSignal: config.abortSignal,
3379
3369
  statusValidator: (status) => {
@@ -3433,7 +3423,7 @@ var QueryExecutionClient = class {
3433
3423
  try {
3434
3424
  const errorBody = fromJson16(responseValue);
3435
3425
  throw new ErrorEnvelopeError(
3436
- "400",
3426
+ `400`,
3437
3427
  response,
3438
3428
  errorBody,
3439
3429
  getErrorMessage(
@@ -3460,7 +3450,7 @@ var QueryExecutionClient = class {
3460
3450
  try {
3461
3451
  const errorBody = fromJson16(responseValue);
3462
3452
  throw new ErrorEnvelopeError(
3463
- "403",
3453
+ `403`,
3464
3454
  response,
3465
3455
  errorBody,
3466
3456
  getErrorMessage(errorBody, "Insufficient permissions."),
@@ -3484,7 +3474,7 @@ var QueryExecutionClient = class {
3484
3474
  try {
3485
3475
  const errorBody = fromJson16(responseValue);
3486
3476
  throw new ErrorEnvelopeError(
3487
- "429",
3477
+ `429`,
3488
3478
  response,
3489
3479
  errorBody,
3490
3480
  getErrorMessage(errorBody, "Too many requests."),
@@ -3508,7 +3498,7 @@ var QueryExecutionClient = class {
3508
3498
  try {
3509
3499
  const errorBody = fromJson16(responseValue);
3510
3500
  throw new ErrorEnvelopeError(
3511
- "500",
3501
+ `500`,
3512
3502
  response,
3513
3503
  errorBody,
3514
3504
  getErrorMessage(errorBody, "An internal server error has occurred."),
@@ -3532,7 +3522,7 @@ var QueryExecutionClient = class {
3532
3522
  try {
3533
3523
  const errorBody = fromJson16(responseValue);
3534
3524
  throw new ErrorEnvelopeError(
3535
- "503",
3525
+ `503`,
3536
3526
  response,
3537
3527
  errorBody,
3538
3528
  getErrorMessage(errorBody, "Service is unavailable."),
@@ -3556,13 +3546,19 @@ var QueryExecutionClient = class {
3556
3546
  const responseValue = await response.body("json");
3557
3547
  try {
3558
3548
  const errorBody = fromJson16(responseValue);
3559
- throw new ErrorEnvelopeError("4XX", response, errorBody, getErrorMessage(errorBody, "Client error."), e);
3549
+ throw new ErrorEnvelopeError(
3550
+ `${response.status}`,
3551
+ response,
3552
+ errorBody,
3553
+ getErrorMessage(errorBody, "Client error."),
3554
+ e
3555
+ );
3560
3556
  } catch (err) {
3561
3557
  if (err instanceof ErrorEnvelopeError) {
3562
3558
  throw err;
3563
3559
  }
3564
3560
  throw new InvalidResponseError(
3565
- `QueryExecutionClient.query:execute:4XX`,
3561
+ `QueryExecutionClient.query:execute:${response.status}`,
3566
3562
  err,
3567
3563
  responseValue,
3568
3564
  "ErrorEnvelope",
@@ -3573,13 +3569,19 @@ var QueryExecutionClient = class {
3573
3569
  const responseValue = await response.body("json");
3574
3570
  try {
3575
3571
  const errorBody = fromJson16(responseValue);
3576
- throw new ErrorEnvelopeError("5XX", response, errorBody, getErrorMessage(errorBody, "Server error."), e);
3572
+ throw new ErrorEnvelopeError(
3573
+ `${response.status}`,
3574
+ response,
3575
+ errorBody,
3576
+ getErrorMessage(errorBody, "Server error."),
3577
+ e
3578
+ );
3577
3579
  } catch (err) {
3578
3580
  if (err instanceof ErrorEnvelopeError) {
3579
3581
  throw err;
3580
3582
  }
3581
3583
  throw new InvalidResponseError(
3582
- `QueryExecutionClient.query:execute:5XX`,
3584
+ `QueryExecutionClient.query:execute:${response.status}`,
3583
3585
  err,
3584
3586
  responseValue,
3585
3587
  "ErrorEnvelope",
@@ -3664,7 +3666,7 @@ var QueryExecutionClient = class {
3664
3666
  try {
3665
3667
  const errorBody = fromJson16(responseValue);
3666
3668
  throw new ErrorEnvelopeError(
3667
- "400",
3669
+ `400`,
3668
3670
  response,
3669
3671
  errorBody,
3670
3672
  getErrorMessage(
@@ -3700,7 +3702,7 @@ var QueryExecutionClient = class {
3700
3702
  try {
3701
3703
  const errorBody = fromJson16(responseValue);
3702
3704
  throw new ErrorEnvelopeError(
3703
- "500",
3705
+ `500`,
3704
3706
  response,
3705
3707
  errorBody,
3706
3708
  getErrorMessage(errorBody, "An internal server error has occurred."),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace-sdk/client-query",
3
- "version": "1.10.1",
3
+ "version": "1.11.0",
4
4
  "description": "Exposes an API to fetch records stored in Grail.",
5
5
  "license": "Apache-2.0",
6
6
  "dependencies": {
@@ -40,7 +40,6 @@ export declare class QueryAssistanceClient {
40
40
  */
41
41
  queryVerify(config: {
42
42
  body: VerifyRequest;
43
- /** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
44
43
  abortSignal?: AbortSignal;
45
44
  }): Promise<VerifyResponse>;
46
45
  /**
@@ -252,7 +251,6 @@ export declare class QueryAssistanceClient {
252
251
  */
253
252
  queryParse(config: {
254
253
  body: ParseRequest;
255
- /** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
256
254
  abortSignal?: AbortSignal;
257
255
  }): Promise<DQLNode>;
258
256
  /**
@@ -308,7 +306,6 @@ export declare class QueryAssistanceClient {
308
306
  */
309
307
  queryAutocomplete(config: {
310
308
  body: AutocompleteRequest;
311
- /** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
312
309
  abortSignal?: AbortSignal;
313
310
  }): Promise<AutocompleteResponse>;
314
311
  }
@@ -118,7 +118,6 @@ export declare class QueryExecutionClient {
118
118
  queryExecute(config: {
119
119
  body: ExecuteRequest;
120
120
  /** If set additional data will be available in the metadata section. */ enrich?: string;
121
- /** The authorization context. Typically start with 'Bearer '. */ authorization?: string;
122
121
  abortSignal?: AbortSignal;
123
122
  }): Promise<QueryStartResponse>;
124
123
  /**
@@ -5,11 +5,11 @@ export interface ExecuteRequest {
5
5
  */
6
6
  query: string;
7
7
  /**
8
- * The query timeframe 'start' timestamp in ISO-8601 or RFC399 format. If the timeframe 'end' parameter is missing, the whole timeframe is ignored. <em>Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.</em>
8
+ * The query timeframe 'start' timestamp in ISO-8601 or RFC3339 format. If the timeframe 'end' parameter is missing, the whole timeframe is ignored. <em>Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.</em>
9
9
  */
10
10
  defaultTimeframeStart?: string;
11
11
  /**
12
- * The query timeframe 'end' timestamp in ISO-8601 or RFC399 format. If the timeframe 'start' parameter is missing, the whole timeframe is ignored. <em>Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.</em>
12
+ * The query timeframe 'end' timestamp in ISO-8601 or RFC3339 format. If the timeframe 'start' parameter is missing, the whole timeframe is ignored. <em>Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.</em>
13
13
  */
14
14
  defaultTimeframeEnd?: string;
15
15
  /**
@@ -13,4 +13,5 @@ export interface VerifyRequest {
13
13
  */
14
14
  locale?: string;
15
15
  queryOptions?: QueryOptions;
16
+ generateCanonicalQuery?: boolean;
16
17
  }
@@ -5,6 +5,7 @@ export interface AsJson {
5
5
  timezone?: string;
6
6
  locale?: string;
7
7
  queryOptions?: _QueryOptionsTransformation.AsJson;
8
+ generateCanonicalQuery?: boolean;
8
9
  }
9
10
  export declare function isVerifyRequest(value: any): value is VerifyRequest;
10
11
  export declare function isJson(value: any): value is AsJson;
@@ -7,6 +7,7 @@ export interface VerifyResponse {
7
7
  * True if the supplied DQL query string is valid.
8
8
  */
9
9
  valid: boolean;
10
+ canonicalQuery?: string;
10
11
  /**
11
12
  * The notifications related to the supplied DQL query string.
12
13
  */
@@ -2,6 +2,7 @@ import * as _MetadataNotificationTransformation from './metadata-notification.tr
2
2
  import { VerifyResponse } from './verify-response';
3
3
  export interface AsJson {
4
4
  valid: boolean;
5
+ canonicalQuery?: string;
5
6
  notifications?: _MetadataNotificationTransformation.AsJson[];
6
7
  }
7
8
  export declare function isVerifyResponse(value: any): value is VerifyResponse;
@@ -1,2 +1,2 @@
1
1
  export { AbortController, AbortSignal, BaseError, Binary, BinaryFormDataRequestField, BinaryFormDataResponseField, DataTypeError, DataTypes, FormDataRequestBody, FormDataRequestField, FormDataResponseBody, FormDataResponseField, Headers, HttpClient, HttpClientAbortError, HttpClientNetworkError, HttpClientRequestError, HttpClientRequestOptions, HttpClientResponse, HttpClientResponseError, JsonFormDataRequestField, RequestBodyTypes, ResponseBodyTypes, StatusValidator, TextFormDataRequestField, TextFormDataResponseField, UnsupportedOperationError, isHttpClientResponseError, isHttpClientAbortError, isHttpClientNetworkError, isHttpClientRequestError, } from './lib/types';
2
- export { AbortController as PlatformAbortController, AbortSignal as PlatformAbortSignal, BaseError as PlatformBaseError, Binary as PlatformBinary, DataTypeError as PlatformDataTypeError, HttpClient as PlatformHttpClient, HttpClientAbortError as PlatformHttpClientAbortError, HttpClientRequestError as PlatformHttpClientRequestError, HttpClientResponse as PlatformHttpClientResponse, HttpClientResponseError as PlatformHttpClientResponseError, UnsupportedOperationError as PlatformUnsupportedOperationError, httpClient, } from './lib/platform';
2
+ export { AbortController as PlatformAbortController, AbortSignal as PlatformAbortSignal, BaseError as PlatformBaseError, Binary as PlatformBinary, DataTypeError as PlatformDataTypeError, HttpClient as PlatformHttpClient, HttpClientAbortError as PlatformHttpClientAbortError, HttpClientRequestError as PlatformHttpClientRequestError, HttpClientResponse as PlatformHttpClientResponse, HttpClientResponseError as PlatformHttpClientResponseError, OAuthHttpClient as _OAuthHttpClient, OAuthHttpClientConfig as _OAuthHttpClientConfig, UnsupportedOperationError as PlatformUnsupportedOperationError, httpClient, } from './lib/platform';
@@ -1,5 +1,16 @@
1
1
  import * as types from '../types';
2
+ interface HttpClientConfiguration {
3
+ baseUrl?: string;
4
+ }
2
5
  export declare class HttpClient implements types.HttpClient {
6
+ private _baseUrl;
7
+ constructor(options?: HttpClientConfiguration);
8
+ /**
9
+ * Sets HTTP Client Instance baseUrl param to the incoming value `baseUrl`.
10
+ * @param baseUrl Base URL used in the request path.
11
+ */
12
+ _setBaseURL(baseUrl: string): void;
3
13
  send<T extends keyof types.RequestBodyTypes = 'json'>(options: types.HttpClientRequestOptions<T>): Promise<types.HttpClientResponse>;
4
14
  }
5
15
  export declare const httpClient: HttpClient;
16
+ export {};
@@ -8,4 +8,5 @@ export * from './http-client-abort-error';
8
8
  export * from './http-client-request-error';
9
9
  export * from './http-client-response';
10
10
  export * from './http-client-response-error';
11
+ export * from './oauth-http-client';
11
12
  export * from './unsupported-operation-error';
@@ -0,0 +1,41 @@
1
+ import * as types from '../types';
2
+ /**
3
+ * DO NOT USE - internal use only.
4
+ */
5
+ export interface OAuthHttpClientConfig {
6
+ clientId: string;
7
+ secret: string;
8
+ scopes: string[];
9
+ environmentUrl: string;
10
+ authUrl: string;
11
+ }
12
+ export interface OAuthTokenResponse {
13
+ scope: string;
14
+ token_type: string;
15
+ expires_in: number;
16
+ access_token: string;
17
+ }
18
+ /**
19
+ * DO NOT USE - internal use only.
20
+ */
21
+ export declare class OAuthToken {
22
+ private readonly _scope;
23
+ private readonly _tokenType;
24
+ private readonly _expirationDate;
25
+ private readonly _accessToken;
26
+ constructor(oauthTokenResponse: OAuthTokenResponse);
27
+ get scope(): string;
28
+ get tokenType(): string;
29
+ isExpired(): boolean;
30
+ get accessToken(): string;
31
+ }
32
+ /**
33
+ * DO NOT USE - internal use only.
34
+ */
35
+ export declare class OAuthHttpClient implements types.HttpClient {
36
+ private readonly config;
37
+ private oauthToken?;
38
+ constructor(config: OAuthHttpClientConfig);
39
+ send<T extends keyof types.RequestBodyTypes = 'json'>(options: types.HttpClientRequestOptions<T>): Promise<types.HttpClientResponse>;
40
+ private requestToken;
41
+ }