Edits history of script submission #14115 for ' Add New Job Opening (bamboo_hr)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Add New Job Opening
     * Add a new 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/job_opening`
    	)
    
    	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 posting title of the job opening.
    	 */
    	postingTitle: string
    	/**
    	 * The status of the job opening.
    	 */
    	jobStatus: 'Draft' | 'Open' | 'On Hold' | 'Filled' | 'Canceled'
    	/**
    	 * The employee id (from the v1/applicant_tracking/hiring_leads endpoint) of the hiring lead for the job opening.
    	 */
    	hiringLead: number
    	/**
    	 * The department of the job opening.
    	 */
    	department?: string
    	/**
    	 * The type of employment offered in the job opening, e.g. Full-Time, Part-Time, Contractor, etc.
    	 */
    	employmentType: string
    	/**
    	 * The minimum experience level that qualifies a candidate for the job opening.
    	 */
    	minimumExperience?:
    		| 'Entry-level'
    		| 'Mid-level'
    		| 'Experienced'
    		| 'Manager/Supervisor'
    		| "Senior Manager/Supervisor'"
    		| 'Executive'
    		| 'Senior Executive'
    	/**
    	 * The pay rate or compensation for the job opening.
    	 */
    	compensation?: string
    	/**
    	 * The location id (from the v1/applicant_tracking/locations endpoint) of the job opening. Omit this parameter for a remote job location.
    	 */
    	jobLocation?: number
    	/**
    	 * The long-form text description of the job opening.
    	 */
    	jobDescription: string
    	/**
    	 * Whether the job opening application has a standard question for resume (true) or not (false) or if uploading a resume is mandatory (required).
    	 */
    	applicationQuestionResume?: 'true' | 'false' | 'Required'
    	/**
    	 * Whether the job opening application has a standard question for address (true) or not (false) or if entering an address is mandatory (required).
    	 */
    	applicationQuestionAddress?: 'true' | 'false' | 'Required'
    	/**
    	 * 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).
    	 */
    	applicationQuestionLinkedinUrl?: 'true' | 'false' | 'Required'
    	/**
    	 * 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).
    	 */
    	applicationQuestionDateAvailable?: 'true' | 'false' | 'Required'
    	/**
    	 * 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).
    	 */
    	applicationQuestionDesiredSalary?: 'true' | 'false' | 'Required'
    	/**
    	 * 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).
    	 */
    	applicationQuestionCoverLetter?: 'true' | 'false' | 'Required'
    	/**
    	 * Whether the job opening application has a standard question for referred by (true) or not (false) or if entering referred by is mandatory (required).
    	 */
    	applicationQuestionReferredBy?: 'true' | 'false' | 'Required'
    	/**
    	 * 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).
    	 */
    	applicationQuestionWebsiteUrl?: 'true' | 'false' | 'Required'
    	/**
    	 * Whether the job opening application has a standard question for highest education (true) or not (false) or if entering highest education is mandatory (required).
    	 */
    	applicationQuestionHighestEducation?: 'true' | 'false' | 'Required'
    	/**
    	 * Whether the job opening application has a standard question for college (true) or not (false) or if entering a college is mandatory (required).
    	 */
    	applicationQuestionCollege?: 'true' | 'false' | 'Required'
    	/**
    	 * Whether the job opening application has a standard question for references (true) or not (false) or if entering references is mandatory (required).
    	 */
    	applicationQuestionReferences?: 'true' | 'false' | 'Required'
    	/**
    	 * The internal job code for the job opening.
    	 */
    	internalJobCode?: string
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago