Skip to content

Commit 82f4676

Browse files
Merging pull request #16746
* Added actions * Added actions * Added actions * updates * pnpm-lock.yaml * update --------- Co-authored-by: Michelle Bergeron <[email protected]>
1 parent 21e5264 commit 82f4676

File tree

8 files changed

+203
-28
lines changed

8 files changed

+203
-28
lines changed

components/tubular/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import app from "../../tubular.app.mjs";
2+
3+
export default {
4+
key: "tubular-create-lead",
5+
name: "Create Lead",
6+
description: "Create lead and return its ID. [See the documentation](https://developer.tubular.io/examples/#create-lead-and-return-its-id)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
firstName: {
12+
propDefinition: [
13+
app,
14+
"firstName",
15+
],
16+
},
17+
lastName: {
18+
propDefinition: [
19+
app,
20+
"lastName",
21+
],
22+
},
23+
note: {
24+
propDefinition: [
25+
app,
26+
"note",
27+
],
28+
},
29+
lead: {
30+
propDefinition: [
31+
app,
32+
"lead",
33+
],
34+
},
35+
},
36+
async run({ $ }) {
37+
const query = `
38+
mutation {
39+
addContact(input: {
40+
firstName: "${this.firstName}",
41+
lastName: "${this.lastName}",
42+
note: "${this.note}",
43+
lead: ${this.lead}
44+
}) {
45+
contact {
46+
id
47+
}
48+
}
49+
}
50+
`;
51+
52+
const response = await this.app.post({
53+
$,
54+
data: {
55+
query,
56+
},
57+
});
58+
59+
$.export("$summary", "Successfully created Lead with ID: " + response.data.addContact.contact.id);
60+
return response;
61+
},
62+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import app from "../../tubular.app.mjs";
2+
3+
export default {
4+
key: "tubular-get-deals-by-date",
5+
name: "Get Deals By Date",
6+
description: "Get deals ordered by date of creation. [See the documentation](https://developer.tubular.io/examples/#get-deals-ordered-by-date-of-creation)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
},
12+
async run({ $ }) {
13+
const query = `{
14+
viewer{
15+
pipelines(first:100){
16+
edges{
17+
node{
18+
deals(orderBy:CREATED_AT, direction: DESC){
19+
edges{
20+
node{
21+
id
22+
name
23+
currency
24+
}
25+
}
26+
}
27+
}
28+
}
29+
}
30+
}
31+
}`;
32+
const response = await this.app.post({
33+
$,
34+
data: {
35+
query,
36+
},
37+
});
38+
$.export("$summary", "Successfully fetched Deals");
39+
return response;
40+
},
41+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import app from "../../tubular.app.mjs";
2+
3+
export default {
4+
key: "tubular-get-leads",
5+
name: "Get Leads",
6+
description: "Get leads ordered by date of creation. [See the documentation](https://developer.tubular.io/examples/#get-first-10-leads)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
},
12+
async run({ $ }) {
13+
const query = `{
14+
viewer{
15+
leads(first: 100){
16+
edges{
17+
node{
18+
id
19+
fullName
20+
email
21+
lead
22+
}
23+
}
24+
}
25+
}
26+
}`;
27+
const response = await this.app.post({
28+
$,
29+
data: {
30+
query,
31+
},
32+
});
33+
$.export("$summary", "Successfully fetched Leads");
34+
return response;
35+
},
36+
};

components/tubular/app/tubular.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

components/tubular/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
22
"name": "@pipedream/tubular",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "Pipedream Tubular Components",
5-
"main": "dist/app/tubular.app.mjs",
5+
"main": "tubular.app.mjs",
66
"keywords": [
77
"pipedream",
88
"tubular"
99
],
10-
"files": ["dist"],
1110
"homepage": "https://pipedream.com/apps/tubular",
1211
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1312
"publishConfig": {
1413
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1517
}
1618
}

components/tubular/tubular.app.mjs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "tubular",
6+
propDefinitions: {
7+
firstName: {
8+
type: "string",
9+
label: "First Name",
10+
description: "The contact's first name",
11+
},
12+
lastName: {
13+
type: "string",
14+
label: "Last Name",
15+
description: "The contact's last name",
16+
},
17+
note: {
18+
type: "string",
19+
label: "Note",
20+
description: "A note about the contact",
21+
},
22+
lead: {
23+
type: "boolean",
24+
label: "Lead",
25+
description: "Indicates whether the contact is a lead",
26+
},
27+
},
28+
methods: {
29+
_baseUrl() {
30+
return "https://api.tubular.io/graphql";
31+
},
32+
async _makeRequest(opts = {}) {
33+
const {
34+
$ = this,
35+
headers,
36+
...otherOpts
37+
} = opts;
38+
return axios($, {
39+
...otherOpts,
40+
url: this._baseUrl(),
41+
headers: {
42+
"Authorization": `${this.$auth.api_token}`,
43+
...headers,
44+
},
45+
});
46+
},
47+
async post(args = {}) {
48+
return this._makeRequest({
49+
method: "POST",
50+
...args,
51+
});
52+
},
53+
},
54+
};

pnpm-lock.yaml

Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)