Skip to content

Commit

Permalink
Merge branch 'atlassian-api:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
gkowalc authored Mar 29, 2024
2 parents b70f618 + d4ef596 commit 6bcd2c0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
make docker-qa PYTHON_VERSION=${{matrix.python-version}}
- name: Creating coverage report
if: ${{ ( matrix.python-version == '3.8' ) }}
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
fail_ci_if_error: true
Expand Down
20 changes: 20 additions & 0 deletions atlassian/bitbucket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,26 @@ def markup_preview(self, data):
def _url_admin(self, api_version=None):
return self.resource_url("admin", api_version=api_version)

def get_groups(self, group_filter=None, limit=25, start=0):
"""
Get list of bitbucket groups.
Use 'group_filter' for get specific group or get all group if necessary.
:param group_filter: str - groupname
:param limit: int - paginated limit to retrieve
:param start: int - paginated point to start retrieving
:return: The collection as JSON with all relevant information about the group
"""
url = self.resource_url("groups", api_version="1.0")
params = {}
if group_filter:
params["filter"] = group_filter
if limit:
params["limit"] = limit
if start:
params["start"] = start
return self._get_paged(url, params=params)

def group_members(self, group, start=0, limit=None):
"""
Get group of members
Expand Down
3 changes: 3 additions & 0 deletions docs/bitbucket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ Groups and admins

.. code-block:: python
# Get groups. Use 'group_filter' parameter to get specific groups.
bitbucket.groups(group_filter="group", limit=99999)
# Get group of members
bitbucket.group_members(group, limit=99999)
Expand Down
7 changes: 7 additions & 0 deletions examples/bitbucket/bitbucket_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# coding=utf-8
from atlassian import Bitbucket

bitbucket = Bitbucket(url="http://localhost:7990", username="admin", password="admin")

data = bitbucket.get_groups(group_filter="group")
print(data)

0 comments on commit 6bcd2c0

Please sign in to comment.