# 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 AsyncRawWhoisClient, RawWhoisClient
from .types.whois_response import WhoisResponse


class WhoisClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawWhoisClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawWhoisClient
        """
        return self._raw_client

    def get_whois(
        self, *, api_key: str, whois: str, domain_name: str, request_options: typing.Optional[RequestOptions] = None
    ) -> WhoisResponse:
        """
        Get WHOIS information for a domain

        Parameters
        ----------
        api_key : str

        whois : str

        domain_name : str

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

        Returns
        -------
        WhoisResponse

        Examples
        --------
        from whoisfreaks import WhoisfreaksApi
        client = WhoisfreaksApi(base_url="https://yourhost.com/path/to/api", )
        client.whois.get_whois(api_key='YOUR_API_KEY', whois='live', domain_name='888starzci.ci', )
        """
        _response = self._raw_client.get_whois(
            api_key=api_key, whois=whois, domain_name=domain_name, request_options=request_options
        )
        return _response.data


class AsyncWhoisClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawWhoisClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawWhoisClient
        """
        return self._raw_client

    async def get_whois(
        self, *, api_key: str, whois: str, domain_name: str, request_options: typing.Optional[RequestOptions] = None
    ) -> WhoisResponse:
        """
        Get WHOIS information for a domain

        Parameters
        ----------
        api_key : str

        whois : str

        domain_name : str

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

        Returns
        -------
        WhoisResponse

        Examples
        --------
        from whoisfreaks import AsyncWhoisfreaksApi
        import asyncio
        client = AsyncWhoisfreaksApi(base_url="https://yourhost.com/path/to/api", )
        async def main() -> None:
            await client.whois.get_whois(api_key='YOUR_API_KEY', whois='live', domain_name='888starzci.ci', )
        asyncio.run(main())
        """
        _response = await self._raw_client.get_whois(
            api_key=api_key, whois=whois, domain_name=domain_name, request_options=request_options
        )
        return _response.data
