Edits history of script submission #1553 for ' Get the branching model config for a repository (bitbucket)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Get the branching model config for a repository
     * Return the branching model configuration for a repository. The returned
    object:
    
    1. Always has a `development` property for the development branch.
    2. Always a `production` property for the production branch. The
       production branch can be disabled.
    3. The `branch_types` contains all the branch types.
    
    This is the raw configuration for the branching model. A client
    wishing to see the branching model with its actual current branches may
    find the active model API more useful.
     */
    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}/branching-model/settings`
      );
    
      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 config for a repository
     * Return the branching model configuration for a repository. The returned
    object:
    
    1. Always has a `development` property for the development branch.
    2. Always a `production` property for the production branch. The
       production branch can be disabled.
    3. The `branch_types` contains all the branch types.
    
    This is the raw configuration for the branching model. A client
    wishing to see the branching model with its actual current branches may
    find the active model API more useful.
     */
    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}/branching-model/settings`
      );
    
      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 880 days ago

  • nativets
    type Bitbucket = {
      username: string;
      password: string;
    };
    /**
     * Get the branching model config for a repository
     * Return the branching model configuration for a repository.
     */
    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}/branching-model/settings`
      );
    
      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 config for a repository
     * Return the branching model configuration for a repository. The returned
    object:
    
    1. Always has a `development` property for the development branch.
    2. Always a `production` property for the production branch. The
       production branch can be disabled.
    3. The `branch_types` contains all the branch types.
    
    This is the raw configuration for the branching model. A client
    wishing to see the branching model with its actual current branches may
    find the [active model API](/cloud/bitbucket/rest/api-group-branching-model/#api-repositories-workspace-repo-slug-branching-model-get) more useful.
     */
    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}/branching-model/settings`
      );
    
      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