@paid-ai/paid-node 1.0.0 → 1.0.1-alpha0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/cjs/BaseClient.d.ts +4 -17
  2. package/dist/cjs/BaseClient.js +0 -59
  3. package/dist/cjs/Client.d.ts +28 -28
  4. package/dist/cjs/Client.js +52 -11
  5. package/dist/cjs/api/errors/BadRequestError.js +1 -5
  6. package/dist/cjs/api/errors/ForbiddenError.js +1 -5
  7. package/dist/cjs/api/errors/InternalServerError.js +1 -5
  8. package/dist/cjs/api/errors/NotFoundError.js +1 -5
  9. package/dist/cjs/api/resources/agents/client/Client.d.ts +23 -22
  10. package/dist/cjs/api/resources/agents/client/Client.js +158 -55
  11. package/dist/cjs/api/resources/contacts/client/Client.d.ts +19 -18
  12. package/dist/cjs/api/resources/contacts/client/Client.js +122 -43
  13. package/dist/cjs/api/resources/customers/client/Client.d.ts +37 -36
  14. package/dist/cjs/api/resources/customers/client/Client.js +315 -113
  15. package/dist/cjs/api/resources/orders/client/Client.d.ts +28 -27
  16. package/dist/cjs/api/resources/orders/client/Client.js +177 -62
  17. package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +9 -8
  18. package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +32 -13
  19. package/dist/cjs/api/resources/plans/client/Client.d.ts +13 -12
  20. package/dist/cjs/api/resources/plans/client/Client.js +82 -32
  21. package/dist/cjs/api/resources/products/client/Client.d.ts +23 -22
  22. package/dist/cjs/api/resources/products/client/Client.js +158 -55
  23. package/dist/cjs/api/resources/products/client/requests/index.d.ts +1 -1
  24. package/dist/cjs/api/resources/products/client/requests/index.js +0 -3
  25. package/dist/cjs/api/resources/traces/client/Client.d.ts +9 -8
  26. package/dist/cjs/api/resources/traces/client/Client.js +57 -23
  27. package/dist/cjs/api/resources/usage/client/Client.d.ts +13 -12
  28. package/dist/cjs/api/resources/usage/client/Client.js +68 -25
  29. package/dist/cjs/core/auth/AuthProvider.d.ts +1 -4
  30. package/dist/cjs/core/auth/BearerToken.d.ts +1 -3
  31. package/dist/cjs/core/auth/BearerToken.js +6 -7
  32. package/dist/cjs/core/auth/index.d.ts +0 -1
  33. package/dist/cjs/core/auth/index.js +1 -3
  34. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +7 -6
  35. package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
  36. package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -10
  37. package/dist/cjs/core/fetcher/Fetcher.js +10 -204
  38. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +4 -0
  39. package/dist/cjs/core/fetcher/ResponseWithBody.js +6 -0
  40. package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
  41. package/dist/cjs/core/fetcher/getRequestBody.js +0 -4
  42. package/dist/cjs/core/fetcher/getResponseBody.js +4 -18
  43. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
  44. package/dist/cjs/core/fetcher/makeRequest.js +2 -0
  45. package/dist/cjs/core/fetcher/requestWithRetries.js +9 -0
  46. package/dist/cjs/core/fetcher/signals.d.ts +7 -1
  47. package/dist/cjs/core/fetcher/signals.js +12 -0
  48. package/dist/cjs/core/headers.d.ts +2 -2
  49. package/dist/cjs/core/headers.js +4 -6
  50. package/dist/cjs/core/index.d.ts +0 -1
  51. package/dist/cjs/core/index.js +1 -2
  52. package/dist/cjs/core/runtime/runtime.js +10 -11
  53. package/dist/cjs/core/url/join.js +1 -0
  54. package/dist/cjs/errors/PaidError.js +1 -5
  55. package/dist/cjs/errors/PaidTimeoutError.js +1 -5
  56. package/dist/cjs/index.d.ts +0 -1
  57. package/dist/cjs/index.js +0 -4
  58. package/dist/cjs/version.d.ts +1 -1
  59. package/dist/cjs/version.js +1 -1
  60. package/dist/esm/BaseClient.d.mts +4 -17
  61. package/dist/esm/BaseClient.mjs +1 -24
  62. package/dist/esm/Client.d.mts +28 -28
  63. package/dist/esm/Client.mjs +27 -19
  64. package/dist/esm/api/errors/BadRequestError.mjs +1 -5
  65. package/dist/esm/api/errors/ForbiddenError.mjs +1 -5
  66. package/dist/esm/api/errors/InternalServerError.mjs +1 -5
  67. package/dist/esm/api/errors/NotFoundError.mjs +1 -5
  68. package/dist/esm/api/resources/agents/client/Client.d.mts +23 -22
  69. package/dist/esm/api/resources/agents/client/Client.mjs +157 -54
  70. package/dist/esm/api/resources/contacts/client/Client.d.mts +19 -18
  71. package/dist/esm/api/resources/contacts/client/Client.mjs +121 -42
  72. package/dist/esm/api/resources/customers/client/Client.d.mts +37 -36
  73. package/dist/esm/api/resources/customers/client/Client.mjs +314 -112
  74. package/dist/esm/api/resources/orders/client/Client.d.mts +28 -27
  75. package/dist/esm/api/resources/orders/client/Client.mjs +177 -62
  76. package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +9 -8
  77. package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +31 -12
  78. package/dist/esm/api/resources/plans/client/Client.d.mts +13 -12
  79. package/dist/esm/api/resources/plans/client/Client.mjs +81 -31
  80. package/dist/esm/api/resources/products/client/Client.d.mts +23 -22
  81. package/dist/esm/api/resources/products/client/Client.mjs +157 -54
  82. package/dist/esm/api/resources/products/client/requests/index.d.mts +1 -1
  83. package/dist/esm/api/resources/products/client/requests/index.mjs +1 -1
  84. package/dist/esm/api/resources/traces/client/Client.d.mts +9 -8
  85. package/dist/esm/api/resources/traces/client/Client.mjs +56 -22
  86. package/dist/esm/api/resources/usage/client/Client.d.mts +13 -12
  87. package/dist/esm/api/resources/usage/client/Client.mjs +67 -24
  88. package/dist/esm/core/auth/AuthProvider.d.mts +1 -4
  89. package/dist/esm/core/auth/BearerToken.d.mts +1 -3
  90. package/dist/esm/core/auth/BearerToken.mjs +6 -7
  91. package/dist/esm/core/auth/index.d.mts +0 -1
  92. package/dist/esm/core/auth/index.mjs +0 -1
  93. package/dist/esm/core/fetcher/BinaryResponse.d.mts +7 -6
  94. package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
  95. package/dist/esm/core/fetcher/Fetcher.d.mts +4 -10
  96. package/dist/esm/core/fetcher/Fetcher.mjs +10 -204
  97. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +4 -0
  98. package/dist/esm/core/fetcher/ResponseWithBody.mjs +3 -0
  99. package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
  100. package/dist/esm/core/fetcher/getRequestBody.mjs +0 -4
  101. package/dist/esm/core/fetcher/getResponseBody.mjs +4 -18
  102. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
  103. package/dist/esm/core/fetcher/makeRequest.mjs +2 -0
  104. package/dist/esm/core/fetcher/requestWithRetries.mjs +9 -0
  105. package/dist/esm/core/fetcher/signals.d.mts +7 -1
  106. package/dist/esm/core/fetcher/signals.mjs +12 -0
  107. package/dist/esm/core/headers.d.mts +2 -2
  108. package/dist/esm/core/headers.mjs +4 -6
  109. package/dist/esm/core/index.d.mts +0 -1
  110. package/dist/esm/core/index.mjs +0 -1
  111. package/dist/esm/core/runtime/runtime.mjs +10 -11
  112. package/dist/esm/core/url/join.mjs +1 -0
  113. package/dist/esm/errors/PaidError.mjs +1 -5
  114. package/dist/esm/errors/PaidTimeoutError.mjs +1 -5
  115. package/dist/esm/index.d.mts +0 -1
  116. package/dist/esm/index.mjs +0 -1
  117. package/dist/esm/version.d.mts +1 -1
  118. package/dist/esm/version.mjs +1 -1
  119. package/package.json +3 -6
  120. package/reference.md +54 -54
  121. package/dist/cjs/auth/BearerAuthProvider.d.ts +0 -20
  122. package/dist/cjs/auth/BearerAuthProvider.js +0 -79
  123. package/dist/cjs/auth/index.d.ts +0 -1
  124. package/dist/cjs/auth/index.js +0 -5
  125. package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +0 -5
  126. package/dist/cjs/core/auth/NoOpAuthProvider.js +0 -9
  127. package/dist/cjs/core/exports.d.ts +0 -1
  128. package/dist/cjs/core/exports.js +0 -17
  129. package/dist/cjs/core/logging/exports.d.ts +0 -18
  130. package/dist/cjs/core/logging/exports.js +0 -45
  131. package/dist/cjs/core/logging/index.d.ts +0 -1
  132. package/dist/cjs/core/logging/index.js +0 -17
  133. package/dist/cjs/core/logging/logger.d.ts +0 -126
  134. package/dist/cjs/core/logging/logger.js +0 -144
  135. package/dist/cjs/errors/handleNonStatusCodeError.d.ts +0 -2
  136. package/dist/cjs/errors/handleNonStatusCodeError.js +0 -65
  137. package/dist/cjs/exports.d.ts +0 -1
  138. package/dist/cjs/exports.js +0 -17
  139. package/dist/esm/auth/BearerAuthProvider.d.mts +0 -20
  140. package/dist/esm/auth/BearerAuthProvider.mjs +0 -42
  141. package/dist/esm/auth/index.d.mts +0 -1
  142. package/dist/esm/auth/index.mjs +0 -1
  143. package/dist/esm/core/auth/NoOpAuthProvider.d.mts +0 -5
  144. package/dist/esm/core/auth/NoOpAuthProvider.mjs +0 -5
  145. package/dist/esm/core/exports.d.mts +0 -1
  146. package/dist/esm/core/exports.mjs +0 -1
  147. package/dist/esm/core/logging/exports.d.mts +0 -18
  148. package/dist/esm/core/logging/exports.mjs +0 -9
  149. package/dist/esm/core/logging/index.d.mts +0 -1
  150. package/dist/esm/core/logging/index.mjs +0 -1
  151. package/dist/esm/core/logging/logger.d.mts +0 -126
  152. package/dist/esm/core/logging/logger.mjs +0 -138
  153. package/dist/esm/errors/handleNonStatusCodeError.d.mts +0 -2
  154. package/dist/esm/errors/handleNonStatusCodeError.mjs +0 -29
  155. package/dist/esm/exports.d.mts +0 -1
  156. package/dist/esm/exports.mjs +0 -1
@@ -43,19 +43,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  });
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.ProductsClient = void 0;
47
- const BaseClient_js_1 = require("../../../../BaseClient.js");
46
+ exports.Products = void 0;
48
47
  const headers_js_1 = require("../../../../core/headers.js");
49
48
  const core = __importStar(require("../../../../core/index.js"));
50
49
  const environments = __importStar(require("../../../../environments.js"));
51
- const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
50
  const errors = __importStar(require("../../../../errors/index.js"));
53
- class ProductsClient {
54
- constructor(options = {}) {
55
- this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
51
+ class Products {
52
+ constructor(_options = {}) {
53
+ this._options = _options;
56
54
  }
57
55
  /**
58
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
56
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
59
57
  *
60
58
  * @example
61
59
  * await client.products.list()
@@ -65,8 +63,8 @@ class ProductsClient {
65
63
  }
66
64
  __list(requestOptions) {
67
65
  return __awaiter(this, void 0, void 0, function* () {
68
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
69
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
66
+ var _a, _b, _c, _d, _e, _f, _g, _h;
67
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
70
68
  const _response = yield core.fetcher({
71
69
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, "products"),
72
70
  method: "GET",
@@ -75,8 +73,6 @@ class ProductsClient {
75
73
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
76
74
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
77
75
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
78
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
79
- logging: this._options.logging,
80
76
  });
81
77
  if (_response.ok) {
82
78
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -88,12 +84,26 @@ class ProductsClient {
88
84
  rawResponse: _response.rawResponse,
89
85
  });
90
86
  }
91
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/products");
87
+ switch (_response.error.reason) {
88
+ case "non-json":
89
+ throw new errors.PaidError({
90
+ statusCode: _response.error.statusCode,
91
+ body: _response.error.rawBody,
92
+ rawResponse: _response.rawResponse,
93
+ });
94
+ case "timeout":
95
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products.");
96
+ case "unknown":
97
+ throw new errors.PaidError({
98
+ message: _response.error.errorMessage,
99
+ rawResponse: _response.rawResponse,
100
+ });
101
+ }
92
102
  });
93
103
  }
94
104
  /**
95
105
  * @param {Paid.ProductCreate} request
96
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
106
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
97
107
  *
98
108
  * @example
99
109
  * await client.products.create({
@@ -108,8 +118,8 @@ class ProductsClient {
108
118
  }
109
119
  __create(request, requestOptions) {
110
120
  return __awaiter(this, void 0, void 0, function* () {
111
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
112
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
121
+ var _a, _b, _c, _d, _e, _f, _g, _h;
122
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
113
123
  const _response = yield core.fetcher({
114
124
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, "products"),
115
125
  method: "POST",
@@ -121,8 +131,6 @@ class ProductsClient {
121
131
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
122
132
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
123
133
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
124
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
125
- logging: this._options.logging,
126
134
  });
127
135
  if (_response.ok) {
128
136
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -134,12 +142,26 @@ class ProductsClient {
134
142
  rawResponse: _response.rawResponse,
135
143
  });
136
144
  }
137
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/products");
145
+ switch (_response.error.reason) {
146
+ case "non-json":
147
+ throw new errors.PaidError({
148
+ statusCode: _response.error.statusCode,
149
+ body: _response.error.rawBody,
150
+ rawResponse: _response.rawResponse,
151
+ });
152
+ case "timeout":
153
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /products.");
154
+ case "unknown":
155
+ throw new errors.PaidError({
156
+ message: _response.error.errorMessage,
157
+ rawResponse: _response.rawResponse,
158
+ });
159
+ }
138
160
  });
139
161
  }
140
162
  /**
141
163
  * @param {string} productId
142
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
164
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
143
165
  *
144
166
  * @example
145
167
  * await client.products.get("productId")
@@ -149,8 +171,8 @@ class ProductsClient {
149
171
  }
150
172
  __get(productId, requestOptions) {
151
173
  return __awaiter(this, void 0, void 0, function* () {
152
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
153
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
174
+ var _a, _b, _c, _d, _e, _f, _g, _h;
175
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
154
176
  const _response = yield core.fetcher({
155
177
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `products/${core.url.encodePathParam(productId)}`),
156
178
  method: "GET",
@@ -159,8 +181,6 @@ class ProductsClient {
159
181
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
160
182
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
161
183
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
162
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
163
- logging: this._options.logging,
164
184
  });
165
185
  if (_response.ok) {
166
186
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -172,13 +192,27 @@ class ProductsClient {
172
192
  rawResponse: _response.rawResponse,
173
193
  });
174
194
  }
175
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/products/{productId}");
195
+ switch (_response.error.reason) {
196
+ case "non-json":
197
+ throw new errors.PaidError({
198
+ statusCode: _response.error.statusCode,
199
+ body: _response.error.rawBody,
200
+ rawResponse: _response.rawResponse,
201
+ });
202
+ case "timeout":
203
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products/{productId}.");
204
+ case "unknown":
205
+ throw new errors.PaidError({
206
+ message: _response.error.errorMessage,
207
+ rawResponse: _response.rawResponse,
208
+ });
209
+ }
176
210
  });
177
211
  }
178
212
  /**
179
213
  * @param {string} productId
180
214
  * @param {Paid.ProductUpdate} request
181
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
215
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
182
216
  *
183
217
  * @example
184
218
  * await client.products.update("productId", {})
@@ -188,8 +222,8 @@ class ProductsClient {
188
222
  }
189
223
  __update(productId, request, requestOptions) {
190
224
  return __awaiter(this, void 0, void 0, function* () {
191
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
192
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
225
+ var _a, _b, _c, _d, _e, _f, _g, _h;
226
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
193
227
  const _response = yield core.fetcher({
194
228
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `products/${core.url.encodePathParam(productId)}`),
195
229
  method: "PUT",
@@ -201,8 +235,6 @@ class ProductsClient {
201
235
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
202
236
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
203
237
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
204
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
205
- logging: this._options.logging,
206
238
  });
207
239
  if (_response.ok) {
208
240
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -214,12 +246,26 @@ class ProductsClient {
214
246
  rawResponse: _response.rawResponse,
215
247
  });
216
248
  }
217
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/products/{productId}");
249
+ switch (_response.error.reason) {
250
+ case "non-json":
251
+ throw new errors.PaidError({
252
+ statusCode: _response.error.statusCode,
253
+ body: _response.error.rawBody,
254
+ rawResponse: _response.rawResponse,
255
+ });
256
+ case "timeout":
257
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /products/{productId}.");
258
+ case "unknown":
259
+ throw new errors.PaidError({
260
+ message: _response.error.errorMessage,
261
+ rawResponse: _response.rawResponse,
262
+ });
263
+ }
218
264
  });
219
265
  }
220
266
  /**
221
267
  * @param {string} productId
222
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
268
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
223
269
  *
224
270
  * @example
225
271
  * await client.products.delete("productId")
@@ -229,8 +275,8 @@ class ProductsClient {
229
275
  }
230
276
  __delete(productId, requestOptions) {
231
277
  return __awaiter(this, void 0, void 0, function* () {
232
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
233
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
278
+ var _a, _b, _c, _d, _e, _f, _g, _h;
279
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
234
280
  const _response = yield core.fetcher({
235
281
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `products/${core.url.encodePathParam(productId)}`),
236
282
  method: "DELETE",
@@ -239,8 +285,6 @@ class ProductsClient {
239
285
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
240
286
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
241
287
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
242
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
243
- logging: this._options.logging,
244
288
  });
245
289
  if (_response.ok) {
246
290
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -252,12 +296,26 @@ class ProductsClient {
252
296
  rawResponse: _response.rawResponse,
253
297
  });
254
298
  }
255
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/products/{productId}");
299
+ switch (_response.error.reason) {
300
+ case "non-json":
301
+ throw new errors.PaidError({
302
+ statusCode: _response.error.statusCode,
303
+ body: _response.error.rawBody,
304
+ rawResponse: _response.rawResponse,
305
+ });
306
+ case "timeout":
307
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /products/{productId}.");
308
+ case "unknown":
309
+ throw new errors.PaidError({
310
+ message: _response.error.errorMessage,
311
+ rawResponse: _response.rawResponse,
312
+ });
313
+ }
256
314
  });
257
315
  }
258
316
  /**
259
317
  * @param {string} externalId
260
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
318
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
261
319
  *
262
320
  * @example
263
321
  * await client.products.getByExternalId("externalId")
@@ -267,8 +325,8 @@ class ProductsClient {
267
325
  }
268
326
  __getByExternalId(externalId, requestOptions) {
269
327
  return __awaiter(this, void 0, void 0, function* () {
270
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
271
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
328
+ var _a, _b, _c, _d, _e, _f, _g, _h;
329
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
272
330
  const _response = yield core.fetcher({
273
331
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `products/external/${core.url.encodePathParam(externalId)}`),
274
332
  method: "GET",
@@ -277,8 +335,6 @@ class ProductsClient {
277
335
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
278
336
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
279
337
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
280
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
281
- logging: this._options.logging,
282
338
  });
283
339
  if (_response.ok) {
284
340
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -290,13 +346,27 @@ class ProductsClient {
290
346
  rawResponse: _response.rawResponse,
291
347
  });
292
348
  }
293
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/products/external/{externalId}");
349
+ switch (_response.error.reason) {
350
+ case "non-json":
351
+ throw new errors.PaidError({
352
+ statusCode: _response.error.statusCode,
353
+ body: _response.error.rawBody,
354
+ rawResponse: _response.rawResponse,
355
+ });
356
+ case "timeout":
357
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products/external/{externalId}.");
358
+ case "unknown":
359
+ throw new errors.PaidError({
360
+ message: _response.error.errorMessage,
361
+ rawResponse: _response.rawResponse,
362
+ });
363
+ }
294
364
  });
295
365
  }
296
366
  /**
297
367
  * @param {string} externalId
298
368
  * @param {Paid.ProductUpdate} request
299
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
369
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
300
370
  *
301
371
  * @example
302
372
  * await client.products.updateByExternalId("externalId", {})
@@ -306,8 +376,8 @@ class ProductsClient {
306
376
  }
307
377
  __updateByExternalId(externalId, request, requestOptions) {
308
378
  return __awaiter(this, void 0, void 0, function* () {
309
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
310
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
379
+ var _a, _b, _c, _d, _e, _f, _g, _h;
380
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
311
381
  const _response = yield core.fetcher({
312
382
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `products/external/${core.url.encodePathParam(externalId)}`),
313
383
  method: "PUT",
@@ -319,8 +389,6 @@ class ProductsClient {
319
389
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
320
390
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
321
391
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
322
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
323
- logging: this._options.logging,
324
392
  });
325
393
  if (_response.ok) {
326
394
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -332,12 +400,26 @@ class ProductsClient {
332
400
  rawResponse: _response.rawResponse,
333
401
  });
334
402
  }
335
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/products/external/{externalId}");
403
+ switch (_response.error.reason) {
404
+ case "non-json":
405
+ throw new errors.PaidError({
406
+ statusCode: _response.error.statusCode,
407
+ body: _response.error.rawBody,
408
+ rawResponse: _response.rawResponse,
409
+ });
410
+ case "timeout":
411
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /products/external/{externalId}.");
412
+ case "unknown":
413
+ throw new errors.PaidError({
414
+ message: _response.error.errorMessage,
415
+ rawResponse: _response.rawResponse,
416
+ });
417
+ }
336
418
  });
337
419
  }
338
420
  /**
339
421
  * @param {string} externalId
340
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
422
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
341
423
  *
342
424
  * @example
343
425
  * await client.products.deleteByExternalId("externalId")
@@ -347,8 +429,8 @@ class ProductsClient {
347
429
  }
348
430
  __deleteByExternalId(externalId, requestOptions) {
349
431
  return __awaiter(this, void 0, void 0, function* () {
350
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
351
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
432
+ var _a, _b, _c, _d, _e, _f, _g, _h;
433
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
352
434
  const _response = yield core.fetcher({
353
435
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `products/external/${core.url.encodePathParam(externalId)}`),
354
436
  method: "DELETE",
@@ -357,8 +439,6 @@ class ProductsClient {
357
439
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
358
440
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
359
441
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
360
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
361
- logging: this._options.logging,
362
442
  });
363
443
  if (_response.ok) {
364
444
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -370,8 +450,31 @@ class ProductsClient {
370
450
  rawResponse: _response.rawResponse,
371
451
  });
372
452
  }
373
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/products/external/{externalId}");
453
+ switch (_response.error.reason) {
454
+ case "non-json":
455
+ throw new errors.PaidError({
456
+ statusCode: _response.error.statusCode,
457
+ body: _response.error.rawBody,
458
+ rawResponse: _response.rawResponse,
459
+ });
460
+ case "timeout":
461
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /products/external/{externalId}.");
462
+ case "unknown":
463
+ throw new errors.PaidError({
464
+ message: _response.error.errorMessage,
465
+ rawResponse: _response.rawResponse,
466
+ });
467
+ }
468
+ });
469
+ }
470
+ _getAuthorizationHeader() {
471
+ return __awaiter(this, void 0, void 0, function* () {
472
+ const bearer = yield core.Supplier.get(this._options.token);
473
+ if (bearer != null) {
474
+ return `Bearer ${bearer}`;
475
+ }
476
+ return undefined;
374
477
  });
375
478
  }
376
479
  }
377
- exports.ProductsClient = ProductsClient;
480
+ exports.Products = Products;
@@ -1 +1 @@
1
- export { ProductCreate } from "./ProductCreate.js";
1
+ export type { ProductCreate } from "./ProductCreate.js";
@@ -1,5 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductCreate = void 0;
4
- var ProductCreate_js_1 = require("./ProductCreate.js");
5
- Object.defineProperty(exports, "ProductCreate", { enumerable: true, get: function () { return ProductCreate_js_1.ProductCreate; } });
@@ -1,18 +1,18 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
- import { type NormalizedClientOptions } from "../../../../BaseClient.js";
3
2
  import * as core from "../../../../core/index.js";
4
3
  import * as Paid from "../../../index.js";
5
- export declare namespace TracesClient {
6
- type Options = BaseClientOptions;
4
+ export declare namespace Traces {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
7
  interface RequestOptions extends BaseRequestOptions {
8
8
  }
9
9
  }
10
- export declare class TracesClient {
11
- protected readonly _options: NormalizedClientOptions<TracesClient.Options>;
12
- constructor(options?: TracesClient.Options);
10
+ export declare class Traces {
11
+ protected readonly _options: Traces.Options;
12
+ constructor(_options?: Traces.Options);
13
13
  /**
14
14
  * @param {Paid.GetTracesRequest} request
15
- * @param {TracesClient.RequestOptions} requestOptions - Request-specific configuration.
15
+ * @param {Traces.RequestOptions} requestOptions - Request-specific configuration.
16
16
  *
17
17
  * @throws {@link Paid.BadRequestError}
18
18
  * @throws {@link Paid.ForbiddenError}
@@ -29,6 +29,7 @@ export declare class TracesClient {
29
29
  * metadata: "metadata"
30
30
  * })
31
31
  */
32
- getTraces(request?: Paid.GetTracesRequest, requestOptions?: TracesClient.RequestOptions): core.HttpResponsePromise<Paid.TracesResponse>;
32
+ getTraces(request?: Paid.GetTracesRequest, requestOptions?: Traces.RequestOptions): core.HttpResponsePromise<Paid.TracesResponse>;
33
33
  private __getTraces;
34
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
34
35
  }
@@ -43,21 +43,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  });
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.TracesClient = void 0;
47
- const BaseClient_js_1 = require("../../../../BaseClient.js");
46
+ exports.Traces = void 0;
48
47
  const headers_js_1 = require("../../../../core/headers.js");
49
48
  const core = __importStar(require("../../../../core/index.js"));
50
49
  const environments = __importStar(require("../../../../environments.js"));
51
- const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
50
  const errors = __importStar(require("../../../../errors/index.js"));
53
51
  const Paid = __importStar(require("../../../index.js"));
54
- class TracesClient {
55
- constructor(options = {}) {
56
- this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
52
+ class Traces {
53
+ constructor(_options = {}) {
54
+ this._options = _options;
57
55
  }
58
56
  /**
59
57
  * @param {Paid.GetTracesRequest} request
60
- * @param {TracesClient.RequestOptions} requestOptions - Request-specific configuration.
58
+ * @param {Traces.RequestOptions} requestOptions - Request-specific configuration.
61
59
  *
62
60
  * @throws {@link Paid.BadRequestError}
63
61
  * @throws {@link Paid.ForbiddenError}
@@ -79,19 +77,34 @@ class TracesClient {
79
77
  }
80
78
  __getTraces() {
81
79
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
82
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
80
+ var _a, _b, _c, _d, _e, _f, _g, _h;
83
81
  const { limit, offset, startTime, endTime, externalCustomerId, externalProductId, externalAgentId, metadata } = request;
84
- const _queryParams = {
85
- limit,
86
- offset,
87
- startTime,
88
- endTime,
89
- externalCustomerId,
90
- externalProductId,
91
- externalAgentId,
92
- metadata,
93
- };
94
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
82
+ const _queryParams = {};
83
+ if (limit != null) {
84
+ _queryParams.limit = limit.toString();
85
+ }
86
+ if (offset != null) {
87
+ _queryParams.offset = offset.toString();
88
+ }
89
+ if (startTime != null) {
90
+ _queryParams.startTime = startTime;
91
+ }
92
+ if (endTime != null) {
93
+ _queryParams.endTime = endTime;
94
+ }
95
+ if (externalCustomerId != null) {
96
+ _queryParams.externalCustomerId = externalCustomerId;
97
+ }
98
+ if (externalProductId != null) {
99
+ _queryParams.externalProductId = externalProductId;
100
+ }
101
+ if (externalAgentId != null) {
102
+ _queryParams.externalAgentId = externalAgentId;
103
+ }
104
+ if (metadata != null) {
105
+ _queryParams.metadata = metadata;
106
+ }
107
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
95
108
  const _response = yield core.fetcher({
96
109
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, "traces"),
97
110
  method: "GET",
@@ -100,8 +113,6 @@ class TracesClient {
100
113
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
101
114
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
102
115
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
103
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
104
- logging: this._options.logging,
105
116
  });
106
117
  if (_response.ok) {
107
118
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -120,8 +131,31 @@ class TracesClient {
120
131
  });
121
132
  }
122
133
  }
123
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/traces");
134
+ switch (_response.error.reason) {
135
+ case "non-json":
136
+ throw new errors.PaidError({
137
+ statusCode: _response.error.statusCode,
138
+ body: _response.error.rawBody,
139
+ rawResponse: _response.rawResponse,
140
+ });
141
+ case "timeout":
142
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /traces.");
143
+ case "unknown":
144
+ throw new errors.PaidError({
145
+ message: _response.error.errorMessage,
146
+ rawResponse: _response.rawResponse,
147
+ });
148
+ }
149
+ });
150
+ }
151
+ _getAuthorizationHeader() {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ const bearer = yield core.Supplier.get(this._options.token);
154
+ if (bearer != null) {
155
+ return `Bearer ${bearer}`;
156
+ }
157
+ return undefined;
124
158
  });
125
159
  }
126
160
  }
127
- exports.TracesClient = TracesClient;
161
+ exports.Traces = Traces;