Fetch immigration case details by case id **Token scopes**: `immigration:read`
1
//native
2
/**
3
* Immigration case details
4
* Fetch immigration case details by case id
5
**Token scopes**: `immigration:read`
6
*/
7
export async function main(auth: RT.Deel, id: string) {
8
const url = new URL(`https://api.letsdeel.com/rest/v2/immigration/client/cases/${id}`)
9
10
const response = await fetch(url, {
11
method: 'GET',
12
headers: {
13
Authorization: 'Bearer ' + auth.apiKey
14
},
15
body: undefined
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