# 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.create_project_distribution_credentials_v1response import CreateProjectDistributionCredentialsV1Response
from ....types.get_project_distribution_credentials_v1response import GetProjectDistributionCredentialsV1Response
from ....types.list_project_distribution_credentials_v1response import ListProjectDistributionCredentialsV1Response
from .raw_client import AsyncRawDistributionCredentialsClient, RawDistributionCredentialsClient
from .types.distribution_credentials_create_request_scopes_item import DistributionCredentialsCreateRequestScopesItem

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


class DistributionCredentialsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawDistributionCredentialsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawDistributionCredentialsClient
        """
        return self._raw_client

    def list(
        self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectDistributionCredentialsV1Response:
        """
        Lists sets of distribution credentials for the specified project

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

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

        Returns
        -------
        ListProjectDistributionCredentialsV1Response
            A list of distribution credentials for a specific project

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

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.self_hosted.v1.distribution_credentials.list(
            project_id="123456-7890-1234-5678-901234",
        )
        """
        _response = self._raw_client.list(project_id, request_options=request_options)
        return _response.data

    def create(
        self,
        project_id: str,
        *,
        scopes: typing.Optional[
            typing.Union[
                DistributionCredentialsCreateRequestScopesItem,
                typing.Sequence[DistributionCredentialsCreateRequestScopesItem],
            ]
        ] = None,
        provider: typing.Optional[typing.Literal["quay"]] = None,
        comment: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateProjectDistributionCredentialsV1Response:
        """
        Creates a set of distribution credentials for the specified project

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

        scopes : typing.Optional[typing.Union[DistributionCredentialsCreateRequestScopesItem, typing.Sequence[DistributionCredentialsCreateRequestScopesItem]]]
            List of permission scopes for the credentials

        provider : typing.Optional[typing.Literal["quay"]]
            The provider of the distribution service

        comment : typing.Optional[str]
            Optional comment about the credentials

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

        Returns
        -------
        CreateProjectDistributionCredentialsV1Response
            Single distribution credential

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

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.self_hosted.v1.distribution_credentials.create(
            project_id="123456-7890-1234-5678-901234",
        )
        """
        _response = self._raw_client.create(
            project_id, scopes=scopes, provider=provider, comment=comment, request_options=request_options
        )
        return _response.data

    def get(
        self,
        project_id: str,
        distribution_credentials_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetProjectDistributionCredentialsV1Response:
        """
        Returns a set of distribution credentials for the specified project

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

        distribution_credentials_id : str
            The UUID of the distribution credentials

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

        Returns
        -------
        GetProjectDistributionCredentialsV1Response
            Single distribution credential

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

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.self_hosted.v1.distribution_credentials.get(
            project_id="123456-7890-1234-5678-901234",
            distribution_credentials_id="8b36cfd0-472f-4a21-833f-2d6343c3a2f3",
        )
        """
        _response = self._raw_client.get(project_id, distribution_credentials_id, request_options=request_options)
        return _response.data

    def delete(
        self,
        project_id: str,
        distribution_credentials_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetProjectDistributionCredentialsV1Response:
        """
        Deletes a set of distribution credentials for the specified project

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

        distribution_credentials_id : str
            The UUID of the distribution credentials

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

        Returns
        -------
        GetProjectDistributionCredentialsV1Response
            Single distribution credential

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

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.self_hosted.v1.distribution_credentials.delete(
            project_id="123456-7890-1234-5678-901234",
            distribution_credentials_id="8b36cfd0-472f-4a21-833f-2d6343c3a2f3",
        )
        """
        _response = self._raw_client.delete(project_id, distribution_credentials_id, request_options=request_options)
        return _response.data


class AsyncDistributionCredentialsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawDistributionCredentialsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawDistributionCredentialsClient
        """
        return self._raw_client

    async def list(
        self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectDistributionCredentialsV1Response:
        """
        Lists sets of distribution credentials for the specified project

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

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

        Returns
        -------
        ListProjectDistributionCredentialsV1Response
            A list of distribution credentials for a specific project

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.self_hosted.v1.distribution_credentials.list(
                project_id="123456-7890-1234-5678-901234",
            )


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

    async def create(
        self,
        project_id: str,
        *,
        scopes: typing.Optional[
            typing.Union[
                DistributionCredentialsCreateRequestScopesItem,
                typing.Sequence[DistributionCredentialsCreateRequestScopesItem],
            ]
        ] = None,
        provider: typing.Optional[typing.Literal["quay"]] = None,
        comment: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateProjectDistributionCredentialsV1Response:
        """
        Creates a set of distribution credentials for the specified project

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

        scopes : typing.Optional[typing.Union[DistributionCredentialsCreateRequestScopesItem, typing.Sequence[DistributionCredentialsCreateRequestScopesItem]]]
            List of permission scopes for the credentials

        provider : typing.Optional[typing.Literal["quay"]]
            The provider of the distribution service

        comment : typing.Optional[str]
            Optional comment about the credentials

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

        Returns
        -------
        CreateProjectDistributionCredentialsV1Response
            Single distribution credential

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.self_hosted.v1.distribution_credentials.create(
                project_id="123456-7890-1234-5678-901234",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            project_id, scopes=scopes, provider=provider, comment=comment, request_options=request_options
        )
        return _response.data

    async def get(
        self,
        project_id: str,
        distribution_credentials_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetProjectDistributionCredentialsV1Response:
        """
        Returns a set of distribution credentials for the specified project

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

        distribution_credentials_id : str
            The UUID of the distribution credentials

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

        Returns
        -------
        GetProjectDistributionCredentialsV1Response
            Single distribution credential

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.self_hosted.v1.distribution_credentials.get(
                project_id="123456-7890-1234-5678-901234",
                distribution_credentials_id="8b36cfd0-472f-4a21-833f-2d6343c3a2f3",
            )


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

    async def delete(
        self,
        project_id: str,
        distribution_credentials_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetProjectDistributionCredentialsV1Response:
        """
        Deletes a set of distribution credentials for the specified project

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

        distribution_credentials_id : str
            The UUID of the distribution credentials

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

        Returns
        -------
        GetProjectDistributionCredentialsV1Response
            Single distribution credential

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.self_hosted.v1.distribution_credentials.delete(
                project_id="123456-7890-1234-5678-901234",
                distribution_credentials_id="8b36cfd0-472f-4a21-833f-2d6343c3a2f3",
            )


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