diff --git a/.eslintrc.json b/.eslintrc.json
index 58cc882..ec2ce14 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -5,7 +5,8 @@
},
"extends": [
"airbnb-base",
- "plugin:jest/recommended"
+ "plugin:jest/recommended",
+ "plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
diff --git a/README.md b/README.md
index 124ecfb..af0b131 100644
--- a/README.md
+++ b/README.md
@@ -90,8 +90,9 @@ OMS | :white_check_mark: |
Logistics | :white_check_mark: |
Pricing | :white_check_mark: |
Master Data (V2) | :white_check_mark: (*) Attachments API pending |
+Catalog | :white_check_mark: |
+Search | Comming soon... |
Antifraud Provider | :x: |
-Catalog | Comming soon... |
Checkout | :x: |
CMS | :x: |
Customer Credit | :x: |
@@ -102,7 +103,6 @@ License Manager | :x: |
Payment Provider Protocol | :x: |
Payments Gateway | :x: |
Rates and Benefits | :x: |
-Search | :x: |
Session Manager | :x: |
Subscriptions (V2) | :x: |
Suggestions | :x: |
diff --git a/babel.config.js b/babel.config.js
index b7f846c..73322d8 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,13 +1,13 @@
module.exports = {
presets: [
[
- '@babel/preset-env',
+ "@babel/preset-env",
{
targets: {
node: 8,
},
},
],
- '@babel/preset-typescript',
+ "@babel/preset-typescript",
],
};
diff --git a/jest.config.js b/jest.config.js
index e72e1b0..34a5a11 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -1,5 +1,5 @@
module.exports = {
- preset: 'ts-jest',
- testEnvironment: 'node',
+ preset: "ts-jest",
+ testEnvironment: "node",
verbose: true,
};
diff --git a/package.json b/package.json
index ef9e3a5..d7aa4cc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@onreadydesa/vtex-node-sdk",
- "version": "1.3.0-alpha",
+ "version": "1.4.0-alpha",
"description": "VTEX Node SDK, built 100% with Typescript and 0 dependencies!",
"author": "Onready",
"private": false,
@@ -19,28 +19,42 @@
"keywords": [
"vtex",
"vtex-sdk",
- "vtex-node-sdk"
+ "vtex-node-sdk",
+ "onready",
+ "vtex-api",
+ "sdk-node-vtex",
+ "typescript",
+ "api-vtex",
+ "sdk-vtex",
+ "node",
+ "vtex-node",
+ "node-vtex",
+ "node-vtex-sdk"
],
"scripts": {
"build": "rimraf dist && tsc",
"test": "jest",
- "lint": "eslint ."
+ "lint": "eslint \"./src/**/*.ts\"",
+ "prepublishOnly": "yarn lint && yarn test && yarn build"
},
"devDependencies": {
"@babel/core": "7.10.3",
"@babel/preset-env": "7.10.3",
"@babel/preset-typescript": "7.10.1",
- "@types/jest": "26.0.0",
- "@types/node": "14.0.13",
- "@typescript-eslint/eslint-plugin": "3.3.0",
- "@typescript-eslint/parser": "3.3.0",
- "babel-jest": "26.0.1",
- "eslint": "7.3.0",
+ "@types/jest": "26.0.3",
+ "@types/node": "14.0.14",
+ "@typescript-eslint/eslint-plugin": "3.4.0",
+ "@typescript-eslint/parser": "3.4.0",
+ "babel-jest": "26.1.0",
+ "eslint": "7.3.1",
"eslint-config-airbnb-base": "14.2.0",
+ "eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.21.2",
- "eslint-plugin-jest": "23.16.0",
- "jest": "26.0.1",
+ "eslint-plugin-jest": "23.17.1",
+ "eslint-plugin-prettier": "3.1.4",
+ "jest": "26.1.0",
"nock": "12.0.3",
+ "prettier": "2.0.5",
"rimraf": "3.0.2",
"ts-jest": "26.1.1",
"typescript": "3.9.5"
diff --git a/src/VTEX.ts b/src/VTEX.ts
index 619c753..15f21a0 100644
--- a/src/VTEX.ts
+++ b/src/VTEX.ts
@@ -1,23 +1,28 @@
-import { VtexCredentials } from './VtexCredentials';
-import { VtexHttpClient } from './utils/VtexHttpClient';
-import { OMS } from './modules/OMS';
-import { Logistics } from './modules/logistics';
-import { Pricing } from './modules/pricing';
-import { MasterData } from './modules/master-data/v2';
+import { VtexCredentials } from "./VtexCredentials";
+import { VtexHttpClient } from "./utils/VtexHttpClient";
+import { OMS } from "./modules/OMS";
+import { Logistics } from "./modules/logistics";
+import { Pricing } from "./modules/pricing";
+import { MasterData } from "./modules/master-data/v2";
+import { Catalog } from "./modules/catalog";
export class VTEX {
private static buildErrorMessage(paramName: string): string {
return `Param ${paramName} is required`;
}
- private static validate(store: string, appKey: string, appToken: string): void {
+ private static validate(
+ store: string,
+ appKey: string,
+ appToken: string
+ ): void {
let errorMessage = null;
if (!store) {
- errorMessage = VTEX.buildErrorMessage('store');
+ errorMessage = VTEX.buildErrorMessage("store");
} else if (!appKey) {
- errorMessage = VTEX.buildErrorMessage('appKey');
+ errorMessage = VTEX.buildErrorMessage("appKey");
} else if (!appToken) {
- errorMessage = VTEX.buildErrorMessage('appToken');
+ errorMessage = VTEX.buildErrorMessage("appToken");
}
if (errorMessage) {
throw new Error(errorMessage);
@@ -44,16 +49,29 @@ export class VTEX {
*/
readonly masterData: MasterData;
+ /**
+ * Catalog Module
+ */
+ readonly catalog: Catalog;
+
/**
* @param {string} store
* @param {string} appKey
* @param {string} appToken
* @param {string} environment Default: 'stable'
*/
- constructor(store: string, appKey: string, appToken: string, environment: string = 'stable') {
+ constructor(
+ store: string,
+ appKey: string,
+ appToken: string,
+ environment: string = "stable"
+ ) {
VTEX.validate(store, appKey, appToken);
const vtexCredentials: VtexCredentials = new VtexCredentials(
- store, appKey, appToken, environment,
+ store,
+ appKey,
+ appToken,
+ environment
);
const vtexHttpClient: VtexHttpClient = new VtexHttpClient(vtexCredentials);
@@ -62,5 +80,6 @@ export class VTEX {
this.logistics = new Logistics(vtexHttpClient);
this.pricing = new Pricing(vtexHttpClient);
this.masterData = new MasterData(vtexHttpClient);
+ this.catalog = new Catalog(vtexHttpClient);
}
}
diff --git a/src/VtexCredentials.ts b/src/VtexCredentials.ts
index 52e5741..23a70c8 100644
--- a/src/VtexCredentials.ts
+++ b/src/VtexCredentials.ts
@@ -12,7 +12,12 @@ export class VtexCredentials {
* @param {string} appKey
* @param {string} appToken
*/
- constructor(store: string, appKey: string, appToken: string, environment: string) {
+ constructor(
+ store: string,
+ appKey: string,
+ appToken: string,
+ environment: string
+ ) {
this.store = store;
this.appKey = appKey;
this.appToken = appToken;
diff --git a/src/index.ts b/src/index.ts
index 2698843..24190eb 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1 +1 @@
-export * from './VTEX';
+export * from "./VTEX";
diff --git a/src/modules/AbstractApi.ts b/src/modules/AbstractApi.ts
index f21d3d0..3754082 100644
--- a/src/modules/AbstractApi.ts
+++ b/src/modules/AbstractApi.ts
@@ -1,15 +1,15 @@
-import { VtexHttpClient } from '../utils/VtexHttpClient';
+import { VtexHttpClient } from "../utils/VtexHttpClient";
export abstract class AbstractApi {
protected readonly vtexHttpClient: VtexHttpClient;
protected readonly HTTP_METHODS = {
- GET: 'GET',
- POST: 'POST',
- PUT: 'PUT',
- DELETE: 'DELETE',
- PATCH: 'PATCH',
- }
+ GET: "GET",
+ POST: "POST",
+ PUT: "PUT",
+ DELETE: "DELETE",
+ PATCH: "PATCH",
+ };
constructor(vtexHttpClient: VtexHttpClient) {
this.vtexHttpClient = vtexHttpClient;
diff --git a/src/modules/OMS/OMS.ts b/src/modules/OMS/OMS.ts
index d0de38e..a4f96c1 100644
--- a/src/modules/OMS/OMS.ts
+++ b/src/modules/OMS/OMS.ts
@@ -1,12 +1,12 @@
-import { VtexHttpClient } from '../../utils/VtexHttpClient';
-import { Orders } from './apis/orders';
-import { Invoice } from './apis/invoice';
-import { Tracking } from './apis/tracking';
-import { Payment } from './apis/payment';
-import { Feed } from './apis/feed/v3';
-import { OrderHook } from './apis/order-hook';
-import { ExportOrderReport } from './apis/export-order-report';
-import { UserOrders } from './apis/user-orders';
+import { VtexHttpClient } from "../../utils/VtexHttpClient";
+import { Orders } from "./apis/orders";
+import { Invoice } from "./apis/invoice";
+import { Tracking } from "./apis/tracking";
+import { Payment } from "./apis/payment";
+import { Feed } from "./apis/feed/v3";
+import { OrderHook } from "./apis/order-hook";
+import { ExportOrderReport } from "./apis/export-order-report";
+import { UserOrders } from "./apis/user-orders";
export class OMS {
/**
diff --git a/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts b/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts
index bbb6d07..07c157c 100644
--- a/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts
+++ b/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts
@@ -1,15 +1,16 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { ExportOrderReportResponseItem } from './responses/ExportOrderReportResponseItem';
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { ExportOrderReportResponseItem } from "./responses/ExportOrderReportResponseItem";
export class ExportOrderReport extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/oms/pvt/admin/reports';
+ private static readonly BASE_PATH: string = "/api/oms/pvt/admin/reports";
/**
* @param {string} status 'inprogress' | 'completed'
*/
- exportOrderReport(status: string)
- : Promise>> {
+ exportOrderReport(
+ status: string
+ ): Promise>> {
const path = `${ExportOrderReport.BASE_PATH}/${status}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
diff --git a/src/modules/OMS/apis/export-order-report/index.ts b/src/modules/OMS/apis/export-order-report/index.ts
index 986f4de..b62c36e 100644
--- a/src/modules/OMS/apis/export-order-report/index.ts
+++ b/src/modules/OMS/apis/export-order-report/index.ts
@@ -1 +1 @@
-export * from './ExportOrderReport';
+export * from "./ExportOrderReport";
diff --git a/src/modules/OMS/apis/feed/v3/Feed.ts b/src/modules/OMS/apis/feed/v3/Feed.ts
index 7df2561..223c223 100644
--- a/src/modules/OMS/apis/feed/v3/Feed.ts
+++ b/src/modules/OMS/apis/feed/v3/Feed.ts
@@ -1,19 +1,20 @@
-import { AbstractApi } from '../../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse';
-import { RetrieveFeedOrderStatusResponse } from './responses/RetrieveFeedOrderStatusResponse';
-import { CommitItemFeedOrderStatusRequest } from './requests/CommitItemFeedOrderStatusRequest';
-import { UpdateFeedConfigurationRequest } from './requests/UpdateFeedConfigurationRequest';
-import { RetrieveFeedConfigurationResponse } from './responses/RetrieveFeedConfigurationResponse';
+import { AbstractApi } from "../../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse";
+import { RetrieveFeedOrderStatusResponse } from "./responses/RetrieveFeedOrderStatusResponse";
+import { CommitItemFeedOrderStatusRequest } from "./requests/CommitItemFeedOrderStatusRequest";
+import { UpdateFeedConfigurationRequest } from "./requests/UpdateFeedConfigurationRequest";
+import { RetrieveFeedConfigurationResponse } from "./responses/RetrieveFeedConfigurationResponse";
export class Feed extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/orders/feed';
+ private static readonly BASE_PATH: string = "/api/orders/feed";
/**
* Lists feed order events.
* @param {number} maxlot
*/
- retrieveFeedOrderStatus(maxlot: number)
- : Promise>> {
+ retrieveFeedOrderStatus(
+ maxlot: number
+ ): Promise>> {
const path = `${Feed.BASE_PATH}?maxlot=${maxlot}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -22,23 +23,37 @@ export class Feed extends AbstractApi {
* Acknowledges an item's feed order status.
* @param {CommitItemFeedOrderStatusRequest} events
*/
- commitItemFeedOrderStatus(events: CommitItemFeedOrderStatusRequest): Promise {
- return this.vtexHttpClient.performRequest(Feed.BASE_PATH, this.HTTP_METHODS.POST, events);
+ commitItemFeedOrderStatus(
+ events: CommitItemFeedOrderStatusRequest
+ ): Promise {
+ return this.vtexHttpClient.performRequest(
+ Feed.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ events
+ );
}
/**
* Configures the filter rule applied to Feed V3.
* @param {UpdateFeedConfigurationRequest} feedConfig
*/
- updateFeedConfiguration(feedConfig: UpdateFeedConfigurationRequest): Promise {
+ updateFeedConfiguration(
+ feedConfig: UpdateFeedConfigurationRequest
+ ): Promise {
const path = `${Feed.BASE_PATH}/config`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, feedConfig);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ feedConfig
+ );
}
/**
* Lists a given Feed's configuration details.
*/
- retrieveFeedConfiguration(): Promise> {
+ retrieveFeedConfiguration(): Promise<
+ VtexHttpResponse
+ > {
const path = `${Feed.BASE_PATH}/config`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
diff --git a/src/modules/OMS/apis/feed/v3/index.ts b/src/modules/OMS/apis/feed/v3/index.ts
index 5ae1dae..75b8a9a 100644
--- a/src/modules/OMS/apis/feed/v3/index.ts
+++ b/src/modules/OMS/apis/feed/v3/index.ts
@@ -1 +1 @@
-export * from './Feed';
+export * from "./Feed";
diff --git a/src/modules/OMS/apis/invoice/Invoice.ts b/src/modules/OMS/apis/invoice/Invoice.ts
index ee801d0..86551d0 100644
--- a/src/modules/OMS/apis/invoice/Invoice.ts
+++ b/src/modules/OMS/apis/invoice/Invoice.ts
@@ -1,12 +1,13 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { OrderInvoiceNotificationRequest } from './requests/OrderInvoiceNotificationRequest';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { OrderInvoiceNotificationResponse } from './responses/OrderInvoiceNotificationResponse';
-import { SendTrackingNumberRequest } from './requests/SendTrackingNumberRequest';
-import { SendTrackingNumberResponse } from './responses/SendTrackingNumberResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { OrderInvoiceNotificationRequest } from "./requests/OrderInvoiceNotificationRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { OrderInvoiceNotificationResponse } from "./responses/OrderInvoiceNotificationResponse";
+import { SendTrackingNumberRequest } from "./requests/SendTrackingNumberRequest";
+import { SendTrackingNumberResponse } from "./responses/SendTrackingNumberResponse";
export class Invoice extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/oms/pvt/orders/{orderId}/invoice';
+ private static readonly BASE_PATH: string =
+ "/api/oms/pvt/orders/{orderId}/invoice";
/**
* Sends Order invoice notifications.
@@ -17,10 +18,16 @@ export class Invoice extends AbstractApi {
* @param {string} orderId
* @param {OrderInvoiceNotificationRequest} invoiceData
*/
- orderInvoiceNotification(orderId: string, invoiceData: OrderInvoiceNotificationRequest)
- : Promise> {
- const path = Invoice.BASE_PATH.replace('{orderId}', orderId);
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, invoiceData);
+ orderInvoiceNotification(
+ orderId: string,
+ invoiceData: OrderInvoiceNotificationRequest
+ ): Promise> {
+ const path = Invoice.BASE_PATH.replace("{orderId}", orderId);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ invoiceData
+ );
}
/**
@@ -29,10 +36,18 @@ export class Invoice extends AbstractApi {
* @param {string} invoiceNumber
* @param {SendTrackingNumberRequest} trackingData
*/
- sendTrackingNumber(orderId: string, invoiceNumber: string,
- trackingData: SendTrackingNumberRequest)
- : Promise> {
- const path = Invoice.BASE_PATH.replace('{orderId}', orderId).concat(`/${invoiceNumber}`);
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PATCH, trackingData);
+ sendTrackingNumber(
+ orderId: string,
+ invoiceNumber: string,
+ trackingData: SendTrackingNumberRequest
+ ): Promise> {
+ const path = Invoice.BASE_PATH.replace("{orderId}", orderId).concat(
+ `/${invoiceNumber}`
+ );
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PATCH,
+ trackingData
+ );
}
}
diff --git a/src/modules/OMS/apis/invoice/index.ts b/src/modules/OMS/apis/invoice/index.ts
index b5a4c36..cf9eadb 100644
--- a/src/modules/OMS/apis/invoice/index.ts
+++ b/src/modules/OMS/apis/invoice/index.ts
@@ -1 +1 @@
-export * from './Invoice';
+export * from "./Invoice";
diff --git a/src/modules/OMS/apis/order-hook/OrderHook.ts b/src/modules/OMS/apis/order-hook/OrderHook.ts
index e75bc34..655d89d 100644
--- a/src/modules/OMS/apis/order-hook/OrderHook.ts
+++ b/src/modules/OMS/apis/order-hook/OrderHook.ts
@@ -1,24 +1,31 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { CreateOrUpdateHookConfigurationRequest } from './requests/CreateOrUpdateHookConfigurationRequest';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { CreateOrUpdateHookConfigurationRequest } from "./requests/CreateOrUpdateHookConfigurationRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
export class OrderHook extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/orders/hook/config';
+ private static readonly BASE_PATH: string = "/api/orders/hook/config";
/**
* Configure filter rules to Order Hook
* @param {CreateOrUpdateHookConfigurationRequest} hookConfiguration
*/
- createOrUpdateHookConfiguration(hookConfiguration: CreateOrUpdateHookConfigurationRequest)
- : Promise {
- return this.vtexHttpClient
- .performRequest(OrderHook.BASE_PATH, this.HTTP_METHODS.POST, hookConfiguration);
+ createOrUpdateHookConfiguration(
+ hookConfiguration: CreateOrUpdateHookConfigurationRequest
+ ): Promise {
+ return this.vtexHttpClient.performRequest(
+ OrderHook.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ hookConfiguration
+ );
}
/**
* Deletes Hook configuration.
*/
deleteHookConfiguration(): Promise {
- return this.vtexHttpClient.performRequest(OrderHook.BASE_PATH, this.HTTP_METHODS.DELETE);
+ return this.vtexHttpClient.performRequest(
+ OrderHook.BASE_PATH,
+ this.HTTP_METHODS.DELETE
+ );
}
}
diff --git a/src/modules/OMS/apis/order-hook/index.ts b/src/modules/OMS/apis/order-hook/index.ts
index e80a7a8..d983c59 100644
--- a/src/modules/OMS/apis/order-hook/index.ts
+++ b/src/modules/OMS/apis/order-hook/index.ts
@@ -1 +1 @@
-export * from './OrderHook';
+export * from "./OrderHook";
diff --git a/src/modules/OMS/apis/orders/Orders.ts b/src/modules/OMS/apis/orders/Orders.ts
index 1adc949..e34cc55 100644
--- a/src/modules/OMS/apis/orders/Orders.ts
+++ b/src/modules/OMS/apis/orders/Orders.ts
@@ -1,14 +1,14 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { OrderChangeRequest } from './requests/OrderChangeRequest';
-import { OrderChangeResponse } from './responses/OrderChangeResponse';
-import { GetOrderResponse } from './responses/GetOrderResponse';
-import { ListOrdersResponse } from './responses/ListOrdersResponse';
-import { AddLogInOrderRequest } from './requests/AddLogInOrderRequest';
-import { ListOrderAttachmentResponse } from './responses/ListOrderAttachmentResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { OrderChangeRequest } from "./requests/OrderChangeRequest";
+import { OrderChangeResponse } from "./responses/OrderChangeResponse";
+import { GetOrderResponse } from "./responses/GetOrderResponse";
+import { ListOrdersResponse } from "./responses/ListOrdersResponse";
+import { AddLogInOrderRequest } from "./requests/AddLogInOrderRequest";
+import { ListOrderAttachmentResponse } from "./responses/ListOrderAttachmentResponse";
export class Orders extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/oms/pvt/orders';
+ private static readonly BASE_PATH: string = "/api/oms/pvt/orders";
/**
* Lists order details by searching through order ID.
@@ -53,10 +53,16 @@ export class Orders extends AbstractApi {
* @param {string} orderId
* @param {OrderChangeRequest} orderChange
*/
- registerChangeOnOrder(orderId: string, orderChange: OrderChangeRequest)
- : Promise> {
+ registerChangeOnOrder(
+ orderId: string,
+ orderChange: OrderChangeRequest
+ ): Promise> {
const path = `${Orders.BASE_PATH}/${orderId}/changes`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, orderChange);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ orderChange
+ );
}
/**
@@ -64,9 +70,16 @@ export class Orders extends AbstractApi {
* @param {string} orderId
* @param {AddLogInOrderRequest} log
*/
- addLogInOrder(orderId: string, log: AddLogInOrderRequest): Promise {
+ addLogInOrder(
+ orderId: string,
+ log: AddLogInOrderRequest
+ ): Promise {
const path = `${Orders.BASE_PATH}/${orderId}/interactions`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, log);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ log
+ );
}
/**
@@ -74,8 +87,10 @@ export class Orders extends AbstractApi {
* @param {string} orderId
* @param {string} attachmentName
*/
- listOrderAttachment(orderId: string, attachmentName: string)
- : Promise> {
+ listOrderAttachment(
+ orderId: string,
+ attachmentName: string
+ ): Promise> {
const path = `${Orders.BASE_PATH}/${orderId}/message-attachment?attachmentName=${attachmentName}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
diff --git a/src/modules/OMS/apis/orders/index.ts b/src/modules/OMS/apis/orders/index.ts
index 12f280e..7312f02 100644
--- a/src/modules/OMS/apis/orders/index.ts
+++ b/src/modules/OMS/apis/orders/index.ts
@@ -1 +1 @@
-export * from './Orders';
+export * from "./Orders";
diff --git a/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts b/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts
index ae2b3f3..79dfc8c 100644
--- a/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts
+++ b/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts
@@ -8,6 +8,6 @@ export interface OrderChangeRequest {
reason?: string;
discountValue?: number;
incrementValue?: number;
- itemsRemoved?: Array
- itemsAdded?: Array
+ itemsRemoved?: Array;
+ itemsAdded?: Array;
}
diff --git a/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts b/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts
index 961c2aa..42c3cc3 100644
--- a/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts
+++ b/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts
@@ -142,7 +142,7 @@ interface ShippingData {
address?: Address;
logisticsInfo?: Array;
trackingHints?: string;
- selectedAddresses?: Array
+ selectedAddresses?: Array;
}
interface Transaction {
diff --git a/src/modules/OMS/apis/payment/Payment.ts b/src/modules/OMS/apis/payment/Payment.ts
index 615e662..b22a7ed 100644
--- a/src/modules/OMS/apis/payment/Payment.ts
+++ b/src/modules/OMS/apis/payment/Payment.ts
@@ -1,17 +1,21 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { RetrievePaymentTransactionResponse } from './responses/RetrievePaymentTransactionResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { RetrievePaymentTransactionResponse } from "./responses/RetrievePaymentTransactionResponse";
export class Payment extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/oms/pvt/orders/{orderId}'
+ private static readonly BASE_PATH: string = "/api/oms/pvt/orders/{orderId}";
/**
* Retrieve transaction details by order ID.
* @param {string} orderId
*/
- retrievePaymentTransaction(orderId: string)
- : Promise> {
- const path = `${Payment.BASE_PATH.replace('{orderId}', orderId)}/payment-transaction`;
+ retrievePaymentTransaction(
+ orderId: string
+ ): Promise> {
+ const path = `${Payment.BASE_PATH.replace(
+ "{orderId}",
+ orderId
+ )}/payment-transaction`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -20,8 +24,14 @@ export class Payment extends AbstractApi {
* @param {string} orderId
* @param {string} paymentId
*/
- sendPaymentNotification(orderId: string, paymentId: string): Promise {
- const path = `${Payment.BASE_PATH.replace('{orderId}', orderId)}/payments/${paymentId}/payment-notification`;
+ sendPaymentNotification(
+ orderId: string,
+ paymentId: string
+ ): Promise {
+ const path = `${Payment.BASE_PATH.replace(
+ "{orderId}",
+ orderId
+ )}/payments/${paymentId}/payment-notification`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST);
}
}
diff --git a/src/modules/OMS/apis/payment/index.ts b/src/modules/OMS/apis/payment/index.ts
index a07ed8e..04125a2 100644
--- a/src/modules/OMS/apis/payment/index.ts
+++ b/src/modules/OMS/apis/payment/index.ts
@@ -1 +1 @@
-export * from './Payment';
+export * from "./Payment";
diff --git a/src/modules/OMS/apis/tracking/Tracking.ts b/src/modules/OMS/apis/tracking/Tracking.ts
index 004bf7e..5c6fff3 100644
--- a/src/modules/OMS/apis/tracking/Tracking.ts
+++ b/src/modules/OMS/apis/tracking/Tracking.ts
@@ -1,7 +1,7 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { UpdateOrderTrackingStatusRequest } from './requests/UpdateOrderTrackingStatusRequest';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { UpdateOrderTrackingStatusResponse } from './responses/UpdateOrderTrackingStatusResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { UpdateOrderTrackingStatusRequest } from "./requests/UpdateOrderTrackingStatusRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { UpdateOrderTrackingStatusResponse } from "./responses/UpdateOrderTrackingStatusResponse";
export class Tracking extends AbstractApi {
/**
@@ -10,10 +10,16 @@ export class Tracking extends AbstractApi {
* @param {string} invoiceNumber
* @param {UpdateOrderTrackingStatusRequest} trackingData
*/
- updateOrderTrackingStatus(orderId: string, invoiceNumber: string,
- trackingData: UpdateOrderTrackingStatusRequest)
- : Promise> {
+ updateOrderTrackingStatus(
+ orderId: string,
+ invoiceNumber: string,
+ trackingData: UpdateOrderTrackingStatusRequest
+ ): Promise> {
const path = `/api/oms/pvt/orders/${orderId}/invoice/${invoiceNumber}/tracking`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, trackingData);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ trackingData
+ );
}
}
diff --git a/src/modules/OMS/apis/tracking/index.ts b/src/modules/OMS/apis/tracking/index.ts
index b1f6b21..5a77bfc 100644
--- a/src/modules/OMS/apis/tracking/index.ts
+++ b/src/modules/OMS/apis/tracking/index.ts
@@ -1 +1 @@
-export * from './Tracking';
+export * from "./Tracking";
diff --git a/src/modules/OMS/apis/user-orders/UserOrders.ts b/src/modules/OMS/apis/user-orders/UserOrders.ts
index 126e9e2..9f1431e 100644
--- a/src/modules/OMS/apis/user-orders/UserOrders.ts
+++ b/src/modules/OMS/apis/user-orders/UserOrders.ts
@@ -1,10 +1,10 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { RetrieveUserOrdersResponse } from './responses/RetrieveUserOrdersResponse';
-import { GetOrderResponse } from '../orders/responses/GetOrderResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { RetrieveUserOrdersResponse } from "./responses/RetrieveUserOrdersResponse";
+import { GetOrderResponse } from "../orders/responses/GetOrderResponse";
export class UserOrders extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/oms/user/orders';
+ private static readonly BASE_PATH: string = "/api/oms/user/orders";
/**
* Lists all orders from a given client, filtering by their email.
@@ -12,8 +12,11 @@ export class UserOrders extends AbstractApi {
* @param {number} page
* @param {number} perPage
*/
- retrieveUserOrders(clientEmail: string, page: number, perPage: number)
- : Promise> {
+ retrieveUserOrders(
+ clientEmail: string,
+ page: number,
+ perPage: number
+ ): Promise> {
const path = `${UserOrders.BASE_PATH}?clientEmail=${clientEmail}&page=${page}&per_page=${perPage}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -23,8 +26,10 @@ export class UserOrders extends AbstractApi {
* @param {string} orderId
* @param {string} clientEmail
*/
- retrieveUserOrderDetails(orderId: string, clientEmail: string)
- : Promise> {
+ retrieveUserOrderDetails(
+ orderId: string,
+ clientEmail: string
+ ): Promise> {
const path = `${UserOrders.BASE_PATH}/${orderId}?clientEmail=${clientEmail}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
diff --git a/src/modules/OMS/apis/user-orders/index.ts b/src/modules/OMS/apis/user-orders/index.ts
index 60fc401..91b433d 100644
--- a/src/modules/OMS/apis/user-orders/index.ts
+++ b/src/modules/OMS/apis/user-orders/index.ts
@@ -1 +1 @@
-export * from './UserOrders';
+export * from "./UserOrders";
diff --git a/src/modules/OMS/index.ts b/src/modules/OMS/index.ts
index a09cadf..b4630c2 100644
--- a/src/modules/OMS/index.ts
+++ b/src/modules/OMS/index.ts
@@ -1 +1 @@
-export * from './OMS';
+export * from "./OMS";
diff --git a/src/modules/catalog/Catalog.ts b/src/modules/catalog/Catalog.ts
new file mode 100644
index 0000000..b3a4dec
--- /dev/null
+++ b/src/modules/catalog/Catalog.ts
@@ -0,0 +1,97 @@
+import { VtexHttpClient } from "../../utils/VtexHttpClient";
+import { SKUService } from "./apis/sku-service/SKUService";
+import { CategoryAndBrand } from "./apis/category-and-brand";
+import { Attachment } from "./apis/attachment";
+import { Product } from "./apis/product";
+import { TradePolicy } from "./apis/trade-policy";
+import { SKU } from "./apis/sku";
+import { Specification } from "./apis/specification";
+import { Collection } from "./apis/collection";
+import { Subcollection } from "./apis/subcollection";
+import { Supplier } from "./apis/supplier";
+import { SalesChannel } from "./apis/sales-channel";
+import { Seller } from "./apis/seller";
+import { Others } from "./apis/others";
+
+export class Catalog {
+ /**
+ * SKU Service API
+ */
+ readonly skuService: SKUService;
+
+ /**
+ * Category and Brand API
+ */
+ readonly categoryAndBrand: CategoryAndBrand;
+
+ /**
+ * Attachment API
+ */
+ readonly attachment: Attachment;
+
+ /**
+ * Product API
+ */
+ readonly product: Product;
+
+ /**
+ * Trade Policy API
+ */
+ readonly tradePolicy: TradePolicy;
+
+ /**
+ * SKU API
+ */
+ readonly sku: SKU;
+
+ /**
+ * Specification API
+ */
+ readonly specification: Specification;
+
+ /**
+ * Collection API
+ */
+ readonly collection: Collection;
+
+ /**
+ * Subcollection API
+ */
+ readonly subcollection: Subcollection;
+
+ /**
+ * Supplier API
+ */
+ readonly supplier: Supplier;
+
+ /**
+ * Sales Channel API
+ */
+ readonly salesChannel: SalesChannel;
+
+ /**
+ * Seller Channel API
+ */
+ readonly seller: Seller;
+
+ /**
+ * Other Catalog API's
+ */
+ readonly others: Others;
+
+ constructor(vtexHttpClient: VtexHttpClient) {
+ this.skuService = new SKUService(vtexHttpClient);
+ this.categoryAndBrand = new CategoryAndBrand(vtexHttpClient);
+ this.attachment = new Attachment(vtexHttpClient);
+ this.product = new Product(vtexHttpClient);
+ this.tradePolicy = new TradePolicy(vtexHttpClient);
+ this.sku = new SKU(vtexHttpClient);
+ this.specification = new Specification(vtexHttpClient);
+ this.collection = new Collection(vtexHttpClient);
+ this.subcollection = new Subcollection(vtexHttpClient);
+ this.supplier = new Supplier(vtexHttpClient);
+ this.salesChannel = new SalesChannel(vtexHttpClient);
+ this.seller = new Seller(vtexHttpClient);
+ this.others = new Others(vtexHttpClient);
+ }
+}
diff --git a/src/modules/catalog/apis/attachment/Attachment.ts b/src/modules/catalog/apis/attachment/Attachment.ts
new file mode 100644
index 0000000..27a4397
--- /dev/null
+++ b/src/modules/catalog/apis/attachment/Attachment.ts
@@ -0,0 +1,59 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetAttachmentResponse } from "./responses/GetAttachmentResponse";
+import { UpdateAttachmentRequest } from "./requests/UpdateAttachmentRequest";
+
+export class Attachment extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog/pvt/attachment";
+
+ /**
+ * Gets information about a registered attachment
+ * @param {string} attachmentId
+ */
+ getAttachment(
+ attachmentId: string
+ ): Promise> {
+ const path = `${Attachment.BASE_PATH}/${attachmentId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates a previously existing SKU attachment with new information
+ * @param {string} attachmentId
+ * @param {UpdateAttachmentRequest} attachmentData
+ */
+ updateAttachment(
+ attachmentId: string,
+ attachmentData: UpdateAttachmentRequest
+ ): Promise> {
+ const path = `${Attachment.BASE_PATH}/${attachmentId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ attachmentData
+ );
+ }
+
+ /**
+ * Deletes a previously existing SKU attachment
+ * @param {string} attachmentId
+ */
+ deleteAttachment(attachmentId: string): Promise {
+ const path = `${Attachment.BASE_PATH}/${attachmentId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a new SKU attachment from scratch
+ * @param {UpdateAttachmentRequest} attachmentData
+ */
+ createAttachment(
+ attachmentData: UpdateAttachmentRequest
+ ): Promise> {
+ return this.vtexHttpClient.performRequest(
+ Attachment.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ attachmentData
+ );
+ }
+}
diff --git a/src/modules/catalog/apis/attachment/index.ts b/src/modules/catalog/apis/attachment/index.ts
new file mode 100644
index 0000000..fa320b2
--- /dev/null
+++ b/src/modules/catalog/apis/attachment/index.ts
@@ -0,0 +1 @@
+export * from "./Attachment";
diff --git a/src/modules/catalog/apis/attachment/requests/UpdateAttachmentRequest.ts b/src/modules/catalog/apis/attachment/requests/UpdateAttachmentRequest.ts
new file mode 100644
index 0000000..cd1b5b6
--- /dev/null
+++ b/src/modules/catalog/apis/attachment/requests/UpdateAttachmentRequest.ts
@@ -0,0 +1,9 @@
+export interface UpdateAttachmentRequest {
+ Name?: string;
+ IsActive?: boolean;
+ IsRequired?: boolean;
+ Domains?: Array;
+ FieldName?: string;
+ MaxCaracters?: string;
+ DomainValues?: string;
+}
diff --git a/src/modules/catalog/apis/attachment/responses/GetAttachmentResponse.ts b/src/modules/catalog/apis/attachment/responses/GetAttachmentResponse.ts
new file mode 100644
index 0000000..6fb69c8
--- /dev/null
+++ b/src/modules/catalog/apis/attachment/responses/GetAttachmentResponse.ts
@@ -0,0 +1,10 @@
+export interface GetAttachmentResponse {
+ Id?: number;
+ Name?: string;
+ IsActive?: boolean;
+ IsRequired?: boolean;
+ Domains?: Array;
+ FieldName?: string;
+ MaxCaracters?: string;
+ DomainValues?: string;
+}
diff --git a/src/modules/catalog/apis/category-and-brand/CategoryAndBrand.ts b/src/modules/catalog/apis/category-and-brand/CategoryAndBrand.ts
new file mode 100644
index 0000000..4f3bbd2
--- /dev/null
+++ b/src/modules/catalog/apis/category-and-brand/CategoryAndBrand.ts
@@ -0,0 +1,127 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetCategoryTreeResponseItem } from "./responses/GetCategoryTreeResponseItem";
+import { GetCategoryByIdResponse } from "./responses/GetCategoryByIdResponse";
+import { UpdateCategoryRequest } from "./requests/UpdateCategoryRequest";
+import { GetBrandResponse } from "./responses/GetBrandResponse";
+import { UpdateBrandRequest } from "./requests/UpdateBrandRequest";
+
+export class CategoryAndBrand extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog";
+
+ /**
+ * Retrieves the Category Tree of your store.
+ * Get all the category levels registered in the Catalog or define the level
+ * up to which you want to get.
+ * @param {number} categoryLevels
+ */
+ getCategoryTree(
+ categoryLevels?: number
+ ): Promise>> {
+ const path = `${CategoryAndBrand.BASE_PATH}_system/pub/category/tree/${
+ categoryLevels || ""
+ }`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves general information about a Category
+ * @param {number} categoryId
+ */
+ getCategoryById(
+ categoryId: number
+ ): Promise> {
+ const path = `${CategoryAndBrand.BASE_PATH}/pvt/category/${categoryId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates a previously existing Category
+ * @param {number} categoryId
+ * @param {UpdateCategoryRequest} data
+ */
+ updateCategory(
+ categoryId: number,
+ data: UpdateCategoryRequest
+ ): Promise> {
+ const path = `${CategoryAndBrand.BASE_PATH}/pvt/category/${categoryId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ data
+ );
+ }
+
+ /**
+ * Creates a new Category from scratch
+ * @param {UpdateCategoryRequest} data
+ */
+ createCategory(
+ data: UpdateCategoryRequest
+ ): Promise> {
+ const path = `${CategoryAndBrand.BASE_PATH}/pvt/category`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ data
+ );
+ }
+
+ /**
+ * Retrieves all Brands registered in the store's Catalog.
+ */
+ getBrandList(): Promise>> {
+ const path = `${CategoryAndBrand.BASE_PATH}_system/pvt/brand/list`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves a specific Brand by its ID.
+ * @param {string} brandId
+ */
+ getBrand(brandId: string): Promise> {
+ const path = `${CategoryAndBrand.BASE_PATH}_system/pvt/brand/${brandId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates a previously existing Brand
+ * @param {string} brandId
+ * @param {UpdateBrandRequest} brandData
+ */
+ updateBrand(
+ brandId: string,
+ brandData: UpdateBrandRequest
+ ): Promise> {
+ const path = `${CategoryAndBrand.BASE_PATH}/pvt/brand/${brandId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ brandData
+ );
+ }
+
+ /**
+ * Deletes an existing Brand
+ * @param {string} brandId
+ */
+ deleteBrand(brandId: string): Promise {
+ const path = `${CategoryAndBrand.BASE_PATH}/pvt/brand/${brandId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a new Brand from scratch
+ * @param {UpdateBrandRequest} brandData
+ */
+ createBrand(
+ brandData: UpdateBrandRequest
+ ): Promise> {
+ const path = `${CategoryAndBrand.BASE_PATH}/pvt/brand`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ brandData
+ );
+ }
+}
diff --git a/src/modules/catalog/apis/category-and-brand/index.ts b/src/modules/catalog/apis/category-and-brand/index.ts
new file mode 100644
index 0000000..f4af1aa
--- /dev/null
+++ b/src/modules/catalog/apis/category-and-brand/index.ts
@@ -0,0 +1 @@
+export * from "./CategoryAndBrand";
diff --git a/src/modules/catalog/apis/category-and-brand/requests/UpdateBrandRequest.ts b/src/modules/catalog/apis/category-and-brand/requests/UpdateBrandRequest.ts
new file mode 100644
index 0000000..0a61fd6
--- /dev/null
+++ b/src/modules/catalog/apis/category-and-brand/requests/UpdateBrandRequest.ts
@@ -0,0 +1,13 @@
+export interface UpdateBrandRequest {
+ Id?: number;
+ Name?: string;
+ Text?: string;
+ Keywords?: string;
+ SiteTitle?: string;
+ Active?: boolean;
+ MenuHome?: boolean;
+ AdWordsRemarketingCode?: string;
+ LomadeeCampaignCode?: string;
+ Score?: number;
+ LinkId?: string;
+}
diff --git a/src/modules/catalog/apis/category-and-brand/requests/UpdateCategoryRequest.ts b/src/modules/catalog/apis/category-and-brand/requests/UpdateCategoryRequest.ts
new file mode 100644
index 0000000..34e0cfa
--- /dev/null
+++ b/src/modules/catalog/apis/category-and-brand/requests/UpdateCategoryRequest.ts
@@ -0,0 +1,16 @@
+export interface UpdateCategoryRequest {
+ Name?: string;
+ FatherCategoryId?: number;
+ Title?: string;
+ Description?: string;
+ Keywords?: string;
+ IsActive?: boolean;
+ LomadeeCampaignCode?: string;
+ AdWordsRemarketingCode?: string;
+ ShowInStoreFront?: boolean;
+ ShowBrandFilter?: boolean;
+ ActiveStoreFrontLink?: boolean;
+ GlobalCategoryId?: number;
+ StockKeepingUnitSelectionMode?: string;
+ Score?: number;
+}
diff --git a/src/modules/catalog/apis/category-and-brand/responses/GetBrandResponse.ts b/src/modules/catalog/apis/category-and-brand/responses/GetBrandResponse.ts
new file mode 100644
index 0000000..d227f93
--- /dev/null
+++ b/src/modules/catalog/apis/category-and-brand/responses/GetBrandResponse.ts
@@ -0,0 +1,8 @@
+export interface GetBrandResponse {
+ id?: number;
+ name?: string;
+ imageUrl?: string;
+ isActive?: boolean;
+ title?: string;
+ metaTagDescription?: string;
+}
diff --git a/src/modules/catalog/apis/category-and-brand/responses/GetCategoryByIdResponse.ts b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryByIdResponse.ts
new file mode 100644
index 0000000..58de56b
--- /dev/null
+++ b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryByIdResponse.ts
@@ -0,0 +1,19 @@
+export interface GetCategoryByIdResponse {
+ Id?: number;
+ Name?: string;
+ FatherCategoryId?: number;
+ Title?: string;
+ Description?: string;
+ Keywords?: string;
+ IsActive?: boolean;
+ LomadeeCampaignCode?: string;
+ AdWordsRemarketingCode?: string;
+ ShowInStoreFront?: boolean;
+ ShowBrandFilter?: boolean;
+ ActiveStoreFrontLink?: boolean;
+ GlobalCategoryId?: number;
+ StockKeepingUnitSelectionMode?: string;
+ Score?: number;
+ LinkId?: string;
+ HasChildren?: boolean;
+}
diff --git a/src/modules/catalog/apis/category-and-brand/responses/GetCategoryTreeResponseItem.ts b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryTreeResponseItem.ts
new file mode 100644
index 0000000..7f2d4b5
--- /dev/null
+++ b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryTreeResponseItem.ts
@@ -0,0 +1,9 @@
+export interface GetCategoryTreeResponseItem {
+ id?: number;
+ name?: string;
+ hasChildren?: boolean;
+ url?: string;
+ children?: Array;
+ Title?: string;
+ MetaTagDescription?: string;
+}
diff --git a/src/modules/catalog/apis/collection/Collection.ts b/src/modules/catalog/apis/collection/Collection.ts
new file mode 100644
index 0000000..721bab8
--- /dev/null
+++ b/src/modules/catalog/apis/collection/Collection.ts
@@ -0,0 +1,59 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetCollectionResponse } from "./responses/GetCollectionResponse";
+import { UpdateCollectionRequest } from "./requests/UpdateCollectionRequest";
+
+export class Collection extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog/pvt/collection";
+
+ /**
+ * Gets general information of a Collection
+ * @param {number} collectionId
+ */
+ getCollection(
+ collectionId: number
+ ): Promise> {
+ const path = `${Collection.BASE_PATH}/${collectionId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates a previously Collection
+ * @param {number} collectionId
+ * @param {UpdateCollectionRequest} collectionData
+ */
+ updateCollection(
+ collectionId: number,
+ collectionData: UpdateCollectionRequest
+ ): Promise> {
+ const path = `${Collection.BASE_PATH}/${collectionId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ collectionData
+ );
+ }
+
+ /**
+ * Deletes a previously existing Collection
+ * @param {number} collectionId
+ */
+ deleteCollection(collectionId: number): Promise {
+ const path = `${Collection.BASE_PATH}/${collectionId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a new Collection
+ * @param {UpdateCollectionRequest} collectionData
+ */
+ createCollection(
+ collectionData: UpdateCollectionRequest
+ ): Promise> {
+ return this.vtexHttpClient.performRequest(
+ Collection.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ collectionData
+ );
+ }
+}
diff --git a/src/modules/catalog/apis/collection/index.ts b/src/modules/catalog/apis/collection/index.ts
new file mode 100644
index 0000000..cbb3f0f
--- /dev/null
+++ b/src/modules/catalog/apis/collection/index.ts
@@ -0,0 +1 @@
+export * from "./Collection";
diff --git a/src/modules/catalog/apis/collection/requests/UpdateCollectionRequest.ts b/src/modules/catalog/apis/collection/requests/UpdateCollectionRequest.ts
new file mode 100644
index 0000000..251547c
--- /dev/null
+++ b/src/modules/catalog/apis/collection/requests/UpdateCollectionRequest.ts
@@ -0,0 +1,7 @@
+export interface UpdateCollectionRequest {
+ Name?: string;
+ Searchable?: boolean;
+ Highlight?: boolean;
+ DateFrom?: string;
+ DateTo?: string;
+}
diff --git a/src/modules/catalog/apis/collection/responses/GetCollectionResponse.ts b/src/modules/catalog/apis/collection/responses/GetCollectionResponse.ts
new file mode 100644
index 0000000..564f708
--- /dev/null
+++ b/src/modules/catalog/apis/collection/responses/GetCollectionResponse.ts
@@ -0,0 +1,7 @@
+import { UpdateCollectionRequest } from "../requests/UpdateCollectionRequest";
+
+export interface GetCollectionResponse extends UpdateCollectionRequest {
+ Id?: number;
+ Description?: string;
+ TotalProducts?: number;
+}
diff --git a/src/modules/catalog/apis/others/Others.ts b/src/modules/catalog/apis/others/Others.ts
new file mode 100644
index 0000000..b099b9a
--- /dev/null
+++ b/src/modules/catalog/apis/others/Others.ts
@@ -0,0 +1,24 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+
+export class Others extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog_system/pvt";
+
+ /**
+ * Notify a change in SKU Seller to VTEX
+ * @param {string} stockKeepingUnitId
+ */
+ changeNotification(stockKeepingUnitId: string): Promise {
+ const path = `${Others.BASE_PATH}/skuseller/changenotification/${stockKeepingUnitId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieve details of Product Indexed Info
+ * @param {string} productId
+ */
+ getIndexedInfo(productId: string): Promise {
+ const path = `${Others.BASE_PATH}products/GetIndexedInfo/${productId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+}
diff --git a/src/modules/catalog/apis/others/index.ts b/src/modules/catalog/apis/others/index.ts
new file mode 100644
index 0000000..b283743
--- /dev/null
+++ b/src/modules/catalog/apis/others/index.ts
@@ -0,0 +1 @@
+export * from "./Others";
diff --git a/src/modules/catalog/apis/product/Product.ts b/src/modules/catalog/apis/product/Product.ts
new file mode 100644
index 0000000..e304438
--- /dev/null
+++ b/src/modules/catalog/apis/product/Product.ts
@@ -0,0 +1,197 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetProductByIdResponse } from "./responses/GetProductByIdResponse";
+import { UpdateProductRequest } from "./requests/UpdateProductRequest";
+import { GetProductVariationsResponse } from "./responses/GetProductVariationsResponse";
+import { GetProductSpecificationResponseItem } from "./responses/GetProductSpecificationResponseItem";
+import { CreateProductSpecificationRequest } from "./requests/CreateProductSpecificationRequest";
+import { CreateProductSpecificationResponse } from "./responses/CreateProductSpecificationResponse";
+import { CreateSimilarProductCategoryResponse } from "./responses/CreateSimilarProductCategoryResponse";
+
+export class Product extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog";
+
+ /**
+ * Retrieves the IDs of all products and SKUs from a specific category by this category's ID.
+ * @param {number} categoryId
+ * @param {number} from
+ * @param {number} to
+ */
+ getProductAndSkuIds(
+ categoryId: number,
+ from: number,
+ to: number
+ ): Promise {
+ const path = `${Product.BASE_PATH}_system/pvt/products/GetProductAndSkuIds?categoryId=${categoryId}&_from=${from}&_to=${to}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves a specific product by its ID.
+ * @param {string} productId
+ */
+ getProductById(
+ productId: string
+ ): Promise> {
+ const path = `${Product.BASE_PATH}/pvt/product/${productId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates an existent Product
+ * @param {string} productId
+ * @param {UpdateProductRequest} productData
+ */
+ updateProduct(
+ productId: string,
+ productData: UpdateProductRequest
+ ): Promise> {
+ const path = `${Product.BASE_PATH}/pvt/product/${productId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ productData
+ );
+ }
+
+ /**
+ * Retrieves a specific product by its Reference ID.
+ * @param {string} refId
+ */
+ getProductByRefId(
+ refId: string
+ ): Promise> {
+ const path = `${Product.BASE_PATH}_system/pvt/products/productgetbyrefid/${refId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves data about the product and all SKUs related to it by the product's ID.
+ * @param {string} productId
+ */
+ getProductVariations(
+ productId: string
+ ): Promise> {
+ const path = `${Product.BASE_PATH}_system/pub/products/variations/${productId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves the review rate of a product by this product's ID.
+ * @param {string} productId
+ */
+ getProductReviewDate(productId: string): Promise {
+ const path = `/api/addon/pvt/review/GetProductRate/${productId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Creates a new Product from scratch
+ * @param {UpdateProductRequest} productData
+ */
+ createProduct(
+ productData: UpdateProductRequest
+ ): Promise> {
+ const path = `${Product.BASE_PATH}/pvt/product`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ productData
+ );
+ }
+
+ /**
+ * Retrieves all specifications of a product by the product's ID.
+ * @param {string} productId
+ */
+ getProductSpecification(
+ productId: string
+ ): Promise>> {
+ const path = `${Product.BASE_PATH}_system/pvt/products/${productId}/specification`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates the value of a product specification by the product's ID.
+ * The ID or name can be used to identify what product specification will be updated.
+ * Specification fields must be previously created in your Catalog.
+ * @param {string} productId
+ * @param {Array} productSpecificationData
+ */
+ updateProductSpecification(
+ productId: string,
+ productSpecificationData: Array
+ ): Promise>> {
+ const path = `${Product.BASE_PATH}_system/pvt/products/${productId}/specification`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ productSpecificationData
+ );
+ }
+
+ /**
+ * Creates a new Product Specification based on a previously defined Field
+ * @param {string} productId
+ * @param {CreateProductSpecificationRequest} productSpecificationData
+ */
+ createProductSpecification(
+ productId: string,
+ productSpecificationData: CreateProductSpecificationRequest
+ ): Promise> {
+ const path = `${Product.BASE_PATH}/pvt/product/${productId}/specification`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ productSpecificationData
+ );
+ }
+
+ /**
+ * Deletes all Product Specifications
+ * @param {string} productId
+ */
+ deleteAllProductSpecification(productId: string): Promise {
+ const path = `${Product.BASE_PATH}/pvt/product/${productId}/specification`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Deletes a specific Product Specification
+ * @param {string} productId
+ * @param {string} specificationId
+ */
+ deleteProductSpecification(
+ productId: string,
+ specificationId: string
+ ): Promise {
+ const path = `${Product.BASE_PATH}/pvt/product/${productId}/specification/${specificationId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a Similar Category to a Product
+ * @param {string} productId
+ * @param {string} categoryId
+ */
+ createSimilarProductCategory(
+ productId: string,
+ categoryId: string
+ ): Promise> {
+ const path = `${Product.BASE_PATH}/pvt/product/${productId}/similarcategory/${categoryId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST);
+ }
+
+ /**
+ * Deletes a Similar Category from a Product
+ * @param {string} productId
+ * @param {string} categoryId
+ */
+ deleteSimilarProductCategory(
+ productId: string,
+ categoryId: string
+ ): Promise {
+ const path = `${Product.BASE_PATH}/pvt/product/${productId}/similarcategory/${categoryId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+}
diff --git a/src/modules/catalog/apis/product/index.ts b/src/modules/catalog/apis/product/index.ts
new file mode 100644
index 0000000..b405045
--- /dev/null
+++ b/src/modules/catalog/apis/product/index.ts
@@ -0,0 +1 @@
+export * from "./Product";
diff --git a/src/modules/catalog/apis/product/requests/CreateProductSpecificationRequest.ts b/src/modules/catalog/apis/product/requests/CreateProductSpecificationRequest.ts
new file mode 100644
index 0000000..b1398c1
--- /dev/null
+++ b/src/modules/catalog/apis/product/requests/CreateProductSpecificationRequest.ts
@@ -0,0 +1,5 @@
+export interface CreateProductSpecificationRequest {
+ FieldId?: number;
+ FieldValueId?: number;
+ Text?: string;
+}
diff --git a/src/modules/catalog/apis/product/requests/UpdateProductRequest.ts b/src/modules/catalog/apis/product/requests/UpdateProductRequest.ts
new file mode 100644
index 0000000..5960125
--- /dev/null
+++ b/src/modules/catalog/apis/product/requests/UpdateProductRequest.ts
@@ -0,0 +1,22 @@
+export interface UpdateProductRequest {
+ Name?: string;
+ DepartmentId?: number;
+ CategoryId?: number;
+ BrandId?: number;
+ LinkId?: string;
+ RefId?: string;
+ IsVisible?: boolean;
+ Description?: string;
+ DescriptionShort?: string;
+ ReleaseDate?: string;
+ KeyWords?: string;
+ Title?: string;
+ IsActive?: boolean;
+ TaxCode?: string;
+ MetaTagDescription?: string;
+ SupplierId?: number;
+ ShowWithoutStock?: boolean;
+ ListStoreId?: Array;
+ AdWordsRemarketingCode?: string;
+ LomadeeCampaignCode?: string;
+}
diff --git a/src/modules/catalog/apis/product/responses/CreateProductSpecificationResponse.ts b/src/modules/catalog/apis/product/responses/CreateProductSpecificationResponse.ts
new file mode 100644
index 0000000..ecfd7b0
--- /dev/null
+++ b/src/modules/catalog/apis/product/responses/CreateProductSpecificationResponse.ts
@@ -0,0 +1,6 @@
+export interface CreateProductSpecificationResponse {
+ Id?: number;
+ FieldId?: number;
+ FieldValueId?: number;
+ Text?: string;
+}
diff --git a/src/modules/catalog/apis/product/responses/CreateSimilarProductCategoryResponse.ts b/src/modules/catalog/apis/product/responses/CreateSimilarProductCategoryResponse.ts
new file mode 100644
index 0000000..4b27f52
--- /dev/null
+++ b/src/modules/catalog/apis/product/responses/CreateSimilarProductCategoryResponse.ts
@@ -0,0 +1,4 @@
+export interface CreateSimilarProductCategoryResponse {
+ ProductId?: number;
+ StoreId?: number;
+}
diff --git a/src/modules/catalog/apis/product/responses/GetProductByIdResponse.ts b/src/modules/catalog/apis/product/responses/GetProductByIdResponse.ts
new file mode 100644
index 0000000..5626832
--- /dev/null
+++ b/src/modules/catalog/apis/product/responses/GetProductByIdResponse.ts
@@ -0,0 +1,23 @@
+export interface GetProductByIdResponse {
+ Id?: number;
+ Name?: string;
+ DepartmentId?: number;
+ CategoryId?: number;
+ BrandId?: number;
+ LinkId?: string;
+ RefId?: string;
+ IsVisible?: boolean;
+ Description?: string;
+ DescriptionShort?: string;
+ ReleaseDate?: string;
+ KeyWords?: string;
+ Title?: string;
+ IsActive?: boolean;
+ TaxCode?: string;
+ MetaTagDescription?: string;
+ SupplierId?: number;
+ ShowWithoutStock?: boolean;
+ ListStoreId?: Array;
+ AdWordsRemarketingCode?: string;
+ LomadeeCampaignCode?: string;
+}
diff --git a/src/modules/catalog/apis/product/responses/GetProductSpecificationResponseItem.ts b/src/modules/catalog/apis/product/responses/GetProductSpecificationResponseItem.ts
new file mode 100644
index 0000000..826f828
--- /dev/null
+++ b/src/modules/catalog/apis/product/responses/GetProductSpecificationResponseItem.ts
@@ -0,0 +1,5 @@
+export interface GetProductSpecificationResponseItem {
+ Value?: Array;
+ Id?: number;
+ Name?: number;
+}
diff --git a/src/modules/catalog/apis/product/responses/GetProductVariationsResponse.ts b/src/modules/catalog/apis/product/responses/GetProductVariationsResponse.ts
new file mode 100644
index 0000000..f88a57c
--- /dev/null
+++ b/src/modules/catalog/apis/product/responses/GetProductVariationsResponse.ts
@@ -0,0 +1,43 @@
+interface Measures {
+ cubicweight?: number;
+ height?: number;
+ length?: number;
+ weight?: number;
+ width?: number;
+}
+
+interface Sku {
+ sku?: number;
+ skuname?: string;
+ dimensions?: any;
+ available?: boolean;
+ availablequantity?: number;
+ cacheVersionUsedToCallCheckout?: string;
+ listPriceFormated?: string;
+ listPrice?: number;
+ taxFormated?: string;
+ taxAsInt?: number;
+ bestPriceFormated?: string;
+ bestPrice?: number;
+ installments?: number;
+ installmentsValue?: number;
+ installmentsInsterestRate?: number;
+ image?: string;
+ sellerId?: string;
+ seller?: string;
+ measures?: Measures;
+ unitMultiplier?: number;
+ rewardValue?: number;
+}
+
+export interface GetProductVariationsResponse {
+ productId?: number;
+ name?: string;
+ salesChannel?: number;
+ available?: boolean;
+ displayMode?: number;
+ dimensions?: string;
+ dimensionsInputType?: string;
+ dimensionsMap?: boolean;
+ skus?: Array;
+}
diff --git a/src/modules/catalog/apis/sales-channel/SalesChannel.ts b/src/modules/catalog/apis/sales-channel/SalesChannel.ts
new file mode 100644
index 0000000..e445e97
--- /dev/null
+++ b/src/modules/catalog/apis/sales-channel/SalesChannel.ts
@@ -0,0 +1,28 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetSalesChannelListResponseItem } from "./responses/GetSalesChannelListResponseItem";
+
+export class SalesChannel extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog_system";
+
+ /**
+ * Retrieves a list with details about the store's sales channels.
+ */
+ getSalesChannelList(): Promise<
+ VtexHttpResponse>
+ > {
+ const path = `${SalesChannel.BASE_PATH}/pvt/saleschannel/list`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves a specific sales channel by its ID.
+ * @param {string} salesChannelId
+ */
+ getSalesChannelById(
+ salesChannelId: string
+ ): Promise> {
+ const path = `${SalesChannel.BASE_PATH}/pub/saleschannel/${salesChannelId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+}
diff --git a/src/modules/catalog/apis/sales-channel/index.ts b/src/modules/catalog/apis/sales-channel/index.ts
new file mode 100644
index 0000000..2c59417
--- /dev/null
+++ b/src/modules/catalog/apis/sales-channel/index.ts
@@ -0,0 +1 @@
+export * from "./SalesChannel";
diff --git a/src/modules/catalog/apis/sales-channel/responses/GetSalesChannelListResponseItem.ts b/src/modules/catalog/apis/sales-channel/responses/GetSalesChannelListResponseItem.ts
new file mode 100644
index 0000000..5fd816b
--- /dev/null
+++ b/src/modules/catalog/apis/sales-channel/responses/GetSalesChannelListResponseItem.ts
@@ -0,0 +1,24 @@
+interface CurrencyFormatInfo {
+ CurrencyDecimalDigits?: number;
+ CurrencyDecimalSeparator?: string;
+ CurrencyGroupSeparator?: string;
+ CurrencyGroupSize?: string;
+ StartsWithCurrencySymbol?: boolean;
+}
+
+export interface GetSalesChannelListResponseItem {
+ Id?: number;
+ Name?: string;
+ IsActive?: boolean;
+ ProductClusterId?: number;
+ CountryCode?: string;
+ CultureInfo?: string;
+ TimeZone?: string;
+ CurrencyCode?: string;
+ CurrencySymbol?: string;
+ CurrencyLocale?: number;
+ CurrencyFormatInfo?: CurrencyFormatInfo;
+ Origin?: string;
+ Position?: number;
+ ConditionRule?: number;
+}
diff --git a/src/modules/catalog/apis/seller/Seller.ts b/src/modules/catalog/apis/seller/Seller.ts
new file mode 100644
index 0000000..94c5aca
--- /dev/null
+++ b/src/modules/catalog/apis/seller/Seller.ts
@@ -0,0 +1,89 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetSellerByIdResponse } from "./responses/GetSellerByIdResponse";
+
+export class Seller extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog_system/pvt";
+
+ /**
+ * Retrieves the seller's details by its ID.
+ * @param {string} sellerId
+ */
+ getSellerById(
+ sellerId: string
+ ): Promise> {
+ const path = `${Seller.BASE_PATH}/seller/${sellerId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Creates a new seller.
+ * @param {string} sellerId
+ * @param {CreateSellerRequest} sellerData
+ */
+ createSeller(
+ sellerId: string,
+ sellerData: GetSellerByIdResponse
+ ): Promise {
+ const path = `${Seller.BASE_PATH}/seller/${sellerId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ sellerData
+ );
+ }
+
+ /**
+ * Updates a seller.
+ * @param {string} sellerId
+ * @param {CreateSellerRequest} sellerData
+ */
+ updateSeller(
+ sellerId: string,
+ sellerData: GetSellerByIdResponse
+ ): Promise {
+ const path = `${Seller.BASE_PATH}/seller/${sellerId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ sellerData
+ );
+ }
+
+ /**
+ * Retrieves the seller's details by its ID.
+ * @param {string} params Example: sc=1&sellerType=1&isBetterScope=false
+ */
+ getSellerList(
+ params?: string
+ ): Promise>> {
+ const path = `${Seller.BASE_PATH}/seller/list?${params || ""}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves the details of a seller's SKU by its ID.
+ * @param {string} sellerId
+ * @param {string} sellerSkuId
+ */
+ getSKUSeller(
+ sellerId: string,
+ sellerSkuId: string
+ ): Promise {
+ const path = `${Seller.BASE_PATH}/skuseller/${sellerId}/${sellerSkuId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Remove the Seller SKU binding
+ * @param {string} sellerId
+ * @param {string} sellerSkuId
+ */
+ deleteSKUSellerAssociation(
+ sellerId: string,
+ sellerSkuId: string
+ ): Promise {
+ const path = `${Seller.BASE_PATH}/skuseller/${sellerId}/${sellerSkuId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+}
diff --git a/src/modules/catalog/apis/seller/index.ts b/src/modules/catalog/apis/seller/index.ts
new file mode 100644
index 0000000..49e2d1a
--- /dev/null
+++ b/src/modules/catalog/apis/seller/index.ts
@@ -0,0 +1 @@
+export * from "./Seller";
diff --git a/src/modules/catalog/apis/seller/responses/GetSKUSellerResponse.ts b/src/modules/catalog/apis/seller/responses/GetSKUSellerResponse.ts
new file mode 100644
index 0000000..2b414b7
--- /dev/null
+++ b/src/modules/catalog/apis/seller/responses/GetSKUSellerResponse.ts
@@ -0,0 +1,11 @@
+export interface GetSKUSellerResponse {
+ IsPersisted?: boolean;
+ IsRemoved?: boolean;
+ SkuSellerId?: number;
+ SellerId?: string;
+ StockKeepingUnitId?: number;
+ SellerStockKeepingUnitId?: string;
+ IsActive?: boolean;
+ UpdateDate?: string;
+ RequestedUpdateDate?: string;
+}
diff --git a/src/modules/catalog/apis/seller/responses/GetSellerByIdResponse.ts b/src/modules/catalog/apis/seller/responses/GetSellerByIdResponse.ts
new file mode 100644
index 0000000..665098c
--- /dev/null
+++ b/src/modules/catalog/apis/seller/responses/GetSellerByIdResponse.ts
@@ -0,0 +1,26 @@
+export interface GetSellerByIdResponse {
+ SellerId?: number;
+ Name?: string;
+ Email?: string;
+ Description?: string;
+ ExchangeReturnPolicy?: string;
+ DeliveryPolicy?: string;
+ UseHybridPaymentOptions?: boolean;
+ UserName?: string;
+ Password?: string;
+ SecutityPrivacyPolicy?: string;
+ CNPJ?: string;
+ CSCIdentification?: string;
+ ArchiveId?: number;
+ UrlLogo?: string;
+ ProductCommissionPercentage?: number;
+ FreightCommissionPercentage?: number;
+ CategoryCommissionPercentage?: number;
+ FulfillmentEndpoint?: string;
+ CatalogSystemEndpoint?: string;
+ IsActive?: boolean;
+ FulfillmentSellerId?: string;
+ SellerType?: number;
+ IsBetterScope?: boolean;
+ Category?: string;
+}
diff --git a/src/modules/catalog/apis/sku-service/SKUService.ts b/src/modules/catalog/apis/sku-service/SKUService.ts
new file mode 100644
index 0000000..964f54f
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/SKUService.ts
@@ -0,0 +1,187 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { UpdateSKUServiceRequest } from "./requests/UpdateSKUServiceRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { UpdateSKUServiceResponse } from "./responses/UpdateSKUServiceResponse";
+import { AssociateSKUServiceRequest } from "./requests/AssociateSKUServiceRequest";
+import { AssociateSKUServiceResponse } from "./responses/AssociateSKUServiceResponse";
+import { AssociateSKUServiceAttachmentRequest } from "./requests/AssociateSKUServiceAttachmentRequest";
+import { AssociateSKUServiceAttachmentResponse } from "./responses/AssociateSKUServiceAttachmentResponse";
+import { UpdateSKUServiceValueRequest } from "./requests/UpdateSKUServiceValueRequest";
+import { UpdateSKUServiceValueResponse } from "./responses/UpdateSKUServiceValueResponse";
+import { UpdateSKUServiceTypeRequest } from "./requests/UpdateSKUServiceTypeRequest";
+import { UpdateSKUServiceTypeResponse } from "./responses/UpdateSKUServiceTypeResponse";
+
+export class SKUService extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog/pvt/skuservice";
+
+ /**
+ * Updates an SKU Service from an SKU
+ * @param {number} skuServiceId
+ * @param {UpdateSKUServiceRequest} data
+ */
+ updateSKUService(
+ skuServiceId: number,
+ data: UpdateSKUServiceRequest
+ ): Promise> {
+ const path = `${SKUService.BASE_PATH}/${skuServiceId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ data
+ );
+ }
+
+ /**
+ * Dissociates an SKU Service from an SKU
+ * @param {number} skuServiceId
+ */
+ dissociateSKUService(skuServiceId: number): Promise {
+ const path = `${SKUService.BASE_PATH}/${skuServiceId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Associates an SKU Service to an SKU
+ * @param {AssociateSKUServiceRequest} data
+ */
+ associateSKUService(
+ data: AssociateSKUServiceRequest
+ ): Promise> {
+ return this.vtexHttpClient.performRequest(
+ SKUService.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ data
+ );
+ }
+
+ /**
+ * typeattachment/skuServiceTypeAttachmentId
+ * @param {number} skuServiceTypeAttachmentId
+ */
+ dissociateAttachmentFromSKUServiceType(
+ skuServiceTypeAttachmentId: number
+ ): Promise {
+ const path = `${SKUService.BASE_PATH}typeattachment/${skuServiceTypeAttachmentId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Associates an Attachment for an existing SKU Service Type
+ * @param {AssociateSKUServiceAttachmentRequest} data
+ */
+ associateSKUServiceAttachment(
+ data: AssociateSKUServiceAttachmentRequest
+ ): Promise> {
+ const path = `${SKUService.BASE_PATH}typeattachment`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ data
+ );
+ }
+
+ /**
+ * Dissociates an Attachment by its Attachment ID or SKU Service Type ID from an SKU Service Type
+ * @param {number} attachmentId
+ * @param {number} skuServiceTypeId
+ */
+ dissociateAttachmentByAttachmentIDorSKUServiceTypeID(
+ attachmentId?: number,
+ skuServiceTypeId?: number
+ ): Promise {
+ let params = "?";
+ if (attachmentId) {
+ params += `attachmentId=${attachmentId}`;
+ }
+ if (attachmentId && skuServiceTypeId) {
+ params += "&";
+ }
+ if (skuServiceTypeId) {
+ params += `skuServiceTypeId=${skuServiceTypeId}`;
+ }
+ const path = `${SKUService.BASE_PATH}typeattachment${params}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Updates an existing SKU Service Value
+ * @param {number} skuServiceValueId
+ * @param {UpdateSKUServiceValueRequest} data
+ */
+ updateSKUServiceValue(
+ skuServiceValueId: number,
+ data: UpdateSKUServiceValueRequest
+ ): Promise> {
+ const path = `${SKUService.BASE_PATH}value/${skuServiceValueId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ data
+ );
+ }
+
+ /**
+ * Deletes an existing SKU Service Value
+ * @param {number} skuServiceValueId
+ */
+ deleteSKUServiceValue(skuServiceValueId: number): Promise {
+ const path = `${SKUService.BASE_PATH}value/${skuServiceValueId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates an SKU Service Value for an existing SKU Service Type
+ * @param {UpdateSKUServiceValueRequest} data
+ */
+ createSKUServiceValue(
+ data: UpdateSKUServiceValueRequest
+ ): Promise> {
+ const path = `${SKUService.BASE_PATH}value`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ data
+ );
+ }
+
+ /**
+ * Updates an existing SKU Service Type
+ * @param {number} skuServiceTypeId
+ * @param {UpdateSKUServiceTypeRequest} data
+ */
+ updateSKUServiceType(
+ skuServiceTypeId: number,
+ data: UpdateSKUServiceTypeRequest
+ ): Promise> {
+ const path = `${SKUService.BASE_PATH}type/${skuServiceTypeId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ data
+ );
+ }
+
+ /**
+ * Deletes an existing SKU Service Type
+ * @param {number} skuServiceTypeId
+ */
+ deleteSKUServiceType(skuServiceTypeId: number): Promise {
+ const path = `${SKUService.BASE_PATH}type/${skuServiceTypeId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates an SKU Service Type from scratch
+ * @param {UpdateSKUServiceTypeRequest} data
+ */
+ createSKUServiceType(
+ data: UpdateSKUServiceTypeRequest
+ ): Promise> {
+ const path = `${SKUService.BASE_PATH}type`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ data
+ );
+ }
+}
diff --git a/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceAttachmentRequest.ts b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceAttachmentRequest.ts
new file mode 100644
index 0000000..708c966
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceAttachmentRequest.ts
@@ -0,0 +1,4 @@
+export interface AssociateSKUServiceAttachmentRequest {
+ AttachmentId?: number;
+ SkuServiceTypeId?: number;
+}
diff --git a/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceRequest.ts b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceRequest.ts
new file mode 100644
index 0000000..b4d1739
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceRequest.ts
@@ -0,0 +1,8 @@
+export interface AssociateSKUServiceRequest {
+ SkuServiceTypeId?: number;
+ SkuServiceValueId?: number;
+ SkuId?: number;
+ Name?: string;
+ Text?: string;
+ IsActive?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceRequest.ts b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceRequest.ts
new file mode 100644
index 0000000..70a3b42
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceRequest.ts
@@ -0,0 +1,8 @@
+export interface UpdateSKUServiceRequest {
+ SkuServiceTypeId?: number;
+ SkuServiceValueId?: number;
+ SkuId?: number;
+ Name?: string;
+ Text?: string;
+ IsActive?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceTypeRequest.ts b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceTypeRequest.ts
new file mode 100644
index 0000000..524ce9f
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceTypeRequest.ts
@@ -0,0 +1,9 @@
+export interface UpdateSKUServiceTypeRequest {
+ Name?: string;
+ IsActive?: boolean;
+ ShowOnCartFront?: boolean;
+ ShowOnAttachmentFront?: boolean;
+ ShowOnFileUpload?: boolean;
+ IsGiftCard?: boolean;
+ IsRequired?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceValueRequest.ts b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceValueRequest.ts
new file mode 100644
index 0000000..6a78b96
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceValueRequest.ts
@@ -0,0 +1,6 @@
+export interface UpdateSKUServiceValueRequest {
+ SkuServiceTypeId?: number;
+ Name?: string;
+ Value?: number;
+ Cost?: number;
+}
diff --git a/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceAttachmentResponse.ts b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceAttachmentResponse.ts
new file mode 100644
index 0000000..11bf0c4
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceAttachmentResponse.ts
@@ -0,0 +1,5 @@
+export interface AssociateSKUServiceAttachmentResponse {
+ Id?: number;
+ AttachmentId?: number;
+ SkuServiceTypeId?: number;
+}
diff --git a/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceResponse.ts b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceResponse.ts
new file mode 100644
index 0000000..d55d1a7
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceResponse.ts
@@ -0,0 +1,9 @@
+export interface AssociateSKUServiceResponse {
+ Id?: string;
+ SkuServiceTypeId?: number;
+ SkuServiceValueId?: number;
+ SkuId?: number;
+ Name?: string;
+ Text?: string;
+ IsActive?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceResponse.ts b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceResponse.ts
new file mode 100644
index 0000000..8825c30
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceResponse.ts
@@ -0,0 +1,9 @@
+export interface UpdateSKUServiceResponse {
+ Id?: number;
+ SkuServiceTypeId?: number;
+ SkuServiceValueId?: number;
+ SkuId?: number;
+ Name?: string;
+ Text?: string;
+ IsActive?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceTypeResponse.ts b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceTypeResponse.ts
new file mode 100644
index 0000000..b03e189
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceTypeResponse.ts
@@ -0,0 +1,10 @@
+export interface UpdateSKUServiceTypeResponse {
+ Id?: number;
+ Name?: string;
+ IsActive?: boolean;
+ ShowOnCartFront?: boolean;
+ ShowOnAttachmentFront?: boolean;
+ ShowOnFileUpload?: boolean;
+ IsGiftCard?: boolean;
+ IsRequired?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceValueResponse.ts b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceValueResponse.ts
new file mode 100644
index 0000000..3795b52
--- /dev/null
+++ b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceValueResponse.ts
@@ -0,0 +1,7 @@
+export interface UpdateSKUServiceValueResponse {
+ Id?: number;
+ SkuServiceTypeId?: number;
+ Name?: string;
+ Value?: number;
+ Cost?: number;
+}
diff --git a/src/modules/catalog/apis/sku/SKU.ts b/src/modules/catalog/apis/sku/SKU.ts
new file mode 100644
index 0000000..72f5fa5
--- /dev/null
+++ b/src/modules/catalog/apis/sku/SKU.ts
@@ -0,0 +1,476 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetSKUResponse } from "./responses/GetSKUResponse";
+import { GetSKUByRefIdResponse } from "./responses/GetSKUByRefIdResponse";
+import { CreateSKURequest } from "./requests/CreateSKURequest";
+import { CreateSKUResponse } from "./responses/CreateSKUResponse";
+import { GetSKUListByProductIdResponseItem } from "./responses/GetSKUListByProductIdResponseItem";
+import { GetSKUFileResponseItem } from "./responses/GetSKUFileResponseItem";
+import { CreateSKUFileRequest } from "./requests/CreateSKUFileRequest";
+import { GetSKUKitResponse } from "./responses/GetSKUKitResponse";
+import { CreateSKUKitRequest } from "./requests/CreateSKUKitRequest";
+import { GetSKUSpecificationsResponseItem } from "./responses/GetSKUSpecificationsResponseItem";
+import { CreateSKUSpecificationRequest } from "./requests/CreateSKUSpecificationRequest";
+import { UpdateSKURequest } from "./requests/UpdateSKURequest";
+import { AssociateSKUAttachmentRequest } from "./requests/AssociateSKUAttachmentRequest";
+import { AssociateSKUAttachmentResponse } from "./responses/AssociateSKUAttachmentResponse";
+import { CreateSKUComplementRequest } from "./requests/CreateSKUComplementRequest";
+import { CreateSKUComplementResponse } from "./responses/CreateSKUComplementResponse";
+import { AssociateAttachmentsToSKURequest } from "./requests/AssociateAttachmentsToSKURequest";
+import { AssociateAttachmentsToSKUResponse } from "./responses/AssociateAttachmentsToSKUResponse";
+
+export class SKU extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog";
+
+ /**
+ * Retrieves the IDs of all SKUs in the store. Presents the result with page size and pagination.
+ * @param {number} page
+ * @param {number} pageSize
+ */
+ listAllSKUIds(
+ page: number,
+ pageSize: number
+ ): Promise>> {
+ const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitids?page=${page}&pagesize=${pageSize}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves a specific SKU by its ID.
+ * @param {string} skuId
+ */
+ getSKU(skuId: string): Promise> {
+ const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitbyid/${skuId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves information about a specific SKU by its RefId
+ * @param {string} refId
+ */
+ getSKUByRefId(
+ refId: string
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit?refId=${refId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Creates a new SKU from scratch
+ * @param {CreateSKURequest} skuData
+ */
+ createSKU(
+ skuData: CreateSKURequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ skuData
+ );
+ }
+
+ /**
+ * Retrieves an SKU ID by the SKU's Reference ID.
+ * @param {string} refId
+ */
+ getSkuIdByRefId(refId: string): Promise {
+ const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitidbyrefid/${refId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves an SKU by its Alternate ID.
+ * @param {string} alternateId
+ */
+ getSKUByAlternateId(
+ alternateId: string
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitbyalternateId/${alternateId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves an SKU by its EAN ID.
+ * @param {string} ean
+ */
+ getSKUByEAN(ean: string): Promise> {
+ const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitbyean/${ean}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves the EAN of the SKU
+ * @param {string} skuId
+ */
+ getEANBySKUId(skuId: string): Promise>> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Deletes all EANs values of an SKU
+ * @param {string} skuId
+ */
+ deleteAllSkuEAN(skuId: string): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Retrieves a list with the SKUs related to a product by the product's ID.
+ * @param {string} productId
+ */
+ getSKUListByProductId(
+ productId: string
+ ): Promise>> {
+ const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitByProductId/${productId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Gets general information about all Files inside the SKU
+ * @param {string} skuId
+ */
+ getSKUFile(
+ skuId: string
+ ): Promise>> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Creates a new Image on an SKU based on its URL
+ * @param {string} skuId
+ * @param {CreateSKUFileRequest} skuFileData
+ */
+ createSKUFile(
+ skuId: string,
+ skuFileData: CreateSKUFileRequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ skuFileData
+ );
+ }
+
+ /**
+ * Deletes all SKU Image Files
+ * @param {string} skuId
+ */
+ deleteAllSKUFile(skuId: string): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Retrieves general information about the components of an SKU Kit by SKU ID or Parent SKU ID
+ * @param {string} skuId
+ * @param {string} parentSkuId
+ */
+ getSKUKitBySkuIDOrParentSkuId(
+ skuId?: string,
+ parentSkuId?: string
+ ): Promise> {
+ let params = "?";
+ if (skuId) {
+ params += `skuId=${skuId}`;
+ }
+ if (skuId && parentSkuId) {
+ params += "&";
+ }
+ if (parentSkuId) {
+ params += `parentSkuId=${parentSkuId}`;
+ }
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit${params}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Creates new component to a specific Kit
+ * @param {CreateSKUKitRequest} skuKitData
+ */
+ createSKUKit(
+ skuKitData: CreateSKUKitRequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ skuKitData
+ );
+ }
+
+ /**
+ * Deletes all Kit’s components based on the Parent SKU ID or deletes
+ * a specific Kit’s component based on the SKU ID
+ * @param {string} skuId
+ * @param {string} parentSkuId
+ */
+ deleteSKUKitBySkuIDOrParentSkuId(
+ skuId?: string,
+ parentSkuId?: string
+ ): Promise {
+ let params = "?";
+ if (skuId) {
+ params += `skuId=${skuId}`;
+ }
+ if (skuId && parentSkuId) {
+ params += "&";
+ }
+ if (parentSkuId) {
+ params += `parentSkuId=${parentSkuId}`;
+ }
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit${params}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Retrieves general information about an SKU Specification
+ * @param {string} skuId
+ */
+ getSKUSpecifications(
+ skuId: string
+ ): Promise>> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Creates a new Specification on a previously existing SKU
+ * @param {string} skuId
+ * @param {CreateSKUSpecificationRequest} skuSpecificationData
+ */
+ createSKUSpecification(
+ skuId: string,
+ skuSpecificationData: CreateSKUSpecificationRequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ skuSpecificationData
+ );
+ }
+
+ /**
+ * Deletes all Product Specifications
+ * @param {string} skuId
+ */
+ deleteAllSKUSpecifications(skuId: string): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Receives a list of Reference IDs and returns the same list with the corresponding SKU IDs.
+ * @param {Array} refIdList
+ */
+ retrieveSkuIdListByRefIdList(
+ refIdList: Array
+ ): Promise {
+ const path = `${SKU.BASE_PATH}_system/pub/sku/stockkeepingunitidsbyrefids`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ refIdList
+ );
+ }
+
+ /**
+ * Updates an existing SKU
+ * @param {string} skuId
+ * @param {UpdateSKURequest} skuData
+ */
+ updateSKU(
+ skuId: string,
+ skuData: UpdateSKURequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ skuData
+ );
+ }
+
+ /**
+ * Associates an existing SKU to an existing Attachment
+ * @param {AssociateSKUAttachmentRequest} skuAttachmentData
+ */
+ associateSKUAttachment(
+ skuAttachmentData: AssociateSKUAttachmentRequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/skuattachment`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ skuAttachmentData
+ );
+ }
+
+ /**
+ * Deletes an association of an SKU to an Attachment by its Sku ID
+ * @param {string} skuId
+ */
+ deleteSKUAttachmentBySkuId(skuId: string): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/skuattachment?skuId=${skuId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Updates a new Image on an SKU based on its URL
+ * @param {string} skuId
+ * @param {string} skuFileId
+ * @param {CreateSKUFileRequest} skuFileData
+ */
+ updateSKUFile(
+ skuId: string,
+ skuFileId: string,
+ skuFileData: CreateSKUFileRequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file/${skuFileId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ skuFileData
+ );
+ }
+
+ /**
+ * Deletes a specific SKU Image File
+ * @param {string} skuId
+ * @param {string} skuFileId
+ */
+ deleteSKUImageByFileId(
+ skuId: string,
+ skuFileId: string
+ ): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file/${skuFileId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a new SKU Complement on a Parent SKU
+ * @param {CreateSKUComplementRequest} skuComplementData
+ */
+ createSKUComplement(
+ skuComplementData: CreateSKUComplementRequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/skucomplement`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ skuComplementData
+ );
+ }
+
+ /**
+ * Deletes an association of an SKU to an Attachment by its Attachment ID
+ * @param {string} attachmentId
+ */
+ deleteSKUAttachmentByAttachmentId(
+ attachmentId: string
+ ): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/skuattachment/${attachmentId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Deletes a previously existing Complement of an SKU by SkuId
+ * @param {string} skuComplementId
+ */
+ deleteSKUComplementBySkuId(
+ skuComplementId: string
+ ): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/skucomplement/${skuComplementId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Amplifies a cart data by associating attachments to SKUs.
+ * This request removes existing SKU attachment associations and recreates
+ * the associations with the attachments being sent.
+ * @param {AssociateAttachmentsToSKURequest} attachmentsData
+ */
+ associateAttachmentsToSKU(
+ attachmentsData: AssociateAttachmentsToSKURequest
+ ): Promise> {
+ const path = `${SKU.BASE_PATH}_system/pvt/sku/associateattachments`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ attachmentsData
+ );
+ }
+
+ /**
+ * Creates or updates the EAN value of an SKU
+ * @param {string} skuId
+ * @param {string} ean
+ */
+ createSkuEAN(skuId: string, ean: string): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean/${ean}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST);
+ }
+
+ /**
+ * Deletes the EAN value of an SKU
+ * @param {string} skuId
+ * @param {string} ean
+ */
+ deleteSkuEAN(skuId: string, ean: string): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean/${ean}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Retrieves general information about a component of a Kit
+ * @param {string} kitId
+ */
+ getSKUKit(kitId: string): Promise> {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit/${kitId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Deletes a specific Kit’s component based on its Kit ID
+ * @param {string} kitId
+ */
+ deleteSKUKitByKitId(kitId: string): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit/${kitId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Deletes a specific SKU Specification
+ * @param {string} skuId
+ * @param {string} specificationId
+ */
+ deleteSKUSpecification(
+ skuId: string,
+ specificationId: string
+ ): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification/${specificationId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Deletes a previously existing Complement of an SKU
+ * @param {string} skuAttachmentId
+ * @param {string} skuAttachmentData
+ */
+ deleteSKUComplement(
+ skuAttachmentId: string,
+ skuAttachmentData: CreateSKUComplementRequest
+ ): Promise {
+ const path = `${SKU.BASE_PATH}/pvt/skuattachment/${skuAttachmentId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.DELETE,
+ skuAttachmentData
+ );
+ }
+}
diff --git a/src/modules/catalog/apis/sku/index.ts b/src/modules/catalog/apis/sku/index.ts
new file mode 100644
index 0000000..8282a34
--- /dev/null
+++ b/src/modules/catalog/apis/sku/index.ts
@@ -0,0 +1 @@
+export * from "./SKU";
diff --git a/src/modules/catalog/apis/sku/requests/AssociateAttachmentsToSKURequest.ts b/src/modules/catalog/apis/sku/requests/AssociateAttachmentsToSKURequest.ts
new file mode 100644
index 0000000..d012fa5
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/AssociateAttachmentsToSKURequest.ts
@@ -0,0 +1,4 @@
+export interface AssociateAttachmentsToSKURequest {
+ SkuId?: Array;
+ AttachmentNames?: Array;
+}
diff --git a/src/modules/catalog/apis/sku/requests/AssociateSKUAttachmentRequest.ts b/src/modules/catalog/apis/sku/requests/AssociateSKUAttachmentRequest.ts
new file mode 100644
index 0000000..9b36473
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/AssociateSKUAttachmentRequest.ts
@@ -0,0 +1,4 @@
+export interface AssociateSKUAttachmentRequest {
+ AttachmentId?: number;
+ SkuId?: number;
+}
diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUComplementRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUComplementRequest.ts
new file mode 100644
index 0000000..af41597
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/CreateSKUComplementRequest.ts
@@ -0,0 +1,5 @@
+export interface CreateSKUComplementRequest {
+ ParentSkuId?: number;
+ SkuId?: number;
+ ComplementTypeId?: number;
+}
diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUFileRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUFileRequest.ts
new file mode 100644
index 0000000..3fd9e69
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/CreateSKUFileRequest.ts
@@ -0,0 +1,7 @@
+export interface CreateSKUFileRequest {
+ IsMain?: boolean;
+ Label?: string;
+ Name?: string;
+ Text?: string;
+ Url?: string;
+}
diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUKitRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUKitRequest.ts
new file mode 100644
index 0000000..5c7bcf5
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/CreateSKUKitRequest.ts
@@ -0,0 +1,6 @@
+export interface CreateSKUKitRequest {
+ StockKeepingUnitParent?: number;
+ StockKeepingUnitId?: number;
+ Quantity?: number;
+ UnitPrice?: number;
+}
diff --git a/src/modules/catalog/apis/sku/requests/CreateSKURequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKURequest.ts
new file mode 100644
index 0000000..bf96eaa
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/CreateSKURequest.ts
@@ -0,0 +1,25 @@
+export interface CreateSKURequest {
+ ProductId?: number;
+ IsActive?: boolean;
+ Name?: string;
+ RefId?: string;
+ PackagedHeight?: number;
+ PackagedLength?: number;
+ PackagedWidth?: number;
+ PackagedWeightKg?: number;
+ Height?: number;
+ Length?: number;
+ Width?: number;
+ WeightKg?: number;
+ CubicWeight?: number;
+ IsKit?: boolean;
+ CreationDate?: string;
+ RewardValue?: number;
+ EstimatedDateArrival?: string;
+ ManufacturerCode?: string;
+ CommercialConditionId?: number;
+ MeasurementUnit?: string;
+ UnitMultiplier?: number;
+ ModalType?: string;
+ KitItensSellApart?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUSpecificationRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUSpecificationRequest.ts
new file mode 100644
index 0000000..f687e81
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/CreateSKUSpecificationRequest.ts
@@ -0,0 +1,4 @@
+export interface CreateSKUSpecificationRequest {
+ FieldId?: number;
+ FieldValueId?: number;
+}
diff --git a/src/modules/catalog/apis/sku/requests/UpdateSKURequest.ts b/src/modules/catalog/apis/sku/requests/UpdateSKURequest.ts
new file mode 100644
index 0000000..c828c4b
--- /dev/null
+++ b/src/modules/catalog/apis/sku/requests/UpdateSKURequest.ts
@@ -0,0 +1,5 @@
+import { CreateSKURequest } from "./CreateSKURequest";
+
+export interface UpdateSKURequest extends CreateSKURequest {
+ Id?: number;
+}
diff --git a/src/modules/catalog/apis/sku/responses/AssociateAttachmentsToSKUResponse.ts b/src/modules/catalog/apis/sku/responses/AssociateAttachmentsToSKUResponse.ts
new file mode 100644
index 0000000..d687b86
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/AssociateAttachmentsToSKUResponse.ts
@@ -0,0 +1,4 @@
+export interface AssociateAttachmentsToSKUResponse {
+ StatusCode?: number;
+ StatusDescription?: any;
+}
diff --git a/src/modules/catalog/apis/sku/responses/AssociateSKUAttachmentResponse.ts b/src/modules/catalog/apis/sku/responses/AssociateSKUAttachmentResponse.ts
new file mode 100644
index 0000000..cddbce9
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/AssociateSKUAttachmentResponse.ts
@@ -0,0 +1,6 @@
+import { AssociateSKUAttachmentRequest } from "../requests/AssociateSKUAttachmentRequest";
+
+export interface AssociateSKUAttachmentResponse
+ extends AssociateSKUAttachmentRequest {
+ Id?: number;
+}
diff --git a/src/modules/catalog/apis/sku/responses/CreateSKUComplementResponse.ts b/src/modules/catalog/apis/sku/responses/CreateSKUComplementResponse.ts
new file mode 100644
index 0000000..989fd19
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/CreateSKUComplementResponse.ts
@@ -0,0 +1,6 @@
+import { CreateSKUComplementRequest } from "../requests/CreateSKUComplementRequest";
+
+export interface CreateSKUComplementResponse
+ extends CreateSKUComplementRequest {
+ Id?: number;
+}
diff --git a/src/modules/catalog/apis/sku/responses/CreateSKUResponse.ts b/src/modules/catalog/apis/sku/responses/CreateSKUResponse.ts
new file mode 100644
index 0000000..f508413
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/CreateSKUResponse.ts
@@ -0,0 +1,5 @@
+import { CreateSKURequest } from "../requests/CreateSKURequest";
+
+export interface CreateSKUResponse extends CreateSKURequest {
+ Id?: number;
+}
diff --git a/src/modules/catalog/apis/sku/responses/GetSKUByRefIdResponse.ts b/src/modules/catalog/apis/sku/responses/GetSKUByRefIdResponse.ts
new file mode 100644
index 0000000..96b656f
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/GetSKUByRefIdResponse.ts
@@ -0,0 +1,27 @@
+export interface GetSKUByRefIdResponse {
+ Id?: number;
+ ProductId?: number;
+ IsActive?: boolean;
+ Name?: string;
+ RefId?: string;
+ PackagedHeight?: number;
+ PackagedLength?: number;
+ PackagedWidth?: number;
+ PackagedWeightKg?: number;
+ Height?: number;
+ Length?: number;
+ Width?: number;
+ WeightKg?: number;
+ CubicWeight?: number;
+ IsKit?: boolean;
+ CreationDate?: string;
+ RewardValue?: number;
+ EstimatedDateArrival?: string;
+ ManufacturerCode?: string;
+ CommercialConditionId?: number;
+ MeasurementUnit?: string;
+ UnitMultiplier?: number;
+ ModalType?: string;
+ KitItensSellApart?: boolean;
+ Videos?: string;
+}
diff --git a/src/modules/catalog/apis/sku/responses/GetSKUFileResponseItem.ts b/src/modules/catalog/apis/sku/responses/GetSKUFileResponseItem.ts
new file mode 100644
index 0000000..2eff795
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/GetSKUFileResponseItem.ts
@@ -0,0 +1,7 @@
+export interface GetSKUFileResponseItem {
+ Id?: number;
+ SkuId?: number;
+ Name?: string;
+ IsMain?: boolean;
+ Label?: string;
+}
diff --git a/src/modules/catalog/apis/sku/responses/GetSKUKitResponse.ts b/src/modules/catalog/apis/sku/responses/GetSKUKitResponse.ts
new file mode 100644
index 0000000..ea1fc84
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/GetSKUKitResponse.ts
@@ -0,0 +1,7 @@
+export interface GetSKUKitResponse {
+ Id?: number;
+ StockKeepingUnitParent?: number;
+ StockKeepingUnitId?: number;
+ Quantity?: number;
+ UnitPrice?: number;
+}
diff --git a/src/modules/catalog/apis/sku/responses/GetSKUListByProductIdResponseItem.ts b/src/modules/catalog/apis/sku/responses/GetSKUListByProductIdResponseItem.ts
new file mode 100644
index 0000000..cf34da8
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/GetSKUListByProductIdResponseItem.ts
@@ -0,0 +1,42 @@
+export interface GetSKUListByProductIdResponseItem {
+ IsPersisted?: boolean;
+ IsRemoved?: boolean;
+ Id?: number;
+ ProductId?: number;
+ IsActive?: boolean;
+ Name?: string;
+ Height?: number;
+ RealHeight?: number;
+ Width?: number;
+ RealWidth?: number;
+ Length?: number;
+ RealLength?: number;
+ WeightKg?: number;
+ RealWeightKg?: number;
+ ModalId?: string;
+ RefId?: string;
+ CubicWeight?: number;
+ IsKit?: boolean;
+ IsDynamicKit?: boolean;
+ InternalNote?: string;
+ DateUpdated?: string;
+ RewardValue?: number;
+ CommercialConditionId?: number;
+ EstimatedDateArrival?: string;
+ FlagKitItensSellApart?: boolean;
+ ManufacturerCode?: string;
+ ReferenceStockKeepingUnitId?: number;
+ Position?: number;
+ EditionSkuId?: number;
+ ApprovedAdminId?: number;
+ EditionAdminId?: number;
+ ActivateIfPossible?: boolean;
+ SupplierCode?: string;
+ MeasurementUnit?: number;
+ UnitMultiplier?: number;
+ IsInventoried?: boolean;
+ IsTransported?: boolean;
+ IsGiftCardRecharge?: boolean;
+ ModalType?: string;
+ IsKitOptimized?: boolean;
+}
diff --git a/src/modules/catalog/apis/sku/responses/GetSKUResponse.ts b/src/modules/catalog/apis/sku/responses/GetSKUResponse.ts
new file mode 100644
index 0000000..22e2682
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/GetSKUResponse.ts
@@ -0,0 +1,109 @@
+interface Dimension {
+ cubicweight?: number;
+ height?: number;
+ length?: number;
+ weight?: number;
+ width?: number;
+}
+
+interface RealDimension {
+ realCubicweight?: number;
+ realHeight?: number;
+ realLength?: number;
+ realWeight?: number;
+ realWidth?: number;
+}
+
+interface Field {
+ FieldName?: string;
+ MaxCaracters?: string;
+ DomainValues?: string;
+}
+
+interface Attachment {
+ Id?: number;
+ Name?: string;
+ Keys?: Array;
+ Fields?: Array;
+ IsActive?: boolean;
+ IsRequired?: boolean;
+}
+
+interface SkuSeller {
+ SellerId?: string;
+ StockKeepingUnitId?: number;
+ SellerStockKeepingUnitId?: string;
+ IsActive?: boolean;
+ FreightCommissionPercentage?: number;
+ ProductCommissionPercentage?: number;
+}
+
+interface Image {
+ ImageUrl?: string;
+ ImageName?: string;
+ FileId?: number;
+}
+
+interface SkuSpecification {
+ FieldId?: number;
+ FieldName?: string;
+ FieldValueIds?: Array;
+ FieldValues?: Array;
+}
+
+interface ProductSpecification {
+ FieldId?: number;
+ FieldName?: string;
+ FieldValueIds?: Array;
+ FieldValues?: Array;
+}
+
+interface AlternateId {
+ Ean?: string;
+ RefId?: string;
+}
+
+export interface GetSKUResponse {
+ Id?: number;
+ ProductId?: number;
+ NameComplete?: string;
+ ProductName?: string;
+ ProductDescription?: string;
+ SkuName?: string;
+ IsActive?: boolean;
+ IsTransported?: boolean;
+ IsInventoried?: boolean;
+ IsGiftCardRecharge?: boolean;
+ ImageUrl?: string;
+ DetailUrl?: string;
+ CSCIdentification?: string;
+ BrandId?: string;
+ BrandName?: string;
+ Dimension?: Dimension;
+ RealDimension?: RealDimension;
+ ManufacturerCode?: string;
+ IsKit?: boolean;
+ KitItems?: Array;
+ Services?: Array;
+ Categories?: Array;
+ Attachments?: Array;
+ Collections?: Array;
+ SkuSellers?: Array;
+ SalesChannels?: Array;
+ Images?: Array;
+ SkuSpecifications?: Array;
+ ProductSpecifications?: Array;
+ ProductClustersIds?: string;
+ ProductCategoryIds?: string;
+ ProductGlobalCategoryId?: string;
+ ProductCategories?: any;
+ CommercialConditionId?: number;
+ RewardValue?: number;
+ AlternateIds?: Array;
+ AlternateIdValues?: Array;
+ EstimatedDateArrival?: string;
+ MeasurementUnit?: string;
+ UnitMultiplier?: number;
+ InformationSource?: string;
+ ModalType?: string;
+}
diff --git a/src/modules/catalog/apis/sku/responses/GetSKUSpecificationsResponseItem.ts b/src/modules/catalog/apis/sku/responses/GetSKUSpecificationsResponseItem.ts
new file mode 100644
index 0000000..f4aff49
--- /dev/null
+++ b/src/modules/catalog/apis/sku/responses/GetSKUSpecificationsResponseItem.ts
@@ -0,0 +1,7 @@
+export interface GetSKUSpecificationsResponseItem {
+ Id?: number;
+ SkuId?: number;
+ FieldId?: number;
+ FieldValueId?: number;
+ Text?: string;
+}
diff --git a/src/modules/catalog/apis/specification/Specification.ts b/src/modules/catalog/apis/specification/Specification.ts
new file mode 100644
index 0000000..e9c75d9
--- /dev/null
+++ b/src/modules/catalog/apis/specification/Specification.ts
@@ -0,0 +1,308 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetSpecificationNonStructuredResponse } from "./responses/GetSpecificationNonStructuredResponse";
+import { CreateSpecificationsFieldRequest } from "./requests/CreateSpecificationsFieldRequest";
+import { CreateSpecificationGroupRequest } from "./requests/CreateSpecificationGroupRequest";
+import { CreateSpecificationGroupResponse } from "./responses/CreateSpecificationGroupResponse";
+import { UpdateSpecificationGroupRequest } from "./requests/UpdateSpecificationGroupRequest";
+import { CreateSpecificationValueRequest } from "./requests/CreateSpecificationValueRequest";
+import { GetSpecificationValueResponse } from "./responses/GetSpecificationValueResponse";
+import { GetSpecificationsByCategoryIdResponseItem } from "./responses/GetSpecificationsByCategoryIdResponseItem";
+import { GetSpecificationFieldValueResponse } from "./responses/GetSpecificationFieldValueResponse";
+import { GetSpecificationsValuesByFieldIdResponseItem } from "./responses/GetSpecificationsValuesByFieldIdResponseItem";
+import { UpdateSpecificationRequest } from "./requests/UpdateSpecificationRequest";
+
+export class Specification extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog";
+
+ /**
+ * Gets general information about unmapped Specifications of a Seller SKU in a Marketplace by its unique ID
+ * @param {number} skuId
+ */
+ getSpecificationNonStructuredBySkuId(
+ skuId: number
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${skuId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Deletes unmapped Specifications of a Seller SKU in a Marketplace by its unique ID
+ * @param {number} skuId
+ */
+ deleteSpecificationNonStructuredBySkuId(
+ skuId: number
+ ): Promise {
+ const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${skuId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a specification field in a category.
+ * @param {CreateSpecificationsFieldRequest} specificationFieldData
+ */
+ createSpecificationsField(
+ specificationFieldData: CreateSpecificationsFieldRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pvt/specification/field`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ specificationFieldData
+ );
+ }
+
+ /**
+ * Updates a specification field in a category.
+ * @param {CreateSpecificationsFieldRequest} specificationFieldData
+ */
+ updateSpecificationsField(
+ specificationFieldData: CreateSpecificationsFieldRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pvt/specification/field`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ specificationFieldData
+ );
+ }
+
+ /**
+ * Create a specification group.
+ * @param {CreateSpecificationGroupRequest} specificationGroupData
+ */
+ createSpecificationGroup(
+ specificationGroupData: CreateSpecificationGroupRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pvt/specification/group`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ specificationGroupData
+ );
+ }
+
+ /**
+ * Update a specification group
+ * @param {UpdateSpecificationGroupRequest} specificationGroupData
+ */
+ updateSpecificationGroup(
+ specificationGroupData: UpdateSpecificationGroupRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pvt/specification/group`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ specificationGroupData
+ );
+ }
+
+ /**
+ * Creates a new Specification Value for a Category
+ * @param {CreateSpecificationValueRequest} specificationValueData
+ */
+ createSpecificationValue(
+ specificationValueData: CreateSpecificationValueRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}/pvt/specificationvalue`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ specificationValueData
+ );
+ }
+
+ /**
+ * Creates a specification field value by the specification field's ID.
+ * @param {CreateSpecificationValueRequest} specificationFieldValueData
+ */
+ createSpecificationFieldValue(
+ specificationFieldValueData: CreateSpecificationValueRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pvt/specification/fieldValue`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ specificationFieldValueData
+ );
+ }
+
+ /**
+ * CUpdates a specification field value by the specification field's ID.
+ * @param {CreateSpecificationValueRequest} specificationFieldValueData
+ */
+ updateSpecificationFieldValue(
+ specificationFieldValueData: CreateSpecificationValueRequest
+ ): Promise {
+ const path = `${Specification.BASE_PATH}_system/pvt/specification/fieldValue`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ specificationFieldValueData
+ );
+ }
+
+ /**
+ * Gets general information about unmapped Specifications of a Seller SKU in a Marketplace
+ * @param {number} id
+ */
+ getSpecificationNonStructured(
+ id: number
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${id}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Deletes unmapped Specifications of a Seller SKU in a Marketplace by its unique ID
+ * @param {number} id
+ */
+ deleteSpecificationNonStructured(id: number): Promise {
+ const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${id}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Retrieves general information about a Specification Value
+ * @param {number} specificationValueId
+ */
+ getSpecificationValue(
+ specificationValueId: number
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}/pvt/specificationvalue/${specificationValueId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ *
+ * @param {number} specificationValueId
+ * @param {CreateSpecificationValueRequest} specificationValueData
+ */
+ updateSpecificationValue(
+ specificationValueId: number,
+ specificationValueData: CreateSpecificationValueRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}/pvt/specificationvalue/${specificationValueId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ specificationValueData
+ );
+ }
+
+ /**
+ * Gets all specifications from a category by its ID.
+ * @param {number} categoryId
+ */
+ getSpecificationsByCategoryId(
+ categoryId: number
+ ): Promise<
+ VtexHttpResponse>
+ > {
+ const path = `${Specification.BASE_PATH}_system/pub/specification/field/listByCategoryId/${categoryId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves details from a specification field by this field's ID.
+ * @param {number} fieldId
+ */
+ getSpecificationsField(
+ fieldId: number
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pub/specification/fieldGet/${fieldId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves details from a specification field's value by this value's ID.
+ * @param {number} fieldValueId
+ */
+ getSpecificationsFieldValue(
+ fieldValueId: number
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pub/specification/fieldValue/${fieldValueId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves details from a specification group by the ID of this group.
+ * @param {number} groupId
+ */
+ getSpecificationsGroup(
+ groupId: number
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}_system/pub/specification/groupGet/${groupId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Lists all specifications including the current category and the level zero specifications
+ * from a category by its ID.
+ * @param {number} categoryId
+ */
+ getSpecificationsTreeByCategoryId(
+ categoryId: number
+ ): Promise<
+ VtexHttpResponse>
+ > {
+ const path = `${Specification.BASE_PATH}_system/pub/specification/field/listTreeByCategoryId/${categoryId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Gets a list of all specification values from a Specification Field by this field's ID.
+ * @param {number} fieldId
+ */
+ getSpecificationsValuesByFieldId(
+ fieldId: number
+ ): Promise<
+ VtexHttpResponse>
+ > {
+ const path = `${Specification.BASE_PATH}_system/pub/specification/fieldvalue/${fieldId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves a list of specification groups by the category ID.
+ * @param {number} categoryId
+ */
+ listSpecificationsGroupByCategory(
+ categoryId: number
+ ): Promise>> {
+ const path = `${Specification.BASE_PATH}_system/pvt/specification/groupbycategory/${categoryId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates a Product or SKU Specification
+ * @param {number} specificationId
+ * @param {UpdateSpecificationRequest} specificationData
+ */
+ updateSpecification(
+ specificationId: number,
+ specificationData: UpdateSpecificationRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}/pvt/specification/${specificationId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ specificationData
+ );
+ }
+
+ /**
+ * Creates a new Product or SKU Specification
+ * @param {UpdateSpecificationRequest} specificationData
+ */
+ createSpecification(
+ specificationData: UpdateSpecificationRequest
+ ): Promise> {
+ const path = `${Specification.BASE_PATH}/pvt/specification`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ specificationData
+ );
+ }
+}
diff --git a/src/modules/catalog/apis/specification/index.ts b/src/modules/catalog/apis/specification/index.ts
new file mode 100644
index 0000000..bbfb449
--- /dev/null
+++ b/src/modules/catalog/apis/specification/index.ts
@@ -0,0 +1 @@
+export * from "./Specification";
diff --git a/src/modules/catalog/apis/specification/requests/CreateSpecificationGroupRequest.ts b/src/modules/catalog/apis/specification/requests/CreateSpecificationGroupRequest.ts
new file mode 100644
index 0000000..ded7e78
--- /dev/null
+++ b/src/modules/catalog/apis/specification/requests/CreateSpecificationGroupRequest.ts
@@ -0,0 +1,4 @@
+export interface CreateSpecificationGroupRequest {
+ CategoryId?: number;
+ Name?: string;
+}
diff --git a/src/modules/catalog/apis/specification/requests/CreateSpecificationValueRequest.ts b/src/modules/catalog/apis/specification/requests/CreateSpecificationValueRequest.ts
new file mode 100644
index 0000000..8403ba6
--- /dev/null
+++ b/src/modules/catalog/apis/specification/requests/CreateSpecificationValueRequest.ts
@@ -0,0 +1,7 @@
+export interface CreateSpecificationValueRequest {
+ FieldId?: number;
+ Name?: string;
+ Text?: string;
+ IsActive?: boolean;
+ Position?: number;
+}
diff --git a/src/modules/catalog/apis/specification/requests/CreateSpecificationsFieldRequest.ts b/src/modules/catalog/apis/specification/requests/CreateSpecificationsFieldRequest.ts
new file mode 100644
index 0000000..66c8ebe
--- /dev/null
+++ b/src/modules/catalog/apis/specification/requests/CreateSpecificationsFieldRequest.ts
@@ -0,0 +1,20 @@
+export interface CreateSpecificationsFieldRequest {
+ Name?: string;
+ CategoryId?: number;
+ FieldId?: number;
+ IsActive?: boolean;
+ IsRequired?: boolean;
+ FieldTypeId?: number;
+ FieldValueId?: number;
+ Description?: string;
+ IsStockKeepingUnit?: boolean;
+ IsFilter?: boolean;
+ IsOnProductDetails?: boolean;
+ Position?: number;
+ IsWizard?: boolean;
+ IsTopMenuLinkActive?: boolean;
+ IsSideMenuLinkActive?: boolean;
+ DefaultValue?: string;
+ FieldGroupId?: number;
+ FieldGroupName?: string;
+}
diff --git a/src/modules/catalog/apis/specification/requests/UpdateSpecificationGroupRequest.ts b/src/modules/catalog/apis/specification/requests/UpdateSpecificationGroupRequest.ts
new file mode 100644
index 0000000..cfa2f27
--- /dev/null
+++ b/src/modules/catalog/apis/specification/requests/UpdateSpecificationGroupRequest.ts
@@ -0,0 +1,4 @@
+export interface UpdateSpecificationGroupRequest {
+ Id?: number;
+ Name?: string;
+}
diff --git a/src/modules/catalog/apis/specification/requests/UpdateSpecificationRequest.ts b/src/modules/catalog/apis/specification/requests/UpdateSpecificationRequest.ts
new file mode 100644
index 0000000..959be25
--- /dev/null
+++ b/src/modules/catalog/apis/specification/requests/UpdateSpecificationRequest.ts
@@ -0,0 +1,17 @@
+export interface UpdateSpecificationRequest {
+ FieldTypeId?: number;
+ CategoryId?: number;
+ FieldGroupId?: number;
+ Name?: string;
+ Description?: string;
+ Position?: number;
+ IsFilter?: boolean;
+ IsRequired?: boolean;
+ IsOnProductDetails?: boolean;
+ IsStockKeepingUnit?: boolean;
+ IsWizard?: boolean;
+ IsActive?: boolean;
+ IsTopMenuLinkActive?: boolean;
+ IsSideMenuLinkActive?: boolean;
+ DefaultValue?: string;
+}
diff --git a/src/modules/catalog/apis/specification/responses/CreateSpecificationGroupResponse.ts b/src/modules/catalog/apis/specification/responses/CreateSpecificationGroupResponse.ts
new file mode 100644
index 0000000..5708f25
--- /dev/null
+++ b/src/modules/catalog/apis/specification/responses/CreateSpecificationGroupResponse.ts
@@ -0,0 +1,7 @@
+import { CreateSpecificationGroupRequest } from "../requests/CreateSpecificationGroupRequest";
+
+export interface CreateSpecificationGroupResponse
+ extends CreateSpecificationGroupRequest {
+ Id?: number;
+ Position?: number;
+}
diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationFieldValueResponse.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationFieldValueResponse.ts
new file mode 100644
index 0000000..2684d89
--- /dev/null
+++ b/src/modules/catalog/apis/specification/responses/GetSpecificationFieldValueResponse.ts
@@ -0,0 +1,8 @@
+export interface GetSpecificationFieldValueResponse {
+ FieldValueId?: number;
+ FieldId?: number;
+ Name?: string;
+ Text?: string;
+ IsActive?: boolean;
+ Position?: number;
+}
diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationNonStructuredResponse.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationNonStructuredResponse.ts
new file mode 100644
index 0000000..9112dfc
--- /dev/null
+++ b/src/modules/catalog/apis/specification/responses/GetSpecificationNonStructuredResponse.ts
@@ -0,0 +1,6 @@
+export interface GetSpecificationNonStructuredResponse {
+ Id?: number;
+ SkuId?: number;
+ SpecificationName?: string;
+ SpecificationValue?: string;
+}
diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationValueResponse.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationValueResponse.ts
new file mode 100644
index 0000000..6a6852b
--- /dev/null
+++ b/src/modules/catalog/apis/specification/responses/GetSpecificationValueResponse.ts
@@ -0,0 +1,6 @@
+import { UpdateSpecificationRequest } from "../requests/UpdateSpecificationRequest";
+
+export interface GetSpecificationValueResponse
+ extends UpdateSpecificationRequest {
+ Id?: number;
+}
diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationsByCategoryIdResponseItem.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationsByCategoryIdResponseItem.ts
new file mode 100644
index 0000000..b2cb69e
--- /dev/null
+++ b/src/modules/catalog/apis/specification/responses/GetSpecificationsByCategoryIdResponseItem.ts
@@ -0,0 +1,7 @@
+export interface GetSpecificationsByCategoryIdResponseItem {
+ Name?: string;
+ CategoryId?: number;
+ FieldId?: number;
+ IsActive?: boolean;
+ IsStockKeepingUnit?: boolean;
+}
diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationsValuesByFieldIdResponseItem.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationsValuesByFieldIdResponseItem.ts
new file mode 100644
index 0000000..3c31957
--- /dev/null
+++ b/src/modules/catalog/apis/specification/responses/GetSpecificationsValuesByFieldIdResponseItem.ts
@@ -0,0 +1,6 @@
+export interface GetSpecificationsValuesByFieldIdResponseItem {
+ FieldValueId?: number;
+ Value?: string;
+ IsActive?: boolean;
+ Position?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/Subcollection.ts b/src/modules/catalog/apis/subcollection/Subcollection.ts
new file mode 100644
index 0000000..fa6a0f5
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/Subcollection.ts
@@ -0,0 +1,183 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { GetSubcollectionResponse } from "./responses/GetSubcollectionResponse";
+import { GetSubcollectionSKUResponse } from "./responses/GetSubcollectionSKUResponse";
+import { CreateCategorySubcollectionRequest } from "./requests/CreateCategorySubcollectionRequest";
+import { CreateCategorySubcollectionResponse } from "./responses/CreateCategorySubcollectionResponse";
+import { CreateBrandSubcollectionRequest } from "./requests/CreateBrandSubcollectionRequest";
+import { CreateBrandSubcollectionResponse } from "./responses/CreateBrandSubcollectionResponse";
+import { CreateSKUSubcollectionRequest } from "./requests/CreateSKUSubcollectionRequest";
+import { CreateSKUSubcollectionResponse } from "./responses/CreateSKUSubcollectionResponse";
+import { CreateSubcollectionRequest } from "./requests/CreateSubcollectionRequest";
+
+export class Subcollection extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog/pvt";
+
+ /**
+ * Retrieves all Subcollections by its Collection ID
+ * @param {number} collectionId
+ */
+ getSubcollectionByCollectionId(
+ collectionId: number
+ ): Promise>> {
+ const path = `${Subcollection.BASE_PATH}/collection/${collectionId}/subcollection`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Retrieves all SKUs from a Subcollection
+ * @param {number} subcollectionId
+ * @param {number} page
+ * @param {number} size
+ */
+ getSubcollectionSKU(
+ subcollectionId: number,
+ page: number,
+ size: number
+ ): Promise> {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/stockkeepingunit?page=${page}&size=${size}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Creates a single Category in a SubCollection
+ * @param {number} subcollectionId
+ * @param {CreateCategorySubcollectionRequest} categorySubcollectionData
+ */
+ createCategorySubcollection(
+ subcollectionId: number,
+ categorySubcollectionData: CreateCategorySubcollectionRequest
+ ): Promise> {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/category`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ categorySubcollectionData
+ );
+ }
+
+ /**
+ * Deletes a Category from a SubCollection
+ * @param {number} subcollectionId
+ * @param {number} categoryId
+ */
+ deleteCategorySubcollection(
+ subcollectionId: number,
+ categoryId: number
+ ): Promise {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/category/${categoryId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Deletes a Brand from a SubCollection
+ * @param {number} subcollectionId
+ * @param {number} brandId
+ */
+ deleteBrandSubcollection(
+ subcollectionId: number,
+ brandId: number
+ ): Promise {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/brand/${brandId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a single Brand in a SubCollection
+ * @param {number} subcollectionId
+ * @param {CreateBrandSubcollectionRequest} brandSubcollectionData
+ */
+ createBrandSubcollection(
+ subcollectionId: number,
+ brandSubcollectionData: CreateBrandSubcollectionRequest
+ ): Promise> {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/brand`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ brandSubcollectionData
+ );
+ }
+
+ /**
+ * Deletes an SKU from a SubCollection
+ * @param {number} subcollectionId
+ * @param {number} skuId
+ */
+ deleteSKUSubcollection(
+ subcollectionId: number,
+ skuId: number
+ ): Promise {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/stockkeepingunit/${skuId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ *
+ * @param {number} subcollectionId
+ * @param {CreateSKUSubcollectionRequest} skuSubcollectionData
+ */
+ createSKUSubcollection(
+ subcollectionId: number,
+ skuSubcollectionData: CreateSKUSubcollectionRequest
+ ): Promise> {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/stockkeepingunit`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ skuSubcollectionData
+ );
+ }
+
+ /**
+ * Creates a new SubCollection inclusion or exclusion under a Collection
+ * @param {CreateSubcollectionRequest} subcollectionData
+ */
+ createSubcollection(
+ subcollectionData: CreateSubcollectionRequest
+ ): Promise> {
+ const path = `${Subcollection.BASE_PATH}/subcollection`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ subcollectionData
+ );
+ }
+
+ /**
+ * Gets information about a SubCollection
+ * @param {number} subcollectionId
+ */
+ getSubcollection(
+ subcollectionId: number
+ ): Promise> {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Updates a previously SubCollection
+ * @param {number} subcollectionId
+ * @param {CreateSubcollectionRequest} subcollectionData
+ */
+ updateSubcollection(
+ subcollectionId: number,
+ subcollectionData: CreateSubcollectionRequest
+ ): Promise> {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ subcollectionData
+ );
+ }
+
+ /**
+ * Deletes a previously SubCollection
+ * @param {number} subcollectionId
+ */
+ deleteSubcollection(subcollectionId: number): Promise {
+ const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+}
diff --git a/src/modules/catalog/apis/subcollection/index.ts b/src/modules/catalog/apis/subcollection/index.ts
new file mode 100644
index 0000000..993ce24
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/index.ts
@@ -0,0 +1 @@
+export * from "./SubCollection";
diff --git a/src/modules/catalog/apis/subcollection/requests/CreateBrandSubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateBrandSubcollectionRequest.ts
new file mode 100644
index 0000000..0930672
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/requests/CreateBrandSubcollectionRequest.ts
@@ -0,0 +1,3 @@
+export interface CreateBrandSubcollectionRequest {
+ BrandId?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/requests/CreateCategorySubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateCategorySubcollectionRequest.ts
new file mode 100644
index 0000000..64a285a
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/requests/CreateCategorySubcollectionRequest.ts
@@ -0,0 +1,3 @@
+export interface CreateCategorySubcollectionRequest {
+ CategoryId?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/requests/CreateSKUSubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateSKUSubcollectionRequest.ts
new file mode 100644
index 0000000..bc225bc
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/requests/CreateSKUSubcollectionRequest.ts
@@ -0,0 +1,3 @@
+export interface CreateSKUSubcollectionRequest {
+ SkuId?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/requests/CreateSubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateSubcollectionRequest.ts
new file mode 100644
index 0000000..4440afd
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/requests/CreateSubcollectionRequest.ts
@@ -0,0 +1,7 @@
+export interface CreateSubcollectionRequest {
+ CollectionId?: number;
+ Name?: string;
+ Type?: string;
+ PreSale?: boolean;
+ Release?: boolean;
+}
diff --git a/src/modules/catalog/apis/subcollection/responses/CreateBrandSubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/CreateBrandSubcollectionResponse.ts
new file mode 100644
index 0000000..a23a3b9
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/responses/CreateBrandSubcollectionResponse.ts
@@ -0,0 +1,6 @@
+import { CreateBrandSubcollectionRequest } from "../requests/CreateBrandSubcollectionRequest";
+
+export interface CreateBrandSubcollectionResponse
+ extends CreateBrandSubcollectionRequest {
+ SubCollectionId?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/responses/CreateCategorySubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/CreateCategorySubcollectionResponse.ts
new file mode 100644
index 0000000..7574033
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/responses/CreateCategorySubcollectionResponse.ts
@@ -0,0 +1,6 @@
+import { CreateCategorySubcollectionRequest } from "../requests/CreateCategorySubcollectionRequest";
+
+export interface CreateCategorySubcollectionResponse
+ extends CreateCategorySubcollectionRequest {
+ SubCollectionId?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/responses/CreateSKUSubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/CreateSKUSubcollectionResponse.ts
new file mode 100644
index 0000000..04b1594
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/responses/CreateSKUSubcollectionResponse.ts
@@ -0,0 +1,6 @@
+import { CreateSKUSubcollectionRequest } from "../requests/CreateSKUSubcollectionRequest";
+
+export interface CreateSKUSubcollectionResponse
+ extends CreateSKUSubcollectionRequest {
+ SubCollectionId?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/responses/GetSubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionResponse.ts
new file mode 100644
index 0000000..1b332df
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionResponse.ts
@@ -0,0 +1,5 @@
+import { CreateSubcollectionRequest } from "../requests/CreateSubcollectionRequest";
+
+export interface GetSubcollectionResponse extends CreateSubcollectionRequest {
+ Id?: number;
+}
diff --git a/src/modules/catalog/apis/subcollection/responses/GetSubcollectionSKUResponse.ts b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionSKUResponse.ts
new file mode 100644
index 0000000..11e4ec9
--- /dev/null
+++ b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionSKUResponse.ts
@@ -0,0 +1,12 @@
+interface DataItem {
+ SubCollectionId?: number;
+ SkuId?: number;
+}
+
+export interface GetSubcollectionSKUResponse {
+ Page?: number;
+ Size?: number;
+ TotalRows?: number;
+ TotalPage?: number;
+ Data?: Array;
+}
diff --git a/src/modules/catalog/apis/supplier/Supplier.ts b/src/modules/catalog/apis/supplier/Supplier.ts
new file mode 100644
index 0000000..b42d193
--- /dev/null
+++ b/src/modules/catalog/apis/supplier/Supplier.ts
@@ -0,0 +1,48 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { UpdateSupplierRequest } from "./requests/UpdateSupplierRequest";
+import { UpdateSupplierResponse } from "./responses/UpdateSupplierResponse";
+
+export class Supplier extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog/pvt/supplier";
+
+ /**
+ * Updates general information of an existing Supplier
+ * @param {number} supplierId
+ * @param {UpdateSupplierRequest} supplierData
+ */
+ updateSupplier(
+ supplierId: number,
+ supplierData: UpdateSupplierRequest
+ ): Promise> {
+ const path = `${Supplier.BASE_PATH}/${supplierId}`;
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ supplierData
+ );
+ }
+
+ /**
+ * Deletes an existing Supplier
+ * @param {number} supplierId
+ */
+ deleteSupplier(supplierId: number): Promise {
+ const path = `${Supplier.BASE_PATH}/${supplierId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+
+ /**
+ * Creates a new Supplier from scratch
+ * @param {UpdateSupplierRequest} supplierData
+ */
+ createSupplier(
+ supplierData: UpdateSupplierRequest
+ ): Promise> {
+ return this.vtexHttpClient.performRequest(
+ Supplier.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ supplierData
+ );
+ }
+}
diff --git a/src/modules/catalog/apis/supplier/index.ts b/src/modules/catalog/apis/supplier/index.ts
new file mode 100644
index 0000000..b695dc6
--- /dev/null
+++ b/src/modules/catalog/apis/supplier/index.ts
@@ -0,0 +1 @@
+export * from "./Supplier";
diff --git a/src/modules/catalog/apis/supplier/requests/UpdateSupplierRequest.ts b/src/modules/catalog/apis/supplier/requests/UpdateSupplierRequest.ts
new file mode 100644
index 0000000..1a66fde
--- /dev/null
+++ b/src/modules/catalog/apis/supplier/requests/UpdateSupplierRequest.ts
@@ -0,0 +1,11 @@
+export interface UpdateSupplierRequest {
+ Name?: string;
+ CorporateName?: string;
+ StateInscription?: string;
+ Cnpj?: string;
+ Phone?: string;
+ CellPhone?: string;
+ CorportePhone?: string;
+ Email?: string;
+ IsActive?: boolean;
+}
diff --git a/src/modules/catalog/apis/supplier/responses/UpdateSupplierResponse.ts b/src/modules/catalog/apis/supplier/responses/UpdateSupplierResponse.ts
new file mode 100644
index 0000000..31e18dc
--- /dev/null
+++ b/src/modules/catalog/apis/supplier/responses/UpdateSupplierResponse.ts
@@ -0,0 +1,5 @@
+import { UpdateSupplierRequest } from "../requests/UpdateSupplierRequest";
+
+export interface UpdateSupplierResponse extends UpdateSupplierRequest {
+ Id?: number;
+}
diff --git a/src/modules/catalog/apis/trade-policy/TradePolicy.ts b/src/modules/catalog/apis/trade-policy/TradePolicy.ts
new file mode 100644
index 0000000..9ad6e84
--- /dev/null
+++ b/src/modules/catalog/apis/trade-policy/TradePolicy.ts
@@ -0,0 +1,41 @@
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+
+export class TradePolicy extends AbstractApi {
+ private static readonly BASE_PATH: string = "/api/catalog/pvt/product";
+
+ /**
+ * Retrieves a Trade Policy associated to a Product by its ID
+ * @param {string} productId
+ */
+ getTradePolicyByProductId(productId: string): Promise {
+ const path = `${TradePolicy.BASE_PATH}/${productId}/salespolicy`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
+ }
+
+ /**
+ * Associates a existing Trade Policy with a Product
+ * @param {string} productId
+ * @param {string} tradePolicyId
+ */
+ createProductToTradePolicy(
+ productId: string,
+ tradePolicyId: string
+ ): Promise {
+ const path = `${TradePolicy.BASE_PATH}/${productId}/salespolicy/${tradePolicyId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST);
+ }
+
+ /**
+ * Disassociates a Trade Policy to a Product
+ * @param {string} productId
+ * @param {string} tradePolicyId
+ */
+ deleteProductToTradePolicy(
+ productId: string,
+ tradePolicyId: string
+ ): Promise {
+ const path = `${TradePolicy.BASE_PATH}/${productId}/salespolicy/${tradePolicyId}`;
+ return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE);
+ }
+}
diff --git a/src/modules/catalog/apis/trade-policy/index.ts b/src/modules/catalog/apis/trade-policy/index.ts
new file mode 100644
index 0000000..84e6bb7
--- /dev/null
+++ b/src/modules/catalog/apis/trade-policy/index.ts
@@ -0,0 +1 @@
+export * from "./TradePolicy";
diff --git a/src/modules/catalog/index.ts b/src/modules/catalog/index.ts
new file mode 100644
index 0000000..e3cc3ba
--- /dev/null
+++ b/src/modules/catalog/index.ts
@@ -0,0 +1 @@
+export * from "./Catalog";
diff --git a/src/modules/logistics/Logistics.ts b/src/modules/logistics/Logistics.ts
index 0665fb5..69ebf4d 100644
--- a/src/modules/logistics/Logistics.ts
+++ b/src/modules/logistics/Logistics.ts
@@ -1,14 +1,14 @@
-import { VtexHttpClient } from '../../utils/VtexHttpClient';
-import { ShippingPolicies } from './apis/shipping-policies';
-import { Carriers } from './apis/carriers';
-import { Docks } from './apis/docks';
-import { Warehouses } from './apis/warehouses';
-import { Inventory } from './apis/inventory';
-import { Holidays } from './apis/holidays';
-import { Reservations } from './apis/reservations';
-import { SLA } from './apis/SLA';
-import { PickupPoints } from './apis/pickup-points';
-import { Polygons } from './apis/polygons';
+import { VtexHttpClient } from "../../utils/VtexHttpClient";
+import { ShippingPolicies } from "./apis/shipping-policies";
+import { Carriers } from "./apis/carriers";
+import { Docks } from "./apis/docks";
+import { Warehouses } from "./apis/warehouses";
+import { Inventory } from "./apis/inventory";
+import { Holidays } from "./apis/holidays";
+import { Reservations } from "./apis/reservations";
+import { SLA } from "./apis/SLA";
+import { PickupPoints } from "./apis/pickup-points";
+import { Polygons } from "./apis/polygons";
export class Logistics {
/**
diff --git a/src/modules/logistics/apis/SLA/SLA.ts b/src/modules/logistics/apis/SLA/SLA.ts
index b6aafb4..dd4b18d 100644
--- a/src/modules/logistics/apis/SLA/SLA.ts
+++ b/src/modules/logistics/apis/SLA/SLA.ts
@@ -1,16 +1,20 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { CalculateSLARequestItem } from './requests/CalculateSLARequestItem';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { CalculateSLAResponseItem } from './responses/CalculateSLAResponseItem';
+import { AbstractApi } from "../../../AbstractApi";
+import { CalculateSLARequestItem } from "./requests/CalculateSLARequestItem";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { CalculateSLAResponseItem } from "./responses/CalculateSLAResponseItem";
export class SLA extends AbstractApi {
/**
* Used by checkout to calculate Service Level Agreement.
* @param {Array} data
*/
- calculateSLA(data: Array)
- : Promise>>> {
- return this.vtexHttpClient
- .performRequest('/api/logistics/pvt/shipping/calculate', this.HTTP_METHODS.POST, data);
+ calculateSLA(
+ data: Array
+ ): Promise>>> {
+ return this.vtexHttpClient.performRequest(
+ "/api/logistics/pvt/shipping/calculate",
+ this.HTTP_METHODS.POST,
+ data
+ );
}
}
diff --git a/src/modules/logistics/apis/SLA/index.ts b/src/modules/logistics/apis/SLA/index.ts
index 456ba76..5a1b5eb 100644
--- a/src/modules/logistics/apis/SLA/index.ts
+++ b/src/modules/logistics/apis/SLA/index.ts
@@ -1 +1 @@
-export * from './SLA';
+export * from "./SLA";
diff --git a/src/modules/logistics/apis/carriers/Carriers.ts b/src/modules/logistics/apis/carriers/Carriers.ts
index e343071..9adf1ee 100644
--- a/src/modules/logistics/apis/carriers/Carriers.ts
+++ b/src/modules/logistics/apis/carriers/Carriers.ts
@@ -1,26 +1,35 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { CreateOrUpdateCarrierRequest } from './requests/CreateOrUpdateCarrierRequest';
-import { ListAllCarriersResponseItem } from './responses/ListAllCarriersResponse';
-import { CreateOrUpdateFreightValuesRequestItem } from './requests/CreateOrUpdateFreightValuesRequestItem';
-import { ListFreightValuesResponseItem } from './responses/ListFreightValuesResponseItem';
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { CreateOrUpdateCarrierRequest } from "./requests/CreateOrUpdateCarrierRequest";
+import { ListAllCarriersResponseItem } from "./responses/ListAllCarriersResponse";
+import { CreateOrUpdateFreightValuesRequestItem } from "./requests/CreateOrUpdateFreightValuesRequestItem";
+import { ListFreightValuesResponseItem } from "./responses/ListFreightValuesResponseItem";
export class Carriers extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration';
+ private static readonly BASE_PATH: string =
+ "/api/logistics/pvt/configuration";
/**
* Creates or updates carriers in your store
* @param {CreateOrUpdateCarrierRequest} carrierData
*/
- createOrUpdateCarrier(carrierData: CreateOrUpdateCarrierRequest): Promise {
+ createOrUpdateCarrier(
+ carrierData: CreateOrUpdateCarrierRequest
+ ): Promise {
const path = `${Carriers.BASE_PATH}/carriers`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, carrierData);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ carrierData
+ );
}
/**
* Get information about all carriers in your store.
*/
- listAllCarriers(): Promise>> {
+ listAllCarriers(): Promise<
+ VtexHttpResponse>
+ > {
const path = `${Carriers.BASE_PATH}/carriers`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -29,7 +38,9 @@ export class Carriers extends AbstractApi {
* Lists information about your store's carriers by searching through the Carrier's ID.
* @param {string} carrierId
*/
- listCarrierByid(carrierId: string): Promise> {
+ listCarrierByid(
+ carrierId: string
+ ): Promise> {
const path = `${Carriers.BASE_PATH}/carriers/${carrierId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -48,10 +59,16 @@ export class Carriers extends AbstractApi {
* @param {string} carrierId
* @param {Array} freightValues
*/
- createOrUpdateFreightValues(carrierId: string,
- freightValues: Array): Promise {
+ createOrUpdateFreightValues(
+ carrierId: string,
+ freightValues: Array
+ ): Promise {
const path = `${Carriers.BASE_PATH}/freights/${carrierId}/values/update`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, freightValues);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ freightValues
+ );
}
/**
@@ -59,8 +76,10 @@ export class Carriers extends AbstractApi {
* @param {string} carrierId
* @param {string} cep
*/
- listFreightValues(carrierId: string, cep: string)
- : Promise>> {
+ listFreightValues(
+ carrierId: string,
+ cep: string
+ ): Promise>> {
const path = `${Carriers.BASE_PATH}/freights/${carrierId}/${cep}/values`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -79,10 +98,17 @@ export class Carriers extends AbstractApi {
* @param {string} carrierId
* @param {string} deliveryWindow
*/
- addBlockedDeliveryWindows(carrierId: string, deliveryWindow: string): Promise {
+ addBlockedDeliveryWindows(
+ carrierId: string,
+ deliveryWindow: string
+ ): Promise {
const path = `${Carriers.BASE_PATH}/carriers/${carrierId}/adddayofweekblocked`;
const body = `"${deliveryWindow}"`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, body);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ body
+ );
}
/**
@@ -90,11 +116,17 @@ export class Carriers extends AbstractApi {
* @param {string} carrierId
* @param {string} deliveryWindow
*/
- removeBlockedDeliveryWindows(carrierId: string, deliveryWindow: string)
- : Promise {
+ removeBlockedDeliveryWindows(
+ carrierId: string,
+ deliveryWindow: string
+ ): Promise {
const path = `${Carriers.BASE_PATH}/carriers/${carrierId}/removedayofweekblocked`;
const body = `"${deliveryWindow}"`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, body);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.POST,
+ body
+ );
}
/**
diff --git a/src/modules/logistics/apis/carriers/index.ts b/src/modules/logistics/apis/carriers/index.ts
index c06d681..d10eb73 100644
--- a/src/modules/logistics/apis/carriers/index.ts
+++ b/src/modules/logistics/apis/carriers/index.ts
@@ -1 +1 @@
-export * from './Carriers';
+export * from "./Carriers";
diff --git a/src/modules/logistics/apis/docks/Docks.ts b/src/modules/logistics/apis/docks/Docks.ts
index 705dd86..5c6b5a2 100644
--- a/src/modules/logistics/apis/docks/Docks.ts
+++ b/src/modules/logistics/apis/docks/Docks.ts
@@ -1,30 +1,42 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { CreateOrUpdateDockRequest } from './requests/CreateOrUpdateDockRequest';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { CreateOrUpdateDockRequest } from "./requests/CreateOrUpdateDockRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
export class Docks extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/docks';
+ private static readonly BASE_PATH: string =
+ "/api/logistics/pvt/configuration/docks";
/**
* Creates or updates docks to be used in your logistic operation.
* @param {CreateOrUpdateDockRequest} dock
*/
- createOrUpdateDock(dock: CreateOrUpdateDockRequest): Promise {
- return this.vtexHttpClient.performRequest(Docks.BASE_PATH, this.HTTP_METHODS.POST, dock);
+ createOrUpdateDock(
+ dock: CreateOrUpdateDockRequest
+ ): Promise {
+ return this.vtexHttpClient.performRequest(
+ Docks.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ dock
+ );
}
/**
* Informs a list of all docks.
*/
listAllDocks(): Promise>> {
- return this.vtexHttpClient.performRequest(Docks.BASE_PATH, this.HTTP_METHODS.GET);
+ return this.vtexHttpClient.performRequest(
+ Docks.BASE_PATH,
+ this.HTTP_METHODS.GET
+ );
}
/**
* Informs a given dock's information, searching by dock ID.
* @param {string} dockId
*/
- listDockById(dockId: string): Promise> {
+ listDockById(
+ dockId: string
+ ): Promise> {
const path = `${Docks.BASE_PATH}/${dockId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
diff --git a/src/modules/logistics/apis/docks/index.ts b/src/modules/logistics/apis/docks/index.ts
index 079331c..fb8dba7 100644
--- a/src/modules/logistics/apis/docks/index.ts
+++ b/src/modules/logistics/apis/docks/index.ts
@@ -1 +1 @@
-export * from './Docks';
+export * from "./Docks";
diff --git a/src/modules/logistics/apis/holidays/Holidays.ts b/src/modules/logistics/apis/holidays/Holidays.ts
index 29e4ba6..d2757ba 100644
--- a/src/modules/logistics/apis/holidays/Holidays.ts
+++ b/src/modules/logistics/apis/holidays/Holidays.ts
@@ -1,19 +1,26 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { CreateOrUpdateHolidayRequest } from './requests/CreateOrUpdateHolidayRequest';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { CreateOrUpdateHolidayRequest } from "./requests/CreateOrUpdateHolidayRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
export class Holidays extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/holidays';
+ private static readonly BASE_PATH: string =
+ "/api/logistics/pvt/configuration/holidays";
/**
* Creates or updates holidays through holiday ID.
* @param {string} holidayId
* @param {string} holidayData
*/
- createOrUpdateHoliday(holidayId: string, holidayData: CreateOrUpdateHolidayRequest)
- : Promise {
+ createOrUpdateHoliday(
+ holidayId: string,
+ holidayData: CreateOrUpdateHolidayRequest
+ ): Promise {
const path = `${Holidays.BASE_PATH}/${holidayId}`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, holidayData);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ holidayData
+ );
}
/**
@@ -38,6 +45,9 @@ export class Holidays extends AbstractApi {
* Lists information of all holidays.
*/
listAllHolidays(): Promise {
- return this.vtexHttpClient.performRequest(Holidays.BASE_PATH, this.HTTP_METHODS.GET);
+ return this.vtexHttpClient.performRequest(
+ Holidays.BASE_PATH,
+ this.HTTP_METHODS.GET
+ );
}
}
diff --git a/src/modules/logistics/apis/holidays/index.ts b/src/modules/logistics/apis/holidays/index.ts
index 8f7ef59..39eeaba 100644
--- a/src/modules/logistics/apis/holidays/index.ts
+++ b/src/modules/logistics/apis/holidays/index.ts
@@ -1 +1 @@
-export * from './Holidays';
+export * from "./Holidays";
diff --git a/src/modules/logistics/apis/inventory/Inventory.ts b/src/modules/logistics/apis/inventory/Inventory.ts
index 88e0273..043146d 100644
--- a/src/modules/logistics/apis/inventory/Inventory.ts
+++ b/src/modules/logistics/apis/inventory/Inventory.ts
@@ -1,17 +1,19 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { ListInventoryBySkuResponse } from './responses/ListInventoryBySkuResponse';
-import { ListInventoryWithDispatchedReservationsResponse } from './responses/ListInventoryWithDispatchedReservationsResponse';
-import { UpdateInventoryBySkuAndWarehouseRequest } from './requests/UpdateInventoryBySkuAndWarehouseRequest';
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { ListInventoryBySkuResponse } from "./responses/ListInventoryBySkuResponse";
+import { ListInventoryWithDispatchedReservationsResponse } from "./responses/ListInventoryWithDispatchedReservationsResponse";
+import { UpdateInventoryBySkuAndWarehouseRequest } from "./requests/UpdateInventoryBySkuAndWarehouseRequest";
export class Inventory extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/logistics/pvt/inventory';
+ private static readonly BASE_PATH: string = "/api/logistics/pvt/inventory";
/**
* Lists your store's inventory by SKU ID
* @param {string} skuId
*/
- listInventoryBySku(skuId: string): Promise> {
+ listInventoryBySku(
+ skuId: string
+ ): Promise> {
const path = `${Inventory.BASE_PATH}/skus/${skuId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -21,7 +23,10 @@ export class Inventory extends AbstractApi {
* @param {string} skuId
* @param {string} warehouseId
*/
- listInventoryPerWarehouse(skuId: string, warehouseId: string): Promise {
+ listInventoryPerWarehouse(
+ skuId: string,
+ warehouseId: string
+ ): Promise {
const path = `${Inventory.BASE_PATH}/items/${skuId}/warehouses/${warehouseId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -31,7 +36,10 @@ export class Inventory extends AbstractApi {
* @param {string} skuId
* @param {string} dockId
*/
- listInventoryPerDock(skuId: string, dockId: string): Promise {
+ listInventoryPerDock(
+ skuId: string,
+ dockId: string
+ ): Promise {
const path = `${Inventory.BASE_PATH}/items/${skuId}/docks/${dockId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -42,8 +50,11 @@ export class Inventory extends AbstractApi {
* @param {string} dockId
* @param {string} warehouseId
*/
- listInventoryPerDockAndWarehouse(skuId: string, dockId: string, warehouseId: string)
- : Promise {
+ listInventoryPerDockAndWarehouse(
+ skuId: string,
+ dockId: string,
+ warehouseId: string
+ ): Promise {
const path = `${Inventory.BASE_PATH}/items/${skuId}/docks/${dockId}/warehouses/${warehouseId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -56,8 +67,12 @@ export class Inventory extends AbstractApi {
* @param {string} itemId
* @param {string} warehouseId
*/
- listInventoryWithDispatchedReservations(itemId: string, warehouseId: string)
- : Promise> {
+ listInventoryWithDispatchedReservations(
+ itemId: string,
+ warehouseId: string
+ ): Promise<
+ VtexHttpResponse
+ > {
const path = `${Inventory.BASE_PATH}/items/${itemId}/warehouses/${warehouseId}/dispatched`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -68,9 +83,16 @@ export class Inventory extends AbstractApi {
* @param {string} warehouseId
* @param {UpdateInventoryBySkuAndWarehouseRequest} inventoryData
*/
- updateInventoryBySkuAndWarehouse(skuId: string, warehouseId: string,
- inventoryData: UpdateInventoryBySkuAndWarehouseRequest): Promise {
+ updateInventoryBySkuAndWarehouse(
+ skuId: string,
+ warehouseId: string,
+ inventoryData: UpdateInventoryBySkuAndWarehouseRequest
+ ): Promise {
const path = `${Inventory.BASE_PATH}/skus/${skuId}/warehouses/${warehouseId}/dispatched`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, inventoryData);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ inventoryData
+ );
}
}
diff --git a/src/modules/logistics/apis/inventory/index.ts b/src/modules/logistics/apis/inventory/index.ts
index 4f98980..1ba1871 100644
--- a/src/modules/logistics/apis/inventory/index.ts
+++ b/src/modules/logistics/apis/inventory/index.ts
@@ -1 +1 @@
-export * from './Inventory';
+export * from "./Inventory";
diff --git a/src/modules/logistics/apis/pickup-points/PickupPoints.ts b/src/modules/logistics/apis/pickup-points/PickupPoints.ts
index 82efb7f..d460848 100644
--- a/src/modules/logistics/apis/pickup-points/PickupPoints.ts
+++ b/src/modules/logistics/apis/pickup-points/PickupPoints.ts
@@ -1,28 +1,35 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { CreateOrUpdatePickupPointRequest } from './requests/CreateOrUpdatePickupPointRequest';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { CreateOrUpdatePickupPointRequest } from "./requests/CreateOrUpdatePickupPointRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
export class PickupPoints extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/pickuppoints';
+ private static readonly BASE_PATH: string =
+ "/api/logistics/pvt/configuration/pickuppoints";
/**
* Creates or updates pickup points in your store by Pickup Point ID.
* @param {string} pickupPointId
* @param {CreateOrUpdatePickupPointRequest} pickupPointData
*/
- createOrUpdatePickupPoint(pickupPointId: string,
- pickupPointData: CreateOrUpdatePickupPointRequest)
- : Promise> {
+ createOrUpdatePickupPoint(
+ pickupPointId: string,
+ pickupPointData: CreateOrUpdatePickupPointRequest
+ ): Promise> {
const path = `${PickupPoints.BASE_PATH}/${pickupPointId}`;
- return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, pickupPointData);
+ return this.vtexHttpClient.performRequest(
+ path,
+ this.HTTP_METHODS.PUT,
+ pickupPointData
+ );
}
/**
* Lists your store's pickup points while searching by ID.
* @param {string} pickupPointId
*/
- listPickupPointById(pickupPointId: string)
- : Promise> {
+ listPickupPointById(
+ pickupPointId: string
+ ): Promise> {
const path = `${PickupPoints.BASE_PATH}/${pickupPointId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
diff --git a/src/modules/logistics/apis/pickup-points/index.ts b/src/modules/logistics/apis/pickup-points/index.ts
index 3ba301f..06d4358 100644
--- a/src/modules/logistics/apis/pickup-points/index.ts
+++ b/src/modules/logistics/apis/pickup-points/index.ts
@@ -1 +1 @@
-export * from './PickupPoints';
+export * from "./PickupPoints";
diff --git a/src/modules/logistics/apis/polygons/Polygons.ts b/src/modules/logistics/apis/polygons/Polygons.ts
index 5054d9d..73ee14d 100644
--- a/src/modules/logistics/apis/polygons/Polygons.ts
+++ b/src/modules/logistics/apis/polygons/Polygons.ts
@@ -1,9 +1,10 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { CreateOrUpdatePolygonRequest } from './requests/CreateOrUpdatePolygonRequest';
+import { AbstractApi } from "../../../AbstractApi";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { CreateOrUpdatePolygonRequest } from "./requests/CreateOrUpdatePolygonRequest";
export class Polygons extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/geoshape';
+ private static readonly BASE_PATH: string =
+ "/api/logistics/pvt/configuration/geoshape";
/**
* Lists stored polygons.
@@ -19,9 +20,14 @@ export class Polygons extends AbstractApi {
* Creates or updates your store's polygons by geoshape coordinates and polygon name.
* @param {CreateOrUpdatePolygonRequest} polygonData
*/
- createOrUpdatePolygon(polygonData: CreateOrUpdatePolygonRequest): Promise {
- return this.vtexHttpClient
- .performRequest(Polygons.BASE_PATH, this.HTTP_METHODS.PUT, polygonData);
+ createOrUpdatePolygon(
+ polygonData: CreateOrUpdatePolygonRequest
+ ): Promise {
+ return this.vtexHttpClient.performRequest(
+ Polygons.BASE_PATH,
+ this.HTTP_METHODS.PUT,
+ polygonData
+ );
}
/**
diff --git a/src/modules/logistics/apis/polygons/index.ts b/src/modules/logistics/apis/polygons/index.ts
index 1eedf7b..024dc93 100644
--- a/src/modules/logistics/apis/polygons/index.ts
+++ b/src/modules/logistics/apis/polygons/index.ts
@@ -1 +1 @@
-export * from './Polygons';
+export * from "./Polygons";
diff --git a/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts b/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts
index f84e863..cfa4963 100644
--- a/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts
+++ b/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts
@@ -1,5 +1,5 @@
interface GeoShape {
- coordinates?: Array>>
+ coordinates?: Array>>;
}
export interface CreateOrUpdatePolygonRequest {
diff --git a/src/modules/logistics/apis/reservations/Reservations.ts b/src/modules/logistics/apis/reservations/Reservations.ts
index 36679fd..acec67f 100644
--- a/src/modules/logistics/apis/reservations/Reservations.ts
+++ b/src/modules/logistics/apis/reservations/Reservations.ts
@@ -1,26 +1,33 @@
-import { AbstractApi } from '../../../AbstractApi';
-import { CreateReservationRequest } from './requests/CreateReservationRequest';
-import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse';
-import { CreateReservationResponse } from './responses/CreateReservationResponse';
+import { AbstractApi } from "../../../AbstractApi";
+import { CreateReservationRequest } from "./requests/CreateReservationRequest";
+import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse";
+import { CreateReservationResponse } from "./responses/CreateReservationResponse";
export class Reservations extends AbstractApi {
- private static readonly BASE_PATH: string = '/api/logistics/pvt/inventory/reservations';
+ private static readonly BASE_PATH: string =
+ "/api/logistics/pvt/inventory/reservations";
/**
* Creates reservation
* @param {CreateReservationRequest} reservation
*/
- createReservation(reservation: CreateReservationRequest)
- : Promise> {
- return this.vtexHttpClient
- .performRequest(Reservations.BASE_PATH, this.HTTP_METHODS.POST, reservation);
+ createReservation(
+ reservation: CreateReservationRequest
+ ): Promise> {
+ return this.vtexHttpClient.performRequest(
+ Reservations.BASE_PATH,
+ this.HTTP_METHODS.POST,
+ reservation
+ );
}
/**
* Lists reservation's information by ID.
* @param {string} reservationId
*/
- listReservationById(reservationId: string): Promise> {
+ listReservationById(
+ reservationId: string
+ ): Promise> {
const path = `${Reservations.BASE_PATH}/${reservationId}`;
return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET);
}
@@ -57,7 +64,10 @@ export class Reservations extends AbstractApi {
* @param {string} warehouseId
* @param {string} skuId
*/
- listReservationByWarehouseAndSku(warehouseId: string, skuId: string): Promise