11from __future__ import annotations
22
3- from typing import Any , assert_type
3+ from collections .abc import Mapping
4+ from typing import Any , TypedDict , assert_type
45
56from generated .my_client import AsyncClient
6- from generated .my_client .types import TaskDto , TaskExecutionDto
7+ from generated .my_client .types import DeploymentConfigRequest , TaskDto , TaskExecutionDto
78
89client = AsyncClient (base_url = "http://testserver" )
910
@@ -12,12 +13,30 @@ async def main() -> None:
1213 result = await client .get ("/tasks" )()
1314 assert_type (result , list [TaskDto ])
1415 task = result [0 ]
15- assert_type (task ["meta" ], dict [str , Any ] | None )
16- assert_type (task ["payload" ], dict [str , Any ])
16+ assert_type (task ["meta" ], Mapping [str , Any ] | None )
17+ assert_type (task ["payload" ], Mapping [str , Any ])
1718 assert_type (task ["executions" ], list [TaskExecutionDto ] | None )
1819 execution = task ["executions" ][0 ] if task ["executions" ] is not None else None
1920 assert_type (execution , TaskExecutionDto | None )
2021 if execution is not None :
21- assert_type (execution ["log" ], list [dict [str , Any ]])
22- assert_type (execution ["output" ], dict [str , Any ] | None )
23- assert_type (execution ["stacktrace" ], dict [str , Any ] | None )
22+ assert_type (execution ["log" ], list [Mapping [str , Any ]])
23+ assert_type (execution ["output" ], Mapping [str , Any ] | None )
24+ assert_type (execution ["stacktrace" ], Mapping [str , Any ] | None )
25+
26+
27+ class FortigateSDWANSpokeConfig (TypedDict ):
28+ hostname : str
29+ serial_number : str
30+
31+
32+ async def create_deployment_config () -> None :
33+ config : FortigateSDWANSpokeConfig = {
34+ "hostname" : "fw01" ,
35+ "serial_number" : "FGT123" ,
36+ }
37+ body : DeploymentConfigRequest = {
38+ "config" : config ,
39+ "franck_submission_id" : None ,
40+ }
41+ created = await client .post ("/deployment-configs" )(body = body )
42+ assert_type (created , DeploymentConfigRequest )
0 commit comments