@@ -23,28 +23,34 @@ Now call your endpoint and use your models:
23
23
``` python
24
24
from my_test_api_client.models import MyDataModel
25
25
from my_test_api_client.api.my_tag import get_my_data_model
26
+ from my_test_api_client.types import Response
26
27
27
- my_data: MyDataModel = get_my_data_model(client = client)
28
+ my_data: MyDataModel = get_my_data_model.sync(client = client)
29
+ # or if you need more info (e.g. status_code)
30
+ response: Response[MyDataModel] = get_my_data_model.sync_detailed(client = client)
28
31
```
29
32
30
33
Or do the same thing with an async version:
31
34
32
35
``` python
33
36
from my_test_api_client.models import MyDataModel
34
37
from my_test_api_client.async_api.my_tag import get_my_data_model
38
+ from my_test_api_client.types import Response
35
39
36
- my_data: MyDataModel = await get_my_data_model(client = client)
40
+ my_data: MyDataModel = await get_my_data_model.asyncio(client = client)
41
+ response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client = client)
37
42
```
38
43
39
44
Things to know:
40
- 1 . Every path/method combo becomes a Python function with type annotations.
45
+ 1 . Every path/method combo becomes a Python module with four functions:
46
+ 1 . ` sync ` : Blocking request that returns parsed data (if successful) or ` None `
47
+ 1 . ` sync_detailed ` : Blocking request that always returns a ` Request ` , optionally with ` parsed ` set if the request was successful.
48
+ 1 . ` asyncio ` : Like ` sync ` but the async instead of blocking
49
+ 1 . ` asyncio_detailed ` : Like ` sync_detailed ` by async instead of blocking
50
+
41
51
1 . All path/query params, and bodies become method arguments.
42
52
1 . If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
43
- 1 . Any endpoint which did not have a tag will be in ` my_test_api_client.api.default `
44
- 1 . If the API returns a response code that was not declared in the OpenAPI document, a
45
- ` my_test_api_client.api.errors.ApiResponseError ` wil be raised
46
- with the ` response ` attribute set to the ` httpx.Response ` that was received.
47
-
53
+ 1 . Any endpoint which did not have a tag will be in ` my_test_api_client.api.default `
48
54
49
55
## Building / publishing this Client
50
56
This project uses [ Poetry] ( https://python-poetry.org/ ) to manage dependencies and packaging. Here are the basics:
0 commit comments