Edits history of script submission #14514 for ' Remove legal hold policy (box)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Box = {
      token: string;
    };
    /**
     * Remove legal hold policy
     * Delete an existing legal hold policy.
    
    This is an asynchronous process. The policy will not be
    fully deleted yet when the response returns.
     */
    export async function main(auth: Box, legal_hold_policy_id: string) {
      const url = new URL(
        `https://api.box.com/2.0/legal_hold_policies/${legal_hold_policy_id}`,
      );
    
      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