@paid-ai/paid-node 1.2.1 → 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 (152) hide show
  1. package/dist/cjs/Client.d.ts +3 -0
  2. package/dist/cjs/Client.js +7 -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/customers/client/Client.d.ts +19 -0
  9. package/dist/cjs/api/resources/customers/client/Client.js +86 -0
  10. package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.ts +16 -0
  11. package/dist/cjs/api/resources/customers/client/requests/UpsertCustomerUserRequest.js +3 -0
  12. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/index.d.ts +4 -0
  14. package/dist/cjs/api/resources/index.js +5 -1
  15. package/dist/cjs/api/resources/orders/client/Client.d.ts +60 -0
  16. package/dist/cjs/api/resources/orders/client/Client.js +242 -0
  17. package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.ts +22 -0
  18. package/dist/cjs/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.js +3 -0
  19. package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.d.ts +14 -0
  20. package/dist/cjs/api/resources/orders/client/requests/ListOrderSeatsRequest.js +3 -0
  21. package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.ts +12 -0
  22. package/dist/cjs/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.js +3 -0
  23. package/dist/cjs/api/resources/orders/client/requests/index.d.ts +3 -0
  24. package/dist/cjs/api/resources/orders/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/orders/index.js +1 -0
  26. package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.d.ts +5 -0
  27. package/dist/cjs/api/resources/orders/types/ListOrderSeatsRequestStatus.js +8 -0
  28. package/dist/cjs/api/resources/orders/types/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/orders/types/index.js +17 -0
  30. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +63 -0
  31. package/dist/cjs/api/resources/webhooks/client/Client.js +282 -0
  32. package/dist/cjs/api/resources/webhooks/client/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/webhooks/client/index.js +17 -0
  34. package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.d.ts +10 -0
  35. package/dist/cjs/api/resources/webhooks/client/requests/TestWebhookRequest.js +3 -0
  36. package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.ts +14 -0
  37. package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequest.js +3 -0
  38. package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
  39. package/dist/cjs/api/resources/webhooks/client/requests/index.js +2 -0
  40. package/dist/cjs/api/resources/webhooks/index.d.ts +2 -0
  41. package/dist/cjs/api/resources/webhooks/index.js +18 -0
  42. package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.ts +12 -0
  43. package/dist/cjs/api/resources/webhooks/types/TestWebhookRequestWebhookName.js +15 -0
  44. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.ts +12 -0
  45. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.js +15 -0
  46. package/dist/cjs/api/resources/webhooks/types/index.d.ts +2 -0
  47. package/dist/cjs/api/resources/webhooks/types/index.js +18 -0
  48. package/dist/cjs/api/types/BatchSeatAssignmentsResponse.d.ts +4 -0
  49. package/dist/cjs/api/types/BatchSeatAssignmentsResponse.js +3 -0
  50. package/dist/cjs/api/types/CheckoutDetails.d.ts +21 -0
  51. package/dist/cjs/api/types/CheckoutDetails.js +3 -0
  52. package/dist/cjs/api/types/CustomerUser.d.ts +13 -0
  53. package/dist/cjs/api/types/CustomerUser.js +3 -0
  54. package/dist/cjs/api/types/CustomerUserStatus.d.ts +5 -0
  55. package/dist/cjs/api/types/CustomerUserStatus.js +8 -0
  56. package/dist/cjs/api/types/OrderSeat.d.ts +10 -0
  57. package/dist/cjs/api/types/OrderSeat.js +3 -0
  58. package/dist/cjs/api/types/OrderSeatListResponse.d.ts +5 -0
  59. package/dist/cjs/api/types/OrderSeatListResponse.js +3 -0
  60. package/dist/cjs/api/types/SeatAssignee.d.ts +5 -0
  61. package/dist/cjs/api/types/SeatAssignee.js +3 -0
  62. package/dist/cjs/api/types/SeatAssignmentStatus.d.ts +5 -0
  63. package/dist/cjs/api/types/SeatAssignmentStatus.js +8 -0
  64. package/dist/cjs/api/types/Webhook.d.ts +24 -0
  65. package/dist/cjs/api/types/Webhook.js +18 -0
  66. package/dist/cjs/api/types/WebhookDeliveryStatus.d.ts +5 -0
  67. package/dist/cjs/api/types/WebhookDeliveryStatus.js +8 -0
  68. package/dist/cjs/api/types/WebhookListResponse.d.ts +4 -0
  69. package/dist/cjs/api/types/WebhookListResponse.js +3 -0
  70. package/dist/cjs/api/types/WebhookTestResponse.d.ts +3 -0
  71. package/dist/cjs/api/types/WebhookTestResponse.js +3 -0
  72. package/dist/cjs/api/types/index.d.ts +12 -0
  73. package/dist/cjs/api/types/index.js +12 -0
  74. package/dist/cjs/version.d.ts +1 -1
  75. package/dist/cjs/version.js +1 -1
  76. package/dist/esm/Client.d.mts +3 -0
  77. package/dist/esm/Client.mjs +7 -2
  78. package/dist/esm/api/errors/ConflictError.d.mts +6 -0
  79. package/dist/esm/api/errors/ConflictError.mjs +13 -0
  80. package/dist/esm/api/errors/index.d.mts +1 -0
  81. package/dist/esm/api/errors/index.mjs +1 -0
  82. package/dist/esm/api/resources/checkouts/client/Client.d.mts +1 -1
  83. package/dist/esm/api/resources/customers/client/Client.d.mts +19 -0
  84. package/dist/esm/api/resources/customers/client/Client.mjs +86 -0
  85. package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.d.mts +16 -0
  86. package/dist/esm/api/resources/customers/client/requests/UpsertCustomerUserRequest.mjs +2 -0
  87. package/dist/esm/api/resources/customers/client/requests/index.d.mts +1 -0
  88. package/dist/esm/api/resources/index.d.mts +4 -0
  89. package/dist/esm/api/resources/index.mjs +4 -0
  90. package/dist/esm/api/resources/orders/client/Client.d.mts +60 -0
  91. package/dist/esm/api/resources/orders/client/Client.mjs +242 -0
  92. package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.d.mts +22 -0
  93. package/dist/esm/api/resources/orders/client/requests/BatchSeatAssignmentsRequest.mjs +2 -0
  94. package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.d.mts +14 -0
  95. package/dist/esm/api/resources/orders/client/requests/ListOrderSeatsRequest.mjs +2 -0
  96. package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.d.mts +12 -0
  97. package/dist/esm/api/resources/orders/client/requests/UpdateSeatAssignmentRequest.mjs +2 -0
  98. package/dist/esm/api/resources/orders/client/requests/index.d.mts +3 -0
  99. package/dist/esm/api/resources/orders/index.d.mts +1 -0
  100. package/dist/esm/api/resources/orders/index.mjs +1 -0
  101. package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.d.mts +5 -0
  102. package/dist/esm/api/resources/orders/types/ListOrderSeatsRequestStatus.mjs +5 -0
  103. package/dist/esm/api/resources/orders/types/index.d.mts +1 -0
  104. package/dist/esm/api/resources/orders/types/index.mjs +1 -0
  105. package/dist/esm/api/resources/webhooks/client/Client.d.mts +63 -0
  106. package/dist/esm/api/resources/webhooks/client/Client.mjs +245 -0
  107. package/dist/esm/api/resources/webhooks/client/index.d.mts +1 -0
  108. package/dist/esm/api/resources/webhooks/client/index.mjs +1 -0
  109. package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.d.mts +10 -0
  110. package/dist/esm/api/resources/webhooks/client/requests/TestWebhookRequest.mjs +2 -0
  111. package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.d.mts +14 -0
  112. package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequest.mjs +2 -0
  113. package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
  114. package/dist/esm/api/resources/webhooks/client/requests/index.mjs +1 -0
  115. package/dist/esm/api/resources/webhooks/index.d.mts +2 -0
  116. package/dist/esm/api/resources/webhooks/index.mjs +2 -0
  117. package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.d.mts +12 -0
  118. package/dist/esm/api/resources/webhooks/types/TestWebhookRequestWebhookName.mjs +12 -0
  119. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.d.mts +12 -0
  120. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequestWebhookName.mjs +12 -0
  121. package/dist/esm/api/resources/webhooks/types/index.d.mts +2 -0
  122. package/dist/esm/api/resources/webhooks/types/index.mjs +2 -0
  123. package/dist/esm/api/types/BatchSeatAssignmentsResponse.d.mts +4 -0
  124. package/dist/esm/api/types/BatchSeatAssignmentsResponse.mjs +2 -0
  125. package/dist/esm/api/types/CheckoutDetails.d.mts +21 -0
  126. package/dist/esm/api/types/CheckoutDetails.mjs +2 -0
  127. package/dist/esm/api/types/CustomerUser.d.mts +13 -0
  128. package/dist/esm/api/types/CustomerUser.mjs +2 -0
  129. package/dist/esm/api/types/CustomerUserStatus.d.mts +5 -0
  130. package/dist/esm/api/types/CustomerUserStatus.mjs +5 -0
  131. package/dist/esm/api/types/OrderSeat.d.mts +10 -0
  132. package/dist/esm/api/types/OrderSeat.mjs +2 -0
  133. package/dist/esm/api/types/OrderSeatListResponse.d.mts +5 -0
  134. package/dist/esm/api/types/OrderSeatListResponse.mjs +2 -0
  135. package/dist/esm/api/types/SeatAssignee.d.mts +5 -0
  136. package/dist/esm/api/types/SeatAssignee.mjs +2 -0
  137. package/dist/esm/api/types/SeatAssignmentStatus.d.mts +5 -0
  138. package/dist/esm/api/types/SeatAssignmentStatus.mjs +5 -0
  139. package/dist/esm/api/types/Webhook.d.mts +24 -0
  140. package/dist/esm/api/types/Webhook.mjs +15 -0
  141. package/dist/esm/api/types/WebhookDeliveryStatus.d.mts +5 -0
  142. package/dist/esm/api/types/WebhookDeliveryStatus.mjs +5 -0
  143. package/dist/esm/api/types/WebhookListResponse.d.mts +4 -0
  144. package/dist/esm/api/types/WebhookListResponse.mjs +2 -0
  145. package/dist/esm/api/types/WebhookTestResponse.d.mts +3 -0
  146. package/dist/esm/api/types/WebhookTestResponse.mjs +2 -0
  147. package/dist/esm/api/types/index.d.mts +12 -0
  148. package/dist/esm/api/types/index.mjs +12 -0
  149. package/dist/esm/version.d.mts +1 -1
  150. package/dist/esm/version.mjs +1 -1
  151. package/package.json +1 -1
  152. package/reference.md +452 -1
@@ -111,5 +111,65 @@ export declare class Orders {
111
111
  */
112
112
  getOrderLines(request: Paid.GetOrderLinesRequest, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.OrderLinesResponse>;
113
113
  private __getOrderLines;
114
+ /**
115
+ * List seats for an order
116
+ *
117
+ * @param {Paid.ListOrderSeatsRequest} request
118
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
119
+ *
120
+ * @throws {@link Paid.BadRequestError}
121
+ * @throws {@link Paid.ForbiddenError}
122
+ * @throws {@link Paid.NotFoundError}
123
+ * @throws {@link Paid.InternalServerError}
124
+ *
125
+ * @example
126
+ * await client.orders.listOrderSeats({
127
+ * id: "id"
128
+ * })
129
+ */
130
+ listOrderSeats(request: Paid.ListOrderSeatsRequest, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.OrderSeatListResponse>;
131
+ private __listOrderSeats;
132
+ /**
133
+ * Assign or unassign a single seat on an order
134
+ *
135
+ * @param {Paid.UpdateSeatAssignmentRequest} request
136
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
137
+ *
138
+ * @throws {@link Paid.BadRequestError}
139
+ * @throws {@link Paid.ForbiddenError}
140
+ * @throws {@link Paid.NotFoundError}
141
+ * @throws {@link Paid.ConflictError}
142
+ * @throws {@link Paid.InternalServerError}
143
+ *
144
+ * @example
145
+ * await client.orders.updateOrderSeatAssignment({
146
+ * id: "id",
147
+ * seatId: "seatId"
148
+ * })
149
+ */
150
+ updateOrderSeatAssignment(request: Paid.UpdateSeatAssignmentRequest, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.OrderSeat>;
151
+ private __updateOrderSeatAssignment;
152
+ /**
153
+ * Assign or unassign seats in batch for an order
154
+ *
155
+ * @param {Paid.BatchSeatAssignmentsRequest} request
156
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
157
+ *
158
+ * @throws {@link Paid.BadRequestError}
159
+ * @throws {@link Paid.ForbiddenError}
160
+ * @throws {@link Paid.NotFoundError}
161
+ * @throws {@link Paid.ConflictError}
162
+ * @throws {@link Paid.InternalServerError}
163
+ *
164
+ * @example
165
+ * await client.orders.batchOrderSeatAssignments({
166
+ * id: "id",
167
+ * assignments: [{
168
+ * seatId: "seatId"
169
+ * }]
170
+ * })
171
+ */
172
+ batchOrderSeatAssignments(request: Paid.BatchSeatAssignmentsRequest, requestOptions?: Orders.RequestOptions): core.HttpResponsePromise<Paid.BatchSeatAssignmentsResponse>;
173
+ private __batchOrderSeatAssignments;
114
174
  protected _getAuthorizationHeader(): Promise<string>;
115
175
  }
@@ -456,6 +456,248 @@ export class Orders {
456
456
  }
457
457
  });
458
458
  }
459
+ /**
460
+ * List seats for an order
461
+ *
462
+ * @param {Paid.ListOrderSeatsRequest} request
463
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
464
+ *
465
+ * @throws {@link Paid.BadRequestError}
466
+ * @throws {@link Paid.ForbiddenError}
467
+ * @throws {@link Paid.NotFoundError}
468
+ * @throws {@link Paid.InternalServerError}
469
+ *
470
+ * @example
471
+ * await client.orders.listOrderSeats({
472
+ * id: "id"
473
+ * })
474
+ */
475
+ listOrderSeats(request, requestOptions) {
476
+ return core.HttpResponsePromise.fromPromise(this.__listOrderSeats(request, requestOptions));
477
+ }
478
+ __listOrderSeats(request, requestOptions) {
479
+ return __awaiter(this, void 0, void 0, function* () {
480
+ var _a, _b, _c, _d, _e, _f, _g, _h;
481
+ const { id, limit, offset, productExternalId, status } = request;
482
+ const _queryParams = {};
483
+ if (limit != null) {
484
+ _queryParams.limit = limit.toString();
485
+ }
486
+ if (offset != null) {
487
+ _queryParams.offset = offset.toString();
488
+ }
489
+ if (productExternalId != null) {
490
+ _queryParams.productExternalId = productExternalId;
491
+ }
492
+ if (status != null) {
493
+ _queryParams.status = status;
494
+ }
495
+ 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);
496
+ const _response = yield core.fetcher({
497
+ 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, `orders/${core.url.encodePathParam(id)}/seats`),
498
+ method: "GET",
499
+ headers: _headers,
500
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
501
+ 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,
502
+ 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,
503
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
504
+ });
505
+ if (_response.ok) {
506
+ return { data: _response.body, rawResponse: _response.rawResponse };
507
+ }
508
+ if (_response.error.reason === "status-code") {
509
+ switch (_response.error.statusCode) {
510
+ case 400:
511
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
512
+ case 403:
513
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
514
+ case 404:
515
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
516
+ case 500:
517
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
518
+ default:
519
+ throw new errors.PaidError({
520
+ statusCode: _response.error.statusCode,
521
+ body: _response.error.body,
522
+ rawResponse: _response.rawResponse,
523
+ });
524
+ }
525
+ }
526
+ switch (_response.error.reason) {
527
+ case "non-json":
528
+ throw new errors.PaidError({
529
+ statusCode: _response.error.statusCode,
530
+ body: _response.error.rawBody,
531
+ rawResponse: _response.rawResponse,
532
+ });
533
+ case "timeout":
534
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /orders/{id}/seats.");
535
+ case "unknown":
536
+ throw new errors.PaidError({
537
+ message: _response.error.errorMessage,
538
+ rawResponse: _response.rawResponse,
539
+ });
540
+ }
541
+ });
542
+ }
543
+ /**
544
+ * Assign or unassign a single seat on an order
545
+ *
546
+ * @param {Paid.UpdateSeatAssignmentRequest} request
547
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
548
+ *
549
+ * @throws {@link Paid.BadRequestError}
550
+ * @throws {@link Paid.ForbiddenError}
551
+ * @throws {@link Paid.NotFoundError}
552
+ * @throws {@link Paid.ConflictError}
553
+ * @throws {@link Paid.InternalServerError}
554
+ *
555
+ * @example
556
+ * await client.orders.updateOrderSeatAssignment({
557
+ * id: "id",
558
+ * seatId: "seatId"
559
+ * })
560
+ */
561
+ updateOrderSeatAssignment(request, requestOptions) {
562
+ return core.HttpResponsePromise.fromPromise(this.__updateOrderSeatAssignment(request, requestOptions));
563
+ }
564
+ __updateOrderSeatAssignment(request, requestOptions) {
565
+ return __awaiter(this, void 0, void 0, function* () {
566
+ var _a, _b, _c, _d, _e, _f, _g, _h;
567
+ const { id, seatId } = request, _body = __rest(request, ["id", "seatId"]);
568
+ 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);
569
+ const _response = yield core.fetcher({
570
+ 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, `orders/${core.url.encodePathParam(id)}/seats/${core.url.encodePathParam(seatId)}`),
571
+ method: "PUT",
572
+ headers: _headers,
573
+ contentType: "application/json",
574
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
575
+ requestType: "json",
576
+ body: _body,
577
+ 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,
578
+ 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,
579
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
580
+ });
581
+ if (_response.ok) {
582
+ return { data: _response.body, rawResponse: _response.rawResponse };
583
+ }
584
+ if (_response.error.reason === "status-code") {
585
+ switch (_response.error.statusCode) {
586
+ case 400:
587
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
588
+ case 403:
589
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
590
+ case 404:
591
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
592
+ case 409:
593
+ throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
594
+ case 500:
595
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
596
+ default:
597
+ throw new errors.PaidError({
598
+ statusCode: _response.error.statusCode,
599
+ body: _response.error.body,
600
+ rawResponse: _response.rawResponse,
601
+ });
602
+ }
603
+ }
604
+ switch (_response.error.reason) {
605
+ case "non-json":
606
+ throw new errors.PaidError({
607
+ statusCode: _response.error.statusCode,
608
+ body: _response.error.rawBody,
609
+ rawResponse: _response.rawResponse,
610
+ });
611
+ case "timeout":
612
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling PUT /orders/{id}/seats/{seatId}.");
613
+ case "unknown":
614
+ throw new errors.PaidError({
615
+ message: _response.error.errorMessage,
616
+ rawResponse: _response.rawResponse,
617
+ });
618
+ }
619
+ });
620
+ }
621
+ /**
622
+ * Assign or unassign seats in batch for an order
623
+ *
624
+ * @param {Paid.BatchSeatAssignmentsRequest} request
625
+ * @param {Orders.RequestOptions} requestOptions - Request-specific configuration.
626
+ *
627
+ * @throws {@link Paid.BadRequestError}
628
+ * @throws {@link Paid.ForbiddenError}
629
+ * @throws {@link Paid.NotFoundError}
630
+ * @throws {@link Paid.ConflictError}
631
+ * @throws {@link Paid.InternalServerError}
632
+ *
633
+ * @example
634
+ * await client.orders.batchOrderSeatAssignments({
635
+ * id: "id",
636
+ * assignments: [{
637
+ * seatId: "seatId"
638
+ * }]
639
+ * })
640
+ */
641
+ batchOrderSeatAssignments(request, requestOptions) {
642
+ return core.HttpResponsePromise.fromPromise(this.__batchOrderSeatAssignments(request, requestOptions));
643
+ }
644
+ __batchOrderSeatAssignments(request, requestOptions) {
645
+ return __awaiter(this, void 0, void 0, function* () {
646
+ var _a, _b, _c, _d, _e, _f, _g, _h;
647
+ const { id } = request, _body = __rest(request, ["id"]);
648
+ 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);
649
+ const _response = yield core.fetcher({
650
+ 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, `orders/${core.url.encodePathParam(id)}/seat-assignments`),
651
+ method: "POST",
652
+ headers: _headers,
653
+ contentType: "application/json",
654
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
655
+ requestType: "json",
656
+ body: _body,
657
+ 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,
658
+ 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,
659
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
660
+ });
661
+ if (_response.ok) {
662
+ return { data: _response.body, rawResponse: _response.rawResponse };
663
+ }
664
+ if (_response.error.reason === "status-code") {
665
+ switch (_response.error.statusCode) {
666
+ case 400:
667
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
668
+ case 403:
669
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
670
+ case 404:
671
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
672
+ case 409:
673
+ throw new Paid.ConflictError(_response.error.body, _response.rawResponse);
674
+ case 500:
675
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
676
+ default:
677
+ throw new errors.PaidError({
678
+ statusCode: _response.error.statusCode,
679
+ body: _response.error.body,
680
+ rawResponse: _response.rawResponse,
681
+ });
682
+ }
683
+ }
684
+ switch (_response.error.reason) {
685
+ case "non-json":
686
+ throw new errors.PaidError({
687
+ statusCode: _response.error.statusCode,
688
+ body: _response.error.rawBody,
689
+ rawResponse: _response.rawResponse,
690
+ });
691
+ case "timeout":
692
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /orders/{id}/seat-assignments.");
693
+ case "unknown":
694
+ throw new errors.PaidError({
695
+ message: _response.error.errorMessage,
696
+ rawResponse: _response.rawResponse,
697
+ });
698
+ }
699
+ });
700
+ }
459
701
  _getAuthorizationHeader() {
460
702
  return __awaiter(this, void 0, void 0, function* () {
461
703
  return `Bearer ${yield core.Supplier.get(this._options.token)}`;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id",
5
+ * assignments: [{
6
+ * seatId: "seatId"
7
+ * }]
8
+ * }
9
+ */
10
+ export interface BatchSeatAssignmentsRequest {
11
+ id: string;
12
+ assignments: BatchSeatAssignmentsRequest.Assignments.Item[];
13
+ }
14
+ export declare namespace BatchSeatAssignmentsRequest {
15
+ type Assignments = Assignments.Item[];
16
+ namespace Assignments {
17
+ interface Item {
18
+ seatId: string;
19
+ userExternalId: string | null;
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,14 @@
1
+ import type * as Paid from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * id: "id"
6
+ * }
7
+ */
8
+ export interface ListOrderSeatsRequest {
9
+ id: string;
10
+ limit?: number;
11
+ offset?: number;
12
+ productExternalId?: string;
13
+ status?: Paid.ListOrderSeatsRequestStatus;
14
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id",
5
+ * seatId: "seatId"
6
+ * }
7
+ */
8
+ export interface UpdateSeatAssignmentRequest {
9
+ id: string;
10
+ seatId: string;
11
+ userExternalId: string | null;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,6 +1,9 @@
1
+ export type { BatchSeatAssignmentsRequest } from "./BatchSeatAssignmentsRequest.mjs";
1
2
  export type { CreateOrderRequest } from "./CreateOrderRequest.mjs";
2
3
  export type { DeleteOrderByIdRequest } from "./DeleteOrderByIdRequest.mjs";
3
4
  export type { GetOrderByIdRequest } from "./GetOrderByIdRequest.mjs";
4
5
  export type { GetOrderLinesRequest } from "./GetOrderLinesRequest.mjs";
6
+ export type { ListOrderSeatsRequest } from "./ListOrderSeatsRequest.mjs";
5
7
  export type { ListOrdersRequest } from "./ListOrdersRequest.mjs";
6
8
  export type { UpdateOrderRequest } from "./UpdateOrderRequest.mjs";
9
+ export type { UpdateSeatAssignmentRequest } from "./UpdateSeatAssignmentRequest.mjs";
@@ -1 +1,2 @@
1
1
  export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -1 +1,2 @@
1
1
  export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,5 @@
1
+ export declare const ListOrderSeatsRequestStatus: {
2
+ readonly Assigned: "assigned";
3
+ readonly Unassigned: "unassigned";
4
+ };
5
+ export type ListOrderSeatsRequestStatus = (typeof ListOrderSeatsRequestStatus)[keyof typeof ListOrderSeatsRequestStatus];
@@ -0,0 +1,5 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const ListOrderSeatsRequestStatus = {
3
+ Assigned: "assigned",
4
+ Unassigned: "unassigned",
5
+ };
@@ -0,0 +1 @@
1
+ export * from "./ListOrderSeatsRequestStatus.mjs";
@@ -0,0 +1 @@
1
+ export * from "./ListOrderSeatsRequestStatus.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
+ }