1 | |
2 | |
3 | * User Login |
4 | * User Login |
5 | */ |
6 | export async function main(auth: RT.BambooHr, body: Login, AcceptHeaderParameter?: string) { |
7 | const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/login`) |
8 |
|
9 | const response = await fetch(url, { |
10 | method: 'POST', |
11 | headers: { |
12 | ...(AcceptHeaderParameter ? { AcceptHeaderParameter: AcceptHeaderParameter } : {}), |
13 | 'Content-Type': 'application/x-www-form-urlencoded', |
14 | Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`) |
15 | }, |
16 | body: new URLSearchParams(body as Record<string, string>) |
17 | }) |
18 | if (!response.ok) { |
19 | const text = await response.text() |
20 | throw new Error(`${response.status} ${text}`) |
21 | } |
22 | return await response.json() |
23 | } |
24 |
|
25 | |
26 | |
27 | * This file was automatically generated by json-schema-to-typescript. |
28 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
29 | * and run json-schema-to-typescript to regenerate this file. |
30 | */ |
31 |
|
32 | export interface Login { |
33 | applicationKey?: string |
34 | user?: string |
35 | password?: string |
36 | [k: string]: unknown |
37 | } |
38 |
|