@paid-ai/paid-node 0.0.5 → 0.0.7

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 (97) hide show
  1. package/README.md +8 -8
  2. package/dist/cjs/Client.d.ts +6 -6
  3. package/dist/cjs/Client.js +7 -7
  4. package/dist/cjs/api/resources/agents/client/Client.d.ts +11 -11
  5. package/dist/cjs/api/resources/agents/client/Client.js +43 -43
  6. package/dist/cjs/api/resources/contacts/client/Client.d.ts +7 -7
  7. package/dist/cjs/api/resources/contacts/client/Client.js +31 -31
  8. package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.d.ts +2 -2
  9. package/dist/cjs/api/resources/customers/client/Client.d.ts +11 -11
  10. package/dist/cjs/api/resources/customers/client/Client.js +43 -43
  11. package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +4 -4
  12. package/dist/cjs/api/resources/orders/client/Client.d.ts +7 -7
  13. package/dist/cjs/api/resources/orders/client/Client.js +26 -26
  14. package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +2 -2
  15. package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +4 -4
  16. package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +6 -6
  17. package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +2 -2
  18. package/dist/cjs/api/resources/usage/client/Client.d.ts +4 -4
  19. package/dist/cjs/api/resources/usage/client/Client.js +6 -6
  20. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.d.ts +2 -2
  21. package/dist/cjs/api/types/Agent.d.ts +2 -2
  22. package/dist/cjs/api/types/AgentAttribute.d.ts +2 -2
  23. package/dist/cjs/api/types/AgentPricePoint.d.ts +2 -2
  24. package/dist/cjs/api/types/AgentUpdate.d.ts +2 -2
  25. package/dist/cjs/api/types/Contact.d.ts +2 -2
  26. package/dist/cjs/api/types/Customer.d.ts +5 -5
  27. package/dist/cjs/api/types/CustomerUpdate.d.ts +4 -4
  28. package/dist/cjs/api/types/Error_.d.ts +2 -2
  29. package/dist/cjs/api/types/Order.d.ts +4 -4
  30. package/dist/cjs/api/types/OrderLine.d.ts +4 -4
  31. package/dist/cjs/api/types/OrderLineAttribute.d.ts +2 -2
  32. package/dist/cjs/api/types/OrderLineAttributePricing.d.ts +5 -5
  33. package/dist/cjs/api/types/PricePoint.d.ts +2 -2
  34. package/dist/cjs/api/types/Pricing.d.ts +5 -5
  35. package/dist/cjs/environments.d.ts +2 -2
  36. package/dist/cjs/environments.js +2 -2
  37. package/dist/cjs/errors/{PaidApiError.d.ts → PaidError.d.ts} +1 -1
  38. package/dist/cjs/errors/{PaidApiError.js → PaidError.js} +4 -4
  39. package/dist/{esm/errors/PaidApiTimeoutError.d.mts → cjs/errors/PaidTimeoutError.d.ts} +1 -1
  40. package/dist/cjs/errors/{PaidApiTimeoutError.js → PaidTimeoutError.js} +4 -4
  41. package/dist/cjs/errors/index.d.ts +2 -2
  42. package/dist/cjs/errors/index.js +5 -5
  43. package/dist/cjs/index.d.ts +4 -4
  44. package/dist/cjs/index.js +6 -6
  45. package/dist/cjs/version.d.ts +1 -1
  46. package/dist/cjs/version.js +1 -1
  47. package/dist/cjs/wrapper/BatchUsage.d.ts +6 -0
  48. package/dist/cjs/wrapper/BatchUsage.js +24 -0
  49. package/dist/esm/Client.d.mts +6 -6
  50. package/dist/esm/Client.mjs +4 -4
  51. package/dist/esm/api/resources/agents/client/Client.d.mts +11 -11
  52. package/dist/esm/api/resources/agents/client/Client.mjs +43 -43
  53. package/dist/esm/api/resources/contacts/client/Client.d.mts +7 -7
  54. package/dist/esm/api/resources/contacts/client/Client.mjs +31 -31
  55. package/dist/esm/api/resources/contacts/client/requests/ContactCreate.d.mts +2 -2
  56. package/dist/esm/api/resources/customers/client/Client.d.mts +11 -11
  57. package/dist/esm/api/resources/customers/client/Client.mjs +43 -43
  58. package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +4 -4
  59. package/dist/esm/api/resources/orders/client/Client.d.mts +7 -7
  60. package/dist/esm/api/resources/orders/client/Client.mjs +26 -26
  61. package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +2 -2
  62. package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +4 -4
  63. package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +6 -6
  64. package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +2 -2
  65. package/dist/esm/api/resources/usage/client/Client.d.mts +4 -4
  66. package/dist/esm/api/resources/usage/client/Client.mjs +6 -6
  67. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.d.mts +2 -2
  68. package/dist/esm/api/types/Agent.d.mts +2 -2
  69. package/dist/esm/api/types/AgentAttribute.d.mts +2 -2
  70. package/dist/esm/api/types/AgentPricePoint.d.mts +2 -2
  71. package/dist/esm/api/types/AgentUpdate.d.mts +2 -2
  72. package/dist/esm/api/types/Contact.d.mts +2 -2
  73. package/dist/esm/api/types/Customer.d.mts +5 -5
  74. package/dist/esm/api/types/CustomerUpdate.d.mts +4 -4
  75. package/dist/esm/api/types/Error_.d.mts +2 -2
  76. package/dist/esm/api/types/Order.d.mts +4 -4
  77. package/dist/esm/api/types/OrderLine.d.mts +4 -4
  78. package/dist/esm/api/types/OrderLineAttribute.d.mts +2 -2
  79. package/dist/esm/api/types/OrderLineAttributePricing.d.mts +5 -5
  80. package/dist/esm/api/types/PricePoint.d.mts +2 -2
  81. package/dist/esm/api/types/Pricing.d.mts +5 -5
  82. package/dist/esm/environments.d.mts +2 -2
  83. package/dist/esm/environments.mjs +1 -1
  84. package/dist/esm/errors/{PaidApiError.d.mts → PaidError.d.mts} +1 -1
  85. package/dist/esm/errors/{PaidApiError.mjs → PaidError.mjs} +2 -2
  86. package/dist/{cjs/errors/PaidApiTimeoutError.d.ts → esm/errors/PaidTimeoutError.d.mts} +1 -1
  87. package/dist/esm/errors/{PaidApiTimeoutError.mjs → PaidTimeoutError.mjs} +2 -2
  88. package/dist/esm/errors/index.d.mts +2 -2
  89. package/dist/esm/errors/index.mjs +2 -2
  90. package/dist/esm/index.d.mts +4 -4
  91. package/dist/esm/index.mjs +4 -4
  92. package/dist/esm/version.d.mts +1 -1
  93. package/dist/esm/version.mjs +1 -1
  94. package/dist/esm/wrapper/BatchUsage.d.mts +6 -0
  95. package/dist/esm/wrapper/BatchUsage.mjs +20 -0
  96. package/package.json +1 -1
  97. package/reference.md +31 -31
package/README.md CHANGED
@@ -20,9 +20,9 @@ A full reference for this library is available [here](https://github.com/AgentPa
20
20
  Instantiate and use the client with the following:
21
21
 
22
22
  ```typescript
23
- import { PaidApiClient } from "@paid-ai/paid-node";
23
+ import { PaidClient } from "@paid-ai/paid-node";
24
24
 
25
- const client = new PaidApiClient({ token: "YOUR_TOKEN" });
25
+ const client = new PaidClient({ token: "YOUR_TOKEN" });
26
26
  await client.customers.create({
27
27
  name: "name",
28
28
  });
@@ -34,9 +34,9 @@ The SDK exports all request and response types as TypeScript interfaces. Simply
34
34
  following namespace:
35
35
 
36
36
  ```typescript
37
- import { PaidApi } from "@paid-ai/paid-node";
37
+ import { Paid } from "@paid-ai/paid-node";
38
38
 
39
- const request: PaidApi.CustomerCreate = {
39
+ const request: Paid.CustomerCreate = {
40
40
  ...
41
41
  };
42
42
  ```
@@ -47,12 +47,12 @@ When the API returns a non-success status code (4xx or 5xx response), a subclass
47
47
  will be thrown.
48
48
 
49
49
  ```typescript
50
- import { PaidApiError } from "@paid-ai/paid-node";
50
+ import { PaidError } from "@paid-ai/paid-node";
51
51
 
52
52
  try {
53
53
  await client.customers.create(...);
54
54
  } catch (err) {
55
- if (err instanceof PaidApiError) {
55
+ if (err instanceof PaidError) {
56
56
  console.log(err.statusCode);
57
57
  console.log(err.message);
58
58
  console.log(err.body);
@@ -147,9 +147,9 @@ The SDK provides a way for you to customize the underlying HTTP client / Fetch f
147
147
  unsupported environment, this provides a way for you to break glass and ensure the SDK works.
148
148
 
149
149
  ```typescript
150
- import { PaidApiClient } from "@paid-ai/paid-node";
150
+ import { PaidClient } from "@paid-ai/paid-node";
151
151
 
152
- const client = new PaidApiClient({
152
+ const client = new PaidClient({
153
153
  ...
154
154
  fetcher: // provide your implementation here
155
155
  });
@@ -7,10 +7,10 @@ import { Customers } from "./api/resources/customers/client/Client.js";
7
7
  import { Agents } from "./api/resources/agents/client/Client.js";
8
8
  import { Contacts } from "./api/resources/contacts/client/Client.js";
9
9
  import { Orders } from "./api/resources/orders/client/Client.js";
10
- import { Usage } from "./api/resources/usage/client/Client.js";
11
- export declare namespace PaidApiClient {
10
+ import { Usage } from "./wrapper/BatchUsage.js";
11
+ export declare namespace PaidClient {
12
12
  interface Options {
13
- environment?: core.Supplier<environments.PaidApiEnvironment | string>;
13
+ environment?: core.Supplier<environments.PaidEnvironment | string>;
14
14
  /** Specify a custom URL to connect the client to. */
15
15
  baseUrl?: core.Supplier<string>;
16
16
  token: core.Supplier<core.BearerToken>;
@@ -28,14 +28,14 @@ export declare namespace PaidApiClient {
28
28
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
29
29
  }
30
30
  }
31
- export declare class PaidApiClient {
32
- protected readonly _options: PaidApiClient.Options;
31
+ export declare class PaidClient {
32
+ protected readonly _options: PaidClient.Options;
33
33
  protected _customers: Customers | undefined;
34
34
  protected _agents: Agents | undefined;
35
35
  protected _contacts: Contacts | undefined;
36
36
  protected _orders: Orders | undefined;
37
37
  protected _usage: Usage | undefined;
38
- constructor(_options: PaidApiClient.Options);
38
+ constructor(_options: PaidClient.Options);
39
39
  get customers(): Customers;
40
40
  get agents(): Agents;
41
41
  get contacts(): Contacts;
@@ -36,21 +36,21 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.PaidApiClient = void 0;
39
+ exports.PaidClient = void 0;
40
40
  const core = __importStar(require("./core/index.js"));
41
41
  const headers_js_1 = require("./core/headers.js");
42
42
  const Client_js_1 = require("./api/resources/customers/client/Client.js");
43
43
  const Client_js_2 = require("./api/resources/agents/client/Client.js");
44
44
  const Client_js_3 = require("./api/resources/contacts/client/Client.js");
45
45
  const Client_js_4 = require("./api/resources/orders/client/Client.js");
46
- const Client_js_5 = require("./api/resources/usage/client/Client.js");
47
- class PaidApiClient {
46
+ const BatchUsage_js_1 = require("./wrapper/BatchUsage.js");
47
+ class PaidClient {
48
48
  constructor(_options) {
49
49
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
50
50
  "X-Fern-Language": "JavaScript",
51
51
  "X-Fern-SDK-Name": "@paid-ai/paid-node",
52
- "X-Fern-SDK-Version": "0.0.5",
53
- "User-Agent": "@paid-ai/paid-node/0.0.5",
52
+ "X-Fern-SDK-Version": "0.0.6",
53
+ "User-Agent": "@paid-ai/paid-node/0.0.6",
54
54
  "X-Fern-Runtime": core.RUNTIME.type,
55
55
  "X-Fern-Runtime-Version": core.RUNTIME.version,
56
56
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -73,7 +73,7 @@ class PaidApiClient {
73
73
  }
74
74
  get usage() {
75
75
  var _a;
76
- return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new Client_js_5.Usage(this._options)));
76
+ return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new BatchUsage_js_1.Usage(this._options)));
77
77
  }
78
78
  }
79
- exports.PaidApiClient = PaidApiClient;
79
+ exports.PaidClient = PaidClient;
@@ -3,10 +3,10 @@
3
3
  */
4
4
  import * as environments from "../../../../environments.js";
5
5
  import * as core from "../../../../core/index.js";
6
- import * as PaidApi from "../../../index.js";
6
+ import * as Paid from "../../../index.js";
7
7
  export declare namespace Agents {
8
8
  interface Options {
9
- environment?: core.Supplier<environments.PaidApiEnvironment | string>;
9
+ environment?: core.Supplier<environments.PaidEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  token: core.Supplier<core.BearerToken>;
@@ -33,10 +33,10 @@ export declare class Agents {
33
33
  * @example
34
34
  * await client.agents.list()
35
35
  */
36
- list(requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent[]>;
36
+ list(requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Paid.Agent[]>;
37
37
  private __list;
38
38
  /**
39
- * @param {PaidApi.AgentCreate} request
39
+ * @param {Paid.AgentCreate} request
40
40
  * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
41
41
  *
42
42
  * @example
@@ -45,7 +45,7 @@ export declare class Agents {
45
45
  * description: "description"
46
46
  * })
47
47
  */
48
- create(request: PaidApi.AgentCreate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
48
+ create(request: Paid.AgentCreate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Paid.Agent>;
49
49
  private __create;
50
50
  /**
51
51
  * @param {string} agentId
@@ -54,17 +54,17 @@ export declare class Agents {
54
54
  * @example
55
55
  * await client.agents.get("agentId")
56
56
  */
57
- get(agentId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
57
+ get(agentId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Paid.Agent>;
58
58
  private __get;
59
59
  /**
60
60
  * @param {string} agentId
61
- * @param {PaidApi.AgentUpdate} request
61
+ * @param {Paid.AgentUpdate} request
62
62
  * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
63
63
  *
64
64
  * @example
65
65
  * await client.agents.update("agentId", {})
66
66
  */
67
- update(agentId: string, request: PaidApi.AgentUpdate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
67
+ update(agentId: string, request: Paid.AgentUpdate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Paid.Agent>;
68
68
  private __update;
69
69
  /**
70
70
  * @param {string} agentId
@@ -82,17 +82,17 @@ export declare class Agents {
82
82
  * @example
83
83
  * await client.agents.getByExternalId("externalId")
84
84
  */
85
- getByExternalId(externalId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
85
+ getByExternalId(externalId: string, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Paid.Agent>;
86
86
  private __getByExternalId;
87
87
  /**
88
88
  * @param {string} externalId
89
- * @param {PaidApi.AgentUpdate} request
89
+ * @param {Paid.AgentUpdate} request
90
90
  * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
91
91
  *
92
92
  * @example
93
93
  * await client.agents.updateByExternalId("externalId", {})
94
94
  */
95
- updateByExternalId(externalId: string, request: PaidApi.AgentUpdate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<PaidApi.Agent>;
95
+ updateByExternalId(externalId: string, request: Paid.AgentUpdate, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Paid.Agent>;
96
96
  private __updateByExternalId;
97
97
  /**
98
98
  * @param {string} externalId
@@ -71,7 +71,7 @@ class Agents {
71
71
  return __awaiter(this, void 0, void 0, function* () {
72
72
  var _a, _b, _c;
73
73
  const _response = yield core.fetcher({
74
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, "agents"),
74
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "agents"),
75
75
  method: "GET",
76
76
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
77
77
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -82,7 +82,7 @@ class Agents {
82
82
  return { data: _response.body, rawResponse: _response.rawResponse };
83
83
  }
84
84
  if (_response.error.reason === "status-code") {
85
- throw new errors.PaidApiError({
85
+ throw new errors.PaidError({
86
86
  statusCode: _response.error.statusCode,
87
87
  body: _response.error.body,
88
88
  rawResponse: _response.rawResponse,
@@ -90,15 +90,15 @@ class Agents {
90
90
  }
91
91
  switch (_response.error.reason) {
92
92
  case "non-json":
93
- throw new errors.PaidApiError({
93
+ throw new errors.PaidError({
94
94
  statusCode: _response.error.statusCode,
95
95
  body: _response.error.rawBody,
96
96
  rawResponse: _response.rawResponse,
97
97
  });
98
98
  case "timeout":
99
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling GET /agents.");
99
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents.");
100
100
  case "unknown":
101
- throw new errors.PaidApiError({
101
+ throw new errors.PaidError({
102
102
  message: _response.error.errorMessage,
103
103
  rawResponse: _response.rawResponse,
104
104
  });
@@ -106,7 +106,7 @@ class Agents {
106
106
  });
107
107
  }
108
108
  /**
109
- * @param {PaidApi.AgentCreate} request
109
+ * @param {Paid.AgentCreate} request
110
110
  * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
111
111
  *
112
112
  * @example
@@ -122,7 +122,7 @@ class Agents {
122
122
  return __awaiter(this, void 0, void 0, function* () {
123
123
  var _a, _b, _c;
124
124
  const _response = yield core.fetcher({
125
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, "agents"),
125
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, "agents"),
126
126
  method: "POST",
127
127
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
128
128
  contentType: "application/json",
@@ -136,7 +136,7 @@ class Agents {
136
136
  return { data: _response.body, rawResponse: _response.rawResponse };
137
137
  }
138
138
  if (_response.error.reason === "status-code") {
139
- throw new errors.PaidApiError({
139
+ throw new errors.PaidError({
140
140
  statusCode: _response.error.statusCode,
141
141
  body: _response.error.body,
142
142
  rawResponse: _response.rawResponse,
@@ -144,15 +144,15 @@ class Agents {
144
144
  }
145
145
  switch (_response.error.reason) {
146
146
  case "non-json":
147
- throw new errors.PaidApiError({
147
+ throw new errors.PaidError({
148
148
  statusCode: _response.error.statusCode,
149
149
  body: _response.error.rawBody,
150
150
  rawResponse: _response.rawResponse,
151
151
  });
152
152
  case "timeout":
153
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling POST /agents.");
153
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /agents.");
154
154
  case "unknown":
155
- throw new errors.PaidApiError({
155
+ throw new errors.PaidError({
156
156
  message: _response.error.errorMessage,
157
157
  rawResponse: _response.rawResponse,
158
158
  });
@@ -173,7 +173,7 @@ class Agents {
173
173
  return __awaiter(this, void 0, void 0, function* () {
174
174
  var _a, _b, _c;
175
175
  const _response = yield core.fetcher({
176
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, `agents/${encodeURIComponent(agentId)}`),
176
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `agents/${encodeURIComponent(agentId)}`),
177
177
  method: "GET",
178
178
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
179
179
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -184,7 +184,7 @@ class Agents {
184
184
  return { data: _response.body, rawResponse: _response.rawResponse };
185
185
  }
186
186
  if (_response.error.reason === "status-code") {
187
- throw new errors.PaidApiError({
187
+ throw new errors.PaidError({
188
188
  statusCode: _response.error.statusCode,
189
189
  body: _response.error.body,
190
190
  rawResponse: _response.rawResponse,
@@ -192,15 +192,15 @@ class Agents {
192
192
  }
193
193
  switch (_response.error.reason) {
194
194
  case "non-json":
195
- throw new errors.PaidApiError({
195
+ throw new errors.PaidError({
196
196
  statusCode: _response.error.statusCode,
197
197
  body: _response.error.rawBody,
198
198
  rawResponse: _response.rawResponse,
199
199
  });
200
200
  case "timeout":
201
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling GET /agents/{agentId}.");
201
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents/{agentId}.");
202
202
  case "unknown":
203
- throw new errors.PaidApiError({
203
+ throw new errors.PaidError({
204
204
  message: _response.error.errorMessage,
205
205
  rawResponse: _response.rawResponse,
206
206
  });
@@ -209,7 +209,7 @@ class Agents {
209
209
  }
210
210
  /**
211
211
  * @param {string} agentId
212
- * @param {PaidApi.AgentUpdate} request
212
+ * @param {Paid.AgentUpdate} request
213
213
  * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
214
214
  *
215
215
  * @example
@@ -222,7 +222,7 @@ class Agents {
222
222
  return __awaiter(this, void 0, void 0, function* () {
223
223
  var _a, _b, _c;
224
224
  const _response = yield core.fetcher({
225
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, `agents/${encodeURIComponent(agentId)}`),
225
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `agents/${encodeURIComponent(agentId)}`),
226
226
  method: "PUT",
227
227
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
228
228
  contentType: "application/json",
@@ -236,7 +236,7 @@ class Agents {
236
236
  return { data: _response.body, rawResponse: _response.rawResponse };
237
237
  }
238
238
  if (_response.error.reason === "status-code") {
239
- throw new errors.PaidApiError({
239
+ throw new errors.PaidError({
240
240
  statusCode: _response.error.statusCode,
241
241
  body: _response.error.body,
242
242
  rawResponse: _response.rawResponse,
@@ -244,15 +244,15 @@ class Agents {
244
244
  }
245
245
  switch (_response.error.reason) {
246
246
  case "non-json":
247
- throw new errors.PaidApiError({
247
+ throw new errors.PaidError({
248
248
  statusCode: _response.error.statusCode,
249
249
  body: _response.error.rawBody,
250
250
  rawResponse: _response.rawResponse,
251
251
  });
252
252
  case "timeout":
253
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling PUT /agents/{agentId}.");
253
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /agents/{agentId}.");
254
254
  case "unknown":
255
- throw new errors.PaidApiError({
255
+ throw new errors.PaidError({
256
256
  message: _response.error.errorMessage,
257
257
  rawResponse: _response.rawResponse,
258
258
  });
@@ -273,7 +273,7 @@ class Agents {
273
273
  return __awaiter(this, void 0, void 0, function* () {
274
274
  var _a, _b, _c;
275
275
  const _response = yield core.fetcher({
276
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, `agents/${encodeURIComponent(agentId)}`),
276
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `agents/${encodeURIComponent(agentId)}`),
277
277
  method: "DELETE",
278
278
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
279
279
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -284,7 +284,7 @@ class Agents {
284
284
  return { data: undefined, rawResponse: _response.rawResponse };
285
285
  }
286
286
  if (_response.error.reason === "status-code") {
287
- throw new errors.PaidApiError({
287
+ throw new errors.PaidError({
288
288
  statusCode: _response.error.statusCode,
289
289
  body: _response.error.body,
290
290
  rawResponse: _response.rawResponse,
@@ -292,15 +292,15 @@ class Agents {
292
292
  }
293
293
  switch (_response.error.reason) {
294
294
  case "non-json":
295
- throw new errors.PaidApiError({
295
+ throw new errors.PaidError({
296
296
  statusCode: _response.error.statusCode,
297
297
  body: _response.error.rawBody,
298
298
  rawResponse: _response.rawResponse,
299
299
  });
300
300
  case "timeout":
301
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling DELETE /agents/{agentId}.");
301
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /agents/{agentId}.");
302
302
  case "unknown":
303
- throw new errors.PaidApiError({
303
+ throw new errors.PaidError({
304
304
  message: _response.error.errorMessage,
305
305
  rawResponse: _response.rawResponse,
306
306
  });
@@ -321,7 +321,7 @@ class Agents {
321
321
  return __awaiter(this, void 0, void 0, function* () {
322
322
  var _a, _b, _c;
323
323
  const _response = yield core.fetcher({
324
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, `agents/external/${encodeURIComponent(externalId)}`),
324
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `agents/external/${encodeURIComponent(externalId)}`),
325
325
  method: "GET",
326
326
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
327
327
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -332,7 +332,7 @@ class Agents {
332
332
  return { data: _response.body, rawResponse: _response.rawResponse };
333
333
  }
334
334
  if (_response.error.reason === "status-code") {
335
- throw new errors.PaidApiError({
335
+ throw new errors.PaidError({
336
336
  statusCode: _response.error.statusCode,
337
337
  body: _response.error.body,
338
338
  rawResponse: _response.rawResponse,
@@ -340,15 +340,15 @@ class Agents {
340
340
  }
341
341
  switch (_response.error.reason) {
342
342
  case "non-json":
343
- throw new errors.PaidApiError({
343
+ throw new errors.PaidError({
344
344
  statusCode: _response.error.statusCode,
345
345
  body: _response.error.rawBody,
346
346
  rawResponse: _response.rawResponse,
347
347
  });
348
348
  case "timeout":
349
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling GET /agents/external/{externalId}.");
349
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /agents/external/{externalId}.");
350
350
  case "unknown":
351
- throw new errors.PaidApiError({
351
+ throw new errors.PaidError({
352
352
  message: _response.error.errorMessage,
353
353
  rawResponse: _response.rawResponse,
354
354
  });
@@ -357,7 +357,7 @@ class Agents {
357
357
  }
358
358
  /**
359
359
  * @param {string} externalId
360
- * @param {PaidApi.AgentUpdate} request
360
+ * @param {Paid.AgentUpdate} request
361
361
  * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
362
362
  *
363
363
  * @example
@@ -370,7 +370,7 @@ class Agents {
370
370
  return __awaiter(this, void 0, void 0, function* () {
371
371
  var _a, _b, _c;
372
372
  const _response = yield core.fetcher({
373
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, `agents/external/${encodeURIComponent(externalId)}`),
373
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `agents/external/${encodeURIComponent(externalId)}`),
374
374
  method: "PUT",
375
375
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
376
376
  contentType: "application/json",
@@ -384,7 +384,7 @@ class Agents {
384
384
  return { data: _response.body, rawResponse: _response.rawResponse };
385
385
  }
386
386
  if (_response.error.reason === "status-code") {
387
- throw new errors.PaidApiError({
387
+ throw new errors.PaidError({
388
388
  statusCode: _response.error.statusCode,
389
389
  body: _response.error.body,
390
390
  rawResponse: _response.rawResponse,
@@ -392,15 +392,15 @@ class Agents {
392
392
  }
393
393
  switch (_response.error.reason) {
394
394
  case "non-json":
395
- throw new errors.PaidApiError({
395
+ throw new errors.PaidError({
396
396
  statusCode: _response.error.statusCode,
397
397
  body: _response.error.rawBody,
398
398
  rawResponse: _response.rawResponse,
399
399
  });
400
400
  case "timeout":
401
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling PUT /agents/external/{externalId}.");
401
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /agents/external/{externalId}.");
402
402
  case "unknown":
403
- throw new errors.PaidApiError({
403
+ throw new errors.PaidError({
404
404
  message: _response.error.errorMessage,
405
405
  rawResponse: _response.rawResponse,
406
406
  });
@@ -421,7 +421,7 @@ class Agents {
421
421
  return __awaiter(this, void 0, void 0, function* () {
422
422
  var _a, _b, _c;
423
423
  const _response = yield core.fetcher({
424
- url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidApiEnvironment.Production, `agents/external/${encodeURIComponent(externalId)}`),
424
+ url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PaidEnvironment.Production, `agents/external/${encodeURIComponent(externalId)}`),
425
425
  method: "DELETE",
426
426
  headers: (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
427
427
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -432,7 +432,7 @@ class Agents {
432
432
  return { data: undefined, rawResponse: _response.rawResponse };
433
433
  }
434
434
  if (_response.error.reason === "status-code") {
435
- throw new errors.PaidApiError({
435
+ throw new errors.PaidError({
436
436
  statusCode: _response.error.statusCode,
437
437
  body: _response.error.body,
438
438
  rawResponse: _response.rawResponse,
@@ -440,15 +440,15 @@ class Agents {
440
440
  }
441
441
  switch (_response.error.reason) {
442
442
  case "non-json":
443
- throw new errors.PaidApiError({
443
+ throw new errors.PaidError({
444
444
  statusCode: _response.error.statusCode,
445
445
  body: _response.error.rawBody,
446
446
  rawResponse: _response.rawResponse,
447
447
  });
448
448
  case "timeout":
449
- throw new errors.PaidApiTimeoutError("Timeout exceeded when calling DELETE /agents/external/{externalId}.");
449
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /agents/external/{externalId}.");
450
450
  case "unknown":
451
- throw new errors.PaidApiError({
451
+ throw new errors.PaidError({
452
452
  message: _response.error.errorMessage,
453
453
  rawResponse: _response.rawResponse,
454
454
  });
@@ -3,10 +3,10 @@
3
3
  */
4
4
  import * as environments from "../../../../environments.js";
5
5
  import * as core from "../../../../core/index.js";
6
- import * as PaidApi from "../../../index.js";
6
+ import * as Paid from "../../../index.js";
7
7
  export declare namespace Contacts {
8
8
  interface Options {
9
- environment?: core.Supplier<environments.PaidApiEnvironment | string>;
9
+ environment?: core.Supplier<environments.PaidEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  token: core.Supplier<core.BearerToken>;
@@ -33,10 +33,10 @@ export declare class Contacts {
33
33
  * @example
34
34
  * await client.contacts.list()
35
35
  */
36
- list(requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<PaidApi.Contact[]>;
36
+ list(requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact[]>;
37
37
  private __list;
38
38
  /**
39
- * @param {PaidApi.ContactCreate} request
39
+ * @param {Paid.ContactCreate} request
40
40
  * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
41
41
  *
42
42
  * @example
@@ -51,7 +51,7 @@ export declare class Contacts {
51
51
  * billingPostalCode: "billingPostalCode"
52
52
  * })
53
53
  */
54
- create(request: PaidApi.ContactCreate, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<PaidApi.Contact>;
54
+ create(request: Paid.ContactCreate, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
55
55
  private __create;
56
56
  /**
57
57
  * @param {string} contactId
@@ -60,7 +60,7 @@ export declare class Contacts {
60
60
  * @example
61
61
  * await client.contacts.get("contactId")
62
62
  */
63
- get(contactId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<PaidApi.Contact>;
63
+ get(contactId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
64
64
  private __get;
65
65
  /**
66
66
  * @param {string} contactId
@@ -78,7 +78,7 @@ export declare class Contacts {
78
78
  * @example
79
79
  * await client.contacts.getByExternalId("externalId")
80
80
  */
81
- getByExternalId(externalId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<PaidApi.Contact>;
81
+ getByExternalId(externalId: string, requestOptions?: Contacts.RequestOptions): core.HttpResponsePromise<Paid.Contact>;
82
82
  private __getByExternalId;
83
83
  /**
84
84
  * @param {string} externalId