1 | |
2 | * create an HMac signature given a job id and a resume id |
3 | * |
4 | */ |
5 | export async function main( |
6 | workspace: string, |
7 | id: string, |
8 | resume_id: string, |
9 | approver: string | undefined |
10 | ) { |
11 | const url = new URL( |
12 | `${BASE_URL}/api/w/${workspace}/jobs/job_signature/${id}/${resume_id}` |
13 | ); |
14 | for (const [k, v] of [["approver", approver]]) { |
15 | if (v !== undefined && v !== "") { |
16 | url.searchParams.append(k, v); |
17 | } |
18 | } |
19 | const response = await fetch(url, { |
20 | method: "GET", |
21 | headers: { |
22 | Authorization: "Bearer " + WM_TOKEN, |
23 | }, |
24 | body: undefined, |
25 | }); |
26 | if (!response.ok) { |
27 | const text = await response.text(); |
28 | throw new Error(`${response.status} ${text}`); |
29 | } |
30 | return await response.text(); |
31 | } |
32 |
|