Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Components] recruitis #11523 #11903

Merged
merged 4 commits into from
May 27, 2024
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
84 changes: 84 additions & 0 deletions components/recruitis/actions/create-answer/create-answer.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { ConfigurationError } from "@pipedream/platform";
import app from "../../recruitis.app.mjs";

export default {
key: "recruitis-create-answer",
name: "Create Answer",
description: "Create a new answer for a job. [See the documentation](https://docs.recruitis.io/api/#tag/Candidates/paths/~1answers/post)",
version: "0.0.1",
type: "action",
props: {
app,
jobID: {
propDefinition: [
app,
"jobID",
],
},
email: {
propDefinition: [
app,
"email",
],
},
name: {
propDefinition: [
app,
"name",
],
},
phone: {
propDefinition: [
app,
"phone",
],
},
twitter: {
propDefinition: [
app,
"twitter",
],
},
facebook: {
propDefinition: [
app,
"facebook",
],
},
linkedin: {
propDefinition: [
app,
"linkedin",
],
},
skype: {
propDefinition: [
app,
"skype",
],
},
},
async run({ $ }) {
if (this.linkedin && !this.linkedin.includes("/in")) {
throw new ConfigurationError("Linkedin URL is wrong, it should contain \"/in\". E.g https://linkedin.com/in/pipedream");
}

const response = await this.app.createAnswer({
$,
data: {
job_id: this.jobID,
email: this.email,
name: this.name,
phone: this.phone,
twitter: this.twitter,
facebook: this.facebook,
linkedin: this.linkedin,
skype: this.skype,
},
});

$.export("$summary", `Successfully created an answer for the user with ID: '${response.payload.user_id}'`);

return response;
},
};
85 changes: 85 additions & 0 deletions components/recruitis/actions/create-candidate/create-candidate.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { ConfigurationError } from "@pipedream/platform";
import app from "../../recruitis.app.mjs";

export default {
key: "recruitis-create-candidate",
name: "Create Candidate",
description: "Create a new candidate. [See the documentation](https://docs.recruitis.io/api/#tag/Candidates/paths/~1candidates/post)",
version: "0.0.1",
type: "action",
props: {
app,
email: {
propDefinition: [
app,
"email",
],
},
name: {
propDefinition: [
app,
"name",
],
},
phone: {
propDefinition: [
app,
"phone",
],
},
twitter: {
propDefinition: [
app,
"twitter",
],
},
facebook: {
propDefinition: [
app,
"facebook",
],
},
linkedin: {
propDefinition: [
app,
"linkedin",
],
},
skype: {
propDefinition: [
app,
"skype",
],
},
gdprAgreement: {
propDefinition: [
app,
"gdprAgreement",
],
},
},
async run({ $ }) {
if (this.linkedin && !this.linkedin.includes("/in")) {
throw new ConfigurationError("Linkedin URL is wrong, it should contain \"/in\". E.g https://linkedin.com/in/pipedream");
}

const response = await this.app.createCandidate({
$,
data: {
job_id: this.jobID,
email: this.email,
name: this.name,
phone: this.phone,
twitter: this.twitter,
facebook: this.facebook,
linkedin: this.linkedin,
skype: this.skype,
gdpr_agreement: this.gdprAgreement,
},
});

$.export("$summary", `Successfully created user with ID: '${response.payload.id}'`);

return response;
},
};
37 changes: 37 additions & 0 deletions components/recruitis/actions/create-job/create-job.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import app from "../../recruitis.app.mjs";

export default {
key: "recruitis-create-job",
name: "Create Job",
description: "Creates a new job ad and puts it in classifieds. [See the documentation](https://docs.recruitis.io/api/#tag/Jobs/paths/~1jobs/post)",
version: "0.0.1",
type: "action",
props: {
app,
title: {
propDefinition: [
app,
"title",
],
},
description: {
propDefinition: [
app,
"description",
],
},
},
async run({ $ }) {
const response = await this.app.createJob({
$,
data: {
description: this.description,
title: this.title,
},
});

$.export("$summary", `Successfully created job at: '${response.payload.edit_url}'`);

return response;
},
};
21 changes: 21 additions & 0 deletions components/recruitis/actions/get-jobs/get-jobs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import app from "../../recruitis.app.mjs";

export default {
key: "recruitis-get-jobs",
name: "Get Jobs",
description: "Get jobs from recruitis profile. [See the documentation](https://docs.recruitis.io/api/#tag/Jobs/paths/~1jobs/get)",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.getJobs({
$,
});

$.export("$summary", `Successfully retrieved ${response.payload.length} job(s)`);

return response;
},
};
7 changes: 5 additions & 2 deletions components/recruitis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/recruitis",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Recruitis Components",
"main": "recruitis.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.6.5"
}
}
}
123 changes: 119 additions & 4 deletions components/recruitis/recruitis.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,126 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "recruitis",
propDefinitions: {},
propDefinitions: {
title: {
type: "string",
label: "Title",
description: "Title of the job",
},
description: {
type: "string",
label: "Description",
description: "Description of the job",
},
name: {
type: "string",
label: "Name",
description: "Applicant's name",
},
email: {
type: "string",
label: "Email",
description: "Applicant's email address",
},
skype: {
type: "string",
label: "Skype",
description: "Applicant's Skype link",
optional: true,
},
linkedin: {
type: "string",
label: "LinkedIn",
description: "Applicant's LinkedIn link",
optional: true,
},
facebook: {
type: "string",
label: "Facebook",
description: "Applicant's Facebook link",
optional: true,
},
twitter: {
type: "string",
label: "Twitter",
description: "Applicant's Twitter link",
optional: true,
},
phone: {
type: "string",
label: "Phone",
description: "Applicant's phone number",
optional: true,
},
gdprAgreement: {
type: "boolean",
label: "GDPR Agreement",
description: "Indicates whether the applicant has agreed to GDPR terms",
},
jobID: {
type: "string",
label: "Job ID",
description: "ID of the job",
async options() {
const response = await this.getJobs();

return response?.payload?.map(({
job_id, title,
}) => ({
value: job_id,
label: title,
}));
},
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://app.recruitis.io/api2";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
Authorization: `Bearer ${this.$auth.api_token}`,
},
});
},
async getJobs(args = {}) {
return this._makeRequest({
path: "/jobs",
...args,
});
},
async createAnswer(args = {}) {
return this._makeRequest({
method: "post",
path: "/answers",
...args,
});
},
async createJob(args = {}) {
return this._makeRequest({
method: "post",
path: "/jobs",
...args,
});
},
async createCandidate(args = {}) {
return this._makeRequest({
method: "post",
path: "/candidates",
...args,
});
},
},
};
5 changes: 4 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading