Skip to content

Support for the effective branching model #88

Open
@bertoost

Description

@bertoost

Hi there,

Just discovered that the branching-model calls are literally the repository settings. Not the inherited settings, if configured. With the effective-branching-model, this should be fixed.

https://developer.atlassian.com/cloud/bitbucket/rest/api-group-branching-model/#api-repositories-workspace-repo-slug-effective-branching-model-get

use Bitbucket\Api\Repositories\Workspaces\AbstractWorkspacesApi;
use Bitbucket\HttpClient\Util\UriBuilder;

class EffectiveBranchingModel extends AbstractWorkspacesApi
{
    public function show(array $params = []): array
    {
        $uri = $this->buildEffectiveBranchingModelUri();

        return $this->get($uri, $params);
    }

    protected function buildEffectiveBranchingModelUri(string ...$parts): string
    {
        return UriBuilder::build('repositories', $this->workspace, $this->repo, 'effective-branching-model', ...$parts);
    }
}

In the workspaces part;

public function effectiveBranchingModel(string $repo): EffectiveBranchingModel
{
    return new EffectiveBranchingModel($this->getClient(), $this->workspace, $repo);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions