Skip to content

Commit ed374f6

Browse files
flichtenheldgonchikSpacetown
authored
Bitbucket Cloud: allow to access repositories directly (atlassian-api#923)
* Bitbucket Cloud: allow to access repositories directly This allows to access a Repository object without having access to the workspace endpoint. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> * Update atlassian/bitbucket/cloud/repositories/__init__.py Co-authored-by: Michael Förderer <michael.foerderer@gmx.de> * Update atlassian/bitbucket/cloud/repositories/__init__.py Co-authored-by: Frank Lichtenheld <frank@lichtenheld.com> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Co-authored-by: Gonchik Tsymzhitov <gonchik.tsymzhitov@gmail.com> Co-authored-by: Michael Förderer <michael.foerderer@gmx.de>
1 parent dc9a099 commit ed374f6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

atlassian/bitbucket/cloud/repositories/__init__.py

+17
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ def each(self, after=None, role=None, q=None, sort=None):
6363
for repository in self._get_paged(None, params):
6464
yield self._get_object(repository)
6565

66+
def get(self, workspace, repo_slug):
67+
"""
68+
Returns the requested repository.
69+
70+
Since this method accesses the repository endpoint
71+
directly it is usable if you do not have permission
72+
to access the workspace endpoint.
73+
74+
:param workspace: string: The workspace of the repository
75+
:param repo_slug: string: The requested repository.
76+
77+
:return: The requested Repository object
78+
79+
API docs: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-get
80+
"""
81+
return self._get_object(super(Repositories, self).get("{}/{}".format(workspace, repo_slug)))
82+
6683

6784
class WorkspaceRepositories(RepositoriesBase):
6885
ALLOW_FORKS = "allow_forks"

0 commit comments

Comments
 (0)