55import httpx
66
77from ..types import context_create_params
8- from .._types import Body , Query , Headers , NotGiven , not_given
8+ from .._types import Body , Omit , Query , Headers , NoneType , NotGiven , omit , not_given
99from .._utils import maybe_transform , async_maybe_transform
1010from .._compat import cached_property
1111from .._resource import SyncAPIResource , AsyncAPIResource
1616 async_to_streamed_response_wrapper ,
1717)
1818from .._base_client import make_request_options
19+ from ..types .context import Context
1920from ..types .context_create_response import ContextCreateResponse
2021from ..types .context_update_response import ContextUpdateResponse
21- from ..types .context_retrieve_response import ContextRetrieveResponse
2222
2323__all__ = ["ContextsResource" , "AsyncContextsResource" ]
2424
@@ -46,7 +46,7 @@ def with_streaming_response(self) -> ContextsResourceWithStreamingResponse:
4646 def create (
4747 self ,
4848 * ,
49- project_id : str ,
49+ project_id : str | Omit = omit ,
5050 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5151 # The extra values given here take precedence over values defined on the client or passed to this method.
5252 extra_headers : Headers | None = None ,
@@ -89,9 +89,9 @@ def retrieve(
8989 extra_query : Query | None = None ,
9090 extra_body : Body | None = None ,
9191 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
92- ) -> ContextRetrieveResponse :
92+ ) -> Context :
9393 """
94- Get a Context
94+ Context
9595
9696 Args:
9797 extra_headers: Send extra headers
@@ -109,7 +109,7 @@ def retrieve(
109109 options = make_request_options (
110110 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
111111 ),
112- cast_to = ContextRetrieveResponse ,
112+ cast_to = Context ,
113113 )
114114
115115 def update (
@@ -124,7 +124,7 @@ def update(
124124 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
125125 ) -> ContextUpdateResponse :
126126 """
127- Update a Context
127+ Update Context
128128
129129 Args:
130130 extra_headers: Send extra headers
@@ -145,6 +145,40 @@ def update(
145145 cast_to = ContextUpdateResponse ,
146146 )
147147
148+ def delete (
149+ self ,
150+ id : str ,
151+ * ,
152+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
153+ # The extra values given here take precedence over values defined on the client or passed to this method.
154+ extra_headers : Headers | None = None ,
155+ extra_query : Query | None = None ,
156+ extra_body : Body | None = None ,
157+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
158+ ) -> None :
159+ """
160+ Delete Context
161+
162+ Args:
163+ extra_headers: Send extra headers
164+
165+ extra_query: Add additional query parameters to the request
166+
167+ extra_body: Add additional JSON properties to the request
168+
169+ timeout: Override the client-level default timeout for this request, in seconds
170+ """
171+ if not id :
172+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
173+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
174+ return self ._delete (
175+ f"/v1/contexts/{ id } " ,
176+ options = make_request_options (
177+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
178+ ),
179+ cast_to = NoneType ,
180+ )
181+
148182
149183class AsyncContextsResource (AsyncAPIResource ):
150184 @cached_property
@@ -169,7 +203,7 @@ def with_streaming_response(self) -> AsyncContextsResourceWithStreamingResponse:
169203 async def create (
170204 self ,
171205 * ,
172- project_id : str ,
206+ project_id : str | Omit = omit ,
173207 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
174208 # The extra values given here take precedence over values defined on the client or passed to this method.
175209 extra_headers : Headers | None = None ,
@@ -212,9 +246,9 @@ async def retrieve(
212246 extra_query : Query | None = None ,
213247 extra_body : Body | None = None ,
214248 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
215- ) -> ContextRetrieveResponse :
249+ ) -> Context :
216250 """
217- Get a Context
251+ Context
218252
219253 Args:
220254 extra_headers: Send extra headers
@@ -232,7 +266,7 @@ async def retrieve(
232266 options = make_request_options (
233267 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
234268 ),
235- cast_to = ContextRetrieveResponse ,
269+ cast_to = Context ,
236270 )
237271
238272 async def update (
@@ -247,7 +281,7 @@ async def update(
247281 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
248282 ) -> ContextUpdateResponse :
249283 """
250- Update a Context
284+ Update Context
251285
252286 Args:
253287 extra_headers: Send extra headers
@@ -268,6 +302,40 @@ async def update(
268302 cast_to = ContextUpdateResponse ,
269303 )
270304
305+ async def delete (
306+ self ,
307+ id : str ,
308+ * ,
309+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
310+ # The extra values given here take precedence over values defined on the client or passed to this method.
311+ extra_headers : Headers | None = None ,
312+ extra_query : Query | None = None ,
313+ extra_body : Body | None = None ,
314+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
315+ ) -> None :
316+ """
317+ Delete Context
318+
319+ Args:
320+ extra_headers: Send extra headers
321+
322+ extra_query: Add additional query parameters to the request
323+
324+ extra_body: Add additional JSON properties to the request
325+
326+ timeout: Override the client-level default timeout for this request, in seconds
327+ """
328+ if not id :
329+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
330+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
331+ return await self ._delete (
332+ f"/v1/contexts/{ id } " ,
333+ options = make_request_options (
334+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
335+ ),
336+ cast_to = NoneType ,
337+ )
338+
271339
272340class ContextsResourceWithRawResponse :
273341 def __init__ (self , contexts : ContextsResource ) -> None :
@@ -282,6 +350,9 @@ def __init__(self, contexts: ContextsResource) -> None:
282350 self .update = to_raw_response_wrapper (
283351 contexts .update ,
284352 )
353+ self .delete = to_raw_response_wrapper (
354+ contexts .delete ,
355+ )
285356
286357
287358class AsyncContextsResourceWithRawResponse :
@@ -297,6 +368,9 @@ def __init__(self, contexts: AsyncContextsResource) -> None:
297368 self .update = async_to_raw_response_wrapper (
298369 contexts .update ,
299370 )
371+ self .delete = async_to_raw_response_wrapper (
372+ contexts .delete ,
373+ )
300374
301375
302376class ContextsResourceWithStreamingResponse :
@@ -312,6 +386,9 @@ def __init__(self, contexts: ContextsResource) -> None:
312386 self .update = to_streamed_response_wrapper (
313387 contexts .update ,
314388 )
389+ self .delete = to_streamed_response_wrapper (
390+ contexts .delete ,
391+ )
315392
316393
317394class AsyncContextsResourceWithStreamingResponse :
@@ -327,3 +404,6 @@ def __init__(self, contexts: AsyncContextsResource) -> None:
327404 self .update = async_to_streamed_response_wrapper (
328405 contexts .update ,
329406 )
407+ self .delete = async_to_streamed_response_wrapper (
408+ contexts .delete ,
409+ )
0 commit comments