Skip to content

Commit

Permalink
Bitbucket Cloud: allow to access repositories directly
Browse files Browse the repository at this point in the history
This allows to access a Repository object without having
access to the workspace endpoint.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
  • Loading branch information
flichtenheld committed Jan 14, 2022
1 parent 6d8545a commit 2d8e1a4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions atlassian/bitbucket/cloud/repositories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ def each(self, after=None, role=None, q=None, sort=None):
for repository in self._get_paged(None, params):
yield self._get_object(repository)

def get(self, repository):
"""
Returns the requested repository.
Since this method accesses the repository endpoint
directly it is usable if you do not have permission
to access the workspace endpoint.
:param repository: string: The requested repository. Needs to be
the full name {workspace}/{slug}.
:return: The requested Repository object
API docs: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-get
"""
return self._get_object(super(Repositories, self).get(repository))


class WorkspaceRepositories(RepositoriesBase):
ALLOW_FORKS = "allow_forks"
Expand Down

0 comments on commit 2d8e1a4

Please sign in to comment.