//native
type Formstack = {
token: string;
};
/**
* /Users
*
*/
export async function main(
auth: Formstack,
body: {
active?: false | true;
userName?: string;
name?: {};
"urn:ietf:params:scim:schemas:extension:formstack:2"?: { "0:User"?: {} };
},
) {
const url = new URL(`https://www.formstack.com/scim/Users`);
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 235 days ago