Edits history of script submission #1363 for ' List effective default reviewers (bitbucket)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * List effective default reviewers
     * Returns the repository's effective default reviewers. This includes both default
    reviewers defined at the repository level as well as those inherited from its project.
    
    These are the users that are automatically added as reviewers on every
    new pull request that is created.
     */
    export async function main(
      auth: Bitbucket,
      repo_slug: string,
      workspace: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/effective-default-reviewers`
      );
    
      const response = await fetch(url, {
        method: "GET",
        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.json();
    }
    

    Submitted by hugo697 375 days ago

  • nativets
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * List effective default reviewers
     * Returns the repository's effective default reviewers. This includes both default
    reviewers defined at the repository level as well as those inherited from its project.
    
    These are the users that are automatically added as reviewers on every
    new pull request that is created.
     */
    export async function main(
      auth: Bitbucket,
      repo_slug: string,
      workspace: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/effective-default-reviewers`
      );
    
      const response = await fetch(url, {
        method: "GET",
        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.json();
    }
    

    Submitted by hugo697 929 days ago

  • nativets
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * List effective default reviewers
     * Returns the repository's effective default reviewers.
     */
    export async function main(
      auth: Bitbucket,
      repo_slug: string,
      workspace: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/effective-default-reviewers`
      );
    
      const response = await fetch(url, {
        method: "GET",
        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.json();
    }
    

    Submitted by hugo697 935 days ago

  • nativets
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * List effective default reviewers
     * Returns the repository's effective default reviewers. This includes both default
    reviewers defined at the repository level as well as those inherited from its project.
    
    These are the users that are automatically added as reviewers on every
    new pull request that is created.
    
    ```
    $ curl https://api.bitbucket.org/2.0/repositories/{workspace_slug}/{repo_slug}/effective-default-reviewers?page=1&pagelen=20
    {
        "pagelen": 20,
        "values": [
            {
                "user": {
                    "display_name": "Patrick Wolf",
                    "uuid": "{9565301a-a3cf-4b5d-88f4-dd6af8078d7e}"
                },
                "reviewer_type": "project",
                "type": "default_reviewer",
            },
            {
                "user": {
                    "display_name": "Davis Lee",
                    "uuid": "{f0e0e8e9-66c1-4b85-a784-44a9eb9ef1a6}"
                },
                "reviewer_type": "repository",
                "type": "default_reviewer",
            }
        ],
        "page": 1,
        "size": 2
    }
    ```
     */
    export async function main(
      auth: Bitbucket,
      repo_slug: string,
      workspace: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/effective-default-reviewers`
      );
    
      const response = await fetch(url, {
        method: "GET",
        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.json();
    }
    

    Submitted by hugo697 935 days ago