# coding: utf-8

"""
Hatchet API

The Hatchet API

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from datetime import datetime
from pydantic import Field, StrictInt, StrictStr
from typing import List, Optional
from typing_extensions import Annotated
from hatchet_sdk.clients.rest.models.v1_log_line_level import V1LogLineLevel
from hatchet_sdk.clients.rest.models.v1_log_line_list import V1LogLineList
from hatchet_sdk.clients.rest.models.v1_log_line_order_by_direction import (
    V1LogLineOrderByDirection,
)
from hatchet_sdk.clients.rest.models.v1_logs_point_metrics import V1LogsPointMetrics

from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
from hatchet_sdk.clients.rest.api_response import ApiResponse
from hatchet_sdk.clients.rest.rest import RESTResponseType


class LogApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client

    @validate_call
    def v1_log_line_list(
        self,
        task: Annotated[
            str,
            Field(min_length=36, strict=True, max_length=36, description="The task id"),
        ],
        limit: Annotated[
            Optional[StrictInt], Field(description="The number to limit by")
        ] = None,
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        order_by_direction: Annotated[
            Optional[V1LogLineOrderByDirection],
            Field(description="The direction to order by"),
        ] = None,
        attempt: Annotated[
            Optional[StrictInt], Field(description="The attempt number to filter for")
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> V1LogLineList:
        """List log lines

        Lists log lines for a task

        :param task: The task id (required)
        :type task: str
        :param limit: The number to limit by
        :type limit: int
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param order_by_direction: The direction to order by
        :type order_by_direction: V1LogLineOrderByDirection
        :param attempt: The attempt number to filter for
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_log_line_list_serialize(
            task=task,
            limit=limit,
            since=since,
            until=until,
            search=search,
            levels=levels,
            order_by_direction=order_by_direction,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogLineList",
            "400": "APIErrors",
            "403": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def v1_log_line_list_with_http_info(
        self,
        task: Annotated[
            str,
            Field(min_length=36, strict=True, max_length=36, description="The task id"),
        ],
        limit: Annotated[
            Optional[StrictInt], Field(description="The number to limit by")
        ] = None,
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        order_by_direction: Annotated[
            Optional[V1LogLineOrderByDirection],
            Field(description="The direction to order by"),
        ] = None,
        attempt: Annotated[
            Optional[StrictInt], Field(description="The attempt number to filter for")
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[V1LogLineList]:
        """List log lines

        Lists log lines for a task

        :param task: The task id (required)
        :type task: str
        :param limit: The number to limit by
        :type limit: int
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param order_by_direction: The direction to order by
        :type order_by_direction: V1LogLineOrderByDirection
        :param attempt: The attempt number to filter for
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_log_line_list_serialize(
            task=task,
            limit=limit,
            since=since,
            until=until,
            search=search,
            levels=levels,
            order_by_direction=order_by_direction,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogLineList",
            "400": "APIErrors",
            "403": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def v1_log_line_list_without_preload_content(
        self,
        task: Annotated[
            str,
            Field(min_length=36, strict=True, max_length=36, description="The task id"),
        ],
        limit: Annotated[
            Optional[StrictInt], Field(description="The number to limit by")
        ] = None,
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        order_by_direction: Annotated[
            Optional[V1LogLineOrderByDirection],
            Field(description="The direction to order by"),
        ] = None,
        attempt: Annotated[
            Optional[StrictInt], Field(description="The attempt number to filter for")
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """List log lines

        Lists log lines for a task

        :param task: The task id (required)
        :type task: str
        :param limit: The number to limit by
        :type limit: int
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param order_by_direction: The direction to order by
        :type order_by_direction: V1LogLineOrderByDirection
        :param attempt: The attempt number to filter for
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_log_line_list_serialize(
            task=task,
            limit=limit,
            since=since,
            until=until,
            search=search,
            levels=levels,
            order_by_direction=order_by_direction,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogLineList",
            "400": "APIErrors",
            "403": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _v1_log_line_list_serialize(
        self,
        task,
        limit,
        since,
        until,
        search,
        levels,
        order_by_direction,
        attempt,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            "levels": "multi",
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if task is not None:
            _path_params["task"] = task
        # process the query parameters
        if limit is not None:

            _query_params.append(("limit", limit))

        if since is not None:
            if isinstance(since, datetime):
                _query_params.append(
                    (
                        "since",
                        since.strftime(self.api_client.configuration.datetime_format),
                    )
                )
            else:
                _query_params.append(("since", since))

        if until is not None:
            if isinstance(until, datetime):
                _query_params.append(
                    (
                        "until",
                        until.strftime(self.api_client.configuration.datetime_format),
                    )
                )
            else:
                _query_params.append(("until", until))

        if search is not None:

            _query_params.append(("search", search))

        if levels is not None:

            _query_params.append(("levels", levels))

        if order_by_direction is not None:

            _query_params.append(("order_by_direction", order_by_direction.value))

        if attempt is not None:

            _query_params.append(("attempt", attempt))

        # process the header parameters
        # process the form parameters
        # process the body parameter

        # set the HTTP header `Accept`
        if "Accept" not in _header_params:
            _header_params["Accept"] = self.api_client.select_header_accept(
                ["application/json"]
            )

        # authentication setting
        _auth_settings: List[str] = ["cookieAuth", "bearerAuth"]

        return self.api_client.param_serialize(
            method="GET",
            resource_path="/api/v1/stable/tasks/{task}/logs",
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth,
        )

    @validate_call
    def v1_tenant_log_line_get_point_metrics(
        self,
        tenant: Annotated[
            str,
            Field(
                min_length=36, strict=True, max_length=36, description="The tenant id"
            ),
        ],
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        task_external_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The task external ID(s) to filter by"),
        ] = None,
        workflow_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The workflow id(s) to filter for"),
        ] = None,
        step_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The step id(s) to filter for"),
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> V1LogsPointMetrics:
        """Get log point metrics

        Get a minute by minute breakdown of log metrics for a tenant

        :param tenant: The tenant id (required)
        :type tenant: str
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param task_external_ids: The task external ID(s) to filter by
        :type task_external_ids: List[str]
        :param workflow_ids: The workflow id(s) to filter for
        :type workflow_ids: List[str]
        :param step_ids: The step id(s) to filter for
        :type step_ids: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_tenant_log_line_get_point_metrics_serialize(
            tenant=tenant,
            since=since,
            until=until,
            search=search,
            levels=levels,
            task_external_ids=task_external_ids,
            workflow_ids=workflow_ids,
            step_ids=step_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogsPointMetrics",
            "400": "APIErrors",
            "403": "APIErrors",
            "501": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def v1_tenant_log_line_get_point_metrics_with_http_info(
        self,
        tenant: Annotated[
            str,
            Field(
                min_length=36, strict=True, max_length=36, description="The tenant id"
            ),
        ],
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        task_external_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The task external ID(s) to filter by"),
        ] = None,
        workflow_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The workflow id(s) to filter for"),
        ] = None,
        step_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The step id(s) to filter for"),
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[V1LogsPointMetrics]:
        """Get log point metrics

        Get a minute by minute breakdown of log metrics for a tenant

        :param tenant: The tenant id (required)
        :type tenant: str
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param task_external_ids: The task external ID(s) to filter by
        :type task_external_ids: List[str]
        :param workflow_ids: The workflow id(s) to filter for
        :type workflow_ids: List[str]
        :param step_ids: The step id(s) to filter for
        :type step_ids: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_tenant_log_line_get_point_metrics_serialize(
            tenant=tenant,
            since=since,
            until=until,
            search=search,
            levels=levels,
            task_external_ids=task_external_ids,
            workflow_ids=workflow_ids,
            step_ids=step_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogsPointMetrics",
            "400": "APIErrors",
            "403": "APIErrors",
            "501": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def v1_tenant_log_line_get_point_metrics_without_preload_content(
        self,
        tenant: Annotated[
            str,
            Field(
                min_length=36, strict=True, max_length=36, description="The tenant id"
            ),
        ],
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        task_external_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The task external ID(s) to filter by"),
        ] = None,
        workflow_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The workflow id(s) to filter for"),
        ] = None,
        step_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The step id(s) to filter for"),
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get log point metrics

        Get a minute by minute breakdown of log metrics for a tenant

        :param tenant: The tenant id (required)
        :type tenant: str
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param task_external_ids: The task external ID(s) to filter by
        :type task_external_ids: List[str]
        :param workflow_ids: The workflow id(s) to filter for
        :type workflow_ids: List[str]
        :param step_ids: The step id(s) to filter for
        :type step_ids: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_tenant_log_line_get_point_metrics_serialize(
            tenant=tenant,
            since=since,
            until=until,
            search=search,
            levels=levels,
            task_external_ids=task_external_ids,
            workflow_ids=workflow_ids,
            step_ids=step_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogsPointMetrics",
            "400": "APIErrors",
            "403": "APIErrors",
            "501": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _v1_tenant_log_line_get_point_metrics_serialize(
        self,
        tenant,
        since,
        until,
        search,
        levels,
        task_external_ids,
        workflow_ids,
        step_ids,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            "levels": "multi",
            "taskExternalIds": "multi",
            "workflow_ids": "multi",
            "step_ids": "multi",
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if tenant is not None:
            _path_params["tenant"] = tenant
        # process the query parameters
        if since is not None:
            if isinstance(since, datetime):
                _query_params.append(
                    (
                        "since",
                        since.strftime(self.api_client.configuration.datetime_format),
                    )
                )
            else:
                _query_params.append(("since", since))

        if until is not None:
            if isinstance(until, datetime):
                _query_params.append(
                    (
                        "until",
                        until.strftime(self.api_client.configuration.datetime_format),
                    )
                )
            else:
                _query_params.append(("until", until))

        if search is not None:

            _query_params.append(("search", search))

        if levels is not None:

            _query_params.append(("levels", levels))

        if task_external_ids is not None:

            _query_params.append(("taskExternalIds", task_external_ids))

        if workflow_ids is not None:

            _query_params.append(("workflow_ids", workflow_ids))

        if step_ids is not None:

            _query_params.append(("step_ids", step_ids))

        # process the header parameters
        # process the form parameters
        # process the body parameter

        # set the HTTP header `Accept`
        if "Accept" not in _header_params:
            _header_params["Accept"] = self.api_client.select_header_accept(
                ["application/json"]
            )

        # authentication setting
        _auth_settings: List[str] = ["cookieAuth", "bearerAuth"]

        return self.api_client.param_serialize(
            method="GET",
            resource_path="/api/v1/stable/tenants/{tenant}/log-point-metrics",
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth,
        )

    @validate_call
    def v1_tenant_log_line_list(
        self,
        tenant: Annotated[
            str,
            Field(
                min_length=36, strict=True, max_length=36, description="The tenant id"
            ),
        ],
        limit: Annotated[
            Optional[StrictInt], Field(description="The number to limit by")
        ] = None,
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        order_by_direction: Annotated[
            Optional[V1LogLineOrderByDirection],
            Field(description="The direction to order by"),
        ] = None,
        attempt: Annotated[
            Optional[StrictInt], Field(description="The attempt number to filter for")
        ] = None,
        task_external_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The task external ID(s) to filter by"),
        ] = None,
        workflow_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The workflow id(s) to filter for"),
        ] = None,
        step_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The step id(s) to filter for"),
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> V1LogLineList:
        """List log lines

        Lists log lines for a tenant

        :param tenant: The tenant id (required)
        :type tenant: str
        :param limit: The number to limit by
        :type limit: int
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param order_by_direction: The direction to order by
        :type order_by_direction: V1LogLineOrderByDirection
        :param attempt: The attempt number to filter for
        :type attempt: int
        :param task_external_ids: The task external ID(s) to filter by
        :type task_external_ids: List[str]
        :param workflow_ids: The workflow id(s) to filter for
        :type workflow_ids: List[str]
        :param step_ids: The step id(s) to filter for
        :type step_ids: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_tenant_log_line_list_serialize(
            tenant=tenant,
            limit=limit,
            since=since,
            until=until,
            search=search,
            levels=levels,
            order_by_direction=order_by_direction,
            attempt=attempt,
            task_external_ids=task_external_ids,
            workflow_ids=workflow_ids,
            step_ids=step_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogLineList",
            "400": "APIErrors",
            "403": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data

    @validate_call
    def v1_tenant_log_line_list_with_http_info(
        self,
        tenant: Annotated[
            str,
            Field(
                min_length=36, strict=True, max_length=36, description="The tenant id"
            ),
        ],
        limit: Annotated[
            Optional[StrictInt], Field(description="The number to limit by")
        ] = None,
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        order_by_direction: Annotated[
            Optional[V1LogLineOrderByDirection],
            Field(description="The direction to order by"),
        ] = None,
        attempt: Annotated[
            Optional[StrictInt], Field(description="The attempt number to filter for")
        ] = None,
        task_external_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The task external ID(s) to filter by"),
        ] = None,
        workflow_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The workflow id(s) to filter for"),
        ] = None,
        step_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The step id(s) to filter for"),
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[V1LogLineList]:
        """List log lines

        Lists log lines for a tenant

        :param tenant: The tenant id (required)
        :type tenant: str
        :param limit: The number to limit by
        :type limit: int
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param order_by_direction: The direction to order by
        :type order_by_direction: V1LogLineOrderByDirection
        :param attempt: The attempt number to filter for
        :type attempt: int
        :param task_external_ids: The task external ID(s) to filter by
        :type task_external_ids: List[str]
        :param workflow_ids: The workflow id(s) to filter for
        :type workflow_ids: List[str]
        :param step_ids: The step id(s) to filter for
        :type step_ids: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_tenant_log_line_list_serialize(
            tenant=tenant,
            limit=limit,
            since=since,
            until=until,
            search=search,
            levels=levels,
            order_by_direction=order_by_direction,
            attempt=attempt,
            task_external_ids=task_external_ids,
            workflow_ids=workflow_ids,
            step_ids=step_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogLineList",
            "400": "APIErrors",
            "403": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )

    @validate_call
    def v1_tenant_log_line_list_without_preload_content(
        self,
        tenant: Annotated[
            str,
            Field(
                min_length=36, strict=True, max_length=36, description="The tenant id"
            ),
        ],
        limit: Annotated[
            Optional[StrictInt], Field(description="The number to limit by")
        ] = None,
        since: Annotated[
            Optional[datetime], Field(description="The start time to get logs for")
        ] = None,
        until: Annotated[
            Optional[datetime], Field(description="The end time to get logs for")
        ] = None,
        search: Annotated[
            Optional[StrictStr],
            Field(description="A full-text search query to filter for"),
        ] = None,
        levels: Annotated[
            Optional[List[V1LogLineLevel]],
            Field(description="The log level(s) to include"),
        ] = None,
        order_by_direction: Annotated[
            Optional[V1LogLineOrderByDirection],
            Field(description="The direction to order by"),
        ] = None,
        attempt: Annotated[
            Optional[StrictInt], Field(description="The attempt number to filter for")
        ] = None,
        task_external_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The task external ID(s) to filter by"),
        ] = None,
        workflow_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The workflow id(s) to filter for"),
        ] = None,
        step_ids: Annotated[
            Optional[
                List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
            ],
            Field(description="The step id(s) to filter for"),
        ] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """List log lines

        Lists log lines for a tenant

        :param tenant: The tenant id (required)
        :type tenant: str
        :param limit: The number to limit by
        :type limit: int
        :param since: The start time to get logs for
        :type since: datetime
        :param until: The end time to get logs for
        :type until: datetime
        :param search: A full-text search query to filter for
        :type search: str
        :param levels: The log level(s) to include
        :type levels: List[V1LogLineLevel]
        :param order_by_direction: The direction to order by
        :type order_by_direction: V1LogLineOrderByDirection
        :param attempt: The attempt number to filter for
        :type attempt: int
        :param task_external_ids: The task external ID(s) to filter by
        :type task_external_ids: List[str]
        :param workflow_ids: The workflow id(s) to filter for
        :type workflow_ids: List[str]
        :param step_ids: The step id(s) to filter for
        :type step_ids: List[str]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """  # noqa: E501

        _param = self._v1_tenant_log_line_list_serialize(
            tenant=tenant,
            limit=limit,
            since=since,
            until=until,
            search=search,
            levels=levels,
            order_by_direction=order_by_direction,
            attempt=attempt,
            task_external_ids=task_external_ids,
            workflow_ids=workflow_ids,
            step_ids=step_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "V1LogLineList",
            "400": "APIErrors",
            "403": "APIErrors",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _v1_tenant_log_line_list_serialize(
        self,
        tenant,
        limit,
        since,
        until,
        search,
        levels,
        order_by_direction,
        attempt,
        task_external_ids,
        workflow_ids,
        step_ids,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            "levels": "multi",
            "taskExternalIds": "multi",
            "workflow_ids": "multi",
            "step_ids": "multi",
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if tenant is not None:
            _path_params["tenant"] = tenant
        # process the query parameters
        if limit is not None:

            _query_params.append(("limit", limit))

        if since is not None:
            if isinstance(since, datetime):
                _query_params.append(
                    (
                        "since",
                        since.strftime(self.api_client.configuration.datetime_format),
                    )
                )
            else:
                _query_params.append(("since", since))

        if until is not None:
            if isinstance(until, datetime):
                _query_params.append(
                    (
                        "until",
                        until.strftime(self.api_client.configuration.datetime_format),
                    )
                )
            else:
                _query_params.append(("until", until))

        if search is not None:

            _query_params.append(("search", search))

        if levels is not None:

            _query_params.append(("levels", levels))

        if order_by_direction is not None:

            _query_params.append(("order_by_direction", order_by_direction.value))

        if attempt is not None:

            _query_params.append(("attempt", attempt))

        if task_external_ids is not None:

            _query_params.append(("taskExternalIds", task_external_ids))

        if workflow_ids is not None:

            _query_params.append(("workflow_ids", workflow_ids))

        if step_ids is not None:

            _query_params.append(("step_ids", step_ids))

        # process the header parameters
        # process the form parameters
        # process the body parameter

        # set the HTTP header `Accept`
        if "Accept" not in _header_params:
            _header_params["Accept"] = self.api_client.select_header_accept(
                ["application/json"]
            )

        # authentication setting
        _auth_settings: List[str] = ["cookieAuth", "bearerAuth"]

        return self.api_client.param_serialize(
            method="GET",
            resource_path="/api/v1/stable/tenants/{tenant}/logs",
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth,
        )
