@51eat/sdk 0.0.51 → 0.0.53

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 (140) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +17 -12
  4. package/dist/cjs/api/resources/business/resources/productOrders/client/Client.d.ts +33 -0
  5. package/dist/cjs/api/resources/business/resources/productOrders/client/Client.js +123 -0
  6. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.ts +10 -0
  7. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.js +3 -0
  8. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.d.ts +12 -0
  9. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.js +3 -0
  10. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/index.d.ts +2 -0
  11. package/dist/cjs/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.d.ts +4 -0
  12. package/dist/cjs/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.js +3 -0
  13. package/dist/cjs/api/resources/business/resources/productOrders/types/index.d.ts +1 -0
  14. package/dist/cjs/api/resources/business/resources/productOrders/types/index.js +1 -0
  15. package/dist/cjs/api/resources/businessShipping/client/Client.d.ts +138 -0
  16. package/dist/cjs/api/resources/businessShipping/client/Client.js +566 -0
  17. package/dist/cjs/api/resources/businessShipping/client/index.d.ts +1 -0
  18. package/dist/cjs/api/resources/businessShipping/client/index.js +17 -0
  19. package/dist/cjs/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.d.ts +10 -0
  20. package/dist/cjs/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.js +3 -0
  21. package/dist/cjs/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.d.ts +12 -0
  22. package/dist/cjs/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.js +3 -0
  23. package/dist/cjs/api/resources/businessShipping/client/requests/StoreShippingRateRequest.d.ts +23 -0
  24. package/dist/cjs/api/resources/businessShipping/client/requests/StoreShippingRateRequest.js +11 -0
  25. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.d.ts +9 -0
  26. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.js +3 -0
  27. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.d.ts +26 -0
  28. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.js +11 -0
  29. package/dist/cjs/api/resources/businessShipping/client/requests/index.d.ts +5 -0
  30. package/dist/cjs/api/resources/businessShipping/client/requests/index.js +7 -0
  31. package/dist/cjs/api/resources/businessShipping/exports.d.ts +2 -0
  32. package/dist/cjs/api/resources/businessShipping/exports.js +21 -0
  33. package/dist/cjs/api/resources/businessShipping/index.d.ts +2 -0
  34. package/dist/cjs/api/resources/businessShipping/index.js +18 -0
  35. package/dist/cjs/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.d.ts +4 -0
  36. package/dist/cjs/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.js +3 -0
  37. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.d.ts +6 -0
  38. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.js +3 -0
  39. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.d.ts +3 -0
  40. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.js +3 -0
  41. package/dist/cjs/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.d.ts +4 -0
  42. package/dist/cjs/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.js +3 -0
  43. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.d.ts +4 -0
  44. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.js +3 -0
  45. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.d.ts +4 -0
  46. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.js +3 -0
  47. package/dist/cjs/api/resources/businessShipping/types/index.d.ts +6 -0
  48. package/dist/cjs/api/resources/businessShipping/types/index.js +22 -0
  49. package/dist/cjs/api/resources/customer/resources/cart/client/Client.d.ts +44 -0
  50. package/dist/cjs/api/resources/customer/resources/cart/client/Client.js +131 -0
  51. package/dist/cjs/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.d.ts +28 -0
  52. package/dist/cjs/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.js +3 -0
  53. package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.ts +12 -0
  54. package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.js +3 -0
  55. package/dist/cjs/api/resources/customer/resources/cart/client/requests/index.d.ts +2 -0
  56. package/dist/cjs/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.ts +11 -0
  57. package/dist/cjs/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.js +3 -0
  58. package/dist/cjs/api/resources/customer/resources/cart/types/index.d.ts +1 -0
  59. package/dist/cjs/api/resources/customer/resources/cart/types/index.js +1 -0
  60. package/dist/cjs/api/resources/index.d.ts +3 -0
  61. package/dist/cjs/api/resources/index.js +4 -1
  62. package/dist/cjs/api/types/ShippingAccountResource.d.ts +10 -0
  63. package/dist/cjs/api/types/ShippingAccountResource.js +3 -0
  64. package/dist/cjs/api/types/ShippingRateResource.d.ts +12 -0
  65. package/dist/cjs/api/types/ShippingRateResource.js +3 -0
  66. package/dist/cjs/api/types/index.d.ts +2 -0
  67. package/dist/cjs/api/types/index.js +2 -0
  68. package/dist/cjs/version.d.ts +1 -1
  69. package/dist/cjs/version.js +1 -1
  70. package/dist/esm/BaseClient.mjs +2 -2
  71. package/dist/esm/Client.d.mts +3 -0
  72. package/dist/esm/Client.mjs +5 -0
  73. package/dist/esm/api/resources/business/resources/productOrders/client/Client.d.mts +33 -0
  74. package/dist/esm/api/resources/business/resources/productOrders/client/Client.mjs +123 -0
  75. package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.mts +10 -0
  76. package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.mjs +2 -0
  77. package/dist/esm/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.d.mts +12 -0
  78. package/dist/esm/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.mjs +2 -0
  79. package/dist/esm/api/resources/business/resources/productOrders/client/requests/index.d.mts +2 -0
  80. package/dist/esm/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.d.mts +4 -0
  81. package/dist/esm/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.mjs +2 -0
  82. package/dist/esm/api/resources/business/resources/productOrders/types/index.d.mts +1 -0
  83. package/dist/esm/api/resources/business/resources/productOrders/types/index.mjs +1 -0
  84. package/dist/esm/api/resources/businessShipping/client/Client.d.mts +138 -0
  85. package/dist/esm/api/resources/businessShipping/client/Client.mjs +529 -0
  86. package/dist/esm/api/resources/businessShipping/client/index.d.mts +1 -0
  87. package/dist/esm/api/resources/businessShipping/client/index.mjs +1 -0
  88. package/dist/esm/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.d.mts +10 -0
  89. package/dist/esm/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.mjs +2 -0
  90. package/dist/esm/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.d.mts +12 -0
  91. package/dist/esm/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.mjs +2 -0
  92. package/dist/esm/api/resources/businessShipping/client/requests/StoreShippingRateRequest.d.mts +23 -0
  93. package/dist/esm/api/resources/businessShipping/client/requests/StoreShippingRateRequest.mjs +8 -0
  94. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.d.mts +9 -0
  95. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.mjs +2 -0
  96. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.d.mts +26 -0
  97. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.mjs +8 -0
  98. package/dist/esm/api/resources/businessShipping/client/requests/index.d.mts +5 -0
  99. package/dist/esm/api/resources/businessShipping/client/requests/index.mjs +2 -0
  100. package/dist/esm/api/resources/businessShipping/exports.d.mts +2 -0
  101. package/dist/esm/api/resources/businessShipping/exports.mjs +3 -0
  102. package/dist/esm/api/resources/businessShipping/index.d.mts +2 -0
  103. package/dist/esm/api/resources/businessShipping/index.mjs +2 -0
  104. package/dist/esm/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.d.mts +4 -0
  105. package/dist/esm/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.mjs +2 -0
  106. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.d.mts +6 -0
  107. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.mjs +2 -0
  108. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.d.mts +3 -0
  109. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.mjs +2 -0
  110. package/dist/esm/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.d.mts +4 -0
  111. package/dist/esm/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.mjs +2 -0
  112. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.d.mts +4 -0
  113. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.mjs +2 -0
  114. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.d.mts +4 -0
  115. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.mjs +2 -0
  116. package/dist/esm/api/resources/businessShipping/types/index.d.mts +6 -0
  117. package/dist/esm/api/resources/businessShipping/types/index.mjs +6 -0
  118. package/dist/esm/api/resources/customer/resources/cart/client/Client.d.mts +44 -0
  119. package/dist/esm/api/resources/customer/resources/cart/client/Client.mjs +131 -0
  120. package/dist/esm/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.d.mts +28 -0
  121. package/dist/esm/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.mjs +2 -0
  122. package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.mts +12 -0
  123. package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.mjs +2 -0
  124. package/dist/esm/api/resources/customer/resources/cart/client/requests/index.d.mts +2 -0
  125. package/dist/esm/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.mts +11 -0
  126. package/dist/esm/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.mjs +2 -0
  127. package/dist/esm/api/resources/customer/resources/cart/types/index.d.mts +1 -0
  128. package/dist/esm/api/resources/customer/resources/cart/types/index.mjs +1 -0
  129. package/dist/esm/api/resources/index.d.mts +3 -0
  130. package/dist/esm/api/resources/index.mjs +3 -0
  131. package/dist/esm/api/types/ShippingAccountResource.d.mts +10 -0
  132. package/dist/esm/api/types/ShippingAccountResource.mjs +2 -0
  133. package/dist/esm/api/types/ShippingRateResource.d.mts +12 -0
  134. package/dist/esm/api/types/ShippingRateResource.mjs +2 -0
  135. package/dist/esm/api/types/index.d.mts +2 -0
  136. package/dist/esm/api/types/index.mjs +2 -0
  137. package/dist/esm/version.d.mts +1 -1
  138. package/dist/esm/version.mjs +1 -1
  139. package/package.json +12 -1
  140. package/reference.md +696 -0
@@ -1,6 +1,7 @@
1
1
  import { BusinessClient } from "./api/resources/business/client/Client.mjs";
2
2
  import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
3
3
  import { BusinessProductsClient } from "./api/resources/businessProducts/client/Client.mjs";
4
+ import { BusinessShippingClient } from "./api/resources/businessShipping/client/Client.mjs";
4
5
  import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
5
6
  import { CustomerEventsClient } from "./api/resources/customerEvents/client/Client.mjs";
6
7
  import { CustomerMessagingClient } from "./api/resources/customerMessaging/client/Client.mjs";
@@ -19,6 +20,7 @@ export declare class FiveOneEatClient {
19
20
  protected readonly _options: NormalizedClientOptionsWithAuth<FiveOneEatClient.Options>;
20
21
  protected _businessMessaging: BusinessMessagingClient | undefined;
21
22
  protected _businessProducts: BusinessProductsClient | undefined;
23
+ protected _businessShipping: BusinessShippingClient | undefined;
22
24
  protected _customerEvents: CustomerEventsClient | undefined;
23
25
  protected _customerMessaging: CustomerMessagingClient | undefined;
24
26
  protected _customerMyAccount: CustomerMyAccountClient | undefined;
@@ -29,6 +31,7 @@ export declare class FiveOneEatClient {
29
31
  constructor(options?: FiveOneEatClient.Options);
30
32
  get businessMessaging(): BusinessMessagingClient;
31
33
  get businessProducts(): BusinessProductsClient;
34
+ get businessShipping(): BusinessShippingClient;
32
35
  get customerEvents(): CustomerEventsClient;
33
36
  get customerMessaging(): CustomerMessagingClient;
34
37
  get customerMyAccount(): CustomerMyAccountClient;
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  import { BusinessClient } from "./api/resources/business/client/Client.mjs";
12
12
  import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
13
13
  import { BusinessProductsClient } from "./api/resources/businessProducts/client/Client.mjs";
14
+ import { BusinessShippingClient } from "./api/resources/businessShipping/client/Client.mjs";
14
15
  import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
15
16
  import { CustomerEventsClient } from "./api/resources/customerEvents/client/Client.mjs";
16
17
  import { CustomerMessagingClient } from "./api/resources/customerMessaging/client/Client.mjs";
@@ -31,6 +32,10 @@ export class FiveOneEatClient {
31
32
  var _a;
32
33
  return ((_a = this._businessProducts) !== null && _a !== void 0 ? _a : (this._businessProducts = new BusinessProductsClient(this._options)));
33
34
  }
35
+ get businessShipping() {
36
+ var _a;
37
+ return ((_a = this._businessShipping) !== null && _a !== void 0 ? _a : (this._businessShipping = new BusinessShippingClient(this._options)));
38
+ }
34
39
  get customerEvents() {
35
40
  var _a;
36
41
  return ((_a = this._customerEvents) !== null && _a !== void 0 ? _a : (this._customerEvents = new CustomerEventsClient(this._options)));
@@ -106,4 +106,37 @@ export declare class ProductOrdersClient {
106
106
  */
107
107
  refund(request: FiveOneEat.business.RefundOrderRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.RefundProductOrdersResponse>;
108
108
  private __refund;
109
+ /**
110
+ * @param {FiveOneEat.business.GetLabelRatesProductOrdersRequest} request
111
+ * @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link FiveOneEat.UnauthorizedError}
114
+ * @throws {@link FiveOneEat.ForbiddenError}
115
+ * @throws {@link FiveOneEat.NotFoundError}
116
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
117
+ *
118
+ * @example
119
+ * await client.business.productOrders.getLabelRates({
120
+ * productOrder: "productOrder"
121
+ * })
122
+ */
123
+ getLabelRates(request: FiveOneEat.business.GetLabelRatesProductOrdersRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<string>;
124
+ private __getLabelRates;
125
+ /**
126
+ * @param {FiveOneEat.business.PurchaseLabelRequest} request
127
+ * @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
128
+ *
129
+ * @throws {@link FiveOneEat.UnauthorizedError}
130
+ * @throws {@link FiveOneEat.ForbiddenError}
131
+ * @throws {@link FiveOneEat.NotFoundError}
132
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
133
+ *
134
+ * @example
135
+ * await client.business.productOrders.purchaseLabel({
136
+ * productOrder: "productOrder",
137
+ * provider_rate_id: "provider_rate_id"
138
+ * })
139
+ */
140
+ purchaseLabel(request: FiveOneEat.business.PurchaseLabelRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.PurchaseLabelProductOrdersResponse>;
141
+ private __purchaseLabel;
109
142
  }
@@ -389,4 +389,127 @@ export class ProductOrdersClient {
389
389
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/product-orders/{productOrder}/refund");
390
390
  });
391
391
  }
392
+ /**
393
+ * @param {FiveOneEat.business.GetLabelRatesProductOrdersRequest} request
394
+ * @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
395
+ *
396
+ * @throws {@link FiveOneEat.UnauthorizedError}
397
+ * @throws {@link FiveOneEat.ForbiddenError}
398
+ * @throws {@link FiveOneEat.NotFoundError}
399
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
400
+ *
401
+ * @example
402
+ * await client.business.productOrders.getLabelRates({
403
+ * productOrder: "productOrder"
404
+ * })
405
+ */
406
+ getLabelRates(request, requestOptions) {
407
+ return core.HttpResponsePromise.fromPromise(this.__getLabelRates(request, requestOptions));
408
+ }
409
+ __getLabelRates(request, requestOptions) {
410
+ return __awaiter(this, void 0, void 0, function* () {
411
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
412
+ const { productOrder } = request;
413
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
414
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
415
+ const _response = yield core.fetcher({
416
+ 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.FiveOneEatEnvironment.Production, `business/product-orders/${core.url.encodePathParam(productOrder)}/label-rates`),
417
+ method: "GET",
418
+ headers: _headers,
419
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
420
+ 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,
421
+ 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,
422
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
423
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
424
+ logging: this._options.logging,
425
+ });
426
+ if (_response.ok) {
427
+ return { data: _response.body, rawResponse: _response.rawResponse };
428
+ }
429
+ if (_response.error.reason === "status-code") {
430
+ switch (_response.error.statusCode) {
431
+ case 401:
432
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
433
+ case 403:
434
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
435
+ case 404:
436
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
437
+ case 422:
438
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
439
+ default:
440
+ throw new errors.FiveOneEatError({
441
+ statusCode: _response.error.statusCode,
442
+ body: _response.error.body,
443
+ rawResponse: _response.rawResponse,
444
+ });
445
+ }
446
+ }
447
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/product-orders/{productOrder}/label-rates");
448
+ });
449
+ }
450
+ /**
451
+ * @param {FiveOneEat.business.PurchaseLabelRequest} request
452
+ * @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
453
+ *
454
+ * @throws {@link FiveOneEat.UnauthorizedError}
455
+ * @throws {@link FiveOneEat.ForbiddenError}
456
+ * @throws {@link FiveOneEat.NotFoundError}
457
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
458
+ *
459
+ * @example
460
+ * await client.business.productOrders.purchaseLabel({
461
+ * productOrder: "productOrder",
462
+ * provider_rate_id: "provider_rate_id"
463
+ * })
464
+ */
465
+ purchaseLabel(request, requestOptions) {
466
+ return core.HttpResponsePromise.fromPromise(this.__purchaseLabel(request, requestOptions));
467
+ }
468
+ __purchaseLabel(request, requestOptions) {
469
+ return __awaiter(this, void 0, void 0, function* () {
470
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
471
+ const { productOrder } = request, _body = __rest(request, ["productOrder"]);
472
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
473
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
474
+ const _response = yield core.fetcher({
475
+ 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.FiveOneEatEnvironment.Production, `business/product-orders/${core.url.encodePathParam(productOrder)}/purchase-label`),
476
+ method: "POST",
477
+ headers: _headers,
478
+ contentType: "application/json",
479
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
480
+ requestType: "json",
481
+ body: _body,
482
+ 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,
483
+ 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,
484
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
485
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
486
+ logging: this._options.logging,
487
+ });
488
+ if (_response.ok) {
489
+ return {
490
+ data: _response.body,
491
+ rawResponse: _response.rawResponse,
492
+ };
493
+ }
494
+ if (_response.error.reason === "status-code") {
495
+ switch (_response.error.statusCode) {
496
+ case 401:
497
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
498
+ case 403:
499
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
500
+ case 404:
501
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
502
+ case 422:
503
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
504
+ default:
505
+ throw new errors.FiveOneEatError({
506
+ statusCode: _response.error.statusCode,
507
+ body: _response.error.body,
508
+ rawResponse: _response.rawResponse,
509
+ });
510
+ }
511
+ }
512
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/product-orders/{productOrder}/purchase-label");
513
+ });
514
+ }
392
515
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * productOrder: "productOrder"
5
+ * }
6
+ */
7
+ export interface GetLabelRatesProductOrdersRequest {
8
+ /** The product order ID */
9
+ productOrder: string;
10
+ }
@@ -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
+ * productOrder: "productOrder",
5
+ * provider_rate_id: "provider_rate_id"
6
+ * }
7
+ */
8
+ export interface PurchaseLabelRequest {
9
+ /** The product order ID */
10
+ productOrder: string;
11
+ provider_rate_id: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,5 +1,7 @@
1
1
  export type { FulfillProductOrdersRequest } from "./FulfillProductOrdersRequest.mjs";
2
+ export type { GetLabelRatesProductOrdersRequest } from "./GetLabelRatesProductOrdersRequest.mjs";
2
3
  export type { GetProductOrdersRequest } from "./GetProductOrdersRequest.mjs";
3
4
  export type { MarkPickedUpProductOrdersRequest } from "./MarkPickedUpProductOrdersRequest.mjs";
5
+ export type { PurchaseLabelRequest } from "./PurchaseLabelRequest.mjs";
4
6
  export type { RefundOrderRequest } from "./RefundOrderRequest.mjs";
5
7
  export type { StoreTrackingRequest } from "./StoreTrackingRequest.mjs";
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../index.mjs";
2
+ export interface PurchaseLabelProductOrdersResponse {
3
+ data: FiveOneEat.BusinessProductOrder;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -3,4 +3,5 @@ export * from "./FulfillProductOrdersResponse.mjs";
3
3
  export * from "./GetProductOrdersResponse.mjs";
4
4
  export * from "./ListProductOrdersResponse.mjs";
5
5
  export * from "./MarkPickedUpProductOrdersResponse.mjs";
6
+ export * from "./PurchaseLabelProductOrdersResponse.mjs";
6
7
  export * from "./RefundProductOrdersResponse.mjs";
@@ -3,4 +3,5 @@ export * from "./FulfillProductOrdersResponse.mjs";
3
3
  export * from "./GetProductOrdersResponse.mjs";
4
4
  export * from "./ListProductOrdersResponse.mjs";
5
5
  export * from "./MarkPickedUpProductOrdersResponse.mjs";
6
+ export * from "./PurchaseLabelProductOrdersResponse.mjs";
6
7
  export * from "./RefundProductOrdersResponse.mjs";
@@ -0,0 +1,138 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
+ import * as core from "../../../../core/index.mjs";
4
+ import * as FiveOneEat from "../../../index.mjs";
5
+ export declare namespace BusinessShippingClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class BusinessShippingClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<BusinessShippingClient.Options>;
12
+ constructor(options?: BusinessShippingClient.Options);
13
+ /**
14
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
15
+ *
16
+ * @throws {@link FiveOneEat.UnauthorizedError}
17
+ *
18
+ * @example
19
+ * await client.businessShipping.getBusinessShippingAccount()
20
+ */
21
+ getBusinessShippingAccount(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.GetBusinessShippingAccountResponse>;
22
+ private __getBusinessShippingAccount;
23
+ /**
24
+ * Use the returned client_secret with the Stripe mobile SDK to collect
25
+ * a payment method for label billing. Pass the resulting pm_* ID to
26
+ * POST /shipping/account.
27
+ *
28
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @throws {@link FiveOneEat.UnauthorizedError}
31
+ *
32
+ * @example
33
+ * await client.businessShipping.getBusinessShippingSetupIntent()
34
+ */
35
+ getBusinessShippingSetupIntent(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.GetBusinessShippingSetupIntentResponse>;
36
+ private __getBusinessShippingSetupIntent;
37
+ /**
38
+ * Creates a Stripe Customer for label billing, attaches the provided
39
+ * payment method, and upserts the ShippingAccount record.
40
+ *
41
+ * @param {FiveOneEat.SetupShippingAccountRequest} request
42
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
44
+ * @throws {@link FiveOneEat.UnauthorizedError}
45
+ * @throws {@link FiveOneEat.ForbiddenError}
46
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
47
+ *
48
+ * @example
49
+ * await client.businessShipping.setupBusinessShippingAccount({
50
+ * payment_method_id: "payment_method_id"
51
+ * })
52
+ */
53
+ setupBusinessShippingAccount(request: FiveOneEat.SetupShippingAccountRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<string>;
54
+ private __setupBusinessShippingAccount;
55
+ /**
56
+ * @param {FiveOneEat.UpdateShippingAccountRequest} request
57
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
58
+ *
59
+ * @throws {@link FiveOneEat.UnauthorizedError}
60
+ * @throws {@link FiveOneEat.ForbiddenError}
61
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
62
+ *
63
+ * @example
64
+ * await client.businessShipping.updateBusinessShippingAccount()
65
+ */
66
+ updateBusinessShippingAccount(request?: FiveOneEat.UpdateShippingAccountRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.UpdateBusinessShippingAccountResponse>;
67
+ private __updateBusinessShippingAccount;
68
+ /**
69
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
70
+ *
71
+ * @throws {@link FiveOneEat.UnauthorizedError}
72
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
73
+ *
74
+ * @example
75
+ * await client.businessShipping.deleteBusinessShippingAccount()
76
+ */
77
+ deleteBusinessShippingAccount(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<void>;
78
+ private __deleteBusinessShippingAccount;
79
+ /**
80
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
81
+ *
82
+ * @throws {@link FiveOneEat.UnauthorizedError}
83
+ *
84
+ * @example
85
+ * await client.businessShipping.listBusinessShippingRates()
86
+ */
87
+ listBusinessShippingRates(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.ListBusinessShippingRatesResponse>;
88
+ private __listBusinessShippingRates;
89
+ /**
90
+ * @param {FiveOneEat.StoreShippingRateRequest} request
91
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
92
+ *
93
+ * @throws {@link FiveOneEat.UnauthorizedError}
94
+ * @throws {@link FiveOneEat.ForbiddenError}
95
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
96
+ *
97
+ * @example
98
+ * await client.businessShipping.createBusinessShippingRate({
99
+ * name: "name",
100
+ * rate_type: "flat"
101
+ * })
102
+ */
103
+ createBusinessShippingRate(request: FiveOneEat.StoreShippingRateRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.CreateBusinessShippingRateResponse>;
104
+ private __createBusinessShippingRate;
105
+ /**
106
+ * @param {FiveOneEat.UpdateShippingRateRequest} request
107
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
108
+ *
109
+ * @throws {@link FiveOneEat.UnauthorizedError}
110
+ * @throws {@link FiveOneEat.ForbiddenError}
111
+ * @throws {@link FiveOneEat.NotFoundError}
112
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
113
+ *
114
+ * @example
115
+ * await client.businessShipping.updateBusinessShippingRate({
116
+ * shippingRate: "shippingRate",
117
+ * name: "name",
118
+ * rate_type: "flat"
119
+ * })
120
+ */
121
+ updateBusinessShippingRate(request: FiveOneEat.UpdateShippingRateRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.UpdateBusinessShippingRateResponse>;
122
+ private __updateBusinessShippingRate;
123
+ /**
124
+ * @param {FiveOneEat.DeleteBusinessShippingRateRequest} request
125
+ * @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
126
+ *
127
+ * @throws {@link FiveOneEat.UnauthorizedError}
128
+ * @throws {@link FiveOneEat.ForbiddenError}
129
+ * @throws {@link FiveOneEat.NotFoundError}
130
+ *
131
+ * @example
132
+ * await client.businessShipping.deleteBusinessShippingRate({
133
+ * shippingRate: "shippingRate"
134
+ * })
135
+ */
136
+ deleteBusinessShippingRate(request: FiveOneEat.DeleteBusinessShippingRateRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<void>;
137
+ private __deleteBusinessShippingRate;
138
+ }