//native
type Ably = {
accessToken: string;
};
/**
* Deletes a rule
* Deletes the rule specified by the rule ID, for the application specified by application ID.
*/
export async function main(auth: Ably, app_id: string, rule_id: string) {
const url = new URL(
`https://control.ably.net/v1/apps/${app_id}/rules/${rule_id}`,
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.accessToken,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 138 days ago