Skip to content

Commit 4f18977

Browse files
committed
benchmarkone init
1 parent 0283bcf commit 4f18977

File tree

7 files changed

+718
-3
lines changed

7 files changed

+718
-3
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import benchmarkone from "../../benchmarkone.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "benchmarkone-add-note",
6+
name: "Add Note to Contact",
7+
description: "Adds a note to a BenchmarkONE contact. [See the documentation]().",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
benchmarkone,
12+
contactId: {
13+
propDefinition: [
14+
benchmarkone,
15+
"contactId",
16+
],
17+
},
18+
contactEmail: {
19+
propDefinition: [
20+
benchmarkone,
21+
"contactEmail",
22+
],
23+
optional: true,
24+
},
25+
noteContent: {
26+
propDefinition: [
27+
benchmarkone,
28+
"noteContent",
29+
],
30+
},
31+
firstName: {
32+
propDefinition: [
33+
benchmarkone,
34+
"firstName",
35+
],
36+
optional: true,
37+
},
38+
lastName: {
39+
propDefinition: [
40+
benchmarkone,
41+
"lastName",
42+
],
43+
optional: true,
44+
},
45+
email: {
46+
propDefinition: [
47+
benchmarkone,
48+
"email",
49+
],
50+
optional: true,
51+
},
52+
phoneNumbers: {
53+
propDefinition: [
54+
benchmarkone,
55+
"phoneNumbers",
56+
],
57+
optional: true,
58+
},
59+
addresses: {
60+
propDefinition: [
61+
benchmarkone,
62+
"addresses",
63+
],
64+
optional: true,
65+
},
66+
},
67+
async run({ $ }) {
68+
try {
69+
if (!this.contactId && !this.contactEmail) {
70+
throw new Error("Either contactId or contactEmail must be provided.");
71+
}
72+
73+
const response = await this.benchmarkone.addNoteToContact({
74+
contactId: this.contactId,
75+
contactEmail: this.contactEmail,
76+
firstName: this.firstName,
77+
lastName: this.lastName,
78+
email: this.email,
79+
phoneNumbers: this.phoneNumbers,
80+
addresses: this.addresses,
81+
noteContent: this.noteContent,
82+
});
83+
84+
if (response && response.contactId) {
85+
$.export("$summary", `Added note to contact with ID ${response.contactId}`);
86+
} else if (this.contactEmail) {
87+
$.export("$summary", `Added note to contact with email ${this.contactEmail}`);
88+
} else {
89+
$.export("$summary", "Added note to contact");
90+
}
91+
92+
return response;
93+
} catch (error) {
94+
$.export("$summary", `Failed to add note: ${error.message}`);
95+
throw error;
96+
}
97+
},
98+
};
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import benchmarkone from "../../benchmarkone.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "benchmarkone-add-tag",
6+
name: "Add Tag to Contact",
7+
description: "Adds tags to a contact. If the contact does not exist, it will be created first. [See the documentation]().",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
benchmarkone,
12+
tagNames: {
13+
propDefinition: [
14+
benchmarkone,
15+
"tagNames",
16+
],
17+
},
18+
email: {
19+
propDefinition: [
20+
benchmarkone,
21+
"email",
22+
],
23+
},
24+
contactId: {
25+
propDefinition: [
26+
benchmarkone,
27+
"contactId",
28+
],
29+
optional: true,
30+
},
31+
contactEmail: {
32+
propDefinition: [
33+
benchmarkone,
34+
"contactEmail",
35+
],
36+
optional: true,
37+
},
38+
firstName: {
39+
propDefinition: [
40+
benchmarkone,
41+
"firstName",
42+
],
43+
optional: true,
44+
},
45+
lastName: {
46+
propDefinition: [
47+
benchmarkone,
48+
"lastName",
49+
],
50+
optional: true,
51+
},
52+
phoneNumbers: {
53+
propDefinition: [
54+
benchmarkone,
55+
"phoneNumbers",
56+
],
57+
optional: true,
58+
},
59+
addresses: {
60+
propDefinition: [
61+
benchmarkone,
62+
"addresses",
63+
],
64+
optional: true,
65+
},
66+
},
67+
async run({ $ }) {
68+
const response = await this.benchmarkone.addTagToContact({
69+
contactId: this.contactId,
70+
contactEmail: this.contactEmail,
71+
firstName: this.firstName,
72+
lastName: this.lastName,
73+
email: this.email,
74+
phoneNumbers: this.phoneNumbers,
75+
addresses: this.addresses,
76+
tagNames: this.tagNames,
77+
});
78+
79+
const contactId = response.contactId;
80+
const addedTags = this.tagNames.join(", ");
81+
$.export("$summary", `Added tags [${addedTags}] to contact ID ${contactId}`);
82+
return response;
83+
},
84+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import benchmarkone from "../../benchmarkone.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "benchmarkone-create-contact",
6+
name: "Create Contact",
7+
description: "Creates a new contact in BenchmarkONE. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
benchmarkone,
12+
firstName: {
13+
propDefinition: [
14+
benchmarkone,
15+
"firstName",
16+
],
17+
},
18+
lastName: {
19+
propDefinition: [
20+
benchmarkone,
21+
"lastName",
22+
],
23+
},
24+
email: {
25+
propDefinition: [
26+
benchmarkone,
27+
"email",
28+
],
29+
},
30+
phoneNumbers: {
31+
propDefinition: [
32+
benchmarkone,
33+
"phoneNumbers",
34+
],
35+
optional: true,
36+
},
37+
addresses: {
38+
propDefinition: [
39+
benchmarkone,
40+
"addresses",
41+
],
42+
optional: true,
43+
},
44+
},
45+
async run({ $ }) {
46+
try {
47+
const response = await this.benchmarkone.createContact({
48+
firstName: this.firstName,
49+
lastName: this.lastName,
50+
email: this.email,
51+
phoneNumbers: this.phoneNumbers,
52+
addresses: this.addresses,
53+
});
54+
$.export("$summary", `Created contact with ID: ${response.contactId}`);
55+
return response;
56+
} catch (error) {
57+
throw new Error(`Failed to create contact: ${error.message}`);
58+
}
59+
},
60+
};
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import benchmarkone from "../../benchmarkone.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "benchmarkone-update-contact",
6+
name: "Update Contact",
7+
description: "Updates an existing contact. [See the documentation](https://sandbox.hatchbuck.com/api/dist/)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
benchmarkone: {
12+
type: "app",
13+
app: "benchmarkone",
14+
},
15+
contactId: {
16+
propDefinition: [
17+
benchmarkone,
18+
"contactId",
19+
],
20+
},
21+
contactEmail: {
22+
propDefinition: [
23+
benchmarkone,
24+
"contactEmail",
25+
],
26+
optional: true,
27+
},
28+
firstName: {
29+
propDefinition: [
30+
benchmarkone,
31+
"firstName",
32+
],
33+
optional: true,
34+
},
35+
lastName: {
36+
propDefinition: [
37+
benchmarkone,
38+
"lastName",
39+
],
40+
optional: true,
41+
},
42+
phoneNumbers: {
43+
propDefinition: [
44+
benchmarkone,
45+
"phoneNumbers",
46+
],
47+
optional: true,
48+
},
49+
addresses: {
50+
propDefinition: [
51+
benchmarkone,
52+
"addresses",
53+
],
54+
optional: true,
55+
},
56+
},
57+
async run({ $ }) {
58+
const response = await this.benchmarkone.updateContact({
59+
contactId: this.contactId,
60+
contactEmail: this.contactEmail,
61+
firstName: this.firstName,
62+
lastName: this.lastName,
63+
phoneNumbers: this.phoneNumbers,
64+
addresses: this.addresses,
65+
});
66+
$.export("$summary", "Contact updated successfully.");
67+
return response;
68+
},
69+
};

0 commit comments

Comments
 (0)