From 75728187f194a4283a318c309c28aac6ee2bf00d Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 8 Aug 2024 11:25:59 -0400 Subject: [PATCH 1/3] easyhire init --- .../assess-candidate/assess-candidate.mjs | 38 ++++++++++++ components/easyhire/easyhire.app.mjs | 58 ++++++++++++++++++- components/easyhire/package.json | 2 +- 3 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 components/easyhire/actions/assess-candidate/assess-candidate.mjs diff --git a/components/easyhire/actions/assess-candidate/assess-candidate.mjs b/components/easyhire/actions/assess-candidate/assess-candidate.mjs new file mode 100644 index 0000000000000..c9e730fdafca3 --- /dev/null +++ b/components/easyhire/actions/assess-candidate/assess-candidate.mjs @@ -0,0 +1,38 @@ +import easyhire from "../../easyhire.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "easyhire-assess-candidate", + name: "Assess Candidate", + description: "Assess a specific candidate on EasyHire. The user needs to input the candidate's id and their evaluation score. An optional prop is comments about the candidate's performance.", + version: "0.0.{{ts}}", + type: "action", + props: { + easyhire, + candidateId: { + type: "string", + label: "Candidate ID", + description: "The ID of the candidate to be assessed", + }, + evaluationScore: { + type: "integer", + label: "Evaluation Score", + description: "The score of the candidate's evaluation", + }, + comments: { + type: "string", + label: "Comments", + description: "Comments about the candidate's performance", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.easyhire.assessCandidate({ + candidateId: this.candidateId, + evaluationScore: this.evaluationScore, + comments: this.comments || "", + }); + $.export("$summary", `Successfully assessed candidate ${this.candidateId}`); + return response; + }, +}; diff --git a/components/easyhire/easyhire.app.mjs b/components/easyhire/easyhire.app.mjs index 78ea6c1405811..f229d98ccfa9f 100644 --- a/components/easyhire/easyhire.app.mjs +++ b/components/easyhire/easyhire.app.mjs @@ -1,11 +1,63 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "easyhire", - propDefinitions: {}, + propDefinitions: { + candidateId: { + type: "string", + label: "Candidate ID", + description: "The ID of the candidate to be assessed", + }, + evaluationScore: { + type: "integer", + label: "Evaluation Score", + description: "The score of the candidate's evaluation", + }, + comments: { + type: "string", + label: "Comments", + description: "Comments about the candidate's performance", + optional: true, + }, + }, methods: { - // this.$auth contains connected account data + _baseUrl() { + return "https://easyhire.ai/api"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + method = "GET", + path, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + method, + url: this._baseUrl() + path, + headers: { + ...headers, + "Content-Type": "application/json", + "Authorization": `Api-Key ${this.$auth.api_key}`, + }, + }); + }, + async assessCandidate({ + candidateId, evaluationScore, comments, + }) { + return this._makeRequest({ + method: "POST", + path: `/candidate/${candidateId}/score/`, + data: { + score: evaluationScore, + comments: comments || "", + }, + }); + }, authKeys() { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/easyhire/package.json b/components/easyhire/package.json index dd174b34ff869..2f9621890dd59 100644 --- a/components/easyhire/package.json +++ b/components/easyhire/package.json @@ -12,4 +12,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} From 3a5ab178145604e3f286a411594573e949ad6c95 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 28 Jan 2025 11:31:40 -0500 Subject: [PATCH 2/3] create-application --- .../assess-candidate/assess-candidate.mjs | 38 -------------- .../create-application/create-application.mjs | 52 +++++++++++++++++++ components/easyhire/easyhire.app.mjs | 34 ++---------- components/easyhire/package.json | 5 +- 4 files changed, 61 insertions(+), 68 deletions(-) delete mode 100644 components/easyhire/actions/assess-candidate/assess-candidate.mjs create mode 100644 components/easyhire/actions/create-application/create-application.mjs diff --git a/components/easyhire/actions/assess-candidate/assess-candidate.mjs b/components/easyhire/actions/assess-candidate/assess-candidate.mjs deleted file mode 100644 index c9e730fdafca3..0000000000000 --- a/components/easyhire/actions/assess-candidate/assess-candidate.mjs +++ /dev/null @@ -1,38 +0,0 @@ -import easyhire from "../../easyhire.app.mjs"; -import { axios } from "@pipedream/platform"; - -export default { - key: "easyhire-assess-candidate", - name: "Assess Candidate", - description: "Assess a specific candidate on EasyHire. The user needs to input the candidate's id and their evaluation score. An optional prop is comments about the candidate's performance.", - version: "0.0.{{ts}}", - type: "action", - props: { - easyhire, - candidateId: { - type: "string", - label: "Candidate ID", - description: "The ID of the candidate to be assessed", - }, - evaluationScore: { - type: "integer", - label: "Evaluation Score", - description: "The score of the candidate's evaluation", - }, - comments: { - type: "string", - label: "Comments", - description: "Comments about the candidate's performance", - optional: true, - }, - }, - async run({ $ }) { - const response = await this.easyhire.assessCandidate({ - candidateId: this.candidateId, - evaluationScore: this.evaluationScore, - comments: this.comments || "", - }); - $.export("$summary", `Successfully assessed candidate ${this.candidateId}`); - return response; - }, -}; diff --git a/components/easyhire/actions/create-application/create-application.mjs b/components/easyhire/actions/create-application/create-application.mjs new file mode 100644 index 0000000000000..a18675a2e34d3 --- /dev/null +++ b/components/easyhire/actions/create-application/create-application.mjs @@ -0,0 +1,52 @@ +import easyhire from "../../easyhire.app.mjs"; + +export default { + key: "easyhire-create-application", + name: "Create Application", + description: "Creates a new application in EasyHire. [See the documentation](https://easyhire.ai/integrations/api-docs/)", + version: "0.0.1", + type: "action", + props: { + easyhire, + jobOpeningId: { + type: "string", + label: "Job Opening ID", + description: "The ID of the job opening to create the application for", + }, + applicantEmail: { + type: "string", + label: "Applicant Email", + description: "The email address of the applicant", + }, + applicantName: { + type: "string", + label: "Applicant Name", + description: "The name of the applicant", + }, + resumePdf: { + type: "string", + label: "Resume PDF", + description: "The URL of a .pdf file containing the applicant's resume", + }, + uniqueExternalId: { + type: "string", + label: "Unique External ID", + description: "A unique external ID representing the application", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.easyhire.createApplication({ + $, + data: { + job_opening_id: this.jobOpeningId, + applicant_email: this.applicantEmail, + applicant_name: this.applicantName, + resume_pdf: this.resumePdf, + unique_external_id: this.uniqueExternalId, + }, + }); + $.export("$summary", `Successfully created application for ${this.applicantName}`); + return response; + }, +}; diff --git a/components/easyhire/easyhire.app.mjs b/components/easyhire/easyhire.app.mjs index f229d98ccfa9f..5d0567c7e441d 100644 --- a/components/easyhire/easyhire.app.mjs +++ b/components/easyhire/easyhire.app.mjs @@ -3,24 +3,7 @@ import { axios } from "@pipedream/platform"; export default { type: "app", app: "easyhire", - propDefinitions: { - candidateId: { - type: "string", - label: "Candidate ID", - description: "The ID of the candidate to be assessed", - }, - evaluationScore: { - type: "integer", - label: "Evaluation Score", - description: "The score of the candidate's evaluation", - }, - comments: { - type: "string", - label: "Comments", - description: "Comments about the candidate's performance", - optional: true, - }, - }, + propDefinitions: {}, methods: { _baseUrl() { return "https://easyhire.ai/api"; @@ -41,23 +24,16 @@ export default { ...headers, "Content-Type": "application/json", "Authorization": `Api-Key ${this.$auth.api_key}`, + "Accept-Version": "v1", }, }); }, - async assessCandidate({ - candidateId, evaluationScore, comments, - }) { + createApplication(opts = {}) { return this._makeRequest({ method: "POST", - path: `/candidate/${candidateId}/score/`, - data: { - score: evaluationScore, - comments: comments || "", - }, + path: "/create-application/", + ...opts, }); }, - authKeys() { - console.log(Object.keys(this.$auth)); - }, }, }; diff --git a/components/easyhire/package.json b/components/easyhire/package.json index 2f9621890dd59..ea47bdb2f8b11 100644 --- a/components/easyhire/package.json +++ b/components/easyhire/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/easyhire", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream easyhire Components", "main": "easyhire.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } From 5aaccb426a8daddddedc3ef6b791e99674d3b386 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 28 Jan 2025 11:34:53 -0500 Subject: [PATCH 3/3] pnpm-lock.yaml --- pnpm-lock.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0175fcf2a536f..5db0b7ad4e7a2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3155,7 +3155,11 @@ importers: components/easycsv: {} - components/easyhire: {} + components/easyhire: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/easyly: dependencies: @@ -5884,8 +5888,7 @@ importers: specifier: ^1.2.1 version: 1.6.6 - components/lightpanda: - specifiers: {} + components/lightpanda: {} components/lightspeed_retail_pos: dependencies: