Skip to content

Commit abb1356

Browse files
Update client for API v1.0.0-beta.47
Auto-generated from devgraph@5aa4037769c7b2569a372565ceca5f6a445f3d23 Spec URL: https://github.com/arctir/devgraph-api/tree/v1.0.0-beta.47
1 parent dac0f30 commit abb1356

17 files changed

Lines changed: 1442 additions & 20 deletions
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
from http import HTTPStatus
2+
from typing import Any, cast
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.entity_relation_response import EntityRelationResponse
9+
from ...models.http_validation_error import HTTPValidationError
10+
from ...types import UNSET, Response, Unset
11+
12+
13+
def _get_kwargs(
14+
*,
15+
namespace: str,
16+
managed_by: None | str | Unset = UNSET,
17+
source_type: None | str | Unset = UNSET,
18+
relation_type: None | str | Unset = UNSET,
19+
) -> dict[str, Any]:
20+
params: dict[str, Any] = {}
21+
22+
params["namespace"] = namespace
23+
24+
json_managed_by: None | str | Unset
25+
if isinstance(managed_by, Unset):
26+
json_managed_by = UNSET
27+
else:
28+
json_managed_by = managed_by
29+
params["managed_by"] = json_managed_by
30+
31+
json_source_type: None | str | Unset
32+
if isinstance(source_type, Unset):
33+
json_source_type = UNSET
34+
else:
35+
json_source_type = source_type
36+
params["source_type"] = json_source_type
37+
38+
json_relation_type: None | str | Unset
39+
if isinstance(relation_type, Unset):
40+
json_relation_type = UNSET
41+
else:
42+
json_relation_type = relation_type
43+
params["relation_type"] = json_relation_type
44+
45+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
46+
47+
_kwargs: dict[str, Any] = {
48+
"method": "get",
49+
"url": "/api/v1/entities/relations",
50+
"params": params,
51+
}
52+
53+
return _kwargs
54+
55+
56+
def _parse_response(
57+
*, client: AuthenticatedClient | Client, response: httpx.Response
58+
) -> Any | HTTPValidationError | list[EntityRelationResponse] | None:
59+
if response.status_code == 200:
60+
response_200 = []
61+
_response_200 = response.json()
62+
for response_200_item_data in _response_200:
63+
response_200_item = EntityRelationResponse.from_dict(response_200_item_data)
64+
65+
response_200.append(response_200_item)
66+
67+
return response_200
68+
69+
if response.status_code == 404:
70+
response_404 = cast(Any, None)
71+
return response_404
72+
73+
if response.status_code == 422:
74+
response_422 = HTTPValidationError.from_dict(response.json())
75+
76+
return response_422
77+
78+
if client.raise_on_unexpected_status:
79+
raise errors.UnexpectedStatus(response.status_code, response.content)
80+
else:
81+
return None
82+
83+
84+
def _build_response(
85+
*, client: AuthenticatedClient | Client, response: httpx.Response
86+
) -> Response[Any | HTTPValidationError | list[EntityRelationResponse]]:
87+
return Response(
88+
status_code=HTTPStatus(response.status_code),
89+
content=response.content,
90+
headers=response.headers,
91+
parsed=_parse_response(client=client, response=response),
92+
)
93+
94+
95+
def sync_detailed(
96+
*,
97+
client: AuthenticatedClient,
98+
namespace: str,
99+
managed_by: None | str | Unset = UNSET,
100+
source_type: None | str | Unset = UNSET,
101+
relation_type: None | str | Unset = UNSET,
102+
) -> Response[Any | HTTPValidationError | list[EntityRelationResponse]]:
103+
"""List relations with optional filtering
104+
105+
Lists all relations in the namespace with optional filtering by labels. Requires
106+
'read:entityrelations' permission.
107+
108+
Args:
109+
namespace (str):
110+
managed_by (None | str | Unset):
111+
source_type (None | str | Unset):
112+
relation_type (None | str | Unset):
113+
114+
Raises:
115+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116+
httpx.TimeoutException: If the request takes longer than Client.timeout.
117+
118+
Returns:
119+
Response[Any | HTTPValidationError | list[EntityRelationResponse]]
120+
"""
121+
122+
kwargs = _get_kwargs(
123+
namespace=namespace,
124+
managed_by=managed_by,
125+
source_type=source_type,
126+
relation_type=relation_type,
127+
)
128+
129+
response = client.get_httpx_client().request(
130+
**kwargs,
131+
)
132+
133+
return _build_response(client=client, response=response)
134+
135+
136+
def sync(
137+
*,
138+
client: AuthenticatedClient,
139+
namespace: str,
140+
managed_by: None | str | Unset = UNSET,
141+
source_type: None | str | Unset = UNSET,
142+
relation_type: None | str | Unset = UNSET,
143+
) -> Any | HTTPValidationError | list[EntityRelationResponse] | None:
144+
"""List relations with optional filtering
145+
146+
Lists all relations in the namespace with optional filtering by labels. Requires
147+
'read:entityrelations' permission.
148+
149+
Args:
150+
namespace (str):
151+
managed_by (None | str | Unset):
152+
source_type (None | str | Unset):
153+
relation_type (None | str | Unset):
154+
155+
Raises:
156+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157+
httpx.TimeoutException: If the request takes longer than Client.timeout.
158+
159+
Returns:
160+
Any | HTTPValidationError | list[EntityRelationResponse]
161+
"""
162+
163+
return sync_detailed(
164+
client=client,
165+
namespace=namespace,
166+
managed_by=managed_by,
167+
source_type=source_type,
168+
relation_type=relation_type,
169+
).parsed
170+
171+
172+
async def asyncio_detailed(
173+
*,
174+
client: AuthenticatedClient,
175+
namespace: str,
176+
managed_by: None | str | Unset = UNSET,
177+
source_type: None | str | Unset = UNSET,
178+
relation_type: None | str | Unset = UNSET,
179+
) -> Response[Any | HTTPValidationError | list[EntityRelationResponse]]:
180+
"""List relations with optional filtering
181+
182+
Lists all relations in the namespace with optional filtering by labels. Requires
183+
'read:entityrelations' permission.
184+
185+
Args:
186+
namespace (str):
187+
managed_by (None | str | Unset):
188+
source_type (None | str | Unset):
189+
relation_type (None | str | Unset):
190+
191+
Raises:
192+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
193+
httpx.TimeoutException: If the request takes longer than Client.timeout.
194+
195+
Returns:
196+
Response[Any | HTTPValidationError | list[EntityRelationResponse]]
197+
"""
198+
199+
kwargs = _get_kwargs(
200+
namespace=namespace,
201+
managed_by=managed_by,
202+
source_type=source_type,
203+
relation_type=relation_type,
204+
)
205+
206+
response = await client.get_async_httpx_client().request(**kwargs)
207+
208+
return _build_response(client=client, response=response)
209+
210+
211+
async def asyncio(
212+
*,
213+
client: AuthenticatedClient,
214+
namespace: str,
215+
managed_by: None | str | Unset = UNSET,
216+
source_type: None | str | Unset = UNSET,
217+
relation_type: None | str | Unset = UNSET,
218+
) -> Any | HTTPValidationError | list[EntityRelationResponse] | None:
219+
"""List relations with optional filtering
220+
221+
Lists all relations in the namespace with optional filtering by labels. Requires
222+
'read:entityrelations' permission.
223+
224+
Args:
225+
namespace (str):
226+
managed_by (None | str | Unset):
227+
source_type (None | str | Unset):
228+
relation_type (None | str | Unset):
229+
230+
Raises:
231+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
232+
httpx.TimeoutException: If the request takes longer than Client.timeout.
233+
234+
Returns:
235+
Any | HTTPValidationError | list[EntityRelationResponse]
236+
"""
237+
238+
return (
239+
await asyncio_detailed(
240+
client=client,
241+
namespace=namespace,
242+
managed_by=managed_by,
243+
source_type=source_type,
244+
relation_type=relation_type,
245+
)
246+
).parsed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
from http import HTTPStatus
2+
from typing import Any, cast
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.oidc_configuration_response import OIDCConfigurationResponse
9+
from ...types import Response
10+
11+
12+
def _get_kwargs() -> dict[str, Any]:
13+
_kwargs: dict[str, Any] = {
14+
"method": "get",
15+
"url": "/api/v1/oauth/oidc-config",
16+
}
17+
18+
return _kwargs
19+
20+
21+
def _parse_response(
22+
*, client: AuthenticatedClient | Client, response: httpx.Response
23+
) -> Any | OIDCConfigurationResponse | None:
24+
if response.status_code == 200:
25+
response_200 = OIDCConfigurationResponse.from_dict(response.json())
26+
27+
return response_200
28+
29+
if response.status_code == 404:
30+
response_404 = cast(Any, None)
31+
return response_404
32+
33+
if client.raise_on_unexpected_status:
34+
raise errors.UnexpectedStatus(response.status_code, response.content)
35+
else:
36+
return None
37+
38+
39+
def _build_response(
40+
*, client: AuthenticatedClient | Client, response: httpx.Response
41+
) -> Response[Any | OIDCConfigurationResponse]:
42+
return Response(
43+
status_code=HTTPStatus(response.status_code),
44+
content=response.content,
45+
headers=response.headers,
46+
parsed=_parse_response(client=client, response=response),
47+
)
48+
49+
50+
def sync_detailed(
51+
*,
52+
client: AuthenticatedClient | Client,
53+
) -> Response[Any | OIDCConfigurationResponse]:
54+
"""Get OIDC Configuration
55+
56+
Get OIDC configuration for CLI authentication (unauthenticated)
57+
58+
Raises:
59+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
60+
httpx.TimeoutException: If the request takes longer than Client.timeout.
61+
62+
Returns:
63+
Response[Any | OIDCConfigurationResponse]
64+
"""
65+
66+
kwargs = _get_kwargs()
67+
68+
response = client.get_httpx_client().request(
69+
**kwargs,
70+
)
71+
72+
return _build_response(client=client, response=response)
73+
74+
75+
def sync(
76+
*,
77+
client: AuthenticatedClient | Client,
78+
) -> Any | OIDCConfigurationResponse | None:
79+
"""Get OIDC Configuration
80+
81+
Get OIDC configuration for CLI authentication (unauthenticated)
82+
83+
Raises:
84+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
85+
httpx.TimeoutException: If the request takes longer than Client.timeout.
86+
87+
Returns:
88+
Any | OIDCConfigurationResponse
89+
"""
90+
91+
return sync_detailed(
92+
client=client,
93+
).parsed
94+
95+
96+
async def asyncio_detailed(
97+
*,
98+
client: AuthenticatedClient | Client,
99+
) -> Response[Any | OIDCConfigurationResponse]:
100+
"""Get OIDC Configuration
101+
102+
Get OIDC configuration for CLI authentication (unauthenticated)
103+
104+
Raises:
105+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
106+
httpx.TimeoutException: If the request takes longer than Client.timeout.
107+
108+
Returns:
109+
Response[Any | OIDCConfigurationResponse]
110+
"""
111+
112+
kwargs = _get_kwargs()
113+
114+
response = await client.get_async_httpx_client().request(**kwargs)
115+
116+
return _build_response(client=client, response=response)
117+
118+
119+
async def asyncio(
120+
*,
121+
client: AuthenticatedClient | Client,
122+
) -> Any | OIDCConfigurationResponse | None:
123+
"""Get OIDC Configuration
124+
125+
Get OIDC configuration for CLI authentication (unauthenticated)
126+
127+
Raises:
128+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
129+
httpx.TimeoutException: If the request takes longer than Client.timeout.
130+
131+
Returns:
132+
Any | OIDCConfigurationResponse
133+
"""
134+
135+
return (
136+
await asyncio_detailed(
137+
client=client,
138+
)
139+
).parsed

0 commit comments

Comments
 (0)