# coding: utf-8

"""
    LUSID API

    FINBOURNE Technology  # noqa: E501

    Contact: info@finbourne.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


import re  # noqa: F401
import io
import warnings

from pydantic.v1 import validate_arguments, ValidationError
from typing import overload, Optional, Union, Awaitable

from typing_extensions import Annotated
from datetime import datetime

from pydantic.v1 import Field, StrictStr, conint, conlist, constr, validator

from typing import Dict, List, Optional

from lusid.models.access_metadata_operation import AccessMetadataOperation
from lusid.models.access_metadata_value import AccessMetadataValue
from lusid.models.deleted_entity_response import DeletedEntityResponse
from lusid.models.legal_entity import LegalEntity
from lusid.models.paged_resource_list_of_legal_entity import PagedResourceListOfLegalEntity
from lusid.models.resource_list_of_access_metadata_value_of import ResourceListOfAccessMetadataValueOf
from lusid.models.resource_list_of_legal_entity import ResourceListOfLegalEntity
from lusid.models.resource_list_of_property_interval import ResourceListOfPropertyInterval
from lusid.models.resource_list_of_relation import ResourceListOfRelation
from lusid.models.resource_list_of_relationship import ResourceListOfRelationship
from lusid.models.set_legal_entity_identifiers_request import SetLegalEntityIdentifiersRequest
from lusid.models.set_legal_entity_properties_request import SetLegalEntityPropertiesRequest
from lusid.models.upsert_legal_entities_response import UpsertLegalEntitiesResponse
from lusid.models.upsert_legal_entity_access_metadata_request import UpsertLegalEntityAccessMetadataRequest
from lusid.models.upsert_legal_entity_request import UpsertLegalEntityRequest

from lusid.api_client import ApiClient
from lusid.api_response import ApiResponse
from lusid.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


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

    Do not edit the class manually.
    """

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

    @overload
    async def delete_legal_entity(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with defined              identifier type uniquely identifies the legal entity to delete.")], **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @overload
    def delete_legal_entity(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with defined              identifier type uniquely identifies the legal entity to delete.")], async_req: Optional[bool]=True, **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @validate_arguments
    def delete_legal_entity(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with defined              identifier type uniquely identifies the legal entity to delete.")], async_req: Optional[bool]=None, **kwargs) -> Union[DeletedEntityResponse, Awaitable[DeletedEntityResponse]]:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntity: Delete Legal Entity  # noqa: E501

        Delete a legal entity. Deletion will be valid from the legal entity's creation datetime.  This means that the legal entity will no longer exist at any effective datetime from the asAt datetime of deletion.  # 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_legal_entity(id_type_scope, id_type_code, code, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: The scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: The code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with defined              identifier type uniquely identifies the legal entity to delete. (required)
        :type code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: DeletedEntityResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the delete_legal_entity_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.delete_legal_entity_with_http_info(id_type_scope, id_type_code, code, **kwargs)  # noqa: E501

    @validate_arguments
    def delete_legal_entity_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="The code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with defined              identifier type uniquely identifies the legal entity to delete.")], **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntity: Delete Legal Entity  # noqa: E501

        Delete a legal entity. Deletion will be valid from the legal entity's creation datetime.  This means that the legal entity will no longer exist at any effective datetime from the asAt datetime of deletion.  # 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_legal_entity_with_http_info(id_type_scope, id_type_code, code, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: The scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: The code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with defined              identifier type uniquely identifies the legal entity to delete. (required)
        :type code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code'
        ]
        _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_legal_entity" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "DeletedEntityResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}', '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'))

    @overload
    async def delete_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective date to delete at, if this is not supplied, it will delete all data found")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective date until which the delete is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' date of the Access Metadata")] = None, **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @overload
    def delete_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective date to delete at, if this is not supplied, it will delete all data found")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective date until which the delete is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' date of the Access Metadata")] = None, async_req: Optional[bool]=True, **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @validate_arguments
    def delete_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective date to delete at, if this is not supplied, it will delete all data found")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective date until which the delete is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' date of the Access Metadata")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[DeletedEntityResponse, Awaitable[DeletedEntityResponse]]:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntityAccessMetadata: Delete a Legal Entity Access Metadata entry  # noqa: E501

        Deletes the Legal Entity Access Metadata entry that exactly matches the provided identifier parts.    It is important to always check to verify success (or failure).  # 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_legal_entity_access_metadata(id_type_scope, id_type_code, code, metadata_key, effective_at, effective_until, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param metadata_key: Key of the metadata entry to retrieve (required)
        :type metadata_key: str
        :param effective_at: The effective date to delete at, if this is not supplied, it will delete all data found
        :type effective_at: str
        :param effective_until: The effective date until which the delete is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' date of the Access Metadata
        :type effective_until: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: DeletedEntityResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the delete_legal_entity_access_metadata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.delete_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, metadata_key, effective_at, effective_until, **kwargs)  # noqa: E501

    @validate_arguments
    def delete_legal_entity_access_metadata_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective date to delete at, if this is not supplied, it will delete all data found")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective date until which the delete is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' date of the Access Metadata")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntityAccessMetadata: Delete a Legal Entity Access Metadata entry  # noqa: E501

        Deletes the Legal Entity Access Metadata entry that exactly matches the provided identifier parts.    It is important to always check to verify success (or failure).  # 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_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, metadata_key, effective_at, effective_until, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param metadata_key: Key of the metadata entry to retrieve (required)
        :type metadata_key: str
        :param effective_at: The effective date to delete at, if this is not supplied, it will delete all data found
        :type effective_at: str
        :param effective_until: The effective date until which the delete is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' date of the Access Metadata
        :type effective_until: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'metadata_key',
            'effective_at',
            'effective_until'
        ]
        _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_legal_entity_access_metadata" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']

        if _params['metadata_key']:
            _path_params['metadataKey'] = _params['metadata_key']


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

        if _params.get('effective_until') is not None:  # noqa: E501
            if isinstance(_params['effective_until'], datetime):
                _query_params.append(('effectiveUntil', _params['effective_until'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('effectiveUntil', _params['effective_until']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "DeletedEntityResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/metadata/{metadataKey}', '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'))

    @overload
    async def delete_legal_entity_identifiers(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the identifiers to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CreditAgency/Identifier\". Each property must be from the \"LegalEntity\" domain. Identifiers or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete the identifiers. Defaults to the current LUSID system datetime if not specified.              Must not include an effective datetime if identifiers are perpetual.")] = None, **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @overload
    def delete_legal_entity_identifiers(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the identifiers to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CreditAgency/Identifier\". Each property must be from the \"LegalEntity\" domain. Identifiers or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete the identifiers. Defaults to the current LUSID system datetime if not specified.              Must not include an effective datetime if identifiers are perpetual.")] = None, async_req: Optional[bool]=True, **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @validate_arguments
    def delete_legal_entity_identifiers(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the identifiers to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CreditAgency/Identifier\". Each property must be from the \"LegalEntity\" domain. Identifiers or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete the identifiers. Defaults to the current LUSID system datetime if not specified.              Must not include an effective datetime if identifiers are perpetual.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[DeletedEntityResponse, Awaitable[DeletedEntityResponse]]:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntityIdentifiers: Delete Legal Entity Identifiers  # noqa: E501

        Delete identifiers that belong to the given property keys of the legal entity.  # 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_legal_entity_identifiers(id_type_scope, id_type_code, code, property_keys, effective_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param property_keys: The property keys of the identifiers to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CreditAgency/Identifier\". Each property must be from the \"LegalEntity\" domain. Identifiers or identifiers not specified in request will not be changed. (required)
        :type property_keys: List[str]
        :param effective_at: The effective datetime or cut label at which to delete the identifiers. Defaults to the current LUSID system datetime if not specified.              Must not include an effective datetime if identifiers are perpetual.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: DeletedEntityResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the delete_legal_entity_identifiers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.delete_legal_entity_identifiers_with_http_info(id_type_scope, id_type_code, code, property_keys, effective_at, **kwargs)  # noqa: E501

    @validate_arguments
    def delete_legal_entity_identifiers_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the identifiers to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CreditAgency/Identifier\". Each property must be from the \"LegalEntity\" domain. Identifiers or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete the identifiers. Defaults to the current LUSID system datetime if not specified.              Must not include an effective datetime if identifiers are perpetual.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntityIdentifiers: Delete Legal Entity Identifiers  # noqa: E501

        Delete identifiers that belong to the given property keys of the legal entity.  # 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_legal_entity_identifiers_with_http_info(id_type_scope, id_type_code, code, property_keys, effective_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param property_keys: The property keys of the identifiers to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CreditAgency/Identifier\". Each property must be from the \"LegalEntity\" domain. Identifiers or identifiers not specified in request will not be changed. (required)
        :type property_keys: List[str]
        :param effective_at: The effective datetime or cut label at which to delete the identifiers. Defaults to the current LUSID system datetime if not specified.              Must not include an effective datetime if identifiers are perpetual.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'property_keys',
            'effective_at'
        ]
        _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_legal_entity_identifiers" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('effective_at') is not None:  # noqa: E501
            _query_params.append(('effectiveAt', _params['effective_at']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "DeletedEntityResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/identifiers', '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'))

    @overload
    async def delete_legal_entity_properties(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the legal entities properties to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CompanyDetails/Role\". Each property must be from the \"LegalEntity\" domain. Properties or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete time-variant properties from.              The property must exist at the specified 'effectiveAt' datetime. If the 'effectiveAt' is not provided or is              before the time-variant property exists then a failure is returned. Do not specify this parameter if any of              the properties to delete are perpetual.")] = None, **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @overload
    def delete_legal_entity_properties(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the legal entities properties to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CompanyDetails/Role\". Each property must be from the \"LegalEntity\" domain. Properties or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete time-variant properties from.              The property must exist at the specified 'effectiveAt' datetime. If the 'effectiveAt' is not provided or is              before the time-variant property exists then a failure is returned. Do not specify this parameter if any of              the properties to delete are perpetual.")] = None, async_req: Optional[bool]=True, **kwargs) -> DeletedEntityResponse:  # noqa: E501
        ...

    @validate_arguments
    def delete_legal_entity_properties(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the legal entities properties to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CompanyDetails/Role\". Each property must be from the \"LegalEntity\" domain. Properties or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete time-variant properties from.              The property must exist at the specified 'effectiveAt' datetime. If the 'effectiveAt' is not provided or is              before the time-variant property exists then a failure is returned. Do not specify this parameter if any of              the properties to delete are perpetual.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[DeletedEntityResponse, Awaitable[DeletedEntityResponse]]:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntityProperties: Delete Legal Entity Properties  # noqa: E501

        Delete all properties that belong to the given property keys of the legal entity.  # 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_legal_entity_properties(id_type_scope, id_type_code, code, property_keys, effective_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param property_keys: The property keys of the legal entities properties to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CompanyDetails/Role\". Each property must be from the \"LegalEntity\" domain. Properties or identifiers not specified in request will not be changed. (required)
        :type property_keys: List[str]
        :param effective_at: The effective datetime or cut label at which to delete time-variant properties from.              The property must exist at the specified 'effectiveAt' datetime. If the 'effectiveAt' is not provided or is              before the time-variant property exists then a failure is returned. Do not specify this parameter if any of              the properties to delete are perpetual.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: DeletedEntityResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the delete_legal_entity_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.delete_legal_entity_properties_with_http_info(id_type_scope, id_type_code, code, property_keys, effective_at, **kwargs)  # noqa: E501

    @validate_arguments
    def delete_legal_entity_properties_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[conlist(StrictStr), Field(..., description="The property keys of the legal entities properties to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CompanyDetails/Role\". Each property must be from the \"LegalEntity\" domain. Properties or identifiers not specified in request will not be changed.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to delete time-variant properties from.              The property must exist at the specified 'effectiveAt' datetime. If the 'effectiveAt' is not provided or is              before the time-variant property exists then a failure is returned. Do not specify this parameter if any of              the properties to delete are perpetual.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] DeleteLegalEntityProperties: Delete Legal Entity Properties  # noqa: E501

        Delete all properties that belong to the given property keys of the legal entity.  # 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_legal_entity_properties_with_http_info(id_type_scope, id_type_code, code, property_keys, effective_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param property_keys: The property keys of the legal entities properties to delete. These take the format              {domain}/{scope}/{code} e.g. \"LegalEntity/CompanyDetails/Role\". Each property must be from the \"LegalEntity\" domain. Properties or identifiers not specified in request will not be changed. (required)
        :type property_keys: List[str]
        :param effective_at: The effective datetime or cut label at which to delete time-variant properties from.              The property must exist at the specified 'effectiveAt' datetime. If the 'effectiveAt' is not provided or is              before the time-variant property exists then a failure is returned. Do not specify this parameter if any of              the properties to delete are perpetual.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'property_keys',
            'effective_at'
        ]
        _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_legal_entity_properties" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('effective_at') is not None:  # noqa: E501
            _query_params.append(('effectiveAt', _params['effective_at']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "DeletedEntityResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/properties', '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'))

    @overload
    async def get_all_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, **kwargs) -> Dict[str, List[AccessMetadataValue]]:  # noqa: E501
        ...

    @overload
    def get_all_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, async_req: Optional[bool]=True, **kwargs) -> Dict[str, List[AccessMetadataValue]]:  # noqa: E501
        ...

    @validate_arguments
    def get_all_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[Dict[str, List[AccessMetadataValue]], Awaitable[Dict[str, List[AccessMetadataValue]]]]:  # noqa: E501
        """[EARLY ACCESS] GetAllLegalEntityAccessMetadata: Get Access Metadata rules for a Legal Entity  # noqa: E501

        Pass the Scope and Code of the Legal Entity identifier along with the Legal Entity code parameter to retrieve the associated Access Metadata  # 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_all_legal_entity_access_metadata(id_type_scope, id_type_code, code, effective_at, as_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param effective_at: The effectiveAt datetime at which to retrieve the Access Metadata
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the Access Metadata
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: Dict[str, List[AccessMetadataValue]]
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_all_legal_entity_access_metadata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.get_all_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, effective_at, as_at, **kwargs)  # noqa: E501

    @validate_arguments
    def get_all_legal_entity_access_metadata_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] GetAllLegalEntityAccessMetadata: Get Access Metadata rules for a Legal Entity  # noqa: E501

        Pass the Scope and Code of the Legal Entity identifier along with the Legal Entity code parameter to retrieve the associated Access Metadata  # 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_all_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, effective_at, as_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param effective_at: The effectiveAt datetime at which to retrieve the Access Metadata
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the Access Metadata
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(Dict[str, List[AccessMetadataValue]], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'effective_at',
            'as_at'
        ]
        _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_all_legal_entity_access_metadata" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "Dict[str, List[AccessMetadataValue]]",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/metadata', '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'))

    @overload
    async def get_legal_entity(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for found legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to retrieve the legal entity. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity. Defaults to return the latest version of the legal entity if not specified.")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto the legal entity in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @overload
    def get_legal_entity(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for found legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to retrieve the legal entity. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity. Defaults to return the latest version of the legal entity if not specified.")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto the legal entity in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, async_req: Optional[bool]=True, **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @validate_arguments
    def get_legal_entity(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for found legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to retrieve the legal entity. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity. Defaults to return the latest version of the legal entity if not specified.")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto the legal entity in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[LegalEntity, Awaitable[LegalEntity]]:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntity: Get Legal Entity  # noqa: E501

        Retrieve the definition of a legal entity.  # 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_legal_entity(id_type_scope, id_type_code, code, property_keys, effective_at, as_at, relationship_definition_ids, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param property_keys: A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for found legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".
        :type property_keys: List[str]
        :param effective_at: The effective datetime or cut label at which to retrieve the legal entity. Defaults to the current LUSID system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the legal entity. Defaults to return the latest version of the legal entity if not specified.
        :type as_at: datetime
        :param relationship_definition_ids: A list of relationship definitions that are used to decorate related entities              onto the legal entity in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.
        :type relationship_definition_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: LegalEntity
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_legal_entity_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.get_legal_entity_with_http_info(id_type_scope, id_type_code, code, property_keys, effective_at, as_at, relationship_definition_ids, **kwargs)  # noqa: E501

    @validate_arguments
    def get_legal_entity_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for found legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to retrieve the legal entity. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity. Defaults to return the latest version of the legal entity if not specified.")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto the legal entity in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntity: Get Legal Entity  # noqa: E501

        Retrieve the definition of a legal entity.  # 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_legal_entity_with_http_info(id_type_scope, id_type_code, code, property_keys, effective_at, as_at, relationship_definition_ids, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param property_keys: A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for found legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".
        :type property_keys: List[str]
        :param effective_at: The effective datetime or cut label at which to retrieve the legal entity. Defaults to the current LUSID system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the legal entity. Defaults to return the latest version of the legal entity if not specified.
        :type as_at: datetime
        :param relationship_definition_ids: A list of relationship definitions that are used to decorate related entities              onto the legal entity in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.
        :type relationship_definition_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(LegalEntity, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'property_keys',
            'effective_at',
            'as_at',
            'relationship_definition_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 get_legal_entity" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('effective_at') is not None:  # noqa: E501
            _query_params.append(('effectiveAt', _params['effective_at']))

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        if _params.get('relationship_definition_ids') is not None:  # noqa: E501
            _query_params.append(('relationshipDefinitionIds', _params['relationship_definition_ids']))
            _collection_formats['relationshipDefinitionIds'] = 'multi'

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "LegalEntity",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}', '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'))

    @overload
    async def get_legal_entity_access_metadata_by_key(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, **kwargs) -> List[AccessMetadataValue]:  # noqa: E501
        ...

    @overload
    def get_legal_entity_access_metadata_by_key(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, async_req: Optional[bool]=True, **kwargs) -> List[AccessMetadataValue]:  # noqa: E501
        ...

    @validate_arguments
    def get_legal_entity_access_metadata_by_key(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[List[AccessMetadataValue], Awaitable[List[AccessMetadataValue]]]:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntityAccessMetadataByKey: Get an entry identified by a metadataKey in the Access Metadata of a Legal Entity  # noqa: E501

        Get a specific Legal Entity Access Metadata by specifying the corresponding identifier parts and Legal Entity code                No matching will be performed through this endpoint. To retrieve an entry, it is necessary to specify, exactly, the identifier of the entry  # 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_legal_entity_access_metadata_by_key(id_type_scope, id_type_code, code, metadata_key, effective_at, as_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param metadata_key: Key of the metadata entry to retrieve (required)
        :type metadata_key: str
        :param effective_at: The effectiveAt datetime at which to retrieve the Access Metadata
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the Access Metadata
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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[AccessMetadataValue]
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_legal_entity_access_metadata_by_key_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.get_legal_entity_access_metadata_by_key_with_http_info(id_type_scope, id_type_code, code, metadata_key, effective_at, as_at, **kwargs)  # noqa: E501

    @validate_arguments
    def get_legal_entity_access_metadata_by_key_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to retrieve the Access Metadata")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the Access Metadata")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntityAccessMetadataByKey: Get an entry identified by a metadataKey in the Access Metadata of a Legal Entity  # noqa: E501

        Get a specific Legal Entity Access Metadata by specifying the corresponding identifier parts and Legal Entity code                No matching will be performed through this endpoint. To retrieve an entry, it is necessary to specify, exactly, the identifier of the entry  # 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_legal_entity_access_metadata_by_key_with_http_info(id_type_scope, id_type_code, code, metadata_key, effective_at, as_at, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param metadata_key: Key of the metadata entry to retrieve (required)
        :type metadata_key: str
        :param effective_at: The effectiveAt datetime at which to retrieve the Access Metadata
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the Access Metadata
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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[AccessMetadataValue], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'metadata_key',
            'effective_at',
            'as_at'
        ]
        _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_legal_entity_access_metadata_by_key" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']

        if _params['metadata_key']:
            _path_params['metadataKey'] = _params['metadata_key']


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

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "List[AccessMetadataValue]",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/metadata/{metadataKey}', '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'))

    @overload
    async def get_legal_entity_property_time_series(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely identifies the legal entity.")], property_key : Annotated[StrictStr, Field(..., description="The property key of the property that will have its history shown. These must be in the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".              Each property must be from the \"LegalEntity\" domain.")], as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the person's property history. Defaults to return the current datetime if not supplied.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set. Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing properties from a previous call to get property time series.              This value is returned from the previous call. If a pagination token is provided the filter and asAt fields              must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many.")] = None, **kwargs) -> ResourceListOfPropertyInterval:  # noqa: E501
        ...

    @overload
    def get_legal_entity_property_time_series(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely identifies the legal entity.")], property_key : Annotated[StrictStr, Field(..., description="The property key of the property that will have its history shown. These must be in the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".              Each property must be from the \"LegalEntity\" domain.")], as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the person's property history. Defaults to return the current datetime if not supplied.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set. Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing properties from a previous call to get property time series.              This value is returned from the previous call. If a pagination token is provided the filter and asAt fields              must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many.")] = None, async_req: Optional[bool]=True, **kwargs) -> ResourceListOfPropertyInterval:  # noqa: E501
        ...

    @validate_arguments
    def get_legal_entity_property_time_series(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely identifies the legal entity.")], property_key : Annotated[StrictStr, Field(..., description="The property key of the property that will have its history shown. These must be in the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".              Each property must be from the \"LegalEntity\" domain.")], as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the person's property history. Defaults to return the current datetime if not supplied.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set. Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing properties from a previous call to get property time series.              This value is returned from the previous call. If a pagination token is provided the filter and asAt fields              must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ResourceListOfPropertyInterval, Awaitable[ResourceListOfPropertyInterval]]:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntityPropertyTimeSeries: Get Legal Entity Property Time Series  # noqa: E501

        List the complete time series of a legal entity property.  # 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_legal_entity_property_time_series(id_type_scope, id_type_code, code, property_key, as_at, filter, page, limit, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely identifies the legal entity. (required)
        :type code: str
        :param property_key: The property key of the property that will have its history shown. These must be in the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".              Each property must be from the \"LegalEntity\" domain. (required)
        :type property_key: str
        :param as_at: The asAt datetime at which to list the person's property history. Defaults to return the current datetime if not supplied.
        :type as_at: datetime
        :param filter: Expression to filter the result set. Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param page: The pagination token to use to continue listing properties from a previous call to get property time series.              This value is returned from the previous call. If a pagination token is provided the filter and asAt fields              must not have changed since the original request.
        :type page: str
        :param limit: When paginating, limit the number of returned results to this many.
        :type limit: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: ResourceListOfPropertyInterval
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_legal_entity_property_time_series_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.get_legal_entity_property_time_series_with_http_info(id_type_scope, id_type_code, code, property_key, as_at, filter, page, limit, **kwargs)  # noqa: E501

    @validate_arguments
    def get_legal_entity_property_time_series_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely identifies the legal entity.")], property_key : Annotated[StrictStr, Field(..., description="The property key of the property that will have its history shown. These must be in the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".              Each property must be from the \"LegalEntity\" domain.")], as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the person's property history. Defaults to return the current datetime if not supplied.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set. Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing properties from a previous call to get property time series.              This value is returned from the previous call. If a pagination token is provided the filter and asAt fields              must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntityPropertyTimeSeries: Get Legal Entity Property Time Series  # noqa: E501

        List the complete time series of a legal entity property.  # 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_legal_entity_property_time_series_with_http_info(id_type_scope, id_type_code, code, property_key, as_at, filter, page, limit, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely identifies the legal entity. (required)
        :type code: str
        :param property_key: The property key of the property that will have its history shown. These must be in the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".              Each property must be from the \"LegalEntity\" domain. (required)
        :type property_key: str
        :param as_at: The asAt datetime at which to list the person's property history. Defaults to return the current datetime if not supplied.
        :type as_at: datetime
        :param filter: Expression to filter the result set. Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param page: The pagination token to use to continue listing properties from a previous call to get property time series.              This value is returned from the previous call. If a pagination token is provided the filter and asAt fields              must not have changed since the original request.
        :type page: str
        :param limit: When paginating, limit the number of returned results to this many.
        :type limit: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(ResourceListOfPropertyInterval, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'property_key',
            'as_at',
            'filter',
            'page',
            '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_legal_entity_property_time_series" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        if _params.get('filter') is not None:  # noqa: E501
            _query_params.append(('filter', _params['filter']))

        if _params.get('page') is not None:  # noqa: E501
            _query_params.append(('page', _params['page']))

        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', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "ResourceListOfPropertyInterval",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/properties/time-series', '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'))

    @overload
    async def get_legal_entity_relations(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relations. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity's relations. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the relations. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifiers types (as property keys) used for referencing Persons or Legal Entities. These take the format              {domain}/{scope}/{code} e.g. \"Person/CompanyDetails/Role\". They must be from the \"Person\" or \"LegalEntity\" domain.              Only identifier types stated will be used to look up relevant entities in relations. If not applicable, provide an empty array.")] = None, **kwargs) -> ResourceListOfRelation:  # noqa: E501
        ...

    @overload
    def get_legal_entity_relations(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relations. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity's relations. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the relations. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifiers types (as property keys) used for referencing Persons or Legal Entities. These take the format              {domain}/{scope}/{code} e.g. \"Person/CompanyDetails/Role\". They must be from the \"Person\" or \"LegalEntity\" domain.              Only identifier types stated will be used to look up relevant entities in relations. If not applicable, provide an empty array.")] = None, async_req: Optional[bool]=True, **kwargs) -> ResourceListOfRelation:  # noqa: E501
        ...

    @validate_arguments
    def get_legal_entity_relations(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relations. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity's relations. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the relations. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifiers types (as property keys) used for referencing Persons or Legal Entities. These take the format              {domain}/{scope}/{code} e.g. \"Person/CompanyDetails/Role\". They must be from the \"Person\" or \"LegalEntity\" domain.              Only identifier types stated will be used to look up relevant entities in relations. If not applicable, provide an empty array.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ResourceListOfRelation, Awaitable[ResourceListOfRelation]]:  # noqa: E501
        """[EXPERIMENTAL] GetLegalEntityRelations: Get Relations for Legal Entity  # noqa: E501

        Get relations for the specified Legal Entity  # 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_legal_entity_relations(id_type_scope, id_type_code, code, effective_at, as_at, filter, identifier_types, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to get relations. Defaults to the current LUSID system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the legal entity's relations. Defaults to return the latest LUSID AsAt time if not specified.
        :type as_at: datetime
        :param filter: Expression to filter the relations. Users should provide null or empty string for this field until further notice.
        :type filter: str
        :param identifier_types: Identifiers types (as property keys) used for referencing Persons or Legal Entities. These take the format              {domain}/{scope}/{code} e.g. \"Person/CompanyDetails/Role\". They must be from the \"Person\" or \"LegalEntity\" domain.              Only identifier types stated will be used to look up relevant entities in relations. If not applicable, provide an empty array.
        :type identifier_types: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: ResourceListOfRelation
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_legal_entity_relations_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.get_legal_entity_relations_with_http_info(id_type_scope, id_type_code, code, effective_at, as_at, filter, identifier_types, **kwargs)  # noqa: E501

    @validate_arguments
    def get_legal_entity_relations_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relations. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve the legal entity's relations. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the relations. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifiers types (as property keys) used for referencing Persons or Legal Entities. These take the format              {domain}/{scope}/{code} e.g. \"Person/CompanyDetails/Role\". They must be from the \"Person\" or \"LegalEntity\" domain.              Only identifier types stated will be used to look up relevant entities in relations. If not applicable, provide an empty array.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EXPERIMENTAL] GetLegalEntityRelations: Get Relations for Legal Entity  # noqa: E501

        Get relations for the specified Legal Entity  # 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_legal_entity_relations_with_http_info(id_type_scope, id_type_code, code, effective_at, as_at, filter, identifier_types, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to get relations. Defaults to the current LUSID system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the legal entity's relations. Defaults to return the latest LUSID AsAt time if not specified.
        :type as_at: datetime
        :param filter: Expression to filter the relations. Users should provide null or empty string for this field until further notice.
        :type filter: str
        :param identifier_types: Identifiers types (as property keys) used for referencing Persons or Legal Entities. These take the format              {domain}/{scope}/{code} e.g. \"Person/CompanyDetails/Role\". They must be from the \"Person\" or \"LegalEntity\" domain.              Only identifier types stated will be used to look up relevant entities in relations. If not applicable, provide an empty array.
        :type identifier_types: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(ResourceListOfRelation, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'effective_at',
            'as_at',
            'filter',
            'identifier_types'
        ]
        _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_legal_entity_relations" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        if _params.get('filter') is not None:  # noqa: E501
            _query_params.append(('filter', _params['filter']))

        if _params.get('identifier_types') is not None:  # noqa: E501
            _query_params.append(('identifierTypes', _params['identifier_types']))
            _collection_formats['identifierTypes'] = 'multi'

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "ResourceListOfRelation",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/relations', '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'))

    @overload
    async def get_legal_entity_relationships(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity's identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity's identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relationships. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve relationships. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter relationships. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifier types (as property keys) used for referencing Persons or Legal Entities.              These can be specified from the 'Person' or 'LegalEntity' domains and have the format {domain}/{scope}/{code}, for example              'Person/CompanyDetails/Role'. An Empty array may be used to return all related Entities.")] = None, **kwargs) -> ResourceListOfRelationship:  # noqa: E501
        ...

    @overload
    def get_legal_entity_relationships(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity's identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity's identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relationships. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve relationships. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter relationships. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifier types (as property keys) used for referencing Persons or Legal Entities.              These can be specified from the 'Person' or 'LegalEntity' domains and have the format {domain}/{scope}/{code}, for example              'Person/CompanyDetails/Role'. An Empty array may be used to return all related Entities.")] = None, async_req: Optional[bool]=True, **kwargs) -> ResourceListOfRelationship:  # noqa: E501
        ...

    @validate_arguments
    def get_legal_entity_relationships(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity's identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity's identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relationships. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve relationships. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter relationships. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifier types (as property keys) used for referencing Persons or Legal Entities.              These can be specified from the 'Person' or 'LegalEntity' domains and have the format {domain}/{scope}/{code}, for example              'Person/CompanyDetails/Role'. An Empty array may be used to return all related Entities.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ResourceListOfRelationship, Awaitable[ResourceListOfRelationship]]:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntityRelationships: Get Relationships for Legal Entity  # noqa: E501

        Get Relationships for the specified Legal Entity  # 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_legal_entity_relationships(id_type_scope, id_type_code, code, effective_at, as_at, filter, identifier_types, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity's identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity's identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to get relationships. Defaults to the current LUSID system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve relationships. Defaults to return the latest LUSID AsAt time if not specified.
        :type as_at: datetime
        :param filter: Expression to filter relationships. Users should provide null or empty string for this field until further notice.
        :type filter: str
        :param identifier_types: Identifier types (as property keys) used for referencing Persons or Legal Entities.              These can be specified from the 'Person' or 'LegalEntity' domains and have the format {domain}/{scope}/{code}, for example              'Person/CompanyDetails/Role'. An Empty array may be used to return all related Entities.
        :type identifier_types: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: ResourceListOfRelationship
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_legal_entity_relationships_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.get_legal_entity_relationships_with_http_info(id_type_scope, id_type_code, code, effective_at, as_at, filter, identifier_types, **kwargs)  # noqa: E501

    @validate_arguments
    def get_legal_entity_relationships_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity's identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity's identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to get relationships. Defaults to the current LUSID system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to retrieve relationships. Defaults to return the latest LUSID AsAt time if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter relationships. Users should provide null or empty string for this field until further notice.")] = None, identifier_types : Annotated[Optional[conlist(StrictStr)], Field(description="Identifier types (as property keys) used for referencing Persons or Legal Entities.              These can be specified from the 'Person' or 'LegalEntity' domains and have the format {domain}/{scope}/{code}, for example              'Person/CompanyDetails/Role'. An Empty array may be used to return all related Entities.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] GetLegalEntityRelationships: Get Relationships for Legal Entity  # noqa: E501

        Get Relationships for the specified Legal Entity  # 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_legal_entity_relationships_with_http_info(id_type_scope, id_type_code, code, effective_at, as_at, filter, identifier_types, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity's identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity's identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to get relationships. Defaults to the current LUSID system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve relationships. Defaults to return the latest LUSID AsAt time if not specified.
        :type as_at: datetime
        :param filter: Expression to filter relationships. Users should provide null or empty string for this field until further notice.
        :type filter: str
        :param identifier_types: Identifier types (as property keys) used for referencing Persons or Legal Entities.              These can be specified from the 'Person' or 'LegalEntity' domains and have the format {domain}/{scope}/{code}, for example              'Person/CompanyDetails/Role'. An Empty array may be used to return all related Entities.
        :type identifier_types: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(ResourceListOfRelationship, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'effective_at',
            'as_at',
            'filter',
            'identifier_types'
        ]
        _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_legal_entity_relationships" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        if _params.get('filter') is not None:  # noqa: E501
            _query_params.append(('filter', _params['filter']))

        if _params.get('identifier_types') is not None:  # noqa: E501
            _query_params.append(('identifierTypes', _params['identifier_types']))
            _collection_formats['identifierTypes'] = 'multi'

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "ResourceListOfRelationship",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/relationships', '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'))

    @overload
    async def list_all_legal_entities(self, effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to list the legal entities. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the legal entities. Defaults to return the latest version              of each legal entities if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 5000 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, **kwargs) -> ResourceListOfLegalEntity:  # noqa: E501
        ...

    @overload
    def list_all_legal_entities(self, effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to list the legal entities. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the legal entities. Defaults to return the latest version              of each legal entities if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 5000 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, async_req: Optional[bool]=True, **kwargs) -> ResourceListOfLegalEntity:  # noqa: E501
        ...

    @validate_arguments
    def list_all_legal_entities(self, effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to list the legal entities. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the legal entities. Defaults to return the latest version              of each legal entities if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 5000 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ResourceListOfLegalEntity, Awaitable[ResourceListOfLegalEntity]]:  # noqa: E501
        """[EARLY ACCESS] ListAllLegalEntities: List Legal Entities  # noqa: E501

        List all legal entities which the user is entitled to see.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_all_legal_entities(effective_at, as_at, page, limit, filter, sort_by, property_keys, relationship_definition_ids, async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to list the legal entities. Defaults to the current LUSID              system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to list the legal entities. Defaults to return the latest version              of each legal entities if not specified.
        :type as_at: datetime
        :param page: The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.
        :type page: str
        :param limit: When paginating, limit the number of returned results to this many. Defaults to 5000 if not specified.
        :type limit: int
        :param filter: Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param sort_by: A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".
        :type sort_by: List[str]
        :param property_keys: A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".
        :type property_keys: List[str]
        :param relationship_definition_ids: A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.
        :type relationship_definition_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: ResourceListOfLegalEntity
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the list_all_legal_entities_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.list_all_legal_entities_with_http_info(effective_at, as_at, page, limit, filter, sort_by, property_keys, relationship_definition_ids, **kwargs)  # noqa: E501

    @validate_arguments
    def list_all_legal_entities_with_http_info(self, effective_at : Annotated[Optional[StrictStr], Field(description="The effective datetime or cut label at which to list the legal entities. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the legal entities. Defaults to return the latest version              of each legal entities if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 5000 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] ListAllLegalEntities: List Legal Entities  # noqa: E501

        List all legal entities which the user is entitled to see.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_all_legal_entities_with_http_info(effective_at, as_at, page, limit, filter, sort_by, property_keys, relationship_definition_ids, async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to list the legal entities. Defaults to the current LUSID              system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to list the legal entities. Defaults to return the latest version              of each legal entities if not specified.
        :type as_at: datetime
        :param page: The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.
        :type page: str
        :param limit: When paginating, limit the number of returned results to this many. Defaults to 5000 if not specified.
        :type limit: int
        :param filter: Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param sort_by: A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".
        :type sort_by: List[str]
        :param property_keys: A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".
        :type property_keys: List[str]
        :param relationship_definition_ids: A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.
        :type relationship_definition_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(ResourceListOfLegalEntity, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'effective_at',
            'as_at',
            'page',
            'limit',
            'filter',
            'sort_by',
            'property_keys',
            'relationship_definition_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 list_all_legal_entities" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

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

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        if _params.get('page') is not None:  # noqa: E501
            _query_params.append(('page', _params['page']))

        if _params.get('limit') is not None:  # noqa: E501
            _query_params.append(('limit', _params['limit']))

        if _params.get('filter') is not None:  # noqa: E501
            _query_params.append(('filter', _params['filter']))

        if _params.get('sort_by') is not None:  # noqa: E501
            _query_params.append(('sortBy', _params['sort_by']))
            _collection_formats['sortBy'] = 'multi'

        if _params.get('property_keys') is not None:  # noqa: E501
            _query_params.append(('propertyKeys', _params['property_keys']))
            _collection_formats['propertyKeys'] = 'multi'

        if _params.get('relationship_definition_ids') is not None:  # noqa: E501
            _query_params.append(('relationshipDefinitionIds', _params['relationship_definition_ids']))
            _collection_formats['relationshipDefinitionIds'] = 'multi'

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "ResourceListOfLegalEntity",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities', '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'))

    @overload
    async def list_legal_entities(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to list the people. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the people. Defaults to return the latest version              of each people if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 100 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, **kwargs) -> PagedResourceListOfLegalEntity:  # noqa: E501
        ...

    @overload
    def list_legal_entities(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to list the people. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the people. Defaults to return the latest version              of each people if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 100 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, async_req: Optional[bool]=True, **kwargs) -> PagedResourceListOfLegalEntity:  # noqa: E501
        ...

    @validate_arguments
    def list_legal_entities(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to list the people. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the people. Defaults to return the latest version              of each people if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 100 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[PagedResourceListOfLegalEntity, Awaitable[PagedResourceListOfLegalEntity]]:  # noqa: E501
        """[EARLY ACCESS] ListLegalEntities: List Legal Entities  # noqa: E501

        List legal entities which has identifier of specific identifier type's scope and code, and satisfies filter criteria.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_legal_entities(id_type_scope, id_type_code, effective_at, as_at, page, limit, filter, sort_by, property_keys, relationship_definition_ids, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param effective_at: The effective datetime or cut label at which to list the people. Defaults to the current LUSID              system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to list the people. Defaults to return the latest version              of each people if not specified.
        :type as_at: datetime
        :param page: The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.
        :type page: str
        :param limit: When paginating, limit the number of returned results to this many. Defaults to 100 if not specified.
        :type limit: int
        :param filter: Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param sort_by: A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".
        :type sort_by: List[str]
        :param property_keys: A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".
        :type property_keys: List[str]
        :param relationship_definition_ids: A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.
        :type relationship_definition_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: PagedResourceListOfLegalEntity
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the list_legal_entities_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.list_legal_entities_with_http_info(id_type_scope, id_type_code, effective_at, as_at, page, limit, filter, sort_by, property_keys, relationship_definition_ids, **kwargs)  # noqa: E501

    @validate_arguments
    def list_legal_entities_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], effective_at : Annotated[Optional[constr(strict=True, max_length=256, min_length=0)], Field(description="The effective datetime or cut label at which to list the people. Defaults to the current LUSID              system datetime if not specified.")] = None, as_at : Annotated[Optional[datetime], Field(description="The asAt datetime at which to list the people. Defaults to return the latest version              of each people if not specified.")] = None, page : Annotated[Optional[constr(strict=True, max_length=500, min_length=1)], Field(description="The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.")] = None, limit : Annotated[Optional[conint(strict=True, le=5000, ge=1)], Field(description="When paginating, limit the number of returned results to this many. Defaults to 100 if not specified.")] = None, filter : Annotated[Optional[constr(strict=True, max_length=16384, min_length=0)], Field(description="Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.")] = None, sort_by : Annotated[Optional[conlist(StrictStr)], Field(description="A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".")] = None, property_keys : Annotated[Optional[conlist(StrictStr)], Field(description="A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".")] = None, relationship_definition_ids : Annotated[Optional[conlist(StrictStr)], Field(description="A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] ListLegalEntities: List Legal Entities  # noqa: E501

        List legal entities which has identifier of specific identifier type's scope and code, and satisfies filter criteria.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_legal_entities_with_http_info(id_type_scope, id_type_code, effective_at, as_at, page, limit, filter, sort_by, property_keys, relationship_definition_ids, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param effective_at: The effective datetime or cut label at which to list the people. Defaults to the current LUSID              system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to list the people. Defaults to return the latest version              of each people if not specified.
        :type as_at: datetime
        :param page: The pagination token to use to continue listing legal entities from a previous call to list legal entities. This  value is returned from the previous call. If a pagination token is provided the filter, effectiveAt, sortBy  and asAt fields must not have changed since the original request.
        :type page: str
        :param limit: When paginating, limit the number of returned results to this many. Defaults to 100 if not specified.
        :type limit: int
        :param filter: Expression to filter the result set.               Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
        :type filter: str
        :param sort_by: A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\".
        :type sort_by: List[str]
        :param property_keys: A list of property keys or identifier types (as property keys) from the \"LegalEntity\" domain              to include for each legal entity, or from any domain that supports relationships to decorate onto related entities.              These take the format {domain}/{scope}/{code} e.g. \"LegalEntity/ContactDetails/Address\".
        :type property_keys: List[str]
        :param relationship_definition_ids: A list of relationship definitions that are used to decorate related entities              onto each portfolio in the response. These must take the form {relationshipDefinitionScope}/{relationshipDefinitionCode}.
        :type relationship_definition_ids: List[str]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(PagedResourceListOfLegalEntity, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'effective_at',
            'as_at',
            'page',
            'limit',
            'filter',
            'sort_by',
            'property_keys',
            'relationship_definition_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 list_legal_entities" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']


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

        if _params.get('as_at') is not None:  # noqa: E501
            if isinstance(_params['as_at'], datetime):
                _query_params.append(('asAt', _params['as_at'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('asAt', _params['as_at']))

        if _params.get('page') is not None:  # noqa: E501
            _query_params.append(('page', _params['page']))

        if _params.get('limit') is not None:  # noqa: E501
            _query_params.append(('limit', _params['limit']))

        if _params.get('filter') is not None:  # noqa: E501
            _query_params.append(('filter', _params['filter']))

        if _params.get('sort_by') is not None:  # noqa: E501
            _query_params.append(('sortBy', _params['sort_by']))
            _collection_formats['sortBy'] = 'multi'

        if _params.get('property_keys') is not None:  # noqa: E501
            _query_params.append(('propertyKeys', _params['property_keys']))
            _collection_formats['propertyKeys'] = 'multi'

        if _params.get('relationship_definition_ids') is not None:  # noqa: E501
            _query_params.append(('relationshipDefinitionIds', _params['relationship_definition_ids']))
            _collection_formats['relationshipDefinitionIds'] = 'multi'

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # 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(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "PagedResourceListOfLegalEntity",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}', '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'))

    @overload
    async def patch_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], access_metadata_operation : Annotated[conlist(AccessMetadataOperation), Field(..., description="The Json Patch document")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, **kwargs) -> Dict[str, List[AccessMetadataValue]]:  # noqa: E501
        ...

    @overload
    def patch_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], access_metadata_operation : Annotated[conlist(AccessMetadataOperation), Field(..., description="The Json Patch document")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, async_req: Optional[bool]=True, **kwargs) -> Dict[str, List[AccessMetadataValue]]:  # noqa: E501
        ...

    @validate_arguments
    def patch_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], access_metadata_operation : Annotated[conlist(AccessMetadataOperation), Field(..., description="The Json Patch document")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[Dict[str, List[AccessMetadataValue]], Awaitable[Dict[str, List[AccessMetadataValue]]]]:  # noqa: E501
        """[EARLY ACCESS] PatchLegalEntityAccessMetadata: Patch Access Metadata rules for a Legal Entity.  # noqa: E501

        Patch Legal Entity Access Metadata Rules in a single scope.  The behaviour is defined by the JSON Patch specification.                Currently only 'add' is a supported operation on the patch document    Currently only valid metadata keys are supported paths on the patch document                The response will return any affected Legal Entity Access Metadata rules or a failure message if unsuccessful.                It is important to always check to verify success (or failure).                Multiple rules for a metadataKey can exist with different effective at dates, when resources are accessed the rule that is active for the current time will be fetched.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.patch_legal_entity_access_metadata(id_type_scope, id_type_code, code, access_metadata_operation, effective_at, effective_until, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param access_metadata_operation: The Json Patch document (required)
        :type access_metadata_operation: List[AccessMetadataOperation]
        :param effective_at: The effectiveAt datetime at which to upsert the Access Metadata
        :type effective_at: str
        :param effective_until: The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata
        :type effective_until: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: Dict[str, List[AccessMetadataValue]]
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the patch_legal_entity_access_metadata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.patch_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, access_metadata_operation, effective_at, effective_until, **kwargs)  # noqa: E501

    @validate_arguments
    def patch_legal_entity_access_metadata_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], access_metadata_operation : Annotated[conlist(AccessMetadataOperation), Field(..., description="The Json Patch document")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] PatchLegalEntityAccessMetadata: Patch Access Metadata rules for a Legal Entity.  # noqa: E501

        Patch Legal Entity Access Metadata Rules in a single scope.  The behaviour is defined by the JSON Patch specification.                Currently only 'add' is a supported operation on the patch document    Currently only valid metadata keys are supported paths on the patch document                The response will return any affected Legal Entity Access Metadata rules or a failure message if unsuccessful.                It is important to always check to verify success (or failure).                Multiple rules for a metadataKey can exist with different effective at dates, when resources are accessed the rule that is active for the current time will be fetched.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.patch_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, access_metadata_operation, effective_at, effective_until, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param access_metadata_operation: The Json Patch document (required)
        :type access_metadata_operation: List[AccessMetadataOperation]
        :param effective_at: The effectiveAt datetime at which to upsert the Access Metadata
        :type effective_at: str
        :param effective_until: The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata
        :type effective_until: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(Dict[str, List[AccessMetadataValue]], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'access_metadata_operation',
            'effective_at',
            'effective_until'
        ]
        _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 patch_legal_entity_access_metadata" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


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

        if _params.get('effective_until') is not None:  # noqa: E501
            if isinstance(_params['effective_until'], datetime):
                _query_params.append(('effectiveUntil', _params['effective_until'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('effectiveUntil', _params['effective_until']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['access_metadata_operation'] is not None:
            _body_params = _params['access_metadata_operation']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/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-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "Dict[str, List[AccessMetadataValue]]",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/metadata', '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'))

    @overload
    async def set_legal_entity_identifiers(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_identifiers_request : Annotated[SetLegalEntityIdentifiersRequest, Field(..., description="Request containing identifiers to set for the legal entity. Identifiers not specified in request will not be changed.")], **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @overload
    def set_legal_entity_identifiers(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_identifiers_request : Annotated[SetLegalEntityIdentifiersRequest, Field(..., description="Request containing identifiers to set for the legal entity. Identifiers not specified in request will not be changed.")], async_req: Optional[bool]=True, **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @validate_arguments
    def set_legal_entity_identifiers(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_identifiers_request : Annotated[SetLegalEntityIdentifiersRequest, Field(..., description="Request containing identifiers to set for the legal entity. Identifiers not specified in request will not be changed.")], async_req: Optional[bool]=None, **kwargs) -> Union[LegalEntity, Awaitable[LegalEntity]]:  # noqa: E501
        """[EARLY ACCESS] SetLegalEntityIdentifiers: Set Legal Entity Identifiers  # noqa: E501

        Set identifiers of the Legal Entity.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.set_legal_entity_identifiers(id_type_scope, id_type_code, code, set_legal_entity_identifiers_request, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param set_legal_entity_identifiers_request: Request containing identifiers to set for the legal entity. Identifiers not specified in request will not be changed. (required)
        :type set_legal_entity_identifiers_request: SetLegalEntityIdentifiersRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: LegalEntity
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the set_legal_entity_identifiers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.set_legal_entity_identifiers_with_http_info(id_type_scope, id_type_code, code, set_legal_entity_identifiers_request, **kwargs)  # noqa: E501

    @validate_arguments
    def set_legal_entity_identifiers_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_identifiers_request : Annotated[SetLegalEntityIdentifiersRequest, Field(..., description="Request containing identifiers to set for the legal entity. Identifiers not specified in request will not be changed.")], **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] SetLegalEntityIdentifiers: Set Legal Entity Identifiers  # noqa: E501

        Set identifiers of the Legal Entity.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.set_legal_entity_identifiers_with_http_info(id_type_scope, id_type_code, code, set_legal_entity_identifiers_request, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param set_legal_entity_identifiers_request: Request containing identifiers to set for the legal entity. Identifiers not specified in request will not be changed. (required)
        :type set_legal_entity_identifiers_request: SetLegalEntityIdentifiersRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(LegalEntity, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'set_legal_entity_identifiers_request'
        ]
        _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 set_legal_entity_identifiers" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['set_legal_entity_identifiers_request'] is not None:
            _body_params = _params['set_legal_entity_identifiers_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/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-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "LegalEntity",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/identifiers', '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'))

    @overload
    async def set_legal_entity_properties(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_properties_request : Annotated[SetLegalEntityPropertiesRequest, Field(..., description="Request containing properties to set for the legal entity. Properties not specified in request will not be changed.")], **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @overload
    def set_legal_entity_properties(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_properties_request : Annotated[SetLegalEntityPropertiesRequest, Field(..., description="Request containing properties to set for the legal entity. Properties not specified in request will not be changed.")], async_req: Optional[bool]=True, **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @validate_arguments
    def set_legal_entity_properties(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_properties_request : Annotated[SetLegalEntityPropertiesRequest, Field(..., description="Request containing properties to set for the legal entity. Properties not specified in request will not be changed.")], async_req: Optional[bool]=None, **kwargs) -> Union[LegalEntity, Awaitable[LegalEntity]]:  # noqa: E501
        """[EARLY ACCESS] SetLegalEntityProperties: Set Legal Entity Properties  # noqa: E501

        Set properties of the legal entity.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.set_legal_entity_properties(id_type_scope, id_type_code, code, set_legal_entity_properties_request, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param set_legal_entity_properties_request: Request containing properties to set for the legal entity. Properties not specified in request will not be changed. (required)
        :type set_legal_entity_properties_request: SetLegalEntityPropertiesRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: LegalEntity
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the set_legal_entity_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.set_legal_entity_properties_with_http_info(id_type_scope, id_type_code, code, set_legal_entity_properties_request, **kwargs)  # noqa: E501

    @validate_arguments
    def set_legal_entity_properties_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the legal entity identifier type.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity identifier type.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity.")], set_legal_entity_properties_request : Annotated[SetLegalEntityPropertiesRequest, Field(..., description="Request containing properties to set for the legal entity. Properties not specified in request will not be changed.")], **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] SetLegalEntityProperties: Set Legal Entity Properties  # noqa: E501

        Set properties of the legal entity.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.set_legal_entity_properties_with_http_info(id_type_scope, id_type_code, code, set_legal_entity_properties_request, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the legal entity identifier type. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the legal entity identifier type. (required)
        :type id_type_code: str
        :param code: Code of the legal entity under specified identifier type's scope and code. This together with stated identifier type uniquely              identifies the legal entity. (required)
        :type code: str
        :param set_legal_entity_properties_request: Request containing properties to set for the legal entity. Properties not specified in request will not be changed. (required)
        :type set_legal_entity_properties_request: SetLegalEntityPropertiesRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(LegalEntity, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'set_legal_entity_properties_request'
        ]
        _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 set_legal_entity_properties" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['set_legal_entity_properties_request'] is not None:
            _body_params = _params['set_legal_entity_properties_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/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-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "LegalEntity",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/properties', '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'))

    @overload
    async def upsert_legal_entities(self, success_mode : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Whether the batch request should fail Atomically or in a Partial fashion - Allowed Values: Atomic, Partial")], request_body : Annotated[Dict[str, UpsertLegalEntityRequest], Field(..., description="A collection of requests to create or update Legal Entities.")], **kwargs) -> UpsertLegalEntitiesResponse:  # noqa: E501
        ...

    @overload
    def upsert_legal_entities(self, success_mode : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Whether the batch request should fail Atomically or in a Partial fashion - Allowed Values: Atomic, Partial")], request_body : Annotated[Dict[str, UpsertLegalEntityRequest], Field(..., description="A collection of requests to create or update Legal Entities.")], async_req: Optional[bool]=True, **kwargs) -> UpsertLegalEntitiesResponse:  # noqa: E501
        ...

    @validate_arguments
    def upsert_legal_entities(self, success_mode : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Whether the batch request should fail Atomically or in a Partial fashion - Allowed Values: Atomic, Partial")], request_body : Annotated[Dict[str, UpsertLegalEntityRequest], Field(..., description="A collection of requests to create or update Legal Entities.")], async_req: Optional[bool]=None, **kwargs) -> Union[UpsertLegalEntitiesResponse, Awaitable[UpsertLegalEntitiesResponse]]:  # noqa: E501
        """[EARLY ACCESS] UpsertLegalEntities: Pluralised upsert of Legal Entities  # noqa: E501

        Creates or updates a collection of Legal Entities  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_legal_entities(success_mode, request_body, async_req=True)
        >>> result = thread.get()

        :param success_mode: Whether the batch request should fail Atomically or in a Partial fashion - Allowed Values: Atomic, Partial (required)
        :type success_mode: str
        :param request_body: A collection of requests to create or update Legal Entities. (required)
        :type request_body: Dict[str, UpsertLegalEntityRequest]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: UpsertLegalEntitiesResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the upsert_legal_entities_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.upsert_legal_entities_with_http_info(success_mode, request_body, **kwargs)  # noqa: E501

    @validate_arguments
    def upsert_legal_entities_with_http_info(self, success_mode : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Whether the batch request should fail Atomically or in a Partial fashion - Allowed Values: Atomic, Partial")], request_body : Annotated[Dict[str, UpsertLegalEntityRequest], Field(..., description="A collection of requests to create or update Legal Entities.")], **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] UpsertLegalEntities: Pluralised upsert of Legal Entities  # noqa: E501

        Creates or updates a collection of Legal Entities  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_legal_entities_with_http_info(success_mode, request_body, async_req=True)
        >>> result = thread.get()

        :param success_mode: Whether the batch request should fail Atomically or in a Partial fashion - Allowed Values: Atomic, Partial (required)
        :type success_mode: str
        :param request_body: A collection of requests to create or update Legal Entities. (required)
        :type request_body: Dict[str, UpsertLegalEntityRequest]
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(UpsertLegalEntitiesResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'success_mode',
            'request_body'
        ]
        _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 upsert_legal_entities" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

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

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['request_body'] is not None:
            _body_params = _params['request_body']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/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-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '201': "UpsertLegalEntitiesResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/$batchUpsert', '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'))

    @overload
    async def upsert_legal_entity(self, upsert_legal_entity_request : Annotated[UpsertLegalEntityRequest, Field(..., description="Request to create or update a legal entity.")], **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @overload
    def upsert_legal_entity(self, upsert_legal_entity_request : Annotated[UpsertLegalEntityRequest, Field(..., description="Request to create or update a legal entity.")], async_req: Optional[bool]=True, **kwargs) -> LegalEntity:  # noqa: E501
        ...

    @validate_arguments
    def upsert_legal_entity(self, upsert_legal_entity_request : Annotated[UpsertLegalEntityRequest, Field(..., description="Request to create or update a legal entity.")], async_req: Optional[bool]=None, **kwargs) -> Union[LegalEntity, Awaitable[LegalEntity]]:  # noqa: E501
        """[EARLY ACCESS] UpsertLegalEntity: Upsert Legal Entity  # noqa: E501

        Create or update a legal entity  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_legal_entity(upsert_legal_entity_request, async_req=True)
        >>> result = thread.get()

        :param upsert_legal_entity_request: Request to create or update a legal entity. (required)
        :type upsert_legal_entity_request: UpsertLegalEntityRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: LegalEntity
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the upsert_legal_entity_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.upsert_legal_entity_with_http_info(upsert_legal_entity_request, **kwargs)  # noqa: E501

    @validate_arguments
    def upsert_legal_entity_with_http_info(self, upsert_legal_entity_request : Annotated[UpsertLegalEntityRequest, Field(..., description="Request to create or update a legal entity.")], **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] UpsertLegalEntity: Upsert Legal Entity  # noqa: E501

        Create or update a legal entity  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_legal_entity_with_http_info(upsert_legal_entity_request, async_req=True)
        >>> result = thread.get()

        :param upsert_legal_entity_request: Request to create or update a legal entity. (required)
        :type upsert_legal_entity_request: UpsertLegalEntityRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(LegalEntity, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'upsert_legal_entity_request'
        ]
        _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 upsert_legal_entity" % _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', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['upsert_legal_entity_request'] is not None:
            _body_params = _params['upsert_legal_entity_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/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-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '201': "LegalEntity",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities', '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'))

    @overload
    async def upsert_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], upsert_legal_entity_access_metadata_request : Annotated[UpsertLegalEntityAccessMetadataRequest, Field(..., description="The Legal Entity Access Metadata entry to upsert")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, **kwargs) -> ResourceListOfAccessMetadataValueOf:  # noqa: E501
        ...

    @overload
    def upsert_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], upsert_legal_entity_access_metadata_request : Annotated[UpsertLegalEntityAccessMetadataRequest, Field(..., description="The Legal Entity Access Metadata entry to upsert")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, async_req: Optional[bool]=True, **kwargs) -> ResourceListOfAccessMetadataValueOf:  # noqa: E501
        ...

    @validate_arguments
    def upsert_legal_entity_access_metadata(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], upsert_legal_entity_access_metadata_request : Annotated[UpsertLegalEntityAccessMetadataRequest, Field(..., description="The Legal Entity Access Metadata entry to upsert")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ResourceListOfAccessMetadataValueOf, Awaitable[ResourceListOfAccessMetadataValueOf]]:  # noqa: E501
        """[EARLY ACCESS] UpsertLegalEntityAccessMetadata: Upsert a Legal Entity Access Metadata entry associated with a specific metadataKey. This creates or updates the data in LUSID.  # noqa: E501

        Update or insert one Legal Entity Access Metadata entry in a single scope. An item will be updated if it already exists  and inserted if it does not.                The response will return the successfully updated or inserted Legal Entity Access Metadata rule or failure message if unsuccessful.                It is important to always check to verify success (or failure).                Multiple rules for a metadataKey can exist with different effective at dates, when resources are accessed the rule that is active for the current time will be fetched.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_legal_entity_access_metadata(id_type_scope, id_type_code, code, metadata_key, upsert_legal_entity_access_metadata_request, effective_at, effective_until, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param metadata_key: Key of the metadata entry to retrieve (required)
        :type metadata_key: str
        :param upsert_legal_entity_access_metadata_request: The Legal Entity Access Metadata entry to upsert (required)
        :type upsert_legal_entity_access_metadata_request: UpsertLegalEntityAccessMetadataRequest
        :param effective_at: The effectiveAt datetime at which to upsert the Access Metadata
        :type effective_at: str
        :param effective_until: The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata
        :type effective_until: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: 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: ResourceListOfAccessMetadataValueOf
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the upsert_legal_entity_access_metadata_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.upsert_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, metadata_key, upsert_legal_entity_access_metadata_request, effective_at, effective_until, **kwargs)  # noqa: E501

    @validate_arguments
    def upsert_legal_entity_access_metadata_with_http_info(self, id_type_scope : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Scope of the Legal Entity identifier.")], id_type_code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity identifier.")], code : Annotated[constr(strict=True, max_length=64, min_length=1), Field(..., description="Code of the Legal Entity under specified identifier type's scope and code.")], metadata_key : Annotated[constr(strict=True, max_length=100, min_length=1), Field(..., description="Key of the metadata entry to retrieve")], upsert_legal_entity_access_metadata_request : Annotated[UpsertLegalEntityAccessMetadataRequest, Field(..., description="The Legal Entity Access Metadata entry to upsert")], effective_at : Annotated[Optional[StrictStr], Field(description="The effectiveAt datetime at which to upsert the Access Metadata")] = None, effective_until : Annotated[Optional[datetime], Field(description="The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """[EARLY ACCESS] UpsertLegalEntityAccessMetadata: Upsert a Legal Entity Access Metadata entry associated with a specific metadataKey. This creates or updates the data in LUSID.  # noqa: E501

        Update or insert one Legal Entity Access Metadata entry in a single scope. An item will be updated if it already exists  and inserted if it does not.                The response will return the successfully updated or inserted Legal Entity Access Metadata rule or failure message if unsuccessful.                It is important to always check to verify success (or failure).                Multiple rules for a metadataKey can exist with different effective at dates, when resources are accessed the rule that is active for the current time will be fetched.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_legal_entity_access_metadata_with_http_info(id_type_scope, id_type_code, code, metadata_key, upsert_legal_entity_access_metadata_request, effective_at, effective_until, async_req=True)
        >>> result = thread.get()

        :param id_type_scope: Scope of the Legal Entity identifier. (required)
        :type id_type_scope: str
        :param id_type_code: Code of the Legal Entity identifier. (required)
        :type id_type_code: str
        :param code: Code of the Legal Entity under specified identifier type's scope and code. (required)
        :type code: str
        :param metadata_key: Key of the metadata entry to retrieve (required)
        :type metadata_key: str
        :param upsert_legal_entity_access_metadata_request: The Legal Entity Access Metadata entry to upsert (required)
        :type upsert_legal_entity_access_metadata_request: UpsertLegalEntityAccessMetadataRequest
        :param effective_at: The effectiveAt datetime at which to upsert the Access Metadata
        :type effective_at: str
        :param effective_until: The effective datetime until which the Access Metadata is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveAt' datetime of the Access Metadata
        :type effective_until: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: 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(ResourceListOfAccessMetadataValueOf, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'id_type_scope',
            'id_type_code',
            'code',
            'metadata_key',
            'upsert_legal_entity_access_metadata_request',
            'effective_at',
            'effective_until'
        ]
        _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 upsert_legal_entity_access_metadata" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

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

        if _params['id_type_code']:
            _path_params['idTypeCode'] = _params['id_type_code']

        if _params['code']:
            _path_params['code'] = _params['code']

        if _params['metadata_key']:
            _path_params['metadataKey'] = _params['metadata_key']


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

        if _params.get('effective_until') is not None:  # noqa: E501
            if isinstance(_params['effective_until'], datetime):
                _query_params.append(('effectiveUntil', _params['effective_until'].strftime(self.api_client.configuration.datetime_format)))
            else:
                _query_params.append(('effectiveUntil', _params['effective_until']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['upsert_legal_entity_access_metadata_request'] is not None:
            _body_params = _params['upsert_legal_entity_access_metadata_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/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-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "ResourceListOfAccessMetadataValueOf",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/legalentities/{idTypeScope}/{idTypeCode}/{code}/metadata/{metadataKey}', 'PUT',
            _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'))
