Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-09-29 16:05:40 -07:00
parent 31cd9e532d
commit 12c164620b
268 changed files with 22464 additions and 18287 deletions

View File

@ -10,19 +10,28 @@ from ...types import Response
def _get_kwargs(
group_by: ApiCallQueryGroupBy,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/api-call-metrics".format(
client.base_url,
) # noqa: E501
url = "{}/api-call-metrics".format(client.base_url, ) # noqa: E501
if group_by is not None:
if "?" in url:
url = url + "&group_by=" + str(group_by)
else:
url = url + "?group_by=" + str(group_by)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
@ -32,27 +41,30 @@ def _get_kwargs(
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(
*, response: httpx.Response
) -> Optional[Union[List[ApiCallQueryGroup], Error]]:
if response.status_code == 200:
response_200 = [ApiCallQueryGroup.from_dict(item) for item in response.json()]
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return Error.from_dict(response.json())
def _parse_response(*, response: httpx.Response) -> Optional[Union[List[ApiCallQueryGroup], Error]] :
if response.status_code == 200:
response_200 = [
ApiCallQueryGroup.from_dict(item)
for item in response.json()
]
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return Error.from_dict(response.json())
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[List[ApiCallQueryGroup], Error]]]:
) -> Response[Optional[Union[List[ApiCallQueryGroup], Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -62,12 +74,21 @@ def _build_response(
def sync_detailed(
group_by: ApiCallQueryGroupBy,
*,
client: Client,
) -> Response[Optional[Union[List[ApiCallQueryGroup], Error]]]:
) -> Response[Optional[Union[List[ApiCallQueryGroup], Error]]]:
kwargs = _get_kwargs(
group_by=group_by,
client=client,
)
@ -80,25 +101,43 @@ def sync_detailed(
def sync(
group_by: ApiCallQueryGroupBy,
*,
client: Client,
) -> Optional[Union[List[ApiCallQueryGroup], Error]]:
) -> Optional[Union[List[ApiCallQueryGroup], Error]] :
"""This endpoint requires authentication by a KittyCAD employee. The API calls are grouped by the parameter passed.""" # noqa: E501
return sync_detailed(
group_by=group_by,
client=client,
).parsed
async def asyncio_detailed(
group_by: ApiCallQueryGroupBy,
*,
client: Client,
) -> Response[Optional[Union[List[ApiCallQueryGroup], Error]]]:
) -> Response[Optional[Union[List[ApiCallQueryGroup], Error]]]:
kwargs = _get_kwargs(
group_by=group_by,
client=client,
)
@ -109,15 +148,24 @@ async def asyncio_detailed(
async def asyncio(
group_by: ApiCallQueryGroupBy,
*,
client: Client,
) -> Optional[Union[List[ApiCallQueryGroup], Error]]:
) -> Optional[Union[List[ApiCallQueryGroup], Error]] :
"""This endpoint requires authentication by a KittyCAD employee. The API calls are grouped by the parameter passed.""" # noqa: E501
return (
await asyncio_detailed(
group_by=group_by,
client=client,
)
).parsed