@51eat/sdk 0.0.45 → 0.0.46

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 (89) hide show
  1. package/README.md +12 -9
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +3 -0
  4. package/dist/cjs/Client.js +15 -10
  5. package/dist/cjs/api/resources/businessProducts/client/Client.d.ts +62 -0
  6. package/dist/cjs/api/resources/businessProducts/client/Client.js +261 -0
  7. package/dist/cjs/api/resources/businessProducts/client/index.d.ts +1 -0
  8. package/dist/cjs/api/resources/businessProducts/client/index.js +17 -0
  9. package/dist/cjs/api/resources/businessProducts/client/requests/AdjustInventoryRequest.d.ts +34 -0
  10. package/dist/cjs/api/resources/businessProducts/client/requests/AdjustInventoryRequest.js +20 -0
  11. package/dist/cjs/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.d.ts +10 -0
  12. package/dist/cjs/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.js +3 -0
  13. package/dist/cjs/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.d.ts +11 -0
  14. package/dist/cjs/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.js +3 -0
  15. package/dist/cjs/api/resources/businessProducts/client/requests/index.d.ts +3 -0
  16. package/dist/cjs/api/resources/businessProducts/client/requests/index.js +5 -0
  17. package/dist/cjs/api/resources/businessProducts/exports.d.ts +2 -0
  18. package/dist/cjs/api/resources/businessProducts/exports.js +21 -0
  19. package/dist/cjs/api/resources/businessProducts/index.d.ts +2 -0
  20. package/dist/cjs/api/resources/businessProducts/index.js +18 -0
  21. package/dist/cjs/api/resources/businessProducts/types/AdjustVariantInventoryResponse.d.ts +4 -0
  22. package/dist/cjs/api/resources/businessProducts/types/AdjustVariantInventoryResponse.js +3 -0
  23. package/dist/cjs/api/resources/businessProducts/types/GetProductInventorySummaryResponse.d.ts +4 -0
  24. package/dist/cjs/api/resources/businessProducts/types/GetProductInventorySummaryResponse.js +3 -0
  25. package/dist/cjs/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.d.ts +4 -0
  26. package/dist/cjs/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.js +3 -0
  27. package/dist/cjs/api/resources/businessProducts/types/index.d.ts +3 -0
  28. package/dist/cjs/api/resources/businessProducts/types/index.js +19 -0
  29. package/dist/cjs/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.ts +1 -1
  30. package/dist/cjs/api/resources/index.d.ts +3 -0
  31. package/dist/cjs/api/resources/index.js +4 -1
  32. package/dist/cjs/api/types/BusinessInventoryLog.d.ts +15 -0
  33. package/dist/cjs/api/types/BusinessInventoryLog.js +3 -0
  34. package/dist/cjs/api/types/BusinessProductInventorySummary.d.ts +7 -0
  35. package/dist/cjs/api/types/BusinessProductInventorySummary.js +3 -0
  36. package/dist/cjs/api/types/CustomerCartItem.d.ts +1 -1
  37. package/dist/cjs/api/types/CustomerProductOrder.d.ts +5 -5
  38. package/dist/cjs/api/types/CustomerProductOrderItem.d.ts +2 -2
  39. package/dist/cjs/api/types/InternalServerErrorBody.d.ts +7 -1
  40. package/dist/cjs/api/types/InternalServerErrorBody.js +7 -0
  41. package/dist/cjs/api/types/index.d.ts +2 -0
  42. package/dist/cjs/api/types/index.js +2 -0
  43. package/dist/cjs/version.d.ts +1 -1
  44. package/dist/cjs/version.js +1 -1
  45. package/dist/esm/BaseClient.mjs +2 -2
  46. package/dist/esm/Client.d.mts +3 -0
  47. package/dist/esm/Client.mjs +5 -0
  48. package/dist/esm/api/resources/businessProducts/client/Client.d.mts +62 -0
  49. package/dist/esm/api/resources/businessProducts/client/Client.mjs +224 -0
  50. package/dist/esm/api/resources/businessProducts/client/index.d.mts +1 -0
  51. package/dist/esm/api/resources/businessProducts/client/index.mjs +1 -0
  52. package/dist/esm/api/resources/businessProducts/client/requests/AdjustInventoryRequest.d.mts +34 -0
  53. package/dist/esm/api/resources/businessProducts/client/requests/AdjustInventoryRequest.mjs +17 -0
  54. package/dist/esm/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.d.mts +10 -0
  55. package/dist/esm/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.mjs +2 -0
  56. package/dist/esm/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.d.mts +11 -0
  57. package/dist/esm/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.mjs +2 -0
  58. package/dist/esm/api/resources/businessProducts/client/requests/index.d.mts +3 -0
  59. package/dist/esm/api/resources/businessProducts/client/requests/index.mjs +1 -0
  60. package/dist/esm/api/resources/businessProducts/exports.d.mts +2 -0
  61. package/dist/esm/api/resources/businessProducts/exports.mjs +3 -0
  62. package/dist/esm/api/resources/businessProducts/index.d.mts +2 -0
  63. package/dist/esm/api/resources/businessProducts/index.mjs +2 -0
  64. package/dist/esm/api/resources/businessProducts/types/AdjustVariantInventoryResponse.d.mts +4 -0
  65. package/dist/esm/api/resources/businessProducts/types/AdjustVariantInventoryResponse.mjs +2 -0
  66. package/dist/esm/api/resources/businessProducts/types/GetProductInventorySummaryResponse.d.mts +4 -0
  67. package/dist/esm/api/resources/businessProducts/types/GetProductInventorySummaryResponse.mjs +2 -0
  68. package/dist/esm/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.d.mts +4 -0
  69. package/dist/esm/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.mjs +2 -0
  70. package/dist/esm/api/resources/businessProducts/types/index.d.mts +3 -0
  71. package/dist/esm/api/resources/businessProducts/types/index.mjs +3 -0
  72. package/dist/esm/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.mts +1 -1
  73. package/dist/esm/api/resources/index.d.mts +3 -0
  74. package/dist/esm/api/resources/index.mjs +3 -0
  75. package/dist/esm/api/types/BusinessInventoryLog.d.mts +15 -0
  76. package/dist/esm/api/types/BusinessInventoryLog.mjs +2 -0
  77. package/dist/esm/api/types/BusinessProductInventorySummary.d.mts +7 -0
  78. package/dist/esm/api/types/BusinessProductInventorySummary.mjs +2 -0
  79. package/dist/esm/api/types/CustomerCartItem.d.mts +1 -1
  80. package/dist/esm/api/types/CustomerProductOrder.d.mts +5 -5
  81. package/dist/esm/api/types/CustomerProductOrderItem.d.mts +2 -2
  82. package/dist/esm/api/types/InternalServerErrorBody.d.mts +7 -1
  83. package/dist/esm/api/types/InternalServerErrorBody.mjs +6 -1
  84. package/dist/esm/api/types/index.d.mts +2 -0
  85. package/dist/esm/api/types/index.mjs +2 -0
  86. package/dist/esm/version.d.mts +1 -1
  87. package/dist/esm/version.mjs +1 -1
  88. package/package.json +12 -1
  89. package/reference.md +157 -0
@@ -0,0 +1,18 @@
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);
18
+ __exportStar(require("./types/index.js"), exports);
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface AdjustVariantInventoryResponse {
3
+ data: FiveOneEat.BusinessProductVariant;
4
+ }
@@ -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,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface GetProductInventorySummaryResponse {
3
+ data: FiveOneEat.BusinessProductInventorySummary;
4
+ }
@@ -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,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface ListVariantInventoryHistoryResponse {
3
+ data: FiveOneEat.BusinessInventoryLog[];
4
+ }
@@ -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,3 @@
1
+ export * from "./AdjustVariantInventoryResponse.js";
2
+ export * from "./GetProductInventorySummaryResponse.js";
3
+ export * from "./ListVariantInventoryHistoryResponse.js";
@@ -0,0 +1,19 @@
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("./AdjustVariantInventoryResponse.js"), exports);
18
+ __exportStar(require("./GetProductInventorySummaryResponse.js"), exports);
19
+ __exportStar(require("./ListVariantInventoryHistoryResponse.js"), exports);
@@ -1,7 +1,7 @@
1
1
  export interface CreatePaymentIntentCartResponse {
2
2
  client_secret: string;
3
3
  payment_intent_id: string;
4
- subtotal: number;
4
+ subtotal: string;
5
5
  tax_amount: string;
6
6
  tax_calculation: CreatePaymentIntentCartResponse.TaxCalculation | null;
7
7
  shipping_amount: string;
@@ -2,6 +2,9 @@ export * as business from "./business/index.js";
2
2
  export * from "./businessMessaging/client/requests/index.js";
3
3
  export * as businessMessaging from "./businessMessaging/index.js";
4
4
  export * from "./businessMessaging/types/index.js";
5
+ export * from "./businessProducts/client/requests/index.js";
6
+ export * as businessProducts from "./businessProducts/index.js";
7
+ export * from "./businessProducts/types/index.js";
5
8
  export * from "./customer/client/requests/index.js";
6
9
  export * as customer from "./customer/index.js";
7
10
  export * from "./customer/types/index.js";
@@ -36,11 +36,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.serveAd = exports.recordClick = exports.customerMyAccount = exports.customerMessaging = exports.customer = exports.businessMessaging = exports.business = void 0;
39
+ exports.serveAd = exports.recordClick = exports.customerMyAccount = exports.customerMessaging = exports.customer = exports.businessProducts = exports.businessMessaging = exports.business = void 0;
40
40
  exports.business = __importStar(require("./business/index.js"));
41
41
  __exportStar(require("./businessMessaging/client/requests/index.js"), exports);
42
42
  exports.businessMessaging = __importStar(require("./businessMessaging/index.js"));
43
43
  __exportStar(require("./businessMessaging/types/index.js"), exports);
44
+ __exportStar(require("./businessProducts/client/requests/index.js"), exports);
45
+ exports.businessProducts = __importStar(require("./businessProducts/index.js"));
46
+ __exportStar(require("./businessProducts/types/index.js"), exports);
44
47
  __exportStar(require("./customer/client/requests/index.js"), exports);
45
48
  exports.customer = __importStar(require("./customer/index.js"));
46
49
  __exportStar(require("./customer/types/index.js"), exports);
@@ -0,0 +1,15 @@
1
+ export interface BusinessInventoryLog {
2
+ id: string;
3
+ change_type: string;
4
+ quantity_change: number;
5
+ quantity_after: number;
6
+ notes: string | null;
7
+ created_by?: BusinessInventoryLog.CreatedBy | undefined;
8
+ created_at: string;
9
+ }
10
+ export declare namespace BusinessInventoryLog {
11
+ interface CreatedBy {
12
+ id: string;
13
+ name: string;
14
+ }
15
+ }
@@ -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,7 @@
1
+ export interface BusinessProductInventorySummary {
2
+ product_id: string;
3
+ total_inventory: number;
4
+ track_inventory: boolean;
5
+ inventory_policy: string;
6
+ variants: string;
7
+ }
@@ -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 });
@@ -19,6 +19,6 @@ export declare namespace CustomerCartItem {
19
19
  interface Variant {
20
20
  id: string;
21
21
  name: string;
22
- price: number;
22
+ price: string;
23
23
  }
24
24
  }
@@ -5,11 +5,11 @@ export interface CustomerProductOrder {
5
5
  status: string;
6
6
  fulfillment_status: string;
7
7
  fulfillment_method: string;
8
- subtotal: number;
9
- tax_amount: number;
10
- shipping_amount: number;
11
- discount_amount: number;
12
- total_amount: number;
8
+ subtotal: string;
9
+ tax_amount: string;
10
+ shipping_amount: string;
11
+ discount_amount: string;
12
+ total_amount: string;
13
13
  tracking_number: string | null;
14
14
  tracking_url: string | null;
15
15
  shipping_address: unknown[] | null;
@@ -3,8 +3,8 @@ export interface CustomerProductOrderItem {
3
3
  product_id: string;
4
4
  variant_id: string | null;
5
5
  quantity: number;
6
- unit_price: number;
7
- total_price: number;
6
+ unit_price: string;
7
+ total_price: string;
8
8
  product_snapshot: unknown[] | null;
9
9
  product?: CustomerProductOrderItem.Product | undefined;
10
10
  variant?: (CustomerProductOrderItem.Variant | null) | undefined;
@@ -1,3 +1,9 @@
1
1
  export interface InternalServerErrorBody {
2
- message: string;
2
+ message: InternalServerErrorBody.Message;
3
+ }
4
+ export declare namespace InternalServerErrorBody {
5
+ const Message: {
6
+ readonly UnableToProcessPaymentPleaseTryAgain: "Unable to process payment. Please try again.";
7
+ };
8
+ type Message = (typeof Message)[keyof typeof Message];
3
9
  }
@@ -1,3 +1,10 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InternalServerErrorBody = void 0;
5
+ var InternalServerErrorBody;
6
+ (function (InternalServerErrorBody) {
7
+ InternalServerErrorBody.Message = {
8
+ UnableToProcessPaymentPleaseTryAgain: "Unable to process payment. Please try again.",
9
+ };
10
+ })(InternalServerErrorBody || (exports.InternalServerErrorBody = InternalServerErrorBody = {}));
@@ -40,6 +40,7 @@ export * from "./BusinessEventOrderDetail.js";
40
40
  export * from "./BusinessEventRsvp.js";
41
41
  export * from "./BusinessEventSalesSummary.js";
42
42
  export * from "./BusinessEventTicketType.js";
43
+ export * from "./BusinessInventoryLog.js";
43
44
  export * from "./BusinessLoginResponse.js";
44
45
  export * from "./BusinessMe.js";
45
46
  export * from "./BusinessMenu.js";
@@ -51,6 +52,7 @@ export * from "./BusinessMessage.js";
51
52
  export * from "./BusinessPhoto.js";
52
53
  export * from "./BusinessProduct.js";
53
54
  export * from "./BusinessProductCategory.js";
55
+ export * from "./BusinessProductInventorySummary.js";
54
56
  export * from "./BusinessProductOrder.js";
55
57
  export * from "./BusinessProductOrderItem.js";
56
58
  export * from "./BusinessProductVariant.js";
@@ -56,6 +56,7 @@ __exportStar(require("./BusinessEventOrderDetail.js"), exports);
56
56
  __exportStar(require("./BusinessEventRsvp.js"), exports);
57
57
  __exportStar(require("./BusinessEventSalesSummary.js"), exports);
58
58
  __exportStar(require("./BusinessEventTicketType.js"), exports);
59
+ __exportStar(require("./BusinessInventoryLog.js"), exports);
59
60
  __exportStar(require("./BusinessLoginResponse.js"), exports);
60
61
  __exportStar(require("./BusinessMe.js"), exports);
61
62
  __exportStar(require("./BusinessMenu.js"), exports);
@@ -67,6 +68,7 @@ __exportStar(require("./BusinessMessage.js"), exports);
67
68
  __exportStar(require("./BusinessPhoto.js"), exports);
68
69
  __exportStar(require("./BusinessProduct.js"), exports);
69
70
  __exportStar(require("./BusinessProductCategory.js"), exports);
71
+ __exportStar(require("./BusinessProductInventorySummary.js"), exports);
70
72
  __exportStar(require("./BusinessProductOrder.js"), exports);
71
73
  __exportStar(require("./BusinessProductOrderItem.js"), exports);
72
74
  __exportStar(require("./BusinessProductVariant.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.45";
1
+ export declare const SDK_VERSION = "0.0.46";
@@ -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 = "0.0.45";
4
+ exports.SDK_VERSION = "0.0.46";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@51eat/sdk",
9
- "X-Fern-SDK-Version": "0.0.45",
10
- "User-Agent": "@51eat/sdk/0.0.45",
9
+ "X-Fern-SDK-Version": "0.0.46",
10
+ "User-Agent": "@51eat/sdk/0.0.46",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,5 +1,6 @@
1
1
  import { BusinessClient } from "./api/resources/business/client/Client.mjs";
2
2
  import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
3
+ import { BusinessProductsClient } from "./api/resources/businessProducts/client/Client.mjs";
3
4
  import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
4
5
  import { CustomerMessagingClient } from "./api/resources/customerMessaging/client/Client.mjs";
5
6
  import { CustomerMyAccountClient } from "./api/resources/customerMyAccount/client/Client.mjs";
@@ -16,6 +17,7 @@ export declare namespace FiveOneEatClient {
16
17
  export declare class FiveOneEatClient {
17
18
  protected readonly _options: NormalizedClientOptionsWithAuth<FiveOneEatClient.Options>;
18
19
  protected _businessMessaging: BusinessMessagingClient | undefined;
20
+ protected _businessProducts: BusinessProductsClient | undefined;
19
21
  protected _customerMessaging: CustomerMessagingClient | undefined;
20
22
  protected _customerMyAccount: CustomerMyAccountClient | undefined;
21
23
  protected _customer: CustomerClient | undefined;
@@ -24,6 +26,7 @@ export declare class FiveOneEatClient {
24
26
  protected _business: BusinessClient | undefined;
25
27
  constructor(options?: FiveOneEatClient.Options);
26
28
  get businessMessaging(): BusinessMessagingClient;
29
+ get businessProducts(): BusinessProductsClient;
27
30
  get customerMessaging(): CustomerMessagingClient;
28
31
  get customerMyAccount(): CustomerMyAccountClient;
29
32
  get customer(): CustomerClient;
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  import { BusinessClient } from "./api/resources/business/client/Client.mjs";
12
12
  import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
13
+ import { BusinessProductsClient } from "./api/resources/businessProducts/client/Client.mjs";
13
14
  import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
14
15
  import { CustomerMessagingClient } from "./api/resources/customerMessaging/client/Client.mjs";
15
16
  import { CustomerMyAccountClient } from "./api/resources/customerMyAccount/client/Client.mjs";
@@ -25,6 +26,10 @@ export class FiveOneEatClient {
25
26
  var _a;
26
27
  return ((_a = this._businessMessaging) !== null && _a !== void 0 ? _a : (this._businessMessaging = new BusinessMessagingClient(this._options)));
27
28
  }
29
+ get businessProducts() {
30
+ var _a;
31
+ return ((_a = this._businessProducts) !== null && _a !== void 0 ? _a : (this._businessProducts = new BusinessProductsClient(this._options)));
32
+ }
28
33
  get customerMessaging() {
29
34
  var _a;
30
35
  return ((_a = this._customerMessaging) !== null && _a !== void 0 ? _a : (this._customerMessaging = new CustomerMessagingClient(this._options)));
@@ -0,0 +1,62 @@
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 BusinessProductsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class BusinessProductsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<BusinessProductsClient.Options>;
12
+ constructor(options?: BusinessProductsClient.Options);
13
+ /**
14
+ * @param {FiveOneEat.AdjustInventoryRequest} request
15
+ * @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
16
+ *
17
+ * @throws {@link FiveOneEat.UnauthorizedError}
18
+ * @throws {@link FiveOneEat.ForbiddenError}
19
+ * @throws {@link FiveOneEat.NotFoundError}
20
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
21
+ *
22
+ * @example
23
+ * await client.businessProducts.adjustVariantInventory({
24
+ * variant: "variant",
25
+ * type: "add",
26
+ * quantity: 1,
27
+ * reason: "restock"
28
+ * })
29
+ */
30
+ adjustVariantInventory(request: FiveOneEat.AdjustInventoryRequest, requestOptions?: BusinessProductsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.AdjustVariantInventoryResponse>;
31
+ private __adjustVariantInventory;
32
+ /**
33
+ * @param {FiveOneEat.ListVariantInventoryHistoryRequest} request
34
+ * @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @throws {@link FiveOneEat.UnauthorizedError}
37
+ * @throws {@link FiveOneEat.ForbiddenError}
38
+ * @throws {@link FiveOneEat.NotFoundError}
39
+ *
40
+ * @example
41
+ * await client.businessProducts.listVariantInventoryHistory({
42
+ * variant: "variant"
43
+ * })
44
+ */
45
+ listVariantInventoryHistory(request: FiveOneEat.ListVariantInventoryHistoryRequest, requestOptions?: BusinessProductsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.ListVariantInventoryHistoryResponse>;
46
+ private __listVariantInventoryHistory;
47
+ /**
48
+ * @param {FiveOneEat.GetProductInventorySummaryRequest} request
49
+ * @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
50
+ *
51
+ * @throws {@link FiveOneEat.UnauthorizedError}
52
+ * @throws {@link FiveOneEat.ForbiddenError}
53
+ * @throws {@link FiveOneEat.NotFoundError}
54
+ *
55
+ * @example
56
+ * await client.businessProducts.getProductInventorySummary({
57
+ * product: "product"
58
+ * })
59
+ */
60
+ getProductInventorySummary(request: FiveOneEat.GetProductInventorySummaryRequest, requestOptions?: BusinessProductsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.GetProductInventorySummaryResponse>;
61
+ private __getProductInventorySummary;
62
+ }
@@ -0,0 +1,224 @@
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 { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
23
+ import { mergeHeaders } from "../../../../core/headers.mjs";
24
+ import * as core from "../../../../core/index.mjs";
25
+ import * as environments from "../../../../environments.mjs";
26
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
27
+ import * as errors from "../../../../errors/index.mjs";
28
+ import * as FiveOneEat from "../../../index.mjs";
29
+ export class BusinessProductsClient {
30
+ constructor(options = {}) {
31
+ this._options = normalizeClientOptionsWithAuth(options);
32
+ }
33
+ /**
34
+ * @param {FiveOneEat.AdjustInventoryRequest} request
35
+ * @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link FiveOneEat.UnauthorizedError}
38
+ * @throws {@link FiveOneEat.ForbiddenError}
39
+ * @throws {@link FiveOneEat.NotFoundError}
40
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
41
+ *
42
+ * @example
43
+ * await client.businessProducts.adjustVariantInventory({
44
+ * variant: "variant",
45
+ * type: "add",
46
+ * quantity: 1,
47
+ * reason: "restock"
48
+ * })
49
+ */
50
+ adjustVariantInventory(request, requestOptions) {
51
+ return core.HttpResponsePromise.fromPromise(this.__adjustVariantInventory(request, requestOptions));
52
+ }
53
+ __adjustVariantInventory(request, requestOptions) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
56
+ const { variant } = request, _body = __rest(request, ["variant"]);
57
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
58
+ 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);
59
+ const _response = yield core.fetcher({
60
+ 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/products/variants/${core.url.encodePathParam(variant)}/inventory/adjust`),
61
+ method: "POST",
62
+ headers: _headers,
63
+ contentType: "application/json",
64
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
65
+ requestType: "json",
66
+ body: _body,
67
+ 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,
68
+ 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,
69
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
70
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
71
+ logging: this._options.logging,
72
+ });
73
+ if (_response.ok) {
74
+ return {
75
+ data: _response.body,
76
+ rawResponse: _response.rawResponse,
77
+ };
78
+ }
79
+ if (_response.error.reason === "status-code") {
80
+ switch (_response.error.statusCode) {
81
+ case 401:
82
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
83
+ case 403:
84
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
85
+ case 404:
86
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
87
+ case 422:
88
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
89
+ default:
90
+ throw new errors.FiveOneEatError({
91
+ statusCode: _response.error.statusCode,
92
+ body: _response.error.body,
93
+ rawResponse: _response.rawResponse,
94
+ });
95
+ }
96
+ }
97
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/products/variants/{variant}/inventory/adjust");
98
+ });
99
+ }
100
+ /**
101
+ * @param {FiveOneEat.ListVariantInventoryHistoryRequest} request
102
+ * @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
103
+ *
104
+ * @throws {@link FiveOneEat.UnauthorizedError}
105
+ * @throws {@link FiveOneEat.ForbiddenError}
106
+ * @throws {@link FiveOneEat.NotFoundError}
107
+ *
108
+ * @example
109
+ * await client.businessProducts.listVariantInventoryHistory({
110
+ * variant: "variant"
111
+ * })
112
+ */
113
+ listVariantInventoryHistory(request, requestOptions) {
114
+ return core.HttpResponsePromise.fromPromise(this.__listVariantInventoryHistory(request, requestOptions));
115
+ }
116
+ __listVariantInventoryHistory(request, requestOptions) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
119
+ const { variant, per_page: perPage } = request;
120
+ const _queryParams = {
121
+ per_page: perPage,
122
+ };
123
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
124
+ 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);
125
+ const _response = yield core.fetcher({
126
+ 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/products/variants/${core.url.encodePathParam(variant)}/inventory/history`),
127
+ method: "GET",
128
+ headers: _headers,
129
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
130
+ queryString: core.url
131
+ .queryBuilder()
132
+ .addMany(_queryParams)
133
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
134
+ .build(),
135
+ 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,
136
+ 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,
137
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
138
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
139
+ logging: this._options.logging,
140
+ });
141
+ if (_response.ok) {
142
+ return {
143
+ data: _response.body,
144
+ rawResponse: _response.rawResponse,
145
+ };
146
+ }
147
+ if (_response.error.reason === "status-code") {
148
+ switch (_response.error.statusCode) {
149
+ case 401:
150
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
151
+ case 403:
152
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
153
+ case 404:
154
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
155
+ default:
156
+ throw new errors.FiveOneEatError({
157
+ statusCode: _response.error.statusCode,
158
+ body: _response.error.body,
159
+ rawResponse: _response.rawResponse,
160
+ });
161
+ }
162
+ }
163
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/products/variants/{variant}/inventory/history");
164
+ });
165
+ }
166
+ /**
167
+ * @param {FiveOneEat.GetProductInventorySummaryRequest} request
168
+ * @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
169
+ *
170
+ * @throws {@link FiveOneEat.UnauthorizedError}
171
+ * @throws {@link FiveOneEat.ForbiddenError}
172
+ * @throws {@link FiveOneEat.NotFoundError}
173
+ *
174
+ * @example
175
+ * await client.businessProducts.getProductInventorySummary({
176
+ * product: "product"
177
+ * })
178
+ */
179
+ getProductInventorySummary(request, requestOptions) {
180
+ return core.HttpResponsePromise.fromPromise(this.__getProductInventorySummary(request, requestOptions));
181
+ }
182
+ __getProductInventorySummary(request, requestOptions) {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
185
+ const { product } = request;
186
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
187
+ 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);
188
+ const _response = yield core.fetcher({
189
+ 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/products/${core.url.encodePathParam(product)}/inventory`),
190
+ method: "GET",
191
+ headers: _headers,
192
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
193
+ 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,
194
+ 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,
195
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
196
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
197
+ logging: this._options.logging,
198
+ });
199
+ if (_response.ok) {
200
+ return {
201
+ data: _response.body,
202
+ rawResponse: _response.rawResponse,
203
+ };
204
+ }
205
+ if (_response.error.reason === "status-code") {
206
+ switch (_response.error.statusCode) {
207
+ case 401:
208
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
209
+ case 403:
210
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
211
+ case 404:
212
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
213
+ default:
214
+ throw new errors.FiveOneEatError({
215
+ statusCode: _response.error.statusCode,
216
+ body: _response.error.body,
217
+ rawResponse: _response.rawResponse,
218
+ });
219
+ }
220
+ }
221
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/products/{product}/inventory");
222
+ });
223
+ }
224
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";