# 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.block_input import BlockInput
from ..types.placeholder_input import PlaceholderInput
from ..types.src_handlers_create_workflow_response import SrcHandlersCreateWorkflowResponse
from ..types.src_handlers_create_workflow_revision_response import SrcHandlersCreateWorkflowRevisionResponse
from ..types.src_handlers_delete_workflow_response import SrcHandlersDeleteWorkflowResponse
from ..types.src_handlers_get_workflow_response import SrcHandlersGetWorkflowResponse
from ..types.src_handlers_list_workflows_response import SrcHandlersListWorkflowsResponse
from ..types.src_handlers_update_workflow_response import SrcHandlersUpdateWorkflowResponse
from ..types.workflow_config_input import WorkflowConfigInput
from ..types.workflow_note_input import WorkflowNoteInput
from ..types.workflow_run_response import WorkflowRunResponse
from ..types.workflow_run_stream_response import WorkflowRunStreamResponse
from .raw_client import AsyncRawWorkflowsClient, RawWorkflowsClient
from .types.src_handlers_workflows_execute_with_config_req_body_inputs_value import (
    SrcHandlersWorkflowsExecuteWithConfigReqBodyInputsValue,
)
from .types.workflows_run_request_inputs_value import WorkflowsRunRequestInputsValue
from .types.workflows_run_stream_request_inputs_value import WorkflowsRunStreamRequestInputsValue
from .types.workflows_run_with_config_response import WorkflowsRunWithConfigResponse

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


class WorkflowsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawWorkflowsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawWorkflowsClient
        """
        return self._raw_client

    def create_revision(
        self,
        *,
        workflow_id: typing.Optional[str] = None,
        workflow_key: typing.Optional[str] = None,
        workflow_display_name: typing.Optional[str] = OMIT,
        workflow_schema_version: typing.Optional[str] = OMIT,
        workflow_img_url: typing.Optional[str] = OMIT,
        workflow_description: typing.Optional[str] = OMIT,
        blocks: typing.Optional[typing.Sequence[BlockInput]] = OMIT,
        notes: typing.Optional[typing.Sequence[WorkflowNoteInput]] = OMIT,
        placeholders: typing.Optional[typing.Sequence[PlaceholderInput]] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        is_tool: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersCreateWorkflowRevisionResponse:
        """
        Parameters
        ----------
        workflow_id : typing.Optional[str]

        workflow_key : typing.Optional[str]

        workflow_display_name : typing.Optional[str]

        workflow_schema_version : typing.Optional[str]

        workflow_img_url : typing.Optional[str]

        workflow_description : typing.Optional[str]

        blocks : typing.Optional[typing.Sequence[BlockInput]]

        notes : typing.Optional[typing.Sequence[WorkflowNoteInput]]

        placeholders : typing.Optional[typing.Sequence[PlaceholderInput]]

        tags : typing.Optional[typing.Sequence[str]]

        is_tool : typing.Optional[bool]

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

        Returns
        -------
        SrcHandlersCreateWorkflowRevisionResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.create_revision()
        """
        _response = self._raw_client.create_revision(
            workflow_id=workflow_id,
            workflow_key=workflow_key,
            workflow_display_name=workflow_display_name,
            workflow_schema_version=workflow_schema_version,
            workflow_img_url=workflow_img_url,
            workflow_description=workflow_description,
            blocks=blocks,
            notes=notes,
            placeholders=placeholders,
            tags=tags,
            is_tool=is_tool,
            request_options=request_options,
        )
        return _response.data

    def list(
        self,
        *,
        sort: typing.Optional[str] = None,
        direction: typing.Optional[str] = None,
        start_at: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        query: typing.Optional[str] = None,
        tags: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersListWorkflowsResponse:
        """
        List all workflows in the organization

        Parameters
        ----------
        sort : typing.Optional[str]
            Field to sort by

        direction : typing.Optional[str]
            Sort in ascending or descending order

        start_at : typing.Optional[str]
            created_at to start at

        limit : typing.Optional[int]
            Limit of records to return

        query : typing.Optional[str]
            Search query

        tags : typing.Optional[str]
            Filter by tags

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

        Returns
        -------
        SrcHandlersListWorkflowsResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.list()
        """
        _response = self._raw_client.list(
            sort=sort,
            direction=direction,
            start_at=start_at,
            limit=limit,
            query=query,
            tags=tags,
            request_options=request_options,
        )
        return _response.data

    def create(
        self,
        *,
        workflow_key: typing.Optional[str] = None,
        workflow_display_name: typing.Optional[str] = OMIT,
        workflow_schema_version: typing.Optional[str] = OMIT,
        workflow_img_url: typing.Optional[str] = OMIT,
        workflow_description: typing.Optional[str] = OMIT,
        blocks: typing.Optional[typing.Sequence[BlockInput]] = OMIT,
        notes: typing.Optional[typing.Sequence[WorkflowNoteInput]] = OMIT,
        placeholders: typing.Optional[typing.Sequence[PlaceholderInput]] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        is_tool: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersCreateWorkflowResponse:
        """
        Parameters
        ----------
        workflow_key : typing.Optional[str]
            A unique key to identify the workflow

        workflow_display_name : typing.Optional[str]

        workflow_schema_version : typing.Optional[str]

        workflow_img_url : typing.Optional[str]

        workflow_description : typing.Optional[str]

        blocks : typing.Optional[typing.Sequence[BlockInput]]

        notes : typing.Optional[typing.Sequence[WorkflowNoteInput]]

        placeholders : typing.Optional[typing.Sequence[PlaceholderInput]]

        tags : typing.Optional[typing.Sequence[str]]

        is_tool : typing.Optional[bool]

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

        Returns
        -------
        SrcHandlersCreateWorkflowResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.create()
        """
        _response = self._raw_client.create(
            workflow_key=workflow_key,
            workflow_display_name=workflow_display_name,
            workflow_schema_version=workflow_schema_version,
            workflow_img_url=workflow_img_url,
            workflow_description=workflow_description,
            blocks=blocks,
            notes=notes,
            placeholders=placeholders,
            tags=tags,
            is_tool=is_tool,
            request_options=request_options,
        )
        return _response.data

    def get(
        self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersGetWorkflowResponse:
        """
        Fetch app configuration by ID.

        Parameters
        ----------
        workflow_id : str

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

        Returns
        -------
        SrcHandlersGetWorkflowResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.get(
            workflow_id="workflow_id",
        )
        """
        _response = self._raw_client.get(workflow_id, request_options=request_options)
        return _response.data

    def update(
        self,
        workflow_id: str,
        *,
        workflow_display_name: typing.Optional[str] = OMIT,
        workflow_schema_version: typing.Optional[str] = OMIT,
        workflow_img_url: typing.Optional[str] = OMIT,
        workflow_description: typing.Optional[str] = OMIT,
        blocks: typing.Optional[typing.Sequence[BlockInput]] = OMIT,
        notes: typing.Optional[typing.Sequence[WorkflowNoteInput]] = OMIT,
        placeholders: typing.Optional[typing.Sequence[PlaceholderInput]] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        is_tool: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersUpdateWorkflowResponse:
        """
        Parameters
        ----------
        workflow_id : str

        workflow_display_name : typing.Optional[str]

        workflow_schema_version : typing.Optional[str]

        workflow_img_url : typing.Optional[str]

        workflow_description : typing.Optional[str]

        blocks : typing.Optional[typing.Sequence[BlockInput]]

        notes : typing.Optional[typing.Sequence[WorkflowNoteInput]]

        placeholders : typing.Optional[typing.Sequence[PlaceholderInput]]

        tags : typing.Optional[typing.Sequence[str]]

        is_tool : typing.Optional[bool]

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

        Returns
        -------
        SrcHandlersUpdateWorkflowResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.update(
            workflow_id="workflow_id",
        )
        """
        _response = self._raw_client.update(
            workflow_id,
            workflow_display_name=workflow_display_name,
            workflow_schema_version=workflow_schema_version,
            workflow_img_url=workflow_img_url,
            workflow_description=workflow_description,
            blocks=blocks,
            notes=notes,
            placeholders=placeholders,
            tags=tags,
            is_tool=is_tool,
            request_options=request_options,
        )
        return _response.data

    def delete(
        self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersDeleteWorkflowResponse:
        """
        Parameters
        ----------
        workflow_id : str

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

        Returns
        -------
        SrcHandlersDeleteWorkflowResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.delete(
            workflow_id="workflow_id",
        )
        """
        _response = self._raw_client.delete(workflow_id, request_options=request_options)
        return _response.data

    def run_stream(
        self,
        workflow_id: str,
        *,
        environment: typing.Optional[str] = None,
        revision_id: typing.Optional[str] = None,
        session_id: typing.Optional[str] = None,
        inputs: typing.Optional[typing.Dict[str, WorkflowsRunStreamRequestInputsValue]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Iterator[WorkflowRunStreamResponse]:
        """
        Parameters
        ----------
        workflow_id : str

        environment : typing.Optional[str]
            Specifies the execution environment for the workflow. The available environments include:
            - `production`: The production environment, where workflows are executed under live conditions.
            - `staging`: A staging environment used for testing prior to production deployment.
            - `development`: A development environment used for testing new changes.
            - `console`: The console environment, runs latest changes on a workflow.

        revision_id : typing.Optional[str]

        session_id : typing.Optional[str]

        inputs : typing.Optional[typing.Dict[str, WorkflowsRunStreamRequestInputsValue]]

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

        Yields
        ------
        typing.Iterator[WorkflowRunStreamResponse]


        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        response = client.workflows.run_stream(
            workflow_id="workflow_id",
        )
        for chunk in response:
            yield chunk
        """
        with self._raw_client.run_stream(
            workflow_id,
            environment=environment,
            revision_id=revision_id,
            session_id=session_id,
            inputs=inputs,
            request_options=request_options,
        ) as r:
            yield from r.data

    def run(
        self,
        workflow_id: str,
        *,
        environment: typing.Optional[str] = None,
        revision_id: typing.Optional[str] = None,
        session_id: typing.Optional[str] = None,
        inputs: typing.Optional[typing.Dict[str, WorkflowsRunRequestInputsValue]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> WorkflowRunResponse:
        """
        Parameters
        ----------
        workflow_id : str

        environment : typing.Optional[str]
            Specifies the execution environment for the workflow. The available environments include:
            - `production`: The production environment, where workflows are executed under live conditions.
            - `staging`: A staging environment used for testing prior to production deployment.
            - `development`: A development environment used for testing new changes.
            - `console`: The console environment, runs latest changes on a workflow.

        revision_id : typing.Optional[str]

        session_id : typing.Optional[str]

        inputs : typing.Optional[typing.Dict[str, WorkflowsRunRequestInputsValue]]

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

        Returns
        -------
        WorkflowRunResponse


        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.run(
            workflow_id="workflow_id",
        )
        """
        _response = self._raw_client.run(
            workflow_id,
            environment=environment,
            revision_id=revision_id,
            session_id=session_id,
            inputs=inputs,
            request_options=request_options,
        )
        return _response.data

    def run_with_config(
        self,
        *,
        workflow_config: WorkflowConfigInput,
        environment: typing.Optional[str] = None,
        revision_id: typing.Optional[str] = None,
        session_id: typing.Optional[str] = None,
        workflow_key: typing.Optional[str] = OMIT,
        inputs: typing.Optional[typing.Dict[str, SrcHandlersWorkflowsExecuteWithConfigReqBodyInputsValue]] = OMIT,
        streaming: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> WorkflowsRunWithConfigResponse:
        """
        Parameters
        ----------
        workflow_config : WorkflowConfigInput

        environment : typing.Optional[str]
            Specifies the execution environment for the workflow. The available environments include:
            - `production`: The production environment, where workflows are executed under live conditions.
            - `staging`: A staging environment used for testing prior to production deployment.
            - `development`: A development environment used for testing new changes.
            - `console`: The console environment, runs latest changes on a workflow.

        revision_id : typing.Optional[str]

        session_id : typing.Optional[str]

        workflow_key : typing.Optional[str]

        inputs : typing.Optional[typing.Dict[str, SrcHandlersWorkflowsExecuteWithConfigReqBodyInputsValue]]

        streaming : typing.Optional[bool]

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

        Returns
        -------
        WorkflowsRunWithConfigResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout, WorkflowConfigInput

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.workflows.run_with_config(
            workflow_config=WorkflowConfigInput(),
        )
        """
        _response = self._raw_client.run_with_config(
            workflow_config=workflow_config,
            environment=environment,
            revision_id=revision_id,
            session_id=session_id,
            workflow_key=workflow_key,
            inputs=inputs,
            streaming=streaming,
            request_options=request_options,
        )
        return _response.data


class AsyncWorkflowsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawWorkflowsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawWorkflowsClient
        """
        return self._raw_client

    async def create_revision(
        self,
        *,
        workflow_id: typing.Optional[str] = None,
        workflow_key: typing.Optional[str] = None,
        workflow_display_name: typing.Optional[str] = OMIT,
        workflow_schema_version: typing.Optional[str] = OMIT,
        workflow_img_url: typing.Optional[str] = OMIT,
        workflow_description: typing.Optional[str] = OMIT,
        blocks: typing.Optional[typing.Sequence[BlockInput]] = OMIT,
        notes: typing.Optional[typing.Sequence[WorkflowNoteInput]] = OMIT,
        placeholders: typing.Optional[typing.Sequence[PlaceholderInput]] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        is_tool: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersCreateWorkflowRevisionResponse:
        """
        Parameters
        ----------
        workflow_id : typing.Optional[str]

        workflow_key : typing.Optional[str]

        workflow_display_name : typing.Optional[str]

        workflow_schema_version : typing.Optional[str]

        workflow_img_url : typing.Optional[str]

        workflow_description : typing.Optional[str]

        blocks : typing.Optional[typing.Sequence[BlockInput]]

        notes : typing.Optional[typing.Sequence[WorkflowNoteInput]]

        placeholders : typing.Optional[typing.Sequence[PlaceholderInput]]

        tags : typing.Optional[typing.Sequence[str]]

        is_tool : typing.Optional[bool]

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

        Returns
        -------
        SrcHandlersCreateWorkflowRevisionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.create_revision()


        asyncio.run(main())
        """
        _response = await self._raw_client.create_revision(
            workflow_id=workflow_id,
            workflow_key=workflow_key,
            workflow_display_name=workflow_display_name,
            workflow_schema_version=workflow_schema_version,
            workflow_img_url=workflow_img_url,
            workflow_description=workflow_description,
            blocks=blocks,
            notes=notes,
            placeholders=placeholders,
            tags=tags,
            is_tool=is_tool,
            request_options=request_options,
        )
        return _response.data

    async def list(
        self,
        *,
        sort: typing.Optional[str] = None,
        direction: typing.Optional[str] = None,
        start_at: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        query: typing.Optional[str] = None,
        tags: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersListWorkflowsResponse:
        """
        List all workflows in the organization

        Parameters
        ----------
        sort : typing.Optional[str]
            Field to sort by

        direction : typing.Optional[str]
            Sort in ascending or descending order

        start_at : typing.Optional[str]
            created_at to start at

        limit : typing.Optional[int]
            Limit of records to return

        query : typing.Optional[str]
            Search query

        tags : typing.Optional[str]
            Filter by tags

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

        Returns
        -------
        SrcHandlersListWorkflowsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.list()


        asyncio.run(main())
        """
        _response = await self._raw_client.list(
            sort=sort,
            direction=direction,
            start_at=start_at,
            limit=limit,
            query=query,
            tags=tags,
            request_options=request_options,
        )
        return _response.data

    async def create(
        self,
        *,
        workflow_key: typing.Optional[str] = None,
        workflow_display_name: typing.Optional[str] = OMIT,
        workflow_schema_version: typing.Optional[str] = OMIT,
        workflow_img_url: typing.Optional[str] = OMIT,
        workflow_description: typing.Optional[str] = OMIT,
        blocks: typing.Optional[typing.Sequence[BlockInput]] = OMIT,
        notes: typing.Optional[typing.Sequence[WorkflowNoteInput]] = OMIT,
        placeholders: typing.Optional[typing.Sequence[PlaceholderInput]] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        is_tool: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersCreateWorkflowResponse:
        """
        Parameters
        ----------
        workflow_key : typing.Optional[str]
            A unique key to identify the workflow

        workflow_display_name : typing.Optional[str]

        workflow_schema_version : typing.Optional[str]

        workflow_img_url : typing.Optional[str]

        workflow_description : typing.Optional[str]

        blocks : typing.Optional[typing.Sequence[BlockInput]]

        notes : typing.Optional[typing.Sequence[WorkflowNoteInput]]

        placeholders : typing.Optional[typing.Sequence[PlaceholderInput]]

        tags : typing.Optional[typing.Sequence[str]]

        is_tool : typing.Optional[bool]

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

        Returns
        -------
        SrcHandlersCreateWorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.create()


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            workflow_key=workflow_key,
            workflow_display_name=workflow_display_name,
            workflow_schema_version=workflow_schema_version,
            workflow_img_url=workflow_img_url,
            workflow_description=workflow_description,
            blocks=blocks,
            notes=notes,
            placeholders=placeholders,
            tags=tags,
            is_tool=is_tool,
            request_options=request_options,
        )
        return _response.data

    async def get(
        self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersGetWorkflowResponse:
        """
        Fetch app configuration by ID.

        Parameters
        ----------
        workflow_id : str

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

        Returns
        -------
        SrcHandlersGetWorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.get(
                workflow_id="workflow_id",
            )


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

    async def update(
        self,
        workflow_id: str,
        *,
        workflow_display_name: typing.Optional[str] = OMIT,
        workflow_schema_version: typing.Optional[str] = OMIT,
        workflow_img_url: typing.Optional[str] = OMIT,
        workflow_description: typing.Optional[str] = OMIT,
        blocks: typing.Optional[typing.Sequence[BlockInput]] = OMIT,
        notes: typing.Optional[typing.Sequence[WorkflowNoteInput]] = OMIT,
        placeholders: typing.Optional[typing.Sequence[PlaceholderInput]] = OMIT,
        tags: typing.Optional[typing.Sequence[str]] = OMIT,
        is_tool: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersUpdateWorkflowResponse:
        """
        Parameters
        ----------
        workflow_id : str

        workflow_display_name : typing.Optional[str]

        workflow_schema_version : typing.Optional[str]

        workflow_img_url : typing.Optional[str]

        workflow_description : typing.Optional[str]

        blocks : typing.Optional[typing.Sequence[BlockInput]]

        notes : typing.Optional[typing.Sequence[WorkflowNoteInput]]

        placeholders : typing.Optional[typing.Sequence[PlaceholderInput]]

        tags : typing.Optional[typing.Sequence[str]]

        is_tool : typing.Optional[bool]

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

        Returns
        -------
        SrcHandlersUpdateWorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.update(
                workflow_id="workflow_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            workflow_id,
            workflow_display_name=workflow_display_name,
            workflow_schema_version=workflow_schema_version,
            workflow_img_url=workflow_img_url,
            workflow_description=workflow_description,
            blocks=blocks,
            notes=notes,
            placeholders=placeholders,
            tags=tags,
            is_tool=is_tool,
            request_options=request_options,
        )
        return _response.data

    async def delete(
        self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersDeleteWorkflowResponse:
        """
        Parameters
        ----------
        workflow_id : str

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

        Returns
        -------
        SrcHandlersDeleteWorkflowResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.delete(
                workflow_id="workflow_id",
            )


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

    async def run_stream(
        self,
        workflow_id: str,
        *,
        environment: typing.Optional[str] = None,
        revision_id: typing.Optional[str] = None,
        session_id: typing.Optional[str] = None,
        inputs: typing.Optional[typing.Dict[str, WorkflowsRunStreamRequestInputsValue]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.AsyncIterator[WorkflowRunStreamResponse]:
        """
        Parameters
        ----------
        workflow_id : str

        environment : typing.Optional[str]
            Specifies the execution environment for the workflow. The available environments include:
            - `production`: The production environment, where workflows are executed under live conditions.
            - `staging`: A staging environment used for testing prior to production deployment.
            - `development`: A development environment used for testing new changes.
            - `console`: The console environment, runs latest changes on a workflow.

        revision_id : typing.Optional[str]

        session_id : typing.Optional[str]

        inputs : typing.Optional[typing.Dict[str, WorkflowsRunStreamRequestInputsValue]]

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

        Yields
        ------
        typing.AsyncIterator[WorkflowRunStreamResponse]


        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            response = await client.workflows.run_stream(
                workflow_id="workflow_id",
            )
            async for chunk in response:
                yield chunk


        asyncio.run(main())
        """
        async with self._raw_client.run_stream(
            workflow_id,
            environment=environment,
            revision_id=revision_id,
            session_id=session_id,
            inputs=inputs,
            request_options=request_options,
        ) as r:
            async for _chunk in r.data:
                yield _chunk

    async def run(
        self,
        workflow_id: str,
        *,
        environment: typing.Optional[str] = None,
        revision_id: typing.Optional[str] = None,
        session_id: typing.Optional[str] = None,
        inputs: typing.Optional[typing.Dict[str, WorkflowsRunRequestInputsValue]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> WorkflowRunResponse:
        """
        Parameters
        ----------
        workflow_id : str

        environment : typing.Optional[str]
            Specifies the execution environment for the workflow. The available environments include:
            - `production`: The production environment, where workflows are executed under live conditions.
            - `staging`: A staging environment used for testing prior to production deployment.
            - `development`: A development environment used for testing new changes.
            - `console`: The console environment, runs latest changes on a workflow.

        revision_id : typing.Optional[str]

        session_id : typing.Optional[str]

        inputs : typing.Optional[typing.Dict[str, WorkflowsRunRequestInputsValue]]

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

        Returns
        -------
        WorkflowRunResponse


        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.run(
                workflow_id="workflow_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.run(
            workflow_id,
            environment=environment,
            revision_id=revision_id,
            session_id=session_id,
            inputs=inputs,
            request_options=request_options,
        )
        return _response.data

    async def run_with_config(
        self,
        *,
        workflow_config: WorkflowConfigInput,
        environment: typing.Optional[str] = None,
        revision_id: typing.Optional[str] = None,
        session_id: typing.Optional[str] = None,
        workflow_key: typing.Optional[str] = OMIT,
        inputs: typing.Optional[typing.Dict[str, SrcHandlersWorkflowsExecuteWithConfigReqBodyInputsValue]] = OMIT,
        streaming: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> WorkflowsRunWithConfigResponse:
        """
        Parameters
        ----------
        workflow_config : WorkflowConfigInput

        environment : typing.Optional[str]
            Specifies the execution environment for the workflow. The available environments include:
            - `production`: The production environment, where workflows are executed under live conditions.
            - `staging`: A staging environment used for testing prior to production deployment.
            - `development`: A development environment used for testing new changes.
            - `console`: The console environment, runs latest changes on a workflow.

        revision_id : typing.Optional[str]

        session_id : typing.Optional[str]

        workflow_key : typing.Optional[str]

        inputs : typing.Optional[typing.Dict[str, SrcHandlersWorkflowsExecuteWithConfigReqBodyInputsValue]]

        streaming : typing.Optional[bool]

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

        Returns
        -------
        WorkflowsRunWithConfigResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout, WorkflowConfigInput

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workflows.run_with_config(
                workflow_config=WorkflowConfigInput(),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.run_with_config(
            workflow_config=workflow_config,
            environment=environment,
            revision_id=revision_id,
            session_id=session_id,
            workflow_key=workflow_key,
            inputs=inputs,
            streaming=streaming,
            request_options=request_options,
        )
        return _response.data
