# 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 ..types.zoom_o_auth_success_response import ZoomOAuthSuccessResponse
from .raw_client import AsyncRawZoomOauthClient, RawZoomOauthClient


class ZoomOauthClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawZoomOauthClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawZoomOauthClient
        """
        return self._raw_client

    def refresh_token(
        self, *, instance_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> ZoomOAuthSuccessResponse:
        """
        Parameters
        ----------
        instance_id : str
            Instance ID for which to refresh the token

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

        Returns
        -------
        ZoomOAuthSuccessResponse
            Successful Response

        Examples
        --------
        from klavis import Klavis

        client = Klavis(
            api_key="YOUR_API_KEY",
        )
        client.zoom_oauth.refresh_token(
            instance_id="instance_id",
        )
        """
        _response = self._raw_client.refresh_token(instance_id=instance_id, request_options=request_options)
        return _response.data


class AsyncZoomOauthClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawZoomOauthClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawZoomOauthClient
        """
        return self._raw_client

    async def refresh_token(
        self, *, instance_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> ZoomOAuthSuccessResponse:
        """
        Parameters
        ----------
        instance_id : str
            Instance ID for which to refresh the token

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

        Returns
        -------
        ZoomOAuthSuccessResponse
            Successful Response

        Examples
        --------
        import asyncio

        from klavis import AsyncKlavis

        client = AsyncKlavis(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.zoom_oauth.refresh_token(
                instance_id="instance_id",
            )


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