"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from .basesdk import BaseSDK
from ascend_sdk import utils
from ascend_sdk._hooks import HookContext
from ascend_sdk.models import components, errors, operations
from ascend_sdk.types import BaseModel, OptionalNullable, UNSET
from typing import Any, Optional, Union, cast


class AccountManagement(BaseSDK):
    def list_accounts(
        self,
        *,
        request: Union[
            operations.AccountsListAccountsRequest,
            operations.AccountsListAccountsRequestTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsListAccountsResponse:
        r"""List Accounts

        Gets a list of Accounts based on search criteria.

        :param request: The request object to send.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        if not isinstance(request, BaseModel):
            request = utils.unmarshal(request, operations.AccountsListAccountsRequest)
        request = cast(operations.AccountsListAccountsRequest, request)

        req = self.build_request(
            method="GET",
            path="/accounts/v1/accounts",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_ListAccounts",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsListAccountsResponse(
                list_accounts_response=utils.unmarshal_json(
                    http_res.text, Optional[components.ListAccountsResponse]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsListAccountsResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def list_accounts_async(
        self,
        *,
        request: Union[
            operations.AccountsListAccountsRequest,
            operations.AccountsListAccountsRequestTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsListAccountsResponse:
        r"""List Accounts

        Gets a list of Accounts based on search criteria.

        :param request: The request object to send.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        if not isinstance(request, BaseModel):
            request = utils.unmarshal(request, operations.AccountsListAccountsRequest)
        request = cast(operations.AccountsListAccountsRequest, request)

        req = self.build_request_async(
            method="GET",
            path="/accounts/v1/accounts",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=False,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_ListAccounts",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsListAccountsResponse(
                list_accounts_response=utils.unmarshal_json(
                    http_res.text, Optional[components.ListAccountsResponse]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsListAccountsResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def update_account(
        self,
        *,
        account_id: str,
        account_request_update: Union[
            components.AccountRequestUpdate, components.AccountRequestUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdateAccountResponse:
        r"""Update Account

        UPDATE Updates an Account.

        :param account_id: The account id.
        :param account_request_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdateAccountRequest(
            account_id=account_id,
            account_request_update=utils.get_pydantic_model(
                account_request_update, components.AccountRequestUpdate
            ),
        )

        req = self.build_request(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.account_request_update,
                False,
                False,
                "json",
                components.AccountRequestUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateAccount",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdateAccountResponse(
                account=utils.unmarshal_json(
                    http_res.text, Optional[components.Account]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdateAccountResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def update_account_async(
        self,
        *,
        account_id: str,
        account_request_update: Union[
            components.AccountRequestUpdate, components.AccountRequestUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdateAccountResponse:
        r"""Update Account

        UPDATE Updates an Account.

        :param account_id: The account id.
        :param account_request_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdateAccountRequest(
            account_id=account_id,
            account_request_update=utils.get_pydantic_model(
                account_request_update, components.AccountRequestUpdate
            ),
        )

        req = self.build_request_async(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.account_request_update,
                False,
                False,
                "json",
                components.AccountRequestUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateAccount",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdateAccountResponse(
                account=utils.unmarshal_json(
                    http_res.text, Optional[components.Account]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdateAccountResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def add_party(
        self,
        *,
        account_id: str,
        add_party_request_create: Union[
            components.AddPartyRequestCreate, components.AddPartyRequestCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsAddPartyResponse:
        r"""Add Party

        Adds a party to an account

        :param account_id: The account id.
        :param add_party_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsAddPartyRequest(
            account_id=account_id,
            add_party_request_create=utils.get_pydantic_model(
                add_party_request_create, components.AddPartyRequestCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/parties:add",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.add_party_request_create,
                False,
                False,
                "json",
                components.AddPartyRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_AddParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsAddPartyResponse(
                party=utils.unmarshal_json(http_res.text, Optional[components.Party]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsAddPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def add_party_async(
        self,
        *,
        account_id: str,
        add_party_request_create: Union[
            components.AddPartyRequestCreate, components.AddPartyRequestCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsAddPartyResponse:
        r"""Add Party

        Adds a party to an account

        :param account_id: The account id.
        :param add_party_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsAddPartyRequest(
            account_id=account_id,
            add_party_request_create=utils.get_pydantic_model(
                add_party_request_create, components.AddPartyRequestCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/parties:add",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.add_party_request_create,
                False,
                False,
                "json",
                components.AddPartyRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_AddParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsAddPartyResponse(
                party=utils.unmarshal_json(http_res.text, Optional[components.Party]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsAddPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def update_party(
        self,
        *,
        account_id: str,
        party_id: str,
        party_request_update: Union[
            components.PartyRequestUpdate, components.PartyRequestUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdatePartyResponse:
        r"""Update Party

        Updates a Party.

        :param account_id: The account id.
        :param party_id: The party id.
        :param party_request_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdatePartyRequest(
            account_id=account_id,
            party_id=party_id,
            party_request_update=utils.get_pydantic_model(
                party_request_update, components.PartyRequestUpdate
            ),
        )

        req = self.build_request(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}/parties/{party_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.party_request_update,
                False,
                False,
                "json",
                components.PartyRequestUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdatePartyResponse(
                party=utils.unmarshal_json(http_res.text, Optional[components.Party]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdatePartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def update_party_async(
        self,
        *,
        account_id: str,
        party_id: str,
        party_request_update: Union[
            components.PartyRequestUpdate, components.PartyRequestUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdatePartyResponse:
        r"""Update Party

        Updates a Party.

        :param account_id: The account id.
        :param party_id: The party id.
        :param party_request_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdatePartyRequest(
            account_id=account_id,
            party_id=party_id,
            party_request_update=utils.get_pydantic_model(
                party_request_update, components.PartyRequestUpdate
            ),
        )

        req = self.build_request_async(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}/parties/{party_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.party_request_update,
                False,
                False,
                "json",
                components.PartyRequestUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdatePartyResponse(
                party=utils.unmarshal_json(http_res.text, Optional[components.Party]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdatePartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def replace_party(
        self,
        *,
        account_id: str,
        party_id: str,
        replace_party_request_create: Union[
            components.ReplacePartyRequestCreate,
            components.ReplacePartyRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsReplacePartyResponse:
        r"""Replace Party

        Replaces a party on an account

        :param account_id: The account id.
        :param party_id: The party id.
        :param replace_party_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsReplacePartyRequest(
            account_id=account_id,
            party_id=party_id,
            replace_party_request_create=utils.get_pydantic_model(
                replace_party_request_create, components.ReplacePartyRequestCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/parties/{party_id}:replace",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.replace_party_request_create,
                False,
                False,
                "json",
                components.ReplacePartyRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_ReplaceParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsReplacePartyResponse(
                party=utils.unmarshal_json(http_res.text, Optional[components.Party]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsReplacePartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def replace_party_async(
        self,
        *,
        account_id: str,
        party_id: str,
        replace_party_request_create: Union[
            components.ReplacePartyRequestCreate,
            components.ReplacePartyRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsReplacePartyResponse:
        r"""Replace Party

        Replaces a party on an account

        :param account_id: The account id.
        :param party_id: The party id.
        :param replace_party_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsReplacePartyRequest(
            account_id=account_id,
            party_id=party_id,
            replace_party_request_create=utils.get_pydantic_model(
                replace_party_request_create, components.ReplacePartyRequestCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/parties/{party_id}:replace",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.replace_party_request_create,
                False,
                False,
                "json",
                components.ReplacePartyRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_ReplaceParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsReplacePartyResponse(
                party=utils.unmarshal_json(http_res.text, Optional[components.Party]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsReplacePartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def remove_party(
        self,
        *,
        account_id: str,
        party_id: str,
        remove_party_request_create: Union[
            components.RemovePartyRequestCreate,
            components.RemovePartyRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsRemovePartyResponse:
        r"""Remove Party

        Remove a party from an account

        :param account_id: The account id.
        :param party_id: The party id.
        :param remove_party_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsRemovePartyRequest(
            account_id=account_id,
            party_id=party_id,
            remove_party_request_create=utils.get_pydantic_model(
                remove_party_request_create, components.RemovePartyRequestCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/parties/{party_id}:remove",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.remove_party_request_create,
                False,
                False,
                "json",
                components.RemovePartyRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_RemoveParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsRemovePartyResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsRemovePartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def remove_party_async(
        self,
        *,
        account_id: str,
        party_id: str,
        remove_party_request_create: Union[
            components.RemovePartyRequestCreate,
            components.RemovePartyRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsRemovePartyResponse:
        r"""Remove Party

        Remove a party from an account

        :param account_id: The account id.
        :param party_id: The party id.
        :param remove_party_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsRemovePartyRequest(
            account_id=account_id,
            party_id=party_id,
            remove_party_request_create=utils.get_pydantic_model(
                remove_party_request_create, components.RemovePartyRequestCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/parties/{party_id}:remove",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.remove_party_request_create,
                False,
                False,
                "json",
                components.RemovePartyRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_RemoveParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsRemovePartyResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsRemovePartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def close_account(
        self,
        *,
        account_id: str,
        close_account_request_create: Union[
            components.CloseAccountRequestCreate,
            components.CloseAccountRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCloseAccountResponse:
        r"""Close Account

        CUSTOM Places an ACCT_MAINT_CLOSURE_PREP_BY_CORRESPONDENT restriction on the Account ready for closure.

        :param account_id: The account id.
        :param close_account_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCloseAccountRequest(
            account_id=account_id,
            close_account_request_create=utils.get_pydantic_model(
                close_account_request_create, components.CloseAccountRequestCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}:close",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.close_account_request_create,
                False,
                False,
                "json",
                components.CloseAccountRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_CloseAccount",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "409", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCloseAccountResponse(
                account=utils.unmarshal_json(
                    http_res.text, Optional[components.Account]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "409", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCloseAccountResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def close_account_async(
        self,
        *,
        account_id: str,
        close_account_request_create: Union[
            components.CloseAccountRequestCreate,
            components.CloseAccountRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCloseAccountResponse:
        r"""Close Account

        CUSTOM Places an ACCT_MAINT_CLOSURE_PREP_BY_CORRESPONDENT restriction on the Account ready for closure.

        :param account_id: The account id.
        :param close_account_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCloseAccountRequest(
            account_id=account_id,
            close_account_request_create=utils.get_pydantic_model(
                close_account_request_create, components.CloseAccountRequestCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}:close",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.close_account_request_create,
                False,
                False,
                "json",
                components.CloseAccountRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_CloseAccount",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "409", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCloseAccountResponse(
                account=utils.unmarshal_json(
                    http_res.text, Optional[components.Account]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "409", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCloseAccountResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def create_trusted_contact(
        self,
        *,
        account_id: str,
        trusted_contact_create: Union[
            components.TrustedContactCreate, components.TrustedContactCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCreateTrustedContactResponse:
        r"""Create Trusted Contact

        Creates a new Trusted Contact for an account.

        :param account_id: The account id.
        :param trusted_contact_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCreateTrustedContactRequest(
            account_id=account_id,
            trusted_contact_create=utils.get_pydantic_model(
                trusted_contact_create, components.TrustedContactCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/trustedContacts",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.trusted_contact_create,
                False,
                False,
                "json",
                components.TrustedContactCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_CreateTrustedContact",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCreateTrustedContactResponse(
                trusted_contact=utils.unmarshal_json(
                    http_res.text, Optional[components.TrustedContact]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCreateTrustedContactResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def create_trusted_contact_async(
        self,
        *,
        account_id: str,
        trusted_contact_create: Union[
            components.TrustedContactCreate, components.TrustedContactCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCreateTrustedContactResponse:
        r"""Create Trusted Contact

        Creates a new Trusted Contact for an account.

        :param account_id: The account id.
        :param trusted_contact_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCreateTrustedContactRequest(
            account_id=account_id,
            trusted_contact_create=utils.get_pydantic_model(
                trusted_contact_create, components.TrustedContactCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/trustedContacts",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.trusted_contact_create,
                False,
                False,
                "json",
                components.TrustedContactCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_CreateTrustedContact",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCreateTrustedContactResponse(
                trusted_contact=utils.unmarshal_json(
                    http_res.text, Optional[components.TrustedContact]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCreateTrustedContactResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def update_trusted_contact(
        self,
        *,
        account_id: str,
        trusted_contact_id: str,
        trusted_contact_update: Union[
            components.TrustedContactUpdate, components.TrustedContactUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdateTrustedContactResponse:
        r"""Update Trusted Contact

        Updates a Trusted Contact.

        :param account_id: The account id.
        :param trusted_contact_id: The trustedContact id.
        :param trusted_contact_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdateTrustedContactRequest(
            account_id=account_id,
            trusted_contact_id=trusted_contact_id,
            trusted_contact_update=utils.get_pydantic_model(
                trusted_contact_update, components.TrustedContactUpdate
            ),
        )

        req = self.build_request(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}/trustedContacts/{trustedContact_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.trusted_contact_update,
                False,
                False,
                "json",
                components.TrustedContactUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateTrustedContact",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdateTrustedContactResponse(
                trusted_contact=utils.unmarshal_json(
                    http_res.text, Optional[components.TrustedContact]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdateTrustedContactResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def update_trusted_contact_async(
        self,
        *,
        account_id: str,
        trusted_contact_id: str,
        trusted_contact_update: Union[
            components.TrustedContactUpdate, components.TrustedContactUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdateTrustedContactResponse:
        r"""Update Trusted Contact

        Updates a Trusted Contact.

        :param account_id: The account id.
        :param trusted_contact_id: The trustedContact id.
        :param trusted_contact_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdateTrustedContactRequest(
            account_id=account_id,
            trusted_contact_id=trusted_contact_id,
            trusted_contact_update=utils.get_pydantic_model(
                trusted_contact_update, components.TrustedContactUpdate
            ),
        )

        req = self.build_request_async(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}/trustedContacts/{trustedContact_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.trusted_contact_update,
                False,
                False,
                "json",
                components.TrustedContactUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateTrustedContact",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdateTrustedContactResponse(
                trusted_contact=utils.unmarshal_json(
                    http_res.text, Optional[components.TrustedContact]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdateTrustedContactResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def delete_trusted_contact(
        self,
        *,
        account_id: str,
        trusted_contact_id: str,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsDeleteTrustedContactResponse:
        r"""Delete Trusted Contact

        DELETE Deletes a Trusted Contact for an Account.

        :param account_id: The account id.
        :param trusted_contact_id: The trustedContact id.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsDeleteTrustedContactRequest(
            account_id=account_id,
            trusted_contact_id=trusted_contact_id,
        )

        req = self.build_request(
            method="DELETE",
            path="/accounts/v1/accounts/{account_id}/trustedContacts/{trustedContact_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_DeleteTrustedContact",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsDeleteTrustedContactResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsDeleteTrustedContactResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def delete_trusted_contact_async(
        self,
        *,
        account_id: str,
        trusted_contact_id: str,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsDeleteTrustedContactResponse:
        r"""Delete Trusted Contact

        DELETE Deletes a Trusted Contact for an Account.

        :param account_id: The account id.
        :param trusted_contact_id: The trustedContact id.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsDeleteTrustedContactRequest(
            account_id=account_id,
            trusted_contact_id=trusted_contact_id,
        )

        req = self.build_request_async(
            method="DELETE",
            path="/accounts/v1/accounts/{account_id}/trustedContacts/{trustedContact_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_DeleteTrustedContact",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsDeleteTrustedContactResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsDeleteTrustedContactResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def create_interested_party(
        self,
        *,
        account_id: str,
        interested_party_create: Union[
            components.InterestedPartyCreate, components.InterestedPartyCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCreateInterestedPartyResponse:
        r"""Create Interested Party

        Creates an Interested Party record for an Account.

        :param account_id: The account id.
        :param interested_party_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCreateInterestedPartyRequest(
            account_id=account_id,
            interested_party_create=utils.get_pydantic_model(
                interested_party_create, components.InterestedPartyCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/interestedParties",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.interested_party_create,
                False,
                False,
                "json",
                components.InterestedPartyCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_CreateInterestedParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCreateInterestedPartyResponse(
                interested_party=utils.unmarshal_json(
                    http_res.text, Optional[components.InterestedParty]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCreateInterestedPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def create_interested_party_async(
        self,
        *,
        account_id: str,
        interested_party_create: Union[
            components.InterestedPartyCreate, components.InterestedPartyCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCreateInterestedPartyResponse:
        r"""Create Interested Party

        Creates an Interested Party record for an Account.

        :param account_id: The account id.
        :param interested_party_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCreateInterestedPartyRequest(
            account_id=account_id,
            interested_party_create=utils.get_pydantic_model(
                interested_party_create, components.InterestedPartyCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/interestedParties",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.interested_party_create,
                False,
                False,
                "json",
                components.InterestedPartyCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_CreateInterestedParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCreateInterestedPartyResponse(
                interested_party=utils.unmarshal_json(
                    http_res.text, Optional[components.InterestedParty]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCreateInterestedPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def update_interested_party(
        self,
        *,
        account_id: str,
        interested_party_id: str,
        interested_party_update: Union[
            components.InterestedPartyUpdate, components.InterestedPartyUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdateInterestedPartyResponse:
        r"""Update Interested Party

        Updates an Interested Party.

        :param account_id: The account id.
        :param interested_party_id: The interestedParty id.
        :param interested_party_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdateInterestedPartyRequest(
            account_id=account_id,
            interested_party_id=interested_party_id,
            interested_party_update=utils.get_pydantic_model(
                interested_party_update, components.InterestedPartyUpdate
            ),
        )

        req = self.build_request(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}/interestedParties/{interestedParty_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.interested_party_update,
                False,
                False,
                "json",
                components.InterestedPartyUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateInterestedParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdateInterestedPartyResponse(
                interested_party=utils.unmarshal_json(
                    http_res.text, Optional[components.InterestedParty]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdateInterestedPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def update_interested_party_async(
        self,
        *,
        account_id: str,
        interested_party_id: str,
        interested_party_update: Union[
            components.InterestedPartyUpdate, components.InterestedPartyUpdateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsUpdateInterestedPartyResponse:
        r"""Update Interested Party

        Updates an Interested Party.

        :param account_id: The account id.
        :param interested_party_id: The interestedParty id.
        :param interested_party_update:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsUpdateInterestedPartyRequest(
            account_id=account_id,
            interested_party_id=interested_party_id,
            interested_party_update=utils.get_pydantic_model(
                interested_party_update, components.InterestedPartyUpdate
            ),
        )

        req = self.build_request_async(
            method="PATCH",
            path="/accounts/v1/accounts/{account_id}/interestedParties/{interestedParty_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.interested_party_update,
                False,
                False,
                "json",
                components.InterestedPartyUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_UpdateInterestedParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsUpdateInterestedPartyResponse(
                interested_party=utils.unmarshal_json(
                    http_res.text, Optional[components.InterestedParty]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsUpdateInterestedPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def delete_interested_party(
        self,
        *,
        account_id: str,
        interested_party_id: str,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsDeleteInterestedPartyResponse:
        r"""Delete Interested Party

        Deletes an Interested Party associated from an Account.

        :param account_id: The account id.
        :param interested_party_id: The interestedParty id.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsDeleteInterestedPartyRequest(
            account_id=account_id,
            interested_party_id=interested_party_id,
        )

        req = self.build_request(
            method="DELETE",
            path="/accounts/v1/accounts/{account_id}/interestedParties/{interestedParty_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_DeleteInterestedParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsDeleteInterestedPartyResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsDeleteInterestedPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def delete_interested_party_async(
        self,
        *,
        account_id: str,
        interested_party_id: str,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsDeleteInterestedPartyResponse:
        r"""Delete Interested Party

        Deletes an Interested Party associated from an Account.

        :param account_id: The account id.
        :param interested_party_id: The interestedParty id.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsDeleteInterestedPartyRequest(
            account_id=account_id,
            interested_party_id=interested_party_id,
        )

        req = self.build_request_async(
            method="DELETE",
            path="/accounts/v1/accounts/{account_id}/interestedParties/{interestedParty_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_DeleteInterestedParty",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsDeleteInterestedPartyResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsDeleteInterestedPartyResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def list_available_restrictions(
        self,
        *,
        account_id: str,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsListAvailableRestrictionsResponse:
        r"""List Available Restrictions

        Gets a list of possible Restrictions that can be placed on an Account based on Enrollments.

        :param account_id: The account id.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsListAvailableRestrictionsRequest(
            account_id=account_id,
        )

        req = self.build_request(
            method="GET",
            path="/accounts/v1/accounts/{account_id}/availableRestrictions",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_ListAvailableRestrictions",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsListAvailableRestrictionsResponse(
                list_available_restrictions_response=utils.unmarshal_json(
                    http_res.text,
                    Optional[components.ListAvailableRestrictionsResponse],
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsListAvailableRestrictionsResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def list_available_restrictions_async(
        self,
        *,
        account_id: str,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsListAvailableRestrictionsResponse:
        r"""List Available Restrictions

        Gets a list of possible Restrictions that can be placed on an Account based on Enrollments.

        :param account_id: The account id.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsListAvailableRestrictionsRequest(
            account_id=account_id,
        )

        req = self.build_request_async(
            method="GET",
            path="/accounts/v1/accounts/{account_id}/availableRestrictions",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_ListAvailableRestrictions",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsListAvailableRestrictionsResponse(
                list_available_restrictions_response=utils.unmarshal_json(
                    http_res.text,
                    Optional[components.ListAvailableRestrictionsResponse],
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsListAvailableRestrictionsResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def create_restriction(
        self,
        *,
        account_id: str,
        restriction_create: Union[
            components.RestrictionCreate, components.RestrictionCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCreateRestrictionResponse:
        r"""Create Restriction

        Applies a Restriction to an account that suspends one or more Entitlements.

        :param account_id: The account id.
        :param restriction_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCreateRestrictionRequest(
            account_id=account_id,
            restriction_create=utils.get_pydantic_model(
                restriction_create, components.RestrictionCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/restrictions",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.restriction_create,
                False,
                False,
                "json",
                components.RestrictionCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_CreateRestriction",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "409", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCreateRestrictionResponse(
                restriction=utils.unmarshal_json(
                    http_res.text, Optional[components.Restriction]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "409", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCreateRestrictionResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def create_restriction_async(
        self,
        *,
        account_id: str,
        restriction_create: Union[
            components.RestrictionCreate, components.RestrictionCreateTypedDict
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsCreateRestrictionResponse:
        r"""Create Restriction

        Applies a Restriction to an account that suspends one or more Entitlements.

        :param account_id: The account id.
        :param restriction_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsCreateRestrictionRequest(
            account_id=account_id,
            restriction_create=utils.get_pydantic_model(
                restriction_create, components.RestrictionCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/restrictions",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.restriction_create,
                False,
                False,
                "json",
                components.RestrictionCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_CreateRestriction",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "409", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return operations.AccountsCreateRestrictionResponse(
                restriction=utils.unmarshal_json(
                    http_res.text, Optional[components.Restriction]
                ),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )
        if utils.match_response(
            http_res, ["400", "403", "409", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsCreateRestrictionResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    def end_restriction(
        self,
        *,
        account_id: str,
        restriction_id: str,
        end_restriction_request_create: Union[
            components.EndRestrictionRequestCreate,
            components.EndRestrictionRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsEndRestrictionResponse:
        r"""End Restriction

        Ends a Restriction on an Account.

        :param account_id: The account id.
        :param restriction_id: The restriction id.
        :param end_restriction_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsEndRestrictionRequest(
            account_id=account_id,
            restriction_id=restriction_id,
            end_restriction_request_create=utils.get_pydantic_model(
                end_restriction_request_create, components.EndRestrictionRequestCreate
            ),
        )

        req = self.build_request(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/restrictions/{restriction_id}:end",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.end_restriction_request_create,
                False,
                False,
                "json",
                components.EndRestrictionRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                operation_id="Accounts_EndRestriction",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsEndRestrictionResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsEndRestrictionResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )

    async def end_restriction_async(
        self,
        *,
        account_id: str,
        restriction_id: str,
        end_restriction_request_create: Union[
            components.EndRestrictionRequestCreate,
            components.EndRestrictionRequestCreateTypedDict,
        ],
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
    ) -> operations.AccountsEndRestrictionResponse:
        r"""End Restriction

        Ends a Restriction on an Account.

        :param account_id: The account id.
        :param restriction_id: The restriction id.
        :param end_restriction_request_create:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url

        request = operations.AccountsEndRestrictionRequest(
            account_id=account_id,
            restriction_id=restriction_id,
            end_restriction_request_create=utils.get_pydantic_model(
                end_restriction_request_create, components.EndRestrictionRequestCreate
            ),
        )

        req = self.build_request_async(
            method="POST",
            path="/accounts/v1/accounts/{account_id}/restrictions/{restriction_id}:end",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.end_restriction_request_create,
                False,
                False,
                "json",
                components.EndRestrictionRequestCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                operation_id="Accounts_EndRestriction",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=["400", "403", "404", "4XX", "500", "503", "5XX"],
            retry_config=retry_config,
        )

        data: Any = None
        if utils.match_response(http_res, "200", "*"):
            return operations.AccountsEndRestrictionResponse(
                http_meta=components.HTTPMetadata(request=req, response=http_res)
            )
        if utils.match_response(
            http_res, ["400", "403", "404", "500", "503"], "application/json"
        ):
            data = utils.unmarshal_json(http_res.text, errors.StatusData)
            raise errors.Status(data=data)
        if utils.match_response(http_res, ["4XX", "5XX"], "*"):
            raise errors.SDKError(
                "API error occurred", http_res.status_code, http_res.text, http_res
            )
        if utils.match_response(http_res, "default", "application/json"):
            return operations.AccountsEndRestrictionResponse(
                status=utils.unmarshal_json(http_res.text, Optional[components.Status]),
                http_meta=components.HTTPMetadata(request=req, response=http_res),
            )

        content_type = http_res.headers.get("Content-Type")
        raise errors.SDKError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res.text,
            http_res,
        )
