Skip to content

Commit 9b469a0

Browse files
authored
Merging pull request #18498
* Update @pipedream/the_official_board to version 0.1.0, add new actions for exporting org charts as PDF and XLSX, and retrieving executive and org chart information. * pnpm update
1 parent 7534a2b commit 9b469a0

File tree

9 files changed

+302
-7
lines changed

9 files changed

+302
-7
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import fs from "fs";
2+
import app from "../../the_official_board.app.mjs";
3+
4+
export default {
5+
key: "the_official_board-create-orgchart-pdf-file",
6+
name: "Create Orgchart PDF File",
7+
description: "Export organization chart as PDF file. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_export_orgchart_pdf)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
companyId: {
13+
propDefinition: [
14+
app,
15+
"companyId",
16+
],
17+
description: "The ID of the company to export orgchart for",
18+
},
19+
filename: {
20+
type: "string",
21+
label: "Target Filename",
22+
description: "The filename that will be used to save in /tmp",
23+
},
24+
syncDir: {
25+
type: "dir",
26+
accessMode: "write",
27+
sync: true,
28+
},
29+
},
30+
async run({ $ }) {
31+
const response = await this.app.exportOrgchartPdf({
32+
$,
33+
params: {
34+
id: this.companyId,
35+
},
36+
});
37+
38+
const filePath = `/tmp/${this.filename}`;
39+
fs.writeFileSync(filePath, response);
40+
41+
$.export("$summary", `Successfully exported orgchart for company with ID ${this.companyId}`);
42+
43+
return {
44+
filename: this.filename,
45+
filePath,
46+
contentType: "application/pdf",
47+
};
48+
},
49+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import fs from "fs";
2+
import app from "../../the_official_board.app.mjs";
3+
4+
export default {
5+
key: "the_official_board-create-orgchart-xlsx-file",
6+
name: "Create Orgchart XLSX File",
7+
description: "Export organization chart as XLSX file. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_export_orgchart_excel)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
companyId: {
13+
propDefinition: [
14+
app,
15+
"companyId",
16+
],
17+
description: "The ID of the company to export orgchart for",
18+
},
19+
filename: {
20+
type: "string",
21+
label: "Target Filename",
22+
description: "The filename that will be used to save in /tmp",
23+
},
24+
syncDir: {
25+
type: "dir",
26+
accessMode: "write",
27+
sync: true,
28+
},
29+
},
30+
async run({ $ }) {
31+
const response = await this.app.exportOrgchartExcel({
32+
$,
33+
params: {
34+
id: this.companyId,
35+
},
36+
});
37+
38+
const filePath = `/tmp/${this.filename}`;
39+
fs.writeFileSync(filePath, response);
40+
41+
$.export("$summary", `Successfully exported orgchart for company with ID ${this.companyId}`);
42+
43+
return {
44+
filename: this.filename,
45+
filePath,
46+
contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
47+
};
48+
},
49+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import app from "../../the_official_board.app.mjs";
2+
3+
export default {
4+
key: "the_official_board-get-executive-info",
5+
name: "Get Executive Info",
6+
description: "Get executive biography information. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Executives/get_executive_biography)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
executiveId: {
12+
propDefinition: [
13+
app,
14+
"executiveId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.getExecutiveBiography({
20+
$,
21+
params: {
22+
bioID: this.executiveId,
23+
},
24+
});
25+
26+
$.export("$summary", `Successfully retrieved executive information for executive with ID ${this.executiveId}`);
27+
return response;
28+
},
29+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import app from "../../the_official_board.app.mjs";
2+
3+
export default {
4+
key: "the_official_board-get-orgchart-info",
5+
name: "Get Orgchart Info",
6+
description: "Get organization chart information for a company. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_company_orgchart)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
companyId: {
12+
propDefinition: [
13+
app,
14+
"companyId",
15+
],
16+
description: "The ID of the company to get orgchart for",
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.app.getCompanyOrgchart({
21+
$,
22+
params: {
23+
id: this.companyId,
24+
},
25+
});
26+
27+
$.export("$summary", `Successfully retrieved orgchart information for company with ID ${this.companyId}`);
28+
return response;
29+
},
30+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import app from "../../the_official_board.app.mjs";
2+
3+
export default {
4+
key: "the_official_board-search-company-org-chart-id",
5+
name: "Search Company Org Chart ID",
6+
description: "Search for company org chart identifier. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Companies/get_company_search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
companyName: {
12+
type: "string",
13+
label: "Company Name",
14+
description: "The name of the company to search for",
15+
},
16+
amount: {
17+
type: "integer",
18+
label: "Amount",
19+
description: "Amount of search results",
20+
max: 50,
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.app.getCompanySearch({
25+
$,
26+
params: {
27+
companyName: this.companyName,
28+
amount: this.amount,
29+
},
30+
});
31+
32+
$.export("$summary", `Successfully retrieved ${response.length} companies with name ${this.companyName}`);
33+
return response;
34+
},
35+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import app from "../../the_official_board.app.mjs";
2+
3+
export default {
4+
key: "the_official_board-search-executive-by-name",
5+
name: "Search Executive",
6+
description: "Search for executives by name. [See the documentation](https://rest.theofficialboard.com/rest/api/doc/#/Executives/get_executive_search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
name: {
12+
type: "string",
13+
label: "Name",
14+
description: "The name of the executive to search for",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.app.getExecutiveSearch({
19+
$,
20+
params: {
21+
name: this.name,
22+
},
23+
});
24+
25+
$.export("$summary", `Successfully retrieved ${response.length} executives with name ${this.name}`);
26+
return response;
27+
},
28+
};

components/the_official_board/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/the_official_board",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream The Official Board Components",
55
"main": "the_official_board.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
15-
}
18+
}
Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,79 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "the_official_board",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
companyId: {
8+
type: "string",
9+
label: "Company ID",
10+
description: "The ID of the company",
11+
},
12+
executiveId: {
13+
type: "string",
14+
label: "Bio ID",
15+
description: "The ID of the executive to get information for",
16+
},
17+
},
518
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
19+
_baseApiUrl() {
20+
return "https://rest.theofficialboard.com/rest";
21+
},
22+
_headers(headers = {}) {
23+
return {
24+
"token": this.$auth.api_token,
25+
"Accept": "application/json",
26+
...headers,
27+
};
28+
},
29+
_makeRequest({
30+
$ = this,
31+
path,
32+
...args
33+
} = {}) {
34+
return axios($, {
35+
url: `${this._baseApiUrl()}${path}`,
36+
headers: this._headers(),
37+
...args,
38+
});
39+
},
40+
getExecutiveSearch(opts = {}) {
41+
return this._makeRequest({
42+
path: "/executive/search",
43+
...opts,
44+
});
45+
},
46+
getCompanySearch(opts = {}) {
47+
return this._makeRequest({
48+
path: "/company/search",
49+
...opts,
50+
});
51+
},
52+
getCompanyOrgchart(opts = {}) {
53+
return this._makeRequest({
54+
path: "/company/orgchart",
55+
...opts,
56+
});
57+
},
58+
exportOrgchartExcel(opts = {}) {
59+
return this._makeRequest({
60+
path: "/export/orgchart-excel",
61+
responseType: "arraybuffer",
62+
...opts,
63+
});
64+
},
65+
exportOrgchartPdf(opts = {}) {
66+
return this._makeRequest({
67+
path: "/export/orgchart-pdf",
68+
responseType: "arraybuffer",
69+
...opts,
70+
});
71+
},
72+
getExecutiveBiography(opts = {}) {
73+
return this._makeRequest({
74+
path: "/executive/biography",
75+
...opts,
76+
});
977
},
1078
},
1179
};

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)