@ -626,7 +626,7 @@ def generateTypes(cwd: str, parser: dict):
|
||||
for key in schemas:
|
||||
schema = schemas[key]
|
||||
print("generating schema: ", key)
|
||||
generateType(path, key, schema)
|
||||
generateType(path, key, schema, data)
|
||||
if 'oneOf' not in schema:
|
||||
f.write("from ." + camel_to_snake(key) + " import " + key + "\n")
|
||||
|
||||
@ -634,7 +634,7 @@ def generateTypes(cwd: str, parser: dict):
|
||||
f.close()
|
||||
|
||||
|
||||
def generateType(path: str, name: str, schema: dict):
|
||||
def generateType(path: str, name: str, schema: dict, data: dict):
|
||||
file_path = path
|
||||
if path.endswith(".py") is False:
|
||||
# Generate the type.
|
||||
@ -644,7 +644,7 @@ def generateType(path: str, name: str, schema: dict):
|
||||
if 'type' in schema:
|
||||
type_name = schema['type']
|
||||
if type_name == 'object':
|
||||
generateObjectType(file_path, name, schema, type_name)
|
||||
generateObjectType(file_path, name, schema, type_name, data)
|
||||
elif type_name == 'string' and 'enum' in schema:
|
||||
generateEnumType(file_path, name, schema, type_name)
|
||||
elif type_name == 'integer':
|
||||
@ -660,19 +660,19 @@ def generateType(path: str, name: str, schema: dict):
|
||||
# Skip it since we will already have generated it.
|
||||
return
|
||||
elif 'oneOf' in schema:
|
||||
generateOneOfType(file_path, name, schema)
|
||||
generateOneOfType(file_path, name, schema, data)
|
||||
else:
|
||||
print(" schema: ", [schema])
|
||||
print(" unsupported type: ", name)
|
||||
raise Exception(" unsupported type: ", name)
|
||||
|
||||
|
||||
def generateOneOfType(path: str, name: str, schema: dict):
|
||||
def generateOneOfType(path: str, name: str, schema: dict, data):
|
||||
for t in schema['oneOf']:
|
||||
# Get the name for the reference.
|
||||
if '$ref' in t:
|
||||
name = t['$ref'].replace('#/components/schemas/', '')
|
||||
generateType(path, name, t)
|
||||
generateType(path, name, t, data)
|
||||
else:
|
||||
print(" schema: ", [t])
|
||||
print(" oneOf must be a ref: ", name)
|
||||
@ -747,7 +747,12 @@ def generateEnumType(path: str, name: str, schema: dict, type_name: str):
|
||||
f.close()
|
||||
|
||||
|
||||
def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
def generateObjectType(
|
||||
path: str,
|
||||
name: str,
|
||||
schema: dict,
|
||||
type_name: str,
|
||||
data: dict):
|
||||
print("generating type: ", name, " at: ", path)
|
||||
print(" schema: ", [schema])
|
||||
f = open(path, "w")
|
||||
@ -783,104 +788,7 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
# Iterate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
property_schema = schema['properties'][property_name]
|
||||
if 'type' in property_schema:
|
||||
property_type = property_schema['type']
|
||||
|
||||
# Write the property.
|
||||
if property_type == 'string':
|
||||
if 'format' in property_schema:
|
||||
if property_schema['format'] == 'date-time' or property_schema['format'] == 'partial-date-time':
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, datetime.datetime] = UNSET\n")
|
||||
continue
|
||||
|
||||
f.write(
|
||||
"\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" +
|
||||
property_name +
|
||||
": Union[Unset, int] = UNSET\n")
|
||||
elif property_type == 'number':
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, float] = UNSET\n")
|
||||
elif property_type == 'boolean':
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, bool] = False\n")
|
||||
elif property_type == 'array':
|
||||
if 'items' in property_schema:
|
||||
if '$ref' in property_schema['items']:
|
||||
property_type = property_schema['items']['$ref']
|
||||
property_type = property_type.replace(
|
||||
'#/components/schemas/', '')
|
||||
f.write(
|
||||
"\tfrom ..models." +
|
||||
camel_to_snake(property_type) +
|
||||
" import " +
|
||||
property_type +
|
||||
"\n")
|
||||
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" +
|
||||
property_name +
|
||||
": Union[Unset, List[" +
|
||||
property_type +
|
||||
"]] = UNSET\n")
|
||||
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(
|
||||
'#/components/schemas/', '')
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, " +
|
||||
ref +
|
||||
"] = UNSET\n")
|
||||
elif 'allOf' in property_schema:
|
||||
thing = property_schema['allOf'][0]
|
||||
if '$ref' in thing:
|
||||
ref = thing['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, " +
|
||||
ref +
|
||||
"] = UNSET\n")
|
||||
else:
|
||||
raise Exception(" unknown allOf type: ", property_schema)
|
||||
else:
|
||||
raise Exception(" unknown schema: ", property_schema)
|
||||
renderTypeInit(f, path, property_name, property_schema, data)
|
||||
|
||||
# Finish writing the class.
|
||||
f.write("\n")
|
||||
@ -893,6 +801,85 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
# Iternate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
property_schema = schema['properties'][property_name]
|
||||
renderTypeToDict(f, property_name, property_schema, data)
|
||||
|
||||
# Finish writing the to_dict method.
|
||||
f.write("\n")
|
||||
f.write("\t\tfield_dict: Dict[str, Any] = {}\n")
|
||||
f.write("\t\tfield_dict.update(self.additional_properties)\n")
|
||||
f.write("\t\tfield_dict.update({})\n")
|
||||
|
||||
# Iternate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
# Write the property.
|
||||
f.write("\t\tif " + property_name + " is not UNSET:\n")
|
||||
f.write(
|
||||
"\t\t\tfield_dict['" +
|
||||
property_name +
|
||||
"'] = " +
|
||||
property_name +
|
||||
"\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\t\treturn field_dict\n")
|
||||
|
||||
# Now let's write the from_dict method.
|
||||
f.write("\n")
|
||||
f.write("\t@classmethod\n")
|
||||
f.write(
|
||||
"\tdef from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:\n")
|
||||
f.write("\t\td = src_dict.copy()\n")
|
||||
|
||||
# Iternate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
property_schema = schema['properties'][property_name]
|
||||
renderTypeFromDict(f, property_name, property_schema, data)
|
||||
|
||||
# Finish writing the from_dict method.
|
||||
f.write("\n")
|
||||
f.write("\t\t" + camel_to_snake(name) + " = cls(\n")
|
||||
# Iternate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
# Write the property.
|
||||
f.write("\t\t\t" + property_name + "= " + property_name + ",\n")
|
||||
|
||||
# Close the class.
|
||||
f.write("\t\t)\n")
|
||||
f.write("\n")
|
||||
f.write("\t\t" + camel_to_snake(name) + ".additional_properties = d\n")
|
||||
f.write("\t\treturn " + camel_to_snake(name) + "\n")
|
||||
|
||||
# write the rest of the class.
|
||||
f.write("\n")
|
||||
f.write("\t@property\n")
|
||||
f.write("\tdef additional_keys(self) -> List[str]:\n")
|
||||
f.write("\t\treturn list(self.additional_properties.keys())\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __getitem__(self, key: str) -> Any:\n")
|
||||
f.write("\t\treturn self.additional_properties[key]\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __setitem__(self, key: str, value: Any) -> None:\n")
|
||||
f.write("\t\tself.additional_properties[key] = value\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __delitem__(self, key: str) -> None:\n")
|
||||
f.write("\t\tdel self.additional_properties[key]\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __contains__(self, key: str) -> bool:\n")
|
||||
f.write("\t\treturn key in self.additional_properties\n")
|
||||
|
||||
# Close the file.
|
||||
f.close()
|
||||
|
||||
|
||||
def renderTypeToDict(
|
||||
f,
|
||||
property_name: str,
|
||||
property_schema: dict,
|
||||
data: dict):
|
||||
if 'type' in property_schema:
|
||||
property_type = property_schema['type']
|
||||
|
||||
@ -905,14 +892,17 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
property_name +
|
||||
": Union[Unset, str] = 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 +
|
||||
".isoformat()\n")
|
||||
continue
|
||||
# return early
|
||||
return
|
||||
|
||||
f.write(
|
||||
"\t\t" +
|
||||
@ -981,7 +971,12 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
property_name +
|
||||
"\n")
|
||||
else:
|
||||
raise Exception(" unknown type: ", property_type)
|
||||
f.write(
|
||||
"\t\t" +
|
||||
property_name +
|
||||
" = self." +
|
||||
property_name +
|
||||
"\n")
|
||||
elif '$ref' in property_schema:
|
||||
ref = property_schema['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
@ -1004,6 +999,9 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
if '$ref' in thing:
|
||||
ref = thing['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
if ref == "Uuid":
|
||||
return renderTypeToDict(
|
||||
f, property_name, data['components']['schemas'][ref], data)
|
||||
f.write(
|
||||
"\t\t" +
|
||||
property_name +
|
||||
@ -1021,38 +1019,133 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
else:
|
||||
raise Exception(" unknown allOf type: ", property_schema)
|
||||
else:
|
||||
raise Exception(" unknown schema: ", property_schema)
|
||||
|
||||
# Finish writing the to_dict method.
|
||||
f.write("\n")
|
||||
f.write("\t\tfield_dict: Dict[str, Any] = {}\n")
|
||||
f.write("\t\tfield_dict.update(self.additional_properties)\n")
|
||||
f.write("\t\tfield_dict.update({})\n")
|
||||
|
||||
# Iternate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
# Write the property.
|
||||
f.write("\t\tif " + property_name + " is not UNSET:\n")
|
||||
f.write(
|
||||
"\t\t\tfield_dict['" +
|
||||
"\t\t" +
|
||||
property_name +
|
||||
"'] = " +
|
||||
" = self." +
|
||||
property_name +
|
||||
"\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\t\treturn field_dict\n")
|
||||
|
||||
# Now let's write the from_dict method.
|
||||
f.write("\n")
|
||||
f.write("\t@classmethod\n")
|
||||
def renderTypeInit(
|
||||
f,
|
||||
path: str,
|
||||
property_name: str,
|
||||
property_schema: dict,
|
||||
data: dict):
|
||||
if 'type' in property_schema:
|
||||
property_type = property_schema['type']
|
||||
|
||||
# Write the property.
|
||||
if property_type == 'string':
|
||||
if 'format' in property_schema:
|
||||
if property_schema['format'] == 'date-time' or property_schema['format'] == 'partial-date-time':
|
||||
f.write(
|
||||
"\tdef from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:\n")
|
||||
f.write("\t\td = src_dict.copy()\n")
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, datetime.datetime] = UNSET\n")
|
||||
# Return early.
|
||||
return
|
||||
|
||||
# Iternate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
property_schema = schema['properties'][property_name]
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, str] = UNSET\n")
|
||||
elif property_type == 'object':
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, Any] = UNSET\n")
|
||||
elif property_type == 'integer':
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, int] = UNSET\n")
|
||||
elif property_type == 'number':
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, float] = UNSET\n")
|
||||
elif property_type == 'boolean':
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, bool] = False\n")
|
||||
elif property_type == 'array':
|
||||
if 'items' in property_schema:
|
||||
if '$ref' in property_schema['items']:
|
||||
property_type = property_schema['items']['$ref']
|
||||
property_type = property_type.replace(
|
||||
'#/components/schemas/', '')
|
||||
f.write(
|
||||
"\tfrom ..models." +
|
||||
camel_to_snake(property_type) +
|
||||
" import " +
|
||||
property_type +
|
||||
"\n")
|
||||
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" +
|
||||
property_name +
|
||||
": Union[Unset, List[" +
|
||||
property_type +
|
||||
"]] = UNSET\n")
|
||||
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(
|
||||
'#/components/schemas/', '')
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, " +
|
||||
ref +
|
||||
"] = UNSET\n")
|
||||
elif 'allOf' in property_schema:
|
||||
thing = property_schema['allOf'][0]
|
||||
if '$ref' in thing:
|
||||
ref = thing['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
if ref == "Uuid":
|
||||
return renderTypeInit(
|
||||
f,
|
||||
path,
|
||||
property_name,
|
||||
data['components']['schemas'][ref],
|
||||
data)
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, " +
|
||||
ref +
|
||||
"] = UNSET\n")
|
||||
else:
|
||||
raise Exception(" unknown allOf type: ", property_schema)
|
||||
else:
|
||||
f.write(
|
||||
"\t" +
|
||||
property_name +
|
||||
": Union[Unset, Any] = UNSET\n")
|
||||
|
||||
|
||||
def renderTypeFromDict(
|
||||
f,
|
||||
property_name: str,
|
||||
property_schema: dict,
|
||||
data: dict):
|
||||
if 'type' in property_schema:
|
||||
property_type = property_schema['type']
|
||||
|
||||
@ -1077,7 +1170,8 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
f.write("\t\t\t" + property_name +
|
||||
" = isoparse(_" + property_name + ")\n")
|
||||
f.write("\n")
|
||||
continue
|
||||
# Return early.
|
||||
return
|
||||
|
||||
f.write(
|
||||
"\t\t" +
|
||||
@ -1142,8 +1236,12 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
"\", UNSET))\n")
|
||||
f.write("\n")
|
||||
else:
|
||||
print(" unknown type: ", property_type)
|
||||
raise Exception(" unknown type: ", property_type)
|
||||
f.write(
|
||||
"\t\t" +
|
||||
property_name +
|
||||
" = d.pop(\"" +
|
||||
property_name +
|
||||
"\", UNSET)\n")
|
||||
elif '$ref' in property_schema:
|
||||
ref = property_schema['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
@ -1169,6 +1267,9 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
if '$ref' in thing:
|
||||
ref = thing['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
if ref == "Uuid":
|
||||
return renderTypeFromDict(
|
||||
f, property_name, data['components']['schemas'][ref], data)
|
||||
f.write(
|
||||
"\t\t_" +
|
||||
property_name +
|
||||
@ -1189,47 +1290,12 @@ def generateObjectType(path: str, name: str, schema: dict, type_name: str):
|
||||
else:
|
||||
raise Exception(" unknown allOf type: ", property_schema)
|
||||
else:
|
||||
print(" unknown schema: ", property_schema)
|
||||
raise Exception(" unknown schema: ", property_schema)
|
||||
|
||||
# Finish writing the from_dict method.
|
||||
f.write("\n")
|
||||
f.write("\t\t" + camel_to_snake(name) + " = cls(\n")
|
||||
# Iternate over the properties.
|
||||
for property_name in schema['properties']:
|
||||
# Write the property.
|
||||
f.write("\t\t\t" + property_name + "= " + property_name + ",\n")
|
||||
|
||||
# Close the class.
|
||||
f.write("\t\t)\n")
|
||||
f.write("\n")
|
||||
f.write("\t\t" + camel_to_snake(name) + ".additional_properties = d\n")
|
||||
f.write("\t\treturn " + camel_to_snake(name) + "\n")
|
||||
|
||||
# write the rest of the class.
|
||||
f.write("\n")
|
||||
f.write("\t@property\n")
|
||||
f.write("\tdef additional_keys(self) -> List[str]:\n")
|
||||
f.write("\t\treturn list(self.additional_properties.keys())\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __getitem__(self, key: str) -> Any:\n")
|
||||
f.write("\t\treturn self.additional_properties[key]\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __setitem__(self, key: str, value: Any) -> None:\n")
|
||||
f.write("\t\tself.additional_properties[key] = value\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __delitem__(self, key: str) -> None:\n")
|
||||
f.write("\t\tdel self.additional_properties[key]\n")
|
||||
|
||||
f.write("\n")
|
||||
f.write("\tdef __contains__(self, key: str) -> bool:\n")
|
||||
f.write("\t\treturn key in self.additional_properties\n")
|
||||
|
||||
# Close the file.
|
||||
f.close()
|
||||
f.write(
|
||||
"\t\t" +
|
||||
property_name +
|
||||
" = d.pop(\"" +
|
||||
property_name +
|
||||
"\", UNSET)\n")
|
||||
|
||||
|
||||
def hasDateTime(schema: dict) -> bool:
|
||||
@ -1262,9 +1328,6 @@ def getRefs(schema: dict) -> [str]:
|
||||
if 'allOf' in schema:
|
||||
for sub_schema in schema['allOf']:
|
||||
refs.extend(getRefs(sub_schema))
|
||||
else:
|
||||
print(" unsupported type: ", schema)
|
||||
raise Exception(" unsupported type: ", schema)
|
||||
else:
|
||||
type_name = schema['type']
|
||||
if type_name == 'object':
|
||||
|
@ -5,6 +5,7 @@ import httpx
|
||||
from ...client import Client
|
||||
from ...models.file_conversion import FileConversion
|
||||
from ...models.file_mass import FileMass
|
||||
from ...models.file_density import FileDensity
|
||||
from ...models.file_volume import FileVolume
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
@ -27,7 +28,7 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
try:
|
||||
@ -44,6 +45,13 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
option = FileDensity.from_dict(data)
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
@ -60,7 +68,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -73,7 +81,7 @@ def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -91,7 +99,7 @@ def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
""" Get the status and output of an async operation.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
|
||||
If the user is not authenticated to view the specified async operation, then it is not returned.
|
||||
@ -107,7 +115,7 @@ async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -123,7 +131,7 @@ async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
""" Get the status and output of an async operation.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested async operation for the user.
|
||||
If the user is not authenticated to view the specified async operation, then it is not returned.
|
||||
|
140
kittycad/api/api-calls/list_async_operations.py
Normal file
140
kittycad/api/api-calls/list_async_operations.py
Normal file
@ -0,0 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.async_api_call_results_page import AsyncApiCallResultsPage
|
||||
from ...models.error import Error
|
||||
from ...models.created_at_sort_mode import CreatedAtSortMode
|
||||
from ...models.api_call_status import APICallStatus
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: APICallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/async/operations?limit={limit}&page_token={page_token}&sort_by={sort_by}&status={status}".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()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AsyncApiCallResultsPage.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, AsyncApiCallResultsPage, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: APICallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
status=status,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: APICallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
""" For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint.
|
||||
This endpoint requires authentication by a KittyCAD employee. """
|
||||
|
||||
return sync_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
status=status,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: APICallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
status=status,
|
||||
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(
|
||||
limit: int,
|
||||
page_token: str,
|
||||
sort_by: CreatedAtSortMode,
|
||||
status: APICallStatus,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, AsyncApiCallResultsPage, Error]]:
|
||||
""" For async file conversion operations, this endpoint does not return the contents of converted files (`output`). To get the contents use the `/async/operations/{id}` endpoint.
|
||||
This endpoint requires authentication by a KittyCAD employee. """
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
limit=limit,
|
||||
page_token=page_token,
|
||||
sort_by=sort_by,
|
||||
status=status,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -81,7 +81,7 @@ def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, Error]]:
|
||||
""" Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously.
|
||||
""" Convert a CAD file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
|
||||
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
@ -120,7 +120,7 @@ async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, Error]]:
|
||||
""" Convert a CAD file from one format to another. If the file being converted is larger than 30MB, it will be performed asynchronously.
|
||||
""" Convert a CAD file from one format to another. If the file being converted is larger than 25MB, it will be performed asynchronously.
|
||||
If the conversion is performed synchronously, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
|
131
kittycad/api/file/create_file_density.py
Normal file
131
kittycad/api/file/create_file_density.py
Normal file
@ -0,0 +1,131 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.file_density import FileDensity
|
||||
from ...models.error import Error
|
||||
from ...models.file_source_format import FileSourceFormat
|
||||
from ...types import Response
|
||||
|
||||
def _get_kwargs(
|
||||
material_mass: float,
|
||||
src_format: FileSourceFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/file/density?material_mass={material_mass}&src_format={src_format}".format(client.base_url, material_mass=material_mass, src_format=src_format)
|
||||
|
||||
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(),
|
||||
"content": body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileDensity, Error]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = FileDensity.from_dict(response.json())
|
||||
return response_201
|
||||
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, FileDensity, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
material_mass: float,
|
||||
src_format: FileSourceFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileDensity, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
material_mass=material_mass,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.post(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
material_mass: float,
|
||||
src_format: FileSourceFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileDensity, Error]]:
|
||||
""" Get the density of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return sync_detailed(
|
||||
material_mass=material_mass,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
material_mass: float,
|
||||
src_format: FileSourceFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileDensity, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
material_mass=material_mass,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.post(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
material_mass: float,
|
||||
src_format: FileSourceFormat,
|
||||
body: bytes,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileDensity, Error]]:
|
||||
""" Get the density of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
material_mass=material_mass,
|
||||
src_format=src_format,
|
||||
body=body,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -80,7 +80,7 @@ def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileMass, Error]]:
|
||||
""" Get the mass of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
|
||||
""" Get the mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return sync_detailed(
|
||||
@ -118,7 +118,7 @@ async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileMass, Error]]:
|
||||
""" Get the mass of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
|
||||
""" Get the mass of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return (
|
||||
|
@ -76,7 +76,7 @@ def sync(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileVolume, Error]]:
|
||||
""" Get the volume of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
|
||||
""" Get the volume of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return sync_detailed(
|
||||
@ -110,7 +110,7 @@ async def asyncio(
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileVolume, Error]]:
|
||||
""" Get the volume of an object in a CAD file. If the file is larger than 30MB, it will be performed asynchronously.
|
||||
""" Get the volume of an object in a CAD file. If the file is larger than 25MB, it will be performed asynchronously.
|
||||
If the operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint. """
|
||||
|
||||
return (
|
||||
|
@ -5,6 +5,7 @@ import httpx
|
||||
from ...client import Client
|
||||
from ...models.file_conversion import FileConversion
|
||||
from ...models.file_mass import FileMass
|
||||
from ...models.file_density import FileDensity
|
||||
from ...models.file_volume import FileVolume
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
@ -27,7 +28,7 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
try:
|
||||
@ -44,6 +45,13 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
option = FileDensity.from_dict(data)
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
@ -60,7 +68,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -73,7 +81,7 @@ def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -91,7 +99,7 @@ def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
""" Get the status and output of an async file conversion.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
|
||||
If the user is not authenticated to view the specified file conversion, then it is not returned.
|
||||
@ -107,7 +115,7 @@ async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -123,7 +131,7 @@ async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
""" Get the status and output of an async file conversion.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user.
|
||||
If the user is not authenticated to view the specified file conversion, then it is not returned.
|
||||
|
@ -5,6 +5,7 @@ import httpx
|
||||
from ...client import Client
|
||||
from ...models.file_conversion import FileConversion
|
||||
from ...models.file_mass import FileMass
|
||||
from ...models.file_density import FileDensity
|
||||
from ...models.file_volume import FileVolume
|
||||
from ...models.error import Error
|
||||
from ...types import Response
|
||||
@ -27,7 +28,7 @@ def _get_kwargs(
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
try:
|
||||
@ -44,6 +45,13 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
option = FileDensity.from_dict(data)
|
||||
return option
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
@ -60,7 +68,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, FileConv
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
@ -73,7 +81,7 @@ def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -91,7 +99,7 @@ def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
|
||||
|
||||
@ -105,7 +113,7 @@ async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Response[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
client=client,
|
||||
@ -121,7 +129,7 @@ async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileVolume, Error]]:
|
||||
) -> Optional[Union[Any, FileConversion, FileMass, FileDensity, FileVolume, Error]]:
|
||||
""" Get the status and output of an async file conversion. If completed, the contents of the converted file (`output`) will be returned as a base64 encoded string.
|
||||
This endpoint requires authentication by any KittyCAD user. It returns details of the requested file conversion for the user. """
|
||||
|
||||
|
@ -8,6 +8,9 @@ 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 .async_api_call_type import AsyncAPICallType
|
||||
from .async_api_call import AsyncApiCall
|
||||
from .async_api_call_results_page import AsyncApiCallResultsPage
|
||||
from .billing_info import BillingInfo
|
||||
from .cache_metadata import CacheMetadata
|
||||
from .card_details import CardDetails
|
||||
@ -25,6 +28,7 @@ from .error import Error
|
||||
from .extended_user import ExtendedUser
|
||||
from .extended_user_results_page import ExtendedUserResultsPage
|
||||
from .file_conversion import FileConversion
|
||||
from .file_density import FileDensity
|
||||
from .file_mass import FileMass
|
||||
from .file_output_format import FileOutputFormat
|
||||
from .file_source_format import FileSourceFormat
|
||||
@ -43,6 +47,7 @@ from .login_params import LoginParams
|
||||
from .meta_cluster_info import MetaClusterInfo
|
||||
from .metadata import Metadata
|
||||
from .method import Method
|
||||
from .output_file import OutputFile
|
||||
from .payment_intent import PaymentIntent
|
||||
from .payment_method import PaymentMethod
|
||||
from .payment_method_card_checks import PaymentMethodCardChecks
|
||||
|
@ -16,7 +16,7 @@ class Address:
|
||||
city: Union[Unset, str] = UNSET
|
||||
country: Union[Unset, str] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
id: Union[Unset, Uuid] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
state: Union[Unset, str] = UNSET
|
||||
street1: Union[Unset, str] = UNSET
|
||||
street2: Union[Unset, str] = UNSET
|
||||
@ -32,9 +32,7 @@ class Address:
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
id: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.id, Unset):
|
||||
id = self.id.value
|
||||
id = self.id
|
||||
state = self.state
|
||||
street1 = self.street1
|
||||
street2 = self.street2
|
||||
@ -84,12 +82,7 @@ class Address:
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = Uuid(_id)
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
state = d.pop("state", UNSET)
|
||||
|
||||
|
@ -20,7 +20,7 @@ class ApiCallWithPrice:
|
||||
duration: Union[Unset, int] = UNSET
|
||||
email: Union[Unset, str] = UNSET
|
||||
endpoint: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, Uuid] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
ip_address: Union[Unset, str] = UNSET
|
||||
method: Union[Unset, Method] = UNSET
|
||||
minutes: Union[Unset, int] = UNSET
|
||||
@ -32,7 +32,7 @@ class ApiCallWithPrice:
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status_code: Union[Unset, StatusCode] = UNSET
|
||||
stripe_invoice_item_id: Union[Unset, str] = UNSET
|
||||
token: Union[Unset, Uuid] = UNSET
|
||||
token: Union[Unset, str] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_agent: Union[Unset, str] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
@ -49,9 +49,7 @@ class ApiCallWithPrice:
|
||||
duration = self.duration
|
||||
email = self.email
|
||||
endpoint = self.endpoint
|
||||
id: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.id, Unset):
|
||||
id = self.id.value
|
||||
id = self.id
|
||||
ip_address = self.ip_address
|
||||
method: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.method, Unset):
|
||||
@ -69,9 +67,7 @@ class ApiCallWithPrice:
|
||||
if not isinstance(self.status_code, Unset):
|
||||
status_code = self.status_code.value
|
||||
stripe_invoice_item_id = self.stripe_invoice_item_id
|
||||
token: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.token, Unset):
|
||||
token = self.token.value
|
||||
token = self.token
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
@ -149,12 +145,7 @@ class ApiCallWithPrice:
|
||||
|
||||
endpoint = d.pop("endpoint", UNSET)
|
||||
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = Uuid(_id)
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
ip_address = d.pop("ip_address", UNSET)
|
||||
|
||||
@ -193,12 +184,7 @@ class ApiCallWithPrice:
|
||||
|
||||
stripe_invoice_item_id = d.pop("stripe_invoice_item_id", UNSET)
|
||||
|
||||
_token = d.pop("token", UNSET)
|
||||
token: Union[Unset, Uuid]
|
||||
if isinstance(_token, Unset):
|
||||
token = UNSET
|
||||
else:
|
||||
token = Uuid(_token)
|
||||
token = d.pop("token", UNSET)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
|
@ -16,7 +16,7 @@ class ApiToken:
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
is_valid: Union[Unset, bool] = False
|
||||
token: Union[Unset, Uuid] = UNSET
|
||||
token: Union[Unset, str] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
@ -28,9 +28,7 @@ class ApiToken:
|
||||
created_at = self.created_at.isoformat()
|
||||
id = self.id
|
||||
is_valid = self.is_valid
|
||||
token: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.token, Unset):
|
||||
token = self.token.value
|
||||
token = self.token
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
@ -68,12 +66,7 @@ class ApiToken:
|
||||
|
||||
is_valid = d.pop("is_valid", UNSET)
|
||||
|
||||
_token = d.pop("token", UNSET)
|
||||
token: Union[Unset, Uuid]
|
||||
if isinstance(_token, Unset):
|
||||
token = UNSET
|
||||
else:
|
||||
token = Uuid(_token)
|
||||
token = d.pop("token", UNSET)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
|
176
kittycad/models/async_api_call.py
Normal file
176
kittycad/models/async_api_call.py
Normal file
@ -0,0 +1,176 @@
|
||||
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 ..models.api_call_status import APICallStatus
|
||||
from ..models.async_api_call_type import AsyncAPICallType
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AsyncApiCall")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class AsyncApiCall:
|
||||
""" """
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
input: Union[Unset, Any] = UNSET
|
||||
output: Union[Unset, Any] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, APICallStatus] = UNSET
|
||||
type: Union[Unset, AsyncAPICallType] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
worker: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id = self.id
|
||||
input = self.input
|
||||
output = self.output
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
type: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type, Unset):
|
||||
type = self.type.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
|
||||
worker = self.worker
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if input is not UNSET:
|
||||
field_dict['input'] = input
|
||||
if output is not UNSET:
|
||||
field_dict['output'] = output
|
||||
if started_at is not UNSET:
|
||||
field_dict['started_at'] = started_at
|
||||
if status is not UNSET:
|
||||
field_dict['status'] = status
|
||||
if type is not UNSET:
|
||||
field_dict['type'] = type
|
||||
if updated_at is not UNSET:
|
||||
field_dict['updated_at'] = updated_at
|
||||
if user_id is not UNSET:
|
||||
field_dict['user_id'] = user_id
|
||||
if worker is not UNSET:
|
||||
field_dict['worker'] = worker
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_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)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
input = d.pop("input", UNSET)
|
||||
output = d.pop("output", UNSET)
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, APICallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = APICallStatus(_status)
|
||||
|
||||
_type = d.pop("type", UNSET)
|
||||
type: Union[Unset, AsyncAPICallType]
|
||||
if isinstance(_type, Unset):
|
||||
type = UNSET
|
||||
else:
|
||||
type = AsyncAPICallType(_type)
|
||||
|
||||
_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)
|
||||
|
||||
worker = d.pop("worker", UNSET)
|
||||
|
||||
async_api_call = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
id=id,
|
||||
input=input,
|
||||
output=output,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
type=type,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
worker=worker,
|
||||
)
|
||||
|
||||
async_api_call.additional_properties = d
|
||||
return async_api_call
|
||||
|
||||
@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
|
66
kittycad/models/async_api_call_results_page.py
Normal file
66
kittycad/models/async_api_call_results_page.py
Normal file
@ -0,0 +1,66 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AsyncApiCallResultsPage")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class AsyncApiCallResultsPage:
|
||||
""" """
|
||||
from ..models.async_api_call import AsyncApiCall
|
||||
items: Union[Unset, List[AsyncApiCall]] = UNSET
|
||||
next_page: Union[Unset, str] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
from ..models.async_api_call import AsyncApiCall
|
||||
items: Union[Unset, List[AsyncApiCall]] = UNSET
|
||||
if not isinstance(self.items, Unset):
|
||||
items = self.items
|
||||
next_page = self.next_page
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if items is not UNSET:
|
||||
field_dict['items'] = items
|
||||
if next_page is not UNSET:
|
||||
field_dict['next_page'] = next_page
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
from ..models.async_api_call import AsyncApiCall
|
||||
items = cast(List[AsyncApiCall], d.pop("items", UNSET))
|
||||
|
||||
next_page = d.pop("next_page", UNSET)
|
||||
|
||||
async_api_call_results_page = cls(
|
||||
items=items,
|
||||
next_page=next_page,
|
||||
)
|
||||
|
||||
async_api_call_results_page.additional_properties = d
|
||||
return async_api_call_results_page
|
||||
|
||||
@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
|
11
kittycad/models/async_api_call_type.py
Normal file
11
kittycad/models/async_api_call_type.py
Normal file
@ -0,0 +1,11 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class AsyncAPICallType(str, Enum):
|
||||
FILE_CONVERSION = 'FileConversion'
|
||||
FILE_VOLUME = 'FileVolume'
|
||||
FILE_MASS = 'FileMass'
|
||||
FILE_DENSITY = 'FileDensity'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
@ -11,6 +11,8 @@ T = TypeVar("T", bound="CodeOutput")
|
||||
class CodeOutput:
|
||||
""" """
|
||||
output: Union[Unset, str] = UNSET
|
||||
from ..models.output_file import OutputFile
|
||||
output_files: Union[Unset, List[OutputFile]] = UNSET
|
||||
stderr: Union[Unset, str] = UNSET
|
||||
stdout: Union[Unset, str] = UNSET
|
||||
|
||||
@ -18,6 +20,10 @@ class CodeOutput:
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
output = self.output
|
||||
from ..models.output_file import OutputFile
|
||||
output_files: Union[Unset, List[OutputFile]] = UNSET
|
||||
if not isinstance(self.output_files, Unset):
|
||||
output_files = self.output_files
|
||||
stderr = self.stderr
|
||||
stdout = self.stdout
|
||||
|
||||
@ -26,6 +32,8 @@ class CodeOutput:
|
||||
field_dict.update({})
|
||||
if output is not UNSET:
|
||||
field_dict['output'] = output
|
||||
if output_files is not UNSET:
|
||||
field_dict['output_files'] = output_files
|
||||
if stderr is not UNSET:
|
||||
field_dict['stderr'] = stderr
|
||||
if stdout is not UNSET:
|
||||
@ -38,12 +46,16 @@ class CodeOutput:
|
||||
d = src_dict.copy()
|
||||
output = d.pop("output", UNSET)
|
||||
|
||||
from ..models.output_file import OutputFile
|
||||
output_files = cast(List[OutputFile], d.pop("output_files", UNSET))
|
||||
|
||||
stderr = d.pop("stderr", UNSET)
|
||||
|
||||
stdout = d.pop("stdout", UNSET)
|
||||
|
||||
code_output = cls(
|
||||
output=output,
|
||||
output_files=output_files,
|
||||
stderr=stderr,
|
||||
stdout=stdout,
|
||||
)
|
||||
|
@ -31,3 +31,422 @@ class Connection:
|
||||
http_base_path: Union[Unset, str] = UNSET
|
||||
http_host: Union[Unset, str] = UNSET
|
||||
http_port: Union[Unset, int] = UNSET
|
||||
http_req_stats: Union[Unset, Any] = UNSET
|
||||
https_port: Union[Unset, int] = UNSET
|
||||
id: Union[Unset, int] = UNSET
|
||||
in_bytes: Union[Unset, int] = UNSET
|
||||
in_msgs: Union[Unset, int] = UNSET
|
||||
ip: Union[Unset, str] = UNSET
|
||||
jetstream: Union[Unset, Jetstream] = UNSET
|
||||
leaf: Union[Unset, LeafNode] = UNSET
|
||||
leafnodes: Union[Unset, int] = UNSET
|
||||
max_connections: Union[Unset, int] = UNSET
|
||||
max_control_line: Union[Unset, int] = UNSET
|
||||
max_payload: Union[Unset, int] = UNSET
|
||||
max_pending: Union[Unset, int] = UNSET
|
||||
mem: Union[Unset, int] = UNSET
|
||||
now: Union[Unset, datetime.datetime] = UNSET
|
||||
out_bytes: Union[Unset, int] = UNSET
|
||||
out_msgs: Union[Unset, int] = UNSET
|
||||
ping_interval: Union[Unset, int] = UNSET
|
||||
ping_max: Union[Unset, int] = UNSET
|
||||
port: Union[Unset, int] = UNSET
|
||||
proto: Union[Unset, int] = UNSET
|
||||
remotes: Union[Unset, int] = UNSET
|
||||
routes: Union[Unset, int] = UNSET
|
||||
rtt: Union[Unset, Duration] = UNSET
|
||||
server_id: Union[Unset, str] = UNSET
|
||||
server_name: Union[Unset, str] = UNSET
|
||||
slow_consumers: Union[Unset, int] = UNSET
|
||||
start: Union[Unset, datetime.datetime] = UNSET
|
||||
subscriptions: Union[Unset, int] = UNSET
|
||||
system_account: Union[Unset, str] = UNSET
|
||||
tls_timeout: Union[Unset, int] = UNSET
|
||||
total_connections: Union[Unset, int] = UNSET
|
||||
uptime: Union[Unset, str] = UNSET
|
||||
version: Union[Unset, str] = UNSET
|
||||
write_deadline: 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
|
||||
cluster: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.cluster, Unset):
|
||||
cluster = self.cluster.value
|
||||
config_load_time: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.config_load_time, Unset):
|
||||
config_load_time = self.config_load_time.isoformat()
|
||||
connections = self.connections
|
||||
cores = self.cores
|
||||
cpu = self.cpu
|
||||
gateway: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.gateway, Unset):
|
||||
gateway = self.gateway.value
|
||||
git_commit = self.git_commit
|
||||
go = self.go
|
||||
gomaxprocs = self.gomaxprocs
|
||||
host = self.host
|
||||
http_base_path = self.http_base_path
|
||||
http_host = self.http_host
|
||||
http_port = self.http_port
|
||||
http_req_stats = self.http_req_stats
|
||||
https_port = self.https_port
|
||||
id = self.id
|
||||
in_bytes = self.in_bytes
|
||||
in_msgs = self.in_msgs
|
||||
ip = self.ip
|
||||
jetstream: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.jetstream, Unset):
|
||||
jetstream = self.jetstream.value
|
||||
leaf: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.leaf, Unset):
|
||||
leaf = self.leaf.value
|
||||
leafnodes = self.leafnodes
|
||||
max_connections = self.max_connections
|
||||
max_control_line = self.max_control_line
|
||||
max_payload = self.max_payload
|
||||
max_pending = self.max_pending
|
||||
mem = self.mem
|
||||
now: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.now, Unset):
|
||||
now = self.now.isoformat()
|
||||
out_bytes = self.out_bytes
|
||||
out_msgs = self.out_msgs
|
||||
ping_interval = self.ping_interval
|
||||
ping_max = self.ping_max
|
||||
port = self.port
|
||||
proto = self.proto
|
||||
remotes = self.remotes
|
||||
routes = self.routes
|
||||
rtt: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.rtt, Unset):
|
||||
rtt = self.rtt.value
|
||||
server_id = self.server_id
|
||||
server_name = self.server_name
|
||||
slow_consumers = self.slow_consumers
|
||||
start: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.start, Unset):
|
||||
start = self.start.isoformat()
|
||||
subscriptions = self.subscriptions
|
||||
system_account = self.system_account
|
||||
tls_timeout = self.tls_timeout
|
||||
total_connections = self.total_connections
|
||||
uptime = self.uptime
|
||||
version = self.version
|
||||
write_deadline = self.write_deadline
|
||||
|
||||
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 cluster is not UNSET:
|
||||
field_dict['cluster'] = cluster
|
||||
if config_load_time is not UNSET:
|
||||
field_dict['config_load_time'] = config_load_time
|
||||
if connections is not UNSET:
|
||||
field_dict['connections'] = connections
|
||||
if cores is not UNSET:
|
||||
field_dict['cores'] = cores
|
||||
if cpu is not UNSET:
|
||||
field_dict['cpu'] = cpu
|
||||
if gateway is not UNSET:
|
||||
field_dict['gateway'] = gateway
|
||||
if git_commit is not UNSET:
|
||||
field_dict['git_commit'] = git_commit
|
||||
if go is not UNSET:
|
||||
field_dict['go'] = go
|
||||
if gomaxprocs is not UNSET:
|
||||
field_dict['gomaxprocs'] = gomaxprocs
|
||||
if host is not UNSET:
|
||||
field_dict['host'] = host
|
||||
if http_base_path is not UNSET:
|
||||
field_dict['http_base_path'] = http_base_path
|
||||
if http_host is not UNSET:
|
||||
field_dict['http_host'] = http_host
|
||||
if http_port is not UNSET:
|
||||
field_dict['http_port'] = http_port
|
||||
if http_req_stats is not UNSET:
|
||||
field_dict['http_req_stats'] = http_req_stats
|
||||
if https_port is not UNSET:
|
||||
field_dict['https_port'] = https_port
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if in_bytes is not UNSET:
|
||||
field_dict['in_bytes'] = in_bytes
|
||||
if in_msgs is not UNSET:
|
||||
field_dict['in_msgs'] = in_msgs
|
||||
if ip is not UNSET:
|
||||
field_dict['ip'] = ip
|
||||
if jetstream is not UNSET:
|
||||
field_dict['jetstream'] = jetstream
|
||||
if leaf is not UNSET:
|
||||
field_dict['leaf'] = leaf
|
||||
if leafnodes is not UNSET:
|
||||
field_dict['leafnodes'] = leafnodes
|
||||
if max_connections is not UNSET:
|
||||
field_dict['max_connections'] = max_connections
|
||||
if max_control_line is not UNSET:
|
||||
field_dict['max_control_line'] = max_control_line
|
||||
if max_payload is not UNSET:
|
||||
field_dict['max_payload'] = max_payload
|
||||
if max_pending is not UNSET:
|
||||
field_dict['max_pending'] = max_pending
|
||||
if mem is not UNSET:
|
||||
field_dict['mem'] = mem
|
||||
if now is not UNSET:
|
||||
field_dict['now'] = now
|
||||
if out_bytes is not UNSET:
|
||||
field_dict['out_bytes'] = out_bytes
|
||||
if out_msgs is not UNSET:
|
||||
field_dict['out_msgs'] = out_msgs
|
||||
if ping_interval is not UNSET:
|
||||
field_dict['ping_interval'] = ping_interval
|
||||
if ping_max is not UNSET:
|
||||
field_dict['ping_max'] = ping_max
|
||||
if port is not UNSET:
|
||||
field_dict['port'] = port
|
||||
if proto is not UNSET:
|
||||
field_dict['proto'] = proto
|
||||
if remotes is not UNSET:
|
||||
field_dict['remotes'] = remotes
|
||||
if routes is not UNSET:
|
||||
field_dict['routes'] = routes
|
||||
if rtt is not UNSET:
|
||||
field_dict['rtt'] = rtt
|
||||
if server_id is not UNSET:
|
||||
field_dict['server_id'] = server_id
|
||||
if server_name is not UNSET:
|
||||
field_dict['server_name'] = server_name
|
||||
if slow_consumers is not UNSET:
|
||||
field_dict['slow_consumers'] = slow_consumers
|
||||
if start is not UNSET:
|
||||
field_dict['start'] = start
|
||||
if subscriptions is not UNSET:
|
||||
field_dict['subscriptions'] = subscriptions
|
||||
if system_account is not UNSET:
|
||||
field_dict['system_account'] = system_account
|
||||
if tls_timeout is not UNSET:
|
||||
field_dict['tls_timeout'] = tls_timeout
|
||||
if total_connections is not UNSET:
|
||||
field_dict['total_connections'] = total_connections
|
||||
if uptime is not UNSET:
|
||||
field_dict['uptime'] = uptime
|
||||
if version is not UNSET:
|
||||
field_dict['version'] = version
|
||||
if write_deadline is not UNSET:
|
||||
field_dict['write_deadline'] = write_deadline
|
||||
|
||||
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)
|
||||
|
||||
_cluster = d.pop("cluster", UNSET)
|
||||
cluster: Union[Unset, Cluster]
|
||||
if isinstance(_cluster, Unset):
|
||||
cluster = UNSET
|
||||
else:
|
||||
cluster = Cluster(_cluster)
|
||||
|
||||
_config_load_time = d.pop("config_load_time", UNSET)
|
||||
config_load_time: Union[Unset, datetime.datetime]
|
||||
if isinstance(_config_load_time, Unset):
|
||||
config_load_time = UNSET
|
||||
else:
|
||||
config_load_time = isoparse(_config_load_time)
|
||||
|
||||
connections = d.pop("connections", UNSET)
|
||||
|
||||
cores = d.pop("cores", UNSET)
|
||||
|
||||
cpu = d.pop("cpu", UNSET)
|
||||
|
||||
_gateway = d.pop("gateway", UNSET)
|
||||
gateway: Union[Unset, Gateway]
|
||||
if isinstance(_gateway, Unset):
|
||||
gateway = UNSET
|
||||
else:
|
||||
gateway = Gateway(_gateway)
|
||||
|
||||
git_commit = d.pop("git_commit", UNSET)
|
||||
|
||||
go = d.pop("go", UNSET)
|
||||
|
||||
gomaxprocs = d.pop("gomaxprocs", UNSET)
|
||||
|
||||
host = d.pop("host", UNSET)
|
||||
|
||||
http_base_path = d.pop("http_base_path", UNSET)
|
||||
|
||||
http_host = d.pop("http_host", UNSET)
|
||||
|
||||
http_port = d.pop("http_port", UNSET)
|
||||
|
||||
http_req_stats = d.pop("http_req_stats", UNSET)
|
||||
https_port = d.pop("https_port", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
in_bytes = d.pop("in_bytes", UNSET)
|
||||
|
||||
in_msgs = d.pop("in_msgs", UNSET)
|
||||
|
||||
ip = d.pop("ip", UNSET)
|
||||
|
||||
_jetstream = d.pop("jetstream", UNSET)
|
||||
jetstream: Union[Unset, Jetstream]
|
||||
if isinstance(_jetstream, Unset):
|
||||
jetstream = UNSET
|
||||
else:
|
||||
jetstream = Jetstream(_jetstream)
|
||||
|
||||
_leaf = d.pop("leaf", UNSET)
|
||||
leaf: Union[Unset, LeafNode]
|
||||
if isinstance(_leaf, Unset):
|
||||
leaf = UNSET
|
||||
else:
|
||||
leaf = LeafNode(_leaf)
|
||||
|
||||
leafnodes = d.pop("leafnodes", UNSET)
|
||||
|
||||
max_connections = d.pop("max_connections", UNSET)
|
||||
|
||||
max_control_line = d.pop("max_control_line", UNSET)
|
||||
|
||||
max_payload = d.pop("max_payload", UNSET)
|
||||
|
||||
max_pending = d.pop("max_pending", UNSET)
|
||||
|
||||
mem = d.pop("mem", UNSET)
|
||||
|
||||
_now = d.pop("now", UNSET)
|
||||
now: Union[Unset, datetime.datetime]
|
||||
if isinstance(_now, Unset):
|
||||
now = UNSET
|
||||
else:
|
||||
now = isoparse(_now)
|
||||
|
||||
out_bytes = d.pop("out_bytes", UNSET)
|
||||
|
||||
out_msgs = d.pop("out_msgs", UNSET)
|
||||
|
||||
ping_interval = d.pop("ping_interval", UNSET)
|
||||
|
||||
ping_max = d.pop("ping_max", UNSET)
|
||||
|
||||
port = d.pop("port", UNSET)
|
||||
|
||||
proto = d.pop("proto", UNSET)
|
||||
|
||||
remotes = d.pop("remotes", UNSET)
|
||||
|
||||
routes = d.pop("routes", UNSET)
|
||||
|
||||
_rtt = d.pop("rtt", UNSET)
|
||||
rtt: Union[Unset, Duration]
|
||||
if isinstance(_rtt, Unset):
|
||||
rtt = UNSET
|
||||
else:
|
||||
rtt = Duration(_rtt)
|
||||
|
||||
server_id = d.pop("server_id", UNSET)
|
||||
|
||||
server_name = d.pop("server_name", UNSET)
|
||||
|
||||
slow_consumers = d.pop("slow_consumers", UNSET)
|
||||
|
||||
_start = d.pop("start", UNSET)
|
||||
start: Union[Unset, datetime.datetime]
|
||||
if isinstance(_start, Unset):
|
||||
start = UNSET
|
||||
else:
|
||||
start = isoparse(_start)
|
||||
|
||||
subscriptions = d.pop("subscriptions", UNSET)
|
||||
|
||||
system_account = d.pop("system_account", UNSET)
|
||||
|
||||
tls_timeout = d.pop("tls_timeout", UNSET)
|
||||
|
||||
total_connections = d.pop("total_connections", UNSET)
|
||||
|
||||
uptime = d.pop("uptime", UNSET)
|
||||
|
||||
version = d.pop("version", UNSET)
|
||||
|
||||
write_deadline = d.pop("write_deadline", UNSET)
|
||||
|
||||
connection = cls(
|
||||
auth_timeout=auth_timeout,
|
||||
cluster=cluster,
|
||||
config_load_time=config_load_time,
|
||||
connections=connections,
|
||||
cores=cores,
|
||||
cpu=cpu,
|
||||
gateway=gateway,
|
||||
git_commit=git_commit,
|
||||
go=go,
|
||||
gomaxprocs=gomaxprocs,
|
||||
host=host,
|
||||
http_base_path=http_base_path,
|
||||
http_host=http_host,
|
||||
http_port=http_port,
|
||||
http_req_stats=http_req_stats,
|
||||
https_port=https_port,
|
||||
id=id,
|
||||
in_bytes=in_bytes,
|
||||
in_msgs=in_msgs,
|
||||
ip=ip,
|
||||
jetstream=jetstream,
|
||||
leaf=leaf,
|
||||
leafnodes=leafnodes,
|
||||
max_connections=max_connections,
|
||||
max_control_line=max_control_line,
|
||||
max_payload=max_payload,
|
||||
max_pending=max_pending,
|
||||
mem=mem,
|
||||
now=now,
|
||||
out_bytes=out_bytes,
|
||||
out_msgs=out_msgs,
|
||||
ping_interval=ping_interval,
|
||||
ping_max=ping_max,
|
||||
port=port,
|
||||
proto=proto,
|
||||
remotes=remotes,
|
||||
routes=routes,
|
||||
rtt=rtt,
|
||||
server_id=server_id,
|
||||
server_name=server_name,
|
||||
slow_consumers=slow_consumers,
|
||||
start=start,
|
||||
subscriptions=subscriptions,
|
||||
system_account=system_account,
|
||||
tls_timeout=tls_timeout,
|
||||
total_connections=total_connections,
|
||||
uptime=uptime,
|
||||
version=version,
|
||||
write_deadline=write_deadline,
|
||||
)
|
||||
|
||||
connection.additional_properties = d
|
||||
return connection
|
||||
|
||||
@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
|
||||
|
@ -22,3 +22,128 @@ class Customer:
|
||||
delinquent: Union[Unset, bool] = False
|
||||
email: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
metadata: Union[Unset, Any] = UNSET
|
||||
name: Union[Unset, str] = UNSET
|
||||
phone: Union[Unset, PhoneNumber] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
address: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.address, Unset):
|
||||
address = self.address.value
|
||||
balance = self.balance
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
currency: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.currency, Unset):
|
||||
currency = self.currency.value
|
||||
delinquent = self.delinquent
|
||||
email = self.email
|
||||
id = self.id
|
||||
metadata = self.metadata
|
||||
name = self.name
|
||||
phone: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.phone, Unset):
|
||||
phone = self.phone.value
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if address is not UNSET:
|
||||
field_dict['address'] = address
|
||||
if balance is not UNSET:
|
||||
field_dict['balance'] = balance
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if currency is not UNSET:
|
||||
field_dict['currency'] = currency
|
||||
if delinquent is not UNSET:
|
||||
field_dict['delinquent'] = delinquent
|
||||
if email is not UNSET:
|
||||
field_dict['email'] = email
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if metadata is not UNSET:
|
||||
field_dict['metadata'] = metadata
|
||||
if name is not UNSET:
|
||||
field_dict['name'] = name
|
||||
if phone is not UNSET:
|
||||
field_dict['phone'] = phone
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
_address = d.pop("address", UNSET)
|
||||
address: Union[Unset, Address]
|
||||
if isinstance(_address, Unset):
|
||||
address = UNSET
|
||||
else:
|
||||
address = Address(_address)
|
||||
|
||||
balance = d.pop("balance", UNSET)
|
||||
|
||||
_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)
|
||||
|
||||
_currency = d.pop("currency", UNSET)
|
||||
currency: Union[Unset, Currency]
|
||||
if isinstance(_currency, Unset):
|
||||
currency = UNSET
|
||||
else:
|
||||
currency = Currency(_currency)
|
||||
|
||||
delinquent = d.pop("delinquent", UNSET)
|
||||
|
||||
email = d.pop("email", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
metadata = d.pop("metadata", UNSET)
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
_phone = d.pop("phone", UNSET)
|
||||
phone: Union[Unset, PhoneNumber]
|
||||
if isinstance(_phone, Unset):
|
||||
phone = UNSET
|
||||
else:
|
||||
phone = PhoneNumber(_phone)
|
||||
|
||||
customer = cls(
|
||||
address=address,
|
||||
balance=balance,
|
||||
created_at=created_at,
|
||||
currency=currency,
|
||||
delinquent=delinquent,
|
||||
email=email,
|
||||
id=id,
|
||||
metadata=metadata,
|
||||
name=name,
|
||||
phone=phone,
|
||||
)
|
||||
|
||||
customer.additional_properties = d
|
||||
return customer
|
||||
|
||||
@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
|
||||
|
@ -2,6 +2,8 @@ from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..models.cache_metadata import CacheMetadata
|
||||
from ..models.environment import Environment
|
||||
from ..models.file_system_metadata import FileSystemMetadata
|
||||
from ..models.connection import Connection
|
||||
from ..types import UNSET, Unset
|
||||
@ -13,6 +15,8 @@ T = TypeVar("T", bound="EngineMetadata")
|
||||
class EngineMetadata:
|
||||
""" """
|
||||
async_jobs_running: Union[Unset, bool] = False
|
||||
cache: Union[Unset, CacheMetadata] = UNSET
|
||||
environment: Union[Unset, Environment] = UNSET
|
||||
fs: Union[Unset, FileSystemMetadata] = UNSET
|
||||
git_hash: Union[Unset, str] = UNSET
|
||||
pubsub: Union[Unset, Connection] = UNSET
|
||||
@ -21,6 +25,12 @@ class EngineMetadata:
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
async_jobs_running = self.async_jobs_running
|
||||
cache: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.cache, Unset):
|
||||
cache = self.cache.value
|
||||
environment: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment.value
|
||||
fs: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.fs, Unset):
|
||||
fs = self.fs.value
|
||||
@ -34,6 +44,10 @@ class EngineMetadata:
|
||||
field_dict.update({})
|
||||
if async_jobs_running is not UNSET:
|
||||
field_dict['async_jobs_running'] = async_jobs_running
|
||||
if cache is not UNSET:
|
||||
field_dict['cache'] = cache
|
||||
if environment is not UNSET:
|
||||
field_dict['environment'] = environment
|
||||
if fs is not UNSET:
|
||||
field_dict['fs'] = fs
|
||||
if git_hash is not UNSET:
|
||||
@ -48,6 +62,20 @@ class EngineMetadata:
|
||||
d = src_dict.copy()
|
||||
async_jobs_running = d.pop("async_jobs_running", UNSET)
|
||||
|
||||
_cache = d.pop("cache", UNSET)
|
||||
cache: Union[Unset, CacheMetadata]
|
||||
if isinstance(_cache, Unset):
|
||||
cache = UNSET
|
||||
else:
|
||||
cache = CacheMetadata(_cache)
|
||||
|
||||
_environment = d.pop("environment", UNSET)
|
||||
environment: Union[Unset, Environment]
|
||||
if isinstance(_environment, Unset):
|
||||
environment = UNSET
|
||||
else:
|
||||
environment = Environment(_environment)
|
||||
|
||||
_fs = d.pop("fs", UNSET)
|
||||
fs: Union[Unset, FileSystemMetadata]
|
||||
if isinstance(_fs, Unset):
|
||||
@ -66,6 +94,8 @@ class EngineMetadata:
|
||||
|
||||
engine_metadata = cls(
|
||||
async_jobs_running=async_jobs_running,
|
||||
cache=cache,
|
||||
environment=environment,
|
||||
fs=fs,
|
||||
git_hash=git_hash,
|
||||
pubsub=pubsub,
|
||||
|
@ -18,7 +18,8 @@ class FileConversion:
|
||||
""" """
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
id: Union[Unset, Uuid] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
output: Union[Unset, str] = UNSET
|
||||
output_format: Union[Unset, FileOutputFormat] = UNSET
|
||||
src_format: Union[Unset, FileSourceFormat] = UNSET
|
||||
@ -36,9 +37,8 @@ class FileConversion:
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
id: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.id, Unset):
|
||||
id = self.id.value
|
||||
error = self.error
|
||||
id = self.id
|
||||
output = self.output
|
||||
output_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
@ -64,6 +64,8 @@ class FileConversion:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if output is not UNSET:
|
||||
@ -100,12 +102,9 @@ class FileConversion:
|
||||
else:
|
||||
created_at = isoparse(_created_at)
|
||||
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = Uuid(_id)
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
output = d.pop("output", UNSET)
|
||||
|
||||
@ -149,6 +148,7 @@ class FileConversion:
|
||||
file_conversion = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
error=error,
|
||||
id=id,
|
||||
output=output,
|
||||
output_format=output_format,
|
||||
|
171
kittycad/models/file_density.py
Normal file
171
kittycad/models/file_density.py
Normal file
@ -0,0 +1,171 @@
|
||||
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 ..models.file_source_format import FileSourceFormat
|
||||
from ..models.api_call_status import APICallStatus
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="FileDensity")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class FileDensity:
|
||||
""" """
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
density: Union[Unset, float] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
material_mass: Union[Unset, float] = UNSET
|
||||
src_format: Union[Unset, FileSourceFormat] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, APICallStatus] = 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]:
|
||||
completed_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.completed_at, Unset):
|
||||
completed_at = self.completed_at.isoformat()
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
density = self.density
|
||||
error = self.error
|
||||
id = self.id
|
||||
material_mass = self.material_mass
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format.value
|
||||
started_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.started_at, Unset):
|
||||
started_at = self.started_at.isoformat()
|
||||
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] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if completed_at is not UNSET:
|
||||
field_dict['completed_at'] = completed_at
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if density is not UNSET:
|
||||
field_dict['density'] = density
|
||||
if error is not UNSET:
|
||||
field_dict['error'] = error
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if material_mass is not UNSET:
|
||||
field_dict['material_mass'] = material_mass
|
||||
if src_format is not UNSET:
|
||||
field_dict['src_format'] = src_format
|
||||
if started_at is not UNSET:
|
||||
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
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
_completed_at = d.pop("completed_at", UNSET)
|
||||
completed_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_completed_at, Unset):
|
||||
completed_at = UNSET
|
||||
else:
|
||||
completed_at = isoparse(_completed_at)
|
||||
|
||||
_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)
|
||||
|
||||
density = d.pop("density", UNSET)
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
material_mass = d.pop("material_mass", UNSET)
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileSourceFormat]
|
||||
if isinstance(_src_format, Unset):
|
||||
src_format = UNSET
|
||||
else:
|
||||
src_format = FileSourceFormat(_src_format)
|
||||
|
||||
_started_at = d.pop("started_at", UNSET)
|
||||
started_at: Union[Unset, datetime.datetime]
|
||||
if isinstance(_started_at, Unset):
|
||||
started_at = UNSET
|
||||
else:
|
||||
started_at = isoparse(_started_at)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, APICallStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = APICallStatus(_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_density = cls(
|
||||
completed_at=completed_at,
|
||||
created_at=created_at,
|
||||
density=density,
|
||||
error=error,
|
||||
id=id,
|
||||
material_mass=material_mass,
|
||||
src_format=src_format,
|
||||
started_at=started_at,
|
||||
status=status,
|
||||
updated_at=updated_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
file_density.additional_properties = d
|
||||
return file_density
|
||||
|
||||
@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
|
@ -18,7 +18,7 @@ class FileMass:
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, Uuid] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
mass: Union[Unset, float] = UNSET
|
||||
material_density: Union[Unset, float] = UNSET
|
||||
src_format: Union[Unset, FileSourceFormat] = UNSET
|
||||
@ -37,9 +37,7 @@ class FileMass:
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.id, Unset):
|
||||
id = self.id.value
|
||||
id = self.id
|
||||
mass = self.mass
|
||||
material_density = self.material_density
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
@ -103,12 +101,7 @@ class FileMass:
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = Uuid(_id)
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
mass = d.pop("mass", UNSET)
|
||||
|
||||
|
@ -18,7 +18,7 @@ class FileVolume:
|
||||
completed_at: Union[Unset, datetime.datetime] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
error: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, Uuid] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
src_format: Union[Unset, FileSourceFormat] = UNSET
|
||||
started_at: Union[Unset, datetime.datetime] = UNSET
|
||||
status: Union[Unset, APICallStatus] = UNSET
|
||||
@ -36,9 +36,7 @@ class FileVolume:
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
error = self.error
|
||||
id: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.id, Unset):
|
||||
id = self.id.value
|
||||
id = self.id
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
src_format = self.src_format.value
|
||||
@ -99,12 +97,7 @@ class FileVolume:
|
||||
|
||||
error = d.pop("error", UNSET)
|
||||
|
||||
_id = d.pop("id", UNSET)
|
||||
id: Union[Unset, Uuid]
|
||||
if isinstance(_id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = Uuid(_id)
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
_src_format = d.pop("src_format", UNSET)
|
||||
src_format: Union[Unset, FileSourceFormat]
|
||||
|
@ -27,3 +27,197 @@ class Invoice:
|
||||
invoice_url: Union[Unset, str] = UNSET
|
||||
from ..models.invoice_line_item import InvoiceLineItem
|
||||
lines: Union[Unset, List[InvoiceLineItem]] = UNSET
|
||||
metadata: Union[Unset, Any] = UNSET
|
||||
number: Union[Unset, str] = UNSET
|
||||
paid: Union[Unset, bool] = False
|
||||
receipt_number: Union[Unset, str] = UNSET
|
||||
statement_descriptor: Union[Unset, str] = UNSET
|
||||
status: Union[Unset, InvoiceStatus] = UNSET
|
||||
subtotal: Union[Unset, int] = UNSET
|
||||
tax: 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]:
|
||||
amount_due = self.amount_due
|
||||
amount_paid = self.amount_paid
|
||||
amount_remaining = self.amount_remaining
|
||||
attempt_count = self.attempt_count
|
||||
attempted = self.attempted
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
currency: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.currency, Unset):
|
||||
currency = self.currency.value
|
||||
description = self.description
|
||||
id = self.id
|
||||
invoice_pdf = self.invoice_pdf
|
||||
invoice_url = self.invoice_url
|
||||
from ..models.invoice_line_item import InvoiceLineItem
|
||||
lines: Union[Unset, List[InvoiceLineItem]] = UNSET
|
||||
if not isinstance(self.lines, Unset):
|
||||
lines = self.lines
|
||||
metadata = self.metadata
|
||||
number = self.number
|
||||
paid = self.paid
|
||||
receipt_number = self.receipt_number
|
||||
statement_descriptor = self.statement_descriptor
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
subtotal = self.subtotal
|
||||
tax = self.tax
|
||||
total = self.total
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if amount_due is not UNSET:
|
||||
field_dict['amount_due'] = amount_due
|
||||
if amount_paid is not UNSET:
|
||||
field_dict['amount_paid'] = amount_paid
|
||||
if amount_remaining is not UNSET:
|
||||
field_dict['amount_remaining'] = amount_remaining
|
||||
if attempt_count is not UNSET:
|
||||
field_dict['attempt_count'] = attempt_count
|
||||
if attempted is not UNSET:
|
||||
field_dict['attempted'] = attempted
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if currency is not UNSET:
|
||||
field_dict['currency'] = currency
|
||||
if description is not UNSET:
|
||||
field_dict['description'] = description
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if invoice_pdf is not UNSET:
|
||||
field_dict['invoice_pdf'] = invoice_pdf
|
||||
if invoice_url is not UNSET:
|
||||
field_dict['invoice_url'] = invoice_url
|
||||
if lines is not UNSET:
|
||||
field_dict['lines'] = lines
|
||||
if metadata is not UNSET:
|
||||
field_dict['metadata'] = metadata
|
||||
if number is not UNSET:
|
||||
field_dict['number'] = number
|
||||
if paid is not UNSET:
|
||||
field_dict['paid'] = paid
|
||||
if receipt_number is not UNSET:
|
||||
field_dict['receipt_number'] = receipt_number
|
||||
if statement_descriptor is not UNSET:
|
||||
field_dict['statement_descriptor'] = statement_descriptor
|
||||
if status is not UNSET:
|
||||
field_dict['status'] = status
|
||||
if subtotal is not UNSET:
|
||||
field_dict['subtotal'] = subtotal
|
||||
if tax is not UNSET:
|
||||
field_dict['tax'] = tax
|
||||
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()
|
||||
amount_due = d.pop("amount_due", UNSET)
|
||||
|
||||
amount_paid = d.pop("amount_paid", UNSET)
|
||||
|
||||
amount_remaining = d.pop("amount_remaining", UNSET)
|
||||
|
||||
attempt_count = d.pop("attempt_count", UNSET)
|
||||
|
||||
attempted = d.pop("attempted", UNSET)
|
||||
|
||||
_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)
|
||||
|
||||
_currency = d.pop("currency", UNSET)
|
||||
currency: Union[Unset, Currency]
|
||||
if isinstance(_currency, Unset):
|
||||
currency = UNSET
|
||||
else:
|
||||
currency = Currency(_currency)
|
||||
|
||||
description = d.pop("description", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
invoice_pdf = d.pop("invoice_pdf", UNSET)
|
||||
|
||||
invoice_url = d.pop("invoice_url", UNSET)
|
||||
|
||||
from ..models.invoice_line_item import InvoiceLineItem
|
||||
lines = cast(List[InvoiceLineItem], d.pop("lines", UNSET))
|
||||
|
||||
metadata = d.pop("metadata", UNSET)
|
||||
number = d.pop("number", UNSET)
|
||||
|
||||
paid = d.pop("paid", UNSET)
|
||||
|
||||
receipt_number = d.pop("receipt_number", UNSET)
|
||||
|
||||
statement_descriptor = d.pop("statement_descriptor", UNSET)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, InvoiceStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = InvoiceStatus(_status)
|
||||
|
||||
subtotal = d.pop("subtotal", UNSET)
|
||||
|
||||
tax = d.pop("tax", UNSET)
|
||||
|
||||
total = d.pop("total", UNSET)
|
||||
|
||||
invoice = cls(
|
||||
amount_due=amount_due,
|
||||
amount_paid=amount_paid,
|
||||
amount_remaining=amount_remaining,
|
||||
attempt_count=attempt_count,
|
||||
attempted=attempted,
|
||||
created_at=created_at,
|
||||
currency=currency,
|
||||
description=description,
|
||||
id=id,
|
||||
invoice_pdf=invoice_pdf,
|
||||
invoice_url=invoice_url,
|
||||
lines=lines,
|
||||
metadata=metadata,
|
||||
number=number,
|
||||
paid=paid,
|
||||
receipt_number=receipt_number,
|
||||
statement_descriptor=statement_descriptor,
|
||||
status=status,
|
||||
subtotal=subtotal,
|
||||
tax=tax,
|
||||
total=total,
|
||||
)
|
||||
|
||||
invoice.additional_properties = d
|
||||
return invoice
|
||||
|
||||
@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
|
||||
|
@ -16,3 +16,82 @@ class InvoiceLineItem:
|
||||
description: Union[Unset, str] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
invoice_item: Union[Unset, str] = UNSET
|
||||
metadata: Union[Unset, Any] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
amount = self.amount
|
||||
currency: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.currency, Unset):
|
||||
currency = self.currency.value
|
||||
description = self.description
|
||||
id = self.id
|
||||
invoice_item = self.invoice_item
|
||||
metadata = self.metadata
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if amount is not UNSET:
|
||||
field_dict['amount'] = amount
|
||||
if currency is not UNSET:
|
||||
field_dict['currency'] = currency
|
||||
if description is not UNSET:
|
||||
field_dict['description'] = description
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if invoice_item is not UNSET:
|
||||
field_dict['invoice_item'] = invoice_item
|
||||
if metadata is not UNSET:
|
||||
field_dict['metadata'] = metadata
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
amount = d.pop("amount", UNSET)
|
||||
|
||||
_currency = d.pop("currency", UNSET)
|
||||
currency: Union[Unset, Currency]
|
||||
if isinstance(_currency, Unset):
|
||||
currency = UNSET
|
||||
else:
|
||||
currency = Currency(_currency)
|
||||
|
||||
description = d.pop("description", UNSET)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
invoice_item = d.pop("invoice_item", UNSET)
|
||||
|
||||
metadata = d.pop("metadata", UNSET)
|
||||
|
||||
invoice_line_item = cls(
|
||||
amount=amount,
|
||||
currency=currency,
|
||||
description=description,
|
||||
id=id,
|
||||
invoice_item=invoice_item,
|
||||
metadata=metadata,
|
||||
)
|
||||
|
||||
invoice_line_item.additional_properties = d
|
||||
return invoice_line_item
|
||||
|
||||
@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
|
||||
|
61
kittycad/models/output_file.py
Normal file
61
kittycad/models/output_file.py
Normal file
@ -0,0 +1,61 @@
|
||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
import attr
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="OutputFile")
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class OutputFile:
|
||||
""" """
|
||||
contents: 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]:
|
||||
contents = self.contents
|
||||
name = self.name
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if contents is not UNSET:
|
||||
field_dict['contents'] = contents
|
||||
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()
|
||||
contents = d.pop("contents", UNSET)
|
||||
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
output_file = cls(
|
||||
contents=contents,
|
||||
name=name,
|
||||
)
|
||||
|
||||
output_file.additional_properties = d
|
||||
return output_file
|
||||
|
||||
@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
|
@ -19,3 +19,103 @@ class PaymentMethod:
|
||||
card: Union[Unset, CardDetails] = UNSET
|
||||
created_at: Union[Unset, datetime.datetime] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
metadata: Union[Unset, Any] = UNSET
|
||||
type: Union[Unset, PaymentMethodType] = UNSET
|
||||
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
billing_info: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.billing_info, Unset):
|
||||
billing_info = self.billing_info.value
|
||||
card: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.card, Unset):
|
||||
card = self.card.value
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
id = self.id
|
||||
metadata = self.metadata
|
||||
type: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type, Unset):
|
||||
type = self.type.value
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if billing_info is not UNSET:
|
||||
field_dict['billing_info'] = billing_info
|
||||
if card is not UNSET:
|
||||
field_dict['card'] = card
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if metadata is not UNSET:
|
||||
field_dict['metadata'] = metadata
|
||||
if type is not UNSET:
|
||||
field_dict['type'] = type
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
_billing_info = d.pop("billing_info", UNSET)
|
||||
billing_info: Union[Unset, BillingInfo]
|
||||
if isinstance(_billing_info, Unset):
|
||||
billing_info = UNSET
|
||||
else:
|
||||
billing_info = BillingInfo(_billing_info)
|
||||
|
||||
_card = d.pop("card", UNSET)
|
||||
card: Union[Unset, CardDetails]
|
||||
if isinstance(_card, Unset):
|
||||
card = UNSET
|
||||
else:
|
||||
card = CardDetails(_card)
|
||||
|
||||
_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)
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
metadata = d.pop("metadata", UNSET)
|
||||
_type = d.pop("type", UNSET)
|
||||
type: Union[Unset, PaymentMethodType]
|
||||
if isinstance(_type, Unset):
|
||||
type = UNSET
|
||||
else:
|
||||
type = PaymentMethodType(_type)
|
||||
|
||||
payment_method = cls(
|
||||
billing_info=billing_info,
|
||||
card=card,
|
||||
created_at=created_at,
|
||||
id=id,
|
||||
metadata=metadata,
|
||||
type=type,
|
||||
)
|
||||
|
||||
payment_method.additional_properties = d
|
||||
return payment_method
|
||||
|
||||
@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
|
||||
|
@ -16,7 +16,7 @@ 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
|
||||
session_token: Union[Unset, str] = UNSET
|
||||
updated_at: Union[Unset, datetime.datetime] = UNSET
|
||||
user_id: Union[Unset, str] = UNSET
|
||||
|
||||
@ -30,9 +30,7 @@ class Session:
|
||||
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
|
||||
session_token = self.session_token
|
||||
updated_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.updated_at, Unset):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
@ -75,12 +73,7 @@ class Session:
|
||||
|
||||
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)
|
||||
session_token = d.pop("session_token", UNSET)
|
||||
|
||||
_updated_at = d.pop("updated_at", UNSET)
|
||||
updated_at: Union[Unset, datetime.datetime]
|
||||
|
Reference in New Issue
Block a user