# 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.cross_env_secrets_list_response import CrossEnvSecretsListResponse
from .raw_client import AsyncRawSecretsClient, RawSecretsClient


class SecretsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawSecretsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawSecretsClient
        """
        return self._raw_client

    def list(
        self,
        namespace_slug: str,
        agent_name: str,
        *,
        include_values: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CrossEnvSecretsListResponse:
        """
        Cross-environment view of all secrets for an agent.

            Shows which keys exist in which environments.
            Never returns actual secret values (is_secret=True).
            Values for non-secrets only returned when include_values=True.

        Parameters
        ----------
        namespace_slug : str

        agent_name : str

        include_values : typing.Optional[bool]
            Include values for non-secrets (is_secret=False only)

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

        Returns
        -------
        CrossEnvSecretsListResponse
            Successful Response

        Examples
        --------
        from terminaluse import TerminalUseBase

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.agents.secrets.list(
            namespace_slug="namespace_slug",
            agent_name="agent_name",
        )
        """
        _response = self._raw_client.list(
            namespace_slug, agent_name, include_values=include_values, request_options=request_options
        )
        return _response.data


class AsyncSecretsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawSecretsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawSecretsClient
        """
        return self._raw_client

    async def list(
        self,
        namespace_slug: str,
        agent_name: str,
        *,
        include_values: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CrossEnvSecretsListResponse:
        """
        Cross-environment view of all secrets for an agent.

            Shows which keys exist in which environments.
            Never returns actual secret values (is_secret=True).
            Values for non-secrets only returned when include_values=True.

        Parameters
        ----------
        namespace_slug : str

        agent_name : str

        include_values : typing.Optional[bool]
            Include values for non-secrets (is_secret=False only)

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

        Returns
        -------
        CrossEnvSecretsListResponse
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import AsyncTerminalUseBase

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.agents.secrets.list(
                namespace_slug="namespace_slug",
                agent_name="agent_name",
            )


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