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

import datetime as dt
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.pydantic_utilities import parse_obj_as
from ..core.request_options import RequestOptions
from ..core.serialization import convert_and_respect_annotation_metadata
from ..errors.bad_request_error import BadRequestError
from ..errors.too_many_requests_error import TooManyRequestsError
from ..errors.unauthorized_error import UnauthorizedError
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from ..types.check_exists_response import CheckExistsResponse
from ..types.pipeline_success_response import PipelineSuccessResponse
from ..types.sync_operation import SyncOperation
from .types.sync_request_sync_mode import SyncRequestSyncMode

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


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

    def upsert_pipeline_data(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[PipelineSuccessResponse]:
        """
        Accept data from data pipeline platforms for processing.

            **Authentication**: Dedicated Pipeline Connector API Key required (`X-API-Key` header)

            **Phase 1**: Validates payload and returns acknowledgment
            **Phase 2**: Will process data, generate embeddings, and store in vector store

            **Rate Limit**: 100 requests per minute per organization
            **Batch Size**: Maximum 1000 records per request

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

        Returns
        -------
        HttpResponse[PipelineSuccessResponse]
            Batch processed successfully
        """
        _response = self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/upsert",
            method="POST",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PipelineSuccessResponse,
                    parse_obj_as(
                        type_=PipelineSuccessResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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(),
                        ),
                    ),
                )
            if _response.status_code == 429:
                raise TooManyRequestsError(
                    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 sync_pipeline_data(
        self,
        *,
        organization_id: str,
        vector_store_id: str,
        sync_mode: SyncRequestSyncMode,
        sync_timestamp: dt.datetime,
        operations: typing.Sequence[SyncOperation],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[typing.Dict[str, typing.Any]]:
        """
        Unified endpoint for syncing data from pipeline platforms.

            Supports both incremental and full_refresh sync modes.
            Handles upsert and delete operations atomically.

            **Processing**: The request is validated synchronously and then processed
            asynchronously in a background worker. The endpoint returns 202 Accepted
            immediately with a sync_id for tracking.

            **Authentication**: Pipeline Connector API Key required (X-API-Key header)

            **Sync Modes**:
            - `incremental`: Process only the operations provided (updates/deletes)
            - `full_refresh`: Clear all records in affected namespaces, then insert new data

            **Rate Limit**: 100 requests per minute per organization
            **Batch Size**: Maximum 5000 operations per request

        Parameters
        ----------
        organization_id : str
            Organization ID (org_ prefixed)

        vector_store_id : str
            Vector store ID (vs_ prefixed)

        sync_mode : SyncRequestSyncMode
            Sync mode: incremental (updates only) or full_refresh (complete replacement)

        sync_timestamp : dt.datetime
            ISO 8601 timestamp of sync start

        operations : typing.Sequence[SyncOperation]
            List of operations to perform

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

        Returns
        -------
        HttpResponse[typing.Dict[str, typing.Any]]
            Sync accepted for processing
        """
        _response = self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/sync",
            method="POST",
            json={
                "organization_id": organization_id,
                "vector_store_id": vector_store_id,
                "sync_mode": sync_mode,
                "sync_timestamp": sync_timestamp,
                "operations": convert_and_respect_annotation_metadata(
                    object_=operations, annotation=typing.Sequence[SyncOperation], direction="write"
                ),
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    typing.Dict[str, typing.Any],
                    parse_obj_as(
                        type_=typing.Dict[str, typing.Any],  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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(),
                        ),
                    ),
                )
            if _response.status_code == 429:
                raise TooManyRequestsError(
                    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 check_records_exist(
        self,
        *,
        organization_id: str,
        vector_store_id: str,
        ids: typing.Sequence[str],
        namespace: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CheckExistsResponse]:
        """
        Check which records already exist to avoid duplicate processing.

            **Authentication**: Dedicated Pipeline Connector API Key required (`X-API-Key` header)

            Returns lists of existing and new IDs for efficient deduplication.

        Parameters
        ----------
        organization_id : str
            Organization ID (org_ prefixed)

        vector_store_id : str
            Vector store ID (vs_ prefixed) - each connector is tied to a specific vector store

        ids : typing.Sequence[str]
            Source system IDs to check

        namespace : str
            Namespace to check within

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

        Returns
        -------
        HttpResponse[CheckExistsResponse]
            Check completed successfully
        """
        _response = self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/check-exists",
            method="POST",
            json={
                "organization_id": organization_id,
                "vector_store_id": vector_store_id,
                "ids": ids,
                "namespace": namespace,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CheckExistsResponse,
                    parse_obj_as(
                        type_=CheckExistsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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 pipeline_health(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[typing.Dict[str, typing.Any]]:
        """
        Health check endpoint for pipeline connector service.

            **Authentication**: None required

            Returns service status and configuration information.

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

        Returns
        -------
        HttpResponse[typing.Dict[str, typing.Any]]
            Service is healthy
        """
        _response = self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/health",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    typing.Dict[str, typing.Any],
                    parse_obj_as(
                        type_=typing.Dict[str, typing.Any],  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _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 validate_pipeline_configuration(
        self,
        *,
        organization_id: str,
        vector_store_id: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[typing.Dict[str, typing.Any]]:
        """
        Validate pipeline connector configuration including vector store, organization, and API key.

            **Authentication**: Pipeline Connector API Key required (`X-API-Key` header)

            **Query Parameters**:
            - `organization_id` (required): Organization ID to validate
            - `vector_store_id` (optional): Specific vector store ID to validate

            Validates:
            - API key authentication
            - Organization exists
            - Vector store record (if vector_store_id provided)
            - Vector store service connectivity
            - Collection initialization for organization

            Returns detailed validation results for each component.

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

        vector_store_id : typing.Optional[str]

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

        Returns
        -------
        HttpResponse[typing.Dict[str, typing.Any]]
            Configuration validation results
        """
        _response = self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/health/validate",
            method="POST",
            params={
                "organization_id": organization_id,
                "vector_store_id": vector_store_id,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    typing.Dict[str, typing.Any],
                    parse_obj_as(
                        type_=typing.Dict[str, typing.Any],  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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 AsyncRawConnectorsDataPipelineClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def upsert_pipeline_data(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[PipelineSuccessResponse]:
        """
        Accept data from data pipeline platforms for processing.

            **Authentication**: Dedicated Pipeline Connector API Key required (`X-API-Key` header)

            **Phase 1**: Validates payload and returns acknowledgment
            **Phase 2**: Will process data, generate embeddings, and store in vector store

            **Rate Limit**: 100 requests per minute per organization
            **Batch Size**: Maximum 1000 records per request

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

        Returns
        -------
        AsyncHttpResponse[PipelineSuccessResponse]
            Batch processed successfully
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/upsert",
            method="POST",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PipelineSuccessResponse,
                    parse_obj_as(
                        type_=PipelineSuccessResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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(),
                        ),
                    ),
                )
            if _response.status_code == 429:
                raise TooManyRequestsError(
                    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 sync_pipeline_data(
        self,
        *,
        organization_id: str,
        vector_store_id: str,
        sync_mode: SyncRequestSyncMode,
        sync_timestamp: dt.datetime,
        operations: typing.Sequence[SyncOperation],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
        """
        Unified endpoint for syncing data from pipeline platforms.

            Supports both incremental and full_refresh sync modes.
            Handles upsert and delete operations atomically.

            **Processing**: The request is validated synchronously and then processed
            asynchronously in a background worker. The endpoint returns 202 Accepted
            immediately with a sync_id for tracking.

            **Authentication**: Pipeline Connector API Key required (X-API-Key header)

            **Sync Modes**:
            - `incremental`: Process only the operations provided (updates/deletes)
            - `full_refresh`: Clear all records in affected namespaces, then insert new data

            **Rate Limit**: 100 requests per minute per organization
            **Batch Size**: Maximum 5000 operations per request

        Parameters
        ----------
        organization_id : str
            Organization ID (org_ prefixed)

        vector_store_id : str
            Vector store ID (vs_ prefixed)

        sync_mode : SyncRequestSyncMode
            Sync mode: incremental (updates only) or full_refresh (complete replacement)

        sync_timestamp : dt.datetime
            ISO 8601 timestamp of sync start

        operations : typing.Sequence[SyncOperation]
            List of operations to perform

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

        Returns
        -------
        AsyncHttpResponse[typing.Dict[str, typing.Any]]
            Sync accepted for processing
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/sync",
            method="POST",
            json={
                "organization_id": organization_id,
                "vector_store_id": vector_store_id,
                "sync_mode": sync_mode,
                "sync_timestamp": sync_timestamp,
                "operations": convert_and_respect_annotation_metadata(
                    object_=operations, annotation=typing.Sequence[SyncOperation], direction="write"
                ),
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    typing.Dict[str, typing.Any],
                    parse_obj_as(
                        type_=typing.Dict[str, typing.Any],  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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(),
                        ),
                    ),
                )
            if _response.status_code == 429:
                raise TooManyRequestsError(
                    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 check_records_exist(
        self,
        *,
        organization_id: str,
        vector_store_id: str,
        ids: typing.Sequence[str],
        namespace: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CheckExistsResponse]:
        """
        Check which records already exist to avoid duplicate processing.

            **Authentication**: Dedicated Pipeline Connector API Key required (`X-API-Key` header)

            Returns lists of existing and new IDs for efficient deduplication.

        Parameters
        ----------
        organization_id : str
            Organization ID (org_ prefixed)

        vector_store_id : str
            Vector store ID (vs_ prefixed) - each connector is tied to a specific vector store

        ids : typing.Sequence[str]
            Source system IDs to check

        namespace : str
            Namespace to check within

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

        Returns
        -------
        AsyncHttpResponse[CheckExistsResponse]
            Check completed successfully
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/check-exists",
            method="POST",
            json={
                "organization_id": organization_id,
                "vector_store_id": vector_store_id,
                "ids": ids,
                "namespace": namespace,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CheckExistsResponse,
                    parse_obj_as(
                        type_=CheckExistsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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 pipeline_health(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
        """
        Health check endpoint for pipeline connector service.

            **Authentication**: None required

            Returns service status and configuration information.

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

        Returns
        -------
        AsyncHttpResponse[typing.Dict[str, typing.Any]]
            Service is healthy
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/health",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    typing.Dict[str, typing.Any],
                    parse_obj_as(
                        type_=typing.Dict[str, typing.Any],  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _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 validate_pipeline_configuration(
        self,
        *,
        organization_id: str,
        vector_store_id: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
        """
        Validate pipeline connector configuration including vector store, organization, and API key.

            **Authentication**: Pipeline Connector API Key required (`X-API-Key` header)

            **Query Parameters**:
            - `organization_id` (required): Organization ID to validate
            - `vector_store_id` (optional): Specific vector store ID to validate

            Validates:
            - API key authentication
            - Organization exists
            - Vector store record (if vector_store_id provided)
            - Vector store service connectivity
            - Collection initialization for organization

            Returns detailed validation results for each component.

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

        vector_store_id : typing.Optional[str]

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

        Returns
        -------
        AsyncHttpResponse[typing.Dict[str, typing.Any]]
            Configuration validation results
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v1/connectors/pipeline/health/validate",
            method="POST",
            params={
                "organization_id": organization_id,
                "vector_store_id": vector_store_id,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    typing.Dict[str, typing.Any],
                    parse_obj_as(
                        type_=typing.Dict[str, typing.Any],  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            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)
