Edits history of script submission #1417 for ' Get the branching model for a project (bitbucket)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Get the branching model for a project
     * Return the branching model set at the project level.
     */
    export async function main(
      auth: Bitbucket,
      project_key: string,
      workspace: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/branching-model`
      );
    
      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;
    };
    /**
     * Get the branching model for a project
     * Return the branching model set at the project level.
     */
    export async function main(
      auth: Bitbucket,
      project_key: string,
      workspace: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/branching-model`
      );
    
      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;
    };
    /**
     * Get the branching model for a project
     * Return the branching model set at the project level. This view is
    read-only. The branching model settings can be changed using the
    [settings](#api-workspaces-workspace-projects-project-key-branching-model-settings-get)
    API.
    
    The returned object:
    
    1. Always has a `development` property. `development.name` is
       the user-specified branch that can be inherited by an individual repository's
       branching model.
    2. Might have a `production` property. `production` will not
       be present when `production` is disabled.
       `production.name` is the user-specified branch that can be
       inherited by an individual repository's branching model.
    3. Always has a `branch_types` array which contains all enabled branch
       types.
     */
    export async function main(
      auth: Bitbucket,
      project_key: string,
      workspace: string
    ) {
      const url = new URL(
        `https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/branching-model`
      );
    
      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