# This file was auto-generated by Fern from our API Definition.

import typing
from json.decoder import JSONDecodeError

from ..core.api_error import ApiError
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.http_response import AsyncHttpResponse, HttpResponse
from ..core.jsonable_encoder import jsonable_encoder
from ..core.pydantic_utilities import parse_obj_as
from ..core.request_options import RequestOptions
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from ..types.success_response_list_vector_store_response import SuccessResponseListVectorStoreResponse
from ..types.success_response_vector_store_response import SuccessResponseVectorStoreResponse
from ..types.success_response_vector_store_usage_response import SuccessResponseVectorStoreUsageResponse

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


class RawVectorStoresClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    def list_vector_stores(
        self,
        organization_id: str,
        *,
        search: typing.Optional[str] = None,
        access_mode: typing.Optional[str] = None,
        flowplate_project_id: typing.Optional[str] = None,
        flow_id: typing.Optional[str] = None,
        skip: typing.Optional[int] = None,
        take: typing.Optional[int] = None,
        sort: typing.Optional[str] = None,
        order: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[SuccessResponseListVectorStoreResponse]:
        """
        Retrieve a list of all vector stores in an organization that the user has access to. Supports filtering and search.

        Parameters
        ----------
        organization_id : str

        search : typing.Optional[str]
            Search by vector store name

        access_mode : typing.Optional[str]
            Filter by access mode (public, organization, department, private)

        flowplate_project_id : typing.Optional[str]
            Filter by Flow-plate project ID

        flow_id : typing.Optional[str]
            Filter by Flow-plate flow ID

        skip : typing.Optional[int]
            Number of records to skip

        take : typing.Optional[int]
            Number of records to return

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

        order : typing.Optional[str]
            Sort order (asc or desc)

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

        Returns
        -------
        HttpResponse[SuccessResponseListVectorStoreResponse]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores",
            method="GET",
            params={
                "search": search,
                "access_mode": access_mode,
                "flowplate_project_id": flowplate_project_id,
                "flow_id": flow_id,
                "skip": skip,
                "take": take,
                "sort": sort,
                "order": order,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseListVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseListVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def create_vector_store(
        self,
        organization_id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        flowplate_project_id: typing.Optional[str] = OMIT,
        flow_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[SuccessResponseVectorStoreResponse]:
        """
        Create a new vector store for semantic search and RAG

        Parameters
        ----------
        organization_id : str

        name : str
            Name of the vector store

        description : typing.Optional[str]
            Description of the vector store's purpose or contents

        access_mode : typing.Optional[str]
            Access control level: public, organization, department, private

        access_departments : typing.Optional[typing.Sequence[str]]
            Department IDs that can access (when access_mode is department)

        access_users : typing.Optional[typing.Sequence[str]]
            User IDs that can access (when access_mode is private)

        flowplate_project_id : typing.Optional[str]
            Flow-plate project ID for organizational scoping

        flow_id : typing.Optional[str]
            Flow-plate flow ID for flow-level scoping

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

        Returns
        -------
        HttpResponse[SuccessResponseVectorStoreResponse]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores",
            method="POST",
            json={
                "name": name,
                "description": description,
                "access_mode": access_mode,
                "access_departments": access_departments,
                "access_users": access_users,
                "flowplate_project_id": flowplate_project_id,
                "flow_id": flow_id,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_vector_store_usage(
        self, organization_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[SuccessResponseVectorStoreUsageResponse]:
        """
        Get storage usage breakdown by vector store for the organization

        Parameters
        ----------
        organization_id : str

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

        Returns
        -------
        HttpResponse[SuccessResponseVectorStoreUsageResponse]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/usage",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreUsageResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreUsageResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_vector_store(
        self, organization_id: str, vector_store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[SuccessResponseVectorStoreResponse]:
        """
        Get details about a specific vector store by its ID

        Parameters
        ----------
        organization_id : str

        vector_store_id : str

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

        Returns
        -------
        HttpResponse[SuccessResponseVectorStoreResponse]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/{jsonable_encoder(vector_store_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def delete_vector_store(
        self, organization_id: str, vector_store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[None]:
        """
        Permanently delete a vector store and remove all associated files

        Parameters
        ----------
        organization_id : str

        vector_store_id : str

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

        Returns
        -------
        HttpResponse[None]
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/{jsonable_encoder(vector_store_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                return HttpResponse(response=_response, data=None)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def update_vector_store(
        self,
        organization_id: str,
        vector_store_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        flowplate_project_id: typing.Optional[str] = OMIT,
        flow_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[SuccessResponseVectorStoreResponse]:
        """
        Modify the name, description, or access settings of a vector store

        Parameters
        ----------
        organization_id : str

        vector_store_id : str

        name : typing.Optional[str]
            New name for the vector store

        description : typing.Optional[str]
            New description for the vector store

        access_mode : typing.Optional[str]
            New access control level: public, organization, department, private

        access_departments : typing.Optional[typing.Sequence[str]]
            Updated list of department IDs with access

        access_users : typing.Optional[typing.Sequence[str]]
            Updated list of user IDs with access

        flowplate_project_id : typing.Optional[str]
            Flow-plate project ID for organizational scoping

        flow_id : typing.Optional[str]
            Flow-plate flow ID for flow-level scoping

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

        Returns
        -------
        HttpResponse[SuccessResponseVectorStoreResponse]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/{jsonable_encoder(vector_store_id)}",
            method="PATCH",
            json={
                "name": name,
                "description": description,
                "access_mode": access_mode,
                "access_departments": access_departments,
                "access_users": access_users,
                "flowplate_project_id": flowplate_project_id,
                "flow_id": flow_id,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)


class AsyncRawVectorStoresClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def list_vector_stores(
        self,
        organization_id: str,
        *,
        search: typing.Optional[str] = None,
        access_mode: typing.Optional[str] = None,
        flowplate_project_id: typing.Optional[str] = None,
        flow_id: typing.Optional[str] = None,
        skip: typing.Optional[int] = None,
        take: typing.Optional[int] = None,
        sort: typing.Optional[str] = None,
        order: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[SuccessResponseListVectorStoreResponse]:
        """
        Retrieve a list of all vector stores in an organization that the user has access to. Supports filtering and search.

        Parameters
        ----------
        organization_id : str

        search : typing.Optional[str]
            Search by vector store name

        access_mode : typing.Optional[str]
            Filter by access mode (public, organization, department, private)

        flowplate_project_id : typing.Optional[str]
            Filter by Flow-plate project ID

        flow_id : typing.Optional[str]
            Filter by Flow-plate flow ID

        skip : typing.Optional[int]
            Number of records to skip

        take : typing.Optional[int]
            Number of records to return

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

        order : typing.Optional[str]
            Sort order (asc or desc)

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

        Returns
        -------
        AsyncHttpResponse[SuccessResponseListVectorStoreResponse]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores",
            method="GET",
            params={
                "search": search,
                "access_mode": access_mode,
                "flowplate_project_id": flowplate_project_id,
                "flow_id": flow_id,
                "skip": skip,
                "take": take,
                "sort": sort,
                "order": order,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseListVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseListVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def create_vector_store(
        self,
        organization_id: str,
        *,
        name: str,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        flowplate_project_id: typing.Optional[str] = OMIT,
        flow_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[SuccessResponseVectorStoreResponse]:
        """
        Create a new vector store for semantic search and RAG

        Parameters
        ----------
        organization_id : str

        name : str
            Name of the vector store

        description : typing.Optional[str]
            Description of the vector store's purpose or contents

        access_mode : typing.Optional[str]
            Access control level: public, organization, department, private

        access_departments : typing.Optional[typing.Sequence[str]]
            Department IDs that can access (when access_mode is department)

        access_users : typing.Optional[typing.Sequence[str]]
            User IDs that can access (when access_mode is private)

        flowplate_project_id : typing.Optional[str]
            Flow-plate project ID for organizational scoping

        flow_id : typing.Optional[str]
            Flow-plate flow ID for flow-level scoping

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

        Returns
        -------
        AsyncHttpResponse[SuccessResponseVectorStoreResponse]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores",
            method="POST",
            json={
                "name": name,
                "description": description,
                "access_mode": access_mode,
                "access_departments": access_departments,
                "access_users": access_users,
                "flowplate_project_id": flowplate_project_id,
                "flow_id": flow_id,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_vector_store_usage(
        self, organization_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[SuccessResponseVectorStoreUsageResponse]:
        """
        Get storage usage breakdown by vector store for the organization

        Parameters
        ----------
        organization_id : str

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

        Returns
        -------
        AsyncHttpResponse[SuccessResponseVectorStoreUsageResponse]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/usage",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreUsageResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreUsageResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_vector_store(
        self, organization_id: str, vector_store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[SuccessResponseVectorStoreResponse]:
        """
        Get details about a specific vector store by its ID

        Parameters
        ----------
        organization_id : str

        vector_store_id : str

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

        Returns
        -------
        AsyncHttpResponse[SuccessResponseVectorStoreResponse]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/{jsonable_encoder(vector_store_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def delete_vector_store(
        self, organization_id: str, vector_store_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[None]:
        """
        Permanently delete a vector store and remove all associated files

        Parameters
        ----------
        organization_id : str

        vector_store_id : str

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

        Returns
        -------
        AsyncHttpResponse[None]
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/{jsonable_encoder(vector_store_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                return AsyncHttpResponse(response=_response, data=None)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def update_vector_store(
        self,
        organization_id: str,
        vector_store_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        access_mode: typing.Optional[str] = OMIT,
        access_departments: typing.Optional[typing.Sequence[str]] = OMIT,
        access_users: typing.Optional[typing.Sequence[str]] = OMIT,
        flowplate_project_id: typing.Optional[str] = OMIT,
        flow_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[SuccessResponseVectorStoreResponse]:
        """
        Modify the name, description, or access settings of a vector store

        Parameters
        ----------
        organization_id : str

        vector_store_id : str

        name : typing.Optional[str]
            New name for the vector store

        description : typing.Optional[str]
            New description for the vector store

        access_mode : typing.Optional[str]
            New access control level: public, organization, department, private

        access_departments : typing.Optional[typing.Sequence[str]]
            Updated list of department IDs with access

        access_users : typing.Optional[typing.Sequence[str]]
            Updated list of user IDs with access

        flowplate_project_id : typing.Optional[str]
            Flow-plate project ID for organizational scoping

        flow_id : typing.Optional[str]
            Flow-plate flow ID for flow-level scoping

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

        Returns
        -------
        AsyncHttpResponse[SuccessResponseVectorStoreResponse]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/organizations/{jsonable_encoder(organization_id)}/vector-stores/{jsonable_encoder(vector_store_id)}",
            method="PATCH",
            json={
                "name": name,
                "description": description,
                "access_mode": access_mode,
                "access_departments": access_departments,
                "access_users": access_users,
                "flowplate_project_id": flowplate_project_id,
                "flow_id": flow_id,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    SuccessResponseVectorStoreResponse,
                    parse_obj_as(
                        type_=SuccessResponseVectorStoreResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
