Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
33 changes: 33 additions & 0 deletions components/parsio_io/actions/create-mailbox/create-mailbox.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import app from "../../parsio_io.app.mjs";

export default {
key: "parsio_io-create-mailbox",
name: "Create Mailbox",
description: "Create a new mailbox in Parsio. [See the documentation](https://help.parsio.io/public-api/parsio-public-api#create-a-mailbox)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
app,
name: {
propDefinition: [
app,
"name",
],
},
},
async run({ $ }) {
const response = await this.app.createMailbox({
$,
data: {
name: this.name,
},
});
$.export("$summary", "Successfully created mailbox");
return response;
},
};
31 changes: 31 additions & 0 deletions components/parsio_io/actions/delete-mailbox/delete-mailbox.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import app from "../../parsio_io.app.mjs";

export default {
key: "parsio_io-delete-mailbox",
name: "Delete Mailbox",
description: "Delete the specified mailbox. [See the documentation](https://help.parsio.io/public-api/parsio-public-api#delete-a-mailbox)",
version: "0.0.1",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
app,
mailboxId: {
propDefinition: [
app,
"mailboxId",
],
},
},
async run({ $ }) {
const response = await this.app.deleteMailbox({
$,
mailboxId: this.mailboxId,
});
$.export("$summary", "Successfully deleted mailbox");
return response;
},
};
69 changes: 69 additions & 0 deletions components/parsio_io/actions/update-mailbox/update-mailbox.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import app from "../../parsio_io.app.mjs";

export default {
key: "parsio_io-update-mailbox",
name: "Update Mailbox",
description: "Update the specified mailbox. [See the documentation](https://help.parsio.io/public-api/parsio-public-api#update-a-mailbox)",
version: "0.0.1",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
app,
mailboxId: {
propDefinition: [
app,
"mailboxId",
],
},
name: {
propDefinition: [
app,
"name",
],
description: "The new name of the mailbox",
},
emailPrefix: {
propDefinition: [
app,
"emailPrefix",
],
},
processAttachments: {
propDefinition: [
app,
"processAttachments",
],
},
collectEmails: {
propDefinition: [
app,
"collectEmails",
],
},
alertEmailH: {
propDefinition: [
app,
"alertEmailH",
],
},
},
async run({ $ }) {
const response = await this.app.updateMailbox({
$,
mailboxId: this.mailboxId,
data: {
name: this.name,
email_prefix: this.emailPrefix,
process_attachments: this.processAttachments,
collect_emails: this.collectEmails,
alert_email_h: this.alertEmailH,
},
});
$.export("$summary", "Successfully updated mailbox");
return response;
},
};
5 changes: 4 additions & 1 deletion components/parsio_io/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/parsio_io",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Parsio.io Components",
"main": "parsio_io.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
101 changes: 96 additions & 5 deletions components/parsio_io/parsio_io.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,102 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "parsio_io",
propDefinitions: {},
propDefinitions: {
name: {
type: "string",
label: "Name",
description: "Name of the mailbox to create",
},
emailPrefix: {
type: "string",
label: "Email Prefix",
description: "Custom prefix for the mailbox email address",
},
processAttachments: {
type: "boolean",
label: "Process Attachments",
description: "Specifies whether to process attachments automatically",
optional: true,
},
collectEmails: {
type: "boolean",
label: "Collect Emails",
description: "Defines if emails should be collected automatically from the mailbox",
optional: true,
},
alertEmailH: {
type: "string",
label: "Alert Email H",
description: "Optional email address to receive alert notifications",
optional: true,
},
mailboxId: {
type: "string",
label: "Mailbox ID",
description: "Unique identifier of the mailbox",
async options() {
const response = await this.getMailboxes();
return response.map(({
name, _id,
}) => ({
label: name,
value: _id,
}));
},
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.parsio.io";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
"X-API-Key": `${this.$auth.api_key}`,
...headers,
},
});
},
async createMailbox(args = {}) {
return this._makeRequest({
path: "/mailboxes/create",
method: "post",
...args,
});
},
async updateMailbox({
mailboxId, ...args
}) {
return this._makeRequest({
path: `/mailboxes/${mailboxId}`,
method: "post",
...args,
});
},
async deleteMailbox({
mailboxId, ...args
}) {
return this._makeRequest({
path: `/mailboxes/${mailboxId}`,
method: "delete",
...args,
});
},
async getMailboxes(args = {}) {
return this._makeRequest({
path: "/mailboxes",
...args,
});
},
},
};
};
33 changes: 14 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading