Models API

The models module provides data models for the 1WorldSync API responses.

Product

class oneworldsync.models.Product(data)[source]

Bases: object

Model representing a product from the 1WorldSync API

__init__(data)[source]

Initialize a product from API data

Parameters:

data (dict) – Product data from the API

property item_id: str

Get the primary item ID

property gtin: str

Get the GTIN (Global Trade Item Number)

property brand_name: str

Get the brand name

property product_name: str

Get the product name

property description: str

Get the product description

property images: List[Dict[str, Any]]

Get product images

property primary_image_url: str

Get the primary image URL

property dimensions: Dict[str, Dict[str, str]]

Get product dimensions

property formatted_dimensions: str

Get formatted dimensions as a string

property gpc_code: str

Get the GPC (Global Product Classification) code

property category: str

Get the product category

property ingredients: str

Get the product ingredients

property country_of_origin: str

Get the country of origin

to_dict()[source]

Convert the product to a dictionary with all extracted data

Returns:

Dictionary representation of the product

Return type:

dict

__str__()[source]

String representation of the product

SearchResults

class oneworldsync.models.SearchResults(data)[source]

Bases: object

Model representing search results from the 1WorldSync API

__init__(data)[source]

Initialize search results from API data

Parameters:

data (dict) – Search results data from the API

__len__()[source]

Get the number of products in the results

__iter__()[source]

Iterate through products

__getitem__(index)[source]

Get a product by index

to_dict()[source]

Convert the search results to a dictionary

Returns:

Dictionary representation of the search results

Return type:

dict