Skip to content

Commit bffc341

Browse files
committedNov 13, 2024
add more properties to environmets
1 parent 69ef0db commit bffc341

16 files changed

+605
-86
lines changed
 

‎README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ client = Client(base_url="https://api.example.com")
1515
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
1616

1717
```python
18-
from ctrlplane_api_client import AuthenticatedClient
18+
from ctrlplane import AuthenticatedClient
1919

2020
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
2121
```
2222

2323
Now call your endpoint and use your models:
2424

2525
```python
26-
from ctrlplane_api_client.models import MyDataModel
27-
from ctrlplane_api_client.api.my_tag import get_my_data_model
28-
from ctrlplane_api_client.types import Response
26+
from ctrlplane.models import MyDataModel
27+
from ctrlplane.api.my_tag import get_my_data_model
28+
from ctrlplane.types import Response
2929

3030
with client as client:
3131
my_data: MyDataModel = get_my_data_model.sync(client=client)
@@ -36,9 +36,9 @@ with client as client:
3636
Or do the same thing with an async version:
3737

3838
```python
39-
from ctrlplane_api_client.models import MyDataModel
40-
from ctrlplane_api_client.api.my_tag import get_my_data_model
41-
from ctrlplane_api_client.types import Response
39+
from ctrlplane.models import MyDataModel
40+
from ctrlplane.api.my_tag import get_my_data_model
41+
from ctrlplane.types import Response
4242

4343
async with client as client:
4444
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
@@ -76,7 +76,7 @@ Things to know:
7676

7777
1. All path/query params, and bodies become method arguments.
7878
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)
79-
1. Any endpoint which did not have a tag will be in `ctrlplane_api_client.api.default`
79+
1. Any endpoint which did not have a tag will be in `ctrlplane.api.default`
8080

8181
## Advanced customizations
8282

‎ctrlplane/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .client import AuthenticatedClient, Client
44

55

6-
__version__ = "0.1.0"
6+
__version__ = "0.1.1"
77

88

99
__all__ = (

‎ctrlplane/api/default/create_environment.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ...client import AuthenticatedClient, Client
88
from ...models.create_environment_body import CreateEnvironmentBody
99
from ...models.create_environment_response_200 import CreateEnvironmentResponse200
10+
from ...models.create_environment_response_409 import CreateEnvironmentResponse409
1011
from ...models.create_environment_response_500 import CreateEnvironmentResponse500
1112
from ...types import Response
1213

@@ -33,11 +34,15 @@ def _get_kwargs(
3334

3435
def _parse_response(
3536
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
36-
) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]:
37+
) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]:
3738
if response.status_code == 200:
3839
response_200 = CreateEnvironmentResponse200.from_dict(response.json())
3940

4041
return response_200
42+
if response.status_code == 409:
43+
response_409 = CreateEnvironmentResponse409.from_dict(response.json())
44+
45+
return response_409
4146
if response.status_code == 500:
4247
response_500 = CreateEnvironmentResponse500.from_dict(response.json())
4348

@@ -50,7 +55,7 @@ def _parse_response(
5055

5156
def _build_response(
5257
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
53-
) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]:
58+
) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]:
5459
return Response(
5560
status_code=HTTPStatus(response.status_code),
5661
content=response.content,
@@ -63,7 +68,7 @@ def sync_detailed(
6368
*,
6469
client: Union[AuthenticatedClient, Client],
6570
body: CreateEnvironmentBody,
66-
) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]:
71+
) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]:
6772
"""Create an environment
6873
6974
Args:
@@ -74,7 +79,7 @@ def sync_detailed(
7479
httpx.TimeoutException: If the request takes longer than Client.timeout.
7580
7681
Returns:
77-
Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]
82+
Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]
7883
"""
7984

8085
kwargs = _get_kwargs(
@@ -92,7 +97,7 @@ def sync(
9297
*,
9398
client: Union[AuthenticatedClient, Client],
9499
body: CreateEnvironmentBody,
95-
) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]:
100+
) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]:
96101
"""Create an environment
97102
98103
Args:
@@ -103,7 +108,7 @@ def sync(
103108
httpx.TimeoutException: If the request takes longer than Client.timeout.
104109
105110
Returns:
106-
Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]
111+
Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]
107112
"""
108113

109114
return sync_detailed(
@@ -116,7 +121,7 @@ async def asyncio_detailed(
116121
*,
117122
client: Union[AuthenticatedClient, Client],
118123
body: CreateEnvironmentBody,
119-
) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]:
124+
) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]:
120125
"""Create an environment
121126
122127
Args:
@@ -127,7 +132,7 @@ async def asyncio_detailed(
127132
httpx.TimeoutException: If the request takes longer than Client.timeout.
128133
129134
Returns:
130-
Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]
135+
Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]
131136
"""
132137

133138
kwargs = _get_kwargs(
@@ -143,7 +148,7 @@ async def asyncio(
143148
*,
144149
client: Union[AuthenticatedClient, Client],
145150
body: CreateEnvironmentBody,
146-
) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]:
151+
) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]:
147152
"""Create an environment
148153
149154
Args:
@@ -154,7 +159,7 @@ async def asyncio(
154159
httpx.TimeoutException: If the request takes longer than Client.timeout.
155160
156161
Returns:
157-
Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]
162+
Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]
158163
"""
159164

160165
return (

‎ctrlplane/api/default/create_release_channel.py

Lines changed: 73 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
from ...models.create_release_channel_response_200 import CreateReleaseChannelResponse200
1010
from ...models.create_release_channel_response_401 import CreateReleaseChannelResponse401
1111
from ...models.create_release_channel_response_403 import CreateReleaseChannelResponse403
12+
from ...models.create_release_channel_response_409 import CreateReleaseChannelResponse409
13+
from ...models.create_release_channel_response_500 import CreateReleaseChannelResponse500
1214
from ...types import Response
1315

1416

1517
def _get_kwargs(
16-
deployment_id: str,
1718
*,
1819
body: CreateReleaseChannelBody,
1920
) -> Dict[str, Any]:
2021
headers: Dict[str, Any] = {}
2122

2223
_kwargs: Dict[str, Any] = {
2324
"method": "post",
24-
"url": f"/v1/deployments/{deployment_id}/release-channels",
25+
"url": "/v1/release-channels",
2526
}
2627

2728
_body = body.to_dict()
@@ -35,7 +36,15 @@ def _get_kwargs(
3536

3637
def _parse_response(
3738
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
38-
) -> Optional[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]:
39+
) -> Optional[
40+
Union[
41+
CreateReleaseChannelResponse200,
42+
CreateReleaseChannelResponse401,
43+
CreateReleaseChannelResponse403,
44+
CreateReleaseChannelResponse409,
45+
CreateReleaseChannelResponse500,
46+
]
47+
]:
3948
if response.status_code == 200:
4049
response_200 = CreateReleaseChannelResponse200.from_dict(response.json())
4150

@@ -48,6 +57,14 @@ def _parse_response(
4857
response_403 = CreateReleaseChannelResponse403.from_dict(response.json())
4958

5059
return response_403
60+
if response.status_code == 409:
61+
response_409 = CreateReleaseChannelResponse409.from_dict(response.json())
62+
63+
return response_409
64+
if response.status_code == 500:
65+
response_500 = CreateReleaseChannelResponse500.from_dict(response.json())
66+
67+
return response_500
5168
if client.raise_on_unexpected_status:
5269
raise errors.UnexpectedStatus(response.status_code, response.content)
5370
else:
@@ -56,7 +73,15 @@ def _parse_response(
5673

5774
def _build_response(
5875
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
59-
) -> Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]:
76+
) -> Response[
77+
Union[
78+
CreateReleaseChannelResponse200,
79+
CreateReleaseChannelResponse401,
80+
CreateReleaseChannelResponse403,
81+
CreateReleaseChannelResponse409,
82+
CreateReleaseChannelResponse500,
83+
]
84+
]:
6085
return Response(
6186
status_code=HTTPStatus(response.status_code),
6287
content=response.content,
@@ -66,27 +91,32 @@ def _build_response(
6691

6792

6893
def sync_detailed(
69-
deployment_id: str,
7094
*,
71-
client: Union[AuthenticatedClient, Client],
95+
client: AuthenticatedClient,
7296
body: CreateReleaseChannelBody,
73-
) -> Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]:
97+
) -> Response[
98+
Union[
99+
CreateReleaseChannelResponse200,
100+
CreateReleaseChannelResponse401,
101+
CreateReleaseChannelResponse403,
102+
CreateReleaseChannelResponse409,
103+
CreateReleaseChannelResponse500,
104+
]
105+
]:
74106
"""Create a release channel
75107
76108
Args:
77-
deployment_id (str):
78109
body (CreateReleaseChannelBody):
79110
80111
Raises:
81112
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
82113
httpx.TimeoutException: If the request takes longer than Client.timeout.
83114
84115
Returns:
85-
Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]
116+
Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500]]
86117
"""
87118

88119
kwargs = _get_kwargs(
89-
deployment_id=deployment_id,
90120
body=body,
91121
)
92122

@@ -98,54 +128,64 @@ def sync_detailed(
98128

99129

100130
def sync(
101-
deployment_id: str,
102131
*,
103-
client: Union[AuthenticatedClient, Client],
132+
client: AuthenticatedClient,
104133
body: CreateReleaseChannelBody,
105-
) -> Optional[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]:
134+
) -> Optional[
135+
Union[
136+
CreateReleaseChannelResponse200,
137+
CreateReleaseChannelResponse401,
138+
CreateReleaseChannelResponse403,
139+
CreateReleaseChannelResponse409,
140+
CreateReleaseChannelResponse500,
141+
]
142+
]:
106143
"""Create a release channel
107144
108145
Args:
109-
deployment_id (str):
110146
body (CreateReleaseChannelBody):
111147
112148
Raises:
113149
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
114150
httpx.TimeoutException: If the request takes longer than Client.timeout.
115151
116152
Returns:
117-
Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]
153+
Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500]
118154
"""
119155

120156
return sync_detailed(
121-
deployment_id=deployment_id,
122157
client=client,
123158
body=body,
124159
).parsed
125160

126161

127162
async def asyncio_detailed(
128-
deployment_id: str,
129163
*,
130-
client: Union[AuthenticatedClient, Client],
164+
client: AuthenticatedClient,
131165
body: CreateReleaseChannelBody,
132-
) -> Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]:
166+
) -> Response[
167+
Union[
168+
CreateReleaseChannelResponse200,
169+
CreateReleaseChannelResponse401,
170+
CreateReleaseChannelResponse403,
171+
CreateReleaseChannelResponse409,
172+
CreateReleaseChannelResponse500,
173+
]
174+
]:
133175
"""Create a release channel
134176
135177
Args:
136-
deployment_id (str):
137178
body (CreateReleaseChannelBody):
138179
139180
Raises:
140181
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141182
httpx.TimeoutException: If the request takes longer than Client.timeout.
142183
143184
Returns:
144-
Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]
185+
Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500]]
145186
"""
146187

147188
kwargs = _get_kwargs(
148-
deployment_id=deployment_id,
149189
body=body,
150190
)
151191

@@ -155,28 +195,33 @@ async def asyncio_detailed(
155195

156196

157197
async def asyncio(
158-
deployment_id: str,
159198
*,
160-
client: Union[AuthenticatedClient, Client],
199+
client: AuthenticatedClient,
161200
body: CreateReleaseChannelBody,
162-
) -> Optional[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]:
201+
) -> Optional[
202+
Union[
203+
CreateReleaseChannelResponse200,
204+
CreateReleaseChannelResponse401,
205+
CreateReleaseChannelResponse403,
206+
CreateReleaseChannelResponse409,
207+
CreateReleaseChannelResponse500,
208+
]
209+
]:
163210
"""Create a release channel
164211
165212
Args:
166-
deployment_id (str):
167213
body (CreateReleaseChannelBody):
168214
169215
Raises:
170216
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
171217
httpx.TimeoutException: If the request takes longer than Client.timeout.
172218
173219
Returns:
174-
Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]
220+
Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500]
175221
"""
176222

177223
return (
178224
await asyncio_detailed(
179-
deployment_id=deployment_id,
180225
client=client,
181226
body=body,
182227
)

0 commit comments

Comments
 (0)