# 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 ..prompts.types.prompt import Prompt
from .raw_client import AsyncRawPromptVersionClient, RawPromptVersionClient

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


class PromptVersionClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawPromptVersionClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawPromptVersionClient
        """
        return self._raw_client

    def update(
        self,
        name: str,
        version: int,
        *,
        new_labels: typing.Sequence[str],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Prompt:
        """
        Update labels for a specific prompt version

        Parameters
        ----------
        name : str
            The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"),
            the folder path must be URL encoded.

        version : int
            Version of the prompt to update

        new_labels : typing.Sequence[str]
            New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse.

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

        Returns
        -------
        Prompt

        Examples
        --------
        from langfuse import LangfuseAPI

        client = LangfuseAPI(
            x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME",
            x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION",
            x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY",
            username="YOUR_USERNAME",
            password="YOUR_PASSWORD",
            base_url="https://yourhost.com/path/to/api",
        )
        client.prompt_version.update(
            name="name",
            version=1,
            new_labels=["newLabels", "newLabels"],
        )
        """
        _response = self._raw_client.update(
            name, version, new_labels=new_labels, request_options=request_options
        )
        return _response.data


class AsyncPromptVersionClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawPromptVersionClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawPromptVersionClient
        """
        return self._raw_client

    async def update(
        self,
        name: str,
        version: int,
        *,
        new_labels: typing.Sequence[str],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> Prompt:
        """
        Update labels for a specific prompt version

        Parameters
        ----------
        name : str
            The name of the prompt. If the prompt is in a folder (e.g., "folder/subfolder/prompt-name"),
            the folder path must be URL encoded.

        version : int
            Version of the prompt to update

        new_labels : typing.Sequence[str]
            New labels for the prompt version. Labels are unique across versions. The "latest" label is reserved and managed by Langfuse.

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

        Returns
        -------
        Prompt

        Examples
        --------
        import asyncio

        from langfuse import AsyncLangfuseAPI

        client = AsyncLangfuseAPI(
            x_langfuse_sdk_name="YOUR_X_LANGFUSE_SDK_NAME",
            x_langfuse_sdk_version="YOUR_X_LANGFUSE_SDK_VERSION",
            x_langfuse_public_key="YOUR_X_LANGFUSE_PUBLIC_KEY",
            username="YOUR_USERNAME",
            password="YOUR_PASSWORD",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.prompt_version.update(
                name="name",
                version=1,
                new_labels=["newLabels", "newLabels"],
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            name, version, new_labels=new_labels, request_options=request_options
        )
        return _response.data
