# 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 AsyncRawApiKeysClient, RawApiKeysClient
from .types.api_keys_create_response import ApiKeysCreateResponse
from .types.api_keys_get_response import ApiKeysGetResponse
from .types.api_keys_list_response_item import ApiKeysListResponseItem

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


class ApiKeysClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawApiKeysClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawApiKeysClient
        """
        return self._raw_client

    def api_keys_list(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[ApiKeysListResponseItem]:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

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

        Returns
        -------
        typing.List[ApiKeysListResponseItem]
            Success

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.api_keys.api_keys_list(
            organization_id="organizationId",
            project_id="projectId",
            environment_id="environmentId",
        )
        """
        _response = self._raw_client.api_keys_list(
            organization_id, project_id, environment_id, request_options=request_options
        )
        return _response.data

    def api_keys_create(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        *,
        name: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ApiKeysCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

        name : str
            a string at most 100 character(s) long

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

        Returns
        -------
        ApiKeysCreateResponse
            Success

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.api_keys.api_keys_create(
            organization_id="organizationId",
            project_id="projectId",
            environment_id="environmentId",
            name="name",
        )
        """
        _response = self._raw_client.api_keys_create(
            organization_id, project_id, environment_id, name=name, request_options=request_options
        )
        return _response.data

    def api_keys_get(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        api_key_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ApiKeysGetResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

        api_key_id : str

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

        Returns
        -------
        ApiKeysGetResponse
            Success

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.api_keys.api_keys_get(
            organization_id="organizationId",
            project_id="projectId",
            environment_id="environmentId",
            api_key_id="apiKeyId",
        )
        """
        _response = self._raw_client.api_keys_get(
            organization_id, project_id, environment_id, api_key_id, request_options=request_options
        )
        return _response.data

    def api_keys_delete(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        api_key_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

        api_key_id : str

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

        Returns
        -------
        None

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.api_keys.api_keys_delete(
            organization_id="organizationId",
            project_id="projectId",
            environment_id="environmentId",
            api_key_id="apiKeyId",
        )
        """
        _response = self._raw_client.api_keys_delete(
            organization_id, project_id, environment_id, api_key_id, request_options=request_options
        )
        return _response.data


class AsyncApiKeysClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawApiKeysClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawApiKeysClient
        """
        return self._raw_client

    async def api_keys_list(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[ApiKeysListResponseItem]:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

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

        Returns
        -------
        typing.List[ApiKeysListResponseItem]
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.api_keys.api_keys_list(
                organization_id="organizationId",
                project_id="projectId",
                environment_id="environmentId",
            )


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

    async def api_keys_create(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        *,
        name: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ApiKeysCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

        name : str
            a string at most 100 character(s) long

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

        Returns
        -------
        ApiKeysCreateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.api_keys.api_keys_create(
                organization_id="organizationId",
                project_id="projectId",
                environment_id="environmentId",
                name="name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.api_keys_create(
            organization_id, project_id, environment_id, name=name, request_options=request_options
        )
        return _response.data

    async def api_keys_get(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        api_key_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ApiKeysGetResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

        api_key_id : str

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

        Returns
        -------
        ApiKeysGetResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.api_keys.api_keys_get(
                organization_id="organizationId",
                project_id="projectId",
                environment_id="environmentId",
                api_key_id="apiKeyId",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.api_keys_get(
            organization_id, project_id, environment_id, api_key_id, request_options=request_options
        )
        return _response.data

    async def api_keys_delete(
        self,
        organization_id: str,
        project_id: str,
        environment_id: str,
        api_key_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        environment_id : str

        api_key_id : str

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.api_keys.api_keys_delete(
                organization_id="organizationId",
                project_id="projectId",
                environment_id="environmentId",
                api_key_id="apiKeyId",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.api_keys_delete(
            organization_id, project_id, environment_id, api_key_id, request_options=request_options
        )
        return _response.data
