# 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.list_project_member_scopes_v1response import ListProjectMemberScopesV1Response
from ......types.update_project_member_scopes_v1response import UpdateProjectMemberScopesV1Response
from .raw_client import AsyncRawScopesClient, RawScopesClient

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


class ScopesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawScopesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawScopesClient
        """
        return self._raw_client

    def list(
        self, project_id: str, member_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectMemberScopesV1Response:
        """
        Retrieves a list of scopes for a specific member

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        member_id : str
            The unique identifier of the Member

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

        Returns
        -------
        ListProjectMemberScopesV1Response
            A list of scopes for a specific member

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.members.scopes.list(
            project_id="123456-7890-1234-5678-901234",
            member_id="123456789012345678901234",
        )
        """
        _response = self._raw_client.list(project_id, member_id, request_options=request_options)
        return _response.data

    def update(
        self, project_id: str, member_id: str, *, scope: str, request_options: typing.Optional[RequestOptions] = None
    ) -> UpdateProjectMemberScopesV1Response:
        """
        Updates the scopes for a specific member

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        member_id : str
            The unique identifier of the Member

        scope : str
            A scope to update

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

        Returns
        -------
        UpdateProjectMemberScopesV1Response
            Updated the scopes for a specific member

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.members.scopes.update(
            project_id="123456-7890-1234-5678-901234",
            member_id="123456789012345678901234",
            scope="admin",
        )
        """
        _response = self._raw_client.update(project_id, member_id, scope=scope, request_options=request_options)
        return _response.data


class AsyncScopesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawScopesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawScopesClient
        """
        return self._raw_client

    async def list(
        self, project_id: str, member_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectMemberScopesV1Response:
        """
        Retrieves a list of scopes for a specific member

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        member_id : str
            The unique identifier of the Member

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

        Returns
        -------
        ListProjectMemberScopesV1Response
            A list of scopes for a specific member

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.members.scopes.list(
                project_id="123456-7890-1234-5678-901234",
                member_id="123456789012345678901234",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list(project_id, member_id, request_options=request_options)
        return _response.data

    async def update(
        self, project_id: str, member_id: str, *, scope: str, request_options: typing.Optional[RequestOptions] = None
    ) -> UpdateProjectMemberScopesV1Response:
        """
        Updates the scopes for a specific member

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        member_id : str
            The unique identifier of the Member

        scope : str
            A scope to update

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

        Returns
        -------
        UpdateProjectMemberScopesV1Response
            Updated the scopes for a specific member

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.members.scopes.update(
                project_id="123456-7890-1234-5678-901234",
                member_id="123456789012345678901234",
                scope="admin",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(project_id, member_id, scope=scope, request_options=request_options)
        return _response.data
