@lehaotech/walmart-mcp 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +25 -0
- package/CHANGELOG.md +247 -0
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/build/api/advertising/ad-client.d.ts +24 -0
- package/build/api/advertising/ad-client.js +174 -0
- package/build/api/advertising/advertising-api.d.ts +50 -0
- package/build/api/advertising/advertising-api.js +89 -0
- package/build/api/client.d.ts +19 -0
- package/build/api/client.js +150 -0
- package/build/api/feeds/feeds-api.d.ts +15 -0
- package/build/api/feeds/feeds-api.js +53 -0
- package/build/api/fulfillment/fulfillment-api.d.ts +37 -0
- package/build/api/fulfillment/fulfillment-api.js +81 -0
- package/build/api/index.d.ts +44 -0
- package/build/api/index.js +56 -0
- package/build/api/inventory/inventory-api.d.ts +27 -0
- package/build/api/inventory/inventory-api.js +49 -0
- package/build/api/items/items-api.d.ts +33 -0
- package/build/api/items/items-api.js +67 -0
- package/build/api/notifications/notifications-api.d.ts +14 -0
- package/build/api/notifications/notifications-api.js +33 -0
- package/build/api/orders/orders-api.d.ts +32 -0
- package/build/api/orders/orders-api.js +47 -0
- package/build/api/pricing/pricing-api.d.ts +32 -0
- package/build/api/pricing/pricing-api.js +60 -0
- package/build/api/reports/reports-api.d.ts +37 -0
- package/build/api/reports/reports-api.js +51 -0
- package/build/api/returns/returns-api.d.ts +26 -0
- package/build/api/returns/returns-api.js +37 -0
- package/build/api/settings/settings-api.d.ts +9 -0
- package/build/api/settings/settings-api.js +21 -0
- package/build/auth/oauth.d.ts +16 -0
- package/build/auth/oauth.js +125 -0
- package/build/config/environment.d.ts +22 -0
- package/build/config/environment.js +50 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +180 -0
- package/build/scripts/client-configs.d.ts +36 -0
- package/build/scripts/client-configs.js +132 -0
- package/build/scripts/diagnose.d.ts +15 -0
- package/build/scripts/diagnose.js +320 -0
- package/build/scripts/setup.d.ts +17 -0
- package/build/scripts/setup.js +276 -0
- package/build/tools/definitions/advertising.d.ts +664 -0
- package/build/tools/definitions/advertising.js +315 -0
- package/build/tools/definitions/discovery.d.ts +24 -0
- package/build/tools/definitions/discovery.js +65 -0
- package/build/tools/definitions/feeds.d.ts +46 -0
- package/build/tools/definitions/feeds.js +42 -0
- package/build/tools/definitions/fulfillment.d.ts +1127 -0
- package/build/tools/definitions/fulfillment.js +272 -0
- package/build/tools/definitions/inventory.d.ts +392 -0
- package/build/tools/definitions/inventory.js +182 -0
- package/build/tools/definitions/items.d.ts +447 -0
- package/build/tools/definitions/items.js +223 -0
- package/build/tools/definitions/notifications.d.ts +84 -0
- package/build/tools/definitions/notifications.js +73 -0
- package/build/tools/definitions/orders.d.ts +2659 -0
- package/build/tools/definitions/orders.js +298 -0
- package/build/tools/definitions/pricing.d.ts +724 -0
- package/build/tools/definitions/pricing.js +254 -0
- package/build/tools/definitions/reports.d.ts +223 -0
- package/build/tools/definitions/reports.js +144 -0
- package/build/tools/definitions/returns.d.ts +441 -0
- package/build/tools/definitions/returns.js +126 -0
- package/build/tools/definitions/settings.d.ts +100 -0
- package/build/tools/definitions/settings.js +52 -0
- package/build/tools/definitions/shared-schemas.d.ts +40 -0
- package/build/tools/definitions/shared-schemas.js +47 -0
- package/build/tools/definitions/token-management.d.ts +16 -0
- package/build/tools/definitions/token-management.js +41 -0
- package/build/tools/index.d.ts +6924 -0
- package/build/tools/index.js +379 -0
- package/build/utils/api-error.d.ts +41 -0
- package/build/utils/api-error.js +97 -0
- package/build/utils/endpoint-catalog.d.ts +22 -0
- package/build/utils/endpoint-catalog.js +89 -0
- package/build/utils/env-file.d.ts +12 -0
- package/build/utils/env-file.js +27 -0
- package/build/utils/known-issues.d.ts +29 -0
- package/build/utils/known-issues.js +122 -0
- package/build/utils/logger.d.ts +15 -0
- package/build/utils/logger.js +56 -0
- package/build/utils/rate-limiter.d.ts +51 -0
- package/build/utils/rate-limiter.js +109 -0
- package/package.json +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type WalmartConfig } from '../config/environment.js';
|
|
2
|
+
import { WalmartApiClient } from './client.js';
|
|
3
|
+
import { WalmartOAuthClient } from '../auth/oauth.js';
|
|
4
|
+
import { ItemsApi } from './items/items-api.js';
|
|
5
|
+
import { InventoryApi } from './inventory/inventory-api.js';
|
|
6
|
+
import { OrdersApi } from './orders/orders-api.js';
|
|
7
|
+
import { PricingApi } from './pricing/pricing-api.js';
|
|
8
|
+
import { FeedsApi } from './feeds/feeds-api.js';
|
|
9
|
+
import { FulfillmentApi } from './fulfillment/fulfillment-api.js';
|
|
10
|
+
import { ReturnsApi } from './returns/returns-api.js';
|
|
11
|
+
import { ReportsApi } from './reports/reports-api.js';
|
|
12
|
+
import { NotificationsApi } from './notifications/notifications-api.js';
|
|
13
|
+
import { AdvertisingApi } from './advertising/advertising-api.js';
|
|
14
|
+
import { SettingsApi } from './settings/settings-api.js';
|
|
15
|
+
export declare class WalmartSellerApi {
|
|
16
|
+
private client;
|
|
17
|
+
auth: WalmartOAuthClient;
|
|
18
|
+
items: ItemsApi;
|
|
19
|
+
inventory: InventoryApi;
|
|
20
|
+
orders: OrdersApi;
|
|
21
|
+
pricing: PricingApi;
|
|
22
|
+
feeds: FeedsApi;
|
|
23
|
+
fulfillment: FulfillmentApi;
|
|
24
|
+
returns: ReturnsApi;
|
|
25
|
+
reports: ReportsApi;
|
|
26
|
+
notifications: NotificationsApi;
|
|
27
|
+
advertising: AdvertisingApi;
|
|
28
|
+
settings: SettingsApi;
|
|
29
|
+
constructor(config: WalmartConfig);
|
|
30
|
+
initialize(): Promise<void>;
|
|
31
|
+
/** Snapshot the rate limiter state for the walmart_get_rate_budget tool. */
|
|
32
|
+
getRateLimiterStatus(): {
|
|
33
|
+
name: string;
|
|
34
|
+
localMaxRequests: number;
|
|
35
|
+
localWindowMs: number;
|
|
36
|
+
localCurrentCount: number;
|
|
37
|
+
localRemaining: number;
|
|
38
|
+
serverTokensRemaining: number | null;
|
|
39
|
+
serverReplenishTime: string | null;
|
|
40
|
+
serverTokensSeenAt: string | null;
|
|
41
|
+
};
|
|
42
|
+
/** Expose the marketplace client for the walmart_call_endpoint discovery tool. */
|
|
43
|
+
getMarketplaceClient(): WalmartApiClient;
|
|
44
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { WalmartApiClient } from './client.js';
|
|
2
|
+
import { ItemsApi } from './items/items-api.js';
|
|
3
|
+
import { InventoryApi } from './inventory/inventory-api.js';
|
|
4
|
+
import { OrdersApi } from './orders/orders-api.js';
|
|
5
|
+
import { PricingApi } from './pricing/pricing-api.js';
|
|
6
|
+
import { FeedsApi } from './feeds/feeds-api.js';
|
|
7
|
+
import { FulfillmentApi } from './fulfillment/fulfillment-api.js';
|
|
8
|
+
import { ReturnsApi } from './returns/returns-api.js';
|
|
9
|
+
import { ReportsApi } from './reports/reports-api.js';
|
|
10
|
+
import { NotificationsApi } from './notifications/notifications-api.js';
|
|
11
|
+
import { WalmartAdClient } from './advertising/ad-client.js';
|
|
12
|
+
import { AdvertisingApi } from './advertising/advertising-api.js';
|
|
13
|
+
import { SettingsApi } from './settings/settings-api.js';
|
|
14
|
+
export class WalmartSellerApi {
|
|
15
|
+
client;
|
|
16
|
+
auth;
|
|
17
|
+
items;
|
|
18
|
+
inventory;
|
|
19
|
+
orders;
|
|
20
|
+
pricing;
|
|
21
|
+
feeds;
|
|
22
|
+
fulfillment;
|
|
23
|
+
returns;
|
|
24
|
+
reports;
|
|
25
|
+
notifications;
|
|
26
|
+
advertising;
|
|
27
|
+
settings;
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.client = new WalmartApiClient(config);
|
|
30
|
+
this.auth = this.client.getAuthClient();
|
|
31
|
+
this.items = new ItemsApi(this.client);
|
|
32
|
+
this.inventory = new InventoryApi(this.client);
|
|
33
|
+
this.orders = new OrdersApi(this.client);
|
|
34
|
+
this.pricing = new PricingApi(this.client);
|
|
35
|
+
this.feeds = new FeedsApi(this.client);
|
|
36
|
+
this.fulfillment = new FulfillmentApi(this.client);
|
|
37
|
+
this.returns = new ReturnsApi(this.client);
|
|
38
|
+
this.reports = new ReportsApi(this.client);
|
|
39
|
+
this.notifications = new NotificationsApi(this.client);
|
|
40
|
+
this.settings = new SettingsApi(this.client);
|
|
41
|
+
// Advertising uses a separate HTTP client with different auth
|
|
42
|
+
const adClient = new WalmartAdClient(config);
|
|
43
|
+
this.advertising = new AdvertisingApi(adClient);
|
|
44
|
+
}
|
|
45
|
+
async initialize() {
|
|
46
|
+
await this.client.initialize();
|
|
47
|
+
}
|
|
48
|
+
/** Snapshot the rate limiter state for the walmart_get_rate_budget tool. */
|
|
49
|
+
getRateLimiterStatus() {
|
|
50
|
+
return this.client.getRateLimiter().getStatus();
|
|
51
|
+
}
|
|
52
|
+
/** Expose the marketplace client for the walmart_call_endpoint discovery tool. */
|
|
53
|
+
getMarketplaceClient() {
|
|
54
|
+
return this.client;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class InventoryApi {
|
|
3
|
+
private client;
|
|
4
|
+
private basePath;
|
|
5
|
+
constructor(client: WalmartApiClient);
|
|
6
|
+
getInventory(sku: string): Promise<unknown>;
|
|
7
|
+
updateInventory(data: {
|
|
8
|
+
sku: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
shipNode?: string;
|
|
11
|
+
}): Promise<unknown>;
|
|
12
|
+
getInventoryAllNodes(sku: string): Promise<unknown>;
|
|
13
|
+
updateInventoryMultiNode(sku: string, data: object): Promise<unknown>;
|
|
14
|
+
getAllInventory(params?: {
|
|
15
|
+
limit?: number;
|
|
16
|
+
offset?: string;
|
|
17
|
+
shipNode?: string;
|
|
18
|
+
}): Promise<unknown>;
|
|
19
|
+
submitInventoryFeed(data: object): Promise<unknown>;
|
|
20
|
+
submitMultiNodeInventoryFeed(data: object): Promise<unknown>;
|
|
21
|
+
getLagTime(sku: string): Promise<unknown>;
|
|
22
|
+
updateLagTime(data: {
|
|
23
|
+
sku: string;
|
|
24
|
+
fulfillmentLagTime: number;
|
|
25
|
+
}): Promise<unknown>;
|
|
26
|
+
submitLagTimeFeed(data: object): Promise<unknown>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export class InventoryApi {
|
|
2
|
+
client;
|
|
3
|
+
basePath = '/v3';
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
async getInventory(sku) {
|
|
8
|
+
if (!sku)
|
|
9
|
+
throw new Error('SKU is required');
|
|
10
|
+
return await this.client.get(`${this.basePath}/inventory`, { sku });
|
|
11
|
+
}
|
|
12
|
+
async updateInventory(data) {
|
|
13
|
+
if (!data.sku)
|
|
14
|
+
throw new Error('SKU is required');
|
|
15
|
+
return await this.client.put(`${this.basePath}/inventory`, data);
|
|
16
|
+
}
|
|
17
|
+
async getInventoryAllNodes(sku) {
|
|
18
|
+
if (!sku)
|
|
19
|
+
throw new Error('SKU is required');
|
|
20
|
+
return await this.client.get(`${this.basePath}/inventories/${encodeURIComponent(sku)}`);
|
|
21
|
+
}
|
|
22
|
+
async updateInventoryMultiNode(sku, data) {
|
|
23
|
+
if (!sku)
|
|
24
|
+
throw new Error('SKU is required');
|
|
25
|
+
return await this.client.put(`${this.basePath}/inventories/${encodeURIComponent(sku)}`, data);
|
|
26
|
+
}
|
|
27
|
+
async getAllInventory(params) {
|
|
28
|
+
return await this.client.get(`${this.basePath}/inventories`, params);
|
|
29
|
+
}
|
|
30
|
+
async submitInventoryFeed(data) {
|
|
31
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=inventory`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
32
|
+
}
|
|
33
|
+
async submitMultiNodeInventoryFeed(data) {
|
|
34
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=MP_INVENTORY`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
35
|
+
}
|
|
36
|
+
async getLagTime(sku) {
|
|
37
|
+
if (!sku)
|
|
38
|
+
throw new Error('SKU is required');
|
|
39
|
+
return await this.client.get(`${this.basePath}/lagtime`, { sku });
|
|
40
|
+
}
|
|
41
|
+
async updateLagTime(data) {
|
|
42
|
+
if (!data.sku)
|
|
43
|
+
throw new Error('SKU is required');
|
|
44
|
+
return await this.client.put(`${this.basePath}/lagtime`, data);
|
|
45
|
+
}
|
|
46
|
+
async submitLagTimeFeed(data) {
|
|
47
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=LAGTIME`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class ItemsApi {
|
|
3
|
+
private client;
|
|
4
|
+
private basePath;
|
|
5
|
+
constructor(client: WalmartApiClient);
|
|
6
|
+
getAllItems(params?: {
|
|
7
|
+
limit?: number;
|
|
8
|
+
offset?: string;
|
|
9
|
+
lifecycleStatus?: string;
|
|
10
|
+
publishedStatus?: string;
|
|
11
|
+
sku?: string;
|
|
12
|
+
}): Promise<unknown>;
|
|
13
|
+
getItem(sku: string): Promise<unknown>;
|
|
14
|
+
retireItem(sku: string): Promise<unknown>;
|
|
15
|
+
bulkRetireItems(data: {
|
|
16
|
+
sku: string;
|
|
17
|
+
}[]): Promise<unknown>;
|
|
18
|
+
getItemCount(params?: {
|
|
19
|
+
status?: string;
|
|
20
|
+
lifecycleStatus?: string;
|
|
21
|
+
publishedStatus?: string;
|
|
22
|
+
}): Promise<unknown>;
|
|
23
|
+
getTaxonomy(): Promise<unknown>;
|
|
24
|
+
getItemSpec(params: {
|
|
25
|
+
productType: string;
|
|
26
|
+
version?: string;
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
submitItemFeed(data: object): Promise<unknown>;
|
|
29
|
+
submitItemUpdateFeed(data: object): Promise<unknown>;
|
|
30
|
+
submitWfsItemFeed(data: object): Promise<unknown>;
|
|
31
|
+
convertToWfs(data: object): Promise<unknown>;
|
|
32
|
+
getHazmatItems(data?: object): Promise<unknown>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export class ItemsApi {
|
|
2
|
+
client;
|
|
3
|
+
basePath = '/v3';
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
async getAllItems(params) {
|
|
8
|
+
const query = {};
|
|
9
|
+
if (params?.limit)
|
|
10
|
+
query.limit = params.limit;
|
|
11
|
+
if (params?.offset)
|
|
12
|
+
query.offset = params.offset;
|
|
13
|
+
if (params?.lifecycleStatus)
|
|
14
|
+
query.lifecycleStatus = params.lifecycleStatus;
|
|
15
|
+
if (params?.publishedStatus)
|
|
16
|
+
query.publishedStatus = params.publishedStatus;
|
|
17
|
+
if (params?.sku)
|
|
18
|
+
query.sku = params.sku;
|
|
19
|
+
return await this.client.get(`${this.basePath}/items`, query);
|
|
20
|
+
}
|
|
21
|
+
async getItem(sku) {
|
|
22
|
+
if (!sku)
|
|
23
|
+
throw new Error('SKU is required');
|
|
24
|
+
return await this.client.get(`${this.basePath}/items/${encodeURIComponent(sku)}`);
|
|
25
|
+
}
|
|
26
|
+
async retireItem(sku) {
|
|
27
|
+
if (!sku)
|
|
28
|
+
throw new Error('SKU is required');
|
|
29
|
+
return await this.client.delete(`${this.basePath}/items/${encodeURIComponent(sku)}`);
|
|
30
|
+
}
|
|
31
|
+
async bulkRetireItems(data) {
|
|
32
|
+
if (!data?.length)
|
|
33
|
+
throw new Error('At least one SKU is required');
|
|
34
|
+
return await this.client.post(`${this.basePath}/items/retire`, { skus: data });
|
|
35
|
+
}
|
|
36
|
+
async getItemCount(params) {
|
|
37
|
+
// `status` is mandatory on /v3/items/count (item statuses in CSV, e.g.
|
|
38
|
+
// PUBLISHED, UNPUBLISHED). Default to PUBLISHED when not supplied.
|
|
39
|
+
const query = { status: 'PUBLISHED', ...params };
|
|
40
|
+
return await this.client.get(`${this.basePath}/items/count`, query);
|
|
41
|
+
}
|
|
42
|
+
async getTaxonomy() {
|
|
43
|
+
return await this.client.get(`${this.basePath}/taxonomy`);
|
|
44
|
+
}
|
|
45
|
+
async getItemSpec(params) {
|
|
46
|
+
if (!params.productType)
|
|
47
|
+
throw new Error('productType is required');
|
|
48
|
+
return await this.client.get(`${this.basePath}/items/spec`, params);
|
|
49
|
+
}
|
|
50
|
+
async submitItemFeed(data) {
|
|
51
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=item`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
52
|
+
}
|
|
53
|
+
async submitItemUpdateFeed(data) {
|
|
54
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=MP_MAINTENANCE`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
55
|
+
}
|
|
56
|
+
async submitWfsItemFeed(data) {
|
|
57
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=MP_WFS_ITEM`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
58
|
+
}
|
|
59
|
+
async convertToWfs(data) {
|
|
60
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=OMNI_WFS`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
61
|
+
}
|
|
62
|
+
async getHazmatItems(data) {
|
|
63
|
+
// Hazmat compliance "on hold" items are retrieved via the on-hold search
|
|
64
|
+
// endpoint (POST). The previous `/v3/items/hazmat` path does not exist (405).
|
|
65
|
+
return await this.client.post(`${this.basePath}/items/onhold/search`, data ?? {});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class NotificationsApi {
|
|
3
|
+
private client;
|
|
4
|
+
private basePath;
|
|
5
|
+
constructor(client: WalmartApiClient);
|
|
6
|
+
createSubscription(data: object): Promise<unknown>;
|
|
7
|
+
getSubscriptions(params?: {
|
|
8
|
+
eventType?: string;
|
|
9
|
+
}): Promise<unknown>;
|
|
10
|
+
getSubscription(subscriptionId: string): Promise<unknown>;
|
|
11
|
+
updateSubscription(subscriptionId: string, data: object): Promise<unknown>;
|
|
12
|
+
deleteSubscription(subscriptionId: string): Promise<unknown>;
|
|
13
|
+
testSubscription(subscriptionId: string): Promise<unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class NotificationsApi {
|
|
2
|
+
client;
|
|
3
|
+
basePath = '/v3/notifications/subscriptions';
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
async createSubscription(data) {
|
|
8
|
+
return await this.client.post(this.basePath, data);
|
|
9
|
+
}
|
|
10
|
+
async getSubscriptions(params) {
|
|
11
|
+
return await this.client.get(this.basePath, params);
|
|
12
|
+
}
|
|
13
|
+
async getSubscription(subscriptionId) {
|
|
14
|
+
if (!subscriptionId)
|
|
15
|
+
throw new Error('subscriptionId is required');
|
|
16
|
+
return await this.client.get(`${this.basePath}/${encodeURIComponent(subscriptionId)}`);
|
|
17
|
+
}
|
|
18
|
+
async updateSubscription(subscriptionId, data) {
|
|
19
|
+
if (!subscriptionId)
|
|
20
|
+
throw new Error('subscriptionId is required');
|
|
21
|
+
return await this.client.put(`${this.basePath}/${encodeURIComponent(subscriptionId)}`, data);
|
|
22
|
+
}
|
|
23
|
+
async deleteSubscription(subscriptionId) {
|
|
24
|
+
if (!subscriptionId)
|
|
25
|
+
throw new Error('subscriptionId is required');
|
|
26
|
+
return await this.client.delete(`${this.basePath}/${encodeURIComponent(subscriptionId)}`);
|
|
27
|
+
}
|
|
28
|
+
async testSubscription(subscriptionId) {
|
|
29
|
+
if (!subscriptionId)
|
|
30
|
+
throw new Error('subscriptionId is required');
|
|
31
|
+
return await this.client.post(`${this.basePath}/${encodeURIComponent(subscriptionId)}/test`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class OrdersApi {
|
|
3
|
+
private client;
|
|
4
|
+
private basePath;
|
|
5
|
+
constructor(client: WalmartApiClient);
|
|
6
|
+
getAllOrders(params?: {
|
|
7
|
+
limit?: number;
|
|
8
|
+
offset?: string;
|
|
9
|
+
status?: string;
|
|
10
|
+
createdStartDate?: string;
|
|
11
|
+
createdEndDate?: string;
|
|
12
|
+
customerOrderId?: string;
|
|
13
|
+
purchaseOrderId?: string;
|
|
14
|
+
sku?: string;
|
|
15
|
+
shipNode?: string;
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
getReleasedOrders(params?: {
|
|
18
|
+
limit?: number;
|
|
19
|
+
offset?: string;
|
|
20
|
+
createdStartDate?: string;
|
|
21
|
+
createdEndDate?: string;
|
|
22
|
+
shipNode?: string;
|
|
23
|
+
}): Promise<unknown>;
|
|
24
|
+
getOrder(purchaseOrderId: string): Promise<unknown>;
|
|
25
|
+
acknowledgeOrder(purchaseOrderId: string): Promise<unknown>;
|
|
26
|
+
shipOrder(purchaseOrderId: string, data: object): Promise<unknown>;
|
|
27
|
+
cancelOrder(purchaseOrderId: string, data: object): Promise<unknown>;
|
|
28
|
+
refundOrder(purchaseOrderId: string, data: object): Promise<unknown>;
|
|
29
|
+
getShippingCarriers(): Promise<unknown>;
|
|
30
|
+
createShippingLabel(data: object): Promise<unknown>;
|
|
31
|
+
getShippingEstimate(params: object): Promise<unknown>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export class OrdersApi {
|
|
2
|
+
client;
|
|
3
|
+
basePath = '/v3/orders';
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
async getAllOrders(params) {
|
|
8
|
+
return await this.client.get(this.basePath, params);
|
|
9
|
+
}
|
|
10
|
+
async getReleasedOrders(params) {
|
|
11
|
+
return await this.client.get(`${this.basePath}/released`, params);
|
|
12
|
+
}
|
|
13
|
+
async getOrder(purchaseOrderId) {
|
|
14
|
+
if (!purchaseOrderId)
|
|
15
|
+
throw new Error('purchaseOrderId is required');
|
|
16
|
+
return await this.client.get(`${this.basePath}/${encodeURIComponent(purchaseOrderId)}`);
|
|
17
|
+
}
|
|
18
|
+
async acknowledgeOrder(purchaseOrderId) {
|
|
19
|
+
if (!purchaseOrderId)
|
|
20
|
+
throw new Error('purchaseOrderId is required');
|
|
21
|
+
return await this.client.post(`${this.basePath}/${encodeURIComponent(purchaseOrderId)}/acknowledge`);
|
|
22
|
+
}
|
|
23
|
+
async shipOrder(purchaseOrderId, data) {
|
|
24
|
+
if (!purchaseOrderId)
|
|
25
|
+
throw new Error('purchaseOrderId is required');
|
|
26
|
+
return await this.client.post(`${this.basePath}/${encodeURIComponent(purchaseOrderId)}/shipping`, data);
|
|
27
|
+
}
|
|
28
|
+
async cancelOrder(purchaseOrderId, data) {
|
|
29
|
+
if (!purchaseOrderId)
|
|
30
|
+
throw new Error('purchaseOrderId is required');
|
|
31
|
+
return await this.client.post(`${this.basePath}/${encodeURIComponent(purchaseOrderId)}/cancel`, data);
|
|
32
|
+
}
|
|
33
|
+
async refundOrder(purchaseOrderId, data) {
|
|
34
|
+
if (!purchaseOrderId)
|
|
35
|
+
throw new Error('purchaseOrderId is required');
|
|
36
|
+
return await this.client.post(`${this.basePath}/${encodeURIComponent(purchaseOrderId)}/refund`, data);
|
|
37
|
+
}
|
|
38
|
+
async getShippingCarriers() {
|
|
39
|
+
return await this.client.get('/v3/shipping/carriers');
|
|
40
|
+
}
|
|
41
|
+
async createShippingLabel(data) {
|
|
42
|
+
return await this.client.post('/v3/shipping/labels', data);
|
|
43
|
+
}
|
|
44
|
+
async getShippingEstimate(params) {
|
|
45
|
+
return await this.client.get('/v3/shipping/estimate', params);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class PricingApi {
|
|
3
|
+
private client;
|
|
4
|
+
private basePath;
|
|
5
|
+
constructor(client: WalmartApiClient);
|
|
6
|
+
/**
|
|
7
|
+
* Update the regular (BASE) price for a single SKU. Accepts semantic params
|
|
8
|
+
* and builds the Walmart `/v3/price` payload, so callers don't have to
|
|
9
|
+
* hand-assemble Walmart's nested pricing structure. For promotional or
|
|
10
|
+
* strikethrough pricing, use the promo price feed.
|
|
11
|
+
*/
|
|
12
|
+
updatePrice(data: {
|
|
13
|
+
sku: string;
|
|
14
|
+
amount: number;
|
|
15
|
+
currency?: string;
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
submitPriceFeed(data: object): Promise<unknown>;
|
|
18
|
+
submitMpPriceFeed(data: object): Promise<unknown>;
|
|
19
|
+
submitPromoPriceFeed(data: object): Promise<unknown>;
|
|
20
|
+
getRepricerStrategies(): Promise<unknown>;
|
|
21
|
+
createRepricerStrategy(data: object): Promise<unknown>;
|
|
22
|
+
updateRepricerStrategy(data: object): Promise<unknown>;
|
|
23
|
+
deleteRepricerStrategy(strategyId: string): Promise<unknown>;
|
|
24
|
+
assignItemsToStrategy(data: {
|
|
25
|
+
strategyId: string;
|
|
26
|
+
items: object[];
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
unassignItemsFromStrategy(data: {
|
|
29
|
+
strategyId: string;
|
|
30
|
+
skus: string[];
|
|
31
|
+
}): Promise<unknown>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export class PricingApi {
|
|
2
|
+
client;
|
|
3
|
+
basePath = '/v3';
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Update the regular (BASE) price for a single SKU. Accepts semantic params
|
|
9
|
+
* and builds the Walmart `/v3/price` payload, so callers don't have to
|
|
10
|
+
* hand-assemble Walmart's nested pricing structure. For promotional or
|
|
11
|
+
* strikethrough pricing, use the promo price feed.
|
|
12
|
+
*/
|
|
13
|
+
async updatePrice(data) {
|
|
14
|
+
if (!data.sku)
|
|
15
|
+
throw new Error('SKU is required');
|
|
16
|
+
if (typeof data.amount !== 'number' || Number.isNaN(data.amount)) {
|
|
17
|
+
throw new Error('amount (a number, e.g. 16.99) is required');
|
|
18
|
+
}
|
|
19
|
+
const currency = data.currency || 'USD';
|
|
20
|
+
const payload = {
|
|
21
|
+
sku: data.sku,
|
|
22
|
+
pricing: [
|
|
23
|
+
{
|
|
24
|
+
currentPriceType: 'BASE',
|
|
25
|
+
currentPrice: { currency, amount: data.amount },
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
return await this.client.put(`${this.basePath}/price`, payload);
|
|
30
|
+
}
|
|
31
|
+
async submitPriceFeed(data) {
|
|
32
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=price`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
33
|
+
}
|
|
34
|
+
async submitMpPriceFeed(data) {
|
|
35
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=MP_ITEM_PRICE_UPDATE`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
36
|
+
}
|
|
37
|
+
async submitPromoPriceFeed(data) {
|
|
38
|
+
return await this.client.post(`${this.basePath}/feeds?feedType=PROMO_PRICE`, data, { headers: { 'Content-Type': 'application/json' } });
|
|
39
|
+
}
|
|
40
|
+
async getRepricerStrategies() {
|
|
41
|
+
return await this.client.get(`${this.basePath}/repricer/strategies`);
|
|
42
|
+
}
|
|
43
|
+
async createRepricerStrategy(data) {
|
|
44
|
+
return await this.client.post(`${this.basePath}/repricer/strategy`, data);
|
|
45
|
+
}
|
|
46
|
+
async updateRepricerStrategy(data) {
|
|
47
|
+
return await this.client.put(`${this.basePath}/repricer/strategy`, data);
|
|
48
|
+
}
|
|
49
|
+
async deleteRepricerStrategy(strategyId) {
|
|
50
|
+
if (!strategyId)
|
|
51
|
+
throw new Error('strategyId is required');
|
|
52
|
+
return await this.client.delete(`${this.basePath}/repricer/strategy`, { strategyId });
|
|
53
|
+
}
|
|
54
|
+
async assignItemsToStrategy(data) {
|
|
55
|
+
return await this.client.post(`${this.basePath}/repricer/strategy/items`, data);
|
|
56
|
+
}
|
|
57
|
+
async unassignItemsFromStrategy(data) {
|
|
58
|
+
return await this.client.delete(`${this.basePath}/repricer/strategy/items`, data);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class ReportsApi {
|
|
3
|
+
private client;
|
|
4
|
+
constructor(client: WalmartApiClient);
|
|
5
|
+
createReport(data: object): Promise<unknown>;
|
|
6
|
+
getReportRequests(params?: {
|
|
7
|
+
reportType?: string;
|
|
8
|
+
reportVersion?: string;
|
|
9
|
+
}): Promise<unknown>;
|
|
10
|
+
getReportStatus(requestId: string): Promise<unknown>;
|
|
11
|
+
downloadReport(params: {
|
|
12
|
+
requestId?: string;
|
|
13
|
+
reportType?: string;
|
|
14
|
+
}): Promise<unknown>;
|
|
15
|
+
createReportSchedule(data: object): Promise<unknown>;
|
|
16
|
+
getReportSchedules(params?: {
|
|
17
|
+
reportType?: string;
|
|
18
|
+
}): Promise<unknown>;
|
|
19
|
+
updateReportSchedule(scheduleId: string, data: object): Promise<unknown>;
|
|
20
|
+
deleteReportSchedule(scheduleId: string): Promise<unknown>;
|
|
21
|
+
getUnpublishedItems(params?: {
|
|
22
|
+
limit?: number;
|
|
23
|
+
offset?: number;
|
|
24
|
+
}): Promise<unknown>;
|
|
25
|
+
getListingQuality(params?: {
|
|
26
|
+
category?: string;
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
getQualityCategories(params?: {
|
|
29
|
+
limit?: number;
|
|
30
|
+
offset?: number;
|
|
31
|
+
}): Promise<unknown>;
|
|
32
|
+
getItemQualityDetails(params?: {
|
|
33
|
+
category?: string;
|
|
34
|
+
limit?: number;
|
|
35
|
+
offset?: number;
|
|
36
|
+
}): Promise<unknown>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export class ReportsApi {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
// ===== Report Requests =====
|
|
7
|
+
async createReport(data) {
|
|
8
|
+
return await this.client.post('/v3/reports/reportRequests', data);
|
|
9
|
+
}
|
|
10
|
+
async getReportRequests(params) {
|
|
11
|
+
return await this.client.get('/v3/reports/reportRequests', params);
|
|
12
|
+
}
|
|
13
|
+
async getReportStatus(requestId) {
|
|
14
|
+
if (!requestId)
|
|
15
|
+
throw new Error('requestId is required');
|
|
16
|
+
return await this.client.get(`/v3/reports/reportRequests/${encodeURIComponent(requestId)}`);
|
|
17
|
+
}
|
|
18
|
+
async downloadReport(params) {
|
|
19
|
+
return await this.client.get('/v3/reports/downloadReport', params);
|
|
20
|
+
}
|
|
21
|
+
// ===== Report Schedules =====
|
|
22
|
+
async createReportSchedule(data) {
|
|
23
|
+
return await this.client.post('/v3/reports/schedules', data);
|
|
24
|
+
}
|
|
25
|
+
async getReportSchedules(params) {
|
|
26
|
+
return await this.client.get('/v3/reports/schedules', params);
|
|
27
|
+
}
|
|
28
|
+
async updateReportSchedule(scheduleId, data) {
|
|
29
|
+
if (!scheduleId)
|
|
30
|
+
throw new Error('scheduleId is required');
|
|
31
|
+
return await this.client.put(`/v3/reports/schedules/${encodeURIComponent(scheduleId)}`, data);
|
|
32
|
+
}
|
|
33
|
+
async deleteReportSchedule(scheduleId) {
|
|
34
|
+
if (!scheduleId)
|
|
35
|
+
throw new Error('scheduleId is required');
|
|
36
|
+
return await this.client.delete(`/v3/reports/schedules/${encodeURIComponent(scheduleId)}`);
|
|
37
|
+
}
|
|
38
|
+
// ===== Insights =====
|
|
39
|
+
async getUnpublishedItems(params) {
|
|
40
|
+
return await this.client.get('/v3/insights/items/unpublished', params);
|
|
41
|
+
}
|
|
42
|
+
async getListingQuality(params) {
|
|
43
|
+
return await this.client.get('/v3/insights/items/listingQuality/score', params);
|
|
44
|
+
}
|
|
45
|
+
async getQualityCategories(params) {
|
|
46
|
+
return await this.client.get('/v3/insights/items/listingQuality/categories', params);
|
|
47
|
+
}
|
|
48
|
+
async getItemQualityDetails(params) {
|
|
49
|
+
return await this.client.get('/v3/insights/items/listingQuality/items', params);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class ReturnsApi {
|
|
3
|
+
private client;
|
|
4
|
+
private basePath;
|
|
5
|
+
constructor(client: WalmartApiClient);
|
|
6
|
+
getAllReturns(params?: {
|
|
7
|
+
limit?: number;
|
|
8
|
+
offset?: number;
|
|
9
|
+
status?: string;
|
|
10
|
+
returnCreationStartDate?: string;
|
|
11
|
+
returnCreationEndDate?: string;
|
|
12
|
+
customerOrderId?: string;
|
|
13
|
+
}): Promise<unknown>;
|
|
14
|
+
getReturn(returnOrderId: string): Promise<unknown>;
|
|
15
|
+
approveReturn(data: object): Promise<unknown>;
|
|
16
|
+
rejectReturn(data: object): Promise<unknown>;
|
|
17
|
+
issueReturnRefund(returnOrderId: string, itemId: string, data: object): Promise<unknown>;
|
|
18
|
+
generateReturnLabel(returnOrderId: string, itemId: string, data: object): Promise<unknown>;
|
|
19
|
+
getWfsReturns(params?: {
|
|
20
|
+
limit?: number;
|
|
21
|
+
offset?: number;
|
|
22
|
+
}): Promise<unknown>;
|
|
23
|
+
getReturnCount(params?: {
|
|
24
|
+
status?: string;
|
|
25
|
+
}): Promise<unknown>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class ReturnsApi {
|
|
2
|
+
client;
|
|
3
|
+
basePath = '/v3/returns';
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
async getAllReturns(params) {
|
|
8
|
+
return await this.client.get(this.basePath, params);
|
|
9
|
+
}
|
|
10
|
+
async getReturn(returnOrderId) {
|
|
11
|
+
if (!returnOrderId)
|
|
12
|
+
throw new Error('returnOrderId is required');
|
|
13
|
+
return await this.client.get(`${this.basePath}/${encodeURIComponent(returnOrderId)}`);
|
|
14
|
+
}
|
|
15
|
+
async approveReturn(data) {
|
|
16
|
+
return await this.client.post(`${this.basePath}/approve`, data);
|
|
17
|
+
}
|
|
18
|
+
async rejectReturn(data) {
|
|
19
|
+
return await this.client.post(`${this.basePath}/reject`, data);
|
|
20
|
+
}
|
|
21
|
+
async issueReturnRefund(returnOrderId, itemId, data) {
|
|
22
|
+
if (!returnOrderId || !itemId)
|
|
23
|
+
throw new Error('returnOrderId and itemId are required');
|
|
24
|
+
return await this.client.post(`${this.basePath}/${encodeURIComponent(returnOrderId)}/items/${encodeURIComponent(itemId)}/refund`, data);
|
|
25
|
+
}
|
|
26
|
+
async generateReturnLabel(returnOrderId, itemId, data) {
|
|
27
|
+
if (!returnOrderId || !itemId)
|
|
28
|
+
throw new Error('returnOrderId and itemId are required');
|
|
29
|
+
return await this.client.post(`${this.basePath}/${encodeURIComponent(returnOrderId)}/items/${encodeURIComponent(itemId)}/shippinglabel`, data);
|
|
30
|
+
}
|
|
31
|
+
async getWfsReturns(params) {
|
|
32
|
+
return await this.client.get(this.basePath, { ...params, isWFSEnabled: 'Y' });
|
|
33
|
+
}
|
|
34
|
+
async getReturnCount(params) {
|
|
35
|
+
return await this.client.get(`${this.basePath}/count`, params);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WalmartApiClient } from '../client.js';
|
|
2
|
+
export declare class SettingsApi {
|
|
3
|
+
private client;
|
|
4
|
+
constructor(client: WalmartApiClient);
|
|
5
|
+
getShippingSettings(): Promise<unknown>;
|
|
6
|
+
updateShippingSettings(data: object): Promise<unknown>;
|
|
7
|
+
getFulfillmentCenters(): Promise<unknown>;
|
|
8
|
+
getPartnerInfo(): Promise<object>;
|
|
9
|
+
}
|