# coding: utf-8

"""
    LEIA RESTful API for AI

    Leia API  # noqa: E501

    The version of the OpenAPI document: 1.0.0
    Contact: contact@leia.io
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

from pydantic import validate_arguments, ValidationError
from typing_extensions import Annotated

from datetime import datetime

from pydantic import Field, StrictBool, StrictInt, StrictStr

from typing import List, Optional

from leiaapi.generated.models.application import Application
from leiaapi.generated.models.application_types import ApplicationTypes

from leiaapi.generated.api_client import ApiClient
from leiaapi.generated.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class ApplicationAdminApi(object):
    """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):
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client

    @validate_arguments
    def admin_create_application(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application : Optional[Application] = None, **kwargs) -> Application:  # noqa: E501
        """Adds a new application to the system (admin only)  # noqa: E501

        Adds a new application to the system. This method is only accessible to admins. An API key will be generated for the new application when calling this method. Note or store it carefully, it will not be recoverable after this call.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_create_application(token, application, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application:
        :type application: Application
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: Application
        """
        kwargs['_return_http_data_only'] = True
        return self.admin_create_application_with_http_info(token, application, **kwargs)  # noqa: E501

    @validate_arguments
    def admin_create_application_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application : Optional[Application] = None, **kwargs):  # noqa: E501
        """Adds a new application to the system (admin only)  # noqa: E501

        Adds a new application to the system. This method is only accessible to admins. An API key will be generated for the new application when calling this method. Note or store it carefully, it will not be recoverable after this call.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_create_application_with_http_info(token, application, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application:
        :type application: Application
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(Application, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'application'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method admin_create_application" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        if _params['token']:
            _header_params['token'] = _params['token']

        # process the form parameters
        _form_params = []
        _files = {}

        # process the body parameter
        _body_params = None
        if _params['application']:
            _body_params = _params['application']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "Application",
            '400': None,
            '401': None,
            '409': None,
        }

        return self.api_client.call_api(
            '/admin/application', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def admin_delete_always_on_schedule(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application")], always_on_schedule_id : Annotated[StrictStr, Field(..., description="The id of the schedule to delete")], **kwargs) -> None:  # noqa: E501
        """Removes a schedule from an application  # noqa: E501

        Removes a schedule from an application  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_delete_always_on_schedule(token, application_id, always_on_schedule_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application (required)
        :type application_id: str
        :param always_on_schedule_id: The id of the schedule to delete (required)
        :type always_on_schedule_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """
        kwargs['_return_http_data_only'] = True
        return self.admin_delete_always_on_schedule_with_http_info(token, application_id, always_on_schedule_id, **kwargs)  # noqa: E501

    @validate_arguments
    def admin_delete_always_on_schedule_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application")], always_on_schedule_id : Annotated[StrictStr, Field(..., description="The id of the schedule to delete")], **kwargs):  # noqa: E501
        """Removes a schedule from an application  # noqa: E501

        Removes a schedule from an application  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_delete_always_on_schedule_with_http_info(token, application_id, always_on_schedule_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application (required)
        :type application_id: str
        :param always_on_schedule_id: The id of the schedule to delete (required)
        :type always_on_schedule_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """

        _params = locals()

        _all_params = [
            'token',
            'application_id',
            'always_on_schedule_id'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method admin_delete_always_on_schedule" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['application_id']:
            _path_params['application_id'] = _params['application_id']
        if _params['always_on_schedule_id']:
            _path_params['always_on_schedule_id'] = _params['always_on_schedule_id']

        # process the query parameters
        _query_params = []

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        if _params['token']:
            _header_params['token'] = _params['token']

        # process the form parameters
        _form_params = []
        _files = {}

        # process the body parameter
        _body_params = None

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {}

        return self.api_client.call_api(
            '/admin/application/{application_id}/always_on_schedules/{always_on_schedule_id}', 'DELETE',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def admin_delete_application(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application to delete")], **kwargs) -> None:  # noqa: E501
        """Deletes an application (admin only)  # noqa: E501

        Retrieves a new application from the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_delete_application(token, application_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application to delete (required)
        :type application_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """
        kwargs['_return_http_data_only'] = True
        return self.admin_delete_application_with_http_info(token, application_id, **kwargs)  # noqa: E501

    @validate_arguments
    def admin_delete_application_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application to delete")], **kwargs):  # noqa: E501
        """Deletes an application (admin only)  # noqa: E501

        Retrieves a new application from the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_delete_application_with_http_info(token, application_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application to delete (required)
        :type application_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """

        _params = locals()

        _all_params = [
            'token',
            'application_id'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method admin_delete_application" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['application_id']:
            _path_params['application_id'] = _params['application_id']

        # process the query parameters
        _query_params = []

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        if _params['token']:
            _header_params['token'] = _params['token']

        # process the form parameters
        _form_params = []
        _files = {}

        # process the body parameter
        _body_params = None

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {}

        return self.api_client.call_api(
            '/admin/application/{application_id}', 'DELETE',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def admin_edit_application(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The application to modify")], application_name : Annotated[Optional[StrictStr], Field(description="The new name of the application")] = None, email : Annotated[Optional[StrictStr], Field(description="The new email of the application")] = None, first_name : Annotated[Optional[StrictStr], Field(description="The new first name of the application")] = None, last_name : Annotated[Optional[StrictStr], Field(description="The new last name of the application")] = None, default_job_callback_url : Annotated[Optional[StrictStr], Field(description="The new default_job_callback_url of the application")] = None, dedicated_workers : Annotated[Optional[StrictBool], Field(description="Should this application use dedicated workers ?")] = None, dedicated_workers_ttl : Annotated[Optional[StrictInt], Field(description="When using dedicated workers, TTL of the worker (in seconds)")] = None, dedicated_workers_max_models : Annotated[Optional[StrictInt], Field(description="When using dedicated workers, maximum number of models loaded at the same time")] = None, reduce_callback_payloads : Annotated[Optional[StrictBool], Field(description="Specifies if the callback should be sent as is, or if the potential base64 encoded documents generated should be saved as sub documents of the original document")] = None, always_on_number : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Will start number always on workers when start time happens and stop them at stop time. (Check always_on_* parameters to set other parameters)")] = None, always_on_start_days : Annotated[Optional[List[StrictInt]], Field(description="Adds a schedule for always on workers. Set the day(s) of the week at which the worker will start (1 is Monday, 7 is Sunday, comma separated). Stop day will be the same day. (Check always_on_* parameters to set other parameters)")] = None, always_on_start_hour : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the hour at which the worker will start (between 0 and 23). (Check always_on_* parameters to set other parameters)")] = None, always_on_stop_hour : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the hour at which the worker will stop (between 0 and 23, stop must happen after start). (Check always_on_* parameters to set other parameters)")] = None, always_on_start_minute : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the minute at which the worker will start (between 0 and 59). (Check always_on_* parameters to set other parameters)")] = None, always_on_stop_minute : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the minute at which the worker will stop (between 0 and 59, stop must happen after start). (Check always_on_* parameters to set other parameters)")] = None, always_on_workers_model_ids : Annotated[Optional[List[StrictStr]], Field(description="When using dedicated workers with always on schedule, the models that should be loaded on start of the worker")] = None, **kwargs) -> Application:  # noqa: E501
        """Modifies an existing application in the system (admin only)  # noqa: E501

        Modifies an application already in the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_edit_application(token, application_id, application_name, email, first_name, last_name, default_job_callback_url, dedicated_workers, dedicated_workers_ttl, dedicated_workers_max_models, reduce_callback_payloads, always_on_number, always_on_start_days, always_on_start_hour, always_on_stop_hour, always_on_start_minute, always_on_stop_minute, always_on_workers_model_ids, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The application to modify (required)
        :type application_id: str
        :param application_name: The new name of the application
        :type application_name: str
        :param email: The new email of the application
        :type email: str
        :param first_name: The new first name of the application
        :type first_name: str
        :param last_name: The new last name of the application
        :type last_name: str
        :param default_job_callback_url: The new default_job_callback_url of the application
        :type default_job_callback_url: str
        :param dedicated_workers: Should this application use dedicated workers ?
        :type dedicated_workers: bool
        :param dedicated_workers_ttl: When using dedicated workers, TTL of the worker (in seconds)
        :type dedicated_workers_ttl: int
        :param dedicated_workers_max_models: When using dedicated workers, maximum number of models loaded at the same time
        :type dedicated_workers_max_models: int
        :param reduce_callback_payloads: Specifies if the callback should be sent as is, or if the potential base64 encoded documents generated should be saved as sub documents of the original document
        :type reduce_callback_payloads: bool
        :param always_on_number: Adds a schedule for always on workers. Will start number always on workers when start time happens and stop them at stop time. (Check always_on_* parameters to set other parameters)
        :type always_on_number: int
        :param always_on_start_days: Adds a schedule for always on workers. Set the day(s) of the week at which the worker will start (1 is Monday, 7 is Sunday, comma separated). Stop day will be the same day. (Check always_on_* parameters to set other parameters)
        :type always_on_start_days: List[int]
        :param always_on_start_hour: Adds a schedule for always on workers. Set the hour at which the worker will start (between 0 and 23). (Check always_on_* parameters to set other parameters)
        :type always_on_start_hour: int
        :param always_on_stop_hour: Adds a schedule for always on workers. Set the hour at which the worker will stop (between 0 and 23, stop must happen after start). (Check always_on_* parameters to set other parameters)
        :type always_on_stop_hour: int
        :param always_on_start_minute: Adds a schedule for always on workers. Set the minute at which the worker will start (between 0 and 59). (Check always_on_* parameters to set other parameters)
        :type always_on_start_minute: int
        :param always_on_stop_minute: Adds a schedule for always on workers. Set the minute at which the worker will stop (between 0 and 59, stop must happen after start). (Check always_on_* parameters to set other parameters)
        :type always_on_stop_minute: int
        :param always_on_workers_model_ids: When using dedicated workers with always on schedule, the models that should be loaded on start of the worker
        :type always_on_workers_model_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: Application
        """
        kwargs['_return_http_data_only'] = True
        return self.admin_edit_application_with_http_info(token, application_id, application_name, email, first_name, last_name, default_job_callback_url, dedicated_workers, dedicated_workers_ttl, dedicated_workers_max_models, reduce_callback_payloads, always_on_number, always_on_start_days, always_on_start_hour, always_on_stop_hour, always_on_start_minute, always_on_stop_minute, always_on_workers_model_ids, **kwargs)  # noqa: E501

    @validate_arguments
    def admin_edit_application_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The application to modify")], application_name : Annotated[Optional[StrictStr], Field(description="The new name of the application")] = None, email : Annotated[Optional[StrictStr], Field(description="The new email of the application")] = None, first_name : Annotated[Optional[StrictStr], Field(description="The new first name of the application")] = None, last_name : Annotated[Optional[StrictStr], Field(description="The new last name of the application")] = None, default_job_callback_url : Annotated[Optional[StrictStr], Field(description="The new default_job_callback_url of the application")] = None, dedicated_workers : Annotated[Optional[StrictBool], Field(description="Should this application use dedicated workers ?")] = None, dedicated_workers_ttl : Annotated[Optional[StrictInt], Field(description="When using dedicated workers, TTL of the worker (in seconds)")] = None, dedicated_workers_max_models : Annotated[Optional[StrictInt], Field(description="When using dedicated workers, maximum number of models loaded at the same time")] = None, reduce_callback_payloads : Annotated[Optional[StrictBool], Field(description="Specifies if the callback should be sent as is, or if the potential base64 encoded documents generated should be saved as sub documents of the original document")] = None, always_on_number : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Will start number always on workers when start time happens and stop them at stop time. (Check always_on_* parameters to set other parameters)")] = None, always_on_start_days : Annotated[Optional[List[StrictInt]], Field(description="Adds a schedule for always on workers. Set the day(s) of the week at which the worker will start (1 is Monday, 7 is Sunday, comma separated). Stop day will be the same day. (Check always_on_* parameters to set other parameters)")] = None, always_on_start_hour : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the hour at which the worker will start (between 0 and 23). (Check always_on_* parameters to set other parameters)")] = None, always_on_stop_hour : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the hour at which the worker will stop (between 0 and 23, stop must happen after start). (Check always_on_* parameters to set other parameters)")] = None, always_on_start_minute : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the minute at which the worker will start (between 0 and 59). (Check always_on_* parameters to set other parameters)")] = None, always_on_stop_minute : Annotated[Optional[StrictInt], Field(description="Adds a schedule for always on workers. Set the minute at which the worker will stop (between 0 and 59, stop must happen after start). (Check always_on_* parameters to set other parameters)")] = None, always_on_workers_model_ids : Annotated[Optional[List[StrictStr]], Field(description="When using dedicated workers with always on schedule, the models that should be loaded on start of the worker")] = None, **kwargs):  # noqa: E501
        """Modifies an existing application in the system (admin only)  # noqa: E501

        Modifies an application already in the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_edit_application_with_http_info(token, application_id, application_name, email, first_name, last_name, default_job_callback_url, dedicated_workers, dedicated_workers_ttl, dedicated_workers_max_models, reduce_callback_payloads, always_on_number, always_on_start_days, always_on_start_hour, always_on_stop_hour, always_on_start_minute, always_on_stop_minute, always_on_workers_model_ids, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The application to modify (required)
        :type application_id: str
        :param application_name: The new name of the application
        :type application_name: str
        :param email: The new email of the application
        :type email: str
        :param first_name: The new first name of the application
        :type first_name: str
        :param last_name: The new last name of the application
        :type last_name: str
        :param default_job_callback_url: The new default_job_callback_url of the application
        :type default_job_callback_url: str
        :param dedicated_workers: Should this application use dedicated workers ?
        :type dedicated_workers: bool
        :param dedicated_workers_ttl: When using dedicated workers, TTL of the worker (in seconds)
        :type dedicated_workers_ttl: int
        :param dedicated_workers_max_models: When using dedicated workers, maximum number of models loaded at the same time
        :type dedicated_workers_max_models: int
        :param reduce_callback_payloads: Specifies if the callback should be sent as is, or if the potential base64 encoded documents generated should be saved as sub documents of the original document
        :type reduce_callback_payloads: bool
        :param always_on_number: Adds a schedule for always on workers. Will start number always on workers when start time happens and stop them at stop time. (Check always_on_* parameters to set other parameters)
        :type always_on_number: int
        :param always_on_start_days: Adds a schedule for always on workers. Set the day(s) of the week at which the worker will start (1 is Monday, 7 is Sunday, comma separated). Stop day will be the same day. (Check always_on_* parameters to set other parameters)
        :type always_on_start_days: List[int]
        :param always_on_start_hour: Adds a schedule for always on workers. Set the hour at which the worker will start (between 0 and 23). (Check always_on_* parameters to set other parameters)
        :type always_on_start_hour: int
        :param always_on_stop_hour: Adds a schedule for always on workers. Set the hour at which the worker will stop (between 0 and 23, stop must happen after start). (Check always_on_* parameters to set other parameters)
        :type always_on_stop_hour: int
        :param always_on_start_minute: Adds a schedule for always on workers. Set the minute at which the worker will start (between 0 and 59). (Check always_on_* parameters to set other parameters)
        :type always_on_start_minute: int
        :param always_on_stop_minute: Adds a schedule for always on workers. Set the minute at which the worker will stop (between 0 and 59, stop must happen after start). (Check always_on_* parameters to set other parameters)
        :type always_on_stop_minute: int
        :param always_on_workers_model_ids: When using dedicated workers with always on schedule, the models that should be loaded on start of the worker
        :type always_on_workers_model_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(Application, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'application_id',
            'application_name',
            'email',
            'first_name',
            'last_name',
            'default_job_callback_url',
            'dedicated_workers',
            'dedicated_workers_ttl',
            'dedicated_workers_max_models',
            'reduce_callback_payloads',
            'always_on_number',
            'always_on_start_days',
            'always_on_start_hour',
            'always_on_stop_hour',
            'always_on_start_minute',
            'always_on_stop_minute',
            'always_on_workers_model_ids'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method admin_edit_application" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['application_id']:
            _path_params['application_id'] = _params['application_id']

        # process the query parameters
        _query_params = []
        if _params.get('application_name') is not None:  # noqa: E501
            _query_params.append(('application_name', _params['application_name']))
        if _params.get('email') is not None:  # noqa: E501
            _query_params.append(('email', _params['email']))
        if _params.get('first_name') is not None:  # noqa: E501
            _query_params.append(('first_name', _params['first_name']))
        if _params.get('last_name') is not None:  # noqa: E501
            _query_params.append(('last_name', _params['last_name']))
        if _params.get('default_job_callback_url') is not None:  # noqa: E501
            _query_params.append(('default_job_callback_url', _params['default_job_callback_url']))
        if _params.get('dedicated_workers') is not None:  # noqa: E501
            _query_params.append(('dedicated_workers', _params['dedicated_workers']))
        if _params.get('dedicated_workers_ttl') is not None:  # noqa: E501
            _query_params.append(('dedicated_workers_ttl', _params['dedicated_workers_ttl']))
        if _params.get('dedicated_workers_max_models') is not None:  # noqa: E501
            _query_params.append(('dedicated_workers_max_models', _params['dedicated_workers_max_models']))
        if _params.get('reduce_callback_payloads') is not None:  # noqa: E501
            _query_params.append(('reduce_callback_payloads', _params['reduce_callback_payloads']))
        if _params.get('always_on_number') is not None:  # noqa: E501
            _query_params.append(('always_on_number', _params['always_on_number']))
        if _params.get('always_on_start_days') is not None:  # noqa: E501
            _query_params.append(('always_on_start_days', _params['always_on_start_days']))
            _collection_formats['always_on_start_days'] = 'multi'
        if _params.get('always_on_start_hour') is not None:  # noqa: E501
            _query_params.append(('always_on_start_hour', _params['always_on_start_hour']))
        if _params.get('always_on_stop_hour') is not None:  # noqa: E501
            _query_params.append(('always_on_stop_hour', _params['always_on_stop_hour']))
        if _params.get('always_on_start_minute') is not None:  # noqa: E501
            _query_params.append(('always_on_start_minute', _params['always_on_start_minute']))
        if _params.get('always_on_stop_minute') is not None:  # noqa: E501
            _query_params.append(('always_on_stop_minute', _params['always_on_stop_minute']))
        if _params.get('always_on_workers_model_ids') is not None:  # noqa: E501
            _query_params.append(('always_on_workers_model_ids', _params['always_on_workers_model_ids']))
            _collection_formats['always_on_workers_model_ids'] = 'multi'

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        if _params['token']:
            _header_params['token'] = _params['token']

        # process the form parameters
        _form_params = []
        _files = {}

        # process the body parameter
        _body_params = None

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "Application",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/admin/application/{application_id}', 'PATCH',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def admin_get_application(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application to retrieve")], **kwargs) -> Application:  # noqa: E501
        """Retrieves an application (admin only)  # noqa: E501

        Retrieves a new application from the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_get_application(token, application_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application to retrieve (required)
        :type application_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: Application
        """
        kwargs['_return_http_data_only'] = True
        return self.admin_get_application_with_http_info(token, application_id, **kwargs)  # noqa: E501

    @validate_arguments
    def admin_get_application_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application to retrieve")], **kwargs):  # noqa: E501
        """Retrieves an application (admin only)  # noqa: E501

        Retrieves a new application from the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_get_application_with_http_info(token, application_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application to retrieve (required)
        :type application_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(Application, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'application_id'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method admin_get_application" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['application_id']:
            _path_params['application_id'] = _params['application_id']

        # process the query parameters
        _query_params = []

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        if _params['token']:
            _header_params['token'] = _params['token']

        # process the form parameters
        _form_params = []
        _files = {}

        # process the body parameter
        _body_params = None

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "Application",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/admin/application/{application_id}', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def admin_get_applications(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[Optional[StrictStr], Field(description="If specified, filters by application id")] = None, email : Annotated[Optional[StrictStr], Field(description="If specified, filters by application email")] = None, application_name : Annotated[Optional[StrictStr], Field(description="If specified, filters by application name")] = None, first_name : Annotated[Optional[StrictStr], Field(description="If specified, filters by application first_name")] = None, last_name : Annotated[Optional[StrictStr], Field(description="If specified, filters by application last_name")] = None, application_type : Annotated[Optional[ApplicationTypes], Field(description="If specified, filters by application application_type")] = None, created_after : Annotated[Optional[datetime], Field(description="If specified, keeps only applications created after given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)")] = None, created_before : Annotated[Optional[datetime], Field(description="If specified, keeps only applications created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)")] = None, dedicated_workers : Annotated[Optional[StrictBool], Field(description="If specified, filters by dedicated_workers value")] = None, offset : Annotated[Optional[StrictInt], Field(description="Number of the first document to send (pagination)")] = None, limit : Annotated[Optional[StrictInt], Field(description="Maximum number of documents to send (pagination)")] = None, sort : Annotated[Optional[StrictStr], Field(description="If specified, sorts the applications by a list of existing parameters separated by commas. Can be 'application_name', 'application_type', 'creation_time', 'first_name', 'last_name', 'email', 'dedicated_workers'. Sorts in ascending order by default. If a parameter is preceded by '-', it is sorted in descending order.")] = None, **kwargs) -> List[Application]:  # noqa: E501
        """Retrieves applications (admin only) (paginated)  # noqa: E501

        Retrieves applications from the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_get_applications(token, application_id, email, application_name, first_name, last_name, application_type, created_after, created_before, dedicated_workers, offset, limit, sort, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: If specified, filters by application id
        :type application_id: str
        :param email: If specified, filters by application email
        :type email: str
        :param application_name: If specified, filters by application name
        :type application_name: str
        :param first_name: If specified, filters by application first_name
        :type first_name: str
        :param last_name: If specified, filters by application last_name
        :type last_name: str
        :param application_type: If specified, filters by application application_type
        :type application_type: ApplicationTypes
        :param created_after: If specified, keeps only applications created after given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_after: datetime
        :param created_before: If specified, keeps only applications created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_before: datetime
        :param dedicated_workers: If specified, filters by dedicated_workers value
        :type dedicated_workers: bool
        :param offset: Number of the first document to send (pagination)
        :type offset: int
        :param limit: Maximum number of documents to send (pagination)
        :type limit: int
        :param sort: If specified, sorts the applications by a list of existing parameters separated by commas. Can be 'application_name', 'application_type', 'creation_time', 'first_name', 'last_name', 'email', 'dedicated_workers'. Sorts in ascending order by default. If a parameter is preceded by '-', it is sorted in descending order.
        :type sort: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: List[Application]
        """
        kwargs['_return_http_data_only'] = True
        return self.admin_get_applications_with_http_info(token, application_id, email, application_name, first_name, last_name, application_type, created_after, created_before, dedicated_workers, offset, limit, sort, **kwargs)  # noqa: E501

    @validate_arguments
    def admin_get_applications_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[Optional[StrictStr], Field(description="If specified, filters by application id")] = None, email : Annotated[Optional[StrictStr], Field(description="If specified, filters by application email")] = None, application_name : Annotated[Optional[StrictStr], Field(description="If specified, filters by application name")] = None, first_name : Annotated[Optional[StrictStr], Field(description="If specified, filters by application first_name")] = None, last_name : Annotated[Optional[StrictStr], Field(description="If specified, filters by application last_name")] = None, application_type : Annotated[Optional[ApplicationTypes], Field(description="If specified, filters by application application_type")] = None, created_after : Annotated[Optional[datetime], Field(description="If specified, keeps only applications created after given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)")] = None, created_before : Annotated[Optional[datetime], Field(description="If specified, keeps only applications created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)")] = None, dedicated_workers : Annotated[Optional[StrictBool], Field(description="If specified, filters by dedicated_workers value")] = None, offset : Annotated[Optional[StrictInt], Field(description="Number of the first document to send (pagination)")] = None, limit : Annotated[Optional[StrictInt], Field(description="Maximum number of documents to send (pagination)")] = None, sort : Annotated[Optional[StrictStr], Field(description="If specified, sorts the applications by a list of existing parameters separated by commas. Can be 'application_name', 'application_type', 'creation_time', 'first_name', 'last_name', 'email', 'dedicated_workers'. Sorts in ascending order by default. If a parameter is preceded by '-', it is sorted in descending order.")] = None, **kwargs):  # noqa: E501
        """Retrieves applications (admin only) (paginated)  # noqa: E501

        Retrieves applications from the system. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_get_applications_with_http_info(token, application_id, email, application_name, first_name, last_name, application_type, created_after, created_before, dedicated_workers, offset, limit, sort, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: If specified, filters by application id
        :type application_id: str
        :param email: If specified, filters by application email
        :type email: str
        :param application_name: If specified, filters by application name
        :type application_name: str
        :param first_name: If specified, filters by application first_name
        :type first_name: str
        :param last_name: If specified, filters by application last_name
        :type last_name: str
        :param application_type: If specified, filters by application application_type
        :type application_type: ApplicationTypes
        :param created_after: If specified, keeps only applications created after given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_after: datetime
        :param created_before: If specified, keeps only applications created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_before: datetime
        :param dedicated_workers: If specified, filters by dedicated_workers value
        :type dedicated_workers: bool
        :param offset: Number of the first document to send (pagination)
        :type offset: int
        :param limit: Maximum number of documents to send (pagination)
        :type limit: int
        :param sort: If specified, sorts the applications by a list of existing parameters separated by commas. Can be 'application_name', 'application_type', 'creation_time', 'first_name', 'last_name', 'email', 'dedicated_workers'. Sorts in ascending order by default. If a parameter is preceded by '-', it is sorted in descending order.
        :type sort: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(List[Application], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'application_id',
            'email',
            'application_name',
            'first_name',
            'last_name',
            'application_type',
            'created_after',
            'created_before',
            'dedicated_workers',
            'offset',
            'limit',
            'sort'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method admin_get_applications" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('application_id') is not None:  # noqa: E501
            _query_params.append(('application_id', _params['application_id']))
        if _params.get('email') is not None:  # noqa: E501
            _query_params.append(('email', _params['email']))
        if _params.get('application_name') is not None:  # noqa: E501
            _query_params.append(('application_name', _params['application_name']))
        if _params.get('first_name') is not None:  # noqa: E501
            _query_params.append(('first_name', _params['first_name']))
        if _params.get('last_name') is not None:  # noqa: E501
            _query_params.append(('last_name', _params['last_name']))
        if _params.get('application_type') is not None:  # noqa: E501
            _query_params.append(('application_type', _params['application_type']))
        if _params.get('created_after') is not None:  # noqa: E501
            _query_params.append(('created_after', _params['created_after']))
        if _params.get('created_before') is not None:  # noqa: E501
            _query_params.append(('created_before', _params['created_before']))
        if _params.get('dedicated_workers') is not None:  # noqa: E501
            _query_params.append(('dedicated_workers', _params['dedicated_workers']))
        if _params.get('offset') is not None:  # noqa: E501
            _query_params.append(('offset', _params['offset']))
        if _params.get('limit') is not None:  # noqa: E501
            _query_params.append(('limit', _params['limit']))
        if _params.get('sort') is not None:  # noqa: E501
            _query_params.append(('sort', _params['sort']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        if _params['token']:
            _header_params['token'] = _params['token']

        # process the form parameters
        _form_params = []
        _files = {}

        # process the body parameter
        _body_params = None

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "List[Application]",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/admin/application', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def admin_reset_api_key(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application to reset")], **kwargs) -> Application:  # noqa: E501
        """Resets an API key (admin only)  # noqa: E501

        Resets the API key of the application corresponding to application_id, and returns a new one. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_reset_api_key(token, application_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application to reset (required)
        :type application_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: Application
        """
        kwargs['_return_http_data_only'] = True
        return self.admin_reset_api_key_with_http_info(token, application_id, **kwargs)  # noqa: E501

    @validate_arguments
    def admin_reset_api_key_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], application_id : Annotated[StrictStr, Field(..., description="The id of the application to reset")], **kwargs):  # noqa: E501
        """Resets an API key (admin only)  # noqa: E501

        Resets the API key of the application corresponding to application_id, and returns a new one. This method is only accessible to admins  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.admin_reset_api_key_with_http_info(token, application_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param application_id: The id of the application to reset (required)
        :type application_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(Application, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'application_id'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method admin_reset_api_key" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['application_id']:
            _path_params['application_id'] = _params['application_id']

        # process the query parameters
        _query_params = []

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        if _params['token']:
            _header_params['token'] = _params['token']

        # process the form parameters
        _form_params = []
        _files = {}

        # process the body parameter
        _body_params = None

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "Application",
            '400': None,
            '401': None,
            '403': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/admin/application/{application_id}/reset_api_key', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))
