# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import os
from typing import Any, cast

import httpx
import pytest
from respx import MockRouter

from casedev import Casedev, AsyncCasedev
from tests.utils import assert_matches_type
from casedev._response import (
    BinaryAPIResponse,
    AsyncBinaryAPIResponse,
    StreamedBinaryAPIResponse,
    AsyncStreamedBinaryAPIResponse,
)
from casedev.types.vault import (
    ObjectListResponse,
    ObjectDeleteResponse,
    ObjectUpdateResponse,
    ObjectGetTextResponse,
    ObjectRetrieveResponse,
    ObjectGetOcrWordsResponse,
    ObjectGetSummarizeJobResponse,
    ObjectCreatePresignedURLResponse,
)

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")


class TestObjects:
    parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])

    @parametrize
    def test_method_retrieve(self, client: Casedev) -> None:
        object_ = client.vault.objects.retrieve(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectRetrieveResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_retrieve(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.retrieve(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectRetrieveResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_retrieve(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.retrieve(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectRetrieveResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_retrieve(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.retrieve(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.retrieve(
                object_id="",
                id="id",
            )

    @parametrize
    def test_method_update(self, client: Casedev) -> None:
        object_ = client.vault.objects.update(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

    @parametrize
    def test_method_update_with_all_params(self, client: Casedev) -> None:
        object_ = client.vault.objects.update(
            object_id="objectId",
            id="id",
            filename="deposition-smith-2024.pdf",
            metadata={},
            path="/Discovery/Depositions",
        )
        assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_update(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.update(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_update(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.update(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_update(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.update(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.update(
                object_id="",
                id="id",
            )

    @parametrize
    def test_method_list(self, client: Casedev) -> None:
        object_ = client.vault.objects.list(
            "id",
        )
        assert_matches_type(ObjectListResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_list(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.list(
            "id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectListResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_list(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.list(
            "id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectListResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_list(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.list(
                "",
            )

    @parametrize
    def test_method_delete(self, client: Casedev) -> None:
        object_ = client.vault.objects.delete(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

    @parametrize
    def test_method_delete_with_all_params(self, client: Casedev) -> None:
        object_ = client.vault.objects.delete(
            object_id="objectId",
            id="id",
            force="true",
        )
        assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_delete(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.delete(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_delete(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.delete(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_delete(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.delete(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.delete(
                object_id="",
                id="id",
            )

    @parametrize
    def test_method_create_presigned_url(self, client: Casedev) -> None:
        object_ = client.vault.objects.create_presigned_url(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

    @parametrize
    def test_method_create_presigned_url_with_all_params(self, client: Casedev) -> None:
        object_ = client.vault.objects.create_presigned_url(
            object_id="objectId",
            id="id",
            content_type="contentType",
            expires_in=60,
            operation="GET",
            size_bytes=1,
        )
        assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_create_presigned_url(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.create_presigned_url(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_create_presigned_url(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.create_presigned_url(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_create_presigned_url(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.create_presigned_url(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.create_presigned_url(
                object_id="",
                id="id",
            )

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    def test_method_download(self, client: Casedev, respx_mock: MockRouter) -> None:
        respx_mock.get("/vault/id/objects/objectId/download").mock(
            return_value=httpx.Response(200, json={"foo": "bar"})
        )
        object_ = client.vault.objects.download(
            object_id="objectId",
            id="id",
        )
        assert object_.is_closed
        assert object_.json() == {"foo": "bar"}
        assert cast(Any, object_.is_closed) is True
        assert isinstance(object_, BinaryAPIResponse)

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    def test_raw_response_download(self, client: Casedev, respx_mock: MockRouter) -> None:
        respx_mock.get("/vault/id/objects/objectId/download").mock(
            return_value=httpx.Response(200, json={"foo": "bar"})
        )

        object_ = client.vault.objects.with_raw_response.download(
            object_id="objectId",
            id="id",
        )

        assert object_.is_closed is True
        assert object_.http_request.headers.get("X-Stainless-Lang") == "python"
        assert object_.json() == {"foo": "bar"}
        assert isinstance(object_, BinaryAPIResponse)

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    def test_streaming_response_download(self, client: Casedev, respx_mock: MockRouter) -> None:
        respx_mock.get("/vault/id/objects/objectId/download").mock(
            return_value=httpx.Response(200, json={"foo": "bar"})
        )
        with client.vault.objects.with_streaming_response.download(
            object_id="objectId",
            id="id",
        ) as object_:
            assert not object_.is_closed
            assert object_.http_request.headers.get("X-Stainless-Lang") == "python"

            assert object_.json() == {"foo": "bar"}
            assert cast(Any, object_.is_closed) is True
            assert isinstance(object_, StreamedBinaryAPIResponse)

        assert cast(Any, object_.is_closed) is True

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    def test_path_params_download(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.download(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.download(
                object_id="",
                id="id",
            )

    @parametrize
    def test_method_get_ocr_words(self, client: Casedev) -> None:
        object_ = client.vault.objects.get_ocr_words(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

    @parametrize
    def test_method_get_ocr_words_with_all_params(self, client: Casedev) -> None:
        object_ = client.vault.objects.get_ocr_words(
            object_id="objectId",
            id="id",
            page=0,
            word_end=0,
            word_start=0,
        )
        assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_get_ocr_words(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.get_ocr_words(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_get_ocr_words(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.get_ocr_words(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_get_ocr_words(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.get_ocr_words(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.get_ocr_words(
                object_id="",
                id="id",
            )

    @parametrize
    def test_method_get_summarize_job(self, client: Casedev) -> None:
        object_ = client.vault.objects.get_summarize_job(
            job_id="jobId",
            id="id",
            object_id="objectId",
        )
        assert_matches_type(ObjectGetSummarizeJobResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_get_summarize_job(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.get_summarize_job(
            job_id="jobId",
            id="id",
            object_id="objectId",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectGetSummarizeJobResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_get_summarize_job(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.get_summarize_job(
            job_id="jobId",
            id="id",
            object_id="objectId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectGetSummarizeJobResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_get_summarize_job(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.get_summarize_job(
                job_id="jobId",
                id="",
                object_id="objectId",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.get_summarize_job(
                job_id="jobId",
                id="id",
                object_id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"):
            client.vault.objects.with_raw_response.get_summarize_job(
                job_id="",
                id="id",
                object_id="objectId",
            )

    @parametrize
    def test_method_get_text(self, client: Casedev) -> None:
        object_ = client.vault.objects.get_text(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectGetTextResponse, object_, path=["response"])

    @parametrize
    def test_raw_response_get_text(self, client: Casedev) -> None:
        response = client.vault.objects.with_raw_response.get_text(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = response.parse()
        assert_matches_type(ObjectGetTextResponse, object_, path=["response"])

    @parametrize
    def test_streaming_response_get_text(self, client: Casedev) -> None:
        with client.vault.objects.with_streaming_response.get_text(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = response.parse()
            assert_matches_type(ObjectGetTextResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    def test_path_params_get_text(self, client: Casedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            client.vault.objects.with_raw_response.get_text(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            client.vault.objects.with_raw_response.get_text(
                object_id="",
                id="id",
            )


class TestAsyncObjects:
    parametrize = pytest.mark.parametrize(
        "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
    )

    @parametrize
    async def test_method_retrieve(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.retrieve(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectRetrieveResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_retrieve(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.retrieve(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectRetrieveResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_retrieve(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.retrieve(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectRetrieveResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_retrieve(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.retrieve(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.retrieve(
                object_id="",
                id="id",
            )

    @parametrize
    async def test_method_update(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.update(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

    @parametrize
    async def test_method_update_with_all_params(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.update(
            object_id="objectId",
            id="id",
            filename="deposition-smith-2024.pdf",
            metadata={},
            path="/Discovery/Depositions",
        )
        assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_update(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.update(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_update(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.update(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectUpdateResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_update(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.update(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.update(
                object_id="",
                id="id",
            )

    @parametrize
    async def test_method_list(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.list(
            "id",
        )
        assert_matches_type(ObjectListResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_list(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.list(
            "id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectListResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_list(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.list(
            "id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectListResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_list(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.list(
                "",
            )

    @parametrize
    async def test_method_delete(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.delete(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

    @parametrize
    async def test_method_delete_with_all_params(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.delete(
            object_id="objectId",
            id="id",
            force="true",
        )
        assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_delete(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.delete(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_delete(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.delete(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectDeleteResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_delete(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.delete(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.delete(
                object_id="",
                id="id",
            )

    @parametrize
    async def test_method_create_presigned_url(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.create_presigned_url(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

    @parametrize
    async def test_method_create_presigned_url_with_all_params(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.create_presigned_url(
            object_id="objectId",
            id="id",
            content_type="contentType",
            expires_in=60,
            operation="GET",
            size_bytes=1,
        )
        assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_create_presigned_url(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.create_presigned_url(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_create_presigned_url(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.create_presigned_url(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectCreatePresignedURLResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_create_presigned_url(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.create_presigned_url(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.create_presigned_url(
                object_id="",
                id="id",
            )

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    async def test_method_download(self, async_client: AsyncCasedev, respx_mock: MockRouter) -> None:
        respx_mock.get("/vault/id/objects/objectId/download").mock(
            return_value=httpx.Response(200, json={"foo": "bar"})
        )
        object_ = await async_client.vault.objects.download(
            object_id="objectId",
            id="id",
        )
        assert object_.is_closed
        assert await object_.json() == {"foo": "bar"}
        assert cast(Any, object_.is_closed) is True
        assert isinstance(object_, AsyncBinaryAPIResponse)

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    async def test_raw_response_download(self, async_client: AsyncCasedev, respx_mock: MockRouter) -> None:
        respx_mock.get("/vault/id/objects/objectId/download").mock(
            return_value=httpx.Response(200, json={"foo": "bar"})
        )

        object_ = await async_client.vault.objects.with_raw_response.download(
            object_id="objectId",
            id="id",
        )

        assert object_.is_closed is True
        assert object_.http_request.headers.get("X-Stainless-Lang") == "python"
        assert await object_.json() == {"foo": "bar"}
        assert isinstance(object_, AsyncBinaryAPIResponse)

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    async def test_streaming_response_download(self, async_client: AsyncCasedev, respx_mock: MockRouter) -> None:
        respx_mock.get("/vault/id/objects/objectId/download").mock(
            return_value=httpx.Response(200, json={"foo": "bar"})
        )
        async with async_client.vault.objects.with_streaming_response.download(
            object_id="objectId",
            id="id",
        ) as object_:
            assert not object_.is_closed
            assert object_.http_request.headers.get("X-Stainless-Lang") == "python"

            assert await object_.json() == {"foo": "bar"}
            assert cast(Any, object_.is_closed) is True
            assert isinstance(object_, AsyncStreamedBinaryAPIResponse)

        assert cast(Any, object_.is_closed) is True

    @parametrize
    @pytest.mark.respx(base_url=base_url)
    async def test_path_params_download(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.download(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.download(
                object_id="",
                id="id",
            )

    @parametrize
    async def test_method_get_ocr_words(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.get_ocr_words(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

    @parametrize
    async def test_method_get_ocr_words_with_all_params(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.get_ocr_words(
            object_id="objectId",
            id="id",
            page=0,
            word_end=0,
            word_start=0,
        )
        assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_get_ocr_words(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.get_ocr_words(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_get_ocr_words(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.get_ocr_words(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectGetOcrWordsResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_get_ocr_words(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.get_ocr_words(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.get_ocr_words(
                object_id="",
                id="id",
            )

    @parametrize
    async def test_method_get_summarize_job(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.get_summarize_job(
            job_id="jobId",
            id="id",
            object_id="objectId",
        )
        assert_matches_type(ObjectGetSummarizeJobResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_get_summarize_job(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.get_summarize_job(
            job_id="jobId",
            id="id",
            object_id="objectId",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectGetSummarizeJobResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_get_summarize_job(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.get_summarize_job(
            job_id="jobId",
            id="id",
            object_id="objectId",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectGetSummarizeJobResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_get_summarize_job(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.get_summarize_job(
                job_id="jobId",
                id="",
                object_id="objectId",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.get_summarize_job(
                job_id="jobId",
                id="id",
                object_id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"):
            await async_client.vault.objects.with_raw_response.get_summarize_job(
                job_id="",
                id="id",
                object_id="objectId",
            )

    @parametrize
    async def test_method_get_text(self, async_client: AsyncCasedev) -> None:
        object_ = await async_client.vault.objects.get_text(
            object_id="objectId",
            id="id",
        )
        assert_matches_type(ObjectGetTextResponse, object_, path=["response"])

    @parametrize
    async def test_raw_response_get_text(self, async_client: AsyncCasedev) -> None:
        response = await async_client.vault.objects.with_raw_response.get_text(
            object_id="objectId",
            id="id",
        )

        assert response.is_closed is True
        assert response.http_request.headers.get("X-Stainless-Lang") == "python"
        object_ = await response.parse()
        assert_matches_type(ObjectGetTextResponse, object_, path=["response"])

    @parametrize
    async def test_streaming_response_get_text(self, async_client: AsyncCasedev) -> None:
        async with async_client.vault.objects.with_streaming_response.get_text(
            object_id="objectId",
            id="id",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            object_ = await response.parse()
            assert_matches_type(ObjectGetTextResponse, object_, path=["response"])

        assert cast(Any, response.is_closed) is True

    @parametrize
    async def test_path_params_get_text(self, async_client: AsyncCasedev) -> None:
        with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
            await async_client.vault.objects.with_raw_response.get_text(
                object_id="objectId",
                id="",
            )

        with pytest.raises(ValueError, match=r"Expected a non-empty value for `object_id` but received ''"):
            await async_client.vault.objects.with_raw_response.get_text(
                object_id="",
                id="id",
            )
