@paid-ai/paid-node 1.2.0 → 1.2.1

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 (70) hide show
  1. package/dist/cjs/Client.d.ts +3 -0
  2. package/dist/cjs/Client.js +7 -2
  3. package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.ts +2 -0
  4. package/dist/cjs/api/resources/customers/client/Client.d.ts +2 -0
  5. package/dist/cjs/api/resources/customers/client/Client.js +6 -0
  6. package/dist/cjs/api/resources/index.d.ts +2 -0
  7. package/dist/cjs/api/resources/index.js +3 -1
  8. package/dist/cjs/api/resources/valueReceipts/client/Client.d.ts +75 -0
  9. package/dist/cjs/api/resources/valueReceipts/client/Client.js +347 -0
  10. package/dist/cjs/api/resources/valueReceipts/client/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/valueReceipts/client/index.js +17 -0
  12. package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.ts +9 -0
  13. package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.js +3 -0
  14. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.ts +10 -0
  15. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.js +3 -0
  16. package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.ts +10 -0
  17. package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.js +3 -0
  18. package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.ts +9 -0
  19. package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.js +3 -0
  20. package/dist/cjs/api/resources/valueReceipts/client/requests/index.d.ts +4 -0
  21. package/dist/cjs/api/resources/valueReceipts/client/requests/index.js +2 -0
  22. package/dist/cjs/api/resources/valueReceipts/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/valueReceipts/index.js +17 -0
  24. package/dist/cjs/api/types/Checkout.d.ts +1 -0
  25. package/dist/cjs/api/types/ValueReceiptDetail.d.ts +19 -0
  26. package/dist/cjs/api/types/ValueReceiptDetail.js +3 -0
  27. package/dist/cjs/api/types/ValueReceiptListResponse.d.ts +5 -0
  28. package/dist/cjs/api/types/ValueReceiptListResponse.js +3 -0
  29. package/dist/cjs/api/types/ValueReceiptSummary.d.ts +16 -0
  30. package/dist/cjs/api/types/ValueReceiptSummary.js +3 -0
  31. package/dist/cjs/api/types/index.d.ts +3 -0
  32. package/dist/cjs/api/types/index.js +3 -0
  33. package/dist/cjs/version.d.ts +1 -1
  34. package/dist/cjs/version.js +1 -1
  35. package/dist/esm/Client.d.mts +3 -0
  36. package/dist/esm/Client.mjs +7 -2
  37. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +2 -0
  38. package/dist/esm/api/resources/customers/client/Client.d.mts +2 -0
  39. package/dist/esm/api/resources/customers/client/Client.mjs +6 -0
  40. package/dist/esm/api/resources/index.d.mts +2 -0
  41. package/dist/esm/api/resources/index.mjs +2 -0
  42. package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +75 -0
  43. package/dist/esm/api/resources/valueReceipts/client/Client.mjs +310 -0
  44. package/dist/esm/api/resources/valueReceipts/client/index.d.mts +1 -0
  45. package/dist/esm/api/resources/valueReceipts/client/index.mjs +1 -0
  46. package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.mts +9 -0
  47. package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.mjs +2 -0
  48. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.mts +10 -0
  49. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.mjs +2 -0
  50. package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.mts +10 -0
  51. package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.mjs +2 -0
  52. package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.mts +9 -0
  53. package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.mjs +2 -0
  54. package/dist/esm/api/resources/valueReceipts/client/requests/index.d.mts +4 -0
  55. package/dist/esm/api/resources/valueReceipts/client/requests/index.mjs +1 -0
  56. package/dist/esm/api/resources/valueReceipts/index.d.mts +1 -0
  57. package/dist/esm/api/resources/valueReceipts/index.mjs +1 -0
  58. package/dist/esm/api/types/Checkout.d.mts +1 -0
  59. package/dist/esm/api/types/ValueReceiptDetail.d.mts +19 -0
  60. package/dist/esm/api/types/ValueReceiptDetail.mjs +2 -0
  61. package/dist/esm/api/types/ValueReceiptListResponse.d.mts +5 -0
  62. package/dist/esm/api/types/ValueReceiptListResponse.mjs +2 -0
  63. package/dist/esm/api/types/ValueReceiptSummary.d.mts +16 -0
  64. package/dist/esm/api/types/ValueReceiptSummary.mjs +2 -0
  65. package/dist/esm/api/types/index.d.mts +3 -0
  66. package/dist/esm/api/types/index.mjs +3 -0
  67. package/dist/esm/version.d.mts +1 -1
  68. package/dist/esm/version.mjs +1 -1
  69. package/package.json +1 -1
  70. package/reference.md +259 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -13,6 +13,7 @@ export interface Checkout {
13
13
  collectAddress: boolean;
14
14
  collectPhone: boolean;
15
15
  singleUse: boolean;
16
+ allowedCurrencies: string[];
16
17
  createdAt: string;
17
18
  updatedAt: string;
18
19
  }
@@ -0,0 +1,19 @@
1
+ export interface ValueReceiptDetail {
2
+ id: string;
3
+ status: string;
4
+ publicUrlToken: string;
5
+ publicUrl: string;
6
+ isPublished: boolean;
7
+ customerId: string | null;
8
+ customerName: string | null;
9
+ customerExternalId: string | null;
10
+ orderId: string | null;
11
+ currency: string;
12
+ startDate: string | null;
13
+ endDate: string | null;
14
+ totalDeliveredValue: number | null;
15
+ createdAt: string;
16
+ publishedAt: string | null;
17
+ publishExpiresAt: string | null;
18
+ allowEmbed: boolean;
19
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type * as Paid from "../index.js";
2
+ export interface ValueReceiptListResponse {
3
+ data: Paid.ValueReceiptSummary[];
4
+ total: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ export interface ValueReceiptSummary {
2
+ id: string;
3
+ status: string;
4
+ publicUrlToken: string;
5
+ publicUrl: string;
6
+ isPublished: boolean;
7
+ customerId: string | null;
8
+ customerName: string | null;
9
+ customerExternalId: string | null;
10
+ orderId: string | null;
11
+ currency: string;
12
+ startDate: string | null;
13
+ endDate: string | null;
14
+ totalDeliveredValue: number | null;
15
+ createdAt: string;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -43,3 +43,6 @@ export * from "./Signal.js";
43
43
  export * from "./UpdateContactRequest.js";
44
44
  export * from "./UpdateCustomerRequest.js";
45
45
  export * from "./UpdateProductRequest.js";
46
+ export * from "./ValueReceiptDetail.js";
47
+ export * from "./ValueReceiptListResponse.js";
48
+ export * from "./ValueReceiptSummary.js";
@@ -59,3 +59,6 @@ __exportStar(require("./Signal.js"), exports);
59
59
  __exportStar(require("./UpdateContactRequest.js"), exports);
60
60
  __exportStar(require("./UpdateCustomerRequest.js"), exports);
61
61
  __exportStar(require("./UpdateProductRequest.js"), exports);
62
+ __exportStar(require("./ValueReceiptDetail.js"), exports);
63
+ __exportStar(require("./ValueReceiptListResponse.js"), exports);
64
+ __exportStar(require("./ValueReceiptSummary.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.2.0";
1
+ export declare const SDK_VERSION = "1.2.1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.2.0";
4
+ exports.SDK_VERSION = "1.2.1";
@@ -7,6 +7,7 @@ import { Invoices } from "./api/resources/invoices/client/Client.mjs";
7
7
  import { Orders } from "./api/resources/orders/client/Client.mjs";
8
8
  import { Products } from "./api/resources/products/client/Client.mjs";
9
9
  import { Signals } from "./api/resources/signals/client/Client.mjs";
10
+ import { ValueReceipts } from "./api/resources/valueReceipts/client/Client.mjs";
10
11
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
11
12
  export declare namespace PaidClient {
12
13
  interface Options extends BaseClientOptions {
@@ -25,6 +26,7 @@ export declare class PaidClient {
25
26
  protected _credits: Credits | undefined;
26
27
  protected _checkouts: Checkouts | undefined;
27
28
  protected _customerPortals: CustomerPortals | undefined;
29
+ protected _valueReceipts: ValueReceipts | undefined;
28
30
  constructor(_options: PaidClient.Options);
29
31
  get products(): Products;
30
32
  get customers(): Customers;
@@ -35,4 +37,5 @@ export declare class PaidClient {
35
37
  get credits(): Credits;
36
38
  get checkouts(): Checkouts;
37
39
  get customerPortals(): CustomerPortals;
40
+ get valueReceipts(): ValueReceipts;
38
41
  }
@@ -8,6 +8,7 @@ import { Invoices } from "./api/resources/invoices/client/Client.mjs";
8
8
  import { Orders } from "./api/resources/orders/client/Client.mjs";
9
9
  import { Products } from "./api/resources/products/client/Client.mjs";
10
10
  import { Signals } from "./api/resources/signals/client/Client.mjs";
11
+ import { ValueReceipts } from "./api/resources/valueReceipts/client/Client.mjs";
11
12
  import { mergeHeaders } from "./core/headers.mjs";
12
13
  import * as core from "./core/index.mjs";
13
14
  export class PaidClient {
@@ -15,8 +16,8 @@ export class PaidClient {
15
16
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
16
17
  "X-Fern-Language": "JavaScript",
17
18
  "X-Fern-SDK-Name": "@paid-ai/paid-node",
18
- "X-Fern-SDK-Version": "1.2.0",
19
- "User-Agent": "@paid-ai/paid-node/1.2.0",
19
+ "X-Fern-SDK-Version": "1.2.1",
20
+ "User-Agent": "@paid-ai/paid-node/1.2.1",
20
21
  "X-Fern-Runtime": core.RUNTIME.type,
21
22
  "X-Fern-Runtime-Version": core.RUNTIME.version,
22
23
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -57,4 +58,8 @@ export class PaidClient {
57
58
  var _a;
58
59
  return ((_a = this._customerPortals) !== null && _a !== void 0 ? _a : (this._customerPortals = new CustomerPortals(this._options)));
59
60
  }
61
+ get valueReceipts() {
62
+ var _a;
63
+ return ((_a = this._valueReceipts) !== null && _a !== void 0 ? _a : (this._valueReceipts = new ValueReceipts(this._options)));
64
+ }
60
65
  }
@@ -20,4 +20,6 @@ export interface CreateCheckoutRequest {
20
20
  collectAddress?: boolean;
21
21
  collectPhone?: boolean;
22
22
  singleUse?: boolean;
23
+ /** Lock checkout to a specific currency. Omit to allow all currencies supported by the selected plans. */
24
+ currency?: string;
23
25
  }
@@ -84,6 +84,7 @@ export declare class Customers {
84
84
  * @param {Paid.DeleteCustomerByIdRequest} request
85
85
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
86
86
  *
87
+ * @throws {@link Paid.BadRequestError}
87
88
  * @throws {@link Paid.ForbiddenError}
88
89
  * @throws {@link Paid.NotFoundError}
89
90
  * @throws {@link Paid.InternalServerError}
@@ -137,6 +138,7 @@ export declare class Customers {
137
138
  * @param {Paid.DeleteCustomerByExternalIdRequest} request
138
139
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
139
140
  *
141
+ * @throws {@link Paid.BadRequestError}
140
142
  * @throws {@link Paid.ForbiddenError}
141
143
  * @throws {@link Paid.NotFoundError}
142
144
  * @throws {@link Paid.InternalServerError}
@@ -309,6 +309,7 @@ export class Customers {
309
309
  * @param {Paid.DeleteCustomerByIdRequest} request
310
310
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
311
311
  *
312
+ * @throws {@link Paid.BadRequestError}
312
313
  * @throws {@link Paid.ForbiddenError}
313
314
  * @throws {@link Paid.NotFoundError}
314
315
  * @throws {@link Paid.InternalServerError}
@@ -340,6 +341,8 @@ export class Customers {
340
341
  }
341
342
  if (_response.error.reason === "status-code") {
342
343
  switch (_response.error.statusCode) {
344
+ case 400:
345
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
343
346
  case 403:
344
347
  throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
345
348
  case 404:
@@ -520,6 +523,7 @@ export class Customers {
520
523
  * @param {Paid.DeleteCustomerByExternalIdRequest} request
521
524
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
522
525
  *
526
+ * @throws {@link Paid.BadRequestError}
523
527
  * @throws {@link Paid.ForbiddenError}
524
528
  * @throws {@link Paid.NotFoundError}
525
529
  * @throws {@link Paid.InternalServerError}
@@ -551,6 +555,8 @@ export class Customers {
551
555
  }
552
556
  if (_response.error.reason === "status-code") {
553
557
  switch (_response.error.statusCode) {
558
+ case 400:
559
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
554
560
  case 403:
555
561
  throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
556
562
  case 404:
@@ -16,3 +16,5 @@ export * from "./products/client/requests/index.mjs";
16
16
  export * as products from "./products/index.mjs";
17
17
  export * from "./signals/client/requests/index.mjs";
18
18
  export * as signals from "./signals/index.mjs";
19
+ export * from "./valueReceipts/client/requests/index.mjs";
20
+ export * as valueReceipts from "./valueReceipts/index.mjs";
@@ -16,3 +16,5 @@ export * from "./products/client/requests/index.mjs";
16
16
  export * as products from "./products/index.mjs";
17
17
  export * from "./signals/client/requests/index.mjs";
18
18
  export * as signals from "./signals/index.mjs";
19
+ export * from "./valueReceipts/client/requests/index.mjs";
20
+ export * as valueReceipts from "./valueReceipts/index.mjs";
@@ -0,0 +1,75 @@
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 ValueReceipts {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ValueReceipts {
11
+ protected readonly _options: ValueReceipts.Options;
12
+ constructor(_options: ValueReceipts.Options);
13
+ /**
14
+ * List value receipts for the organization
15
+ *
16
+ * @param {Paid.ListValueReceiptsRequest} request
17
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Paid.InternalServerError}
20
+ *
21
+ * @example
22
+ * await client.valueReceipts.listValueReceipts()
23
+ */
24
+ listValueReceipts(request?: Paid.ListValueReceiptsRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptListResponse>;
25
+ private __listValueReceipts;
26
+ /**
27
+ * Get a value receipt by ID, including its publish/share state.
28
+ *
29
+ * @param {Paid.GetValueReceiptByIdRequest} request
30
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
31
+ *
32
+ * @throws {@link Paid.NotFoundError}
33
+ * @throws {@link Paid.InternalServerError}
34
+ *
35
+ * @example
36
+ * await client.valueReceipts.getValueReceiptById({
37
+ * id: "id"
38
+ * })
39
+ */
40
+ getValueReceiptById(request: Paid.GetValueReceiptByIdRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
41
+ private __getValueReceiptById;
42
+ /**
43
+ * Make a value receipt publicly accessible via URL.
44
+ *
45
+ * @param {Paid.PublishValueReceiptBody} request
46
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
47
+ *
48
+ * @throws {@link Paid.NotFoundError}
49
+ * @throws {@link Paid.InternalServerError}
50
+ *
51
+ * @example
52
+ * await client.valueReceipts.publishValueReceipt({
53
+ * id: "id"
54
+ * })
55
+ */
56
+ publishValueReceipt(request: Paid.PublishValueReceiptBody, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
57
+ private __publishValueReceipt;
58
+ /**
59
+ * Revoke public access to a value receipt.
60
+ *
61
+ * @param {Paid.UnpublishValueReceiptRequest} request
62
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Paid.NotFoundError}
65
+ * @throws {@link Paid.InternalServerError}
66
+ *
67
+ * @example
68
+ * await client.valueReceipts.unpublishValueReceipt({
69
+ * id: "id"
70
+ * })
71
+ */
72
+ unpublishValueReceipt(request: Paid.UnpublishValueReceiptRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
73
+ private __unpublishValueReceipt;
74
+ protected _getAuthorizationHeader(): Promise<string>;
75
+ }
@@ -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 {};