1 | |
2 | |
3 | * Add New Job Opening |
4 | * Add a new job opening. The owner of the API key used must have access to ATS settings. |
5 | */ |
6 | export async function main(auth: RT.BambooHr, body: Body) { |
7 | const url = new URL( |
8 | `https://${auth.companyDomain}.bamboohr.com/api/v1/applicant_tracking/job_opening` |
9 | ) |
10 |
|
11 | const formData = new FormData() |
12 | for (const [k, v] of Object.entries(body)) { |
13 | if (v !== undefined && v !== '') { |
14 | formData.append(k, String(v)) |
15 | } |
16 | } |
17 | const response = await fetch(url, { |
18 | method: 'POST', |
19 | headers: { |
20 | Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`) |
21 | }, |
22 | body: formData |
23 | }) |
24 | if (!response.ok) { |
25 | const text = await response.text() |
26 | throw new Error(`${response.status} ${text}`) |
27 | } |
28 | return await response.json() |
29 | } |
30 |
|
31 | |
32 | |
33 | * This file was automatically generated by json-schema-to-typescript. |
34 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
35 | * and run json-schema-to-typescript to regenerate this file. |
36 | */ |
37 |
|
38 | export interface Body { |
39 | |
40 | * The posting title of the job opening. |
41 | */ |
42 | postingTitle: string |
43 | |
44 | * The status of the job opening. |
45 | */ |
46 | jobStatus: 'Draft' | 'Open' | 'On Hold' | 'Filled' | 'Canceled' |
47 | |
48 | * The employee id (from the v1/applicant_tracking/hiring_leads endpoint) of the hiring lead for the job opening. |
49 | */ |
50 | hiringLead: number |
51 | |
52 | * The department of the job opening. |
53 | */ |
54 | department?: string |
55 | |
56 | * The type of employment offered in the job opening, e.g. Full-Time, Part-Time, Contractor, etc. |
57 | */ |
58 | employmentType: string |
59 | |
60 | * The minimum experience level that qualifies a candidate for the job opening. |
61 | */ |
62 | minimumExperience?: |
63 | | 'Entry-level' |
64 | | 'Mid-level' |
65 | | 'Experienced' |
66 | | 'Manager/Supervisor' |
67 | | "Senior Manager/Supervisor'" |
68 | | 'Executive' |
69 | | 'Senior Executive' |
70 | |
71 | * The pay rate or compensation for the job opening. |
72 | */ |
73 | compensation?: string |
74 | |
75 | * The location id (from the v1/applicant_tracking/locations endpoint) of the job opening. Omit this parameter for a remote job location. |
76 | */ |
77 | jobLocation?: number |
78 | |
79 | * The long-form text description of the job opening. |
80 | */ |
81 | jobDescription: string |
82 | |
83 | * Whether the job opening application has a standard question for resume (true) or not (false) or if uploading a resume is mandatory (required). |
84 | */ |
85 | applicationQuestionResume?: 'true' | 'false' | 'Required' |
86 | |
87 | * Whether the job opening application has a standard question for address (true) or not (false) or if entering an address is mandatory (required). |
88 | */ |
89 | applicationQuestionAddress?: 'true' | 'false' | 'Required' |
90 | |
91 | * Whether the job opening application has a standard question for LinkedIn profile url (true) or not (false) or if entering a LinkedIn profile url is mandatory (required). |
92 | */ |
93 | applicationQuestionLinkedinUrl?: 'true' | 'false' | 'Required' |
94 | |
95 | * Whether the job opening application has a standard question for availability date (true) or not (false) or if entering an availability date is mandatory (required). |
96 | */ |
97 | applicationQuestionDateAvailable?: 'true' | 'false' | 'Required' |
98 | |
99 | * Whether the job opening application has a standard question for desired salary (true) or not (false) or if entering a desired salary is mandatory (required). |
100 | */ |
101 | applicationQuestionDesiredSalary?: 'true' | 'false' | 'Required' |
102 | |
103 | * Whether the job opening application has a standard question for cover letter (true) or not (false) or if uploading a cover letter is mandatory (required). |
104 | */ |
105 | applicationQuestionCoverLetter?: 'true' | 'false' | 'Required' |
106 | |
107 | * Whether the job opening application has a standard question for referred by (true) or not (false) or if entering referred by is mandatory (required). |
108 | */ |
109 | applicationQuestionReferredBy?: 'true' | 'false' | 'Required' |
110 | |
111 | * Whether the job opening application has a standard question for website url (true) or not (false) or if entering a website url is mandatory (required). |
112 | */ |
113 | applicationQuestionWebsiteUrl?: 'true' | 'false' | 'Required' |
114 | |
115 | * Whether the job opening application has a standard question for highest education (true) or not (false) or if entering highest education is mandatory (required). |
116 | */ |
117 | applicationQuestionHighestEducation?: 'true' | 'false' | 'Required' |
118 | |
119 | * Whether the job opening application has a standard question for college (true) or not (false) or if entering a college is mandatory (required). |
120 | */ |
121 | applicationQuestionCollege?: 'true' | 'false' | 'Required' |
122 | |
123 | * Whether the job opening application has a standard question for references (true) or not (false) or if entering references is mandatory (required). |
124 | */ |
125 | applicationQuestionReferences?: 'true' | 'false' | 'Required' |
126 | |
127 | * The internal job code for the job opening. |
128 | */ |
129 | internalJobCode?: string |
130 | [k: string]: unknown |
131 | } |
132 |
|