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

from ...core.client_wrapper import SyncClientWrapper
from .raw_client import RawEventTypesClient
import typing
from ...core.request_options import RequestOptions
from ...types.list_webhook_event_types_response import ListWebhookEventTypesResponse
from ...core.client_wrapper import AsyncClientWrapper
from .raw_client import AsyncRawEventTypesClient


class EventTypesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawEventTypesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawEventTypesClient
        """
        return self._raw_client

    def list(
        self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> ListWebhookEventTypesResponse:
        """
        Lists all webhook event types that can be subscribed to.

        Parameters
        ----------
        api_version : typing.Optional[str]
            The API version for which to list event types. Setting this field overrides the default version used by the application.

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

        Returns
        -------
        ListWebhookEventTypesResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.webhooks.event_types.list()
        """
        response = self._raw_client.list(api_version=api_version, request_options=request_options)
        return response.data


class AsyncEventTypesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawEventTypesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawEventTypesClient
        """
        return self._raw_client

    async def list(
        self, *, api_version: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> ListWebhookEventTypesResponse:
        """
        Lists all webhook event types that can be subscribed to.

        Parameters
        ----------
        api_version : typing.Optional[str]
            The API version for which to list event types. Setting this field overrides the default version used by the application.

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

        Returns
        -------
        ListWebhookEventTypesResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.webhooks.event_types.list()


        asyncio.run(main())
        """
        response = await self._raw_client.list(api_version=api_version, request_options=request_options)
        return response.data
