Edits history of script submission #1478 for ' Delete an app (bitbucket)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Delete an app
     * Deletes the application for the user.
     */
    export async function main(auth: Bitbucket) {
      const url = new URL(`https://api.bitbucket.org/2.0/addon`);
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 375 days ago

  • nativets
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Delete an app
     * Deletes the application for the user.
     */
    export async function main(auth: Bitbucket) {
      const url = new URL(`https://api.bitbucket.org/2.0/addon`);
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 935 days ago

  • nativets
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Delete an app
     * Deletes the application for the user.
    
    This endpoint is intended to be used by Bitbucket Connect apps
    and only supports JWT authentication -- that is how Bitbucket
    identifies the particular installation of the app. Developers
    with applications registered in the "Develop Apps" section
    of Bitbucket Marketplace need not use this endpoint as
    updates for those applications can be sent out via the
    UI of that section.
    
    ```
    $ curl -X DELETE https://api.bitbucket.org/2.0/addon \
      -H "Authorization: JWT <JWT Token>"
    ```
     */
    export async function main(auth: Bitbucket) {
      const url = new URL(`https://api.bitbucket.org/2.0/addon`);
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 935 days ago