This commit is contained in:
Ruben Fiszel
2024-01-16 23:46:36 +01:00
parent a24645ee00
commit c73e2760d4
1696 changed files with 160145 additions and 0 deletions
@@ -0,0 +1,133 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.add_user_to_group_json_body import AddUserToGroupJsonBody
def _get_kwargs(
workspace: str,
name: str,
*,
json_body: AddUserToGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/w/{workspace}/groups/adduser/{name}".format(workspace=workspace,name=name,),
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: AddUserToGroupJsonBody,
) -> Response[Any]:
""" add user to group
Args:
workspace (str):
name (str):
json_body (AddUserToGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: AddUserToGroupJsonBody,
) -> Response[Any]:
""" add user to group
Args:
workspace (str):
name (str):
json_body (AddUserToGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,126 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.add_user_to_instance_group_json_body import AddUserToInstanceGroupJsonBody
def _get_kwargs(
name: str,
*,
json_body: AddUserToInstanceGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/groups/adduser/{name}".format(name=name,),
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: AddUserToInstanceGroupJsonBody,
) -> Response[Any]:
""" add user to instance group
Args:
name (str):
json_body (AddUserToInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: AddUserToInstanceGroupJsonBody,
) -> Response[Any]:
""" add user to instance group
Args:
name (str):
json_body (AddUserToInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,126 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from ...models.create_group_json_body import CreateGroupJsonBody
from typing import Dict
def _get_kwargs(
workspace: str,
*,
json_body: CreateGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/w/{workspace}/groups/create".format(workspace=workspace,),
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: CreateGroupJsonBody,
) -> Response[Any]:
""" create group
Args:
workspace (str):
json_body (CreateGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: CreateGroupJsonBody,
) -> Response[Any]:
""" create group
Args:
workspace (str):
json_body (CreateGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,119 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.create_instance_group_json_body import CreateInstanceGroupJsonBody
def _get_kwargs(
*,
json_body: CreateInstanceGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/groups/create",
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
json_body: CreateInstanceGroupJsonBody,
) -> Response[Any]:
""" create instance group
Args:
json_body (CreateInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
json_body: CreateInstanceGroupJsonBody,
) -> Response[Any]:
""" create instance group
Args:
json_body (CreateInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,119 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
def _get_kwargs(
workspace: str,
name: str,
) -> Dict[str, Any]:
cookies = {}
return {
"method": "delete",
"url": "/w/{workspace}/groups/delete/{name}".format(workspace=workspace,name=name,),
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[Any]:
""" delete group
Args:
workspace (str):
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[Any]:
""" delete group
Args:
workspace (str):
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,112 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
def _get_kwargs(
name: str,
) -> Dict[str, Any]:
cookies = {}
return {
"method": "delete",
"url": "/groups/delete/{name}".format(name=name,),
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[Any]:
""" delete instance group
Args:
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[Any]:
""" delete instance group
Args:
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,184 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from ...models.get_group_response_200 import GetGroupResponse200
from typing import Dict
def _get_kwargs(
workspace: str,
name: str,
) -> Dict[str, Any]:
cookies = {}
return {
"method": "get",
"url": "/w/{workspace}/groups/get/{name}".format(workspace=workspace,name=name,),
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[GetGroupResponse200]:
if response.status_code == HTTPStatus.OK:
response_200 = GetGroupResponse200.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[GetGroupResponse200]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[GetGroupResponse200]:
""" get group
Args:
workspace (str):
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[GetGroupResponse200]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Optional[GetGroupResponse200]:
""" get group
Args:
workspace (str):
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
GetGroupResponse200
"""
return sync_detailed(
workspace=workspace,
name=name,
client=client,
).parsed
async def asyncio_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[GetGroupResponse200]:
""" get group
Args:
workspace (str):
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[GetGroupResponse200]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
async def asyncio(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Optional[GetGroupResponse200]:
""" get group
Args:
workspace (str):
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
GetGroupResponse200
"""
return (await asyncio_detailed(
workspace=workspace,
name=name,
client=client,
)).parsed
@@ -0,0 +1,171 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.get_instance_group_response_200 import GetInstanceGroupResponse200
def _get_kwargs(
name: str,
) -> Dict[str, Any]:
cookies = {}
return {
"method": "get",
"url": "/groups/get/{name}".format(name=name,),
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[GetInstanceGroupResponse200]:
if response.status_code == HTTPStatus.OK:
response_200 = GetInstanceGroupResponse200.from_dict(response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[GetInstanceGroupResponse200]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[GetInstanceGroupResponse200]:
""" get instance group
Args:
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[GetInstanceGroupResponse200]
"""
kwargs = _get_kwargs(
name=name,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Optional[GetInstanceGroupResponse200]:
""" get instance group
Args:
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
GetInstanceGroupResponse200
"""
return sync_detailed(
name=name,
client=client,
).parsed
async def asyncio_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Response[GetInstanceGroupResponse200]:
""" get instance group
Args:
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[GetInstanceGroupResponse200]
"""
kwargs = _get_kwargs(
name=name,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
async def asyncio(
name: str,
*,
client: Union[AuthenticatedClient, Client],
) -> Optional[GetInstanceGroupResponse200]:
""" get instance group
Args:
name (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
GetInstanceGroupResponse200
"""
return (await asyncio_detailed(
name=name,
client=client,
)).parsed
@@ -0,0 +1,191 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import Union
from typing import Optional
from typing import cast, List
from ...types import UNSET, Unset
def _get_kwargs(
workspace: str,
*,
only_member_of: Union[Unset, None, bool] = UNSET,
) -> Dict[str, Any]:
cookies = {}
params: Dict[str, Any] = {}
params["only_member_of"] = only_member_of
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/w/{workspace}/groups/listnames".format(workspace=workspace,),
"params": params,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List[str]]:
if response.status_code == HTTPStatus.OK:
response_200 = cast(List[str], response.json())
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List[str]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
only_member_of: Union[Unset, None, bool] = UNSET,
) -> Response[List[str]]:
""" list group names
Args:
workspace (str):
only_member_of (Union[Unset, None, bool]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[List[str]]
"""
kwargs = _get_kwargs(
workspace=workspace,
only_member_of=only_member_of,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
only_member_of: Union[Unset, None, bool] = UNSET,
) -> Optional[List[str]]:
""" list group names
Args:
workspace (str):
only_member_of (Union[Unset, None, bool]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
List[str]
"""
return sync_detailed(
workspace=workspace,
client=client,
only_member_of=only_member_of,
).parsed
async def asyncio_detailed(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
only_member_of: Union[Unset, None, bool] = UNSET,
) -> Response[List[str]]:
""" list group names
Args:
workspace (str):
only_member_of (Union[Unset, None, bool]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[List[str]]
"""
kwargs = _get_kwargs(
workspace=workspace,
only_member_of=only_member_of,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
async def asyncio(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
only_member_of: Union[Unset, None, bool] = UNSET,
) -> Optional[List[str]]:
""" list group names
Args:
workspace (str):
only_member_of (Union[Unset, None, bool]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
List[str]
"""
return (await asyncio_detailed(
workspace=workspace,
client=client,
only_member_of=only_member_of,
)).parsed
@@ -0,0 +1,217 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import Union
from typing import cast
from typing import cast, List
from ...models.list_groups_response_200_item import ListGroupsResponse200Item
from typing import Dict
from typing import Optional
from ...types import UNSET, Unset
def _get_kwargs(
workspace: str,
*,
page: Union[Unset, None, int] = UNSET,
per_page: Union[Unset, None, int] = UNSET,
) -> Dict[str, Any]:
cookies = {}
params: Dict[str, Any] = {}
params["page"] = page
params["per_page"] = per_page
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/w/{workspace}/groups/list".format(workspace=workspace,),
"params": params,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['ListGroupsResponse200Item']]:
if response.status_code == HTTPStatus.OK:
response_200 = []
_response_200 = response.json()
for response_200_item_data in (_response_200):
response_200_item = ListGroupsResponse200Item.from_dict(response_200_item_data)
response_200.append(response_200_item)
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['ListGroupsResponse200Item']]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
page: Union[Unset, None, int] = UNSET,
per_page: Union[Unset, None, int] = UNSET,
) -> Response[List['ListGroupsResponse200Item']]:
""" list groups
Args:
workspace (str):
page (Union[Unset, None, int]):
per_page (Union[Unset, None, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[List['ListGroupsResponse200Item']]
"""
kwargs = _get_kwargs(
workspace=workspace,
page=page,
per_page=per_page,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
page: Union[Unset, None, int] = UNSET,
per_page: Union[Unset, None, int] = UNSET,
) -> Optional[List['ListGroupsResponse200Item']]:
""" list groups
Args:
workspace (str):
page (Union[Unset, None, int]):
per_page (Union[Unset, None, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
List['ListGroupsResponse200Item']
"""
return sync_detailed(
workspace=workspace,
client=client,
page=page,
per_page=per_page,
).parsed
async def asyncio_detailed(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
page: Union[Unset, None, int] = UNSET,
per_page: Union[Unset, None, int] = UNSET,
) -> Response[List['ListGroupsResponse200Item']]:
""" list groups
Args:
workspace (str):
page (Union[Unset, None, int]):
per_page (Union[Unset, None, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[List['ListGroupsResponse200Item']]
"""
kwargs = _get_kwargs(
workspace=workspace,
page=page,
per_page=per_page,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
async def asyncio(
workspace: str,
*,
client: Union[AuthenticatedClient, Client],
page: Union[Unset, None, int] = UNSET,
per_page: Union[Unset, None, int] = UNSET,
) -> Optional[List['ListGroupsResponse200Item']]:
""" list groups
Args:
workspace (str):
page (Union[Unset, None, int]):
per_page (Union[Unset, None, int]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
List['ListGroupsResponse200Item']
"""
return (await asyncio_detailed(
workspace=workspace,
client=client,
page=page,
per_page=per_page,
)).parsed
@@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.list_instance_groups_response_200_item import ListInstanceGroupsResponse200Item
from typing import cast, List
def _get_kwargs(
) -> Dict[str, Any]:
cookies = {}
return {
"method": "get",
"url": "/groups/list",
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['ListInstanceGroupsResponse200Item']]:
if response.status_code == HTTPStatus.OK:
response_200 = []
_response_200 = response.json()
for response_200_item_data in (_response_200):
response_200_item = ListInstanceGroupsResponse200Item.from_dict(response_200_item_data)
response_200.append(response_200_item)
return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['ListInstanceGroupsResponse200Item']]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
) -> Response[List['ListInstanceGroupsResponse200Item']]:
""" list instance groups
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[List['ListInstanceGroupsResponse200Item']]
"""
kwargs = _get_kwargs(
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
*,
client: Union[AuthenticatedClient, Client],
) -> Optional[List['ListInstanceGroupsResponse200Item']]:
""" list instance groups
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
List['ListInstanceGroupsResponse200Item']
"""
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
) -> Response[List['ListInstanceGroupsResponse200Item']]:
""" list instance groups
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[List['ListInstanceGroupsResponse200Item']]
"""
kwargs = _get_kwargs(
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
async def asyncio(
*,
client: Union[AuthenticatedClient, Client],
) -> Optional[List['ListInstanceGroupsResponse200Item']]:
""" list instance groups
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
List['ListInstanceGroupsResponse200Item']
"""
return (await asyncio_detailed(
client=client,
)).parsed
@@ -0,0 +1,126 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.remove_user_from_instance_group_json_body import RemoveUserFromInstanceGroupJsonBody
def _get_kwargs(
name: str,
*,
json_body: RemoveUserFromInstanceGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/groups/removeuser/{name}".format(name=name,),
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: RemoveUserFromInstanceGroupJsonBody,
) -> Response[Any]:
""" remove user from instance group
Args:
name (str):
json_body (RemoveUserFromInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: RemoveUserFromInstanceGroupJsonBody,
) -> Response[Any]:
""" remove user from instance group
Args:
name (str):
json_body (RemoveUserFromInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,133 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from ...models.remove_user_to_group_json_body import RemoveUserToGroupJsonBody
from typing import cast
from typing import Dict
def _get_kwargs(
workspace: str,
name: str,
*,
json_body: RemoveUserToGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/w/{workspace}/groups/removeuser/{name}".format(workspace=workspace,name=name,),
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: RemoveUserToGroupJsonBody,
) -> Response[Any]:
""" remove user to group
Args:
workspace (str):
name (str):
json_body (RemoveUserToGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: RemoveUserToGroupJsonBody,
) -> Response[Any]:
""" remove user to group
Args:
workspace (str):
name (str):
json_body (RemoveUserToGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,133 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.update_group_json_body import UpdateGroupJsonBody
def _get_kwargs(
workspace: str,
name: str,
*,
json_body: UpdateGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/w/{workspace}/groups/update/{name}".format(workspace=workspace,name=name,),
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: UpdateGroupJsonBody,
) -> Response[Any]:
""" update group
Args:
workspace (str):
name (str):
json_body (UpdateGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
workspace: str,
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: UpdateGroupJsonBody,
) -> Response[Any]:
""" update group
Args:
workspace (str):
name (str):
json_body (UpdateGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
workspace=workspace,
name=name,
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)
@@ -0,0 +1,126 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Union, cast
import httpx
from ...client import AuthenticatedClient, Client
from ...types import Response, UNSET
from ... import errors
from typing import cast
from typing import Dict
from ...models.update_instance_group_json_body import UpdateInstanceGroupJsonBody
def _get_kwargs(
name: str,
*,
json_body: UpdateInstanceGroupJsonBody,
) -> Dict[str, Any]:
cookies = {}
json_json_body = json_body.to_dict()
return {
"method": "post",
"url": "/groups/update/{name}".format(name=name,),
"json": json_json_body,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: UpdateInstanceGroupJsonBody,
) -> Response[Any]:
""" update instance group
Args:
name (str):
json_body (UpdateInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
json_body=json_body,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
name: str,
*,
client: Union[AuthenticatedClient, Client],
json_body: UpdateInstanceGroupJsonBody,
) -> Response[Any]:
""" update instance group
Args:
name (str):
json_body (UpdateInstanceGroupJsonBody):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
name=name,
json_body=json_body,
)
response = await client.get_async_httpx_client().request(
**kwargs
)
return _build_response(client=client, response=response)