| :mod:`airflow.providers.asana.hooks.asana` |
| ========================================== |
| |
| .. py:module:: airflow.providers.asana.hooks.asana |
| |
| .. autoapi-nested-parse:: |
| |
| Connect to Asana. |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| .. py:class:: AsanaHook(conn_id: str = default_conn_name, *args, **kwargs) |
| |
| Bases: :class:`airflow.hooks.base.BaseHook` |
| |
| Wrapper around Asana Python client library. |
| |
| .. attribute:: conn_name_attr |
| :annotation: = asana_conn_id |
| |
| |
| |
| .. attribute:: default_conn_name |
| :annotation: = asana_default |
| |
| |
| |
| .. attribute:: conn_type |
| :annotation: = asana |
| |
| |
| |
| .. attribute:: hook_name |
| :annotation: = Asana |
| |
| |
| |
| |
| .. method:: get_conn(self) |
| |
| |
| |
| |
| .. staticmethod:: get_connection_form_widgets() |
| |
| Returns connection widgets to add to connection form |
| |
| |
| |
| |
| .. staticmethod:: get_ui_field_behaviour() |
| |
| Returns custom field behaviour |
| |
| |
| |
| |
| .. method:: client(self) |
| |
| Instantiates python-asana Client |
| |
| |
| |
| |
| .. method:: create_task(self, task_name: str, params: dict) |
| |
| Creates an Asana task. |
| |
| :param task_name: Name of the new task |
| :param params: Other task attributes, such as due_on, parent, and notes. For a complete list |
| of possible parameters, see https://developers.asana.com/docs/create-a-task |
| :return: A dict of attributes of the created task, including its gid |
| |
| |
| |
| |
| .. method:: _merge_create_task_parameters(self, task_name: str, task_params: dict) |
| |
| Merge create_task parameters with default params from the connection. |
| |
| :param task_name: Name of the task |
| :param task_params: Other task parameters which should override defaults from the connection |
| :return: A dict of merged parameters to use in the new task |
| |
| |
| |
| |
| .. staticmethod:: _validate_create_task_parameters(params: dict) |
| |
| Check that user provided minimal parameters for task creation. |
| |
| :param params: A dict of attributes the task to be created should have |
| :return: None; raises ValueError if `params` doesn't contain required parameters |
| |
| |
| |
| |
| .. method:: delete_task(self, task_id: str) |
| |
| Deletes an Asana task. |
| |
| :param task_id: Asana GID of the task to delete |
| :return: A dict containing the response from Asana |
| |
| |
| |
| |
| .. method:: find_task(self, params: dict) |
| |
| Retrieves a list of Asana tasks that match search parameters. |
| |
| :param params: Attributes that matching tasks should have. For a list of possible parameters, |
| see https://developers.asana.com/docs/get-multiple-tasks |
| :return: A list of dicts containing attributes of matching Asana tasks |
| |
| |
| |
| |
| .. method:: _merge_find_task_parameters(self, search_parameters: dict) |
| |
| Merge find_task parameters with default params from the connection. |
| |
| :param search_parameters: Attributes that tasks matching the search should have; these override |
| defaults from the connection |
| :return: A dict of merged parameters to use in the search |
| |
| |
| |
| |
| .. staticmethod:: _validate_find_task_parameters(params: dict) |
| |
| Check that the user provided minimal search parameters. |
| |
| :param params: Dict of parameters to be used in the search |
| :return: None; raises ValueError if search parameters do not contain minimum required attributes |
| |
| |
| |
| |
| .. method:: update_task(self, task_id: str, params: dict) |
| |
| Updates an existing Asana task. |
| |
| :param task_id: Asana GID of task to update |
| :param params: New values of the task's attributes. For a list of possible parameters, see |
| https://developers.asana.com/docs/update-a-task |
| :return: A dict containing the updated task's attributes |
| |
| |
| |
| |
| .. method:: create_project(self, params: dict) |
| |
| Creates a new project. |
| |
| :param params: Attributes that the new project should have. See |
| https://developers.asana.com/docs/create-a-project#create-a-project-parameters |
| for a list of possible parameters. |
| :return: A dict containing the new project's attributes, including its GID. |
| |
| |
| |
| |
| .. staticmethod:: _validate_create_project_parameters(params: dict) |
| |
| Check that user provided the minimum required parameters for project creation |
| |
| :param params: Attributes that the new project should have |
| :return: None; raises a ValueError if `params` does not contain the minimum required attributes. |
| |
| |
| |
| |
| .. method:: _merge_project_parameters(self, params: dict) |
| |
| Merge parameters passed into a project method with default params from the connection. |
| |
| :param params: Parameters passed into one of the project methods, which should override |
| defaults from the connection |
| :return: A dict of merged parameters |
| |
| |
| |
| |
| .. method:: find_project(self, params: dict) |
| |
| Retrieves a list of Asana projects that match search parameters. |
| |
| :param params: Attributes which matching projects should have. See |
| https://developers.asana.com/docs/get-multiple-projects |
| for a list of possible parameters. |
| :return: A list of dicts containing attributes of matching Asana projects |
| |
| |
| |
| |
| .. method:: update_project(self, project_id: str, params: dict) |
| |
| Updates an existing project. |
| |
| :param project_id: Asana GID of the project to update |
| :param params: New attributes that the project should have. See |
| https://developers.asana.com/docs/update-a-project#update-a-project-parameters |
| for a list of possible parameters |
| :return: A dict containing the updated project's attributes |
| |
| |
| |
| |
| .. method:: delete_project(self, project_id: str) |
| |
| Deletes a project. |
| |
| :param project_id: Asana GID of the project to delete |
| :return: A dict containing the response from Asana |
| |
| |
| |
| |