@paid-ai/paid-node 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/cjs/Client.d.ts +6 -0
  2. package/dist/cjs/Client.js +12 -2
  3. package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
  4. package/dist/cjs/api/errors/ConflictError.js +50 -0
  5. package/dist/cjs/api/errors/index.d.ts +1 -0
  6. package/dist/cjs/api/errors/index.js +1 -0
  7. package/dist/cjs/api/resources/checkouts/client/Client.d.ts +1 -1
  8. package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.ts +2 -0
  9. package/dist/cjs/api/resources/customers/client/Client.d.ts +21 -0
  10. package/dist/cjs/api/resources/customers/client/Client.js +92 -0
  11. package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.ts +16 -0
  12. package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.js +3 -0
  13. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +1 -0
  14. package/dist/cjs/api/resources/index.d.ts +6 -0
  15. package/dist/cjs/api/resources/index.js +7 -1
  16. package/dist/cjs/api/resources/orders/client/Client.d.ts +60 -0
  17. package/dist/cjs/api/resources/orders/client/Client.js +242 -0
  18. package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.ts +22 -0
  19. package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.js +3 -0
  20. package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.d.ts +14 -0
  21. package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.js +3 -0
  22. package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.ts +12 -0
  23. package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.js +3 -0
  24. package/dist/cjs/api/resources/orders/client/requests/index.d.ts +3 -0
  25. package/dist/cjs/api/resources/orders/index.d.ts +1 -0
  26. package/dist/cjs/api/resources/orders/index.js +1 -0
  27. package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.d.ts +5 -0
  28. package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.js +8 -0
  29. package/dist/cjs/api/resources/orders/types/index.d.ts +1 -0
  30. package/dist/cjs/api/resources/orders/types/index.js +17 -0
  31. package/dist/cjs/api/resources/valueReceipts/client/Client.d.ts +75 -0
  32. package/dist/cjs/api/resources/valueReceipts/client/Client.js +347 -0
  33. package/dist/cjs/api/resources/valueReceipts/client/index.d.ts +1 -0
  34. package/dist/cjs/api/resources/valueReceipts/client/index.js +17 -0
  35. package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.ts +9 -0
  36. package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.js +3 -0
  37. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.ts +10 -0
  38. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.js +3 -0
  39. package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.ts +10 -0
  40. package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.js +3 -0
  41. package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.ts +9 -0
  42. package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.js +3 -0
  43. package/dist/cjs/api/resources/valueReceipts/client/requests/index.d.ts +4 -0
  44. package/dist/cjs/api/resources/valueReceipts/client/requests/index.js +2 -0
  45. package/dist/cjs/api/resources/valueReceipts/index.d.ts +1 -0
  46. package/dist/cjs/api/resources/valueReceipts/index.js +17 -0
  47. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +63 -0
  48. package/dist/cjs/api/resources/webhooks/client/Client.js +282 -0
  49. package/dist/cjs/api/resources/webhooks/client/index.d.ts +1 -0
  50. package/dist/cjs/api/resources/webhooks/client/index.js +17 -0
  51. package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.d.ts +10 -0
  52. package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.js +3 -0
  53. package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.ts +14 -0
  54. package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.js +3 -0
  55. package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
  56. package/dist/cjs/api/resources/webhooks/client/requests/index.js +2 -0
  57. package/dist/cjs/api/resources/webhooks/index.d.ts +2 -0
  58. package/dist/cjs/api/resources/webhooks/index.js +18 -0
  59. package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.ts +12 -0
  60. package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.js +15 -0
  61. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.ts +12 -0
  62. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.js +15 -0
  63. package/dist/cjs/api/resources/webhooks/types/index.d.ts +2 -0
  64. package/dist/cjs/api/resources/webhooks/types/index.js +18 -0
  65. package/dist/cjs/api/types/BatchSeatAssignmentsResponse.d.ts +4 -0
  66. package/dist/cjs/api/types/BatchSeatAssignmentsResponse.js +3 -0
  67. package/dist/cjs/api/types/Checkout.d.ts +1 -0
  68. package/dist/cjs/api/types/CheckoutDetails.d.ts +21 -0
  69. package/dist/cjs/api/types/CheckoutDetails.js +3 -0
  70. package/dist/cjs/api/types/CustomerUser.d.ts +13 -0
  71. package/dist/cjs/api/types/CustomerUser.js +3 -0
  72. package/dist/cjs/api/types/CustomerUserStatus.d.ts +5 -0
  73. package/dist/cjs/api/types/CustomerUserStatus.js +8 -0
  74. package/dist/cjs/api/types/OrderSeat.d.ts +10 -0
  75. package/dist/cjs/api/types/OrderSeat.js +3 -0
  76. package/dist/cjs/api/types/OrderSeatListResponse.d.ts +5 -0
  77. package/dist/cjs/api/types/OrderSeatListResponse.js +3 -0
  78. package/dist/cjs/api/types/SeatAssignee.d.ts +5 -0
  79. package/dist/cjs/api/types/SeatAssignee.js +3 -0
  80. package/dist/cjs/api/types/SeatAssignmentStatus.d.ts +5 -0
  81. package/dist/cjs/api/types/SeatAssignmentStatus.js +8 -0
  82. package/dist/cjs/api/types/ValueReceiptDetail.d.ts +19 -0
  83. package/dist/cjs/api/types/ValueReceiptDetail.js +3 -0
  84. package/dist/cjs/api/types/ValueReceiptListResponse.d.ts +5 -0
  85. package/dist/cjs/api/types/ValueReceiptListResponse.js +3 -0
  86. package/dist/cjs/api/types/ValueReceiptSummary.d.ts +16 -0
  87. package/dist/cjs/api/types/ValueReceiptSummary.js +3 -0
  88. package/dist/cjs/api/types/Webhook.d.ts +24 -0
  89. package/dist/cjs/api/types/Webhook.js +18 -0
  90. package/dist/cjs/api/types/WebhookDeliveryStatus.d.ts +5 -0
  91. package/dist/cjs/api/types/WebhookDeliveryStatus.js +8 -0
  92. package/dist/cjs/api/types/WebhookListResponse.d.ts +4 -0
  93. package/dist/cjs/api/types/WebhookListResponse.js +3 -0
  94. package/dist/cjs/api/types/WebhookTestResponse.d.ts +3 -0
  95. package/dist/cjs/api/types/WebhookTestResponse.js +3 -0
  96. package/dist/cjs/api/types/index.d.ts +15 -0
  97. package/dist/cjs/api/types/index.js +15 -0
  98. package/dist/cjs/version.d.ts +1 -1
  99. package/dist/cjs/version.js +1 -1
  100. package/dist/esm/Client.d.mts +6 -0
  101. package/dist/esm/Client.mjs +12 -2
  102. package/dist/esm/api/errors/ConflictError.d.mts +6 -0
  103. package/dist/esm/api/errors/ConflictError.mjs +13 -0
  104. package/dist/esm/api/errors/index.d.mts +1 -0
  105. package/dist/esm/api/errors/index.mjs +1 -0
  106. package/dist/esm/api/resources/checkouts/client/Client.d.mts +1 -1
  107. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +2 -0
  108. package/dist/esm/api/resources/customers/client/Client.d.mts +21 -0
  109. package/dist/esm/api/resources/customers/client/Client.mjs +92 -0
  110. package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.mts +16 -0
  111. package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.mjs +2 -0
  112. package/dist/esm/api/resources/customers/client/requests/index.d.mts +1 -0
  113. package/dist/esm/api/resources/index.d.mts +6 -0
  114. package/dist/esm/api/resources/index.mjs +6 -0
  115. package/dist/esm/api/resources/orders/client/Client.d.mts +60 -0
  116. package/dist/esm/api/resources/orders/client/Client.mjs +242 -0
  117. package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.mts +22 -0
  118. package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.mjs +2 -0
  119. package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.d.mts +14 -0
  120. package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.mjs +2 -0
  121. package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.mts +12 -0
  122. package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.mjs +2 -0
  123. package/dist/esm/api/resources/orders/client/requests/index.d.mts +3 -0
  124. package/dist/esm/api/resources/orders/index.d.mts +1 -0
  125. package/dist/esm/api/resources/orders/index.mjs +1 -0
  126. package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.d.mts +5 -0
  127. package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.mjs +5 -0
  128. package/dist/esm/api/resources/orders/types/index.d.mts +1 -0
  129. package/dist/esm/api/resources/orders/types/index.mjs +1 -0
  130. package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +75 -0
  131. package/dist/esm/api/resources/valueReceipts/client/Client.mjs +310 -0
  132. package/dist/esm/api/resources/valueReceipts/client/index.d.mts +1 -0
  133. package/dist/esm/api/resources/valueReceipts/client/index.mjs +1 -0
  134. package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.mts +9 -0
  135. package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.mjs +2 -0
  136. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.mts +10 -0
  137. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.mjs +2 -0
  138. package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.mts +10 -0
  139. package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.mjs +2 -0
  140. package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.mts +9 -0
  141. package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.mjs +2 -0
  142. package/dist/esm/api/resources/valueReceipts/client/requests/index.d.mts +4 -0
  143. package/dist/esm/api/resources/valueReceipts/client/requests/index.mjs +1 -0
  144. package/dist/esm/api/resources/valueReceipts/index.d.mts +1 -0
  145. package/dist/esm/api/resources/valueReceipts/index.mjs +1 -0
  146. package/dist/esm/api/resources/webhooks/client/Client.d.mts +63 -0
  147. package/dist/esm/api/resources/webhooks/client/Client.mjs +245 -0
  148. package/dist/esm/api/resources/webhooks/client/index.d.mts +1 -0
  149. package/dist/esm/api/resources/webhooks/client/index.mjs +1 -0
  150. package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.d.mts +10 -0
  151. package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.mjs +2 -0
  152. package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.mts +14 -0
  153. package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.mjs +2 -0
  154. package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
  155. package/dist/esm/api/resources/webhooks/client/requests/index.mjs +1 -0
  156. package/dist/esm/api/resources/webhooks/index.d.mts +2 -0
  157. package/dist/esm/api/resources/webhooks/index.mjs +2 -0
  158. package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.mts +12 -0
  159. package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.mjs +12 -0
  160. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.mts +12 -0
  161. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.mjs +12 -0
  162. package/dist/esm/api/resources/webhooks/types/index.d.mts +2 -0
  163. package/dist/esm/api/resources/webhooks/types/index.mjs +2 -0
  164. package/dist/esm/api/types/BatchSeatAssignmentsResponse.d.mts +4 -0
  165. package/dist/esm/api/types/BatchSeatAssignmentsResponse.mjs +2 -0
  166. package/dist/esm/api/types/Checkout.d.mts +1 -0
  167. package/dist/esm/api/types/CheckoutDetails.d.mts +21 -0
  168. package/dist/esm/api/types/CheckoutDetails.mjs +2 -0
  169. package/dist/esm/api/types/CustomerUser.d.mts +13 -0
  170. package/dist/esm/api/types/CustomerUser.mjs +2 -0
  171. package/dist/esm/api/types/CustomerUserStatus.d.mts +5 -0
  172. package/dist/esm/api/types/CustomerUserStatus.mjs +5 -0
  173. package/dist/esm/api/types/OrderSeat.d.mts +10 -0
  174. package/dist/esm/api/types/OrderSeat.mjs +2 -0
  175. package/dist/esm/api/types/OrderSeatListResponse.d.mts +5 -0
  176. package/dist/esm/api/types/OrderSeatListResponse.mjs +2 -0
  177. package/dist/esm/api/types/SeatAssignee.d.mts +5 -0
  178. package/dist/esm/api/types/SeatAssignee.mjs +2 -0
  179. package/dist/esm/api/types/SeatAssignmentStatus.d.mts +5 -0
  180. package/dist/esm/api/types/SeatAssignmentStatus.mjs +5 -0
  181. package/dist/esm/api/types/ValueReceiptDetail.d.mts +19 -0
  182. package/dist/esm/api/types/ValueReceiptDetail.mjs +2 -0
  183. package/dist/esm/api/types/ValueReceiptListResponse.d.mts +5 -0
  184. package/dist/esm/api/types/ValueReceiptListResponse.mjs +2 -0
  185. package/dist/esm/api/types/ValueReceiptSummary.d.mts +16 -0
  186. package/dist/esm/api/types/ValueReceiptSummary.mjs +2 -0
  187. package/dist/esm/api/types/Webhook.d.mts +24 -0
  188. package/dist/esm/api/types/Webhook.mjs +15 -0
  189. package/dist/esm/api/types/WebhookDeliveryStatus.d.mts +5 -0
  190. package/dist/esm/api/types/WebhookDeliveryStatus.mjs +5 -0
  191. package/dist/esm/api/types/WebhookListResponse.d.mts +4 -0
  192. package/dist/esm/api/types/WebhookListResponse.mjs +2 -0
  193. package/dist/esm/api/types/WebhookTestResponse.d.mts +3 -0
  194. package/dist/esm/api/types/WebhookTestResponse.mjs +2 -0
  195. package/dist/esm/api/types/index.d.mts +15 -0
  196. package/dist/esm/api/types/index.mjs +15 -0
  197. package/dist/esm/version.d.mts +1 -1
  198. package/dist/esm/version.mjs +1 -1
  199. package/package.json +1 -1
  200. package/reference.md +711 -1
@@ -0,0 +1,310 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
23
+ import * as core from "../../../../core/index.mjs";
24
+ import * as environments from "../../../../environments.mjs";
25
+ import * as errors from "../../../../errors/index.mjs";
26
+ import * as Paid from "../../../index.mjs";
27
+ export class ValueReceipts {
28
+ constructor(_options) {
29
+ this._options = _options;
30
+ }
31
+ /**
32
+ * List value receipts for the organization
33
+ *
34
+ * @param {Paid.ListValueReceiptsRequest} request
35
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Paid.InternalServerError}
38
+ *
39
+ * @example
40
+ * await client.valueReceipts.listValueReceipts()
41
+ */
42
+ listValueReceipts(request = {}, requestOptions) {
43
+ return core.HttpResponsePromise.fromPromise(this.__listValueReceipts(request, requestOptions));
44
+ }
45
+ __listValueReceipts() {
46
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
47
+ var _a, _b, _c, _d, _e, _f, _g, _h;
48
+ const { limit, offset, customerId, orderId } = request;
49
+ const _queryParams = {};
50
+ if (limit != null) {
51
+ _queryParams.limit = limit.toString();
52
+ }
53
+ if (offset != null) {
54
+ _queryParams.offset = offset.toString();
55
+ }
56
+ if (customerId != null) {
57
+ _queryParams.customerId = customerId;
58
+ }
59
+ if (orderId != null) {
60
+ _queryParams.orderId = orderId;
61
+ }
62
+ 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);
63
+ const _response = yield core.fetcher({
64
+ 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.Default, "value-receipts/"),
65
+ method: "GET",
66
+ headers: _headers,
67
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
68
+ 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,
69
+ 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,
70
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
71
+ });
72
+ if (_response.ok) {
73
+ return { data: _response.body, rawResponse: _response.rawResponse };
74
+ }
75
+ if (_response.error.reason === "status-code") {
76
+ switch (_response.error.statusCode) {
77
+ case 500:
78
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
79
+ default:
80
+ throw new errors.PaidError({
81
+ statusCode: _response.error.statusCode,
82
+ body: _response.error.body,
83
+ rawResponse: _response.rawResponse,
84
+ });
85
+ }
86
+ }
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 /value-receipts/.");
96
+ case "unknown":
97
+ throw new errors.PaidError({
98
+ message: _response.error.errorMessage,
99
+ rawResponse: _response.rawResponse,
100
+ });
101
+ }
102
+ });
103
+ }
104
+ /**
105
+ * Get a value receipt by ID, including its publish/share state.
106
+ *
107
+ * @param {Paid.GetValueReceiptByIdRequest} request
108
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
109
+ *
110
+ * @throws {@link Paid.NotFoundError}
111
+ * @throws {@link Paid.InternalServerError}
112
+ *
113
+ * @example
114
+ * await client.valueReceipts.getValueReceiptById({
115
+ * id: "id"
116
+ * })
117
+ */
118
+ getValueReceiptById(request, requestOptions) {
119
+ return core.HttpResponsePromise.fromPromise(this.__getValueReceiptById(request, requestOptions));
120
+ }
121
+ __getValueReceiptById(request, requestOptions) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ var _a, _b, _c, _d, _e, _f, _g, _h;
124
+ const { id } = request;
125
+ 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);
126
+ const _response = yield core.fetcher({
127
+ 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.Default, `value-receipts/${core.url.encodePathParam(id)}`),
128
+ method: "GET",
129
+ headers: _headers,
130
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
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,
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,
133
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
134
+ });
135
+ if (_response.ok) {
136
+ return { data: _response.body, rawResponse: _response.rawResponse };
137
+ }
138
+ if (_response.error.reason === "status-code") {
139
+ switch (_response.error.statusCode) {
140
+ case 404:
141
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
142
+ case 500:
143
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
144
+ default:
145
+ throw new errors.PaidError({
146
+ statusCode: _response.error.statusCode,
147
+ body: _response.error.body,
148
+ rawResponse: _response.rawResponse,
149
+ });
150
+ }
151
+ }
152
+ switch (_response.error.reason) {
153
+ case "non-json":
154
+ throw new errors.PaidError({
155
+ statusCode: _response.error.statusCode,
156
+ body: _response.error.rawBody,
157
+ rawResponse: _response.rawResponse,
158
+ });
159
+ case "timeout":
160
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /value-receipts/{id}.");
161
+ case "unknown":
162
+ throw new errors.PaidError({
163
+ message: _response.error.errorMessage,
164
+ rawResponse: _response.rawResponse,
165
+ });
166
+ }
167
+ });
168
+ }
169
+ /**
170
+ * Make a value receipt publicly accessible via URL.
171
+ *
172
+ * @param {Paid.PublishValueReceiptBody} request
173
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
174
+ *
175
+ * @throws {@link Paid.NotFoundError}
176
+ * @throws {@link Paid.InternalServerError}
177
+ *
178
+ * @example
179
+ * await client.valueReceipts.publishValueReceipt({
180
+ * id: "id"
181
+ * })
182
+ */
183
+ publishValueReceipt(request, requestOptions) {
184
+ return core.HttpResponsePromise.fromPromise(this.__publishValueReceipt(request, requestOptions));
185
+ }
186
+ __publishValueReceipt(request, requestOptions) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ var _a, _b, _c, _d, _e, _f, _g, _h;
189
+ const { id } = request, _body = __rest(request, ["id"]);
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);
191
+ const _response = yield core.fetcher({
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.Default, `value-receipts/${core.url.encodePathParam(id)}/publish`),
193
+ method: "POST",
194
+ headers: _headers,
195
+ contentType: "application/json",
196
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
197
+ requestType: "json",
198
+ body: _body,
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,
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,
201
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
202
+ });
203
+ if (_response.ok) {
204
+ return { data: _response.body, rawResponse: _response.rawResponse };
205
+ }
206
+ if (_response.error.reason === "status-code") {
207
+ switch (_response.error.statusCode) {
208
+ case 404:
209
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
210
+ case 500:
211
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
212
+ default:
213
+ throw new errors.PaidError({
214
+ statusCode: _response.error.statusCode,
215
+ body: _response.error.body,
216
+ rawResponse: _response.rawResponse,
217
+ });
218
+ }
219
+ }
220
+ switch (_response.error.reason) {
221
+ case "non-json":
222
+ throw new errors.PaidError({
223
+ statusCode: _response.error.statusCode,
224
+ body: _response.error.rawBody,
225
+ rawResponse: _response.rawResponse,
226
+ });
227
+ case "timeout":
228
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /value-receipts/{id}/publish.");
229
+ case "unknown":
230
+ throw new errors.PaidError({
231
+ message: _response.error.errorMessage,
232
+ rawResponse: _response.rawResponse,
233
+ });
234
+ }
235
+ });
236
+ }
237
+ /**
238
+ * Revoke public access to a value receipt.
239
+ *
240
+ * @param {Paid.UnpublishValueReceiptRequest} request
241
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
242
+ *
243
+ * @throws {@link Paid.NotFoundError}
244
+ * @throws {@link Paid.InternalServerError}
245
+ *
246
+ * @example
247
+ * await client.valueReceipts.unpublishValueReceipt({
248
+ * id: "id"
249
+ * })
250
+ */
251
+ unpublishValueReceipt(request, requestOptions) {
252
+ return core.HttpResponsePromise.fromPromise(this.__unpublishValueReceipt(request, requestOptions));
253
+ }
254
+ __unpublishValueReceipt(request, requestOptions) {
255
+ return __awaiter(this, void 0, void 0, function* () {
256
+ var _a, _b, _c, _d, _e, _f, _g, _h;
257
+ const { id } = request, _body = __rest(request, ["id"]);
258
+ 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);
259
+ const _response = yield core.fetcher({
260
+ 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.Default, `value-receipts/${core.url.encodePathParam(id)}/unpublish`),
261
+ method: "POST",
262
+ headers: _headers,
263
+ contentType: "application/json",
264
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
265
+ requestType: "json",
266
+ body: _body,
267
+ 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,
268
+ 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,
269
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
270
+ });
271
+ if (_response.ok) {
272
+ return { data: _response.body, rawResponse: _response.rawResponse };
273
+ }
274
+ if (_response.error.reason === "status-code") {
275
+ switch (_response.error.statusCode) {
276
+ case 404:
277
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
278
+ case 500:
279
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
280
+ default:
281
+ throw new errors.PaidError({
282
+ statusCode: _response.error.statusCode,
283
+ body: _response.error.body,
284
+ rawResponse: _response.rawResponse,
285
+ });
286
+ }
287
+ }
288
+ switch (_response.error.reason) {
289
+ case "non-json":
290
+ throw new errors.PaidError({
291
+ statusCode: _response.error.statusCode,
292
+ body: _response.error.rawBody,
293
+ rawResponse: _response.rawResponse,
294
+ });
295
+ case "timeout":
296
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /value-receipts/{id}/unpublish.");
297
+ case "unknown":
298
+ throw new errors.PaidError({
299
+ message: _response.error.errorMessage,
300
+ rawResponse: _response.rawResponse,
301
+ });
302
+ }
303
+ });
304
+ }
305
+ _getAuthorizationHeader() {
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
308
+ });
309
+ }
310
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface GetValueReceiptByIdRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListValueReceiptsRequest {
6
+ limit?: number;
7
+ offset?: number;
8
+ customerId?: string;
9
+ orderId?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface PublishValueReceiptBody {
8
+ id: string;
9
+ publishExpiresAt?: string | null;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface UnpublishValueReceiptRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export type { GetValueReceiptByIdRequest } from "./GetValueReceiptByIdRequest.mjs";
2
+ export type { ListValueReceiptsRequest } from "./ListValueReceiptsRequest.mjs";
3
+ export type { PublishValueReceiptBody } from "./PublishValueReceiptBody.mjs";
4
+ export type { UnpublishValueReceiptRequest } from "./UnpublishValueReceiptRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1,63 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import * as Paid from "../../../index.mjs";
4
+ export declare namespace Webhooks {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class Webhooks {
11
+ protected readonly _options: Webhooks.Options;
12
+ constructor(_options: Webhooks.Options);
13
+ /**
14
+ * List customer-facing billing webhooks for the authenticated organization.
15
+ *
16
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
17
+ *
18
+ * @throws {@link Paid.ForbiddenError}
19
+ * @throws {@link Paid.InternalServerError}
20
+ *
21
+ * @example
22
+ * await client.webhooks.listWebhooks()
23
+ */
24
+ listWebhooks(requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Paid.WebhookListResponse>;
25
+ private __listWebhooks;
26
+ /**
27
+ * Enable or disable a webhook and configure the destination URL for the authenticated organization.
28
+ *
29
+ * @param {Paid.UpdateWebhookRequest} request
30
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
31
+ *
32
+ * @throws {@link Paid.BadRequestError}
33
+ * @throws {@link Paid.ForbiddenError}
34
+ * @throws {@link Paid.NotFoundError}
35
+ * @throws {@link Paid.InternalServerError}
36
+ *
37
+ * @example
38
+ * await client.webhooks.updateWebhook({
39
+ * webhookName: "billing-invoice-created"
40
+ * })
41
+ */
42
+ updateWebhook(request: Paid.UpdateWebhookRequest, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Paid.Webhook>;
43
+ private __updateWebhook;
44
+ /**
45
+ * Send a synthetic webhook delivery to the configured destination for this webhook.
46
+ *
47
+ * @param {Paid.TestWebhookRequest} request
48
+ * @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
49
+ *
50
+ * @throws {@link Paid.BadRequestError}
51
+ * @throws {@link Paid.ForbiddenError}
52
+ * @throws {@link Paid.NotFoundError}
53
+ * @throws {@link Paid.InternalServerError}
54
+ *
55
+ * @example
56
+ * await client.webhooks.testWebhook({
57
+ * webhookName: "billing-invoice-created"
58
+ * })
59
+ */
60
+ testWebhook(request: Paid.TestWebhookRequest, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Paid.WebhookTestResponse>;
61
+ private __testWebhook;
62
+ protected _getAuthorizationHeader(): Promise<string>;
63
+ }