//native
type Grist = {
apiKey: string;
host: string;
};
/**
* Empty a document's queue of undelivered payloads
*
*/
export async function main(auth: Grist, docId: string) {
const url = new URL(`https://${auth.host}/api/docs/${docId}/webhooks/queue`);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 329 days ago