Skip to content

Commit

Permalink
Merge pull request #309 from EvanBldy/master
Browse files Browse the repository at this point in the history
[task] in gazu.task.get_task_type_by_name and new parameter for_entit…
  • Loading branch information
EvanBldy authored Jan 10, 2024
2 parents 07d2595 + 603d964 commit 6890b87
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions gazu/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,17 +444,22 @@ def get_task_type(task_type_id, client=default):


@cache
def get_task_type_by_name(task_type_name, client=default):
def get_task_type_by_name(
task_type_name, for_entity=None, department=None, client=default
):
"""
Args:
task_type_name (str): Name of claimed task type.
Returns:
dict: Task type object for given name.
"""
return raw.fetch_first(
"task-types", {"name": task_type_name}, client=client
)
params = {"name": task_type_name}
if for_entity is not None:
params["for_entity"] = for_entity
if department is not None:
params["department_id"] = normalize_model_parameter(department)["id"]
return raw.fetch_first("task-types", params, client=client)


@cache
Expand Down

0 comments on commit 6890b87

Please sign in to comment.