Edits history of script submission #1568 for ' Delete a SSH key (bitbucket)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Delete a SSH key
     * Deletes a specific SSH public key from a user's account.
     */
    export async function main(
      auth: Bitbucket,
      key_id: string,
      selected_user: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/users/${selected_user}/ssh-keys/${key_id}`
      );
    
      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 a SSH key
     * Deletes a specific SSH public key from a user's account.
     */
    export async function main(
      auth: Bitbucket,
      key_id: string,
      selected_user: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/users/${selected_user}/ssh-keys/${key_id}`
      );
    
      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 929 days ago

  • nativets
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Delete a SSH key
     * Deletes a specific SSH public key from a user's account
    
    Example:
    ```
    $ curl -X DELETE https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a}
    ```
     */
    export async function main(
      auth: Bitbucket,
      key_id: string,
      selected_user: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/users/${selected_user}/ssh-keys/${key_id}`
      );
    
      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