33# Copyright 2019-Present Datadog, Inc.
44from __future__ import annotations
55
6+ import collections
67from typing import Any , Dict , List , Union
78
89from datadog_api_client .api_client import ApiClient , Endpoint as _Endpoint
910from datadog_api_client .configuration import Configuration
1011from datadog_api_client .model_utils import (
12+ set_attribute_from_path ,
13+ get_attribute_from_path ,
1114 UnsetType ,
1215 unset ,
1316)
1821)
1922from datadog_api_client .v1 .model .synthetics_private_location import SyntheticsPrivateLocation
2023from datadog_api_client .v1 .model .synthetics_list_tests_response import SyntheticsListTestsResponse
24+ from datadog_api_client .v1 .model .synthetics_test_details import SyntheticsTestDetails
2125from datadog_api_client .v1 .model .synthetics_api_test import SyntheticsAPITest
2226from datadog_api_client .v1 .model .synthetics_browser_test import SyntheticsBrowserTest
2327from datadog_api_client .v1 .model .synthetics_get_browser_test_latest_results_response import (
2933from datadog_api_client .v1 .model .synthetics_trigger_ci_tests_response import SyntheticsTriggerCITestsResponse
3034from datadog_api_client .v1 .model .synthetics_trigger_body import SyntheticsTriggerBody
3135from datadog_api_client .v1 .model .synthetics_ci_test_body import SyntheticsCITestBody
32- from datadog_api_client .v1 .model .synthetics_test_details import SyntheticsTestDetails
3336from datadog_api_client .v1 .model .synthetics_get_api_test_latest_results_response import (
3437 SyntheticsGetAPITestLatestResultsResponse ,
3538)
@@ -562,12 +565,12 @@ def __init__(self, api_client=None):
562565 },
563566 params_map = {
564567 "page_size" : {
565- "openapi_types" : (str ,),
568+ "openapi_types" : (int ,),
566569 "attribute" : "page_size" ,
567570 "location" : "query" ,
568571 },
569572 "page_number" : {
570- "openapi_types" : (str ,),
573+ "openapi_types" : (int ,),
571574 "attribute" : "page_number" ,
572575 "location" : "query" ,
573576 },
@@ -1125,17 +1128,17 @@ def list_locations(
11251128 def list_tests (
11261129 self ,
11271130 * ,
1128- page_size : Union [str , UnsetType ] = unset ,
1129- page_number : Union [str , UnsetType ] = unset ,
1131+ page_size : Union [int , UnsetType ] = unset ,
1132+ page_number : Union [int , UnsetType ] = unset ,
11301133 ) -> SyntheticsListTestsResponse :
11311134 """Get the list of all Synthetic tests.
11321135
11331136 Get the list of all Synthetic tests.
11341137
11351138 :param page_size: Used for pagination. The number of tests returned in the page.
1136- :type page_size: str , optional
1139+ :type page_size: int , optional
11371140 :param page_number: Used for pagination. Which page you want to retrieve. Starts at zero.
1138- :type page_number: str , optional
1141+ :type page_number: int , optional
11391142 :rtype: SyntheticsListTestsResponse
11401143 """
11411144 kwargs : Dict [str , Any ] = {}
@@ -1147,6 +1150,43 @@ def list_tests(
11471150
11481151 return self ._list_tests_endpoint .call_with_http_info (** kwargs )
11491152
1153+ def list_tests_with_pagination (
1154+ self ,
1155+ * ,
1156+ page_size : Union [int , UnsetType ] = unset ,
1157+ page_number : Union [int , UnsetType ] = unset ,
1158+ ) -> collections .abc .Iterable [SyntheticsTestDetails ]:
1159+ """Get the list of all Synthetic tests.
1160+
1161+ Provide a paginated version of :meth:`list_tests`, returning all items.
1162+
1163+ :param page_size: Used for pagination. The number of tests returned in the page.
1164+ :type page_size: int, optional
1165+ :param page_number: Used for pagination. Which page you want to retrieve. Starts at zero.
1166+ :type page_number: int, optional
1167+
1168+ :return: A generator of paginated results.
1169+ :rtype: collections.abc.Iterable[SyntheticsTestDetails]
1170+ """
1171+ kwargs : Dict [str , Any ] = {}
1172+ if page_size is not unset :
1173+ kwargs ["page_size" ] = page_size
1174+
1175+ if page_number is not unset :
1176+ kwargs ["page_number" ] = page_number
1177+
1178+ local_page_size = get_attribute_from_path (kwargs , "page_size" , 100 )
1179+ endpoint = self ._list_tests_endpoint
1180+ set_attribute_from_path (kwargs , "page_size" , local_page_size , endpoint .params_map )
1181+ pagination = {
1182+ "limit_value" : local_page_size ,
1183+ "results_path" : "tests" ,
1184+ "page_param" : "page_number" ,
1185+ "endpoint" : endpoint ,
1186+ "kwargs" : kwargs ,
1187+ }
1188+ return endpoint .call_with_http_info_paginated (pagination )
1189+
11501190 def trigger_ci_tests (
11511191 self ,
11521192 body : SyntheticsCITestBody ,
0 commit comments