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 65e2289496856..5d0567c7e441d 100644 --- a/components/easyhire/easyhire.app.mjs +++ b/components/easyhire/easyhire.app.mjs @@ -1,11 +1,39 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "easyhire", propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _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}`, + "Accept-Version": "v1", + }, + }); + }, + createApplication(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/create-application/", + ...opts, + }); }, }, }; diff --git a/components/easyhire/package.json b/components/easyhire/package.json index dd174b34ff869..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" } -} \ No newline at end of file +} 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: