Skip to content

Commit 069b8f7

Browse files
authored
Merging pull request #18197
* new components * pnpm-lock.yaml
1 parent 36f3c89 commit 069b8f7

File tree

8 files changed

+394
-5
lines changed

8 files changed

+394
-5
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import bamboohr from "../../bamboohr.app.mjs";
2+
3+
export default {
4+
key: "bamboohr-add-application-comment",
5+
name: "Add Application Comment",
6+
description: "Add a comment to an application. [See the documentation](https://documentation.bamboohr.com/reference/post-application-comment-1)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
bamboohr,
11+
applicationId: {
12+
propDefinition: [
13+
bamboohr,
14+
"applicationId",
15+
],
16+
},
17+
comment: {
18+
type: "string",
19+
label: "Comment",
20+
description: "The comment to add to the application",
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.bamboohr.addApplicationComment({
25+
$,
26+
applicationId: this.applicationId,
27+
data: {
28+
comment: this.comment,
29+
type: "comment",
30+
},
31+
});
32+
$.export("$summary", `Added comment to application ${this.applicationId}`);
33+
return response;
34+
},
35+
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import bamboohr from "../../bamboohr.app.mjs";
2+
import fs from "fs";
3+
import { ConfigurationError } from "@pipedream/platform";
4+
5+
export default {
6+
key: "bamboohr-download-resume",
7+
name: "Download Resume",
8+
description: "Download a resume from an application. [See the documentation](https://documentation.bamboohr.com/reference/get-company-file)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
bamboohr,
13+
applicationId: {
14+
propDefinition: [
15+
bamboohr,
16+
"applicationId",
17+
],
18+
},
19+
filename: {
20+
type: "string",
21+
label: "Filename",
22+
description: "The filename to save the downloaded file as in the `/tmp` directory",
23+
},
24+
syncDir: {
25+
type: "dir",
26+
accessMode: "write",
27+
sync: true,
28+
},
29+
},
30+
async run({ $ }) {
31+
const { resumeFileId } = await this.bamboohr.getApplication({
32+
$,
33+
applicationId: this.applicationId,
34+
});
35+
36+
if (!resumeFileId) {
37+
throw new ConfigurationError("No resume file ID found for application");
38+
}
39+
40+
const response = await this.bamboohr.downloadFile({
41+
$,
42+
fileId: resumeFileId,
43+
});
44+
45+
const rawcontent = response.toString("base64");
46+
const buffer = Buffer.from(rawcontent, "base64");
47+
const downloadedFilepath = `/tmp/${this.filename}`;
48+
fs.writeFileSync(downloadedFilepath, buffer);
49+
50+
$.export("$summary", `Downloaded resume for application ${this.applicationId}`);
51+
52+
return {
53+
filename: this.filename,
54+
downloadedFilepath,
55+
};
56+
},
57+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import bamboohr from "../../bamboohr.app.mjs";
2+
3+
export default {
4+
key: "bamboohr-get-application",
5+
name: "Get Application",
6+
description: "Get the details of an application. [See the documentation](https://documentation.bamboohr.com/reference/get-application-details-1)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
bamboohr,
11+
applicationId: {
12+
propDefinition: [
13+
bamboohr,
14+
"applicationId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.bamboohr.getApplication({
20+
$,
21+
applicationId: this.applicationId,
22+
});
23+
$.export("$summary", `Found application ${this.applicationId}`);
24+
return response;
25+
},
26+
};
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import bamboohr from "../../bamboohr.app.mjs";
2+
import constants from "../../common/constants.mjs";
3+
4+
export default {
5+
key: "bamboohr-list-applications",
6+
name: "List Applications",
7+
description: "List all applications. [See the documentation](https://documentation.bamboohr.com/reference/get-applications)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
bamboohr,
12+
jobId: {
13+
propDefinition: [
14+
bamboohr,
15+
"jobId",
16+
],
17+
},
18+
statusId: {
19+
propDefinition: [
20+
bamboohr,
21+
"statusId",
22+
],
23+
optional: true,
24+
},
25+
statusGroup: {
26+
type: "string",
27+
label: "Status Group",
28+
description: "The group of statuses to filter by",
29+
options: constants.APPLICATION_STATUS_GROUPS,
30+
optional: true,
31+
},
32+
jobStatusGroup: {
33+
type: "string",
34+
label: "Job Status Group",
35+
description: "The group of job statuses to filter by",
36+
options: constants.JOB_STATUS_GROUPS,
37+
optional: true,
38+
},
39+
searchString: {
40+
type: "string",
41+
label: "Search String",
42+
description: "A general search criteria by which to find applications",
43+
optional: true,
44+
},
45+
sortBy: {
46+
type: "string",
47+
label: "Sort By",
48+
description: "The field to sort by",
49+
options: constants.APPLICATION_SORT_FIELDS,
50+
optional: true,
51+
},
52+
sortOrder: {
53+
type: "string",
54+
label: "Sort Order",
55+
description: "The order in which to sort the results",
56+
options: [
57+
"ASC",
58+
"DESC",
59+
],
60+
optional: true,
61+
},
62+
newSince: {
63+
type: "string",
64+
label: "New Since",
65+
description: "Only get applications newer than a given UTC timestamp, for example `2024-01-01 13:00:00`",
66+
optional: true,
67+
},
68+
page: {
69+
type: "integer",
70+
label: "Page",
71+
description: "The page number to return",
72+
optional: true,
73+
},
74+
},
75+
async run({ $ }) {
76+
const response = await this.bamboohr.listApplications({
77+
$,
78+
params: {
79+
jobId: this.jobId,
80+
applicationStatusId: this.statusId,
81+
applicationStatus: this.statusGroup,
82+
jobStatusGroups: this.jobStatusGroup,
83+
searchString: this.searchString,
84+
sortBy: this.sortBy,
85+
sortOrder: this.sortOrder,
86+
newSince: this.newSince,
87+
page: this.page,
88+
},
89+
});
90+
$.export("$summary", `Found ${response.applications.length} applications`);
91+
return response;
92+
},
93+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import bamboohr from "../../bamboohr.app.mjs";
2+
3+
export default {
4+
key: "bamboohr-update-application-status",
5+
name: "Update Application Status",
6+
description: "Update the status of an application. [See the documentation](https://documentation.bamboohr.com/reference/post-applicant-status-1)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
bamboohr,
11+
applicationId: {
12+
propDefinition: [
13+
bamboohr,
14+
"applicationId",
15+
],
16+
},
17+
statusId: {
18+
propDefinition: [
19+
bamboohr,
20+
"statusId",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.bamboohr.updateApplicationStatus({
26+
$,
27+
applicationId: this.applicationId,
28+
data: {
29+
status: this.statusId,
30+
},
31+
});
32+
$.export("$summary", "Updated status of application.");
33+
return response;
34+
},
35+
};
Lines changed: 112 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,119 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "bamboohr",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
applicationId: {
8+
type: "string",
9+
label: "Application ID",
10+
description: "The ID of an application",
11+
async options({ page }) {
12+
const { applications } = await this.listApplications({
13+
params: {
14+
page: page + 1,
15+
},
16+
});
17+
return applications?.map((application) => ({
18+
label: `${application.applicant.firstName} ${application.applicant.lastName}`,
19+
value: application.id,
20+
})) || [];
21+
},
22+
},
23+
jobId: {
24+
type: "string",
25+
label: "Job ID",
26+
description: "The ID of a job",
27+
optional: true,
28+
async options() {
29+
const jobs = await this.listJobs();
30+
return jobs?.map((job) => ({
31+
label: job.title.label,
32+
value: job.id,
33+
})) || [];
34+
},
35+
},
36+
statusId: {
37+
type: "string",
38+
label: "Status ID",
39+
description: "The ID of a job status",
40+
async options() {
41+
const statuses = await this.listStatuses();
42+
return statuses?.map((status) => ({
43+
label: status.name,
44+
value: status.id,
45+
})) || [];
46+
},
47+
},
48+
},
549
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
50+
_baseUrl() {
51+
return `https://api.bamboohr.com/api/gateway.php/${this.$auth.company_domain}/v1`;
52+
},
53+
_makeRequest({
54+
$ = this, path, ...opts
55+
}) {
56+
return axios($, {
57+
url: `${this._baseUrl()}${path}`,
58+
auth: {
59+
username: `${this.$auth.api_key}`,
60+
password: "x",
61+
},
62+
...opts,
63+
});
64+
},
65+
getApplication({
66+
applicationId, ...opts
67+
}) {
68+
return this._makeRequest({
69+
path: `/applicant_tracking/applications/${applicationId}`,
70+
...opts,
71+
});
72+
},
73+
listApplications(opts = {}) {
74+
return this._makeRequest({
75+
path: "/applicant_tracking/applications",
76+
...opts,
77+
});
78+
},
79+
listJobs(opts = {}) {
80+
return this._makeRequest({
81+
path: "/applicant_tracking/jobs",
82+
...opts,
83+
});
84+
},
85+
listStatuses(opts = {}) {
86+
return this._makeRequest({
87+
path: "/applicant_tracking/statuses",
88+
...opts,
89+
});
90+
},
91+
addApplicationComment({
92+
applicationId, ...opts
93+
}) {
94+
return this._makeRequest({
95+
path: `/applicant_tracking/applications/${applicationId}/comments`,
96+
method: "POST",
97+
...opts,
98+
});
99+
},
100+
updateApplicationStatus({
101+
applicationId, ...opts
102+
}) {
103+
return this._makeRequest({
104+
path: `/applicant_tracking/applications/${applicationId}/status`,
105+
method: "POST",
106+
...opts,
107+
});
108+
},
109+
downloadFile({
110+
fileId, ...opts
111+
}) {
112+
return this._makeRequest({
113+
path: `/files/${fileId}`,
114+
responseType: "arraybuffer",
115+
...opts,
116+
});
9117
},
10118
},
11119
};

0 commit comments

Comments
 (0)