diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2ce25fe..ff4f9a5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.32" + ".": "0.1.0-alpha.33" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index fdb7be8..49a4e3c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 56 -openapi_spec_hash: 80b1836ebec22fc0dc25d5d8efe62a50 -config_hash: 9e0ed146f9f6e6d1884a4c0589d6f1c2 +configured_endpoints: 65 +openapi_spec_hash: d273ca5158facc1251efa0a5f9e723c5 +config_hash: cd9208a2204f43e0aa5ab35ac85ef90d diff --git a/CHANGELOG.md b/CHANGELOG.md index be7448d..306f329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.1.0-alpha.33 (2025-11-18) + +Full Changelog: [v0.1.0-alpha.32...v0.1.0-alpha.33](https://github.com/cleanlab/codex-python/compare/v0.1.0-alpha.32...v0.1.0-alpha.33) + +### Features + +* **api:** add expert answer endpoints ([68ec69e](https://github.com/cleanlab/codex-python/commit/68ec69ebf6aecfc216daba6a898cae0d24e0c0be)) +* **api:** api update ([57567dc](https://github.com/cleanlab/codex-python/commit/57567dcc746b17735296ef990be1fc5518cc312b)) +* **api:** api update ([6f52772](https://github.com/cleanlab/codex-python/commit/6f5277261b360cb04ff317371841a22145f7fae8)) + + +### Bug Fixes + +* compat with Python 3.14 ([0ec7ffd](https://github.com/cleanlab/codex-python/commit/0ec7ffdf3a5def6fdd42f58c6df579593073ed0c)) +* **compat:** update signatures of `model_dump` and `model_dump_json` for Pydantic v1 ([1225af1](https://github.com/cleanlab/codex-python/commit/1225af1da7aa3442931b29a049c951aa656a5d03)) + + +### Chores + +* **package:** drop Python 3.8 support ([b5ef513](https://github.com/cleanlab/codex-python/commit/b5ef513181cd5725100b45e798290e523fdf3b76)) + ## 0.1.0-alpha.32 (2025-11-05) Full Changelog: [v0.1.0-alpha.31...v0.1.0-alpha.32](https://github.com/cleanlab/codex-python/compare/v0.1.0-alpha.31...v0.1.0-alpha.32) diff --git a/api.md b/api.md index a288874..6e8c053 100644 --- a/api.md +++ b/api.md @@ -244,14 +244,43 @@ from codex.types.projects import ( Methods: -- client.projects.remediations.create(project_id, \*\*params) -> RemediationCreateResponse -- client.projects.remediations.retrieve(remediation_id, \*, project_id) -> RemediationRetrieveResponse -- client.projects.remediations.list(project_id, \*\*params) -> SyncOffsetPageRemediations[RemediationListResponse] -- client.projects.remediations.delete(remediation_id, \*, project_id) -> None -- client.projects.remediations.edit_answer(remediation_id, \*, project_id, \*\*params) -> RemediationEditAnswerResponse -- client.projects.remediations.edit_draft_answer(remediation_id, \*, project_id, \*\*params) -> RemediationEditDraftAnswerResponse -- client.projects.remediations.get_resolved_logs_count(remediation_id, \*, project_id) -> RemediationGetResolvedLogsCountResponse -- client.projects.remediations.list_resolved_logs(remediation_id, \*, project_id) -> RemediationListResolvedLogsResponse -- client.projects.remediations.pause(remediation_id, \*, project_id) -> RemediationPauseResponse -- client.projects.remediations.publish(remediation_id, \*, project_id) -> RemediationPublishResponse -- client.projects.remediations.unpause(remediation_id, \*, project_id) -> RemediationUnpauseResponse +- client.projects.remediations.create(project_id, \*\*params) -> RemediationCreateResponse +- client.projects.remediations.retrieve(remediation_id, \*, project_id) -> RemediationRetrieveResponse +- client.projects.remediations.list(project_id, \*\*params) -> SyncOffsetPageRemediations[RemediationListResponse] +- client.projects.remediations.delete(remediation_id, \*, project_id) -> None +- client.projects.remediations.edit_answer(remediation_id, \*, project_id, \*\*params) -> RemediationEditAnswerResponse +- client.projects.remediations.edit_draft_answer(remediation_id, \*, project_id, \*\*params) -> RemediationEditDraftAnswerResponse +- client.projects.remediations.get_resolved_logs_count(remediation_id, \*, project_id) -> RemediationGetResolvedLogsCountResponse +- client.projects.remediations.list_resolved_logs(remediation_id, \*, project_id) -> RemediationListResolvedLogsResponse +- client.projects.remediations.pause(remediation_id, \*, project_id) -> RemediationPauseResponse +- client.projects.remediations.publish(remediation_id, \*, project_id) -> RemediationPublishResponse +- client.projects.remediations.unpause(remediation_id, \*, project_id) -> RemediationUnpauseResponse + +### ExpertAnswers + +Types: + +```python +from codex.types.projects.remediations import ( + ExpertAnswerCreateResponse, + ExpertAnswerRetrieveResponse, + ExpertAnswerListResponse, + ExpertAnswerEditAnswerResponse, + ExpertAnswerEditDraftAnswerResponse, + ExpertAnswerPauseResponse, + ExpertAnswerPublishResponse, + ExpertAnswerUnpauseResponse, +) +``` + +Methods: + +- client.projects.remediations.expert_answers.create(project_id, \*\*params) -> ExpertAnswerCreateResponse +- client.projects.remediations.expert_answers.retrieve(expert_answer_id, \*, project_id) -> ExpertAnswerRetrieveResponse +- client.projects.remediations.expert_answers.list(project_id, \*\*params) -> SyncOffsetPageExpertAnswers[ExpertAnswerListResponse] +- client.projects.remediations.expert_answers.delete(expert_answer_id, \*, project_id) -> None +- client.projects.remediations.expert_answers.edit_answer(expert_answer_id, \*, project_id, \*\*params) -> ExpertAnswerEditAnswerResponse +- client.projects.remediations.expert_answers.edit_draft_answer(expert_answer_id, \*, project_id, \*\*params) -> ExpertAnswerEditDraftAnswerResponse +- client.projects.remediations.expert_answers.pause(expert_answer_id, \*, project_id) -> ExpertAnswerPauseResponse +- client.projects.remediations.expert_answers.publish(expert_answer_id, \*, project_id) -> ExpertAnswerPublishResponse +- client.projects.remediations.expert_answers.unpause(expert_answer_id, \*, project_id) -> ExpertAnswerUnpauseResponse diff --git a/pyproject.toml b/pyproject.toml index 060cc09..efd2e79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "codex-sdk" -version = "0.1.0-alpha.32" +version = "0.1.0-alpha.33" description = "Internal SDK used within cleanlab-codex package. Refer to https://pypi.org/project/cleanlab-codex/ instead." dynamic = ["readme"] license = "MIT" @@ -15,11 +15,10 @@ dependencies = [ "distro>=1.7.0, <2", "sniffio", ] -requires-python = ">= 3.8" +requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -141,7 +140,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.8" +pythonVersion = "3.9" exclude = [ "_dev", diff --git a/src/codex/_models.py b/src/codex/_models.py index 6a3cd1d..ca9500b 100644 --- a/src/codex/_models.py +++ b/src/codex/_models.py @@ -2,6 +2,7 @@ import os import inspect +import weakref from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( @@ -256,15 +257,16 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, - serialize_as_any: bool = False, fallback: Callable[[Any], Any] | None = None, + serialize_as_any: bool = False, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -272,16 +274,24 @@ def model_dump( Args: mode: The mode in which `to_python` should run. - If mode is 'json', the dictionary will only contain JSON serializable types. - If mode is 'python', the dictionary may contain any Python objects. - include: A list of fields to include in the output. - exclude: A list of fields to exclude from the output. + If mode is 'json', the output will only contain JSON serializable types. + If mode is 'python', the output may contain non-JSON-serializable Python objects. + include: A set of fields to include in the output. + exclude: A set of fields to exclude from the output. + context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. - exclude_unset: Whether to exclude fields that are unset or None from the output. - exclude_defaults: Whether to exclude fields that are set to their default value from the output. - exclude_none: Whether to exclude fields that have a value of `None` from the output. - round_trip: Whether to enable serialization and deserialization round-trip support. - warnings: Whether to log warnings when invalid fields are encountered. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value. + exclude_none: Whether to exclude fields that have a value of `None`. + exclude_computed_fields: Whether to exclude computed fields. + While this can be useful for round-tripping, it is usually recommended to use the dedicated + `round_trip` parameter instead. + round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. + warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, + "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. + fallback: A function to call when an unknown value is encountered. If not provided, + a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. + serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. Returns: A dictionary representation of the model. @@ -298,6 +308,8 @@ def model_dump( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, @@ -314,15 +326,17 @@ def model_dump_json( self, *, indent: int | None = None, + ensure_ascii: bool = False, include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: @@ -354,6 +368,10 @@ def model_dump_json( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if ensure_ascii != False: + raise ValueError("ensure_ascii is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, @@ -573,6 +591,9 @@ class CachedDiscriminatorType(Protocol): __discriminator__: DiscriminatorDetails +DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary() + + class DiscriminatorDetails: field_name: str """The name of the discriminator field in the variant class, e.g. @@ -615,8 +636,9 @@ def __init__( def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: - if isinstance(union, CachedDiscriminatorType): - return union.__discriminator__ + cached = DISCRIMINATOR_CACHE.get(union) + if cached is not None: + return cached discriminator_field_name: str | None = None @@ -669,7 +691,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, discriminator_field=discriminator_field_name, discriminator_alias=discriminator_alias, ) - cast(CachedDiscriminatorType, union).__discriminator__ = details + DISCRIMINATOR_CACHE.setdefault(union, details) return details diff --git a/src/codex/_utils/_sync.py b/src/codex/_utils/_sync.py index ad7ec71..f6027c1 100644 --- a/src/codex/_utils/_sync.py +++ b/src/codex/_utils/_sync.py @@ -1,10 +1,8 @@ from __future__ import annotations -import sys import asyncio import functools -import contextvars -from typing import Any, TypeVar, Callable, Awaitable +from typing import TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio @@ -15,34 +13,11 @@ T_ParamSpec = ParamSpec("T_ParamSpec") -if sys.version_info >= (3, 9): - _asyncio_to_thread = asyncio.to_thread -else: - # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread - # for Python 3.8 support - async def _asyncio_to_thread( - func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs - ) -> Any: - """Asynchronously run function *func* in a separate thread. - - Any *args and **kwargs supplied for this function are directly passed - to *func*. Also, the current :class:`contextvars.Context` is propagated, - allowing context variables from the main thread to be accessed in the - separate thread. - - Returns a coroutine that can be awaited to get the eventual result of *func*. - """ - loop = asyncio.events.get_running_loop() - ctx = contextvars.copy_context() - func_call = functools.partial(ctx.run, func, *args, **kwargs) - return await loop.run_in_executor(None, func_call) - - async def to_thread( func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs ) -> T_Retval: if sniffio.current_async_library() == "asyncio": - return await _asyncio_to_thread(func, *args, **kwargs) + return await asyncio.to_thread(func, *args, **kwargs) return await anyio.to_thread.run_sync( functools.partial(func, *args, **kwargs), @@ -53,10 +28,7 @@ async def to_thread( def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments. For python version 3.9 and above, it uses - asyncio.to_thread to run the function in a separate thread. For python version - 3.8, it uses locally defined copy of the asyncio.to_thread function which was - introduced in python 3.9. + positional and keyword arguments. Usage: diff --git a/src/codex/_version.py b/src/codex/_version.py index 57e8ea7..45fdfee 100644 --- a/src/codex/_version.py +++ b/src/codex/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "codex" -__version__ = "0.1.0-alpha.32" # x-release-please-version +__version__ = "0.1.0-alpha.33" # x-release-please-version diff --git a/src/codex/pagination.py b/src/codex/pagination.py index 36af0f6..e5721eb 100644 --- a/src/codex/pagination.py +++ b/src/codex/pagination.py @@ -22,6 +22,8 @@ "AsyncOffsetPageQueryLogGroups", "SyncOffsetPageQueryLogsByGroup", "AsyncOffsetPageQueryLogsByGroup", + "SyncOffsetPageExpertAnswers", + "AsyncOffsetPageExpertAnswers", ] _BaseModelT = TypeVar("_BaseModelT", bound=BaseModel) @@ -389,3 +391,63 @@ def next_page_info(self) -> Optional[PageInfo]: return PageInfo(params={"offset": current_count}) return None + + +class SyncOffsetPageExpertAnswers(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + expert_answers: List[_T] + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + expert_answers = self.expert_answers + if not expert_answers: + return [] + return expert_answers + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + total_count = self.total_count + if total_count is None: + return None + + if current_count < total_count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPageExpertAnswers(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + expert_answers: List[_T] + total_count: Optional[int] = None + + @override + def _get_page_items(self) -> List[_T]: + expert_answers = self.expert_answers + if not expert_answers: + return [] + return expert_answers + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + total_count = self.total_count + if total_count is None: + return None + + if current_count < total_count: + return PageInfo(params={"offset": current_count}) + + return None diff --git a/src/codex/resources/projects/projects.py b/src/codex/resources/projects/projects.py index 8aa1da7..0152bac 100644 --- a/src/codex/resources/projects/projects.py +++ b/src/codex/resources/projects/projects.py @@ -51,7 +51,8 @@ AccessKeysResourceWithStreamingResponse, AsyncAccessKeysResourceWithStreamingResponse, ) -from .remediations import ( +from ..._base_client import make_request_options +from .remediations.remediations import ( RemediationsResource, AsyncRemediationsResource, RemediationsResourceWithRawResponse, @@ -59,7 +60,6 @@ RemediationsResourceWithStreamingResponse, AsyncRemediationsResourceWithStreamingResponse, ) -from ..._base_client import make_request_options from ...types.project_list_response import ProjectListResponse from ...types.project_return_schema import ProjectReturnSchema from ...types.project_detect_response import ProjectDetectResponse diff --git a/src/codex/resources/projects/query_logs.py b/src/codex/resources/projects/query_logs.py index 2720dd1..fec1138 100644 --- a/src/codex/resources/projects/query_logs.py +++ b/src/codex/resources/projects/query_logs.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal @@ -252,6 +253,7 @@ def add_user_feedback( cast_to=QueryLogAddUserFeedbackResponse, ) + @typing_extensions.deprecated("deprecated") def list_by_group( self, project_id: str, @@ -372,6 +374,7 @@ def list_by_group( cast_to=QueryLogListByGroupResponse, ) + @typing_extensions.deprecated("deprecated") def list_groups( self, project_id: str, @@ -490,6 +493,7 @@ def list_groups( model=QueryLogListGroupsResponse, ) + @typing_extensions.deprecated("deprecated") def start_remediation( self, query_log_id: str, @@ -776,6 +780,7 @@ async def add_user_feedback( cast_to=QueryLogAddUserFeedbackResponse, ) + @typing_extensions.deprecated("deprecated") async def list_by_group( self, project_id: str, @@ -896,6 +901,7 @@ async def list_by_group( cast_to=QueryLogListByGroupResponse, ) + @typing_extensions.deprecated("deprecated") def list_groups( self, project_id: str, @@ -1014,6 +1020,7 @@ def list_groups( model=QueryLogListGroupsResponse, ) + @typing_extensions.deprecated("deprecated") async def start_remediation( self, query_log_id: str, @@ -1102,14 +1109,20 @@ def __init__(self, query_logs: QueryLogsResource) -> None: self.add_user_feedback = to_raw_response_wrapper( query_logs.add_user_feedback, ) - self.list_by_group = to_raw_response_wrapper( - query_logs.list_by_group, + self.list_by_group = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + query_logs.list_by_group, # pyright: ignore[reportDeprecated], + ) ) - self.list_groups = to_raw_response_wrapper( - query_logs.list_groups, + self.list_groups = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + query_logs.list_groups, # pyright: ignore[reportDeprecated], + ) ) - self.start_remediation = to_raw_response_wrapper( - query_logs.start_remediation, + self.start_remediation = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + query_logs.start_remediation, # pyright: ignore[reportDeprecated], + ) ) self.update_metadata = to_raw_response_wrapper( query_logs.update_metadata, @@ -1129,14 +1142,20 @@ def __init__(self, query_logs: AsyncQueryLogsResource) -> None: self.add_user_feedback = async_to_raw_response_wrapper( query_logs.add_user_feedback, ) - self.list_by_group = async_to_raw_response_wrapper( - query_logs.list_by_group, + self.list_by_group = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + query_logs.list_by_group, # pyright: ignore[reportDeprecated], + ) ) - self.list_groups = async_to_raw_response_wrapper( - query_logs.list_groups, + self.list_groups = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + query_logs.list_groups, # pyright: ignore[reportDeprecated], + ) ) - self.start_remediation = async_to_raw_response_wrapper( - query_logs.start_remediation, + self.start_remediation = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + query_logs.start_remediation, # pyright: ignore[reportDeprecated], + ) ) self.update_metadata = async_to_raw_response_wrapper( query_logs.update_metadata, @@ -1156,14 +1175,20 @@ def __init__(self, query_logs: QueryLogsResource) -> None: self.add_user_feedback = to_streamed_response_wrapper( query_logs.add_user_feedback, ) - self.list_by_group = to_streamed_response_wrapper( - query_logs.list_by_group, + self.list_by_group = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + query_logs.list_by_group, # pyright: ignore[reportDeprecated], + ) ) - self.list_groups = to_streamed_response_wrapper( - query_logs.list_groups, + self.list_groups = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + query_logs.list_groups, # pyright: ignore[reportDeprecated], + ) ) - self.start_remediation = to_streamed_response_wrapper( - query_logs.start_remediation, + self.start_remediation = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + query_logs.start_remediation, # pyright: ignore[reportDeprecated], + ) ) self.update_metadata = to_streamed_response_wrapper( query_logs.update_metadata, @@ -1183,14 +1208,20 @@ def __init__(self, query_logs: AsyncQueryLogsResource) -> None: self.add_user_feedback = async_to_streamed_response_wrapper( query_logs.add_user_feedback, ) - self.list_by_group = async_to_streamed_response_wrapper( - query_logs.list_by_group, + self.list_by_group = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + query_logs.list_by_group, # pyright: ignore[reportDeprecated], + ) ) - self.list_groups = async_to_streamed_response_wrapper( - query_logs.list_groups, + self.list_groups = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + query_logs.list_groups, # pyright: ignore[reportDeprecated], + ) ) - self.start_remediation = async_to_streamed_response_wrapper( - query_logs.start_remediation, + self.start_remediation = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + query_logs.start_remediation, # pyright: ignore[reportDeprecated], + ) ) self.update_metadata = async_to_streamed_response_wrapper( query_logs.update_metadata, diff --git a/src/codex/resources/projects/remediations/__init__.py b/src/codex/resources/projects/remediations/__init__.py new file mode 100644 index 0000000..3a7c4f9 --- /dev/null +++ b/src/codex/resources/projects/remediations/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .remediations import ( + RemediationsResource, + AsyncRemediationsResource, + RemediationsResourceWithRawResponse, + AsyncRemediationsResourceWithRawResponse, + RemediationsResourceWithStreamingResponse, + AsyncRemediationsResourceWithStreamingResponse, +) +from .expert_answers import ( + ExpertAnswersResource, + AsyncExpertAnswersResource, + ExpertAnswersResourceWithRawResponse, + AsyncExpertAnswersResourceWithRawResponse, + ExpertAnswersResourceWithStreamingResponse, + AsyncExpertAnswersResourceWithStreamingResponse, +) + +__all__ = [ + "ExpertAnswersResource", + "AsyncExpertAnswersResource", + "ExpertAnswersResourceWithRawResponse", + "AsyncExpertAnswersResourceWithRawResponse", + "ExpertAnswersResourceWithStreamingResponse", + "AsyncExpertAnswersResourceWithStreamingResponse", + "RemediationsResource", + "AsyncRemediationsResource", + "RemediationsResourceWithRawResponse", + "AsyncRemediationsResourceWithRawResponse", + "RemediationsResourceWithStreamingResponse", + "AsyncRemediationsResourceWithStreamingResponse", +] diff --git a/src/codex/resources/projects/remediations/expert_answers.py b/src/codex/resources/projects/remediations/expert_answers.py new file mode 100644 index 0000000..bade078 --- /dev/null +++ b/src/codex/resources/projects/remediations/expert_answers.py @@ -0,0 +1,968 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncOffsetPageExpertAnswers, AsyncOffsetPageExpertAnswers +from ...._base_client import AsyncPaginator, make_request_options +from ....types.projects.remediations import ( + expert_answer_list_params, + expert_answer_create_params, + expert_answer_edit_answer_params, + expert_answer_edit_draft_answer_params, +) +from ....types.projects.remediations.expert_answer_list_response import ExpertAnswerListResponse +from ....types.projects.remediations.expert_answer_pause_response import ExpertAnswerPauseResponse +from ....types.projects.remediations.expert_answer_create_response import ExpertAnswerCreateResponse +from ....types.projects.remediations.expert_answer_publish_response import ExpertAnswerPublishResponse +from ....types.projects.remediations.expert_answer_unpause_response import ExpertAnswerUnpauseResponse +from ....types.projects.remediations.expert_answer_retrieve_response import ExpertAnswerRetrieveResponse +from ....types.projects.remediations.expert_answer_edit_answer_response import ExpertAnswerEditAnswerResponse +from ....types.projects.remediations.expert_answer_edit_draft_answer_response import ExpertAnswerEditDraftAnswerResponse + +__all__ = ["ExpertAnswersResource", "AsyncExpertAnswersResource"] + + +class ExpertAnswersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ExpertAnswersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cleanlab/codex-python#accessing-raw-response-data-eg-headers + """ + return ExpertAnswersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ExpertAnswersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cleanlab/codex-python#with_streaming_response + """ + return ExpertAnswersResourceWithStreamingResponse(self) + + def create( + self, + project_id: str, + *, + query: str, + answer: Optional[str] | Omit = omit, + draft_answer: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerCreateResponse: + """ + Create Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + return self._post( + f"/api/projects/{project_id}/expert_answers/", + body=maybe_transform( + { + "query": query, + "answer": answer, + "draft_answer": draft_answer, + }, + expert_answer_create_params.ExpertAnswerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerCreateResponse, + ) + + def retrieve( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerRetrieveResponse: + """ + Get Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return self._get( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerRetrieveResponse, + ) + + def list( + self, + project_id: str, + *, + created_at_end: Union[str, datetime, None] | Omit = omit, + created_at_start: Union[str, datetime, None] | Omit = omit, + last_edited_at_end: Union[str, datetime, None] | Omit = omit, + last_edited_at_start: Union[str, datetime, None] | Omit = omit, + last_edited_by: Optional[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order: Literal["asc", "desc"] | Omit = omit, + sort: Optional[Literal["created_at", "last_edited_at", "resolved_logs_count"]] | Omit = omit, + status: Optional[List[Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"]]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncOffsetPageExpertAnswers[ExpertAnswerListResponse]: + """ + List Expert Answers Route + + Args: + created_at_end: Filter remediations created at or before this timestamp + + created_at_start: Filter remediations created at or after this timestamp + + last_edited_at_end: Filter remediations last edited at or before this timestamp + + last_edited_at_start: Filter remediations last edited at or after this timestamp + + last_edited_by: Filter by last edited by user ID + + status: Filter expert answers that have ANY of these statuses (OR operation) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + return self._get_api_list( + f"/api/projects/{project_id}/expert_answers/", + page=SyncOffsetPageExpertAnswers[ExpertAnswerListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at_end": created_at_end, + "created_at_start": created_at_start, + "last_edited_at_end": last_edited_at_end, + "last_edited_at_start": last_edited_at_start, + "last_edited_by": last_edited_by, + "limit": limit, + "offset": offset, + "order": order, + "sort": sort, + "status": status, + }, + expert_answer_list_params.ExpertAnswerListParams, + ), + ), + model=ExpertAnswerListResponse, + ) + + def delete( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def edit_answer( + self, + expert_answer_id: str, + *, + project_id: str, + answer: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerEditAnswerResponse: + """ + Edit Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/edit_expert_answer", + body=maybe_transform({"answer": answer}, expert_answer_edit_answer_params.ExpertAnswerEditAnswerParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerEditAnswerResponse, + ) + + def edit_draft_answer( + self, + expert_answer_id: str, + *, + project_id: str, + draft_answer: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerEditDraftAnswerResponse: + """ + Edit Draft Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/edit_draft_expert_answer", + body=maybe_transform( + {"draft_answer": draft_answer}, expert_answer_edit_draft_answer_params.ExpertAnswerEditDraftAnswerParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerEditDraftAnswerResponse, + ) + + def pause( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerPauseResponse: + """ + Pause Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/pause", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerPauseResponse, + ) + + def publish( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerPublishResponse: + """ + Publish Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/publish", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerPublishResponse, + ) + + def unpause( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerUnpauseResponse: + """ + Unpause Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/unpause", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerUnpauseResponse, + ) + + +class AsyncExpertAnswersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncExpertAnswersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cleanlab/codex-python#accessing-raw-response-data-eg-headers + """ + return AsyncExpertAnswersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncExpertAnswersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cleanlab/codex-python#with_streaming_response + """ + return AsyncExpertAnswersResourceWithStreamingResponse(self) + + async def create( + self, + project_id: str, + *, + query: str, + answer: Optional[str] | Omit = omit, + draft_answer: Optional[str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerCreateResponse: + """ + Create Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + return await self._post( + f"/api/projects/{project_id}/expert_answers/", + body=await async_maybe_transform( + { + "query": query, + "answer": answer, + "draft_answer": draft_answer, + }, + expert_answer_create_params.ExpertAnswerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerCreateResponse, + ) + + async def retrieve( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerRetrieveResponse: + """ + Get Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return await self._get( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerRetrieveResponse, + ) + + def list( + self, + project_id: str, + *, + created_at_end: Union[str, datetime, None] | Omit = omit, + created_at_start: Union[str, datetime, None] | Omit = omit, + last_edited_at_end: Union[str, datetime, None] | Omit = omit, + last_edited_at_start: Union[str, datetime, None] | Omit = omit, + last_edited_by: Optional[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order: Literal["asc", "desc"] | Omit = omit, + sort: Optional[Literal["created_at", "last_edited_at", "resolved_logs_count"]] | Omit = omit, + status: Optional[List[Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"]]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[ExpertAnswerListResponse, AsyncOffsetPageExpertAnswers[ExpertAnswerListResponse]]: + """ + List Expert Answers Route + + Args: + created_at_end: Filter remediations created at or before this timestamp + + created_at_start: Filter remediations created at or after this timestamp + + last_edited_at_end: Filter remediations last edited at or before this timestamp + + last_edited_at_start: Filter remediations last edited at or after this timestamp + + last_edited_by: Filter by last edited by user ID + + status: Filter expert answers that have ANY of these statuses (OR operation) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + return self._get_api_list( + f"/api/projects/{project_id}/expert_answers/", + page=AsyncOffsetPageExpertAnswers[ExpertAnswerListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at_end": created_at_end, + "created_at_start": created_at_start, + "last_edited_at_end": last_edited_at_end, + "last_edited_at_start": last_edited_at_start, + "last_edited_by": last_edited_by, + "limit": limit, + "offset": offset, + "order": order, + "sort": sort, + "status": status, + }, + expert_answer_list_params.ExpertAnswerListParams, + ), + ), + model=ExpertAnswerListResponse, + ) + + async def delete( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Delete Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def edit_answer( + self, + expert_answer_id: str, + *, + project_id: str, + answer: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerEditAnswerResponse: + """ + Edit Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return await self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/edit_expert_answer", + body=await async_maybe_transform( + {"answer": answer}, expert_answer_edit_answer_params.ExpertAnswerEditAnswerParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerEditAnswerResponse, + ) + + async def edit_draft_answer( + self, + expert_answer_id: str, + *, + project_id: str, + draft_answer: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerEditDraftAnswerResponse: + """ + Edit Draft Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return await self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/edit_draft_expert_answer", + body=await async_maybe_transform( + {"draft_answer": draft_answer}, expert_answer_edit_draft_answer_params.ExpertAnswerEditDraftAnswerParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerEditDraftAnswerResponse, + ) + + async def pause( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerPauseResponse: + """ + Pause Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return await self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/pause", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerPauseResponse, + ) + + async def publish( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerPublishResponse: + """ + Publish Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return await self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/publish", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerPublishResponse, + ) + + async def unpause( + self, + expert_answer_id: str, + *, + project_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ExpertAnswerUnpauseResponse: + """ + Unpause Expert Answer Route + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not project_id: + raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") + if not expert_answer_id: + raise ValueError(f"Expected a non-empty value for `expert_answer_id` but received {expert_answer_id!r}") + return await self._patch( + f"/api/projects/{project_id}/expert_answers/{expert_answer_id}/unpause", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ExpertAnswerUnpauseResponse, + ) + + +class ExpertAnswersResourceWithRawResponse: + def __init__(self, expert_answers: ExpertAnswersResource) -> None: + self._expert_answers = expert_answers + + self.create = to_raw_response_wrapper( + expert_answers.create, + ) + self.retrieve = to_raw_response_wrapper( + expert_answers.retrieve, + ) + self.list = to_raw_response_wrapper( + expert_answers.list, + ) + self.delete = to_raw_response_wrapper( + expert_answers.delete, + ) + self.edit_answer = to_raw_response_wrapper( + expert_answers.edit_answer, + ) + self.edit_draft_answer = to_raw_response_wrapper( + expert_answers.edit_draft_answer, + ) + self.pause = to_raw_response_wrapper( + expert_answers.pause, + ) + self.publish = to_raw_response_wrapper( + expert_answers.publish, + ) + self.unpause = to_raw_response_wrapper( + expert_answers.unpause, + ) + + +class AsyncExpertAnswersResourceWithRawResponse: + def __init__(self, expert_answers: AsyncExpertAnswersResource) -> None: + self._expert_answers = expert_answers + + self.create = async_to_raw_response_wrapper( + expert_answers.create, + ) + self.retrieve = async_to_raw_response_wrapper( + expert_answers.retrieve, + ) + self.list = async_to_raw_response_wrapper( + expert_answers.list, + ) + self.delete = async_to_raw_response_wrapper( + expert_answers.delete, + ) + self.edit_answer = async_to_raw_response_wrapper( + expert_answers.edit_answer, + ) + self.edit_draft_answer = async_to_raw_response_wrapper( + expert_answers.edit_draft_answer, + ) + self.pause = async_to_raw_response_wrapper( + expert_answers.pause, + ) + self.publish = async_to_raw_response_wrapper( + expert_answers.publish, + ) + self.unpause = async_to_raw_response_wrapper( + expert_answers.unpause, + ) + + +class ExpertAnswersResourceWithStreamingResponse: + def __init__(self, expert_answers: ExpertAnswersResource) -> None: + self._expert_answers = expert_answers + + self.create = to_streamed_response_wrapper( + expert_answers.create, + ) + self.retrieve = to_streamed_response_wrapper( + expert_answers.retrieve, + ) + self.list = to_streamed_response_wrapper( + expert_answers.list, + ) + self.delete = to_streamed_response_wrapper( + expert_answers.delete, + ) + self.edit_answer = to_streamed_response_wrapper( + expert_answers.edit_answer, + ) + self.edit_draft_answer = to_streamed_response_wrapper( + expert_answers.edit_draft_answer, + ) + self.pause = to_streamed_response_wrapper( + expert_answers.pause, + ) + self.publish = to_streamed_response_wrapper( + expert_answers.publish, + ) + self.unpause = to_streamed_response_wrapper( + expert_answers.unpause, + ) + + +class AsyncExpertAnswersResourceWithStreamingResponse: + def __init__(self, expert_answers: AsyncExpertAnswersResource) -> None: + self._expert_answers = expert_answers + + self.create = async_to_streamed_response_wrapper( + expert_answers.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + expert_answers.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + expert_answers.list, + ) + self.delete = async_to_streamed_response_wrapper( + expert_answers.delete, + ) + self.edit_answer = async_to_streamed_response_wrapper( + expert_answers.edit_answer, + ) + self.edit_draft_answer = async_to_streamed_response_wrapper( + expert_answers.edit_draft_answer, + ) + self.pause = async_to_streamed_response_wrapper( + expert_answers.pause, + ) + self.publish = async_to_streamed_response_wrapper( + expert_answers.publish, + ) + self.unpause = async_to_streamed_response_wrapper( + expert_answers.unpause, + ) diff --git a/src/codex/resources/projects/remediations.py b/src/codex/resources/projects/remediations/remediations.py similarity index 77% rename from src/codex/resources/projects/remediations.py rename to src/codex/resources/projects/remediations/remediations.py index 1164262..23873af 100644 --- a/src/codex/resources/projects/remediations.py +++ b/src/codex/resources/projects/remediations/remediations.py @@ -2,45 +2,58 @@ from __future__ import annotations +import typing_extensions from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal import httpx -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...pagination import SyncOffsetPageRemediations, AsyncOffsetPageRemediations -from ..._base_client import AsyncPaginator, make_request_options -from ...types.projects import ( +from ....pagination import SyncOffsetPageRemediations, AsyncOffsetPageRemediations +from .expert_answers import ( + ExpertAnswersResource, + AsyncExpertAnswersResource, + ExpertAnswersResourceWithRawResponse, + AsyncExpertAnswersResourceWithRawResponse, + ExpertAnswersResourceWithStreamingResponse, + AsyncExpertAnswersResourceWithStreamingResponse, +) +from ...._base_client import AsyncPaginator, make_request_options +from ....types.projects import ( remediation_list_params, remediation_create_params, remediation_edit_answer_params, remediation_edit_draft_answer_params, ) -from ...types.projects.remediation_list_response import RemediationListResponse -from ...types.projects.remediation_pause_response import RemediationPauseResponse -from ...types.projects.remediation_create_response import RemediationCreateResponse -from ...types.projects.remediation_publish_response import RemediationPublishResponse -from ...types.projects.remediation_unpause_response import RemediationUnpauseResponse -from ...types.projects.remediation_retrieve_response import RemediationRetrieveResponse -from ...types.projects.remediation_edit_answer_response import RemediationEditAnswerResponse -from ...types.projects.remediation_edit_draft_answer_response import RemediationEditDraftAnswerResponse -from ...types.projects.remediation_list_resolved_logs_response import RemediationListResolvedLogsResponse -from ...types.projects.remediation_get_resolved_logs_count_response import RemediationGetResolvedLogsCountResponse +from ....types.projects.remediation_list_response import RemediationListResponse +from ....types.projects.remediation_pause_response import RemediationPauseResponse +from ....types.projects.remediation_create_response import RemediationCreateResponse +from ....types.projects.remediation_publish_response import RemediationPublishResponse +from ....types.projects.remediation_unpause_response import RemediationUnpauseResponse +from ....types.projects.remediation_retrieve_response import RemediationRetrieveResponse +from ....types.projects.remediation_edit_answer_response import RemediationEditAnswerResponse +from ....types.projects.remediation_edit_draft_answer_response import RemediationEditDraftAnswerResponse +from ....types.projects.remediation_list_resolved_logs_response import RemediationListResolvedLogsResponse +from ....types.projects.remediation_get_resolved_logs_count_response import RemediationGetResolvedLogsCountResponse __all__ = ["RemediationsResource", "AsyncRemediationsResource"] class RemediationsResource(SyncAPIResource): + @cached_property + def expert_answers(self) -> ExpertAnswersResource: + return ExpertAnswersResource(self._client) + @cached_property def with_raw_response(self) -> RemediationsResourceWithRawResponse: """ @@ -60,6 +73,7 @@ def with_streaming_response(self) -> RemediationsResourceWithStreamingResponse: """ return RemediationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, project_id: str, @@ -104,6 +118,7 @@ def create( cast_to=RemediationCreateResponse, ) + @typing_extensions.deprecated("deprecated") def retrieve( self, remediation_id: str, @@ -140,6 +155,7 @@ def retrieve( cast_to=RemediationRetrieveResponse, ) + @typing_extensions.deprecated("deprecated") def list( self, project_id: str, @@ -214,6 +230,7 @@ def list( model=RemediationListResponse, ) + @typing_extensions.deprecated("deprecated") def delete( self, remediation_id: str, @@ -251,6 +268,7 @@ def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") def edit_answer( self, remediation_id: str, @@ -289,6 +307,7 @@ def edit_answer( cast_to=RemediationEditAnswerResponse, ) + @typing_extensions.deprecated("deprecated") def edit_draft_answer( self, remediation_id: str, @@ -329,6 +348,7 @@ def edit_draft_answer( cast_to=RemediationEditDraftAnswerResponse, ) + @typing_extensions.deprecated("deprecated") def get_resolved_logs_count( self, remediation_id: str, @@ -365,6 +385,7 @@ def get_resolved_logs_count( cast_to=RemediationGetResolvedLogsCountResponse, ) + @typing_extensions.deprecated("deprecated") def list_resolved_logs( self, remediation_id: str, @@ -401,6 +422,7 @@ def list_resolved_logs( cast_to=RemediationListResolvedLogsResponse, ) + @typing_extensions.deprecated("deprecated") def pause( self, remediation_id: str, @@ -437,6 +459,7 @@ def pause( cast_to=RemediationPauseResponse, ) + @typing_extensions.deprecated("deprecated") def publish( self, remediation_id: str, @@ -473,6 +496,7 @@ def publish( cast_to=RemediationPublishResponse, ) + @typing_extensions.deprecated("deprecated") def unpause( self, remediation_id: str, @@ -511,6 +535,10 @@ def unpause( class AsyncRemediationsResource(AsyncAPIResource): + @cached_property + def expert_answers(self) -> AsyncExpertAnswersResource: + return AsyncExpertAnswersResource(self._client) + @cached_property def with_raw_response(self) -> AsyncRemediationsResourceWithRawResponse: """ @@ -530,6 +558,7 @@ def with_streaming_response(self) -> AsyncRemediationsResourceWithStreamingRespo """ return AsyncRemediationsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, project_id: str, @@ -574,6 +603,7 @@ async def create( cast_to=RemediationCreateResponse, ) + @typing_extensions.deprecated("deprecated") async def retrieve( self, remediation_id: str, @@ -610,6 +640,7 @@ async def retrieve( cast_to=RemediationRetrieveResponse, ) + @typing_extensions.deprecated("deprecated") def list( self, project_id: str, @@ -684,6 +715,7 @@ def list( model=RemediationListResponse, ) + @typing_extensions.deprecated("deprecated") async def delete( self, remediation_id: str, @@ -721,6 +753,7 @@ async def delete( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") async def edit_answer( self, remediation_id: str, @@ -761,6 +794,7 @@ async def edit_answer( cast_to=RemediationEditAnswerResponse, ) + @typing_extensions.deprecated("deprecated") async def edit_draft_answer( self, remediation_id: str, @@ -801,6 +835,7 @@ async def edit_draft_answer( cast_to=RemediationEditDraftAnswerResponse, ) + @typing_extensions.deprecated("deprecated") async def get_resolved_logs_count( self, remediation_id: str, @@ -837,6 +872,7 @@ async def get_resolved_logs_count( cast_to=RemediationGetResolvedLogsCountResponse, ) + @typing_extensions.deprecated("deprecated") async def list_resolved_logs( self, remediation_id: str, @@ -873,6 +909,7 @@ async def list_resolved_logs( cast_to=RemediationListResolvedLogsResponse, ) + @typing_extensions.deprecated("deprecated") async def pause( self, remediation_id: str, @@ -909,6 +946,7 @@ async def pause( cast_to=RemediationPauseResponse, ) + @typing_extensions.deprecated("deprecated") async def publish( self, remediation_id: str, @@ -945,6 +983,7 @@ async def publish( cast_to=RemediationPublishResponse, ) + @typing_extensions.deprecated("deprecated") async def unpause( self, remediation_id: str, @@ -986,153 +1025,257 @@ class RemediationsResourceWithRawResponse: def __init__(self, remediations: RemediationsResource) -> None: self._remediations = remediations - self.create = to_raw_response_wrapper( - remediations.create, - ) - self.retrieve = to_raw_response_wrapper( - remediations.retrieve, - ) - self.list = to_raw_response_wrapper( - remediations.list, - ) - self.delete = to_raw_response_wrapper( - remediations.delete, - ) - self.edit_answer = to_raw_response_wrapper( - remediations.edit_answer, - ) - self.edit_draft_answer = to_raw_response_wrapper( - remediations.edit_draft_answer, - ) - self.get_resolved_logs_count = to_raw_response_wrapper( - remediations.get_resolved_logs_count, - ) - self.list_resolved_logs = to_raw_response_wrapper( - remediations.list_resolved_logs, - ) - self.pause = to_raw_response_wrapper( - remediations.pause, - ) - self.publish = to_raw_response_wrapper( - remediations.publish, - ) - self.unpause = to_raw_response_wrapper( - remediations.unpause, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.create, # pyright: ignore[reportDeprecated], + ) + ) + self.retrieve = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.retrieve, # pyright: ignore[reportDeprecated], + ) + ) + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.list, # pyright: ignore[reportDeprecated], + ) + ) + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.delete, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_answer = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.edit_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_draft_answer = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.edit_draft_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.get_resolved_logs_count = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.get_resolved_logs_count, # pyright: ignore[reportDeprecated], + ) + ) + self.list_resolved_logs = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.list_resolved_logs, # pyright: ignore[reportDeprecated], + ) + ) + self.pause = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.pause, # pyright: ignore[reportDeprecated], + ) + ) + self.publish = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.publish, # pyright: ignore[reportDeprecated], + ) + ) + self.unpause = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + remediations.unpause, # pyright: ignore[reportDeprecated], + ) ) + @cached_property + def expert_answers(self) -> ExpertAnswersResourceWithRawResponse: + return ExpertAnswersResourceWithRawResponse(self._remediations.expert_answers) + class AsyncRemediationsResourceWithRawResponse: def __init__(self, remediations: AsyncRemediationsResource) -> None: self._remediations = remediations - self.create = async_to_raw_response_wrapper( - remediations.create, - ) - self.retrieve = async_to_raw_response_wrapper( - remediations.retrieve, - ) - self.list = async_to_raw_response_wrapper( - remediations.list, - ) - self.delete = async_to_raw_response_wrapper( - remediations.delete, - ) - self.edit_answer = async_to_raw_response_wrapper( - remediations.edit_answer, - ) - self.edit_draft_answer = async_to_raw_response_wrapper( - remediations.edit_draft_answer, - ) - self.get_resolved_logs_count = async_to_raw_response_wrapper( - remediations.get_resolved_logs_count, - ) - self.list_resolved_logs = async_to_raw_response_wrapper( - remediations.list_resolved_logs, - ) - self.pause = async_to_raw_response_wrapper( - remediations.pause, - ) - self.publish = async_to_raw_response_wrapper( - remediations.publish, - ) - self.unpause = async_to_raw_response_wrapper( - remediations.unpause, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.create, # pyright: ignore[reportDeprecated], + ) + ) + self.retrieve = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.retrieve, # pyright: ignore[reportDeprecated], + ) + ) + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.list, # pyright: ignore[reportDeprecated], + ) + ) + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.delete, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_answer = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.edit_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_draft_answer = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.edit_draft_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.get_resolved_logs_count = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.get_resolved_logs_count, # pyright: ignore[reportDeprecated], + ) + ) + self.list_resolved_logs = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.list_resolved_logs, # pyright: ignore[reportDeprecated], + ) + ) + self.pause = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.pause, # pyright: ignore[reportDeprecated], + ) + ) + self.publish = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.publish, # pyright: ignore[reportDeprecated], + ) + ) + self.unpause = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + remediations.unpause, # pyright: ignore[reportDeprecated], + ) ) + @cached_property + def expert_answers(self) -> AsyncExpertAnswersResourceWithRawResponse: + return AsyncExpertAnswersResourceWithRawResponse(self._remediations.expert_answers) + class RemediationsResourceWithStreamingResponse: def __init__(self, remediations: RemediationsResource) -> None: self._remediations = remediations - self.create = to_streamed_response_wrapper( - remediations.create, - ) - self.retrieve = to_streamed_response_wrapper( - remediations.retrieve, - ) - self.list = to_streamed_response_wrapper( - remediations.list, - ) - self.delete = to_streamed_response_wrapper( - remediations.delete, - ) - self.edit_answer = to_streamed_response_wrapper( - remediations.edit_answer, - ) - self.edit_draft_answer = to_streamed_response_wrapper( - remediations.edit_draft_answer, - ) - self.get_resolved_logs_count = to_streamed_response_wrapper( - remediations.get_resolved_logs_count, - ) - self.list_resolved_logs = to_streamed_response_wrapper( - remediations.list_resolved_logs, - ) - self.pause = to_streamed_response_wrapper( - remediations.pause, - ) - self.publish = to_streamed_response_wrapper( - remediations.publish, - ) - self.unpause = to_streamed_response_wrapper( - remediations.unpause, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.create, # pyright: ignore[reportDeprecated], + ) + ) + self.retrieve = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.retrieve, # pyright: ignore[reportDeprecated], + ) + ) + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.list, # pyright: ignore[reportDeprecated], + ) + ) + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.delete, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_answer = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.edit_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_draft_answer = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.edit_draft_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.get_resolved_logs_count = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.get_resolved_logs_count, # pyright: ignore[reportDeprecated], + ) + ) + self.list_resolved_logs = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.list_resolved_logs, # pyright: ignore[reportDeprecated], + ) + ) + self.pause = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.pause, # pyright: ignore[reportDeprecated], + ) + ) + self.publish = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.publish, # pyright: ignore[reportDeprecated], + ) + ) + self.unpause = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + remediations.unpause, # pyright: ignore[reportDeprecated], + ) ) + @cached_property + def expert_answers(self) -> ExpertAnswersResourceWithStreamingResponse: + return ExpertAnswersResourceWithStreamingResponse(self._remediations.expert_answers) + class AsyncRemediationsResourceWithStreamingResponse: def __init__(self, remediations: AsyncRemediationsResource) -> None: self._remediations = remediations - self.create = async_to_streamed_response_wrapper( - remediations.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - remediations.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - remediations.list, - ) - self.delete = async_to_streamed_response_wrapper( - remediations.delete, - ) - self.edit_answer = async_to_streamed_response_wrapper( - remediations.edit_answer, - ) - self.edit_draft_answer = async_to_streamed_response_wrapper( - remediations.edit_draft_answer, - ) - self.get_resolved_logs_count = async_to_streamed_response_wrapper( - remediations.get_resolved_logs_count, - ) - self.list_resolved_logs = async_to_streamed_response_wrapper( - remediations.list_resolved_logs, - ) - self.pause = async_to_streamed_response_wrapper( - remediations.pause, - ) - self.publish = async_to_streamed_response_wrapper( - remediations.publish, - ) - self.unpause = async_to_streamed_response_wrapper( - remediations.unpause, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.create, # pyright: ignore[reportDeprecated], + ) + ) + self.retrieve = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.retrieve, # pyright: ignore[reportDeprecated], + ) + ) + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.list, # pyright: ignore[reportDeprecated], + ) + ) + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.delete, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_answer = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.edit_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.edit_draft_answer = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.edit_draft_answer, # pyright: ignore[reportDeprecated], + ) + ) + self.get_resolved_logs_count = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.get_resolved_logs_count, # pyright: ignore[reportDeprecated], + ) + ) + self.list_resolved_logs = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.list_resolved_logs, # pyright: ignore[reportDeprecated], + ) + ) + self.pause = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.pause, # pyright: ignore[reportDeprecated], + ) + ) + self.publish = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.publish, # pyright: ignore[reportDeprecated], + ) + ) + self.unpause = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + remediations.unpause, # pyright: ignore[reportDeprecated], + ) ) + + @cached_property + def expert_answers(self) -> AsyncExpertAnswersResourceWithStreamingResponse: + return AsyncExpertAnswersResourceWithStreamingResponse(self._remediations.expert_answers) diff --git a/src/codex/types/projects/query_log_list_by_group_response.py b/src/codex/types/projects/query_log_list_by_group_response.py index 0aa74bf..ed1a32d 100644 --- a/src/codex/types/projects/query_log_list_by_group_response.py +++ b/src/codex/types/projects/query_log_list_by_group_response.py @@ -398,14 +398,14 @@ class QueryLogsByGroupQueryLog(BaseModel): is_bad_response: bool + issue_id: Optional[str] = None + needs_review: bool project_id: str question: str - remediation_id: str - remediation_status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "NOT_STARTED", "PAUSED", "NO_ACTION_NEEDED"] tool_call_names: Optional[List[str]] = None @@ -416,6 +416,9 @@ class QueryLogsByGroupQueryLog(BaseModel): ai_guidance_id: Optional[str] = None """ID of the AI guidance remediation that was created from this query log.""" + applied_expert_answer_id: Optional[str] = None + """ID of the expert answer that was applied to the query.""" + context: Optional[List[QueryLogsByGroupQueryLogContext]] = None """RAG context used for the query""" @@ -520,9 +523,6 @@ class QueryLogsByGroupQueryLog(BaseModel): primary_eval_issue_score: Optional[float] = None """Score of the primary eval issue""" - served_remediation_id: Optional[str] = None - """ID of the remediation that was served if cache hit, otherwise None.""" - tools: Optional[List[QueryLogsByGroupQueryLogTool]] = None """Tools to use for the LLM call. diff --git a/src/codex/types/projects/query_log_list_groups_response.py b/src/codex/types/projects/query_log_list_groups_response.py index e829f73..d20eb8c 100644 --- a/src/codex/types/projects/query_log_list_groups_response.py +++ b/src/codex/types/projects/query_log_list_groups_response.py @@ -391,14 +391,14 @@ class QueryLogListGroupsResponse(BaseModel): is_bad_response: bool + issue_id: Optional[str] = None + needs_review: bool project_id: str question: str - remediation_id: str - remediation_status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "NOT_STARTED", "PAUSED", "NO_ACTION_NEEDED"] tool_call_names: Optional[List[str]] = None @@ -411,6 +411,9 @@ class QueryLogListGroupsResponse(BaseModel): ai_guidance_id: Optional[str] = None """ID of the AI guidance remediation that was created from this query log.""" + applied_expert_answer_id: Optional[str] = None + """ID of the expert answer that was applied to the query.""" + context: Optional[List[Context]] = None """RAG context used for the query""" @@ -515,9 +518,6 @@ class QueryLogListGroupsResponse(BaseModel): primary_eval_issue_score: Optional[float] = None """Score of the primary eval issue""" - served_remediation_id: Optional[str] = None - """ID of the remediation that was served if cache hit, otherwise None.""" - tools: Optional[List[Tool]] = None """Tools to use for the LLM call. diff --git a/src/codex/types/projects/query_log_list_response.py b/src/codex/types/projects/query_log_list_response.py index b26272e..9d8d198 100644 --- a/src/codex/types/projects/query_log_list_response.py +++ b/src/codex/types/projects/query_log_list_response.py @@ -385,12 +385,12 @@ class QueryLogListResponse(BaseModel): is_bad_response: bool + issue_id: Optional[str] = None + project_id: str question: str - remediation_id: str - tool_call_names: Optional[List[str]] = None was_cache_hit: Optional[bool] = None @@ -399,6 +399,9 @@ class QueryLogListResponse(BaseModel): ai_guidance_id: Optional[str] = None """ID of the AI guidance remediation that was created from this query log.""" + applied_expert_answer_id: Optional[str] = None + """ID of the expert answer that was applied to the query.""" + context: Optional[List[Context]] = None """RAG context used for the query""" @@ -500,9 +503,6 @@ class QueryLogListResponse(BaseModel): primary_eval_issue_score: Optional[float] = None """Score of the primary eval issue""" - served_remediation_id: Optional[str] = None - """ID of the remediation that was served if cache hit, otherwise None.""" - tools: Optional[List[Tool]] = None """Tools to use for the LLM call. diff --git a/src/codex/types/projects/query_log_retrieve_response.py b/src/codex/types/projects/query_log_retrieve_response.py index 0ef986f..3943325 100644 --- a/src/codex/types/projects/query_log_retrieve_response.py +++ b/src/codex/types/projects/query_log_retrieve_response.py @@ -365,6 +365,8 @@ class QueryLogRetrieveResponse(BaseModel): created_at: datetime + expert_answer_id: Optional[str] = None + formatted_escalation_eval_scores: Optional[Dict[str, FormattedEscalationEvalScores]] = None formatted_eval_scores: Optional[Dict[str, FormattedEvalScores]] = None @@ -385,16 +387,17 @@ class QueryLogRetrieveResponse(BaseModel): is_bad_response: bool + issue_id: Optional[str] = None + + issue_status: Literal["addressed", "unaddressed"] + """Manual review status override for remediations.""" + needs_review: bool project_id: str question: str - remediation_id: str - - remediation_status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "NOT_STARTED", "PAUSED", "NO_ACTION_NEEDED"] - tool_call_names: Optional[List[str]] = None was_cache_hit: Optional[bool] = None @@ -403,6 +406,9 @@ class QueryLogRetrieveResponse(BaseModel): ai_guidance_id: Optional[str] = None """ID of the AI guidance remediation that was created from this query log.""" + applied_expert_answer_id: Optional[str] = None + """ID of the expert answer that was applied to the query.""" + context: Optional[List[Context]] = None """RAG context used for the query""" @@ -507,9 +513,6 @@ class QueryLogRetrieveResponse(BaseModel): primary_eval_issue_score: Optional[float] = None """Score of the primary eval issue""" - served_remediation_id: Optional[str] = None - """ID of the remediation that was served if cache hit, otherwise None.""" - tools: Optional[List[Tool]] = None """Tools to use for the LLM call. diff --git a/src/codex/types/projects/remediation_list_resolved_logs_response.py b/src/codex/types/projects/remediation_list_resolved_logs_response.py index e04e413..e586b14 100644 --- a/src/codex/types/projects/remediation_list_resolved_logs_response.py +++ b/src/codex/types/projects/remediation_list_resolved_logs_response.py @@ -392,12 +392,12 @@ class QueryLog(BaseModel): is_bad_response: bool + issue_id: Optional[str] = None + project_id: str question: str - remediation_id: str - tool_call_names: Optional[List[str]] = None was_cache_hit: Optional[bool] = None @@ -406,6 +406,9 @@ class QueryLog(BaseModel): ai_guidance_id: Optional[str] = None """ID of the AI guidance remediation that was created from this query log.""" + applied_expert_answer_id: Optional[str] = None + """ID of the expert answer that was applied to the query.""" + context: Optional[List[QueryLogContext]] = None """RAG context used for the query""" @@ -507,9 +510,6 @@ class QueryLog(BaseModel): primary_eval_issue_score: Optional[float] = None """Score of the primary eval issue""" - served_remediation_id: Optional[str] = None - """ID of the remediation that was served if cache hit, otherwise None.""" - tools: Optional[List[QueryLogTool]] = None """Tools to use for the LLM call. diff --git a/src/codex/types/projects/remediations/__init__.py b/src/codex/types/projects/remediations/__init__.py new file mode 100644 index 0000000..da14220 --- /dev/null +++ b/src/codex/types/projects/remediations/__init__.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .expert_answer_list_params import ExpertAnswerListParams as ExpertAnswerListParams +from .expert_answer_create_params import ExpertAnswerCreateParams as ExpertAnswerCreateParams +from .expert_answer_list_response import ExpertAnswerListResponse as ExpertAnswerListResponse +from .expert_answer_pause_response import ExpertAnswerPauseResponse as ExpertAnswerPauseResponse +from .expert_answer_create_response import ExpertAnswerCreateResponse as ExpertAnswerCreateResponse +from .expert_answer_publish_response import ExpertAnswerPublishResponse as ExpertAnswerPublishResponse +from .expert_answer_unpause_response import ExpertAnswerUnpauseResponse as ExpertAnswerUnpauseResponse +from .expert_answer_retrieve_response import ExpertAnswerRetrieveResponse as ExpertAnswerRetrieveResponse +from .expert_answer_edit_answer_params import ExpertAnswerEditAnswerParams as ExpertAnswerEditAnswerParams +from .expert_answer_edit_answer_response import ExpertAnswerEditAnswerResponse as ExpertAnswerEditAnswerResponse +from .expert_answer_edit_draft_answer_params import ( + ExpertAnswerEditDraftAnswerParams as ExpertAnswerEditDraftAnswerParams, +) +from .expert_answer_edit_draft_answer_response import ( + ExpertAnswerEditDraftAnswerResponse as ExpertAnswerEditDraftAnswerResponse, +) diff --git a/src/codex/types/projects/remediations/expert_answer_create_params.py b/src/codex/types/projects/remediations/expert_answer_create_params.py new file mode 100644 index 0000000..34c3316 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_create_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["ExpertAnswerCreateParams"] + + +class ExpertAnswerCreateParams(TypedDict, total=False): + query: Required[str] + + answer: Optional[str] + + draft_answer: Optional[str] diff --git a/src/codex/types/projects/remediations/expert_answer_create_response.py b/src/codex/types/projects/remediations/expert_answer_create_response.py new file mode 100644 index 0000000..b58d033 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_create_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerCreateResponse"] + + +class ExpertAnswerCreateResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/src/codex/types/projects/remediations/expert_answer_edit_answer_params.py b/src/codex/types/projects/remediations/expert_answer_edit_answer_params.py new file mode 100644 index 0000000..44e75c9 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_edit_answer_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ExpertAnswerEditAnswerParams"] + + +class ExpertAnswerEditAnswerParams(TypedDict, total=False): + project_id: Required[str] + + answer: Required[str] diff --git a/src/codex/types/projects/remediations/expert_answer_edit_answer_response.py b/src/codex/types/projects/remediations/expert_answer_edit_answer_response.py new file mode 100644 index 0000000..2e3d558 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_edit_answer_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerEditAnswerResponse"] + + +class ExpertAnswerEditAnswerResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/src/codex/types/projects/remediations/expert_answer_edit_draft_answer_params.py b/src/codex/types/projects/remediations/expert_answer_edit_draft_answer_params.py new file mode 100644 index 0000000..3b3ab8b --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_edit_draft_answer_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ExpertAnswerEditDraftAnswerParams"] + + +class ExpertAnswerEditDraftAnswerParams(TypedDict, total=False): + project_id: Required[str] + + draft_answer: Required[str] diff --git a/src/codex/types/projects/remediations/expert_answer_edit_draft_answer_response.py b/src/codex/types/projects/remediations/expert_answer_edit_draft_answer_response.py new file mode 100644 index 0000000..7872526 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_edit_draft_answer_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerEditDraftAnswerResponse"] + + +class ExpertAnswerEditDraftAnswerResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/src/codex/types/projects/remediations/expert_answer_list_params.py b/src/codex/types/projects/remediations/expert_answer_list_params.py new file mode 100644 index 0000000..3a9fd1e --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_list_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["ExpertAnswerListParams"] + + +class ExpertAnswerListParams(TypedDict, total=False): + created_at_end: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Filter remediations created at or before this timestamp""" + + created_at_start: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Filter remediations created at or after this timestamp""" + + last_edited_at_end: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Filter remediations last edited at or before this timestamp""" + + last_edited_at_start: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Filter remediations last edited at or after this timestamp""" + + last_edited_by: Optional[str] + """Filter by last edited by user ID""" + + limit: int + + offset: int + + order: Literal["asc", "desc"] + + sort: Optional[Literal["created_at", "last_edited_at", "resolved_logs_count"]] + + status: Optional[List[Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"]]] + """Filter expert answers that have ANY of these statuses (OR operation)""" diff --git a/src/codex/types/projects/remediations/expert_answer_list_response.py b/src/codex/types/projects/remediations/expert_answer_list_response.py new file mode 100644 index 0000000..8eabb3f --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_list_response.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerListResponse"] + + +class ExpertAnswerListResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + resolved_logs_count: int + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/src/codex/types/projects/remediations/expert_answer_pause_response.py b/src/codex/types/projects/remediations/expert_answer_pause_response.py new file mode 100644 index 0000000..a2c9a0a --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_pause_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerPauseResponse"] + + +class ExpertAnswerPauseResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/src/codex/types/projects/remediations/expert_answer_publish_response.py b/src/codex/types/projects/remediations/expert_answer_publish_response.py new file mode 100644 index 0000000..547a036 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_publish_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerPublishResponse"] + + +class ExpertAnswerPublishResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/src/codex/types/projects/remediations/expert_answer_retrieve_response.py b/src/codex/types/projects/remediations/expert_answer_retrieve_response.py new file mode 100644 index 0000000..b1da431 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_retrieve_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerRetrieveResponse"] + + +class ExpertAnswerRetrieveResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/src/codex/types/projects/remediations/expert_answer_unpause_response.py b/src/codex/types/projects/remediations/expert_answer_unpause_response.py new file mode 100644 index 0000000..a160284 --- /dev/null +++ b/src/codex/types/projects/remediations/expert_answer_unpause_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["ExpertAnswerUnpauseResponse"] + + +class ExpertAnswerUnpauseResponse(BaseModel): + id: str + + answered_at: Optional[datetime] = None + + answered_by: Optional[str] = None + + created_at: datetime + + last_edited_at: Optional[datetime] = None + + last_edited_by: Optional[str] = None + + needs_review: bool + + project_id: str + + query: str + + status: Literal["ACTIVE", "DRAFT", "ACTIVE_WITH_DRAFT", "PAUSED"] + + answer: Optional[str] = None + + draft_answer: Optional[str] = None + + issue_id: Optional[str] = None + + manual_review_status_override: Optional[Literal["addressed", "unaddressed"]] = None + """Manual review status override for issues.""" diff --git a/tests/api_resources/projects/remediations/__init__.py b/tests/api_resources/projects/remediations/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/projects/remediations/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/projects/remediations/test_expert_answers.py b/tests/api_resources/projects/remediations/test_expert_answers.py new file mode 100644 index 0000000..d0757e9 --- /dev/null +++ b/tests/api_resources/projects/remediations/test_expert_answers.py @@ -0,0 +1,1019 @@ +# 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 pytest + +from codex import Codex, AsyncCodex +from tests.utils import assert_matches_type +from codex._utils import parse_datetime +from codex.pagination import SyncOffsetPageExpertAnswers, AsyncOffsetPageExpertAnswers +from codex.types.projects.remediations import ( + ExpertAnswerListResponse, + ExpertAnswerPauseResponse, + ExpertAnswerCreateResponse, + ExpertAnswerPublishResponse, + ExpertAnswerUnpauseResponse, + ExpertAnswerRetrieveResponse, + ExpertAnswerEditAnswerResponse, + ExpertAnswerEditDraftAnswerResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestExpertAnswers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + ) + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + answer="answer", + draft_answer="draft_answer", + ) + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_create(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.create( + project_id="", + query="x", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_retrieve(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerRetrieveResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_retrieve(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(ExpertAnswerRetrieveResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_retrieve(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(ExpertAnswerRetrieveResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_retrieve(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.retrieve( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(SyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_by="last_edited_by", + limit=1, + offset=0, + order="asc", + sort="created_at", + status=["ACTIVE"], + ) + assert_matches_type(SyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(SyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(SyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_list(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.list( + project_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert expert_answer is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert expert_answer is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert expert_answer is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.delete( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_edit_answer(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + assert_matches_type(ExpertAnswerEditAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_edit_answer(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(ExpertAnswerEditAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_edit_answer(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(ExpertAnswerEditAnswerResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_edit_answer(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + answer="answer", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.edit_answer( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_edit_draft_answer(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + assert_matches_type(ExpertAnswerEditDraftAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_edit_draft_answer(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(ExpertAnswerEditDraftAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_edit_draft_answer(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(ExpertAnswerEditDraftAnswerResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_edit_draft_answer(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + draft_answer="draft_answer", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.edit_draft_answer( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_pause(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerPauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_pause(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(ExpertAnswerPauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_pause(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(ExpertAnswerPauseResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_pause(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.pause( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_publish(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerPublishResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_publish(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(ExpertAnswerPublishResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_publish(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(ExpertAnswerPublishResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_publish(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.publish( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_unpause(self, client: Codex) -> None: + expert_answer = client.projects.remediations.expert_answers.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerUnpauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_unpause(self, client: Codex) -> None: + response = client.projects.remediations.expert_answers.with_raw_response.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = response.parse() + assert_matches_type(ExpertAnswerUnpauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_unpause(self, client: Codex) -> None: + with client.projects.remediations.expert_answers.with_streaming_response.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = response.parse() + assert_matches_type(ExpertAnswerUnpauseResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_unpause(self, client: Codex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + client.projects.remediations.expert_answers.with_raw_response.unpause( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + +class TestAsyncExpertAnswers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + ) + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + answer="answer", + draft_answer="draft_answer", + ) + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + query="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerCreateResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_create(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.create( + project_id="", + query="x", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_retrieve(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerRetrieveResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerRetrieveResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerRetrieveResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.retrieve( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.retrieve( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(AsyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_by="last_edited_by", + limit=1, + offset=0, + order="asc", + sort="created_at", + status=["ACTIVE"], + ) + assert_matches_type(AsyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(AsyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type( + AsyncOffsetPageExpertAnswers[ExpertAnswerListResponse], expert_answer, path=["response"] + ) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_list(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.list( + project_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert expert_answer is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert expert_answer is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert expert_answer is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.delete( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.delete( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_edit_answer(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + assert_matches_type(ExpertAnswerEditAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_edit_answer(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerEditAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_edit_answer(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerEditAnswerResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_edit_answer(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.edit_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + answer="answer", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.edit_answer( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_edit_draft_answer(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + assert_matches_type(ExpertAnswerEditDraftAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_edit_draft_answer(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerEditDraftAnswerResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_edit_draft_answer(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerEditDraftAnswerResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_edit_draft_answer(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.edit_draft_answer( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + draft_answer="draft_answer", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.edit_draft_answer( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_pause(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerPauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_pause(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerPauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_pause(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerPauseResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_pause(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.pause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.pause( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_publish(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerPublishResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_publish(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerPublishResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_publish(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerPublishResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_publish(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.publish( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.publish( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_unpause(self, async_client: AsyncCodex) -> None: + expert_answer = await async_client.projects.remediations.expert_answers.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(ExpertAnswerUnpauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_unpause(self, async_client: AsyncCodex) -> None: + response = await async_client.projects.remediations.expert_answers.with_raw_response.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerUnpauseResponse, expert_answer, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_unpause(self, async_client: AsyncCodex) -> None: + async with async_client.projects.remediations.expert_answers.with_streaming_response.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + expert_answer = await response.parse() + assert_matches_type(ExpertAnswerUnpauseResponse, expert_answer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_unpause(self, async_client: AsyncCodex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.unpause( + expert_answer_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `expert_answer_id` but received ''"): + await async_client.projects.remediations.expert_answers.with_raw_response.unpause( + expert_answer_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) diff --git a/tests/api_resources/projects/test_query_logs.py b/tests/api_resources/projects/test_query_logs.py index 51262fe..e98cb27 100644 --- a/tests/api_resources/projects/test_query_logs.py +++ b/tests/api_resources/projects/test_query_logs.py @@ -26,6 +26,8 @@ QueryLogStartRemediationResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -210,43 +212,48 @@ def test_path_params_add_user_feedback(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_by_group(self, client: Codex) -> None: - query_log = client.projects.query_logs.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + query_log = client.projects.query_logs.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_by_group_with_all_params(self, client: Codex) -> None: - query_log = client.projects.query_logs.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - custom_metadata="custom_metadata", - expert_review_status="good", - failed_evals=["string"], - guardrailed=True, - has_tool_calls=True, - limit=1, - needs_review=True, - offset=0, - order="asc", - passed_evals=["string"], - primary_eval_issue=["hallucination"], - remediation_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - search_text="search_text", - sort="created_at", - tool_call_names=["string"], - was_cache_hit=True, - ) + with pytest.warns(DeprecationWarning): + query_log = client.projects.query_logs.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + custom_metadata="custom_metadata", + expert_review_status="good", + failed_evals=["string"], + guardrailed=True, + has_tool_calls=True, + limit=1, + needs_review=True, + offset=0, + order="asc", + passed_evals=["string"], + primary_eval_issue=["hallucination"], + remediation_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + search_text="search_text", + sort="created_at", + tool_call_names=["string"], + was_cache_hit=True, + ) + assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_list_by_group(self, client: Codex) -> None: - response = client.projects.query_logs.with_raw_response.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.query_logs.with_raw_response.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -256,64 +263,71 @@ def test_raw_response_list_by_group(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_list_by_group(self, client: Codex) -> None: - with client.projects.query_logs.with_streaming_response.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.query_logs.with_streaming_response.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - query_log = response.parse() - assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) + query_log = response.parse() + assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_list_by_group(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.query_logs.with_raw_response.list_by_group( - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.query_logs.with_raw_response.list_by_group( + project_id="", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_groups(self, client: Codex) -> None: - query_log = client.projects.query_logs.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + query_log = client.projects.query_logs.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(SyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_groups_with_all_params(self, client: Codex) -> None: - query_log = client.projects.query_logs.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - custom_metadata="custom_metadata", - expert_review_status="good", - failed_evals=["string"], - guardrailed=True, - has_tool_calls=True, - limit=1, - needs_review=True, - offset=0, - order="asc", - passed_evals=["string"], - primary_eval_issue=["hallucination"], - search_text="search_text", - sort="created_at", - tool_call_names=["string"], - was_cache_hit=True, - ) + with pytest.warns(DeprecationWarning): + query_log = client.projects.query_logs.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + custom_metadata="custom_metadata", + expert_review_status="good", + failed_evals=["string"], + guardrailed=True, + has_tool_calls=True, + limit=1, + needs_review=True, + offset=0, + order="asc", + passed_evals=["string"], + primary_eval_issue=["hallucination"], + search_text="search_text", + sort="created_at", + tool_call_names=["string"], + was_cache_hit=True, + ) + assert_matches_type(SyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_list_groups(self, client: Codex) -> None: - response = client.projects.query_logs.with_raw_response.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.query_logs.with_raw_response.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -323,41 +337,48 @@ def test_raw_response_list_groups(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_list_groups(self, client: Codex) -> None: - with client.projects.query_logs.with_streaming_response.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.query_logs.with_streaming_response.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - query_log = response.parse() - assert_matches_type(SyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"]) + query_log = response.parse() + assert_matches_type( + SyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"] + ) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_list_groups(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.query_logs.with_raw_response.list_groups( - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.query_logs.with_raw_response.list_groups( + project_id="", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_start_remediation(self, client: Codex) -> None: - query_log = client.projects.query_logs.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + query_log = client.projects.query_logs.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(QueryLogStartRemediationResponse, query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_start_remediation(self, client: Codex) -> None: - response = client.projects.query_logs.with_raw_response.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.query_logs.with_raw_response.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -367,32 +388,34 @@ def test_raw_response_start_remediation(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_start_remediation(self, client: Codex) -> None: - with client.projects.query_logs.with_streaming_response.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.query_logs.with_streaming_response.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - query_log = response.parse() - assert_matches_type(QueryLogStartRemediationResponse, query_log, path=["response"]) + query_log = response.parse() + assert_matches_type(QueryLogStartRemediationResponse, query_log, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_start_remediation(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.query_logs.with_raw_response.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.query_logs.with_raw_response.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `query_log_id` but received ''"): - client.projects.query_logs.with_raw_response.start_remediation( - query_log_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `query_log_id` but received ''"): + client.projects.query_logs.with_raw_response.start_remediation( + query_log_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize @@ -635,43 +658,48 @@ async def test_path_params_add_user_feedback(self, async_client: AsyncCodex) -> @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_by_group(self, async_client: AsyncCodex) -> None: - query_log = await async_client.projects.query_logs.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + query_log = await async_client.projects.query_logs.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_by_group_with_all_params(self, async_client: AsyncCodex) -> None: - query_log = await async_client.projects.query_logs.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - custom_metadata="custom_metadata", - expert_review_status="good", - failed_evals=["string"], - guardrailed=True, - has_tool_calls=True, - limit=1, - needs_review=True, - offset=0, - order="asc", - passed_evals=["string"], - primary_eval_issue=["hallucination"], - remediation_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - search_text="search_text", - sort="created_at", - tool_call_names=["string"], - was_cache_hit=True, - ) + with pytest.warns(DeprecationWarning): + query_log = await async_client.projects.query_logs.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + custom_metadata="custom_metadata", + expert_review_status="good", + failed_evals=["string"], + guardrailed=True, + has_tool_calls=True, + limit=1, + needs_review=True, + offset=0, + order="asc", + passed_evals=["string"], + primary_eval_issue=["hallucination"], + remediation_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + search_text="search_text", + sort="created_at", + tool_call_names=["string"], + was_cache_hit=True, + ) + assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_list_by_group(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.query_logs.with_raw_response.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.query_logs.with_raw_response.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -681,64 +709,71 @@ async def test_raw_response_list_by_group(self, async_client: AsyncCodex) -> Non @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_list_by_group(self, async_client: AsyncCodex) -> None: - async with async_client.projects.query_logs.with_streaming_response.list_by_group( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.query_logs.with_streaming_response.list_by_group( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - query_log = await response.parse() - assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) + query_log = await response.parse() + assert_matches_type(QueryLogListByGroupResponse, query_log, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_list_by_group(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.query_logs.with_raw_response.list_by_group( - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.query_logs.with_raw_response.list_by_group( + project_id="", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_groups(self, async_client: AsyncCodex) -> None: - query_log = await async_client.projects.query_logs.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + query_log = await async_client.projects.query_logs.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(AsyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_groups_with_all_params(self, async_client: AsyncCodex) -> None: - query_log = await async_client.projects.query_logs.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - custom_metadata="custom_metadata", - expert_review_status="good", - failed_evals=["string"], - guardrailed=True, - has_tool_calls=True, - limit=1, - needs_review=True, - offset=0, - order="asc", - passed_evals=["string"], - primary_eval_issue=["hallucination"], - search_text="search_text", - sort="created_at", - tool_call_names=["string"], - was_cache_hit=True, - ) + with pytest.warns(DeprecationWarning): + query_log = await async_client.projects.query_logs.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + custom_metadata="custom_metadata", + expert_review_status="good", + failed_evals=["string"], + guardrailed=True, + has_tool_calls=True, + limit=1, + needs_review=True, + offset=0, + order="asc", + passed_evals=["string"], + primary_eval_issue=["hallucination"], + search_text="search_text", + sort="created_at", + tool_call_names=["string"], + was_cache_hit=True, + ) + assert_matches_type(AsyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_list_groups(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.query_logs.with_raw_response.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.query_logs.with_raw_response.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -748,41 +783,48 @@ async def test_raw_response_list_groups(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_list_groups(self, async_client: AsyncCodex) -> None: - async with async_client.projects.query_logs.with_streaming_response.list_groups( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.query_logs.with_streaming_response.list_groups( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - query_log = await response.parse() - assert_matches_type(AsyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"]) + query_log = await response.parse() + assert_matches_type( + AsyncOffsetPageQueryLogGroups[QueryLogListGroupsResponse], query_log, path=["response"] + ) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_list_groups(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.query_logs.with_raw_response.list_groups( - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.query_logs.with_raw_response.list_groups( + project_id="", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_start_remediation(self, async_client: AsyncCodex) -> None: - query_log = await async_client.projects.query_logs.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + query_log = await async_client.projects.query_logs.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(QueryLogStartRemediationResponse, query_log, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_start_remediation(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.query_logs.with_raw_response.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.query_logs.with_raw_response.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -792,32 +834,34 @@ async def test_raw_response_start_remediation(self, async_client: AsyncCodex) -> @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_start_remediation(self, async_client: AsyncCodex) -> None: - async with async_client.projects.query_logs.with_streaming_response.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.query_logs.with_streaming_response.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - query_log = await response.parse() - assert_matches_type(QueryLogStartRemediationResponse, query_log, path=["response"]) + query_log = await response.parse() + assert_matches_type(QueryLogStartRemediationResponse, query_log, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_start_remediation(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.query_logs.with_raw_response.start_remediation( - query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `query_log_id` but received ''"): - await async_client.projects.query_logs.with_raw_response.start_remediation( - query_log_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.query_logs.with_raw_response.start_remediation( + query_log_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `query_log_id` but received ''"): + await async_client.projects.query_logs.with_raw_response.start_remediation( + query_log_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize diff --git a/tests/api_resources/projects/test_remediations.py b/tests/api_resources/projects/test_remediations.py index d547ac8..37bb655 100644 --- a/tests/api_resources/projects/test_remediations.py +++ b/tests/api_resources/projects/test_remediations.py @@ -24,6 +24,8 @@ RemediationGetResolvedLogsCountResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -33,30 +35,35 @@ class TestRemediations: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_create(self, client: Codex) -> None: - remediation = client.projects.remediations.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + ) + assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_create_with_all_params(self, client: Codex) -> None: - remediation = client.projects.remediations.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - answer="answer", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + answer="answer", + draft_answer="draft_answer", + ) + assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_create(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -66,43 +73,48 @@ def test_raw_response_create(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_create(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_create(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.create( - project_id="", - question="x", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.create( + project_id="", + question="x", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_retrieve(self, client: Codex) -> None: - remediation = client.projects.remediations.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationRetrieveResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,65 +124,72 @@ def test_raw_response_retrieve(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationRetrieveResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationRetrieveResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_retrieve(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.retrieve( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.retrieve( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list(self, client: Codex) -> None: - remediation = client.projects.remediations.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(SyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Codex) -> None: - remediation = client.projects.remediations.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - last_edited_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - last_edited_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - last_edited_by="last_edited_by", - limit=1, - offset=0, - order="asc", - sort="created_at", - status=["ACTIVE"], - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_by="last_edited_by", + limit=1, + offset=0, + order="asc", + sort="created_at", + status=["ACTIVE"], + ) + assert_matches_type(SyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_list(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -180,41 +199,46 @@ def test_raw_response_list(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_list(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(SyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(SyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_list(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.list( - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.list( + project_id="", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_delete(self, client: Codex) -> None: - remediation = client.projects.remediations.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert remediation is None @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_delete(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -224,51 +248,56 @@ def test_raw_response_delete(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_delete(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert remediation is None + remediation = response.parse() + assert remediation is None assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_delete(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.delete( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.delete( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_edit_answer(self, client: Codex) -> None: - remediation = client.projects.remediations.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + assert_matches_type(RemediationEditAnswerResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_edit_answer(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -278,54 +307,59 @@ def test_raw_response_edit_answer(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_edit_answer(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationEditAnswerResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationEditAnswerResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_edit_answer(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - answer="answer", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + answer="answer", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.edit_answer( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.edit_answer( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_edit_draft_answer(self, client: Codex) -> None: - remediation = client.projects.remediations.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + assert_matches_type(RemediationEditDraftAnswerResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_edit_draft_answer(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -335,52 +369,57 @@ def test_raw_response_edit_draft_answer(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_edit_draft_answer(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationEditDraftAnswerResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationEditDraftAnswerResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_edit_draft_answer(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + draft_answer="draft_answer", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.edit_draft_answer( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.edit_draft_answer( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_get_resolved_logs_count(self, client: Codex) -> None: - remediation = client.projects.remediations.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationGetResolvedLogsCountResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_get_resolved_logs_count(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -390,49 +429,54 @@ def test_raw_response_get_resolved_logs_count(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_get_resolved_logs_count(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationGetResolvedLogsCountResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationGetResolvedLogsCountResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_get_resolved_logs_count(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.get_resolved_logs_count( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.get_resolved_logs_count( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_list_resolved_logs(self, client: Codex) -> None: - remediation = client.projects.remediations.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationListResolvedLogsResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_list_resolved_logs(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -442,49 +486,54 @@ def test_raw_response_list_resolved_logs(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_list_resolved_logs(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationListResolvedLogsResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationListResolvedLogsResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_list_resolved_logs(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.list_resolved_logs( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.list_resolved_logs( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_pause(self, client: Codex) -> None: - remediation = client.projects.remediations.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationPauseResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_pause(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -494,49 +543,54 @@ def test_raw_response_pause(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_pause(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationPauseResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationPauseResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_pause(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.pause( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.pause( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_publish(self, client: Codex) -> None: - remediation = client.projects.remediations.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationPublishResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_publish(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -546,49 +600,54 @@ def test_raw_response_publish(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_publish(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationPublishResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationPublishResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_publish(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.publish( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.publish( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_unpause(self, client: Codex) -> None: - remediation = client.projects.remediations.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = client.projects.remediations.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationUnpauseResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_raw_response_unpause(self, client: Codex) -> None: - response = client.projects.remediations.with_raw_response.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = client.projects.remediations.with_raw_response.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -598,32 +657,34 @@ def test_raw_response_unpause(self, client: Codex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_streaming_response_unpause(self, client: Codex) -> None: - with client.projects.remediations.with_streaming_response.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.projects.remediations.with_streaming_response.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = response.parse() - assert_matches_type(RemediationUnpauseResponse, remediation, path=["response"]) + remediation = response.parse() + assert_matches_type(RemediationUnpauseResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_path_params_unpause(self, client: Codex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.remediations.with_raw_response.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + client.projects.remediations.with_raw_response.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - client.projects.remediations.with_raw_response.unpause( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + client.projects.remediations.with_raw_response.unpause( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) class TestAsyncRemediations: @@ -634,30 +695,35 @@ class TestAsyncRemediations: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_create(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + ) + assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - answer="answer", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + answer="answer", + draft_answer="draft_answer", + ) + assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_create(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -667,43 +733,48 @@ async def test_raw_response_create(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_create(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.create( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - question="x", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + question="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationCreateResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_create(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.create( - project_id="", - question="x", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.create( + project_id="", + question="x", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationRetrieveResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -713,65 +784,72 @@ async def test_raw_response_retrieve(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationRetrieveResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationRetrieveResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.retrieve( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.retrieve( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.retrieve( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.retrieve( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(AsyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - last_edited_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), - last_edited_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), - last_edited_by="last_edited_by", - limit=1, - offset=0, - order="asc", - sort="created_at", - status=["ACTIVE"], - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + created_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + created_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_end=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_at_start=parse_datetime("2019-12-27T18:11:19.117Z"), + last_edited_by="last_edited_by", + limit=1, + offset=0, + order="asc", + sort="created_at", + status=["ACTIVE"], + ) + assert_matches_type(AsyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -781,41 +859,48 @@ async def test_raw_response_list(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.list( - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.list( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(AsyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type( + AsyncOffsetPageRemediations[RemediationListResponse], remediation, path=["response"] + ) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_list(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.list( - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.list( + project_id="", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_delete(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert remediation is None @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_delete(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -825,51 +910,56 @@ async def test_raw_response_delete(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_delete(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert remediation is None + remediation = await response.parse() + assert remediation is None assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_delete(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.delete( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.delete( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.delete( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.delete( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_edit_answer(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) + assert_matches_type(RemediationEditAnswerResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_edit_answer(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -879,54 +969,59 @@ async def test_raw_response_edit_answer(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_edit_answer(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationEditAnswerResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationEditAnswerResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_edit_answer(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.edit_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - answer="answer", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.edit_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + answer="answer", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.edit_answer( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - answer="answer", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.edit_answer( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + answer="answer", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_edit_draft_answer(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) + assert_matches_type(RemediationEditDraftAnswerResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_edit_draft_answer(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -936,52 +1031,57 @@ async def test_raw_response_edit_draft_answer(self, async_client: AsyncCodex) -> @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_edit_draft_answer(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationEditDraftAnswerResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationEditDraftAnswerResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_edit_draft_answer(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.edit_draft_answer( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - draft_answer="draft_answer", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.edit_draft_answer( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + draft_answer="draft_answer", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.edit_draft_answer( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - draft_answer="draft_answer", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.edit_draft_answer( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + draft_answer="draft_answer", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_get_resolved_logs_count(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationGetResolvedLogsCountResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_get_resolved_logs_count(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -991,49 +1091,54 @@ async def test_raw_response_get_resolved_logs_count(self, async_client: AsyncCod @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_get_resolved_logs_count(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationGetResolvedLogsCountResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationGetResolvedLogsCountResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_get_resolved_logs_count(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.get_resolved_logs_count( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.get_resolved_logs_count( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.get_resolved_logs_count( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.get_resolved_logs_count( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_list_resolved_logs(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationListResolvedLogsResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_list_resolved_logs(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1043,49 +1148,54 @@ async def test_raw_response_list_resolved_logs(self, async_client: AsyncCodex) - @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_list_resolved_logs(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationListResolvedLogsResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationListResolvedLogsResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_list_resolved_logs(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.list_resolved_logs( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.list_resolved_logs( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.list_resolved_logs( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.list_resolved_logs( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_pause(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationPauseResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_pause(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1095,49 +1205,54 @@ async def test_raw_response_pause(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_pause(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationPauseResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationPauseResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_pause(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.pause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.pause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.pause( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.pause( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_publish(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationPublishResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_publish(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1147,49 +1262,54 @@ async def test_raw_response_publish(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_publish(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationPublishResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationPublishResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_publish(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.publish( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.publish( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.publish( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.publish( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_unpause(self, async_client: AsyncCodex) -> None: - remediation = await async_client.projects.remediations.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + remediation = await async_client.projects.remediations.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RemediationUnpauseResponse, remediation, path=["response"]) @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_raw_response_unpause(self, async_client: AsyncCodex) -> None: - response = await async_client.projects.remediations.with_raw_response.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.projects.remediations.with_raw_response.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1199,29 +1319,31 @@ async def test_raw_response_unpause(self, async_client: AsyncCodex) -> None: @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_streaming_response_unpause(self, async_client: AsyncCodex) -> None: - async with async_client.projects.remediations.with_streaming_response.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.projects.remediations.with_streaming_response.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - remediation = await response.parse() - assert_matches_type(RemediationUnpauseResponse, remediation, path=["response"]) + remediation = await response.parse() + assert_matches_type(RemediationUnpauseResponse, remediation, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_path_params_unpause(self, async_client: AsyncCodex) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.remediations.with_raw_response.unpause( - remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): - await async_client.projects.remediations.with_raw_response.unpause( - remediation_id="", - project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): + await async_client.projects.remediations.with_raw_response.unpause( + remediation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + project_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `remediation_id` but received ''"): + await async_client.projects.remediations.with_raw_response.unpause( + remediation_id="", + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) diff --git a/tests/test_models.py b/tests/test_models.py index 61fe594..b4f6c31 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -9,7 +9,7 @@ from codex._utils import PropertyInfo from codex._compat import PYDANTIC_V1, parse_obj, model_dump, model_json -from codex._models import BaseModel, construct_type +from codex._models import DISCRIMINATOR_CACHE, BaseModel, construct_type class BasicModel(BaseModel): @@ -809,7 +809,7 @@ class B(BaseModel): UnionType = cast(Any, Union[A, B]) - assert not hasattr(UnionType, "__discriminator__") + assert not DISCRIMINATOR_CACHE.get(UnionType) m = construct_type( value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) @@ -818,7 +818,7 @@ class B(BaseModel): assert m.type == "b" assert m.data == "foo" # type: ignore[comparison-overlap] - discriminator = UnionType.__discriminator__ + discriminator = DISCRIMINATOR_CACHE.get(UnionType) assert discriminator is not None m = construct_type( @@ -830,7 +830,7 @@ class B(BaseModel): # if the discriminator details object stays the same between invocations then # we hit the cache - assert UnionType.__discriminator__ is discriminator + assert DISCRIMINATOR_CACHE.get(UnionType) is discriminator @pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1")