//native
type Formstack = {
token: string;
};
/**
* /portal/:id/form/:portalFormId
* Delete specified portal form from portal
*/
export async function main(auth: Formstack, id: string, portalFormId: string) {
const url = new URL(
`https://www.formstack.com/api/v2/portal/${id}/form/${portalFormId}`,
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
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