binctl-client 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- binctl_client/__init__.py +5 -0
- binctl_client/api/__init__.py +1 -0
- binctl_client/api/auth/__init__.py +1 -0
- binctl_client/api/auth/login.py +160 -0
- binctl_client/api/auth/logout.py +81 -0
- binctl_client/api/config/__init__.py +1 -0
- binctl_client/api/config/get_config.py +124 -0
- binctl_client/api/nodes/__init__.py +1 -0
- binctl_client/api/nodes/delete_node_endpoint.py +155 -0
- binctl_client/api/nodes/get_node_detail.py +155 -0
- binctl_client/api/nodes/get_nodes_list.py +171 -0
- binctl_client/api/nodes/patch_node_update.py +176 -0
- binctl_client/api/nodes/post_node_create.py +156 -0
- binctl_client/api/tags/__init__.py +1 -0
- binctl_client/api/tags/delete_tag_endpoint.py +155 -0
- binctl_client/api/tags/get_tag_detail.py +155 -0
- binctl_client/api/tags/get_tags_list.py +171 -0
- binctl_client/api/tags/patch_tag_update.py +176 -0
- binctl_client/api/tags/post_tag_create.py +156 -0
- binctl_client/client.py +164 -0
- binctl_client/errors.py +16 -0
- binctl_client/models/__init__.py +37 -0
- binctl_client/models/delete_node_endpoint_response_200.py +67 -0
- binctl_client/models/delete_node_endpoint_response_200_deleted.py +85 -0
- binctl_client/models/delete_tag_endpoint_response_200.py +67 -0
- binctl_client/models/delete_tag_endpoint_response_200_deleted.py +69 -0
- binctl_client/models/login_request.py +69 -0
- binctl_client/models/login_response.py +61 -0
- binctl_client/models/node.py +187 -0
- binctl_client/models/node_child.py +137 -0
- binctl_client/models/node_create.py +123 -0
- binctl_client/models/node_page.py +99 -0
- binctl_client/models/node_update.py +121 -0
- binctl_client/models/server_config.py +68 -0
- binctl_client/models/tag.py +87 -0
- binctl_client/models/tag_create.py +61 -0
- binctl_client/models/tag_page.py +99 -0
- binctl_client/models/tag_update.py +61 -0
- binctl_client/py.typed +1 -0
- binctl_client/types.py +54 -0
- binctl_client-1.0.0.dist-info/METADATA +141 -0
- binctl_client-1.0.0.dist-info/RECORD +43 -0
- binctl_client-1.0.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import Client
|
|
8
|
+
from ...models.login_request import LoginRequest
|
|
9
|
+
from ...models.login_response import LoginResponse
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: LoginRequest,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
headers: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/v1/auth/login",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_kwargs["json"] = body.to_dict()
|
|
25
|
+
|
|
26
|
+
headers["Content-Type"] = "application/json"
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Any | LoginResponse | None:
|
|
33
|
+
if response.status_code == 200:
|
|
34
|
+
response_200 = LoginResponse.from_dict(response.json())
|
|
35
|
+
|
|
36
|
+
return response_200
|
|
37
|
+
|
|
38
|
+
if response.status_code == 401:
|
|
39
|
+
response_401 = cast(Any, None)
|
|
40
|
+
return response_401
|
|
41
|
+
|
|
42
|
+
if client.raise_on_unexpected_status:
|
|
43
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
44
|
+
else:
|
|
45
|
+
return None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any | LoginResponse]:
|
|
49
|
+
return Response(
|
|
50
|
+
status_code=HTTPStatus(response.status_code),
|
|
51
|
+
content=response.content,
|
|
52
|
+
headers=response.headers,
|
|
53
|
+
parsed=_parse_response(client=client, response=response),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def sync_detailed(
|
|
58
|
+
*,
|
|
59
|
+
client: Client,
|
|
60
|
+
body: LoginRequest,
|
|
61
|
+
) -> Response[Any | LoginResponse]:
|
|
62
|
+
"""Obtain a bearer token
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
body (LoginRequest):
|
|
66
|
+
|
|
67
|
+
Raises:
|
|
68
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
69
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Response[Any | LoginResponse]
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
kwargs = _get_kwargs(
|
|
76
|
+
body=body,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
response = client.get_httpx_client().request(
|
|
80
|
+
**kwargs,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return _build_response(client=client, response=response)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def sync(
|
|
87
|
+
*,
|
|
88
|
+
client: Client,
|
|
89
|
+
body: LoginRequest,
|
|
90
|
+
) -> Any | LoginResponse | None:
|
|
91
|
+
"""Obtain a bearer token
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
body (LoginRequest):
|
|
95
|
+
|
|
96
|
+
Raises:
|
|
97
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
98
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Any | LoginResponse
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
return sync_detailed(
|
|
105
|
+
client=client,
|
|
106
|
+
body=body,
|
|
107
|
+
).parsed
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
async def asyncio_detailed(
|
|
111
|
+
*,
|
|
112
|
+
client: Client,
|
|
113
|
+
body: LoginRequest,
|
|
114
|
+
) -> Response[Any | LoginResponse]:
|
|
115
|
+
"""Obtain a bearer token
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
body (LoginRequest):
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
122
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
Response[Any | LoginResponse]
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
kwargs = _get_kwargs(
|
|
129
|
+
body=body,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
133
|
+
|
|
134
|
+
return _build_response(client=client, response=response)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
async def asyncio(
|
|
138
|
+
*,
|
|
139
|
+
client: Client,
|
|
140
|
+
body: LoginRequest,
|
|
141
|
+
) -> Any | LoginResponse | None:
|
|
142
|
+
"""Obtain a bearer token
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
body (LoginRequest):
|
|
146
|
+
|
|
147
|
+
Raises:
|
|
148
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
149
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
Any | LoginResponse
|
|
153
|
+
"""
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
await asyncio_detailed(
|
|
157
|
+
client=client,
|
|
158
|
+
body=body,
|
|
159
|
+
)
|
|
160
|
+
).parsed
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import Client
|
|
8
|
+
from ...types import Response
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
12
|
+
|
|
13
|
+
_kwargs: dict[str, Any] = {
|
|
14
|
+
"method": "post",
|
|
15
|
+
"url": "/v1/auth/logout",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return _kwargs
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Any | None:
|
|
22
|
+
if response.status_code == 204:
|
|
23
|
+
return None
|
|
24
|
+
|
|
25
|
+
if client.raise_on_unexpected_status:
|
|
26
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
27
|
+
else:
|
|
28
|
+
return None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
|
|
32
|
+
return Response(
|
|
33
|
+
status_code=HTTPStatus(response.status_code),
|
|
34
|
+
content=response.content,
|
|
35
|
+
headers=response.headers,
|
|
36
|
+
parsed=_parse_response(client=client, response=response),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def sync_detailed(
|
|
41
|
+
*,
|
|
42
|
+
client: Client,
|
|
43
|
+
) -> Response[Any]:
|
|
44
|
+
"""Revoke the current bearer token
|
|
45
|
+
|
|
46
|
+
Raises:
|
|
47
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
48
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
Response[Any]
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
kwargs = _get_kwargs()
|
|
55
|
+
|
|
56
|
+
response = client.get_httpx_client().request(
|
|
57
|
+
**kwargs,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
return _build_response(client=client, response=response)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
async def asyncio_detailed(
|
|
64
|
+
*,
|
|
65
|
+
client: Client,
|
|
66
|
+
) -> Response[Any]:
|
|
67
|
+
"""Revoke the current bearer token
|
|
68
|
+
|
|
69
|
+
Raises:
|
|
70
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
71
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Response[Any]
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
kwargs = _get_kwargs()
|
|
78
|
+
|
|
79
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
80
|
+
|
|
81
|
+
return _build_response(client=client, response=response)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import Client
|
|
8
|
+
from ...models.server_config import ServerConfig
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
13
|
+
|
|
14
|
+
_kwargs: dict[str, Any] = {
|
|
15
|
+
"method": "get",
|
|
16
|
+
"url": "/v1/config",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _kwargs
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> ServerConfig | None:
|
|
23
|
+
if response.status_code == 200:
|
|
24
|
+
response_200 = ServerConfig.from_dict(response.json())
|
|
25
|
+
|
|
26
|
+
return response_200
|
|
27
|
+
|
|
28
|
+
if client.raise_on_unexpected_status:
|
|
29
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
30
|
+
else:
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[ServerConfig]:
|
|
35
|
+
return Response(
|
|
36
|
+
status_code=HTTPStatus(response.status_code),
|
|
37
|
+
content=response.content,
|
|
38
|
+
headers=response.headers,
|
|
39
|
+
parsed=_parse_response(client=client, response=response),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def sync_detailed(
|
|
44
|
+
*,
|
|
45
|
+
client: Client,
|
|
46
|
+
) -> Response[ServerConfig]:
|
|
47
|
+
"""Get server configuration
|
|
48
|
+
|
|
49
|
+
Raises:
|
|
50
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
51
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
Response[ServerConfig]
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
kwargs = _get_kwargs()
|
|
58
|
+
|
|
59
|
+
response = client.get_httpx_client().request(
|
|
60
|
+
**kwargs,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return _build_response(client=client, response=response)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def sync(
|
|
67
|
+
*,
|
|
68
|
+
client: Client,
|
|
69
|
+
) -> ServerConfig | None:
|
|
70
|
+
"""Get server configuration
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
74
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
ServerConfig
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
return sync_detailed(
|
|
81
|
+
client=client,
|
|
82
|
+
).parsed
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
async def asyncio_detailed(
|
|
86
|
+
*,
|
|
87
|
+
client: Client,
|
|
88
|
+
) -> Response[ServerConfig]:
|
|
89
|
+
"""Get server configuration
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Response[ServerConfig]
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
kwargs = _get_kwargs()
|
|
100
|
+
|
|
101
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
102
|
+
|
|
103
|
+
return _build_response(client=client, response=response)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
async def asyncio(
|
|
107
|
+
*,
|
|
108
|
+
client: Client,
|
|
109
|
+
) -> ServerConfig | None:
|
|
110
|
+
"""Get server configuration
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
ServerConfig
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
await asyncio_detailed(
|
|
122
|
+
client=client,
|
|
123
|
+
)
|
|
124
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import Client
|
|
9
|
+
from ...models.delete_node_endpoint_response_200 import DeleteNodeEndpointResponse200
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
node_id: str,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
|
|
17
|
+
_kwargs: dict[str, Any] = {
|
|
18
|
+
"method": "delete",
|
|
19
|
+
"url": "/v1/nodes/{node_id}".format(
|
|
20
|
+
node_id=quote(str(node_id), safe=""),
|
|
21
|
+
),
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return _kwargs
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Any | DeleteNodeEndpointResponse200 | None:
|
|
28
|
+
if response.status_code == 200:
|
|
29
|
+
response_200 = DeleteNodeEndpointResponse200.from_dict(response.json())
|
|
30
|
+
|
|
31
|
+
return response_200
|
|
32
|
+
|
|
33
|
+
if response.status_code == 404:
|
|
34
|
+
response_404 = cast(Any, None)
|
|
35
|
+
return response_404
|
|
36
|
+
|
|
37
|
+
if client.raise_on_unexpected_status:
|
|
38
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
39
|
+
else:
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any | DeleteNodeEndpointResponse200]:
|
|
44
|
+
return Response(
|
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
|
46
|
+
content=response.content,
|
|
47
|
+
headers=response.headers,
|
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def sync_detailed(
|
|
53
|
+
node_id: str,
|
|
54
|
+
*,
|
|
55
|
+
client: Client,
|
|
56
|
+
) -> Response[Any | DeleteNodeEndpointResponse200]:
|
|
57
|
+
"""Delete a node
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
node_id (str):
|
|
61
|
+
|
|
62
|
+
Raises:
|
|
63
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
64
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Response[Any | DeleteNodeEndpointResponse200]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
kwargs = _get_kwargs(
|
|
71
|
+
node_id=node_id,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = client.get_httpx_client().request(
|
|
75
|
+
**kwargs,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return _build_response(client=client, response=response)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync(
|
|
82
|
+
node_id: str,
|
|
83
|
+
*,
|
|
84
|
+
client: Client,
|
|
85
|
+
) -> Any | DeleteNodeEndpointResponse200 | None:
|
|
86
|
+
"""Delete a node
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
node_id (str):
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Any | DeleteNodeEndpointResponse200
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
return sync_detailed(
|
|
100
|
+
node_id=node_id,
|
|
101
|
+
client=client,
|
|
102
|
+
).parsed
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async def asyncio_detailed(
|
|
106
|
+
node_id: str,
|
|
107
|
+
*,
|
|
108
|
+
client: Client,
|
|
109
|
+
) -> Response[Any | DeleteNodeEndpointResponse200]:
|
|
110
|
+
"""Delete a node
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
node_id (str):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
Response[Any | DeleteNodeEndpointResponse200]
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
kwargs = _get_kwargs(
|
|
124
|
+
node_id=node_id,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
128
|
+
|
|
129
|
+
return _build_response(client=client, response=response)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio(
|
|
133
|
+
node_id: str,
|
|
134
|
+
*,
|
|
135
|
+
client: Client,
|
|
136
|
+
) -> Any | DeleteNodeEndpointResponse200 | None:
|
|
137
|
+
"""Delete a node
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
node_id (str):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Any | DeleteNodeEndpointResponse200
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
await asyncio_detailed(
|
|
152
|
+
node_id=node_id,
|
|
153
|
+
client=client,
|
|
154
|
+
)
|
|
155
|
+
).parsed
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import Client
|
|
9
|
+
from ...models.node import Node
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
node_id: str,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
|
|
17
|
+
_kwargs: dict[str, Any] = {
|
|
18
|
+
"method": "get",
|
|
19
|
+
"url": "/v1/nodes/{node_id}".format(
|
|
20
|
+
node_id=quote(str(node_id), safe=""),
|
|
21
|
+
),
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return _kwargs
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Any | Node | None:
|
|
28
|
+
if response.status_code == 200:
|
|
29
|
+
response_200 = Node.from_dict(response.json())
|
|
30
|
+
|
|
31
|
+
return response_200
|
|
32
|
+
|
|
33
|
+
if response.status_code == 404:
|
|
34
|
+
response_404 = cast(Any, None)
|
|
35
|
+
return response_404
|
|
36
|
+
|
|
37
|
+
if client.raise_on_unexpected_status:
|
|
38
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
39
|
+
else:
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any | Node]:
|
|
44
|
+
return Response(
|
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
|
46
|
+
content=response.content,
|
|
47
|
+
headers=response.headers,
|
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def sync_detailed(
|
|
53
|
+
node_id: str,
|
|
54
|
+
*,
|
|
55
|
+
client: Client,
|
|
56
|
+
) -> Response[Any | Node]:
|
|
57
|
+
"""Get a node by ID
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
node_id (str):
|
|
61
|
+
|
|
62
|
+
Raises:
|
|
63
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
64
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Response[Any | Node]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
kwargs = _get_kwargs(
|
|
71
|
+
node_id=node_id,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = client.get_httpx_client().request(
|
|
75
|
+
**kwargs,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return _build_response(client=client, response=response)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync(
|
|
82
|
+
node_id: str,
|
|
83
|
+
*,
|
|
84
|
+
client: Client,
|
|
85
|
+
) -> Any | Node | None:
|
|
86
|
+
"""Get a node by ID
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
node_id (str):
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Any | Node
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
return sync_detailed(
|
|
100
|
+
node_id=node_id,
|
|
101
|
+
client=client,
|
|
102
|
+
).parsed
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async def asyncio_detailed(
|
|
106
|
+
node_id: str,
|
|
107
|
+
*,
|
|
108
|
+
client: Client,
|
|
109
|
+
) -> Response[Any | Node]:
|
|
110
|
+
"""Get a node by ID
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
node_id (str):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
Response[Any | Node]
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
kwargs = _get_kwargs(
|
|
124
|
+
node_id=node_id,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
128
|
+
|
|
129
|
+
return _build_response(client=client, response=response)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio(
|
|
133
|
+
node_id: str,
|
|
134
|
+
*,
|
|
135
|
+
client: Client,
|
|
136
|
+
) -> Any | Node | None:
|
|
137
|
+
"""Get a node by ID
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
node_id (str):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Any | Node
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
await asyncio_detailed(
|
|
152
|
+
node_id=node_id,
|
|
153
|
+
client=client,
|
|
154
|
+
)
|
|
155
|
+
).parsed
|