//native
type Brex = {
token: string;
};
/**
*
Archive a Spend Limit
*
Archives a Spend Limit, making it unusable for future expenses and removing it from the UI
*/
export async function main(auth: Brex, id: string) {
const url = new URL(
`https://platform.brexapis.com/v2/spend_limits/${id}/archive`,
);
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 170 days ago