Skip to content

Commit

Permalink
Merge pull request #158 from MerginMaps/only_public
Browse files Browse the repository at this point in the history
Add `only_public` to paginated projects api
  • Loading branch information
tomasMizera authored Jan 27, 2023
2 parents 0f45468 + c72808d commit f5761fc
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion mergin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ def paginated_projects_list(
only_namespace=None,
namespace=None,
order_params=None,
only_public=None,
):
"""
Find all available Mergin Maps projects.
Expand Down Expand Up @@ -472,6 +473,9 @@ def paginated_projects_list(
Available attrs: namespace, name, created, updated, disk_usage, creator
:type order_params: String
:param only_public: Only fetch public projects
:type only_public: Bool
:rtype: List[Dict]
"""
params = {}
Expand All @@ -487,6 +491,8 @@ def paginated_projects_list(
params["only_namespace"] = only_namespace
elif namespace:
params["namespace"] = namespace
if only_public:
params["only_public"] = only_public
params["page"] = page
params["per_page"] = per_page
if order_params is not None:
Expand All @@ -496,7 +502,15 @@ def paginated_projects_list(
return projects

def projects_list(
self, tags=None, user=None, flag=None, name=None, only_namespace=None, namespace=None, order_params=None
self,
tags=None,
user=None,
flag=None,
name=None,
only_namespace=None,
namespace=None,
order_params=None,
only_public=None,
):
"""
Find all available Mergin Maps projects.
Expand Down Expand Up @@ -526,6 +540,9 @@ def projects_list(
Available attrs: namespace, name, created, updated, disk_usage, creator
:type order_params: String
:param only_public: Only fetch public projects
:type only_public: Bool
:rtype: List[Dict]
"""
projects = []
Expand All @@ -542,6 +559,7 @@ def projects_list(
only_namespace=only_namespace,
namespace=namespace,
order_params=order_params,
only_public=only_public,
)
fetched_projects += len(resp["projects"])
count = resp["count"]
Expand Down

0 comments on commit f5761fc

Please sign in to comment.