Skip to content

Commit

Permalink
benchmarkone init
Browse files Browse the repository at this point in the history
  • Loading branch information
luancazarine committed Feb 19, 2025
1 parent 0283bcf commit 4f18977
Show file tree
Hide file tree
Showing 7 changed files with 718 additions and 3 deletions.
98 changes: 98 additions & 0 deletions components/benchmarkone/actions/add-note/add-note.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import benchmarkone from "../../benchmarkone.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/benchmarkone/actions/add-note/add-note.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "benchmarkone-add-note",
name: "Add Note to Contact",
description: "Adds a note to a BenchmarkONE contact. [See the documentation]().",
version: "0.0.{{ts}}",

Check warning on line 8 in components/benchmarkone/actions/add-note/add-note.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
benchmarkone,
contactId: {
propDefinition: [
benchmarkone,
"contactId",
],
},
contactEmail: {
propDefinition: [
benchmarkone,
"contactEmail",
],
optional: true,
},
noteContent: {
propDefinition: [
benchmarkone,
"noteContent",
],
},
firstName: {
propDefinition: [
benchmarkone,
"firstName",
],
optional: true,
},
lastName: {
propDefinition: [
benchmarkone,
"lastName",
],
optional: true,
},
email: {
propDefinition: [
benchmarkone,
"email",
],
optional: true,
},
phoneNumbers: {
propDefinition: [
benchmarkone,
"phoneNumbers",
],
optional: true,
},
addresses: {
propDefinition: [
benchmarkone,
"addresses",
],
optional: true,
},
},
async run({ $ }) {
try {
if (!this.contactId && !this.contactEmail) {
throw new Error("Either contactId or contactEmail must be provided.");
}

const response = await this.benchmarkone.addNoteToContact({
contactId: this.contactId,
contactEmail: this.contactEmail,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
phoneNumbers: this.phoneNumbers,
addresses: this.addresses,
noteContent: this.noteContent,
});

if (response && response.contactId) {
$.export("$summary", `Added note to contact with ID ${response.contactId}`);
} else if (this.contactEmail) {
$.export("$summary", `Added note to contact with email ${this.contactEmail}`);
} else {
$.export("$summary", "Added note to contact");
}

return response;
} catch (error) {
$.export("$summary", `Failed to add note: ${error.message}`);
throw error;
}
},
};
84 changes: 84 additions & 0 deletions components/benchmarkone/actions/add-tag/add-tag.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import benchmarkone from "../../benchmarkone.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/benchmarkone/actions/add-tag/add-tag.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "benchmarkone-add-tag",
name: "Add Tag to Contact",
description: "Adds tags to a contact. If the contact does not exist, it will be created first. [See the documentation]().",
version: "0.0.{{ts}}",

Check warning on line 8 in components/benchmarkone/actions/add-tag/add-tag.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
benchmarkone,
tagNames: {
propDefinition: [
benchmarkone,
"tagNames",
],
},
email: {
propDefinition: [
benchmarkone,
"email",
],
},
contactId: {
propDefinition: [
benchmarkone,
"contactId",
],
optional: true,
},
contactEmail: {
propDefinition: [
benchmarkone,
"contactEmail",
],
optional: true,
},
firstName: {
propDefinition: [
benchmarkone,
"firstName",
],
optional: true,
},
lastName: {
propDefinition: [
benchmarkone,
"lastName",
],
optional: true,
},
phoneNumbers: {
propDefinition: [
benchmarkone,
"phoneNumbers",
],
optional: true,
},
addresses: {
propDefinition: [
benchmarkone,
"addresses",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.benchmarkone.addTagToContact({
contactId: this.contactId,
contactEmail: this.contactEmail,
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
phoneNumbers: this.phoneNumbers,
addresses: this.addresses,
tagNames: this.tagNames,
});

const contactId = response.contactId;
const addedTags = this.tagNames.join(", ");
$.export("$summary", `Added tags [${addedTags}] to contact ID ${contactId}`);
return response;
},
};
60 changes: 60 additions & 0 deletions components/benchmarkone/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import benchmarkone from "../../benchmarkone.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/benchmarkone/actions/create-contact/create-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "benchmarkone-create-contact",
name: "Create Contact",
description: "Creates a new contact in BenchmarkONE. [See the documentation]()",
version: "0.0.{{ts}}",

Check warning on line 8 in components/benchmarkone/actions/create-contact/create-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
benchmarkone,
firstName: {
propDefinition: [
benchmarkone,
"firstName",
],
},
lastName: {
propDefinition: [
benchmarkone,
"lastName",
],
},
email: {
propDefinition: [
benchmarkone,
"email",
],
},
phoneNumbers: {
propDefinition: [
benchmarkone,
"phoneNumbers",
],
optional: true,
},
addresses: {
propDefinition: [
benchmarkone,
"addresses",
],
optional: true,
},
},
async run({ $ }) {
try {
const response = await this.benchmarkone.createContact({
firstName: this.firstName,
lastName: this.lastName,
email: this.email,
phoneNumbers: this.phoneNumbers,
addresses: this.addresses,
});
$.export("$summary", `Created contact with ID: ${response.contactId}`);
return response;
} catch (error) {
throw new Error(`Failed to create contact: ${error.message}`);
}
},
};
69 changes: 69 additions & 0 deletions components/benchmarkone/actions/update-contact/update-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import benchmarkone from "../../benchmarkone.app.mjs";
import { axios } from "@pipedream/platform";

Check failure on line 2 in components/benchmarkone/actions/update-contact/update-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

'axios' is defined but never used

export default {
key: "benchmarkone-update-contact",
name: "Update Contact",
description: "Updates an existing contact. [See the documentation](https://sandbox.hatchbuck.com/api/dist/)",
version: "0.0.{{ts}}",

Check warning on line 8 in components/benchmarkone/actions/update-contact/update-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
benchmarkone: {

Check warning on line 11 in components/benchmarkone/actions/update-contact/update-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop benchmarkone must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 11 in components/benchmarkone/actions/update-contact/update-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop benchmarkone must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "app",
app: "benchmarkone",
},
contactId: {
propDefinition: [
benchmarkone,
"contactId",
],
},
contactEmail: {
propDefinition: [
benchmarkone,
"contactEmail",
],
optional: true,
},
firstName: {
propDefinition: [
benchmarkone,
"firstName",
],
optional: true,
},
lastName: {
propDefinition: [
benchmarkone,
"lastName",
],
optional: true,
},
phoneNumbers: {
propDefinition: [
benchmarkone,
"phoneNumbers",
],
optional: true,
},
addresses: {
propDefinition: [
benchmarkone,
"addresses",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.benchmarkone.updateContact({
contactId: this.contactId,
contactEmail: this.contactEmail,
firstName: this.firstName,
lastName: this.lastName,
phoneNumbers: this.phoneNumbers,
addresses: this.addresses,
});
$.export("$summary", "Contact updated successfully.");
return response;
},
};
Loading

0 comments on commit 4f18977

Please sign in to comment.