# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T00:34:07+00:00
from __future__ import annotations
from enum import Enum
from typing import Any, List, Optional
from pydantic import AnyUrl, BaseModel, Field, RootModel
class Code(RootModel[str]):
root: str = Field(
..., description='The standardized product code in UPC/EAN format.'
)
class Error(BaseModel):
code: Optional[str] = Field(
None, description='The provided code.', examples=['329576019311']
)
codeType: Optional[Any] = Field(
None, description='The type of code provided.', examples=[None]
)
error: str = Field(
...,
description='A human readable error message.',
examples=['The provided code is not in a recognized format.'],
)
class CodeType(Enum):
UPC = 'UPC'
EAN = 'EAN'
ISBN = 'ISBN'
class Product(BaseModel):
brand: Optional[str] = Field(
None,
description='The brand of the product (if available).',
examples=['Goodfellow and Co'],
)
category: Optional[str] = Field(
None,
description='The category of the product (if available).',
examples=['Hair Care'],
)
description: Optional[str] = Field(
None,
description='A description of the product (if available).',
examples=[
'Gives you an easy way to achieve the hairstyle you love. Made with jojoba esters, vegetable-derived lanolin, glycerin and carnauba wax.'
],
)
ean: Optional[int] = Field(
None, description='The EAN code of the product.', examples=[829576019311]
)
imageUrl: Optional[AnyUrl] = Field(
None,
description='The URL for the product image.',
examples=['http://go-upc.s3.amazonaws.com/images/54066938.jpeg'],
)
name: Optional[str] = Field(
None,
description='The name of the product.',
examples=['Blue Sage Tonka Texturizing Fiber'],
)
region: Optional[str] = Field(
None, description='The region of the product.', examples=['USA or Canada']
)
specs: Optional[List[List[str]]] = Field(
None,
description='A list of additional item specifications (if available).',
examples=[
[
['Item Form', 'Clay'],
['Liquid Volume', '4 Fluid Ounces'],
['Scent', 'Lime'],
]
],
)
upc: Optional[int] = Field(
None, description='The UPC code of the product.', examples=[829576019311]
)
class CodeCodeGetResponse(BaseModel):
barcodeUrl: Optional[AnyUrl] = Field(
None,
description='The URL to the scannable barcode image.',
examples=['https://go-upc.com/barcode/829576019311'],
)
codeType: Optional[CodeType] = Field(
None, description='The type of product code (UPC/EAN/ISBN).', examples=['UPC']
)
product: Optional[Product] = Field(
None, description='all matching product details.'
)