//native
/**
* Get verification method
* Get verification method by provided country and document type
**Token scopes**: `screenings:read`, `worker:read`
*/
export async function main(
auth: RT.Deel,
country: string | undefined,
document_type: 'passport' | 'government_id' | 'driving_license' | 'other' | undefined
) {
const url = new URL(`https://api.letsdeel.com/rest/v2/screenings/verification-method`)
for (const [k, v] of [
['country', country],
['document_type', document_type]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago