//native
type Motimate = {
token: string;
};
/**
* Create position
* Creates a new Position.
*/
export async function main(
auth: Motimate,
body: { external_id?: string; import_id?: string; name?: string },
) {
const url = new URL(`https://motimateapp.com/public_api/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