Add an employee dependent
One script reply has been approved by the moderators Verified

Adds an employee dependent

Created by hugo697 51 days ago
Submitted by hugo697 Bun
Verified 51 days ago
1
//native
2
/**
3
 * Add an employee dependent
4
 * Adds an employee dependent
5
 */
6
export async function main(auth: RT.BambooHr, body: EmployeeDependent) {
7
	const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/employeedependents`)
8

9
	const response = await fetch(url, {
10
		method: 'POST',
11
		headers: {
12
			'Content-Type': 'application/json',
13
			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
14
		},
15
		body: JSON.stringify(body)
16
	})
17
	if (!response.ok) {
18
		const text = await response.text()
19
		throw new Error(`${response.status} ${text}`)
20
	}
21
	return await response.json()
22
}
23

24
/* eslint-disable */
25
/**
26
 * This file was automatically generated by json-schema-to-typescript.
27
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
28
 * and run json-schema-to-typescript to regenerate this file.
29
 */
30

31
export interface EmployeeDependent {
32
	employeeId?: string
33
	firstName?: string
34
	middleName?: string
35
	lastName?: string
36
	relationship?: string
37
	gender?: string
38
	ssn?: string
39
	dateOfBirth?: string
40
	addressLine1?: string
41
	addressLine2?: string
42
	city?: string
43
	state?: string
44
	zipCode?: string
45
	homePhone?: string
46
	country?: string
47
	isUsCitizen?: string
48
	isStudent?: string
49
	[k: string]: unknown
50
}
51