@@ -243,6 +243,58 @@ def get_session(
243243 raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response .text )
244244 raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response_json )
245245
246+ def delete_session (
247+ self , session_id : str , * , request_options : typing .Optional [RequestOptions ] = None
248+ ) -> HttpResponse [None ]:
249+ """
250+ Delete a session with all its tasks.
251+
252+ Parameters
253+ ----------
254+ session_id : str
255+
256+ request_options : typing.Optional[RequestOptions]
257+ Request-specific configuration.
258+
259+ Returns
260+ -------
261+ HttpResponse[None]
262+ """
263+ _response = self ._client_wrapper .httpx_client .request (
264+ f"sessions/{ jsonable_encoder (session_id )} " ,
265+ method = "DELETE" ,
266+ request_options = request_options ,
267+ )
268+ try :
269+ if 200 <= _response .status_code < 300 :
270+ return HttpResponse (response = _response , data = None )
271+ if _response .status_code == 404 :
272+ raise NotFoundError (
273+ headers = dict (_response .headers ),
274+ body = typing .cast (
275+ typing .Optional [typing .Any ],
276+ construct_type (
277+ type_ = typing .Optional [typing .Any ], # type: ignore
278+ object_ = _response .json (),
279+ ),
280+ ),
281+ )
282+ if _response .status_code == 422 :
283+ raise UnprocessableEntityError (
284+ headers = dict (_response .headers ),
285+ body = typing .cast (
286+ typing .Optional [typing .Any ],
287+ construct_type (
288+ type_ = typing .Optional [typing .Any ], # type: ignore
289+ object_ = _response .json (),
290+ ),
291+ ),
292+ )
293+ _response_json = _response .json ()
294+ except JSONDecodeError :
295+ raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response .text )
296+ raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response_json )
297+
246298 def update_session (
247299 self , session_id : str , * , request_options : typing .Optional [RequestOptions ] = None
248300 ) -> HttpResponse [SessionView ]:
@@ -702,6 +754,58 @@ async def get_session(
702754 raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response .text )
703755 raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response_json )
704756
757+ async def delete_session (
758+ self , session_id : str , * , request_options : typing .Optional [RequestOptions ] = None
759+ ) -> AsyncHttpResponse [None ]:
760+ """
761+ Delete a session with all its tasks.
762+
763+ Parameters
764+ ----------
765+ session_id : str
766+
767+ request_options : typing.Optional[RequestOptions]
768+ Request-specific configuration.
769+
770+ Returns
771+ -------
772+ AsyncHttpResponse[None]
773+ """
774+ _response = await self ._client_wrapper .httpx_client .request (
775+ f"sessions/{ jsonable_encoder (session_id )} " ,
776+ method = "DELETE" ,
777+ request_options = request_options ,
778+ )
779+ try :
780+ if 200 <= _response .status_code < 300 :
781+ return AsyncHttpResponse (response = _response , data = None )
782+ if _response .status_code == 404 :
783+ raise NotFoundError (
784+ headers = dict (_response .headers ),
785+ body = typing .cast (
786+ typing .Optional [typing .Any ],
787+ construct_type (
788+ type_ = typing .Optional [typing .Any ], # type: ignore
789+ object_ = _response .json (),
790+ ),
791+ ),
792+ )
793+ if _response .status_code == 422 :
794+ raise UnprocessableEntityError (
795+ headers = dict (_response .headers ),
796+ body = typing .cast (
797+ typing .Optional [typing .Any ],
798+ construct_type (
799+ type_ = typing .Optional [typing .Any ], # type: ignore
800+ object_ = _response .json (),
801+ ),
802+ ),
803+ )
804+ _response_json = _response .json ()
805+ except JSONDecodeError :
806+ raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response .text )
807+ raise ApiError (status_code = _response .status_code , headers = dict (_response .headers ), body = _response_json )
808+
705809 async def update_session (
706810 self , session_id : str , * , request_options : typing .Optional [RequestOptions ] = None
707811 ) -> AsyncHttpResponse [SessionView ]:
0 commit comments