@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
@@ -8,18 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- import { normalizeClientOptions } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
11
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
13
12
  import * as core from "../../../../core/index.mjs";
14
13
  import * as environments from "../../../../environments.mjs";
15
- import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
16
14
  import * as errors from "../../../../errors/index.mjs";
17
- export class ProductsClient {
18
- constructor(options = {}) {
19
- this._options = normalizeClientOptions(options);
15
+ export class Products {
16
+ constructor(_options = {}) {
17
+ this._options = _options;
20
18
  }
21
19
  /**
22
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
20
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
23
21
  *
24
22
  * @example
25
23
  * await client.products.list()
@@ -29,8 +27,8 @@ export class ProductsClient {
29
27
  }
30
28
  __list(requestOptions) {
31
29
  return __awaiter(this, void 0, void 0, function* () {
32
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
33
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
30
+ var _a, _b, _c, _d, _e, _f, _g, _h;
31
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
34
32
  const _response = yield core.fetcher({
35
33
  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"),
36
34
  method: "GET",
@@ -39,8 +37,6 @@ export class ProductsClient {
39
37
  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,
40
38
  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,
41
39
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
42
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
43
- logging: this._options.logging,
44
40
  });
45
41
  if (_response.ok) {
46
42
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -52,12 +48,26 @@ export class ProductsClient {
52
48
  rawResponse: _response.rawResponse,
53
49
  });
54
50
  }
55
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/products");
51
+ switch (_response.error.reason) {
52
+ case "non-json":
53
+ throw new errors.PaidError({
54
+ statusCode: _response.error.statusCode,
55
+ body: _response.error.rawBody,
56
+ rawResponse: _response.rawResponse,
57
+ });
58
+ case "timeout":
59
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products.");
60
+ case "unknown":
61
+ throw new errors.PaidError({
62
+ message: _response.error.errorMessage,
63
+ rawResponse: _response.rawResponse,
64
+ });
65
+ }
56
66
  });
57
67
  }
58
68
  /**
59
69
  * @param {Paid.ProductCreate} request
60
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
70
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
61
71
  *
62
72
  * @example
63
73
  * await client.products.create({
@@ -72,8 +82,8 @@ export class ProductsClient {
72
82
  }
73
83
  __create(request, requestOptions) {
74
84
  return __awaiter(this, void 0, void 0, function* () {
75
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
76
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
85
+ var _a, _b, _c, _d, _e, _f, _g, _h;
86
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
77
87
  const _response = yield core.fetcher({
78
88
  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"),
79
89
  method: "POST",
@@ -85,8 +95,6 @@ export class ProductsClient {
85
95
  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,
86
96
  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,
87
97
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
88
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
89
- logging: this._options.logging,
90
98
  });
91
99
  if (_response.ok) {
92
100
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -98,12 +106,26 @@ export class ProductsClient {
98
106
  rawResponse: _response.rawResponse,
99
107
  });
100
108
  }
101
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/products");
109
+ switch (_response.error.reason) {
110
+ case "non-json":
111
+ throw new errors.PaidError({
112
+ statusCode: _response.error.statusCode,
113
+ body: _response.error.rawBody,
114
+ rawResponse: _response.rawResponse,
115
+ });
116
+ case "timeout":
117
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /products.");
118
+ case "unknown":
119
+ throw new errors.PaidError({
120
+ message: _response.error.errorMessage,
121
+ rawResponse: _response.rawResponse,
122
+ });
123
+ }
102
124
  });
103
125
  }
104
126
  /**
105
127
  * @param {string} productId
106
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
128
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
107
129
  *
108
130
  * @example
109
131
  * await client.products.get("productId")
@@ -113,8 +135,8 @@ export class ProductsClient {
113
135
  }
114
136
  __get(productId, requestOptions) {
115
137
  return __awaiter(this, void 0, void 0, function* () {
116
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
117
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
138
+ var _a, _b, _c, _d, _e, _f, _g, _h;
139
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
118
140
  const _response = yield core.fetcher({
119
141
  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)}`),
120
142
  method: "GET",
@@ -123,8 +145,6 @@ export class ProductsClient {
123
145
  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,
124
146
  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,
125
147
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
126
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
127
- logging: this._options.logging,
128
148
  });
129
149
  if (_response.ok) {
130
150
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -136,13 +156,27 @@ export class ProductsClient {
136
156
  rawResponse: _response.rawResponse,
137
157
  });
138
158
  }
139
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/products/{productId}");
159
+ switch (_response.error.reason) {
160
+ case "non-json":
161
+ throw new errors.PaidError({
162
+ statusCode: _response.error.statusCode,
163
+ body: _response.error.rawBody,
164
+ rawResponse: _response.rawResponse,
165
+ });
166
+ case "timeout":
167
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products/{productId}.");
168
+ case "unknown":
169
+ throw new errors.PaidError({
170
+ message: _response.error.errorMessage,
171
+ rawResponse: _response.rawResponse,
172
+ });
173
+ }
140
174
  });
141
175
  }
142
176
  /**
143
177
  * @param {string} productId
144
178
  * @param {Paid.ProductUpdate} request
145
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
179
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
146
180
  *
147
181
  * @example
148
182
  * await client.products.update("productId", {})
@@ -152,8 +186,8 @@ export class ProductsClient {
152
186
  }
153
187
  __update(productId, request, requestOptions) {
154
188
  return __awaiter(this, void 0, void 0, function* () {
155
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
156
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
189
+ var _a, _b, _c, _d, _e, _f, _g, _h;
190
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
157
191
  const _response = yield core.fetcher({
158
192
  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)}`),
159
193
  method: "PUT",
@@ -165,8 +199,6 @@ export class ProductsClient {
165
199
  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,
166
200
  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,
167
201
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
168
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
169
- logging: this._options.logging,
170
202
  });
171
203
  if (_response.ok) {
172
204
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -178,12 +210,26 @@ export class ProductsClient {
178
210
  rawResponse: _response.rawResponse,
179
211
  });
180
212
  }
181
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/products/{productId}");
213
+ switch (_response.error.reason) {
214
+ case "non-json":
215
+ throw new errors.PaidError({
216
+ statusCode: _response.error.statusCode,
217
+ body: _response.error.rawBody,
218
+ rawResponse: _response.rawResponse,
219
+ });
220
+ case "timeout":
221
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /products/{productId}.");
222
+ case "unknown":
223
+ throw new errors.PaidError({
224
+ message: _response.error.errorMessage,
225
+ rawResponse: _response.rawResponse,
226
+ });
227
+ }
182
228
  });
183
229
  }
184
230
  /**
185
231
  * @param {string} productId
186
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
232
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
187
233
  *
188
234
  * @example
189
235
  * await client.products.delete("productId")
@@ -193,8 +239,8 @@ export class ProductsClient {
193
239
  }
194
240
  __delete(productId, requestOptions) {
195
241
  return __awaiter(this, void 0, void 0, function* () {
196
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
197
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
242
+ var _a, _b, _c, _d, _e, _f, _g, _h;
243
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
198
244
  const _response = yield core.fetcher({
199
245
  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)}`),
200
246
  method: "DELETE",
@@ -203,8 +249,6 @@ export class ProductsClient {
203
249
  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,
204
250
  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,
205
251
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
206
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
207
- logging: this._options.logging,
208
252
  });
209
253
  if (_response.ok) {
210
254
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -216,12 +260,26 @@ export class ProductsClient {
216
260
  rawResponse: _response.rawResponse,
217
261
  });
218
262
  }
219
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/products/{productId}");
263
+ switch (_response.error.reason) {
264
+ case "non-json":
265
+ throw new errors.PaidError({
266
+ statusCode: _response.error.statusCode,
267
+ body: _response.error.rawBody,
268
+ rawResponse: _response.rawResponse,
269
+ });
270
+ case "timeout":
271
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /products/{productId}.");
272
+ case "unknown":
273
+ throw new errors.PaidError({
274
+ message: _response.error.errorMessage,
275
+ rawResponse: _response.rawResponse,
276
+ });
277
+ }
220
278
  });
221
279
  }
222
280
  /**
223
281
  * @param {string} externalId
224
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
282
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
225
283
  *
226
284
  * @example
227
285
  * await client.products.getByExternalId("externalId")
@@ -231,8 +289,8 @@ export class ProductsClient {
231
289
  }
232
290
  __getByExternalId(externalId, requestOptions) {
233
291
  return __awaiter(this, void 0, void 0, function* () {
234
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
235
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
292
+ var _a, _b, _c, _d, _e, _f, _g, _h;
293
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
236
294
  const _response = yield core.fetcher({
237
295
  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)}`),
238
296
  method: "GET",
@@ -241,8 +299,6 @@ export class ProductsClient {
241
299
  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,
242
300
  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,
243
301
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
244
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
245
- logging: this._options.logging,
246
302
  });
247
303
  if (_response.ok) {
248
304
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -254,13 +310,27 @@ export class ProductsClient {
254
310
  rawResponse: _response.rawResponse,
255
311
  });
256
312
  }
257
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/products/external/{externalId}");
313
+ switch (_response.error.reason) {
314
+ case "non-json":
315
+ throw new errors.PaidError({
316
+ statusCode: _response.error.statusCode,
317
+ body: _response.error.rawBody,
318
+ rawResponse: _response.rawResponse,
319
+ });
320
+ case "timeout":
321
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /products/external/{externalId}.");
322
+ case "unknown":
323
+ throw new errors.PaidError({
324
+ message: _response.error.errorMessage,
325
+ rawResponse: _response.rawResponse,
326
+ });
327
+ }
258
328
  });
259
329
  }
260
330
  /**
261
331
  * @param {string} externalId
262
332
  * @param {Paid.ProductUpdate} request
263
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
333
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
264
334
  *
265
335
  * @example
266
336
  * await client.products.updateByExternalId("externalId", {})
@@ -270,8 +340,8 @@ export class ProductsClient {
270
340
  }
271
341
  __updateByExternalId(externalId, request, requestOptions) {
272
342
  return __awaiter(this, void 0, void 0, function* () {
273
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
274
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
343
+ var _a, _b, _c, _d, _e, _f, _g, _h;
344
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
275
345
  const _response = yield core.fetcher({
276
346
  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)}`),
277
347
  method: "PUT",
@@ -283,8 +353,6 @@ export class ProductsClient {
283
353
  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,
284
354
  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,
285
355
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
286
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
287
- logging: this._options.logging,
288
356
  });
289
357
  if (_response.ok) {
290
358
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -296,12 +364,26 @@ export class ProductsClient {
296
364
  rawResponse: _response.rawResponse,
297
365
  });
298
366
  }
299
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/products/external/{externalId}");
367
+ switch (_response.error.reason) {
368
+ case "non-json":
369
+ throw new errors.PaidError({
370
+ statusCode: _response.error.statusCode,
371
+ body: _response.error.rawBody,
372
+ rawResponse: _response.rawResponse,
373
+ });
374
+ case "timeout":
375
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /products/external/{externalId}.");
376
+ case "unknown":
377
+ throw new errors.PaidError({
378
+ message: _response.error.errorMessage,
379
+ rawResponse: _response.rawResponse,
380
+ });
381
+ }
300
382
  });
301
383
  }
302
384
  /**
303
385
  * @param {string} externalId
304
- * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
386
+ * @param {Products.RequestOptions} requestOptions - Request-specific configuration.
305
387
  *
306
388
  * @example
307
389
  * await client.products.deleteByExternalId("externalId")
@@ -311,8 +393,8 @@ export class ProductsClient {
311
393
  }
312
394
  __deleteByExternalId(externalId, requestOptions) {
313
395
  return __awaiter(this, void 0, void 0, function* () {
314
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
315
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
396
+ var _a, _b, _c, _d, _e, _f, _g, _h;
397
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
316
398
  const _response = yield core.fetcher({
317
399
  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)}`),
318
400
  method: "DELETE",
@@ -321,8 +403,6 @@ export class ProductsClient {
321
403
  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,
322
404
  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,
323
405
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
324
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
325
- logging: this._options.logging,
326
406
  });
327
407
  if (_response.ok) {
328
408
  return { data: undefined, rawResponse: _response.rawResponse };
@@ -334,7 +414,30 @@ export class ProductsClient {
334
414
  rawResponse: _response.rawResponse,
335
415
  });
336
416
  }
337
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/products/external/{externalId}");
417
+ switch (_response.error.reason) {
418
+ case "non-json":
419
+ throw new errors.PaidError({
420
+ statusCode: _response.error.statusCode,
421
+ body: _response.error.rawBody,
422
+ rawResponse: _response.rawResponse,
423
+ });
424
+ case "timeout":
425
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /products/external/{externalId}.");
426
+ case "unknown":
427
+ throw new errors.PaidError({
428
+ message: _response.error.errorMessage,
429
+ rawResponse: _response.rawResponse,
430
+ });
431
+ }
432
+ });
433
+ }
434
+ _getAuthorizationHeader() {
435
+ return __awaiter(this, void 0, void 0, function* () {
436
+ const bearer = yield core.Supplier.get(this._options.token);
437
+ if (bearer != null) {
438
+ return `Bearer ${bearer}`;
439
+ }
440
+ return undefined;
338
441
  });
339
442
  }
340
443
  }
@@ -1 +1 @@
1
- export { ProductCreate } from "./ProductCreate.mjs";
1
+ export type { ProductCreate } from "./ProductCreate.mjs";
@@ -1 +1 @@
1
- export { ProductCreate } from "./ProductCreate.mjs";
1
+ export {};
@@ -1,18 +1,18 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
- import { type NormalizedClientOptions } from "../../../../BaseClient.mjs";
3
2
  import * as core from "../../../../core/index.mjs";
4
3
  import * as Paid from "../../../index.mjs";
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
  }
@@ -8,20 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- import { normalizeClientOptions } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
11
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
13
12
  import * as core from "../../../../core/index.mjs";
14
13
  import * as environments from "../../../../environments.mjs";
15
- import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
16
14
  import * as errors from "../../../../errors/index.mjs";
17
15
  import * as Paid from "../../../index.mjs";
18
- export class TracesClient {
19
- constructor(options = {}) {
20
- this._options = normalizeClientOptions(options);
16
+ export class Traces {
17
+ constructor(_options = {}) {
18
+ this._options = _options;
21
19
  }
22
20
  /**
23
21
  * @param {Paid.GetTracesRequest} request
24
- * @param {TracesClient.RequestOptions} requestOptions - Request-specific configuration.
22
+ * @param {Traces.RequestOptions} requestOptions - Request-specific configuration.
25
23
  *
26
24
  * @throws {@link Paid.BadRequestError}
27
25
  * @throws {@link Paid.ForbiddenError}
@@ -43,19 +41,34 @@ export class TracesClient {
43
41
  }
44
42
  __getTraces() {
45
43
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
46
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
44
+ var _a, _b, _c, _d, _e, _f, _g, _h;
47
45
  const { limit, offset, startTime, endTime, externalCustomerId, externalProductId, externalAgentId, metadata } = request;
48
- const _queryParams = {
49
- limit,
50
- offset,
51
- startTime,
52
- endTime,
53
- externalCustomerId,
54
- externalProductId,
55
- externalAgentId,
56
- metadata,
57
- };
58
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
46
+ const _queryParams = {};
47
+ if (limit != null) {
48
+ _queryParams.limit = limit.toString();
49
+ }
50
+ if (offset != null) {
51
+ _queryParams.offset = offset.toString();
52
+ }
53
+ if (startTime != null) {
54
+ _queryParams.startTime = startTime;
55
+ }
56
+ if (endTime != null) {
57
+ _queryParams.endTime = endTime;
58
+ }
59
+ if (externalCustomerId != null) {
60
+ _queryParams.externalCustomerId = externalCustomerId;
61
+ }
62
+ if (externalProductId != null) {
63
+ _queryParams.externalProductId = externalProductId;
64
+ }
65
+ if (externalAgentId != null) {
66
+ _queryParams.externalAgentId = externalAgentId;
67
+ }
68
+ if (metadata != null) {
69
+ _queryParams.metadata = metadata;
70
+ }
71
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
59
72
  const _response = yield core.fetcher({
60
73
  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"),
61
74
  method: "GET",
@@ -64,8 +77,6 @@ export class TracesClient {
64
77
  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,
65
78
  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,
66
79
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
67
- fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
68
- logging: this._options.logging,
69
80
  });
70
81
  if (_response.ok) {
71
82
  return { data: _response.body, rawResponse: _response.rawResponse };
@@ -84,7 +95,30 @@ export class TracesClient {
84
95
  });
85
96
  }
86
97
  }
87
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/traces");
98
+ switch (_response.error.reason) {
99
+ case "non-json":
100
+ throw new errors.PaidError({
101
+ statusCode: _response.error.statusCode,
102
+ body: _response.error.rawBody,
103
+ rawResponse: _response.rawResponse,
104
+ });
105
+ case "timeout":
106
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /traces.");
107
+ case "unknown":
108
+ throw new errors.PaidError({
109
+ message: _response.error.errorMessage,
110
+ rawResponse: _response.rawResponse,
111
+ });
112
+ }
113
+ });
114
+ }
115
+ _getAuthorizationHeader() {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const bearer = yield core.Supplier.get(this._options.token);
118
+ if (bearer != null) {
119
+ return `Bearer ${bearer}`;
120
+ }
121
+ return undefined;
88
122
  });
89
123
  }
90
124
  }
@@ -1,31 +1,31 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
- import { type NormalizedClientOptions } from "../../../../BaseClient.mjs";
3
2
  import * as core from "../../../../core/index.mjs";
4
3
  import * as Paid from "../../../index.mjs";
5
- export declare namespace UsageClient {
6
- type Options = BaseClientOptions;
4
+ export declare namespace Usage {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
7
  interface RequestOptions extends BaseRequestOptions {
8
8
  }
9
9
  }
10
- export declare class UsageClient {
11
- protected readonly _options: NormalizedClientOptions<UsageClient.Options>;
12
- constructor(options?: UsageClient.Options);
10
+ export declare class Usage {
11
+ protected readonly _options: Usage.Options;
12
+ constructor(_options?: Usage.Options);
13
13
  /**
14
14
  * DEPRECATED: Use POST /usage/v2/signals/bulk instead for cleaner field names.
15
15
  *
16
16
  * @param {Paid.UsageRecordBulkRequest} request
17
- * @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
17
+ * @param {Usage.RequestOptions} requestOptions - Request-specific configuration.
18
18
  *
19
19
  * @example
20
20
  * await client.usage.recordBulk({
21
21
  * signals: [{}, {}, {}]
22
22
  * })
23
23
  */
24
- recordBulk(request?: Paid.UsageRecordBulkRequest, requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<void>;
24
+ recordBulk(request?: Paid.UsageRecordBulkRequest, requestOptions?: Usage.RequestOptions): core.HttpResponsePromise<void>;
25
25
  private __recordBulk;
26
26
  /**
27
27
  * @param {Paid.UsageRecordBulkV2Request} request
28
- * @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ * @param {Usage.RequestOptions} requestOptions - Request-specific configuration.
29
29
  *
30
30
  * @throws {@link Paid.BadRequestError}
31
31
  *
@@ -50,11 +50,11 @@ export declare class UsageClient {
50
50
  * }]
51
51
  * })
52
52
  */
53
- usageRecordBulkV2(request?: Paid.UsageRecordBulkV2Request, requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<void>;
53
+ usageRecordBulkV2(request?: Paid.UsageRecordBulkV2Request, requestOptions?: Usage.RequestOptions): core.HttpResponsePromise<void>;
54
54
  private __usageRecordBulkV2;
55
55
  /**
56
56
  * @param {Paid.UsageCheckUsageRequest} request
57
- * @param {UsageClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ * @param {Usage.RequestOptions} requestOptions - Request-specific configuration.
58
58
  *
59
59
  * @throws {@link Paid.BadRequestError}
60
60
  * @throws {@link Paid.NotFoundError}
@@ -66,6 +66,7 @@ export declare class UsageClient {
66
66
  * externalProductId: "acme-agent"
67
67
  * })
68
68
  */
69
- checkUsage(request: Paid.UsageCheckUsageRequest, requestOptions?: UsageClient.RequestOptions): core.HttpResponsePromise<Paid.UsageCheckUsageResponse>;
69
+ checkUsage(request: Paid.UsageCheckUsageRequest, requestOptions?: Usage.RequestOptions): core.HttpResponsePromise<Paid.UsageCheckUsageResponse>;
70
70
  private __checkUsage;
71
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
71
72
  }