Skip to content

Add only_public to paginated projects api #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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