Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const LIMIT = 500;
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import etrusted from "../../etrusted.app.mjs";

export default {
key: "etrusted-create-veto-for-review",
name: "Create A Veto For A Review",
description: "Creates a veto for a specific review. [See the documentation](https://developers.etrusted.com/reference/createveto)",
version: "0.0.1",
type: "action",
props: {
etrusted,
reviewId: {
propDefinition: [
etrusted,
"reviewId",
],
},
comment: {
type: "string",
label: "Comment",
description: "The veto comment. Provide additional information on the review or your veto here.",
},
reason: {
type: "string",
label: "Reason",
description: "The reason for the veto.",
options: [
"UNTRUTHFUL",
"ABUSIVE",
"VIOLATES_THE_TERMS_OF_USE",
"INAPPROPRIATE_IMAGE",
],
},
vetoReporterEmail: {
type: "string",
label: "Veto Reporter Email",
description: "The E-Mail address of the veto reporter.",
optional: true,
},
},
async run({ $ }) {
const response = await this.etrusted.createVetoForReview({
$,
reviewId: this.reviewId,
data: {
comment: this.comment,
reason: this.reason,
vetoReporterEmail: this.vetoReporterEmail,
},
});

$.export("$summary", `Successfully created veto with ID ${response.id} for review ${this.reviewId}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import etrusted from "../../etrusted.app.mjs";

export default {
key: "etrusted-delete-review-reply",
name: "Delete Review Reply",
description: "Reply to a review. [See the documentation](https://developers.etrusted.com/reference/deletereviewreply)",
version: "0.0.1",
type: "action",
props: {
etrusted,
reviewId: {
propDefinition: [
etrusted,
"reviewId",
],
},
},
async run({ $ }) {
const response = await this.etrusted.deleteReviewReply({
$,
reviewId: this.reviewId,
});

$.export("$summary", `Successfully deleted review reply for review ${this.reviewId}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import { parseObject } from "../../common/utils.mjs";
import etrusted from "../../etrusted.app.mjs";

export default {
key: "etrusted-get-list-of-reviews-with-fewer-properties",
name: "Get List of Reviews with Fewer Properties",
description: "Retrieves a list of reviews with fewer properties. [See the documentation](https://developers.etrusted.com/reference/getminimalreviews)",
version: "0.0.1",
type: "action",
props: {
etrusted,
channelId: {
propDefinition: [
etrusted,
"channelId",
],
type: "string[]",
optional: true,
},
after: {
propDefinition: [
etrusted,
"reviewId",
],
label: "After",
description: "`After` is a review ID. The list of reviews in the response will only contain reviews submitted earlier than the review with this ID.",
optional: true,
},
before: {
propDefinition: [
etrusted,
"reviewId",
],
label: "Before",
description: "`Before` is a review ID. The list of reviews in the response will only contain reviews submitted later than the review with this ID.",
optional: true,
},
submittedAfter: {
propDefinition: [
etrusted,
"submittedAfter",
],
optional: true,
},
submittedBefore: {
propDefinition: [
etrusted,
"submittedBefore",
],
optional: true,
},
rating: {
propDefinition: [
etrusted,
"rating",
],
optional: true,
},
status: {
propDefinition: [
etrusted,
"status",
],
optional: true,
},
type: {
propDefinition: [
etrusted,
"type",
],
optional: true,
},
hasReply: {
propDefinition: [
etrusted,
"hasReply",
],
optional: true,
},
ignoreStatements: {
propDefinition: [
etrusted,
"ignoreStatements",
],
optional: true,
},
query: {
propDefinition: [
etrusted,
"query",
],
optional: true,
},
sku: {
propDefinition: [
etrusted,
"sku",
],
optional: true,
},
orderBy: {
propDefinition: [
etrusted,
"orderBy",
],
optional: true,
},
maxResults: {
propDefinition: [
etrusted,
"maxResults",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.etrusted.paginate({
$,
fn: this.etrusted.getListOfReviewsWithFewerProperties,
params: {
channels: this.channelId && parseObject(this.channelId).join(","),
after: this.after,
before: this.before,
submittedAfter: this.submittedAfter,
submittedBefore: this.submittedBefore,
rating: this.rating && parseObject(this.rating).join(","),
status: this.status && parseObject(this.status).join(","),
type: this.type && parseObject(this.type).join(","),
hasReply: this.hasReply,
ignoreStatements: this.ignoreStatements,
query: this.query,
sku: this.sku,
orderBy: this.orderBy,
maxResults: this.maxResults,
},
maxResults: this.maxResults,
});

const reviews = [];
for await (const review of response) {
reviews.push(review);
}

$.export("$summary", `Successfully retrieved ${reviews.length} review${reviews.length === 1
? ""
: "s"} with fewer properties`);
return reviews;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import { parseObject } from "../../common/utils.mjs";
import etrusted from "../../etrusted.app.mjs";

export default {
key: "etrusted-get-list-of-reviews",
name: "Get List of Reviews",
description: "Get a list of reviews for a specific channel, a set of channels or for your entire account. [See the documentation](https://developers.etrusted.com/reference/getreviews)",
version: "0.0.1",
type: "action",
props: {
etrusted,
channelId: {
propDefinition: [
etrusted,
"channelId",
],
type: "string[]",
optional: true,
},
after: {
propDefinition: [
etrusted,
"reviewId",
],
label: "After",
description: "`After` is a review ID. The list of reviews in the response will only contain reviews submitted earlier than the review with this ID.",
optional: true,
},
before: {
propDefinition: [
etrusted,
"reviewId",
],
label: "Before",
description: "`Before` is a review ID. The list of reviews in the response will only contain reviews submitted later than the review with this ID.",
optional: true,
},
submittedAfter: {
propDefinition: [
etrusted,
"submittedAfter",
],
optional: true,
},
submittedBefore: {
propDefinition: [
etrusted,
"submittedBefore",
],
optional: true,
},
rating: {
propDefinition: [
etrusted,
"rating",
],
optional: true,
},
status: {
propDefinition: [
etrusted,
"status",
],
optional: true,
},
type: {
propDefinition: [
etrusted,
"type",
],
optional: true,
},
hasReply: {
propDefinition: [
etrusted,
"hasReply",
],
optional: true,
},
additionalInformation: {
type: "string[]",
label: "Additional Information",
description: "A list of additional pieces of information to be retrieved with the review. If this property is not set, none of the of additional information are included in the review.",
options: [
"VETO",
"ATTACHMENTS",
],
optional: true,
},
ignoreStatements: {
propDefinition: [
etrusted,
"ignoreStatements",
],
optional: true,
},
query: {
propDefinition: [
etrusted,
"query",
],
optional: true,
},
sku: {
propDefinition: [
etrusted,
"sku",
],
optional: true,
},
orderBy: {
propDefinition: [
etrusted,
"orderBy",
],
optional: true,
},
maxResults: {
propDefinition: [
etrusted,
"maxResults",
],
optional: true,
},
},
async run({ $ }) {
const response = this.etrusted.paginate({
$,
fn: this.etrusted.getListOfReviews,
params: {
channels: this.channelId && parseObject(this.channelId).join(","),
after: this.after,
before: this.before,
submittedAfter: this.submittedAfter,
submittedBefore: this.submittedBefore,
rating: this.rating && parseObject(this.rating).join(","),
status: this.status && parseObject(this.status).join(","),
type: this.type && parseObject(this.type).join(","),
hasReply: this.hasReply,
additionalInformation: this.additionalInformation && parseObject(this.additionalInformation).join(","),
ignoreStatements: this.ignoreStatements,
query: this.query,
sku: this.sku && parseObject(this.sku).join(","),
orderBy: this.orderBy,
},
maxResults: this.maxResults,
});

const reviews = [];
for await (const review of response) {
reviews.push(review);
}

$.export("$summary", `Successfully retrieved ${reviews.length} review${reviews.length === 1
? ""
: "s"}`);
return reviews;
},
};
Loading