@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.
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +12 -2
- package/dist/cjs/api/errors/ConflictError.d.ts +6 -0
- package/dist/cjs/api/errors/ConflictError.js +50 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/checkouts/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.ts +2 -0
- package/dist/cjs/api/resources/customers/client/Client.d.ts +21 -0
- package/dist/cjs/api/resources/customers/client/Client.js +92 -0
- package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.ts +16 -0
- package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.d.ts +6 -0
- package/dist/cjs/api/resources/index.js +7 -1
- package/dist/cjs/api/resources/orders/client/Client.d.ts +60 -0
- package/dist/cjs/api/resources/orders/client/Client.js +242 -0
- package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.ts +22 -0
- package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.d.ts +14 -0
- package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.ts +12 -0
- package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/orders/index.d.ts +1 -0
- package/dist/cjs/api/resources/orders/index.js +1 -0
- package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.d.ts +5 -0
- package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.js +8 -0
- package/dist/cjs/api/resources/orders/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/orders/types/index.js +17 -0
- package/dist/cjs/api/resources/valueReceipts/client/Client.d.ts +75 -0
- package/dist/cjs/api/resources/valueReceipts/client/Client.js +347 -0
- package/dist/cjs/api/resources/valueReceipts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/valueReceipts/client/index.js +17 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.ts +10 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.ts +9 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.js +3 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/valueReceipts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/valueReceipts/index.d.ts +1 -0
- package/dist/cjs/api/resources/valueReceipts/index.js +17 -0
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +63 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +282 -0
- package/dist/cjs/api/resources/webhooks/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/webhooks/client/index.js +17 -0
- package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.d.ts +10 -0
- package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.ts +14 -0
- package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/webhooks/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/webhooks/index.d.ts +2 -0
- package/dist/cjs/api/resources/webhooks/index.js +18 -0
- package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.ts +12 -0
- package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.js +15 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.ts +12 -0
- package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.js +15 -0
- package/dist/cjs/api/resources/webhooks/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/webhooks/types/index.js +18 -0
- package/dist/cjs/api/types/BatchSeatAssignmentsResponse.d.ts +4 -0
- package/dist/cjs/api/types/BatchSeatAssignmentsResponse.js +3 -0
- package/dist/cjs/api/types/Checkout.d.ts +1 -0
- package/dist/cjs/api/types/CheckoutDetails.d.ts +21 -0
- package/dist/cjs/api/types/CheckoutDetails.js +3 -0
- package/dist/cjs/api/types/CustomerUser.d.ts +13 -0
- package/dist/cjs/api/types/CustomerUser.js +3 -0
- package/dist/cjs/api/types/CustomerUserStatus.d.ts +5 -0
- package/dist/cjs/api/types/CustomerUserStatus.js +8 -0
- package/dist/cjs/api/types/OrderSeat.d.ts +10 -0
- package/dist/cjs/api/types/OrderSeat.js +3 -0
- package/dist/cjs/api/types/OrderSeatListResponse.d.ts +5 -0
- package/dist/cjs/api/types/OrderSeatListResponse.js +3 -0
- package/dist/cjs/api/types/SeatAssignee.d.ts +5 -0
- package/dist/cjs/api/types/SeatAssignee.js +3 -0
- package/dist/cjs/api/types/SeatAssignmentStatus.d.ts +5 -0
- package/dist/cjs/api/types/SeatAssignmentStatus.js +8 -0
- package/dist/cjs/api/types/ValueReceiptDetail.d.ts +19 -0
- package/dist/cjs/api/types/ValueReceiptDetail.js +3 -0
- package/dist/cjs/api/types/ValueReceiptListResponse.d.ts +5 -0
- package/dist/cjs/api/types/ValueReceiptListResponse.js +3 -0
- package/dist/cjs/api/types/ValueReceiptSummary.d.ts +16 -0
- package/dist/cjs/api/types/ValueReceiptSummary.js +3 -0
- package/dist/cjs/api/types/Webhook.d.ts +24 -0
- package/dist/cjs/api/types/Webhook.js +18 -0
- package/dist/cjs/api/types/WebhookDeliveryStatus.d.ts +5 -0
- package/dist/cjs/api/types/WebhookDeliveryStatus.js +8 -0
- package/dist/cjs/api/types/WebhookListResponse.d.ts +4 -0
- package/dist/cjs/api/types/WebhookListResponse.js +3 -0
- package/dist/cjs/api/types/WebhookTestResponse.d.ts +3 -0
- package/dist/cjs/api/types/WebhookTestResponse.js +3 -0
- package/dist/cjs/api/types/index.d.ts +15 -0
- package/dist/cjs/api/types/index.js +15 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +12 -2
- package/dist/esm/api/errors/ConflictError.d.mts +6 -0
- package/dist/esm/api/errors/ConflictError.mjs +13 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/checkouts/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +2 -0
- package/dist/esm/api/resources/customers/client/Client.d.mts +21 -0
- package/dist/esm/api/resources/customers/client/Client.mjs +92 -0
- package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.mts +16 -0
- package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/index.d.mts +6 -0
- package/dist/esm/api/resources/index.mjs +6 -0
- package/dist/esm/api/resources/orders/client/Client.d.mts +60 -0
- package/dist/esm/api/resources/orders/client/Client.mjs +242 -0
- package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.mts +22 -0
- package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.d.mts +14 -0
- package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.mts +12 -0
- package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/orders/index.d.mts +1 -0
- package/dist/esm/api/resources/orders/index.mjs +1 -0
- package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.d.mts +5 -0
- package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.mjs +5 -0
- package/dist/esm/api/resources/orders/types/index.d.mts +1 -0
- package/dist/esm/api/resources/orders/types/index.mjs +1 -0
- package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +75 -0
- package/dist/esm/api/resources/valueReceipts/client/Client.mjs +310 -0
- package/dist/esm/api/resources/valueReceipts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/valueReceipts/client/index.mjs +1 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.mts +10 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.mts +10 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.mts +9 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.mjs +2 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/valueReceipts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/valueReceipts/index.d.mts +1 -0
- package/dist/esm/api/resources/valueReceipts/index.mjs +1 -0
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +63 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +245 -0
- package/dist/esm/api/resources/webhooks/client/index.d.mts +1 -0
- package/dist/esm/api/resources/webhooks/client/index.mjs +1 -0
- package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.d.mts +10 -0
- package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.mts +14 -0
- package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/webhooks/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/webhooks/index.d.mts +2 -0
- package/dist/esm/api/resources/webhooks/index.mjs +2 -0
- package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.mts +12 -0
- package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.mjs +12 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.mts +12 -0
- package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.mjs +12 -0
- package/dist/esm/api/resources/webhooks/types/index.d.mts +2 -0
- package/dist/esm/api/resources/webhooks/types/index.mjs +2 -0
- package/dist/esm/api/types/BatchSeatAssignmentsResponse.d.mts +4 -0
- package/dist/esm/api/types/BatchSeatAssignmentsResponse.mjs +2 -0
- package/dist/esm/api/types/Checkout.d.mts +1 -0
- package/dist/esm/api/types/CheckoutDetails.d.mts +21 -0
- package/dist/esm/api/types/CheckoutDetails.mjs +2 -0
- package/dist/esm/api/types/CustomerUser.d.mts +13 -0
- package/dist/esm/api/types/CustomerUser.mjs +2 -0
- package/dist/esm/api/types/CustomerUserStatus.d.mts +5 -0
- package/dist/esm/api/types/CustomerUserStatus.mjs +5 -0
- package/dist/esm/api/types/OrderSeat.d.mts +10 -0
- package/dist/esm/api/types/OrderSeat.mjs +2 -0
- package/dist/esm/api/types/OrderSeatListResponse.d.mts +5 -0
- package/dist/esm/api/types/OrderSeatListResponse.mjs +2 -0
- package/dist/esm/api/types/SeatAssignee.d.mts +5 -0
- package/dist/esm/api/types/SeatAssignee.mjs +2 -0
- package/dist/esm/api/types/SeatAssignmentStatus.d.mts +5 -0
- package/dist/esm/api/types/SeatAssignmentStatus.mjs +5 -0
- package/dist/esm/api/types/ValueReceiptDetail.d.mts +19 -0
- package/dist/esm/api/types/ValueReceiptDetail.mjs +2 -0
- package/dist/esm/api/types/ValueReceiptListResponse.d.mts +5 -0
- package/dist/esm/api/types/ValueReceiptListResponse.mjs +2 -0
- package/dist/esm/api/types/ValueReceiptSummary.d.mts +16 -0
- package/dist/esm/api/types/ValueReceiptSummary.mjs +2 -0
- package/dist/esm/api/types/Webhook.d.mts +24 -0
- package/dist/esm/api/types/Webhook.mjs +15 -0
- package/dist/esm/api/types/WebhookDeliveryStatus.d.mts +5 -0
- package/dist/esm/api/types/WebhookDeliveryStatus.mjs +5 -0
- package/dist/esm/api/types/WebhookListResponse.d.mts +4 -0
- package/dist/esm/api/types/WebhookListResponse.mjs +2 -0
- package/dist/esm/api/types/WebhookTestResponse.d.mts +3 -0
- package/dist/esm/api/types/WebhookTestResponse.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +15 -0
- package/dist/esm/api/types/index.mjs +15 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- 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,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 {};
|
|
@@ -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
|
+
}
|