Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import fs from "fs";
import app from "../../the_official_board.app.mjs";

export default {
key: "the_official_board-create-orgchart-pdf-file",
name: "Create Orgchart PDF File",
description: "Export organization chart as PDF file. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_export_orgchart_pdf)",
version: "0.0.1",
type: "action",
props: {
app,
companyId: {
propDefinition: [
app,
"companyId",
],
description: "The ID of the company to export orgchart for",
},
filename: {
type: "string",
label: "Target Filename",
description: "The filename that will be used to save in /tmp",
},
syncDir: {
type: "dir",
accessMode: "write",
sync: true,
},
},
async run({ $ }) {
const response = await this.app.exportOrgchartPdf({
$,
params: {
id: this.companyId,
},
});

const filePath = `/tmp/${this.filename}`;
fs.writeFileSync(filePath, response);

$.export("$summary", `Successfully exported orgchart for company with ID ${this.companyId}`);

return {
filename: this.filename,
filePath,
contentType: "application/pdf",
};
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import fs from "fs";
import app from "../../the_official_board.app.mjs";

export default {
key: "the_official_board-create-orgchart-xlsx-file",
name: "Create Orgchart XLSX File",
description: "Export organization chart as XLSX file. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_export_orgchart_excel)",
version: "0.0.1",
type: "action",
props: {
app,
companyId: {
propDefinition: [
app,
"companyId",
],
description: "The ID of the company to export orgchart for",
},
filename: {
type: "string",
label: "Target Filename",
description: "The filename that will be used to save in /tmp",
},
syncDir: {
type: "dir",
accessMode: "write",
sync: true,
},
},
async run({ $ }) {
const response = await this.app.exportOrgchartExcel({
$,
params: {
id: this.companyId,
},
});

const filePath = `/tmp/${this.filename}`;
fs.writeFileSync(filePath, response);

$.export("$summary", `Successfully exported orgchart for company with ID ${this.companyId}`);

return {
filename: this.filename,
filePath,
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
};
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import app from "../../the_official_board.app.mjs";

export default {
key: "the_official_board-get-executive-info",
name: "Get Executive Info",
description: "Get executive biography information. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Executives/get_executive_biography)",
version: "0.0.1",
type: "action",
props: {
app,
executiveId: {
propDefinition: [
app,
"executiveId",
],
},
},
async run({ $ }) {
const response = await this.app.getExecutiveBiography({
$,
params: {
bioID: this.executiveId,
},
});

$.export("$summary", `Successfully retrieved executive information for executive with ID ${this.executiveId}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import app from "../../the_official_board.app.mjs";

export default {
key: "the_official_board-get-orgchart-info",
name: "Get Orgchart Info",
description: "Get organization chart information for a company. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_company_orgchart)",
version: "0.0.1",
type: "action",
props: {
app,
companyId: {
propDefinition: [
app,
"companyId",
],
description: "The ID of the company to get orgchart for",
},
},
async run({ $ }) {
const response = await this.app.getCompanyOrgchart({
$,
params: {
id: this.companyId,
},
});

$.export("$summary", `Successfully retrieved orgchart information for company with ID ${this.companyId}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import app from "../../the_official_board.app.mjs";

export default {
key: "the_official_board-search-company-org-chart-id",
name: "Search Company Org Chart ID",
description: "Search for company org chart identifier. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_company_search)",
version: "0.0.1",
type: "action",
props: {
app,
companyName: {
type: "string",
label: "Company Name",
description: "The name of the company to search for",
},
amount: {
type: "integer",
label: "Amount",
description: "Amount of search results",
max: 50,
},
},
async run({ $ }) {
const response = await this.app.getCompanySearch({
$,
params: {
companyName: this.companyName,
amount: this.amount,
},
});

$.export("$summary", `Successfully retrieved ${response.length} companies with name ${this.companyName}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import app from "../../the_official_board.app.mjs";

export default {
key: "the_official_board-search-executive-by-name",
name: "Search Executive",
description: "Search for executives by name. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Executives/get_executive_search)",
version: "0.0.1",
type: "action",
props: {
app,
name: {
type: "string",
label: "Name",
description: "The name of the executive to search for",
},
},
async run({ $ }) {
const response = await this.app.getExecutiveSearch({
$,
params: {
name: this.name,
},
});

$.export("$summary", `Successfully retrieved ${response.length} executives with name ${this.name}`);
return response;
},
};
7 changes: 5 additions & 2 deletions components/the_official_board/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/the_official_board",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream The Official Board Components",
"main": "the_official_board.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
}
76 changes: 72 additions & 4 deletions components/the_official_board/the_official_board.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,79 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "the_official_board",
propDefinitions: {},
propDefinitions: {
companyId: {
type: "string",
label: "Company ID",
description: "The ID of the company",
},
executiveId: {
type: "string",
label: "Bio ID",
description: "The ID of the executive to get information for",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseApiUrl() {
return "https://rest.theofficialboard.com/rest";
},
_headers(headers = {}) {
return {
"token": this.$auth.api_token,
"Accept": "application/json",
...headers,
};
},
_makeRequest({
$ = this,
path,
...args
} = {}) {
return axios($, {
url: `${this._baseApiUrl()}${path}`,
headers: this._headers(),
...args,
});
},
getExecutiveSearch(opts = {}) {
return this._makeRequest({
path: "/executive/search",
...opts,
});
},
getCompanySearch(opts = {}) {
return this._makeRequest({
path: "/company/search",
...opts,
});
},
getCompanyOrgchart(opts = {}) {
return this._makeRequest({
path: "/company/orgchart",
...opts,
});
},
exportOrgchartExcel(opts = {}) {
return this._makeRequest({
path: "/export/orgchart-excel",
responseType: "arraybuffer",
...opts,
});
},
exportOrgchartPdf(opts = {}) {
return this._makeRequest({
path: "/export/orgchart-pdf",
responseType: "arraybuffer",
...opts,
});
},
getExecutiveBiography(opts = {}) {
return this._makeRequest({
path: "/executive/biography",
...opts,
});
},
},
};
Loading
Loading