Skip to content

Commit 59d4639

Browse files
authored
[BITBUCKET] Allow users to use filter on pipeline (atlassian-api#755)
Adding filter "page" & "pagelen" on pipeline.each()
1 parent f63efa7 commit 59d4639

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

atlassian/bitbucket/cloud/repositories/pipelines.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def trigger(self, branch="master", commit=None, pattern=None, variables=None):
5959

6060
return self.__get_object(self.post(None, trailing=True, data=data))
6161

62-
def each(self, q=None, sort=None):
62+
def each(self, q=None, sort=None, pagelen=None, page=None):
6363
"""
6464
Returns the list of pipelines in this repository.
6565
@@ -73,6 +73,10 @@ def each(self, q=None, sort=None):
7373
API docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines/#get
7474
"""
7575
params = {}
76+
if page is not None:
77+
params["page"] = page
78+
if pagelen is not None:
79+
params["pagelen"] = pagelen
7680
if sort is not None:
7781
params["sort"] = sort
7882
if q is not None:

docs/bitbucket.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,12 @@ Pipelines management
279279
# Get the repository first
280280
r = cloud.workspaces.get(workspace).repositories.get(repository)
281281
282-
# Get all Pipelines results for repository
282+
# Get first ten Pipelines results for repository
283283
r.pipelines.each()
284284
285+
# Get twenty last Pipelines results for repository
286+
r.pipelines.each(sort="-created_on", pagelen=20)
287+
285288
# Trigger default Pipeline on the latest revision of the master branch
286289
r.pipelines.trigger()
287290

0 commit comments

Comments
 (0)