# 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, StrictInt, StrictStr

from typing import Any, List, Optional

from leiaapi.generated.models.annotation import Annotation
from leiaapi.generated.models.annotation_types import AnnotationTypes

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


class AnnotationApi(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 create_annotation(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], document_id : Annotated[StrictStr, Field(..., description="The id of the document to annotate")], annotation_type : Annotated[AnnotationTypes, Field(..., description="The type of the annotation")], body : Annotated[Optional[Any], Field(..., description="The prediction that should be associated to document in this annotation, in free form json")], name : Annotated[Optional[StrictStr], Field(description="The name of the annotation (for information purposes only)")] = None, tags : Annotated[Optional[List[StrictStr]], Field(description="The tags of the annotation")] = None, **kwargs) -> Annotation:  # noqa: E501
        """Creates an annotation  # noqa: E501

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

        >>> thread = api.create_annotation(token, document_id, annotation_type, body, name, tags, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param document_id: The id of the document to annotate (required)
        :type document_id: str
        :param annotation_type: The type of the annotation (required)
        :type annotation_type: AnnotationTypes
        :param body: The prediction that should be associated to document in this annotation, in free form json (required)
        :type body: object
        :param name: The name of the annotation (for information purposes only)
        :type name: str
        :param tags: The tags of the annotation
        :type tags: 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: Annotation
        """
        kwargs['_return_http_data_only'] = True
        return self.create_annotation_with_http_info(token, document_id, annotation_type, body, name, tags, **kwargs)  # noqa: E501

    @validate_arguments
    def create_annotation_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], document_id : Annotated[StrictStr, Field(..., description="The id of the document to annotate")], annotation_type : Annotated[AnnotationTypes, Field(..., description="The type of the annotation")], body : Annotated[Optional[Any], Field(..., description="The prediction that should be associated to document in this annotation, in free form json")], name : Annotated[Optional[StrictStr], Field(description="The name of the annotation (for information purposes only)")] = None, tags : Annotated[Optional[List[StrictStr]], Field(description="The tags of the annotation")] = None, **kwargs):  # noqa: E501
        """Creates an annotation  # noqa: E501

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

        >>> thread = api.create_annotation_with_http_info(token, document_id, annotation_type, body, name, tags, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param document_id: The id of the document to annotate (required)
        :type document_id: str
        :param annotation_type: The type of the annotation (required)
        :type annotation_type: AnnotationTypes
        :param body: The prediction that should be associated to document in this annotation, in free form json (required)
        :type body: object
        :param name: The name of the annotation (for information purposes only)
        :type name: str
        :param tags: The tags of the annotation
        :type tags: 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(Annotation, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'document_id',
            'annotation_type',
            'body',
            'name',
            'tags'
        ]
        _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 create_annotation" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        # process the query parameters
        _query_params = []
        if _params.get('annotation_type') is not None:  # noqa: E501
            _query_params.append(('annotation_type', _params['annotation_type']))
        if _params.get('name') is not None:  # noqa: E501
            _query_params.append(('name', _params['name']))
        if _params.get('tags') is not None:  # noqa: E501
            _query_params.append(('tags', _params['tags']))
            _collection_formats['tags'] = '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
        if _params['body']:
            _body_params = _params['body']

        # 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': "Annotation",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/annotation/{document_id}', '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 delete_annotation(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation (for information purposes only)")], **kwargs) -> None:  # noqa: E501
        """Deletes an annotation  # noqa: E501

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

        >>> thread = api.delete_annotation(token, annotation_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (for information purposes only) (required)
        :type annotation_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.delete_annotation_with_http_info(token, annotation_id, **kwargs)  # noqa: E501

    @validate_arguments
    def delete_annotation_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation (for information purposes only)")], **kwargs):  # noqa: E501
        """Deletes an annotation  # noqa: E501

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

        >>> thread = api.delete_annotation_with_http_info(token, annotation_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (for information purposes only) (required)
        :type annotation_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',
            'annotation_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 delete_annotation" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['annotation_id']:
            _path_params['annotation_id'] = _params['annotation_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(
            '/annotation/{annotation_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 get_annotation(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation (for information purposes only)")], **kwargs) -> Annotation:  # noqa: E501
        """Retrieves an annotation  # noqa: E501

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

        >>> thread = api.get_annotation(token, annotation_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (for information purposes only) (required)
        :type annotation_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: Annotation
        """
        kwargs['_return_http_data_only'] = True
        return self.get_annotation_with_http_info(token, annotation_id, **kwargs)  # noqa: E501

    @validate_arguments
    def get_annotation_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation (for information purposes only)")], **kwargs):  # noqa: E501
        """Retrieves an annotation  # noqa: E501

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

        >>> thread = api.get_annotation_with_http_info(token, annotation_id, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (for information purposes only) (required)
        :type annotation_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(Annotation, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'annotation_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 get_annotation" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['annotation_id']:
            _path_params['annotation_id'] = _params['annotation_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': "Annotation",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/annotation/{annotation_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 get_annotations(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[Optional[StrictStr], Field(description="If specified, filters the annotations id")] = None, annotation_type : Annotated[Optional[AnnotationTypes], Field(description="If specified, filters the annotations by type")] = None, name : Annotated[Optional[StrictStr], Field(description="If specified, filters the annotations by name")] = None, tags : Annotated[Optional[List[StrictStr]], Field(description="If specified, filters the annotations by tag")] = None, document_id : Annotated[Optional[StrictStr], Field(description="If specified, filters the annotations attached to a given document")] = None, created_after : Annotated[Optional[datetime], Field(description="If specified, keeps only annotations 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 annotations created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)")] = None, offset : Annotated[Optional[StrictInt], Field(description="Number of the first annotation to send (pagination)")] = None, limit : Annotated[Optional[StrictInt], Field(description="Maximum number of annotation to send (pagination)")] = None, **kwargs) -> List[Annotation]:  # noqa: E501
        """Retrieves annotations (paginated)  # noqa: E501

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

        >>> thread = api.get_annotations(token, annotation_id, annotation_type, name, tags, document_id, created_after, created_before, offset, limit, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: If specified, filters the annotations id
        :type annotation_id: str
        :param annotation_type: If specified, filters the annotations by type
        :type annotation_type: AnnotationTypes
        :param name: If specified, filters the annotations by name
        :type name: str
        :param tags: If specified, filters the annotations by tag
        :type tags: List[str]
        :param document_id: If specified, filters the annotations attached to a given document
        :type document_id: str
        :param created_after: If specified, keeps only annotations created after given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_after: datetime
        :param created_before: If specified, keeps only annotations created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_before: datetime
        :param offset: Number of the first annotation to send (pagination)
        :type offset: int
        :param limit: Maximum number of annotation to send (pagination)
        :type limit: int
        :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[Annotation]
        """
        kwargs['_return_http_data_only'] = True
        return self.get_annotations_with_http_info(token, annotation_id, annotation_type, name, tags, document_id, created_after, created_before, offset, limit, **kwargs)  # noqa: E501

    @validate_arguments
    def get_annotations_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[Optional[StrictStr], Field(description="If specified, filters the annotations id")] = None, annotation_type : Annotated[Optional[AnnotationTypes], Field(description="If specified, filters the annotations by type")] = None, name : Annotated[Optional[StrictStr], Field(description="If specified, filters the annotations by name")] = None, tags : Annotated[Optional[List[StrictStr]], Field(description="If specified, filters the annotations by tag")] = None, document_id : Annotated[Optional[StrictStr], Field(description="If specified, filters the annotations attached to a given document")] = None, created_after : Annotated[Optional[datetime], Field(description="If specified, keeps only annotations 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 annotations created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)")] = None, offset : Annotated[Optional[StrictInt], Field(description="Number of the first annotation to send (pagination)")] = None, limit : Annotated[Optional[StrictInt], Field(description="Maximum number of annotation to send (pagination)")] = None, **kwargs):  # noqa: E501
        """Retrieves annotations (paginated)  # noqa: E501

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

        >>> thread = api.get_annotations_with_http_info(token, annotation_id, annotation_type, name, tags, document_id, created_after, created_before, offset, limit, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: If specified, filters the annotations id
        :type annotation_id: str
        :param annotation_type: If specified, filters the annotations by type
        :type annotation_type: AnnotationTypes
        :param name: If specified, filters the annotations by name
        :type name: str
        :param tags: If specified, filters the annotations by tag
        :type tags: List[str]
        :param document_id: If specified, filters the annotations attached to a given document
        :type document_id: str
        :param created_after: If specified, keeps only annotations created after given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_after: datetime
        :param created_before: If specified, keeps only annotations created before given UTC timestamp (ISO 8601 format : yyyy-MM-ddThh:mm:ss)
        :type created_before: datetime
        :param offset: Number of the first annotation to send (pagination)
        :type offset: int
        :param limit: Maximum number of annotation to send (pagination)
        :type limit: int
        :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[Annotation], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'annotation_id',
            'annotation_type',
            'name',
            'tags',
            'document_id',
            'created_after',
            'created_before',
            'offset',
            'limit'
        ]
        _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 get_annotations" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('annotation_id') is not None:  # noqa: E501
            _query_params.append(('annotation_id', _params['annotation_id']))
        if _params.get('annotation_type') is not None:  # noqa: E501
            _query_params.append(('annotation_type', _params['annotation_type']))
        if _params.get('name') is not None:  # noqa: E501
            _query_params.append(('name', _params['name']))
        if _params.get('tags') is not None:  # noqa: E501
            _query_params.append(('tags', _params['tags']))
            _collection_formats['tags'] = 'multi'
        if _params.get('document_id') is not None:  # noqa: E501
            _query_params.append(('document_id', _params['document_id']))
        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('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']))

        # 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[Annotation]",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/annotation', '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 tag_annotation(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation")], tag : Annotated[StrictStr, Field(..., description="The tag to add to the annotation")], **kwargs) -> Annotation:  # noqa: E501
        """Tags an annotation  # noqa: E501

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

        >>> thread = api.tag_annotation(token, annotation_id, tag, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (required)
        :type annotation_id: str
        :param tag: The tag to add to the annotation (required)
        :type tag: 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: Annotation
        """
        kwargs['_return_http_data_only'] = True
        return self.tag_annotation_with_http_info(token, annotation_id, tag, **kwargs)  # noqa: E501

    @validate_arguments
    def tag_annotation_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation")], tag : Annotated[StrictStr, Field(..., description="The tag to add to the annotation")], **kwargs):  # noqa: E501
        """Tags an annotation  # noqa: E501

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

        >>> thread = api.tag_annotation_with_http_info(token, annotation_id, tag, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (required)
        :type annotation_id: str
        :param tag: The tag to add to the annotation (required)
        :type tag: 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(Annotation, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'annotation_id',
            'tag'
        ]
        _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 tag_annotation" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        # 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': "Annotation",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/annotation/{annotation_id}/tag/{tag}', '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 untag_annotation(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation")], tag : Annotated[StrictStr, Field(..., description="The tag to delete from the annotation")], **kwargs) -> None:  # noqa: E501
        """Untags an annotation  # noqa: E501

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

        >>> thread = api.untag_annotation(token, annotation_id, tag, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (required)
        :type annotation_id: str
        :param tag: The tag to delete from the annotation (required)
        :type tag: 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.untag_annotation_with_http_info(token, annotation_id, tag, **kwargs)  # noqa: E501

    @validate_arguments
    def untag_annotation_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation")], tag : Annotated[StrictStr, Field(..., description="The tag to delete from the annotation")], **kwargs):  # noqa: E501
        """Untags an annotation  # noqa: E501

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

        >>> thread = api.untag_annotation_with_http_info(token, annotation_id, tag, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation (required)
        :type annotation_id: str
        :param tag: The tag to delete from the annotation (required)
        :type tag: 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',
            'annotation_id',
            'tag'
        ]
        _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 untag_annotation" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        # 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(
            '/annotation/{annotation_id}/tag/{tag}', '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 update_annotation(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation to modify")], body : Annotated[Optional[Any], Field(..., description="The new prediction that should be associated to document in this annotation, in free form json")], name : Annotated[Optional[StrictStr], Field(description="The new name of the annotation (won't change if not set)")] = None, **kwargs) -> Annotation:  # noqa: E501
        """Updates an annotation  # noqa: E501

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

        >>> thread = api.update_annotation(token, annotation_id, body, name, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation to modify (required)
        :type annotation_id: str
        :param body: The new prediction that should be associated to document in this annotation, in free form json (required)
        :type body: object
        :param name: The new name of the annotation (won't change if not set)
        :type name: 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: Annotation
        """
        kwargs['_return_http_data_only'] = True
        return self.update_annotation_with_http_info(token, annotation_id, body, name, **kwargs)  # noqa: E501

    @validate_arguments
    def update_annotation_with_http_info(self, token : Annotated[StrictStr, Field(..., description="The login token obtained via POST /login/")], annotation_id : Annotated[StrictStr, Field(..., description="The id of the annotation to modify")], body : Annotated[Optional[Any], Field(..., description="The new prediction that should be associated to document in this annotation, in free form json")], name : Annotated[Optional[StrictStr], Field(description="The new name of the annotation (won't change if not set)")] = None, **kwargs):  # noqa: E501
        """Updates an annotation  # noqa: E501

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

        >>> thread = api.update_annotation_with_http_info(token, annotation_id, body, name, async_req=True)
        >>> result = thread.get()

        :param token: The login token obtained via POST /login/ (required)
        :type token: str
        :param annotation_id: The id of the annotation to modify (required)
        :type annotation_id: str
        :param body: The new prediction that should be associated to document in this annotation, in free form json (required)
        :type body: object
        :param name: The new name of the annotation (won't change if not set)
        :type name: 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(Annotation, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'annotation_id',
            'body',
            'name'
        ]
        _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 update_annotation" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        # process the query parameters
        _query_params = []
        if _params.get('name') is not None:  # noqa: E501
            _query_params.append(('name', _params['name']))

        # 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['body']:
            _body_params = _params['body']

        # 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': "Annotation",
            '401': None,
            '404': None,
        }

        return self.api_client.call_api(
            '/annotation/{annotation_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'))
