Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
4 changes: 3 additions & 1 deletion .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1076,4 +1076,6 @@ Golang
UX
taskSchedulerURL
taskId
codebase
egift
eGift
API
11 changes: 0 additions & 11 deletions components/sendoso/README.md

This file was deleted.

47 changes: 47 additions & 0 deletions components/sendoso/actions/add-group-members/add-group-members.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { parseObject } from "../../common/utils.mjs";
import sendoso from "../../sendoso.app.mjs";

export default {
key: "sendoso-add-group-members",
name: "Add Group Members",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
description: "Add members to a group. [See the documentation](https://sendoso.docs.apiary.io/#reference/group-management)",
type: "action",
props: {
sendoso,
groupId: {
propDefinition: [
sendoso,
"groupId",
],
},
members: {
type: "string[]",
label: "Members",
description: "Array of member email addresses or IDs to add to the group.",
},
},
async run({ $ }) {
const {
groupId,
members,
} = this;

const parsedMembers = parseObject(members);

const response = await this.sendoso.addGroupMembers({
$,
groupId,
members: parsedMembers,
});

$.export("$summary", `Successfully added ${parsedMembers?.length} member(s) to group ID: ${groupId}`);
return response;
},
};

48 changes: 48 additions & 0 deletions components/sendoso/actions/cancel-send/cancel-send.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import sendoso from "../../sendoso.app.mjs";

export default {
key: "sendoso-cancel-send",
name: "Cancel Send",
version: "0.0.1",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
description: "Cancel a pending or scheduled send before it is shipped. [See the documentation](https://sendoso.docs.apiary.io/#reference/send-management)",
type: "action",
props: {
sendoso,
sendId: {
propDefinition: [
sendoso,
"sendId",
],
description: "The unique ID of the send to cancel.",
},
reason: {
type: "string",
label: "Cancellation Reason",
description: "Optional reason for cancelling the send.",
optional: true,
},
},
async run({ $ }) {
const {
sendId,
reason,
} = this;

const response = await this.sendoso.cancelSend({
$,
sendId,
...(reason && {
reason,
}),
});

$.export("$summary", `Successfully cancelled send ID: ${sendId}`);
return response;
},
};

58 changes: 58 additions & 0 deletions components/sendoso/actions/create-campaign/create-campaign.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import sendoso from "../../sendoso.app.mjs";

export default {
key: "sendoso-create-campaign",
name: "Create Campaign",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
description: "Create a new campaign in Sendoso. [See the documentation](https://sendoso.docs.apiary.io/#reference/campaign-management)",
type: "action",
props: {
sendoso,
name: {
type: "string",
label: "Campaign Name",
description: "Name of the campaign.",
},
description: {
type: "string",
label: "Description",
description: "Description of the campaign.",
optional: true,
},
groupId: {
propDefinition: [
sendoso,
"groupId",
],
optional: true,
description: "Group ID to associate with this campaign.",
},
},
async run({ $ }) {
const {
name,
description,
groupId,
} = this;

const data = {
name,
};
if (description) data.description = description;
if (groupId) data.group_id = groupId;

const response = await this.sendoso.createCampaign({
$,
...data,
});

$.export("$summary", `Successfully created campaign: ${name}`);
return response;
},
};

118 changes: 118 additions & 0 deletions components/sendoso/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import sendoso from "../../sendoso.app.mjs";

export default {
key: "sendoso-create-contact",
name: "Create Contact",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
description: "Create a new contact in Sendoso. [See the documentation](https://sendoso.docs.apiary.io/#reference/contact-management)",
type: "action",
props: {
sendoso,
firstName: {
type: "string",
label: "First Name",
description: "Contact's first name.",
},
lastName: {
type: "string",
label: "Last Name",
description: "Contact's last name.",
},
email: {
type: "string",
label: "Email",
description: "Contact's email address.",
},
phone: {
type: "string",
label: "Phone",
description: "Contact's phone number.",
optional: true,
},
company: {
type: "string",
label: "Company",
description: "Contact's company name.",
optional: true,
},
title: {
type: "string",
label: "Title",
description: "Contact's job title.",
optional: true,
},
address: {
type: "string",
label: "Address",
description: "Contact's street address.",
optional: true,
},
city: {
type: "string",
label: "City",
description: "Contact's city.",
optional: true,
},
state: {
type: "string",
label: "State",
description: "Contact's state/province.",
optional: true,
},
zip: {
type: "string",
label: "ZIP Code",
description: "Contact's postal code.",
optional: true,
},
country: {
type: "string",
label: "Country",
description: "Contact's country.",
optional: true,
},
},
async run({ $ }) {
const {
firstName,
lastName,
email,
phone,
company,
title,
address,
city,
state,
zip,
country,
} = this;

const data = {
first_name: firstName,
last_name: lastName,
email,
...(phone && { mobile_no: phone }),
...(company && { company_name: company }),
...(title && { title }),
...(address && { address }),
...(city && { city }),
...(state && { state }),
...(zip && { zip }),
...(country && { country }),
};

const response = await this.sendoso.createContact({
$,
...data,
});

$.export("$summary", `Successfully created contact: ${firstName} ${lastName}`);
return response;
},
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import sendoso from "../../sendoso.app.mjs";

export default {
key: "sendoso-create-egift-links",
name: "Create eGift Links",
description: "Generate eGift links. [See the documentation](https://developer.sendoso.com/rest-api/sends/create-egift-links)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
sendoso,
touchId: {
propDefinition: [
sendoso,
"touchId",
],
},
amount: {
type: "integer",
label: "Amount",
description: "The number of links to generate.",
min: 1,
default: 1,
},
},
async run({ $ }) {
const response = await this.sendoso.createEgiftLinks({
$,
touch_id: this.touchId,
amount: this.amount,
});
$.export("$summary", `Successfully created ${this.amount} eGift links`);
return response;
},
};
48 changes: 48 additions & 0 deletions components/sendoso/actions/create-group/create-group.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import sendoso from "../../sendoso.app.mjs";

export default {
key: "sendoso-create-group",
name: "Create Group",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
description: "Create a new group in Sendoso. [See the documentation](https://sendoso.docs.apiary.io/#reference/group-management)",
type: "action",
props: {
sendoso,
name: {
type: "string",
label: "Group Name",
description: "Name of the group.",
},
description: {
type: "string",
label: "Description",
description: "Description of the group.",
optional: true,
},
},
async run({ $ }) {
const {
name,
description,
} = this;

const data = {
name,
};
if (description) data.description = description;

const response = await this.sendoso.createGroup({
$,
...data,
});

$.export("$summary", `Successfully created group: ${name}`);
return response;
},
};

Loading