Skip to content

Commit

Permalink
client: include fields kwarg in get_project()
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Jan 11, 2023
1 parent 4d99ae5 commit 9d026b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,17 +736,19 @@ def available_query_params(self, resource="contributions"):
operation = resource_obj.operations[op_key]
return [param.name for param in operation.params.values()]

def get_project(self, name: str = None) -> Type[Dict]:
"""Retrieve full project entry
def get_project(self, name: str = None, fields: list = None) -> Type[Dict]:
"""Retrieve a project entry
Args:
name (str): name of the project
fields (list): list of fields to include in response
"""
name = self.project or name
if not name:
return {"error": "initialize client with project or set `name` argument!"}

return Dict(self.projects.getProjectByName(pk=name, _fields=["_all"]).result())
fields = fields or ["_all"] # retrieve all fields by default
return Dict(self.projects.getProjectByName(pk=name, _fields=fields).result())

def query_projects(
self,
Expand Down

0 comments on commit 9d026b4

Please sign in to comment.