Lee-W commented on code in PR #45634: URL: https://github.com/apache/airflow/pull/45634#discussion_r1926250885
########## providers/src/airflow/providers/dbt/cloud/hooks/dbt.py: ########## @@ -376,27 +385,73 @@ def get_project(self, project_id: int, account_id: int | None = None) -> Respons """ return self._run_and_get_response(endpoint=f"{account_id}/projects/{project_id}/", api_version="v3") + @fallback_to_default_account + def list_environments( + self, project_id: int, name_contains: str | None = None, account_id: int | None = None + ) -> list[Response]: + """ + Retrieve metadata for all environments tied to a specified dbt Cloud project. + + :param project_id: The ID of a dbt Cloud project. + :param name_contains: Optional. The case-insensitive substring of a dbt Cloud environment name to filter by. + :param account_id: Optional. The ID of a dbt Cloud account. + :return: List of request responses. + """ + payload = {"name__icontains": name_contains} if name_contains else None + return self._run_and_get_response( + endpoint=f"{account_id}/projects/{project_id}/environments/", + payload=payload, + paginate=True, + api_version="v3", + ) + + @fallback_to_default_account + def get_environment( + self, project_id: int, environment_id: int, account_id: int | None = None + ) -> Response: Review Comment: sounds like a good. in general, i would suggest using keyword-only for public method with more than 3 args. it's hard to remember the right order -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org