From 0d74d1cf8d672aa70aa622ed1e91c6d5c527b144 Mon Sep 17 00:00:00 2001 From: Gonchik Tsymzhitov Date: Wed, 16 Aug 2023 23:46:24 +0300 Subject: [PATCH] Add docs about properties (#1218) * Add docs about properties * Simplify expression * Jira: Add for changelog the pagination --------- Co-authored-by: Gonchik Tsymzhitov --- .../repositories/deploymentEnvironments.py | 5 ++-- atlassian/jira.py | 13 +++++++--- docs/jira.rst | 25 +++++++++++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py b/atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py index d217b4208..e85f539ed 100644 --- a/atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py +++ b/atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py @@ -170,8 +170,7 @@ def each(self, pagelen=10): API docs: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#api-repositories-workspace-repo-slug-deployments-config-environments-environment-uuid-variables-get """ - params = {} - params["pagelen"] = pagelen + params = {"pagelen": pagelen} response = super(BitbucketCloudBase, self).get(None, params=params) @@ -190,7 +189,7 @@ def each(self, pagelen=10): if pagelen_total < size_total: pagelen_total = pagelen_total + response["pagelen"] - page = page + 1 + page += 1 response = super(BitbucketCloudBase, self).get(None, params={"pagelen": pagelen, "page": page}) else: break diff --git a/atlassian/jira.py b/atlassian/jira.py index 12773ba00..5cc30018d 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -128,7 +128,7 @@ def set_property(self, property_id, value): def get_advanced_settings(self): """ - Returns the properties that are displayed on the "General Configuration > Advanced Settings" page + Returns the properties that are displayed on the "General Configuration > Advanced Settings" page. :return: """ url = self.resource_url("application-properties/advanced-settings") @@ -1077,15 +1077,22 @@ def issue_editmeta(self, key): url = "{}/{}/editmeta".format(base_url, key) return self.get(url) - def get_issue_changelog(self, issue_key): + def get_issue_changelog(self, issue_key, start=None, limit=None): """ Get issue related change log :param issue_key: + :param start: start index, usually 0 + :param limit: limit of the results, usually 50 :return: """ base_url = self.resource_url("issue") url = "{base_url}/{issue_key}?expand=changelog".format(base_url=base_url, issue_key=issue_key) - return (self.get(url) or {}).get("changelog") + params = {} + if start: + params["startAt"] = start + if limit: + params["maxResults"] = limit + return (self.get(url) or {}).get("changelog", params) def issue_add_json_worklog(self, key, worklog): """ diff --git a/docs/jira.rst b/docs/jira.rst index e3fb94c17..f64491360 100644 --- a/docs/jira.rst +++ b/docs/jira.rst @@ -31,6 +31,31 @@ Reindex Jira If it's not possible (due to an inconsistent index), do a foreground reindexing. """ +Manage Permissions +------------------ + +.. code-block:: python + + # Get permissions + jira.permissions(permissions, project_id=None, project_key=None, issue_id=None, issue_key=None,) + + # Get all permissions + jira.get_all_permissions() + +Application properties +---------------------- + +.. code-block:: python + + # Get an application property + jira.get_property(key=None, permission_level=None, key_filter=None) + + # Set an application property + jira.set_property(property_id, value) + + # Returns the properties that are displayed on the "General Configuration > Advanced Settings" page. + jira.get_advanced_settings() + Manage users ------------