Skip to content

Commit 4019317

Browse files
authored
Merging pull request #18189
* new components * updates
1 parent 3d233f7 commit 4019317

File tree

8 files changed

+359
-3
lines changed

8 files changed

+359
-3
lines changed

components/akeneo/actions/create-a-new-product-media-file/create-a-new-product-media-file.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import FormData from "form-data";
77
export default {
88
type: "action",
99
key: "akeneo-create-a-new-product-media-file",
10-
version: "0.1.2",
10+
version: "0.1.3",
1111
name: "Create A New Product Media File",
1212
description: "Allows you to create a new media file and associate it to an attribute value of a given product or product model. [See the docs](https://api.akeneo.com/api-reference.html#post_media_files)",
1313
props: {
@@ -17,6 +17,7 @@ export default {
1717
app,
1818
"productId",
1919
],
20+
optional: true,
2021
},
2122
productModelCode: {
2223
propDefinition: [
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import akeneo from "../../akeneo.app.mjs";
2+
3+
export default {
4+
key: "akeneo-delete-product",
5+
name: "Delete Product",
6+
description: "Delete a product from Akeneo. [See the documentation](https://api.akeneo.com/api-reference.html#delete_products__code_)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
akeneo,
11+
productId: {
12+
propDefinition: [
13+
akeneo,
14+
"productId",
15+
],
16+
description: "Identifier of the product to delete",
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.akeneo.deleteProduct({
21+
$,
22+
productId: this.productId,
23+
});
24+
$.export("$summary", `Successfully deleted product ${this.productId}`);
25+
return response;
26+
},
27+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import akeneo from "../../akeneo.app.mjs";
2+
3+
export default {
4+
key: "akeneo-get-draft",
5+
name: "Get Draft",
6+
description: "Get a product draft from Akeneo. [See the documentation](https://api.akeneo.com/api-reference.html#get_draft__code_)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
akeneo,
11+
productId: {
12+
propDefinition: [
13+
akeneo,
14+
"productId",
15+
],
16+
description: "Identifier of the product to get the draft for",
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.akeneo.getProductDraft({
21+
$,
22+
productId: this.productId,
23+
});
24+
$.export("$summary", `Found draft for product ${this.productId}`);
25+
return response;
26+
},
27+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import akeneo from "../../akeneo.app.mjs";
2+
3+
export default {
4+
key: "akeneo-get-product",
5+
name: "Get Product",
6+
description: "Get a product from Akeneo. [See the documentation](https://api.akeneo.com/api-reference.html#get_products__code_)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
akeneo,
11+
productId: {
12+
propDefinition: [
13+
akeneo,
14+
"productId",
15+
],
16+
description: "Identifier of the product to get",
17+
},
18+
withAttributeOptions: {
19+
propDefinition: [
20+
akeneo,
21+
"withAttributeOptions",
22+
],
23+
},
24+
withAssetShareLinks: {
25+
propDefinition: [
26+
akeneo,
27+
"withAssetShareLinks",
28+
],
29+
},
30+
withQualityScores: {
31+
propDefinition: [
32+
akeneo,
33+
"withQualityScores",
34+
],
35+
},
36+
withCompletenesses: {
37+
propDefinition: [
38+
akeneo,
39+
"withCompletenesses",
40+
],
41+
},
42+
},
43+
async run({ $ }) {
44+
const response = await this.akeneo.getProduct({
45+
$,
46+
productId: this.productId,
47+
params: {
48+
with_attribute_options: this.withAttributeOptions,
49+
with_asset_share_links: this.withAssetShareLinks,
50+
with_quality_scores: this.withQualityScores,
51+
with_completenesses: this.withCompletenesses,
52+
},
53+
});
54+
55+
$.export("$summary", `Found product ${response.identifier}`);
56+
return response;
57+
},
58+
};
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import akeneo from "../../akeneo.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "akeneo-search-products",
6+
name: "Search Products",
7+
description: "Search products from Akeneo. [See the documentation](https://api.akeneo.com/api-reference.html#get_products)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
akeneo,
12+
search: {
13+
type: "string",
14+
label: "Search",
15+
description: "Filter products, for more details see the [Filters](https://api.akeneo.com/documentation/filter.html) section",
16+
optional: true,
17+
},
18+
scope: {
19+
propDefinition: [
20+
akeneo,
21+
"channelCode",
22+
],
23+
label: "Scope",
24+
description: "Filter product values to return scopable attributes for the given channel as well as the non localizable/non scopable attributes, for more details see the [Filter product values via channel](https://api.akeneo.com/documentation/filter.html#via-channel) section",
25+
optional: true,
26+
},
27+
locales: {
28+
propDefinition: [
29+
akeneo,
30+
"locale",
31+
],
32+
description: "Filter product values to return localizable attributes for the given locales as well as the non localizable/non scopable attributes, for more details see the [Filter product values via locale](https://api.akeneo.com/documentation/filter.html#via-locale) section",
33+
optional: true,
34+
},
35+
attributes: {
36+
propDefinition: [
37+
akeneo,
38+
"attribute",
39+
],
40+
label: "Attributes",
41+
description: "Filter product values to only return those concerning the given attributes, for more details see the [Filter on product values](https://api.akeneo.com/documentation/filter.html#filter-product-values) section",
42+
optional: true,
43+
},
44+
convertMeasurements: {
45+
type: "boolean",
46+
label: "Convert Measurements",
47+
description: "Convert values of measurement attributes to the unit configured in the channel provided by the parameter \"scope\". Therefore, this parameter requires the \"scope\" parameter to be provided.",
48+
optional: true,
49+
},
50+
withCount: {
51+
type: "boolean",
52+
label: "With Count",
53+
description: "Return the count of items in the response. Be careful: on large catalogs, enabling counts can significantly impact performance.",
54+
optional: true,
55+
},
56+
withAttributeOptions: {
57+
propDefinition: [
58+
akeneo,
59+
"withAttributeOptions",
60+
],
61+
},
62+
withAssetShareLinks: {
63+
propDefinition: [
64+
akeneo,
65+
"withAssetShareLinks",
66+
],
67+
},
68+
withQualityScores: {
69+
propDefinition: [
70+
akeneo,
71+
"withQualityScores",
72+
],
73+
},
74+
withCompletenesses: {
75+
propDefinition: [
76+
akeneo,
77+
"withCompletenesses",
78+
],
79+
},
80+
page: {
81+
type: "integer",
82+
label: "Page",
83+
description: "The page number to return",
84+
optional: true,
85+
},
86+
limit: {
87+
type: "integer",
88+
label: "Limit",
89+
description: "The number of items to return per page",
90+
optional: true,
91+
},
92+
},
93+
async run({ $ }) {
94+
if (this.convertMeasurements && !this.scope) {
95+
throw new ConfigurationError("The `convertMeasurements` parameter requires the `scope` parameter to be provided");
96+
}
97+
98+
const response = await this.akeneo.getProducts({
99+
$,
100+
params: {
101+
search: this.search,
102+
scope: this.scope,
103+
locales: this.locales,
104+
attributes: this.attributes,
105+
convert_measurements: this.convertMeasurements,
106+
with_count: this.withCount,
107+
with_attribute_options: this.withAttributeOptions,
108+
with_asset_share_links: this.withAssetShareLinks,
109+
with_quality_scores: this.withQualityScores,
110+
with_completenesses: this.withCompletenesses,
111+
page: this.page,
112+
limit: this.limit,
113+
},
114+
});
115+
116+
$.export("$summary", `Found ${response._embedded.items.length} products`);
117+
return response;
118+
},
119+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import akeneo from "../../akeneo.app.mjs";
2+
3+
export default {
4+
key: "akeneo-submit-product-for-approval",
5+
name: "Submit Product For Approval",
6+
description: "Submit a product for approval. [See the documentation](https://api.akeneo.com/api-reference.html#post_proposal)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
akeneo,
11+
productId: {
12+
propDefinition: [
13+
akeneo,
14+
"productId",
15+
],
16+
description: "Identifier of the product to submit for approval",
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.akeneo.submitDraft({
21+
$,
22+
productId: this.productId,
23+
});
24+
$.export("$summary", `Successfully submitted product ${this.productId} for approval`);
25+
return response;
26+
},
27+
};

0 commit comments

Comments
 (0)