Signed-off-by: Jess Frazelle <github@jessfraz.com>

add more

Signed-off-by: Jess Frazelle <github@jessfraz.com>

update

Signed-off-by: Jess Frazelle <github@jessfraz.com>

u[dates

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2022-04-27 12:14:58 -07:00
parent 7375479cf2
commit 02dff4020c
25 changed files with 5364 additions and 3482 deletions

View File

@ -16,9 +16,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.x'
- name: make generate
shell: bash
run: |

View File

@ -13,6 +13,7 @@ VERSION := $(shell toml get $(CURDIR)/pyproject.toml tool.poetry.version | jq -r
generate: docker-image ## Generate the api client.
docker run --rm -i $(DOCKER_FLAGS) \
--name python-generator \
--disable-content-trust \
-v $(CURDIR):/usr/src \
--workdir /usr/src \
$(DOCKER_IMAGE_NAME) sh -c 'poetry run python generate/generate.py && poetry run autopep8 --in-place --aggressive --aggressive kittycad/models/*.py && poetry run autopep8 --in-place --aggressive --aggressive kittycad/api/*.py && poetry run autopep8 --in-place --aggressive --aggressive kittycad/*.py && poetry run autopep8 --in-place --aggressive --aggressive generate/*.py'

View File

@ -714,6 +714,14 @@ def generateType(path: str, name: str, schema: dict):
"\t" +
property_name +
": Union[Unset, str] = UNSET\n")
elif property_type == 'object':
if 'additionalProperties' in property_schema:
return generateType(
path, property_name, property_schema['additionalProperties'])
else:
print(" property type: ", property_type)
print(" property schema: ", property_schema)
raise Exception(" unknown type: ", property_type)
elif property_type == 'integer':
f.write(
"\t" +
@ -735,6 +743,17 @@ def generateType(path: str, name: str, schema: dict):
property_type = property_schema['items']['$ref']
property_type = property_type.replace(
'#/components/schemas/', '')
elif 'type' in property_schema['items']:
if property_schema['items']['type'] == 'string':
property_type = 'str'
else:
print(" property: ", property_schema)
raise Exception("Unknown property type")
else:
print(" array: ", [property_schema])
print(" array: ", [property_schema['items']])
raise Exception("Unknown array type")
f.write(
"\tfrom ..models import " +
property_type +
@ -745,13 +764,10 @@ def generateType(path: str, name: str, schema: dict):
": Union[Unset, List[" +
property_type +
"]] = UNSET\n")
else:
print(" array: ", [property_schema])
print(" array: ", [property_schema['items']])
raise Exception("Unknown array type")
else:
raise Exception("Unknown array type")
else:
print(" property type: ", property_type)
raise Exception(" unknown type: ", property_type)
elif '$ref' in property_schema:
ref = property_schema['$ref'].replace(
@ -843,6 +859,17 @@ def generateType(path: str, name: str, schema: dict):
property_type = property_schema['items']['$ref']
property_type = property_type.replace(
'#/components/schemas/', '')
elif 'type' in property_schema['items']:
if property_schema['items']['type'] == 'string':
property_type = 'str'
else:
print(" property: ", property_schema)
raise Exception("Unknown property type")
else:
print(" array: ", [property_schema])
print(" array: ", [property_schema['items']])
raise Exception("Unknown array type")
f.write(
"\t\tfrom ..models import " +
property_type +
@ -854,17 +881,15 @@ def generateType(path: str, name: str, schema: dict):
property_type +
"]] = UNSET\n")
f.write(
"\t\tif not isinstance(self." + property_name + ", Unset):\n")
"\t\tif not isinstance(self." +
property_name +
", Unset):\n")
f.write(
"\t\t\t" +
property_name +
" = self." +
property_name +
"\n")
else:
print(" array: ", [property_schema])
print(" array: ", [property_schema['items']])
raise Exception("Unknown array type")
else:
raise Exception(" unknown type: ", property_type)
elif '$ref' in property_schema:
@ -1001,6 +1026,18 @@ def generateType(path: str, name: str, schema: dict):
property_type = property_schema['items']['$ref']
property_type = property_type.replace(
'#/components/schemas/', '')
elif 'type' in property_schema['items']:
if property_schema['items']['type'] == 'string':
property_type = 'str'
else:
raise Exception(
" unknown array type: ",
property_schema['items']['type'])
else:
print(" array: ", [property_schema])
print(" array: ", [property_schema['items']])
raise Exception("Unknown array type")
f.write(
"\t\tfrom ..models import " +
property_type +
@ -1012,10 +1049,6 @@ def generateType(path: str, name: str, schema: dict):
property_name +
"\", UNSET))\n")
f.write("\n")
else:
print(" array: ", [property_schema])
print(" array: ", [property_schema['items']])
raise Exception("Unknown array type")
else:
print(" unknown type: ", property_type)
raise Exception(" unknown type: ", property_type)
@ -1172,6 +1205,7 @@ def getRefs(schema: dict) -> [str]:
else:
type_name = schema['type']
if type_name == 'object':
if 'properties' in schema:
# Iternate over the properties.
for property_name in schema['properties']:
property_schema = schema['properties'][property_name]
@ -1179,6 +1213,14 @@ def getRefs(schema: dict) -> [str]:
for ref in schema_refs:
if ref not in refs:
refs.append(ref)
elif 'additionalProperties' in schema:
schema_refs = getRefs(schema['additionalProperties'])
for ref in schema_refs:
if ref not in refs:
refs.append(ref)
else:
print(" unsupported type: ", schema)
raise Exception(" unsupported type: ", schema)
return refs

View File

@ -6,16 +6,18 @@ from ...client import Client
from ...models.file_conversion_results_page import FileConversionResultsPage
from ...models.error import Error
from ...models.created_at_sort_mode import CreatedAtSortMode
from ...models.file_conversion_status import FileConversionStatus
from ...types import Response
def _get_kwargs(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/file/conversions".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by)
url = "{}/file/conversions".format(client.base_url, limit=limit, page_token=page_token, sort_by=sort_by, status=status)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
@ -54,6 +56,7 @@ def sync_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Response[Union[Any, FileConversionResultsPage, Error]]:
@ -61,6 +64,7 @@ def sync_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
)
@ -76,6 +80,7 @@ def sync(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
@ -86,6 +91,7 @@ This endpoint requires authentication by a KittyCAD employee. """
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
).parsed
@ -94,6 +100,7 @@ async def asyncio_detailed(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Response[Union[Any, FileConversionResultsPage, Error]]:
@ -101,6 +108,7 @@ async def asyncio_detailed(
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
)
@ -114,6 +122,7 @@ async def asyncio(
limit: int,
page_token: str,
sort_by: CreatedAtSortMode,
status: FileConversionStatus,
*,
client: Client,
) -> Optional[Union[Any, FileConversionResultsPage, Error]]:
@ -125,6 +134,7 @@ This endpoint requires authentication by a KittyCAD employee. """
limit=limit,
page_token=page_token,
sort_by=sort_by,
status=status,
client=client,
)
).parsed

View File

@ -0,0 +1,102 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.metadata import Metadata
from ...models.error import Error
from ...types import Response
def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/_meta/info".format(client.base_url)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Metadata, Error]]:
if response.status_code == 200:
response_200 = Metadata.from_dict(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 None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Metadata, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
*,
client: Client,
) -> Response[Union[Any, Metadata, Error]]:
kwargs = _get_kwargs(
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
*,
client: Client,
) -> Optional[Union[Any, Metadata, Error]]:
""" This includes information on any of our other distributed systems it is connected to.
You must be a KittyCAD employee to perform this request. """
return sync_detailed(
client=client,
).parsed
async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Any, Metadata, Error]]:
kwargs = _get_kwargs(
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
*,
client: Client,
) -> Optional[Union[Any, Metadata, Error]]:
""" This includes information on any of our other distributed systems it is connected to.
You must be a KittyCAD employee to perform this request. """
return (
await asyncio_detailed(
client=client,
)
).parsed

View File

@ -0,0 +1 @@
""" Contains methods for accessing the sessions API paths: Sessions allow users to call the API from their session cookie in the browser. """

View File

@ -0,0 +1,109 @@
from typing import Any, Dict, Optional, Union, cast
import httpx
from ...client import Client
from ...models.session import Session
from ...models.error import Error
from ...types import Response
def _get_kwargs(
token: str,
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/user/session/{token}".format(client.base_url, token=token)
headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
return {
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Session, Error]]:
if response.status_code == 200:
response_200 = Session.from_dict(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 None
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Session, Error]]:
return Response(
status_code=response.status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(response=response),
)
def sync_detailed(
token: str,
*,
client: Client,
) -> Response[Union[Any, Session, Error]]:
kwargs = _get_kwargs(
token=token,
client=client,
)
response = httpx.get(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(response=response)
def sync(
token: str,
*,
client: Client,
) -> Optional[Union[Any, Session, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns details of the requested API token for the user. """
return sync_detailed(
token=token,
client=client,
).parsed
async def asyncio_detailed(
token: str,
*,
client: Client,
) -> Response[Union[Any, Session, Error]]:
kwargs = _get_kwargs(
token=token,
client=client,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.get(**kwargs)
return _build_response(response=response)
async def asyncio(
token: str,
*,
client: Client,
) -> Optional[Union[Any, Session, Error]]:
""" This endpoint requires authentication by any KittyCAD user. It returns details of the requested API token for the user. """
return (
await asyncio_detailed(
token=token,
client=client,
)
).parsed

View File

@ -6,7 +6,10 @@ from .api_call_with_price import ApiCallWithPrice
from .api_call_with_price_results_page import ApiCallWithPriceResultsPage
from .api_token import ApiToken
from .api_token_results_page import ApiTokenResultsPage
from .cluster import Cluster
from .created_at_sort_mode import CreatedAtSortMode
from .duration import Duration
from .engine_metadata import EngineMetadata
from .error import Error
from .extended_user import ExtendedUser
from .extended_user_results_page import ExtendedUserResultsPage
@ -16,8 +19,19 @@ from .file_conversion_results_page import FileConversionResultsPage
from .file_conversion_source_format import FileConversionSourceFormat
from .file_conversion_status import FileConversionStatus
from .file_conversion_with_output import FileConversionWithOutput
from .file_system_metadata import FileSystemMetadata
from .gateway import Gateway
from .jetstream import Jetstream
from .jetstream_api_stats import JetstreamApiStats
from .jetstream_config import JetstreamConfig
from .jetstream_stats import JetstreamStats
from .leaf_node import LeafNode
from .meta_cluster_info import MetaClusterInfo
from .metadata import Metadata
from .method import Method
from .nats_connection import NatsConnection
from .pong import Pong
from .session import Session
from .status_code import StatusCode
from .user import User
from .user_results_page import UserResultsPage

View File

@ -0,0 +1,94 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="Cluster")
@attr.s(auto_attribs=True)
class Cluster:
""" """
addr: Union[Unset, str] = UNSET
auth_timeout: Union[Unset, int] = UNSET
cluster_port: Union[Unset, int] = UNSET
name: Union[Unset, str] = UNSET
tls_timeout: Union[Unset, int] = UNSET
from ..models import str
urls: Union[Unset, List[str]] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
addr = self.addr
auth_timeout = self.auth_timeout
cluster_port = self.cluster_port
name = self.name
tls_timeout = self.tls_timeout
from ..models import str
urls: Union[Unset, List[str]] = UNSET
if not isinstance(self.urls, Unset):
urls = self.urls
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if addr is not UNSET:
field_dict['addr'] = addr
if auth_timeout is not UNSET:
field_dict['auth_timeout'] = auth_timeout
if cluster_port is not UNSET:
field_dict['cluster_port'] = cluster_port
if name is not UNSET:
field_dict['name'] = name
if tls_timeout is not UNSET:
field_dict['tls_timeout'] = tls_timeout
if urls is not UNSET:
field_dict['urls'] = urls
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
addr = d.pop("addr", UNSET)
auth_timeout = d.pop("auth_timeout", UNSET)
cluster_port = d.pop("cluster_port", UNSET)
name = d.pop("name", UNSET)
tls_timeout = d.pop("tls_timeout", UNSET)
from ..models import str
urls = cast(List[str], d.pop("urls", UNSET))
cluster = cls(
addr=addr,
auth_timeout=auth_timeout,
cluster_port=cluster_port,
name=name,
tls_timeout=tls_timeout,
urls=urls,
)
cluster.additional_properties = d
return cluster
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,4 @@
class Duration(int):
def __int__(self) -> int:
return self

View File

@ -0,0 +1,91 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.file_system_metadata import FileSystemMetadata
from ..models.nats_connection import NatsConnection
from ..types import UNSET, Unset
T = TypeVar("T", bound="EngineMetadata")
@attr.s(auto_attribs=True)
class EngineMetadata:
""" """
async_jobs_running: Union[Unset, bool] = False
fs: Union[Unset, FileSystemMetadata] = UNSET
git_hash: Union[Unset, str] = UNSET
nats: Union[Unset, NatsConnection] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
async_jobs_running = self.async_jobs_running
fs: Union[Unset, str] = UNSET
if not isinstance(self.fs, Unset):
fs = self.fs.value
git_hash = self.git_hash
nats: Union[Unset, str] = UNSET
if not isinstance(self.nats, Unset):
nats = self.nats.value
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if async_jobs_running is not UNSET:
field_dict['async_jobs_running'] = async_jobs_running
if fs is not UNSET:
field_dict['fs'] = fs
if git_hash is not UNSET:
field_dict['git_hash'] = git_hash
if nats is not UNSET:
field_dict['nats'] = nats
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
async_jobs_running = d.pop("async_jobs_running", UNSET)
_fs = d.pop("fs", UNSET)
fs: Union[Unset, FileSystemMetadata]
if isinstance(_fs, Unset):
fs = UNSET
else:
fs = FileSystemMetadata(_fs)
git_hash = d.pop("git_hash", UNSET)
_nats = d.pop("nats", UNSET)
nats: Union[Unset, NatsConnection]
if isinstance(_nats, Unset):
nats = UNSET
else:
nats = NatsConnection(_nats)
engine_metadata = cls(
async_jobs_running=async_jobs_running,
fs=fs,
git_hash=git_hash,
nats=nats,
)
engine_metadata.additional_properties = d
return engine_metadata
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -24,6 +24,7 @@ class FileConversionWithOutput:
src_format: Union[Unset, FileConversionSourceFormat] = UNSET
started_at: Union[Unset, datetime.datetime] = UNSET
status: Union[Unset, FileConversionStatus] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
@ -51,6 +52,9 @@ class FileConversionWithOutput:
status: Union[Unset, str] = UNSET
if not isinstance(self.status, Unset):
status = self.status.value
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
field_dict: Dict[str, Any] = {}
@ -72,6 +76,8 @@ class FileConversionWithOutput:
field_dict['started_at'] = started_at
if status is not UNSET:
field_dict['status'] = status
if updated_at is not UNSET:
field_dict['updated_at'] = updated_at
if user_id is not UNSET:
field_dict['user_id'] = user_id
@ -131,6 +137,13 @@ class FileConversionWithOutput:
else:
status = FileConversionStatus(_status)
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
file_conversion_with_output = cls(
@ -142,6 +155,7 @@ class FileConversionWithOutput:
src_format=src_format,
started_at=started_at,
status=status,
updated_at=updated_at,
user_id=user_id,
)

View File

@ -0,0 +1,54 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="FileSystemMetadata")
@attr.s(auto_attribs=True)
class FileSystemMetadata:
""" """
ok: Union[Unset, bool] = False
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
ok = self.ok
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if ok is not UNSET:
field_dict['ok'] = ok
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
ok = d.pop("ok", UNSET)
file_system_metadata = cls(
ok=ok,
)
file_system_metadata.additional_properties = d
return file_system_metadata
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,82 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="Gateway")
@attr.s(auto_attribs=True)
class Gateway:
""" """
auth_timeout: Union[Unset, int] = UNSET
host: Union[Unset, str] = UNSET
name: Union[Unset, str] = UNSET
port: Union[Unset, int] = UNSET
tls_timeout: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
auth_timeout = self.auth_timeout
host = self.host
name = self.name
port = self.port
tls_timeout = self.tls_timeout
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if auth_timeout is not UNSET:
field_dict['auth_timeout'] = auth_timeout
if host is not UNSET:
field_dict['host'] = host
if name is not UNSET:
field_dict['name'] = name
if port is not UNSET:
field_dict['port'] = port
if tls_timeout is not UNSET:
field_dict['tls_timeout'] = tls_timeout
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET)
host = d.pop("host", UNSET)
name = d.pop("name", UNSET)
port = d.pop("port", UNSET)
tls_timeout = d.pop("tls_timeout", UNSET)
gateway = cls(
auth_timeout=auth_timeout,
host=host,
name=name,
port=port,
tls_timeout=tls_timeout,
)
gateway.additional_properties = d
return gateway
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,4 @@
class http_req_stats(int):
def __int__(self) -> int:
return self

View File

@ -0,0 +1,92 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.jetstream_config import JetstreamConfig
from ..models.meta_cluster_info import MetaClusterInfo
from ..models.jetstream_stats import JetstreamStats
from ..types import UNSET, Unset
T = TypeVar("T", bound="Jetstream")
@attr.s(auto_attribs=True)
class Jetstream:
""" """
config: Union[Unset, JetstreamConfig] = UNSET
meta: Union[Unset, MetaClusterInfo] = UNSET
stats: Union[Unset, JetstreamStats] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
config: Union[Unset, str] = UNSET
if not isinstance(self.config, Unset):
config = self.config.value
meta: Union[Unset, str] = UNSET
if not isinstance(self.meta, Unset):
meta = self.meta.value
stats: Union[Unset, str] = UNSET
if not isinstance(self.stats, Unset):
stats = self.stats.value
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if config is not UNSET:
field_dict['config'] = config
if meta is not UNSET:
field_dict['meta'] = meta
if stats is not UNSET:
field_dict['stats'] = stats
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
_config = d.pop("config", UNSET)
config: Union[Unset, JetstreamConfig]
if isinstance(_config, Unset):
config = UNSET
else:
config = JetstreamConfig(_config)
_meta = d.pop("meta", UNSET)
meta: Union[Unset, MetaClusterInfo]
if isinstance(_meta, Unset):
meta = UNSET
else:
meta = MetaClusterInfo(_meta)
_stats = d.pop("stats", UNSET)
stats: Union[Unset, JetstreamStats]
if isinstance(_stats, Unset):
stats = UNSET
else:
stats = JetstreamStats(_stats)
jetstream = cls(
config=config,
meta=meta,
stats=stats,
)
jetstream.additional_properties = d
return jetstream
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,68 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="JetstreamApiStats")
@attr.s(auto_attribs=True)
class JetstreamApiStats:
""" """
errors: Union[Unset, int] = UNSET
inflight: Union[Unset, int] = UNSET
total: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
errors = self.errors
inflight = self.inflight
total = self.total
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if errors is not UNSET:
field_dict['errors'] = errors
if inflight is not UNSET:
field_dict['inflight'] = inflight
if total is not UNSET:
field_dict['total'] = total
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
errors = d.pop("errors", UNSET)
inflight = d.pop("inflight", UNSET)
total = d.pop("total", UNSET)
jetstream_api_stats = cls(
errors=errors,
inflight=inflight,
total=total,
)
jetstream_api_stats.additional_properties = d
return jetstream_api_stats
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,75 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="JetstreamConfig")
@attr.s(auto_attribs=True)
class JetstreamConfig:
""" """
domain: Union[Unset, str] = UNSET
max_memory: Union[Unset, int] = UNSET
max_storage: Union[Unset, int] = UNSET
store_dir: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
domain = self.domain
max_memory = self.max_memory
max_storage = self.max_storage
store_dir = self.store_dir
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if domain is not UNSET:
field_dict['domain'] = domain
if max_memory is not UNSET:
field_dict['max_memory'] = max_memory
if max_storage is not UNSET:
field_dict['max_storage'] = max_storage
if store_dir is not UNSET:
field_dict['store_dir'] = store_dir
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
domain = d.pop("domain", UNSET)
max_memory = d.pop("max_memory", UNSET)
max_storage = d.pop("max_storage", UNSET)
store_dir = d.pop("store_dir", UNSET)
jetstream_config = cls(
domain=domain,
max_memory=max_memory,
max_storage=max_storage,
store_dir=store_dir,
)
jetstream_config.additional_properties = d
return jetstream_config
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,104 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.jetstream_api_stats import JetstreamApiStats
from ..types import UNSET, Unset
T = TypeVar("T", bound="JetstreamStats")
@attr.s(auto_attribs=True)
class JetstreamStats:
""" """
accounts: Union[Unset, int] = UNSET
api: Union[Unset, JetstreamApiStats] = UNSET
ha_assets: Union[Unset, int] = UNSET
memory: Union[Unset, int] = UNSET
reserved_memory: Union[Unset, int] = UNSET
reserved_store: Union[Unset, int] = UNSET
store: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
accounts = self.accounts
api: Union[Unset, str] = UNSET
if not isinstance(self.api, Unset):
api = self.api.value
ha_assets = self.ha_assets
memory = self.memory
reserved_memory = self.reserved_memory
reserved_store = self.reserved_store
store = self.store
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if accounts is not UNSET:
field_dict['accounts'] = accounts
if api is not UNSET:
field_dict['api'] = api
if ha_assets is not UNSET:
field_dict['ha_assets'] = ha_assets
if memory is not UNSET:
field_dict['memory'] = memory
if reserved_memory is not UNSET:
field_dict['reserved_memory'] = reserved_memory
if reserved_store is not UNSET:
field_dict['reserved_store'] = reserved_store
if store is not UNSET:
field_dict['store'] = store
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
accounts = d.pop("accounts", UNSET)
_api = d.pop("api", UNSET)
api: Union[Unset, JetstreamApiStats]
if isinstance(_api, Unset):
api = UNSET
else:
api = JetstreamApiStats(_api)
ha_assets = d.pop("ha_assets", UNSET)
memory = d.pop("memory", UNSET)
reserved_memory = d.pop("reserved_memory", UNSET)
reserved_store = d.pop("reserved_store", UNSET)
store = d.pop("store", UNSET)
jetstream_stats = cls(
accounts=accounts,
api=api,
ha_assets=ha_assets,
memory=memory,
reserved_memory=reserved_memory,
reserved_store=reserved_store,
store=store,
)
jetstream_stats.additional_properties = d
return jetstream_stats
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,75 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="LeafNode")
@attr.s(auto_attribs=True)
class LeafNode:
""" """
auth_timeout: Union[Unset, int] = UNSET
host: Union[Unset, str] = UNSET
port: Union[Unset, int] = UNSET
tls_timeout: Union[Unset, int] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
auth_timeout = self.auth_timeout
host = self.host
port = self.port
tls_timeout = self.tls_timeout
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if auth_timeout is not UNSET:
field_dict['auth_timeout'] = auth_timeout
if host is not UNSET:
field_dict['host'] = host
if port is not UNSET:
field_dict['port'] = port
if tls_timeout is not UNSET:
field_dict['tls_timeout'] = tls_timeout
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
auth_timeout = d.pop("auth_timeout", UNSET)
host = d.pop("host", UNSET)
port = d.pop("port", UNSET)
tls_timeout = d.pop("tls_timeout", UNSET)
leaf_node = cls(
auth_timeout=auth_timeout,
host=host,
port=port,
tls_timeout=tls_timeout,
)
leaf_node.additional_properties = d
return leaf_node
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,68 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="MetaClusterInfo")
@attr.s(auto_attribs=True)
class MetaClusterInfo:
""" """
cluster_size: Union[Unset, int] = UNSET
leader: Union[Unset, str] = UNSET
name: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
cluster_size = self.cluster_size
leader = self.leader
name = self.name
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if cluster_size is not UNSET:
field_dict['cluster_size'] = cluster_size
if leader is not UNSET:
field_dict['leader'] = leader
if name is not UNSET:
field_dict['name'] = name
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
cluster_size = d.pop("cluster_size", UNSET)
leader = d.pop("leader", UNSET)
name = d.pop("name", UNSET)
meta_cluster_info = cls(
cluster_size=cluster_size,
leader=leader,
name=name,
)
meta_cluster_info.additional_properties = d
return meta_cluster_info
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,99 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.engine_metadata import EngineMetadata
from ..models.file_system_metadata import FileSystemMetadata
from ..models.nats_connection import NatsConnection
from ..types import UNSET, Unset
T = TypeVar("T", bound="Metadata")
@attr.s(auto_attribs=True)
class Metadata:
""" """
engine: Union[Unset, EngineMetadata] = UNSET
fs: Union[Unset, FileSystemMetadata] = UNSET
git_hash: Union[Unset, str] = UNSET
nats: Union[Unset, NatsConnection] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
engine: Union[Unset, str] = UNSET
if not isinstance(self.engine, Unset):
engine = self.engine.value
fs: Union[Unset, str] = UNSET
if not isinstance(self.fs, Unset):
fs = self.fs.value
git_hash = self.git_hash
nats: Union[Unset, str] = UNSET
if not isinstance(self.nats, Unset):
nats = self.nats.value
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if engine is not UNSET:
field_dict['engine'] = engine
if fs is not UNSET:
field_dict['fs'] = fs
if git_hash is not UNSET:
field_dict['git_hash'] = git_hash
if nats is not UNSET:
field_dict['nats'] = nats
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
_engine = d.pop("engine", UNSET)
engine: Union[Unset, EngineMetadata]
if isinstance(_engine, Unset):
engine = UNSET
else:
engine = EngineMetadata(_engine)
_fs = d.pop("fs", UNSET)
fs: Union[Unset, FileSystemMetadata]
if isinstance(_fs, Unset):
fs = UNSET
else:
fs = FileSystemMetadata(_fs)
git_hash = d.pop("git_hash", UNSET)
_nats = d.pop("nats", UNSET)
nats: Union[Unset, NatsConnection]
if isinstance(_nats, Unset):
nats = UNSET
else:
nats = NatsConnection(_nats)
metadata = cls(
engine=engine,
fs=fs,
git_hash=git_hash,
nats=nats,
)
metadata.additional_properties = d
return metadata
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -0,0 +1,33 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.cluster import Cluster
from ..models.gateway import Gateway
from ..models.jetstream import Jetstream
from ..models.leaf_node import LeafNode
from ..models.duration import Duration
from ..types import UNSET, Unset
T = TypeVar("T", bound="NatsConnection")
@attr.s(auto_attribs=True)
class NatsConnection:
""" """
auth_timeout: Union[Unset, int] = UNSET
cluster: Union[Unset, Cluster] = UNSET
config_load_time: Union[Unset, datetime.datetime] = UNSET
connections: Union[Unset, int] = UNSET
cores: Union[Unset, int] = UNSET
cpu: Union[Unset, int] = UNSET
gateway: Union[Unset, Gateway] = UNSET
git_commit: Union[Unset, str] = UNSET
go: Union[Unset, str] = UNSET
gomaxprocs: Union[Unset, int] = UNSET
host: Union[Unset, str] = UNSET
http_base_path: Union[Unset, str] = UNSET
http_host: Union[Unset, str] = UNSET
http_port: Union[Unset, int] = UNSET

120
kittycad/models/session.py Normal file
View File

@ -0,0 +1,120 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..types import UNSET, Unset
T = TypeVar("T", bound="Session")
@attr.s(auto_attribs=True)
class Session:
""" """
created_at: Union[Unset, datetime.datetime] = UNSET
expires: Union[Unset, datetime.datetime] = UNSET
id: Union[Unset, str] = UNSET
session_token: Union[Unset, Uuid] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
expires: Union[Unset, str] = UNSET
if not isinstance(self.expires, Unset):
expires = self.expires.isoformat()
id = self.id
session_token: Union[Unset, str] = UNSET
if not isinstance(self.session_token, Unset):
session_token = self.session_token.value
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if created_at is not UNSET:
field_dict['created_at'] = created_at
if expires is not UNSET:
field_dict['expires'] = expires
if id is not UNSET:
field_dict['id'] = id
if session_token is not UNSET:
field_dict['session_token'] = session_token
if updated_at is not UNSET:
field_dict['updated_at'] = updated_at
if user_id is not UNSET:
field_dict['user_id'] = user_id
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
_created_at = d.pop("created_at", UNSET)
created_at: Union[Unset, datetime.datetime]
if isinstance(_created_at, Unset):
created_at = UNSET
else:
created_at = isoparse(_created_at)
_expires = d.pop("expires", UNSET)
expires: Union[Unset, datetime.datetime]
if isinstance(_expires, Unset):
expires = UNSET
else:
expires = isoparse(_expires)
id = d.pop("id", UNSET)
_session_token = d.pop("session_token", UNSET)
session_token: Union[Unset, Uuid]
if isinstance(_session_token, Unset):
session_token = UNSET
else:
session_token = Uuid(_session_token)
_updated_at = d.pop("updated_at", UNSET)
updated_at: Union[Unset, datetime.datetime]
if isinstance(_updated_at, Unset):
updated_at = UNSET
else:
updated_at = isoparse(_updated_at)
user_id = d.pop("user_id", UNSET)
session = cls(
created_at=created_at,
expires=expires,
id=id,
session_token=session_token,
updated_at=updated_at,
user_id=user_id,
)
session.additional_properties = d
return session
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

767
spec.json

File diff suppressed because it is too large Load Diff