Updated API docs
This commit is contained in:
@@ -14,8 +14,8 @@ class Message(BaseModel):
|
||||
|
||||
class Vendor(BaseModel):
|
||||
id: int = Field(description="Unique internal ID of this vendor.")
|
||||
name: str = Field(max_length=64, description="Vendor name.")
|
||||
comment: Optional[str] = Field(max_length=1024, description="Free text comment about this vendor.")
|
||||
name: str = Field(max_length=64, description="Vendor name.", example="Polymaker")
|
||||
comment: Optional[str] = Field(max_length=1024, description="Free text comment about this vendor.", example="")
|
||||
|
||||
@staticmethod
|
||||
def from_db(item: models.Vendor) -> "Vendor":
|
||||
@@ -35,16 +35,37 @@ class Filament(BaseModel):
|
||||
"Filament name, to distinguish this filament type among others from the same vendor."
|
||||
"Should contain its color for example."
|
||||
),
|
||||
example="PolyTerra™ Charcoal Black",
|
||||
)
|
||||
vendor: Optional[Vendor] = Field(description="The vendor of this filament type.")
|
||||
material: Optional[str] = Field(max_length=64, description="The material of this filament, e.g. PLA.")
|
||||
price: Optional[float] = Field(ge=0, description="The price of this filament in the system configured currency.")
|
||||
density: float = Field(gt=0, description="The density of this filament in g/cm3.")
|
||||
diameter: float = Field(gt=0, description="The diameter of this filament in mm.")
|
||||
weight: Optional[float] = Field(gt=0, description="The weight of the filament in a full spool.")
|
||||
spool_weight: Optional[float] = Field(gt=0, description="The empty spool weight.")
|
||||
article_number: Optional[str] = Field(max_length=64, description="Vendor article number, e.g. EAN, QR code, etc.")
|
||||
comment: Optional[str] = Field(max_length=1024, description="Free text comment about this filament type.")
|
||||
material: Optional[str] = Field(
|
||||
max_length=64,
|
||||
description="The material of this filament, e.g. PLA.",
|
||||
example="PLA",
|
||||
)
|
||||
price: Optional[float] = Field(
|
||||
ge=0,
|
||||
description="The price of this filament in the system configured currency.",
|
||||
example=20.0,
|
||||
)
|
||||
density: float = Field(gt=0, description="The density of this filament in g/cm3.", example=1.24)
|
||||
diameter: float = Field(gt=0, description="The diameter of this filament in mm.", example=1.75)
|
||||
weight: Optional[float] = Field(
|
||||
gt=0,
|
||||
description="The weight of the filament in a full spool, in grams.",
|
||||
example=1000,
|
||||
)
|
||||
spool_weight: Optional[float] = Field(gt=0, description="The empty spool weight, in grams.", example=140)
|
||||
article_number: Optional[str] = Field(
|
||||
max_length=64,
|
||||
description="Vendor article number, e.g. EAN, QR code, etc.",
|
||||
example="PM70820",
|
||||
)
|
||||
comment: Optional[str] = Field(
|
||||
max_length=1024,
|
||||
description="Free text comment about this filament type.",
|
||||
example="",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def from_db(item: models.Filament) -> "Filament":
|
||||
@@ -70,10 +91,18 @@ class Spool(BaseModel):
|
||||
first_used: Optional[datetime] = Field(description="First logged occurence of spool usage.")
|
||||
last_used: Optional[datetime] = Field(description="Last logged occurence of spool usage.")
|
||||
filament: Filament = Field(description="The filament type of this spool.")
|
||||
weight: float = Field(ge=0, description="Remaining weight of filament on the spool.")
|
||||
location: Optional[str] = Field(max_length=64, description="Where this spool can be found.")
|
||||
lot_nr: Optional[str] = Field(max_length=64, description="Vendor manufacturing lot/batch number of the spool.")
|
||||
comment: Optional[str] = Field(max_length=1024, description="Free text comment about this specific spool.")
|
||||
weight: float = Field(ge=0, description="Remaining weight of filament on the spool.", example=500)
|
||||
location: Optional[str] = Field(max_length=64, description="Where this spool can be found.", example="Shelf A")
|
||||
lot_nr: Optional[str] = Field(
|
||||
max_length=64,
|
||||
description="Vendor manufacturing lot/batch number of the spool.",
|
||||
example="52342",
|
||||
)
|
||||
comment: Optional[str] = Field(
|
||||
max_length=1024,
|
||||
description="Free text comment about this specific spool.",
|
||||
example="",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def from_db(item: models.Spool) -> "Spool":
|
||||
|
||||
Reference in New Issue
Block a user