Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions nuon/api/orgs/get_org_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
from http import HTTPStatus
from typing import Any

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.app_org import AppOrg
from ...models.stderr_err_response import StderrErrResponse
from ...types import Response


def _get_kwargs() -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/v1/orgs/current/stats",
}

return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> AppOrg | StderrErrResponse | None:
if response.status_code == 200:
response_200 = AppOrg.from_dict(response.json())

return response_200

if response.status_code == 400:
response_400 = StderrErrResponse.from_dict(response.json())

return response_400

if response.status_code == 401:
response_401 = StderrErrResponse.from_dict(response.json())

return response_401

if response.status_code == 403:
response_403 = StderrErrResponse.from_dict(response.json())

return response_403

if response.status_code == 404:
response_404 = StderrErrResponse.from_dict(response.json())

return response_404

if response.status_code == 500:
response_500 = StderrErrResponse.from_dict(response.json())

return response_500

if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None


def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[AppOrg | StderrErrResponse]:
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: AuthenticatedClient,
) -> Response[AppOrg | StderrErrResponse]:
"""Get an org

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[AppOrg | StderrErrResponse]
"""

kwargs = _get_kwargs()

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: AuthenticatedClient,
) -> AppOrg | StderrErrResponse | None:
"""Get an org

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:
AppOrg | StderrErrResponse
"""

return sync_detailed(
client=client,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
) -> Response[AppOrg | StderrErrResponse]:
"""Get an org

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[AppOrg | StderrErrResponse]
"""

kwargs = _get_kwargs()

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: AuthenticatedClient,
) -> AppOrg | StderrErrResponse | None:
"""Get an org

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:
AppOrg | StderrErrResponse
"""

return (
await asyncio_detailed(
client=client,
)
).parsed
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nuon"
version = "0.19.718"
version = "0.19.719"
description = "A client library for accessing Nuon"
authors = []
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.19.718
0.19.719
Loading