//native
type Motimate = {
token: string
}
export async function main(
auth: Motimate,
body: {
imported?: false | true
position_id?: number
position_external_id?: string
user_id?: number
user_external_id?: string
}
) {
const url = new URL(`https://motimateapp.com/public_api/user_positions`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 581 days ago