//native
/**
* Add New Candidate
* Add a new candidate application to a job opening. The owner of the API key used must have access to ATS settings.
*/
export async function main(auth: RT.BambooHr, body: Body) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/applicant_tracking/application`
)
const formData = new FormData()
for (const [k, v] of Object.entries(body)) {
if (v !== undefined && v !== '') {
formData.append(k, String(v))
}
}
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
},
body: formData
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
/**
* The first name of the candidate.
*/
firstName: string
/**
* The last name of the candidate.
*/
lastName: string
/**
* The email address of the candidate.
*/
email?: string
/**
* The phone number of the candidate.
*/
phoneNumber?: string
/**
* The source of the candidate application, e.g. LinkedIn, Indeed, etc.
*/
source?: string
/**
* The id of the job opening for the candidate application.
*/
jobId: number
/**
* The street address of the candidate.
*/
address?: string
/**
* The city of the candidate.
*/
city?: string
/**
* The state or province of the candidate. Accepts state name, abbreviation, or ISO code.
*/
state?: string
/**
* The zip code or postal code of the candidate.
*/
zip?: string
/**
* The country of the candidate. Accepts country name or ISO code.
*/
country?: string
/**
* The LinkedIn profile url of the candidate.
*/
linkedinUrl?: string
/**
* The available start date of the candidate with the format YYYY-MM-DD.
*/
dateAvailable?: string
/**
* The desired salary of the candidate.
*/
desiredSalary?: string
/**
* The person or entity that referred the candidate.
*/
referredBy?: string
/**
* The personal website, blog, or online portfolio of the candidate.
*/
websiteUrl?: string
/**
* The highest completed education level of the candidate.
*/
highestEducation?:
| 'GED or Equivalent'
| 'High School'
| 'Some College'
| 'College - Associates'
| 'College - Bachelor of Arts'
| 'College - Bachelor of Fine Arts'
| 'College - Bachelor of Science'
| 'College - Master of Arts'
| 'College - Master of Fine Arts'
| 'College - Master of Science'
| 'College - Master of Business Administration'
| 'College - Doctorate'
| 'Medical Doctor'
| 'Other'
/**
* The college or university of the candidate.
*/
collegeName?: string
/**
* A list of references supplied by the candidate.
*/
references?: string
/**
* Resume of the candidate.
*/
resume?: string
/**
* Cover letter of the candidate.
*/
coverLetter?: string
[k: string]: unknown
}
Submitted by hugo697 137 days ago