Skip to content

Commit 6075bbd

Browse files
authored
New Components - amazon_selling_partner (#17562)
* new components * pnpm-lock.yaml * update * update
1 parent 26b2da6 commit 6075bbd

File tree

13 files changed

+746
-6
lines changed

13 files changed

+746
-6
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import amazonSellingPartner from "../../amazon_selling_partner.app.mjs";
2+
3+
export default {
4+
key: "amazon_selling_partner-check-fba-inventory-levels",
5+
name: "Check FBA Inventory Levels",
6+
description: "Retrieves inventory summaries from Amazon fulfillment centers to monitor stock availability. [See the documentation](https://developer-docs.amazon.com/sp-api/reference/getinventorysummaries)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
amazonSellingPartner,
11+
marketplaceId: {
12+
propDefinition: [
13+
amazonSellingPartner,
14+
"marketplaceId",
15+
],
16+
},
17+
details: {
18+
type: "boolean",
19+
label: "Details",
20+
description: "Set to `true` to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value).",
21+
optional: true,
22+
},
23+
startDateTime: {
24+
type: "string",
25+
label: "Start Date Time",
26+
description: "A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected.",
27+
optional: true,
28+
},
29+
sellerSkus: {
30+
type: "string[]",
31+
label: "Seller SKUs",
32+
description: "A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs.",
33+
optional: true,
34+
},
35+
},
36+
async run({ $ }) {
37+
const { payload } = await this.amazonSellingPartner.getInventorySummaries({
38+
$,
39+
params: {
40+
marketplaceIds: this.marketplaceId,
41+
granularityType: "Marketplace",
42+
granularityId: this.marketplaceId,
43+
details: this.details,
44+
startDateTime: this.startDateTime,
45+
sellerSkus: this.sellerSkus?.length
46+
? this.sellerSkus.join(",")
47+
: undefined,
48+
},
49+
});
50+
$.export("$summary", `Fetched ${payload.inventorySummaries.length} inventory summar${payload.inventorySummaries.length === 1
51+
? "y"
52+
: "ies"}`);
53+
return payload.inventorySummaries || [];
54+
},
55+
};
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import amazonSellingPartner from "../../amazon_selling_partner.app.mjs";
2+
3+
export default {
4+
key: "amazon_selling_partner-fetch-orders-by-date-range",
5+
name: "Fetch Orders by Date Range",
6+
description: "Retrieves a list of orders based on a specified date range, buyer email, or order ID. [See the documentation](https://developer-docs.amazon.com/sp-api/reference/getorders)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
amazonSellingPartner,
11+
marketplaceId: {
12+
propDefinition: [
13+
amazonSellingPartner,
14+
"marketplaceId",
15+
],
16+
},
17+
createdAfter: {
18+
type: "string",
19+
label: "Created After",
20+
description: "Fetch orders created after this ISO date.",
21+
},
22+
createdBefore: {
23+
type: "string",
24+
label: "Created Before",
25+
description: "Fetch orders created before this ISO date.",
26+
optional: true,
27+
},
28+
buyerEmail: {
29+
type: "string",
30+
label: "Buyer Email",
31+
description: "The email address of a buyer",
32+
optional: true,
33+
},
34+
amazonOrderId: {
35+
propDefinition: [
36+
amazonSellingPartner,
37+
"orderId",
38+
(c) => ({
39+
marketplaceId: c.marketplaceId,
40+
}),
41+
],
42+
label: "Seller Order ID",
43+
description: "An order identifier that is specified by the seller. Used to select only the orders that match the order identifier. If SellerOrderId is specified, then FulfillmentChannels, OrderStatuses, PaymentMethod, LastUpdatedAfter, LastUpdatedBefore, and BuyerEmail cannot be specified.",
44+
optional: true,
45+
},
46+
},
47+
async run({ $ }) {
48+
const { payload } = await this.amazonSellingPartner.listOrders({
49+
$,
50+
params: {
51+
MarketplaceIds: this.marketplaceId,
52+
CreatedAfter: this.createdAfter,
53+
CreatedBefore: this.createdBefore,
54+
BuyerEmail: this.buyerEmail,
55+
SellerOrderId: this.amazonOrderId,
56+
},
57+
});
58+
$.export("$summary", `Fetched ${payload.Orders.length} order${payload.Orders.length === 1
59+
? ""
60+
: "s"}`);
61+
return payload.Orders || [];
62+
},
63+
};
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import amazonSellingPartner from "../../amazon_selling_partner.app.mjs";
2+
3+
export default {
4+
key: "amazon_selling_partner-generate-sales-inventory-reports",
5+
name: "Generate Sales & Inventory Reports",
6+
description: "Requests reports on sales, inventory, and fulfillment performance. [See the documentation](https://developer-docs.amazon.com/sp-api/reference/getreports)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
amazonSellingPartner,
11+
reportTypes: {
12+
type: "string[]",
13+
label: "Report Types",
14+
description: "A list of report types used to filter reports. Refer to [Report Type Values](https://developer-docs.amazon.com/sp-api/docs/report-type-values) for more information.",
15+
},
16+
marketplaceId: {
17+
propDefinition: [
18+
amazonSellingPartner,
19+
"marketplaceId",
20+
],
21+
optional: true,
22+
},
23+
processingStatuses: {
24+
type: "string[]",
25+
label: "Processing Statuses",
26+
description: "A list of processing statuses used to filter reports",
27+
options: [
28+
"CANCELLED",
29+
"DONE",
30+
"FATAL",
31+
"IN_PROGRESS",
32+
"IN_QUEUE",
33+
],
34+
optional: true,
35+
},
36+
createdSince: {
37+
type: "string",
38+
label: "Created Since",
39+
description: "The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days.",
40+
optional: true,
41+
},
42+
createdUntil: {
43+
type: "string",
44+
label: "Created Until",
45+
description: "The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now.",
46+
optional: true,
47+
},
48+
},
49+
async run({ $ }) {
50+
const reports = await this.amazonSellingPartner.getPaginatedResources({
51+
fn: this.amazonSellingPartner.listReports,
52+
params: {
53+
reportTypes: this.reportTypes
54+
? this.reportTypes.join(",")
55+
: undefined,
56+
marketplaceIds: this.marketplaceId,
57+
processingStatuses: this.processingStatuses
58+
? this.processingStatuses.join(",")
59+
: undefined,
60+
createdSince: this.createdSince,
61+
createdUntil: this.createdUntil,
62+
},
63+
resourceKey: "reports",
64+
hasPayload: false,
65+
});
66+
$.export("$summary", `Fetched ${reports.length} report${reports.length === 1
67+
? ""
68+
: "s"}`);
69+
return reports;
70+
},
71+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import amazonSellingPartner from "../../amazon_selling_partner.app.mjs";
2+
3+
export default {
4+
key: "amazon_selling_partner-get-order-details",
5+
name: "Get Order Details",
6+
description: "Fetches detailed information about a specific order using its order ID. [See the documentation](https://developer-docs.amazon.com/sp-api/reference/getorder)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
amazonSellingPartner,
11+
marketplaceId: {
12+
propDefinition: [
13+
amazonSellingPartner,
14+
"marketplaceId",
15+
],
16+
},
17+
amazonOrderId: {
18+
propDefinition: [
19+
amazonSellingPartner,
20+
"orderId",
21+
(c) => ({
22+
marketplaceId: c.marketplaceId,
23+
}),
24+
],
25+
},
26+
},
27+
async run({ $ }) {
28+
const response = await this.amazonSellingPartner.getOrder({
29+
$,
30+
orderId: this.amazonOrderId,
31+
});
32+
$.export("$summary", `Fetched order details for ${this.amazonOrderId}`);
33+
return response;
34+
},
35+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import amazonSellingPartner from "../../amazon_selling_partner.app.mjs";
2+
3+
export default {
4+
key: "amazon_selling_partner-list-inbound-shipments",
5+
name: "List Inbound Shipments",
6+
description: "Fetches inbound shipment details to track stock movement and replenishment. [See the documentation](https://developer-docs.amazon.com/sp-api/reference/getshipments)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
amazonSellingPartner,
11+
marketplaceId: {
12+
propDefinition: [
13+
amazonSellingPartner,
14+
"marketplaceId",
15+
],
16+
},
17+
status: {
18+
propDefinition: [
19+
amazonSellingPartner,
20+
"status",
21+
],
22+
},
23+
lastUpdatedAfter: {
24+
type: "string",
25+
label: "Last Updated After",
26+
description: "A date used for selecting inbound shipments that were last updated after (or at) a specified time. The selection includes updates made by Amazon and by the seller.",
27+
optional: true,
28+
},
29+
lastUpdatedBefore: {
30+
type: "string",
31+
label: "Last Updated Before",
32+
description: "A date used for selecting inbound shipments that were last updated before (or at) a specified time. The selection includes updates made by Amazon and by the seller.",
33+
optional: true,
34+
},
35+
},
36+
async run({ $ }) {
37+
const shipments = await this.amazonSellingPartner.getPaginatedResources({
38+
fn: this.amazonSellingPartner.listInboundShipments,
39+
params: {
40+
MarketplaceId: this.marketplaceId,
41+
ShipmentStatusList: this.status?.length
42+
? this.status.join(",")
43+
: undefined,
44+
LastUpdatedAfter: this.lastUpdatedAfter,
45+
LastUpdatedBefore: this.lastUpdatedBefore,
46+
},
47+
resourceKey: "ShipmentData",
48+
});
49+
$.export("$summary", `Fetched ${shipments.length} shipment${shipments.length === 1
50+
? ""
51+
: "s"}`);
52+
return shipments;
53+
},
54+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import amazonSellingPartner from "../../amazon_selling_partner.app.mjs";
2+
3+
export default {
4+
key: "amazon_selling_partner-optimize-product-pricing",
5+
name: "Optimize Product Pricing",
6+
description: "Retrieves pricing data to adjust product prices dynamically based on market trends. [See the documentation](https://developer-docs.amazon.com/sp-api/reference/getcompetitivepricing)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
amazonSellingPartner,
11+
marketplaceId: {
12+
propDefinition: [
13+
amazonSellingPartner,
14+
"marketplaceId",
15+
],
16+
},
17+
itemType: {
18+
type: "string",
19+
label: "Item Type",
20+
description: "Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter.",
21+
options: [
22+
"Asin",
23+
"Sku",
24+
],
25+
},
26+
values: {
27+
type: "string[]",
28+
label: "Values",
29+
description: "A list of ASINs or seller SKUs. You may specify up to 20 identifiers.",
30+
},
31+
customerType: {
32+
type: "string",
33+
label: "Customer Type",
34+
description: "Filters the offer listings based on customer type",
35+
options: [
36+
"Consumer",
37+
"Business",
38+
],
39+
},
40+
},
41+
async run({ $ }) {
42+
const { payload } = await this.amazonSellingPartner.listProductPricing({
43+
$,
44+
params: {
45+
MarketplaceId: this.marketplaceId,
46+
ItemType: this.itemType,
47+
[this.itemType === "Asin"
48+
? "Asins"
49+
: "Skus"]: this.values.join(","),
50+
CustomerType: this.customerType,
51+
},
52+
});
53+
if (payload[0]?.Product) {
54+
$.export("$summary", "Fetched pricing information");
55+
}
56+
return payload;
57+
},
58+
};

0 commit comments

Comments
 (0)