From b3f2cb0dd99fbd9d878dc0dd7624312cb5e12745 Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Tue, 25 Nov 2025 15:10:29 -0300 Subject: [PATCH 1/4] Fixed errors --- .../get-autocomplete/get-autocomplete.mjs | 2 +- .../actions/get-categories/get-categories.mjs | 35 +++++++--- components/bluecart_api/bluecart_api.app.mjs | 68 +++++++++++++++++-- components/bluecart_api/package.json | 2 +- 4 files changed, 93 insertions(+), 14 deletions(-) diff --git a/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs b/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs index e51a90c729df6..7eec651cfe039 100644 --- a/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs +++ b/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs @@ -31,7 +31,7 @@ export default { const response = await this.app.getAutocomplete({ $, params: { - searchTerm: this.searchTerm, + search_term: this.searchTerm, type: "autocomplete", }, }); diff --git a/components/bluecart_api/actions/get-categories/get-categories.mjs b/components/bluecart_api/actions/get-categories/get-categories.mjs index 350f61a0dcfac..a90def32b47cd 100644 --- a/components/bluecart_api/actions/get-categories/get-categories.mjs +++ b/components/bluecart_api/actions/get-categories/get-categories.mjs @@ -22,13 +22,32 @@ export default { }, }, async run({ $ }) { - const response = await this.app.getCategories({ - $, - params: { - search_term: this.searchTerm, - }, - }); - $.export("$summary", "Successfully retrieved " + response.categories.length + " categories"); - return response; + try { + const response = await this.app.getCategories({ + $, + params: { + search_term: this.searchTerm, + }, + }); + + $.export("$summary", "Successfully retrieved " + response.categories.length + " categories"); + return response; + + } catch (err) { + if ( + err?.response?.status === 400 && + err?.response?.data?.request_info?.message?.includes("No categories match") + ) { + const message = err.response.data.request_info.message; + + $.export("$summary", message); + return { + success: false, + categories: [], + message, + }; + } + throw err; + } }, }; diff --git a/components/bluecart_api/bluecart_api.app.mjs b/components/bluecart_api/bluecart_api.app.mjs index 647ad7d1d296a..74f53c622bf88 100644 --- a/components/bluecart_api/bluecart_api.app.mjs +++ b/components/bluecart_api/bluecart_api.app.mjs @@ -1,11 +1,71 @@ +import { axios } from "@pipedream/platform"; +import constants from "./common/constants.mjs"; + export default { type: "app", app: "bluecart_api", - propDefinitions: {}, + propDefinitions: { + walmartDomain: { + type: "string", + label: "Walmart Domain", + description: "The Walmart domain to target", + options: constants.DOMAIN_OPTIONS, + }, + url: { + type: "string", + label: "URL", + description: "The Walmart product page URL to retrieve results from", + optional: true, + }, + searchTerm: { + type: "string", + label: "Search Term", + description: "A search term used to find Walmart items", + }, + itemId: { + type: "string", + label: "Item ID", + description: "The Walmart Item ID to retrieve product details for. Not used if a URL is provided", + optional: true, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.bluecartapi.com"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + path, + params, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl() + path, + params: { + api_key: `${this.$auth.api_key}`, + ...params, + }, + }); + }, + async getCategories(args = {}) { + return this._makeRequest({ + path: "/categories", + ...args, + }); + }, + async searchItem(args = {}) { + return this._makeRequest({ + path: "/request", + ...args, + }); + }, + async getAutocomplete(args = {}) { + return this._makeRequest({ + path: "/request", + ...args, + }); }, }, }; diff --git a/components/bluecart_api/package.json b/components/bluecart_api/package.json index 6b61b228c6326..5311a1e17e47d 100644 --- a/components/bluecart_api/package.json +++ b/components/bluecart_api/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/bluecart_api", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream BlueCart API Components", "main": "bluecart_api.app.mjs", "keywords": [ From bbc90db4db7bab75c587102c7f8c13031d001fea Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Tue, 25 Nov 2025 15:15:43 -0300 Subject: [PATCH 2/4] Fixed errors --- components/bluecart_api/actions/get-product/get-product.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bluecart_api/actions/get-product/get-product.mjs b/components/bluecart_api/actions/get-product/get-product.mjs index 9eb5c005e599b..6a92f97f6a20d 100644 --- a/components/bluecart_api/actions/get-product/get-product.mjs +++ b/components/bluecart_api/actions/get-product/get-product.mjs @@ -4,7 +4,7 @@ export default { key: "bluecart_api-get-product", name: "Get product", description: "Get product data from Walmart. [See the documentation](https://docs.trajectdata.com/bluecartapi/walmart-product-data-api/parameters/product)", - version: "0.0.1", + version: "0.0.2", annotations: { destructiveHint: false, openWorldHint: true, From 1cfbcda8c210510eda7fdf5e4588faf5291da0d0 Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Tue, 25 Nov 2025 15:16:49 -0300 Subject: [PATCH 3/4] Fixed errors --- components/bluecart_api/bluecart_api.app.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bluecart_api/bluecart_api.app.mjs b/components/bluecart_api/bluecart_api.app.mjs index 74f53c622bf88..c838f6f37e27c 100644 --- a/components/bluecart_api/bluecart_api.app.mjs +++ b/components/bluecart_api/bluecart_api.app.mjs @@ -44,7 +44,7 @@ export default { ...otherOpts, url: this._baseUrl() + path, params: { - api_key: `${this.$auth.api_key}`, + api_key: this.$auth.api_key, ...params, }, }); From c690da61a09080c90917bd82b844fdf8b74a59db Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Tue, 25 Nov 2025 15:19:58 -0300 Subject: [PATCH 4/4] Fixed errors --- .../bluecart_api/actions/get-autocomplete/get-autocomplete.mjs | 2 +- .../bluecart_api/actions/get-categories/get-categories.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs b/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs index 7eec651cfe039..fd586e9a23741 100644 --- a/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs +++ b/components/bluecart_api/actions/get-autocomplete/get-autocomplete.mjs @@ -4,7 +4,7 @@ export default { key: "bluecart_api-get-autocomplete", name: "Get Autocomplete", description: "Get autocomplete suggestions for the specified search term. [See the documentation](https://docs.trajectdata.com/bluecartapi/walmart-product-data-api/parameters/autocomplete)", - version: "0.0.1", + version: "0.0.2", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/bluecart_api/actions/get-categories/get-categories.mjs b/components/bluecart_api/actions/get-categories/get-categories.mjs index a90def32b47cd..7ebe0877b0065 100644 --- a/components/bluecart_api/actions/get-categories/get-categories.mjs +++ b/components/bluecart_api/actions/get-categories/get-categories.mjs @@ -4,7 +4,7 @@ export default { key: "bluecart_api-get-categories", name: "Get Categories", description: "Get a list of categories related to the provided search term. [See the documentation](https://docs.trajectdata.com/bluecartapi/walmart-product-data-api/parameters/category)", - version: "0.0.1", + version: "0.0.2", annotations: { destructiveHint: false, openWorldHint: true,