1818 async_to_streamed_response_wrapper ,
1919)
2020from ..._base_client import make_request_options
21- from ...types .projects import test_create_params
21+ from ...types .projects import test_list_params , test_create_params
22+ from ...types .projects .test_list_response import TestListResponse
2223from ...types .projects .test_create_response import TestCreateResponse
2324
2425__all__ = ["TestsResource" , "AsyncTestsResource" ]
@@ -177,6 +178,76 @@ def create(
177178 cast_to = TestCreateResponse ,
178179 )
179180
181+ def list (
182+ self ,
183+ project_id : str ,
184+ * ,
185+ include_archived : bool | NotGiven = NOT_GIVEN ,
186+ origin_version_id : Optional [str ] | NotGiven = NOT_GIVEN ,
187+ page : int | NotGiven = NOT_GIVEN ,
188+ per_page : int | NotGiven = NOT_GIVEN ,
189+ suggested : bool | NotGiven = NOT_GIVEN ,
190+ type : Literal ["integrity" , "consistency" , "performance" , "fairness" , "robustness" ] | NotGiven = NOT_GIVEN ,
191+ uses_production_data : Optional [bool ] | NotGiven = NOT_GIVEN ,
192+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
193+ # The extra values given here take precedence over values defined on the client or passed to this method.
194+ extra_headers : Headers | None = None ,
195+ extra_query : Query | None = None ,
196+ extra_body : Body | None = None ,
197+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
198+ ) -> TestListResponse :
199+ """
200+ List tests under a project.
201+
202+ Args:
203+ include_archived: Filter for archived tests.
204+
205+ origin_version_id: Retrive tests created by a specific project version.
206+
207+ page: The page to return in a paginated query.
208+
209+ per_page: Maximum number of items to return per page.
210+
211+ suggested: Filter for suggested tests.
212+
213+ type: Filter objects by test type. Available types are `integrity`, `consistency`,
214+ `performance`, `fairness`, and `robustness`.
215+
216+ uses_production_data: Retrive tests with usesProductionData (monitoring).
217+
218+ extra_headers: Send extra headers
219+
220+ extra_query: Add additional query parameters to the request
221+
222+ extra_body: Add additional JSON properties to the request
223+
224+ timeout: Override the client-level default timeout for this request, in seconds
225+ """
226+ if not project_id :
227+ raise ValueError (f"Expected a non-empty value for `project_id` but received { project_id !r} " )
228+ return self ._get (
229+ f"/projects/{ project_id } /tests" ,
230+ options = make_request_options (
231+ extra_headers = extra_headers ,
232+ extra_query = extra_query ,
233+ extra_body = extra_body ,
234+ timeout = timeout ,
235+ query = maybe_transform (
236+ {
237+ "include_archived" : include_archived ,
238+ "origin_version_id" : origin_version_id ,
239+ "page" : page ,
240+ "per_page" : per_page ,
241+ "suggested" : suggested ,
242+ "type" : type ,
243+ "uses_production_data" : uses_production_data ,
244+ },
245+ test_list_params .TestListParams ,
246+ ),
247+ ),
248+ cast_to = TestListResponse ,
249+ )
250+
180251
181252class AsyncTestsResource (AsyncAPIResource ):
182253 @cached_property
@@ -329,6 +400,76 @@ async def create(
329400 cast_to = TestCreateResponse ,
330401 )
331402
403+ async def list (
404+ self ,
405+ project_id : str ,
406+ * ,
407+ include_archived : bool | NotGiven = NOT_GIVEN ,
408+ origin_version_id : Optional [str ] | NotGiven = NOT_GIVEN ,
409+ page : int | NotGiven = NOT_GIVEN ,
410+ per_page : int | NotGiven = NOT_GIVEN ,
411+ suggested : bool | NotGiven = NOT_GIVEN ,
412+ type : Literal ["integrity" , "consistency" , "performance" , "fairness" , "robustness" ] | NotGiven = NOT_GIVEN ,
413+ uses_production_data : Optional [bool ] | NotGiven = NOT_GIVEN ,
414+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
415+ # The extra values given here take precedence over values defined on the client or passed to this method.
416+ extra_headers : Headers | None = None ,
417+ extra_query : Query | None = None ,
418+ extra_body : Body | None = None ,
419+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
420+ ) -> TestListResponse :
421+ """
422+ List tests under a project.
423+
424+ Args:
425+ include_archived: Filter for archived tests.
426+
427+ origin_version_id: Retrive tests created by a specific project version.
428+
429+ page: The page to return in a paginated query.
430+
431+ per_page: Maximum number of items to return per page.
432+
433+ suggested: Filter for suggested tests.
434+
435+ type: Filter objects by test type. Available types are `integrity`, `consistency`,
436+ `performance`, `fairness`, and `robustness`.
437+
438+ uses_production_data: Retrive tests with usesProductionData (monitoring).
439+
440+ extra_headers: Send extra headers
441+
442+ extra_query: Add additional query parameters to the request
443+
444+ extra_body: Add additional JSON properties to the request
445+
446+ timeout: Override the client-level default timeout for this request, in seconds
447+ """
448+ if not project_id :
449+ raise ValueError (f"Expected a non-empty value for `project_id` but received { project_id !r} " )
450+ return await self ._get (
451+ f"/projects/{ project_id } /tests" ,
452+ options = make_request_options (
453+ extra_headers = extra_headers ,
454+ extra_query = extra_query ,
455+ extra_body = extra_body ,
456+ timeout = timeout ,
457+ query = await async_maybe_transform (
458+ {
459+ "include_archived" : include_archived ,
460+ "origin_version_id" : origin_version_id ,
461+ "page" : page ,
462+ "per_page" : per_page ,
463+ "suggested" : suggested ,
464+ "type" : type ,
465+ "uses_production_data" : uses_production_data ,
466+ },
467+ test_list_params .TestListParams ,
468+ ),
469+ ),
470+ cast_to = TestListResponse ,
471+ )
472+
332473
333474class TestsResourceWithRawResponse :
334475 __test__ = False
@@ -339,6 +480,9 @@ def __init__(self, tests: TestsResource) -> None:
339480 self .create = to_raw_response_wrapper (
340481 tests .create ,
341482 )
483+ self .list = to_raw_response_wrapper (
484+ tests .list ,
485+ )
342486
343487
344488class AsyncTestsResourceWithRawResponse :
@@ -348,6 +492,9 @@ def __init__(self, tests: AsyncTestsResource) -> None:
348492 self .create = async_to_raw_response_wrapper (
349493 tests .create ,
350494 )
495+ self .list = async_to_raw_response_wrapper (
496+ tests .list ,
497+ )
351498
352499
353500class TestsResourceWithStreamingResponse :
@@ -359,6 +506,9 @@ def __init__(self, tests: TestsResource) -> None:
359506 self .create = to_streamed_response_wrapper (
360507 tests .create ,
361508 )
509+ self .list = to_streamed_response_wrapper (
510+ tests .list ,
511+ )
362512
363513
364514class AsyncTestsResourceWithStreamingResponse :
@@ -368,3 +518,6 @@ def __init__(self, tests: AsyncTestsResource) -> None:
368518 self .create = async_to_streamed_response_wrapper (
369519 tests .create ,
370520 )
521+ self .list = async_to_streamed_response_wrapper (
522+ tests .list ,
523+ )
0 commit comments