Skip to content

Commit 62b0c84

Browse files
Merge branch 'master' of github.com:PipedreamHQ/pipedream
2 parents dccb2a7 + de4f748 commit 62b0c84

File tree

34 files changed

+859
-113
lines changed

34 files changed

+859
-113
lines changed

components/apollo_io/actions/search-accounts/search-accounts.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "Search For Accounts",
77
description: "Search for accounts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)",
88
type: "action",
9-
version: "0.0.5",
9+
version: "0.0.6",
1010
props: {
1111
app,
1212
search: {
@@ -40,7 +40,7 @@ export default {
4040
},
4141
},
4242
async run({ $ }) {
43-
const resourcesStream = this.app.getResourcesStream({
43+
const resourcesStream = this.app.getIterations({
4444
resourceFn: this.app.searchAccounts,
4545
resourceFnArgs: {
4646
params: {
@@ -53,7 +53,7 @@ export default {
5353
resourceName: "accounts",
5454
});
5555

56-
const accounts = await utils.streamIterator(resourcesStream);
56+
const accounts = await utils.iterate(resourcesStream);
5757

5858
$.export("$summary", `Successfully fetched ${accounts.length} accounts.`);
5959

components/apollo_io/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/apollo_io",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"description": "Pipedream Apollo.io Components",
55
"main": "apollo_io.app.mjs",
66
"keywords": [

components/issue_badge/issue_badge.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import leaddyno from "../../leaddyno.app.mjs";
2+
3+
export default {
4+
key: "leaddyno-create-affiliate",
5+
name: "Create Affiliate",
6+
description: "Creates a new affiliate in LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/affiliates/post-affiliates)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
leaddyno,
11+
email: {
12+
type: "string",
13+
label: "Email",
14+
description: "The email address of the affiliate",
15+
},
16+
firstName: {
17+
type: "string",
18+
label: "First Name",
19+
description: "The first name of the affiliate",
20+
optional: true,
21+
},
22+
lastName: {
23+
type: "string",
24+
label: "Last Name",
25+
description: "The last name of the affiliate",
26+
optional: true,
27+
},
28+
affiliateCode: {
29+
type: "string",
30+
label: "Affiliate Code",
31+
description: "A custom affiliate code for the new affiliate",
32+
optional: true,
33+
},
34+
paypalEmail: {
35+
type: "string",
36+
label: "PayPal Email",
37+
description: "The PayPal email address for affiliate payouts",
38+
optional: true,
39+
},
40+
unsubscribed: {
41+
type: "boolean",
42+
label: "Unsubscribed",
43+
description: "Indicates whether the affiliate is unsubscribed from communications",
44+
optional: true,
45+
},
46+
affiliateType: {
47+
type: "string",
48+
label: "Affiliate Type",
49+
description: "The code for the affiliate's group",
50+
optional: true,
51+
},
52+
overrideApproval: {
53+
type: "boolean",
54+
label: "Override Approval",
55+
description: "If set to true, the affiliate will not require approval",
56+
optional: true,
57+
},
58+
},
59+
async run({ $ }) {
60+
const response = await this.leaddyno.createAffiliate({
61+
$,
62+
data: {
63+
email: this.email,
64+
first_name: this.firstName,
65+
last_name: this.lastName,
66+
affiliate_code: this.affiliateCode,
67+
paypal_email: this.paypalEmail,
68+
unsubscribed: this.unsubscribed,
69+
affiliate_type: this.affiliateType,
70+
override_approval: this.overrideApproval,
71+
},
72+
});
73+
74+
$.export("$summary", `Successfully created affiliate with ID ${response.id}`);
75+
76+
return response;
77+
},
78+
};
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import leaddyno from "../../leaddyno.app.mjs";
2+
3+
export default {
4+
key: "leaddyno-create-lead",
5+
name: "Create Lead",
6+
description: "Creates a new lead in LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/leaddyno-api#POSTCreate-a-lead)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
leaddyno,
11+
email: {
12+
type: "string",
13+
label: "Email",
14+
description: "The email address of the lead",
15+
},
16+
firstName: {
17+
type: "string",
18+
label: "First Name",
19+
description: "The first name of the lead",
20+
optional: true,
21+
},
22+
lastName: {
23+
type: "string",
24+
label: "Last Name",
25+
description: "The last name of the lead",
26+
optional: true,
27+
},
28+
address1: {
29+
type: "string",
30+
label: "Address 1",
31+
description: "The first line of the address of the lead",
32+
optional: true,
33+
},
34+
address2: {
35+
type: "string",
36+
label: "Address 2",
37+
description: "The second line of the address of the lead",
38+
optional: true,
39+
},
40+
city: {
41+
type: "string",
42+
label: "City",
43+
description: "The city of the lead",
44+
optional: true,
45+
},
46+
state: {
47+
type: "string",
48+
label: "State",
49+
description: "The state of the lead",
50+
optional: true,
51+
},
52+
zipcode: {
53+
type: "string",
54+
label: "Zipcode",
55+
description: "The zipcode of the lead",
56+
optional: true,
57+
},
58+
country: {
59+
type: "string",
60+
label: "Country",
61+
description: "The country of the lead",
62+
optional: true,
63+
},
64+
phone: {
65+
type: "string",
66+
label: "Phone",
67+
description: "The phone number of the lead",
68+
optional: true,
69+
},
70+
affiliate: {
71+
propDefinition: [
72+
leaddyno,
73+
"affiliate",
74+
],
75+
optional: true,
76+
},
77+
customStatus: {
78+
type: "string",
79+
label: "Custom Status",
80+
description: "The custom status of the lead",
81+
optional: true,
82+
},
83+
},
84+
async run({ $ }) {
85+
86+
const response = await this.leaddyno.createLead({
87+
$,
88+
data: {
89+
email: this.email,
90+
first_name: this.firstName,
91+
last_name: this.lastName,
92+
address1: this.address1,
93+
address2: this.address2,
94+
city: this.city,
95+
state: this.state,
96+
zipcode: this.zipcode,
97+
country: this.country,
98+
phone: this.phone,
99+
affiliate: this.affiliate,
100+
custom_status: this.customStatus,
101+
},
102+
});
103+
104+
$.export("$summary", `Successfully created lead with email ${this.email}`);
105+
106+
return response;
107+
},
108+
};
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import { parseObject } from "../../common/utils.mjs";
2+
import leaddyno from "../../leaddyno.app.mjs";
3+
4+
export default {
5+
key: "leaddyno-create-purchase",
6+
name: "Create Purchase",
7+
description: "Creates a new purchase in LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/purchases/post-purchases)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
leaddyno,
12+
email: {
13+
propDefinition: [
14+
leaddyno,
15+
"leadEmail",
16+
],
17+
},
18+
purchaseCode: {
19+
type: "string",
20+
label: "Purchase Code",
21+
description: "A unique identifier for this purchase. If not provided, a unique ID will be generated",
22+
optional: true,
23+
},
24+
purchaseAmount: {
25+
type: "string",
26+
label: "Purchase Amount",
27+
description: "The total amount of the purchase, used for percentage commission calculations",
28+
optional: true,
29+
},
30+
planCode: {
31+
type: "string",
32+
label: "Plan Code",
33+
description: "The code of the reward structure used for calculating affiliate commissions",
34+
optional: true,
35+
},
36+
affiliateCode: {
37+
propDefinition: [
38+
leaddyno,
39+
"affiliateCode",
40+
],
41+
optional: true,
42+
},
43+
commissionAmount: {
44+
type: "string",
45+
label: "Commission Amount Override",
46+
description: "An overriding commission amount that will replace any predefined plan and provide an immediate fixed-amount commission. This value should be a decimal",
47+
optional: true,
48+
},
49+
description: {
50+
type: "string",
51+
label: "Description",
52+
description: "Text description of the purchase",
53+
optional: true,
54+
},
55+
reassignAffiliate: {
56+
type: "boolean",
57+
label: "Reassign Affiliate",
58+
description: "If set to false, the original affiliate of the lead will be retained.",
59+
optional: true,
60+
},
61+
lineItems: {
62+
type: "string[]",
63+
label: "Line Items",
64+
description: "A list of JSON object containing the line items associated with the purchase. **Format: [{\"sku\": \"string\", \"description\": \"string\", \"quantity\": \"string\", \"amount\": \"string\"}]**",
65+
optional: true,
66+
},
67+
},
68+
async run({ $ }) {
69+
const response = await this.leaddyno.createPurchase({
70+
$,
71+
data: {
72+
email: this.email,
73+
purchase_code: this.purchaseCode,
74+
purchase_amount: this.purchaseAmount && parseFloat(this.purchaseAmount),
75+
plan_code: this.planCode,
76+
code: this.affiliateCode,
77+
commission_amount_override: this.commissionAmount && parseFloat(this.commissionAmount),
78+
description: this.description,
79+
reassign_affiliate: this.reassignAffiliate,
80+
line_items: parseObject(this.lineItems),
81+
},
82+
});
83+
84+
$.export("$summary", `Successfully created purchase with ID ${response.id}`);
85+
86+
return response;
87+
},
88+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import leaddyno from "../../leaddyno.app.mjs";
2+
3+
export default {
4+
key: "leaddyno-retrieve-lead",
5+
name: "Retrieve Lead",
6+
description: "Retrieves information about a lead from LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/leads/retrieve-a-lead-by-id)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
leaddyno,
11+
leadId: {
12+
propDefinition: [
13+
leaddyno,
14+
"leadId",
15+
],
16+
description: "The ID of the lead to retrieve",
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.leaddyno.getLead({
21+
$,
22+
leadId: this.leadId,
23+
});
24+
25+
$.export("$summary", `Successfully retrieved lead with ID ${this.leadId}`);
26+
return response;
27+
},
28+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const parseObject = (obj) => {
2+
if (!obj) return undefined;
3+
4+
if (Array.isArray(obj)) {
5+
return obj.map((item) => {
6+
if (typeof item === "string") {
7+
try {
8+
return JSON.parse(item);
9+
} catch (e) {
10+
return item;
11+
}
12+
}
13+
return item;
14+
});
15+
}
16+
if (typeof obj === "string") {
17+
try {
18+
return JSON.parse(obj);
19+
} catch (e) {
20+
return obj;
21+
}
22+
}
23+
return obj;
24+
};

0 commit comments

Comments
 (0)