Merge pull request #42 from KittyCAD/update-spec

Update api spec
This commit is contained in:
Jess Frazelle
2022-07-28 08:41:22 -07:00
committed by GitHub
6 changed files with 51 additions and 114 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,6 @@
""" Contains all the data models used in inputs/outputs """
from .account_provider import AccountProvider
from .address import Address
from .api_call_query_group import ApiCallQueryGroup
from .api_call_query_group_by import ApiCallQueryGroupBy
from .api_call_status import ApiCallStatus
@ -56,6 +55,7 @@ from .leaf_node import LeafNode
from .meta_cluster_info import MetaClusterInfo
from .metadata import Metadata
from .method import Method
from .new_address import NewAddress
from .o_auth2_client_info import OAuth2ClientInfo
from .o_auth2_grant_type import OAuth2GrantType
from .output_file import OutputFile

View File

@ -2,7 +2,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.address import Address
from ..models.new_address import NewAddress
from ..types import UNSET, Unset
T = TypeVar("T", bound="BillingInfo")
@ -11,7 +11,7 @@ T = TypeVar("T", bound="BillingInfo")
@attr.s(auto_attribs=True)
class BillingInfo:
""" """
address: Union[Unset, Address] = UNSET
address: Union[Unset, NewAddress] = UNSET
name: Union[Unset, str] = UNSET
phone: Union[Unset, str] = UNSET
@ -40,11 +40,11 @@ class BillingInfo:
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]
address: Union[Unset, NewAddress]
if isinstance(_address, Unset):
address = UNSET
else:
address = Address(_address)
address = NewAddress(_address)
name = d.pop("name", UNSET)

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.address import Address
from ..models.new_address import NewAddress
from ..models.currency import Currency
from ..types import UNSET, Unset
@ -14,7 +14,7 @@ T = TypeVar("T", bound="Customer")
@attr.s(auto_attribs=True)
class Customer:
""" """
address: Union[Unset, Address] = UNSET
address: Union[Unset, NewAddress] = UNSET
balance: Union[Unset, float] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
currency: Union[Unset, Currency] = UNSET
@ -75,11 +75,11 @@ class Customer:
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]
address: Union[Unset, NewAddress]
if isinstance(_address, Unset):
address = UNSET
else:
address = Address(_address)
address = NewAddress(_address)
balance = d.pop("balance", UNSET)

View File

@ -1,26 +1,20 @@
import datetime
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from dateutil.parser import isoparse
from ..models.uuid import Uuid
from ..types import UNSET, Unset
T = TypeVar("T", bound="Address")
T = TypeVar("T", bound="NewAddress")
@attr.s(auto_attribs=True)
class Address:
class NewAddress:
""" """
city: Union[Unset, str] = UNSET
country: Union[Unset, str] = UNSET
created_at: Union[Unset, datetime.datetime] = UNSET
id: Union[Unset, str] = UNSET
state: Union[Unset, str] = UNSET
street1: Union[Unset, str] = UNSET
street2: Union[Unset, str] = UNSET
updated_at: Union[Unset, datetime.datetime] = UNSET
user_id: Union[Unset, str] = UNSET
zip: Union[Unset, str] = UNSET
@ -29,16 +23,9 @@ class Address:
def to_dict(self) -> Dict[str, Any]:
city = self.city
country = self.country
created_at: Union[Unset, str] = UNSET
if not isinstance(self.created_at, Unset):
created_at = self.created_at.isoformat()
id = self.id
state = self.state
street1 = self.street1
street2 = self.street2
updated_at: Union[Unset, str] = UNSET
if not isinstance(self.updated_at, Unset):
updated_at = self.updated_at.isoformat()
user_id = self.user_id
zip = self.zip
@ -49,18 +36,12 @@ class Address:
field_dict['city'] = city
if country is not UNSET:
field_dict['country'] = country
if created_at is not UNSET:
field_dict['created_at'] = created_at
if id is not UNSET:
field_dict['id'] = id
if state is not UNSET:
field_dict['state'] = state
if street1 is not UNSET:
field_dict['street1'] = street1
if street2 is not UNSET:
field_dict['street2'] = street2
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 zip is not UNSET:
@ -75,47 +56,28 @@ class Address:
country = d.pop("country", 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)
id = d.pop("id", UNSET)
state = d.pop("state", UNSET)
street1 = d.pop("street1", UNSET)
street2 = d.pop("street2", UNSET)
_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)
zip = d.pop("zip", UNSET)
address = cls(
new_address = cls(
city=city,
country=country,
created_at=created_at,
id=id,
state=state,
street1=street1,
street2=street2,
updated_at=updated_at,
user_id=user_id,
zip=zip,
)
address.additional_properties = d
return address
new_address.additional_properties = d
return new_address
@property
def additional_keys(self) -> List[str]:

View File

@ -21,65 +21,6 @@
],
"type": "string"
},
"Address": {
"description": "An address.",
"properties": {
"city": {
"description": "The city component.",
"type": "string"
},
"country": {
"description": "The country component.",
"type": "string"
},
"created_at": {
"description": "The time and date the address was created.",
"format": "date-time",
"title": "DateTime",
"type": "string"
},
"id": {
"allOf": [
{
"$ref": "#/components/schemas/Uuid"
}
],
"description": "The unique identifier of the address."
},
"state": {
"description": "The state component.",
"type": "string"
},
"street1": {
"description": "The first street component.",
"type": "string"
},
"street2": {
"description": "The second street component.",
"type": "string"
},
"updated_at": {
"description": "The time and date the address was last updated.",
"format": "date-time",
"title": "DateTime",
"type": "string"
},
"user_id": {
"description": "The user ID that this address belongs to.",
"type": "string"
},
"zip": {
"description": "The zip component.",
"type": "string"
}
},
"required": [
"created_at",
"id",
"updated_at"
],
"type": "object"
},
"ApiCallQueryGroup": {
"description": "A response for a query on the API call table that is grouped by something.",
"properties": {
@ -841,7 +782,7 @@
"address": {
"allOf": [
{
"$ref": "#/components/schemas/Address"
"$ref": "#/components/schemas/NewAddress"
}
],
"description": "The address of the customer.",
@ -1499,7 +1440,7 @@
"address": {
"allOf": [
{
"$ref": "#/components/schemas/Address"
"$ref": "#/components/schemas/NewAddress"
}
],
"description": "The customer's address.",
@ -3219,6 +3160,40 @@
],
"type": "string"
},
"NewAddress": {
"description": "The struct that is used to create a new record. This is automatically generated and has all the same fields as the main struct only it is missing the `id`.",
"properties": {
"city": {
"description": "The city component.",
"type": "string"
},
"country": {
"description": "The country component.",
"type": "string"
},
"state": {
"description": "The state component.",
"type": "string"
},
"street1": {
"description": "The first street component.",
"type": "string"
},
"street2": {
"description": "The second street component.",
"type": "string"
},
"user_id": {
"description": "The user ID that this address belongs to.",
"type": "string"
},
"zip": {
"description": "The zip component.",
"type": "string"
}
},
"type": "object"
},
"OAuth2ClientInfo": {
"description": "Information about an OAuth 2.0 client.",
"properties": {