# This file was auto-generated by Fern from our API Definition.

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from .raw_client import AsyncRawAccesstokensClient, RawAccesstokensClient
from .types.issue_temporary_access_token_response import IssueTemporaryAccessTokenResponse

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class AccesstokensClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAccesstokensClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawAccesstokensClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawAccesstokensClient
        """
        return self._raw_client

    def issue_temporary_access_token(
        self, *, lookup: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> IssueTemporaryAccessTokenResponse:
        """
        Parameters
        ----------
        lookup : typing.Dict[str, str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        IssueTemporaryAccessTokenResponse
            Created

        Examples
        --------
        from schematic import Schematic

        client = Schematic(
            api_key="YOUR_API_KEY",
        )
        client.accesstokens.issue_temporary_access_token(
            lookup={"key": "value"},
        )
        """
        _response = self._raw_client.issue_temporary_access_token(lookup=lookup, request_options=request_options)
        return _response.data


class AsyncAccesstokensClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAccesstokensClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawAccesstokensClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawAccesstokensClient
        """
        return self._raw_client

    async def issue_temporary_access_token(
        self, *, lookup: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> IssueTemporaryAccessTokenResponse:
        """
        Parameters
        ----------
        lookup : typing.Dict[str, str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        IssueTemporaryAccessTokenResponse
            Created

        Examples
        --------
        import asyncio

        from schematic import AsyncSchematic

        client = AsyncSchematic(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.accesstokens.issue_temporary_access_token(
                lookup={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.issue_temporary_access_token(lookup=lookup, request_options=request_options)
        return _response.data
