1 | |
2 | |
3 | * Cancel EOR Contract |
4 | * Cancel EOR Contract |
5 | **Token scopes**: `contracts:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, oid: string, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/eor/contract/${oid}/cancel`) |
9 |
|
10 | const response = await fetch(url, { |
11 | method: 'POST', |
12 | headers: { |
13 | 'Content-Type': 'application/json', |
14 | Authorization: 'Bearer ' + auth.apiKey |
15 | }, |
16 | body: JSON.stringify(body) |
17 | }) |
18 | if (!response.ok) { |
19 | const text = await response.text() |
20 | throw new Error(`${response.status} ${text}`) |
21 | } |
22 | return await response.text() |
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 Body { |
33 | data: { |
34 | |
35 | * Reason for contract termination |
36 | */ |
37 | cancellation_reason: |
38 | | 'INTERNAL_DECISION' |
39 | | 'UNSATISFACTORY_EXPERIENCE' |
40 | | 'EXPLORING_ALTERNATIVE' |
41 | | 'OFFER_CHANGES' |
42 | |
43 | * Message for contract termination |
44 | */ |
45 | cancellation_message?: string |
46 | [k: string]: unknown |
47 | } |
48 | [k: string]: unknown |
49 | } |
50 |
|