Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 0 additions & 3 deletions components/tubular/.gitignore

This file was deleted.

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

export default {
key: "tubular-create-lead",
name: "Create Lead",
description: "Create lead and return its ID. [See the documentation](https://developer.tubular.io/examples/#create-lead-and-return-its-id)",
version: "0.0.1",
type: "action",
props: {
app,
firstName: {
propDefinition: [
app,
"firstName",
],
},
lastName: {
propDefinition: [
app,
"lastName",
],
},
note: {
propDefinition: [
app,
"note",
],
},
lead: {
propDefinition: [
app,
"lead",
],
},
},
async run({ $ }) {
const query = `
mutation {
addContact(input: {
firstName: "${this.firstName}",
lastName: "${this.lastName}",
note: "${this.note}",
lead: ${this.lead}
}) {
contact {
id
}
}
}
`;

const response = await this.app.createLead({
$,
data: {
query,
},
});

$.export("$summary", "Successfully created Lead with ID: " + response.data.addContact.contact.id);
return response;
},
};
41 changes: 41 additions & 0 deletions components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import app from "../../tubular.app.mjs";

export default {
key: "tubular-get-deals-by-date",
name: "Get Deals By Date",
description: "Get deals ordered by date of creation. [See the documentation](https://developer.tubular.io/examples/#get-deals-ordered-by-date-of-creation)",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const query = `{
viewer{
pipelines(first:100){
edges{
node{
deals(orderBy:CREATED_AT, direction: DESC){
edges{
node{
id
name
currency
}
}
}
}
}
}
}
}`;
const response = await this.app.getDealsByDate({
$,
data: {
query,
},
});
$.export("$summary", "Successfully fetched Deals");
return response;
},
};
37 changes: 37 additions & 0 deletions components/tubular/actions/get-leads/get-leads.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import app from "../../tubular.app.mjs";

export default {
key: "tubular-get-leads",
name: "Get Leads",
description: "Get leads ordered by date of creation. [See the documentation](https://developer.tubular.io/examples/#get-first-10-leads)",
version: "0.0.1",
type: "action",
props: {
app,

},
async run({ $ }) {
const query = `{
viewer{
leads(first: 100){
edges{
node{
id
fullName
email
lead
}
}
}
}
}`;
const response = await this.app.getLeads({
$,
data: {
query,
},
});
$.export("$summary", "Successfully fetched Leads");
return response;
},
};
13 changes: 0 additions & 13 deletions components/tubular/app/tubular.app.ts

This file was deleted.

66 changes: 66 additions & 0 deletions components/tubular/tubular.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "tubular",
propDefinitions: {
firstName: {
type: "string",
label: "First Name",
description: "The contact's first name",
},
lastName: {
type: "string",
label: "Last Name",
description: "The contact's last name",
},
note: {
type: "string",
label: "Note",
description: "A note about the contact",
},
lead: {
type: "boolean",
label: "Lead",
description: "Indicates whether the contact is a lead",
},
},
methods: {
_baseUrl() {
return "https://api.tubular.io/graphql";
},
async _makeRequest(opts = {}) {
const {
$ = this,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl(),
headers: {
"Authorization": `${this.$auth.api_token}`,
...headers,
},
});
},
async createLead(args = {}) {
return this._makeRequest({
method: "POST",
...args,
});
},
async getDealsByDate(args = {}) {
return this._makeRequest({
method: "POST",
...args,
});
},
async getLeads(args = {}) {
return this._makeRequest({
method: "POST",
...args,
});
},
},
};
14 changes: 5 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading