Edits history of script submission #14567 for ' Archive a Budget (brex)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Brex = {
      token: string;
    };
    /**
     * 
    Archive a Budget
    
     * 
    Archives a Budget, making any Spend Limits beneath 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/budgets/${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 217 days ago