Skip to content

Commit ef7bfb9

Browse files
committed
* Updated docstrings
1 parent 439a5a9 commit ef7bfb9

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

mergin/client.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,21 @@ def project_info(self, project_path_or_id, since=None, version=None):
719719
return json.load(resp)
720720

721721
def project_versions_page(self, project_path, page, per_page=100, descending=False):
722+
"""
723+
Get records of project's versions (history) using calculated pagination.
724+
wrapper around the /v1/project/versions/paginated/{} API end point
725+
726+
:param project_path: Project's full name (<namespace>/<name>)
727+
:type project_path: String | Int
728+
:param page: page number
729+
:type page: Int
730+
:param per_page: number of results per page default 100
731+
:type per_page: Int
732+
:param descending: order of sorting
733+
:type descending: Bool
734+
735+
:rtype: List[Dict]
736+
"""
722737
params = {"page": page, "per_page": per_page, "descending": descending}
723738
resp = self.get("/v1/project/versions/paginated/{}".format(project_path), params)
724739
resp_json = json.load(resp)
@@ -727,8 +742,12 @@ def project_versions_page(self, project_path, page, per_page=100, descending=Fal
727742
def project_versions_count(self, project_path):
728743
"""
729744
return the total count of versions
745+
To note we fetch only one page and one item as we only need the "count" response
746+
747+
:param project_path_or_id: Project's full name (<namespace>/<name>) or id
748+
:type project_path_or_id: String
730749
731-
To note the requested informations are kept to the minimal
750+
:rtype: Int
732751
"""
733752
params = {"page": 1, "per_page": 1, "descending": False}
734753
resp = self.get("/v1/project/versions/paginated/{}".format(project_path), params)
@@ -741,11 +760,11 @@ def project_versions_in_range(self, project_path, since=None, to=None):
741760
If neither 'since' nor 'to' is specified it will return all versions.
742761
743762
:param project_path: Project's full name (<namespace>/<name>)
744-
:type project_path: String | Int
763+
:type project_path: String
745764
:param since: Version to track project history from
746765
:type since: String | Int
747766
:param to: Version to track project history to
748-
:type to: String
767+
:type to: String | Int
749768
750769
:rtype: List[Dict]
751770
"""

0 commit comments

Comments
 (0)