diff --git a/.spec-sha256 b/.spec-sha256 index 903fef4..fa982ec 100644 --- a/.spec-sha256 +++ b/.spec-sha256 @@ -1 +1 @@ -8c6a3b8bfecad67daa21d1361057c24f2e063b17c13afdcc93e7f71806011003 +41311cb64247613fcc1634a63a1804e344c71873d665fc58af33e053a5f919f1 diff --git a/src/controlresell/generated/api/items/create_item.py b/src/controlresell/generated/api/items/create_item.py index d310e15..19486a2 100644 --- a/src/controlresell/generated/api/items/create_item.py +++ b/src/controlresell/generated/api/items/create_item.py @@ -117,8 +117,19 @@ def sync_detailed( publishing it: publish it with `POST /items/{id}/publish`. Only `name` is required. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the seller's library: another seller's, or - an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. Requires - `items:write` and an `Idempotency-Key`. + an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. The + fields a marketplace asks for are written with the item: `packageSizeId`, `materialIds`, + `measurementLength` and `measurementWidth` (centimeters), `enumValues` (the category's enumerated + fields, `{enumKey, enumValue}`, one entry per picked value), `attributes` (its free-text fields, + `{fieldKey, value}`, one per key) and `customFields` (the seller's own fields, `{fieldId, value}`); + each list replaces the item's whole list. A place (`purchasePlaceId`, `sellingPlaceId`) or a custom + field of another seller, or an unknown one, is `404 place_not_found` or `404 field_not_found`. + `categoryId`, `sizeId` and `state` are ids from 1 (`0` is a 400, `null` clears them). Keys and + enumerated values are trimmed and counted in characters (UTF-16 units), 1 to 100 for a key and 1 to + 255 for a value; two entries that differ only by case or accents (as the database compares them) are + a 400. At most 100 entries per list, and 65,535 bytes (UTF-8) per free-text value. Read back, + `enumValues`, `attributes` and `customFields` are sorted by key (then value, or field id), as plain + strings (upper case before lower case). Requires `items:write` and an `Idempotency-Key`. Args: idempotency_key (str): @@ -156,8 +167,19 @@ def sync( publishing it: publish it with `POST /items/{id}/publish`. Only `name` is required. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the seller's library: another seller's, or - an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. Requires - `items:write` and an `Idempotency-Key`. + an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. The + fields a marketplace asks for are written with the item: `packageSizeId`, `materialIds`, + `measurementLength` and `measurementWidth` (centimeters), `enumValues` (the category's enumerated + fields, `{enumKey, enumValue}`, one entry per picked value), `attributes` (its free-text fields, + `{fieldKey, value}`, one per key) and `customFields` (the seller's own fields, `{fieldId, value}`); + each list replaces the item's whole list. A place (`purchasePlaceId`, `sellingPlaceId`) or a custom + field of another seller, or an unknown one, is `404 place_not_found` or `404 field_not_found`. + `categoryId`, `sizeId` and `state` are ids from 1 (`0` is a 400, `null` clears them). Keys and + enumerated values are trimmed and counted in characters (UTF-16 units), 1 to 100 for a key and 1 to + 255 for a value; two entries that differ only by case or accents (as the database compares them) are + a 400. At most 100 entries per list, and 65,535 bytes (UTF-8) per free-text value. Read back, + `enumValues`, `attributes` and `customFields` are sorted by key (then value, or field id), as plain + strings (upper case before lower case). Requires `items:write` and an `Idempotency-Key`. Args: idempotency_key (str): @@ -190,8 +212,19 @@ async def asyncio_detailed( publishing it: publish it with `POST /items/{id}/publish`. Only `name` is required. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the seller's library: another seller's, or - an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. Requires - `items:write` and an `Idempotency-Key`. + an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. The + fields a marketplace asks for are written with the item: `packageSizeId`, `materialIds`, + `measurementLength` and `measurementWidth` (centimeters), `enumValues` (the category's enumerated + fields, `{enumKey, enumValue}`, one entry per picked value), `attributes` (its free-text fields, + `{fieldKey, value}`, one per key) and `customFields` (the seller's own fields, `{fieldId, value}`); + each list replaces the item's whole list. A place (`purchasePlaceId`, `sellingPlaceId`) or a custom + field of another seller, or an unknown one, is `404 place_not_found` or `404 field_not_found`. + `categoryId`, `sizeId` and `state` are ids from 1 (`0` is a 400, `null` clears them). Keys and + enumerated values are trimmed and counted in characters (UTF-16 units), 1 to 100 for a key and 1 to + 255 for a value; two entries that differ only by case or accents (as the database compares them) are + a 400. At most 100 entries per list, and 65,535 bytes (UTF-8) per free-text value. Read back, + `enumValues`, `attributes` and `customFields` are sorted by key (then value, or field id), as plain + strings (upper case before lower case). Requires `items:write` and an `Idempotency-Key`. Args: idempotency_key (str): @@ -227,8 +260,19 @@ async def asyncio( publishing it: publish it with `POST /items/{id}/publish`. Only `name` is required. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the seller's library: another seller's, or - an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. Requires - `items:write` and an `Idempotency-Key`. + an unknown one, is `404 photo_not_found`. A label the seller does not have yet is created. The + fields a marketplace asks for are written with the item: `packageSizeId`, `materialIds`, + `measurementLength` and `measurementWidth` (centimeters), `enumValues` (the category's enumerated + fields, `{enumKey, enumValue}`, one entry per picked value), `attributes` (its free-text fields, + `{fieldKey, value}`, one per key) and `customFields` (the seller's own fields, `{fieldId, value}`); + each list replaces the item's whole list. A place (`purchasePlaceId`, `sellingPlaceId`) or a custom + field of another seller, or an unknown one, is `404 place_not_found` or `404 field_not_found`. + `categoryId`, `sizeId` and `state` are ids from 1 (`0` is a 400, `null` clears them). Keys and + enumerated values are trimmed and counted in characters (UTF-16 units), 1 to 100 for a key and 1 to + 255 for a value; two entries that differ only by case or accents (as the database compares them) are + a 400. At most 100 entries per list, and 65,535 bytes (UTF-8) per free-text value. Read back, + `enumValues`, `attributes` and `customFields` are sorted by key (then value, or field id), as plain + strings (upper case before lower case). Requires `items:write` and an `Idempotency-Key`. Args: idempotency_key (str): diff --git a/src/controlresell/generated/api/items/update_item.py b/src/controlresell/generated/api/items/update_item.py index 363f6fe..7220845 100644 --- a/src/controlresell/generated/api/items/update_item.py +++ b/src/controlresell/generated/api/items/update_item.py @@ -106,12 +106,24 @@ def sync_detailed( """Change an item of the seller's stock Changes one item of the seller's stock with a JSON merge patch: a field left out keeps its value, a - field set to `null` is cleared (not `name`, `sold`, `photoIds`, `colorIds` nor `labels`: send `[]` - to empty a list), a list replaces the whole list. It changes the item in ControlResell only, not its - listings on the marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a - new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in - the seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the - seller does not have yet is created. Requires `items:write`. + field set to `null` is cleared (not `name`, `sold`, nor a list: send `[]` to empty a list), a list + replaces the whole list. It changes the item in ControlResell only, not its listings on the + marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; + another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the + seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the seller + does not have yet is created. The fields a marketplace asks for are written with the item: + `packageSizeId`, `materialIds`, `measurementLength` and `measurementWidth` (centimeters), + `enumValues` (the category's enumerated fields, `{enumKey, enumValue}`, one entry per picked value), + `attributes` (its free-text fields, `{fieldKey, value}`, one per key) and `customFields` (the + seller's own fields, `{fieldId, value}`); each list replaces the item's whole list. A place + (`purchasePlaceId`, `sellingPlaceId`) or a custom field of another seller, or an unknown one, is + `404 place_not_found` or `404 field_not_found`. `categoryId`, `sizeId` and `state` are ids from 1 + (`0` is a 400, `null` clears them). Keys and enumerated values are trimmed and counted in characters + (UTF-16 units), 1 to 100 for a key and 1 to 255 for a value; two entries that differ only by case or + accents (as the database compares them) are a 400. At most 100 entries per list, and 65,535 bytes + (UTF-8) per free-text value. Read back, `enumValues`, `attributes` and `customFields` are sorted by + key (then value, or field id), as plain strings (upper case before lower case). Requires + `items:write`. Args: id (int): @@ -146,12 +158,24 @@ def sync( """Change an item of the seller's stock Changes one item of the seller's stock with a JSON merge patch: a field left out keeps its value, a - field set to `null` is cleared (not `name`, `sold`, `photoIds`, `colorIds` nor `labels`: send `[]` - to empty a list), a list replaces the whole list. It changes the item in ControlResell only, not its - listings on the marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a - new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in - the seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the - seller does not have yet is created. Requires `items:write`. + field set to `null` is cleared (not `name`, `sold`, nor a list: send `[]` to empty a list), a list + replaces the whole list. It changes the item in ControlResell only, not its listings on the + marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; + another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the + seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the seller + does not have yet is created. The fields a marketplace asks for are written with the item: + `packageSizeId`, `materialIds`, `measurementLength` and `measurementWidth` (centimeters), + `enumValues` (the category's enumerated fields, `{enumKey, enumValue}`, one entry per picked value), + `attributes` (its free-text fields, `{fieldKey, value}`, one per key) and `customFields` (the + seller's own fields, `{fieldId, value}`); each list replaces the item's whole list. A place + (`purchasePlaceId`, `sellingPlaceId`) or a custom field of another seller, or an unknown one, is + `404 place_not_found` or `404 field_not_found`. `categoryId`, `sizeId` and `state` are ids from 1 + (`0` is a 400, `null` clears them). Keys and enumerated values are trimmed and counted in characters + (UTF-16 units), 1 to 100 for a key and 1 to 255 for a value; two entries that differ only by case or + accents (as the database compares them) are a 400. At most 100 entries per list, and 65,535 bytes + (UTF-8) per free-text value. Read back, `enumValues`, `attributes` and `customFields` are sorted by + key (then value, or field id), as plain strings (upper case before lower case). Requires + `items:write`. Args: id (int): @@ -181,12 +205,24 @@ async def asyncio_detailed( """Change an item of the seller's stock Changes one item of the seller's stock with a JSON merge patch: a field left out keeps its value, a - field set to `null` is cleared (not `name`, `sold`, `photoIds`, `colorIds` nor `labels`: send `[]` - to empty a list), a list replaces the whole list. It changes the item in ControlResell only, not its - listings on the marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a - new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in - the seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the - seller does not have yet is created. Requires `items:write`. + field set to `null` is cleared (not `name`, `sold`, nor a list: send `[]` to empty a list), a list + replaces the whole list. It changes the item in ControlResell only, not its listings on the + marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; + another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the + seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the seller + does not have yet is created. The fields a marketplace asks for are written with the item: + `packageSizeId`, `materialIds`, `measurementLength` and `measurementWidth` (centimeters), + `enumValues` (the category's enumerated fields, `{enumKey, enumValue}`, one entry per picked value), + `attributes` (its free-text fields, `{fieldKey, value}`, one per key) and `customFields` (the + seller's own fields, `{fieldId, value}`); each list replaces the item's whole list. A place + (`purchasePlaceId`, `sellingPlaceId`) or a custom field of another seller, or an unknown one, is + `404 place_not_found` or `404 field_not_found`. `categoryId`, `sizeId` and `state` are ids from 1 + (`0` is a 400, `null` clears them). Keys and enumerated values are trimmed and counted in characters + (UTF-16 units), 1 to 100 for a key and 1 to 255 for a value; two entries that differ only by case or + accents (as the database compares them) are a 400. At most 100 entries per list, and 65,535 bytes + (UTF-8) per free-text value. Read back, `enumValues`, `attributes` and `customFields` are sorted by + key (then value, or field id), as plain strings (upper case before lower case). Requires + `items:write`. Args: id (int): @@ -219,12 +255,24 @@ async def asyncio( """Change an item of the seller's stock Changes one item of the seller's stock with a JSON merge patch: a field left out keeps its value, a - field set to `null` is cleared (not `name`, `sold`, `photoIds`, `colorIds` nor `labels`: send `[]` - to empty a list), a list replaces the whole list. It changes the item in ControlResell only, not its - listings on the marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a - new item; another currency is refused with `422 currency_mismatch`). `photoIds` are files already in - the seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the - seller does not have yet is created. Requires `items:write`. + field set to `null` is cleared (not `name`, `sold`, nor a list: send `[]` to empty a list), a list + replaces the whole list. It changes the item in ControlResell only, not its listings on the + marketplaces. The amounts are `{amount, currency}` in the item's currency (EUR for a new item; + another currency is refused with `422 currency_mismatch`). `photoIds` are files already in the + seller's library: another seller's, or an unknown one, is `404 photo_not_found`. A label the seller + does not have yet is created. The fields a marketplace asks for are written with the item: + `packageSizeId`, `materialIds`, `measurementLength` and `measurementWidth` (centimeters), + `enumValues` (the category's enumerated fields, `{enumKey, enumValue}`, one entry per picked value), + `attributes` (its free-text fields, `{fieldKey, value}`, one per key) and `customFields` (the + seller's own fields, `{fieldId, value}`); each list replaces the item's whole list. A place + (`purchasePlaceId`, `sellingPlaceId`) or a custom field of another seller, or an unknown one, is + `404 place_not_found` or `404 field_not_found`. `categoryId`, `sizeId` and `state` are ids from 1 + (`0` is a 400, `null` clears them). Keys and enumerated values are trimmed and counted in characters + (UTF-16 units), 1 to 100 for a key and 1 to 255 for a value; two entries that differ only by case or + accents (as the database compares them) are a 400. At most 100 entries per list, and 65,535 bytes + (UTF-8) per free-text value. Read back, `enumValues`, `attributes` and `customFields` are sorted by + key (then value, or field id), as plain strings (upper case before lower case). Requires + `items:write`. Args: id (int): diff --git a/src/controlresell/generated/models/__init__.py b/src/controlresell/generated/models/__init__.py index f9e5dcb..065e166 100644 --- a/src/controlresell/generated/models/__init__.py +++ b/src/controlresell/generated/models/__init__.py @@ -11,7 +11,10 @@ from .customer_page import CustomerPage from .error_response import ErrorResponse from .item import Item +from .item_attribute import ItemAttribute from .item_create_request import ItemCreateRequest +from .item_custom_field import ItemCustomField +from .item_enum_value import ItemEnumValue from .item_page import ItemPage from .item_photo import ItemPhoto from .item_update_request import ItemUpdateRequest @@ -46,7 +49,10 @@ "CustomerPage", "ErrorResponse", "Item", + "ItemAttribute", "ItemCreateRequest", + "ItemCustomField", + "ItemEnumValue", "ItemPage", "ItemPhoto", "ItemUpdateRequest", diff --git a/src/controlresell/generated/models/item.py b/src/controlresell/generated/models/item.py index 487a942..af0503f 100644 --- a/src/controlresell/generated/models/item.py +++ b/src/controlresell/generated/models/item.py @@ -10,6 +10,9 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.item_attribute import ItemAttribute + from ..models.item_custom_field import ItemCustomField + from ..models.item_enum_value import ItemEnumValue from ..models.item_photo import ItemPhoto from ..models.money import Money @@ -27,6 +30,10 @@ class Item: color_ids (list[int]): labels (list[str]): sold (bool): + material_ids (list[int]): + enum_values (list[ItemEnumValue]): + attributes (list[ItemAttribute]): + custom_fields (list[ItemCustomField]): created_at (datetime.datetime): updated_at (datetime.datetime): sku (None | str | Unset): @@ -36,11 +43,16 @@ class Item: size_id (int | None | Unset): state (int | None | Unset): sex (None | str | Unset): + package_size_id (int | None | Unset): + measurement_length (float | None | Unset): + measurement_width (float | None | Unset): estimated_price (Money | None | Unset): purchase_price (Money | None | Unset): purchase_date (datetime.datetime | None | Unset): + purchase_place_id (int | None | Unset): selling_price (Money | None | Unset): selling_date (datetime.datetime | None | Unset): + selling_place_id (int | None | Unset): """ id: int @@ -49,6 +61,10 @@ class Item: color_ids: list[int] labels: list[str] sold: bool + material_ids: list[int] + enum_values: list[ItemEnumValue] + attributes: list[ItemAttribute] + custom_fields: list[ItemCustomField] created_at: datetime.datetime updated_at: datetime.datetime sku: None | str | Unset = UNSET @@ -58,11 +74,16 @@ class Item: size_id: int | None | Unset = UNSET state: int | None | Unset = UNSET sex: None | str | Unset = UNSET + package_size_id: int | None | Unset = UNSET + measurement_length: float | None | Unset = UNSET + measurement_width: float | None | Unset = UNSET estimated_price: Money | None | Unset = UNSET purchase_price: Money | None | Unset = UNSET purchase_date: datetime.datetime | None | Unset = UNSET + purchase_place_id: int | None | Unset = UNSET selling_price: Money | None | Unset = UNSET selling_date: datetime.datetime | None | Unset = UNSET + selling_place_id: int | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -83,6 +104,23 @@ def to_dict(self) -> dict[str, Any]: sold = self.sold + material_ids = self.material_ids + + enum_values = [] + for enum_values_item_data in self.enum_values: + enum_values_item = enum_values_item_data.to_dict() + enum_values.append(enum_values_item) + + attributes = [] + for attributes_item_data in self.attributes: + attributes_item = attributes_item_data.to_dict() + attributes.append(attributes_item) + + custom_fields = [] + for custom_fields_item_data in self.custom_fields: + custom_fields_item = custom_fields_item_data.to_dict() + custom_fields.append(custom_fields_item) + created_at = self.created_at.isoformat() updated_at = self.updated_at.isoformat() @@ -129,6 +167,24 @@ def to_dict(self) -> dict[str, Any]: else: sex = self.sex + package_size_id: int | None | Unset + if isinstance(self.package_size_id, Unset): + package_size_id = UNSET + else: + package_size_id = self.package_size_id + + measurement_length: float | None | Unset + if isinstance(self.measurement_length, Unset): + measurement_length = UNSET + else: + measurement_length = self.measurement_length + + measurement_width: float | None | Unset + if isinstance(self.measurement_width, Unset): + measurement_width = UNSET + else: + measurement_width = self.measurement_width + estimated_price: dict[str, Any] | None | Unset if isinstance(self.estimated_price, Unset): estimated_price = UNSET @@ -153,6 +209,12 @@ def to_dict(self) -> dict[str, Any]: else: purchase_date = self.purchase_date + purchase_place_id: int | None | Unset + if isinstance(self.purchase_place_id, Unset): + purchase_place_id = UNSET + else: + purchase_place_id = self.purchase_place_id + selling_price: dict[str, Any] | None | Unset if isinstance(self.selling_price, Unset): selling_price = UNSET @@ -169,6 +231,12 @@ def to_dict(self) -> dict[str, Any]: else: selling_date = self.selling_date + selling_place_id: int | None | Unset + if isinstance(self.selling_place_id, Unset): + selling_place_id = UNSET + else: + selling_place_id = self.selling_place_id + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -179,6 +247,10 @@ def to_dict(self) -> dict[str, Any]: "colorIds": color_ids, "labels": labels, "sold": sold, + "materialIds": material_ids, + "enumValues": enum_values, + "attributes": attributes, + "customFields": custom_fields, "createdAt": created_at, "updatedAt": updated_at, } @@ -197,21 +269,34 @@ def to_dict(self) -> dict[str, Any]: field_dict["state"] = state if sex is not UNSET: field_dict["sex"] = sex + if package_size_id is not UNSET: + field_dict["packageSizeId"] = package_size_id + if measurement_length is not UNSET: + field_dict["measurementLength"] = measurement_length + if measurement_width is not UNSET: + field_dict["measurementWidth"] = measurement_width if estimated_price is not UNSET: field_dict["estimatedPrice"] = estimated_price if purchase_price is not UNSET: field_dict["purchasePrice"] = purchase_price if purchase_date is not UNSET: field_dict["purchaseDate"] = purchase_date + if purchase_place_id is not UNSET: + field_dict["purchasePlaceId"] = purchase_place_id if selling_price is not UNSET: field_dict["sellingPrice"] = selling_price if selling_date is not UNSET: field_dict["sellingDate"] = selling_date + if selling_place_id is not UNSET: + field_dict["sellingPlaceId"] = selling_place_id return field_dict @classmethod def from_dict(cls, src_dict: Mapping[str, Any]) -> Self: + from ..models.item_attribute import ItemAttribute + from ..models.item_custom_field import ItemCustomField + from ..models.item_enum_value import ItemEnumValue from ..models.item_photo import ItemPhoto from ..models.money import Money @@ -233,6 +318,29 @@ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self: sold = d.pop("sold") + material_ids = cast(list[int], d.pop("materialIds")) + + enum_values = [] + _enum_values = d.pop("enumValues") + for enum_values_item_data in _enum_values: + enum_values_item = ItemEnumValue.from_dict(enum_values_item_data) + + enum_values.append(enum_values_item) + + attributes = [] + _attributes = d.pop("attributes") + for attributes_item_data in _attributes: + attributes_item = ItemAttribute.from_dict(attributes_item_data) + + attributes.append(attributes_item) + + custom_fields = [] + _custom_fields = d.pop("customFields") + for custom_fields_item_data in _custom_fields: + custom_fields_item = ItemCustomField.from_dict(custom_fields_item_data) + + custom_fields.append(custom_fields_item) + created_at = datetime.datetime.fromisoformat(d.pop("createdAt")) updated_at = datetime.datetime.fromisoformat(d.pop("updatedAt")) @@ -300,6 +408,35 @@ def _parse_sex(data: object) -> None | str | Unset: sex = _parse_sex(d.pop("sex", UNSET)) + def _parse_package_size_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + package_size_id = _parse_package_size_id(d.pop("packageSizeId", UNSET)) + + def _parse_measurement_length(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + measurement_length = _parse_measurement_length( + d.pop("measurementLength", UNSET) + ) + + def _parse_measurement_width(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + measurement_width = _parse_measurement_width(d.pop("measurementWidth", UNSET)) + def _parse_estimated_price(data: object) -> Money | None | Unset: if data is None: return data @@ -351,6 +488,15 @@ def _parse_purchase_date(data: object) -> datetime.datetime | None | Unset: purchase_date = _parse_purchase_date(d.pop("purchaseDate", UNSET)) + def _parse_purchase_place_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + purchase_place_id = _parse_purchase_place_id(d.pop("purchasePlaceId", UNSET)) + def _parse_selling_price(data: object) -> Money | None | Unset: if data is None: return data @@ -385,6 +531,15 @@ def _parse_selling_date(data: object) -> datetime.datetime | None | Unset: selling_date = _parse_selling_date(d.pop("sellingDate", UNSET)) + def _parse_selling_place_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + selling_place_id = _parse_selling_place_id(d.pop("sellingPlaceId", UNSET)) + item = cls( id=id, name=name, @@ -392,6 +547,10 @@ def _parse_selling_date(data: object) -> datetime.datetime | None | Unset: color_ids=color_ids, labels=labels, sold=sold, + material_ids=material_ids, + enum_values=enum_values, + attributes=attributes, + custom_fields=custom_fields, created_at=created_at, updated_at=updated_at, sku=sku, @@ -401,11 +560,16 @@ def _parse_selling_date(data: object) -> datetime.datetime | None | Unset: size_id=size_id, state=state, sex=sex, + package_size_id=package_size_id, + measurement_length=measurement_length, + measurement_width=measurement_width, estimated_price=estimated_price, purchase_price=purchase_price, purchase_date=purchase_date, + purchase_place_id=purchase_place_id, selling_price=selling_price, selling_date=selling_date, + selling_place_id=selling_place_id, ) item.additional_properties = d diff --git a/src/controlresell/generated/models/item_attribute.py b/src/controlresell/generated/models/item_attribute.py new file mode 100644 index 0000000..c29a7ce --- /dev/null +++ b/src/controlresell/generated/models/item_attribute.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Self, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ItemAttribute") + + +@_attrs_define +class ItemAttribute: + """ + Attributes: + field_key (str): + value (str): + """ + + field_key: str + value: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_key = self.field_key + + value = self.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "fieldKey": field_key, + "value": value, + } + ) + + return field_dict + + @classmethod + def from_dict(cls, src_dict: Mapping[str, Any]) -> Self: + d = dict(src_dict) + field_key = d.pop("fieldKey") + + value = d.pop("value") + + item_attribute = cls( + field_key=field_key, + value=value, + ) + + item_attribute.additional_properties = d + return item_attribute + + @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 diff --git a/src/controlresell/generated/models/item_create_request.py b/src/controlresell/generated/models/item_create_request.py index ae8c7fb..2155732 100644 --- a/src/controlresell/generated/models/item_create_request.py +++ b/src/controlresell/generated/models/item_create_request.py @@ -11,6 +11,9 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.item_attribute import ItemAttribute + from ..models.item_custom_field import ItemCustomField + from ..models.item_enum_value import ItemEnumValue from ..models.money import Money @@ -33,11 +36,20 @@ class ItemCreateRequest: sex (None | str | Unset): labels (list[str] | Unset): sold (bool | Unset): + package_size_id (int | None | Unset): + material_ids (list[int] | Unset): + measurement_length (float | None | Unset): + measurement_width (float | None | Unset): + enum_values (list[ItemEnumValue] | Unset): + attributes (list[ItemAttribute] | Unset): + custom_fields (list[ItemCustomField] | Unset): estimated_price (Money | None | Unset): purchase_price (Money | None | Unset): purchase_date (datetime.datetime | None | Unset): + purchase_place_id (int | None | Unset): selling_price (Money | None | Unset): selling_date (datetime.datetime | None | Unset): + selling_place_id (int | None | Unset): """ name: str @@ -52,11 +64,20 @@ class ItemCreateRequest: sex: None | str | Unset = UNSET labels: list[str] | Unset = UNSET sold: bool | Unset = UNSET + package_size_id: int | None | Unset = UNSET + material_ids: list[int] | Unset = UNSET + measurement_length: float | None | Unset = UNSET + measurement_width: float | None | Unset = UNSET + enum_values: list[ItemEnumValue] | Unset = UNSET + attributes: list[ItemAttribute] | Unset = UNSET + custom_fields: list[ItemCustomField] | Unset = UNSET estimated_price: Money | None | Unset = UNSET purchase_price: Money | None | Unset = UNSET purchase_date: datetime.datetime | None | Unset = UNSET + purchase_place_id: int | None | Unset = UNSET selling_price: Money | None | Unset = UNSET selling_date: datetime.datetime | None | Unset = UNSET + selling_place_id: int | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -123,6 +144,49 @@ def to_dict(self) -> dict[str, Any]: sold = self.sold + package_size_id: int | None | Unset + if isinstance(self.package_size_id, Unset): + package_size_id = UNSET + else: + package_size_id = self.package_size_id + + material_ids: list[int] | Unset = UNSET + if not isinstance(self.material_ids, Unset): + material_ids = self.material_ids + + measurement_length: float | None | Unset + if isinstance(self.measurement_length, Unset): + measurement_length = UNSET + else: + measurement_length = self.measurement_length + + measurement_width: float | None | Unset + if isinstance(self.measurement_width, Unset): + measurement_width = UNSET + else: + measurement_width = self.measurement_width + + enum_values: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.enum_values, Unset): + enum_values = [] + for enum_values_item_data in self.enum_values: + enum_values_item = enum_values_item_data.to_dict() + enum_values.append(enum_values_item) + + attributes: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.attributes, Unset): + attributes = [] + for attributes_item_data in self.attributes: + attributes_item = attributes_item_data.to_dict() + attributes.append(attributes_item) + + custom_fields: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.custom_fields, Unset): + custom_fields = [] + for custom_fields_item_data in self.custom_fields: + custom_fields_item = custom_fields_item_data.to_dict() + custom_fields.append(custom_fields_item) + estimated_price: dict[str, Any] | None | Unset if isinstance(self.estimated_price, Unset): estimated_price = UNSET @@ -147,6 +211,12 @@ def to_dict(self) -> dict[str, Any]: else: purchase_date = self.purchase_date + purchase_place_id: int | None | Unset + if isinstance(self.purchase_place_id, Unset): + purchase_place_id = UNSET + else: + purchase_place_id = self.purchase_place_id + selling_price: dict[str, Any] | None | Unset if isinstance(self.selling_price, Unset): selling_price = UNSET @@ -163,6 +233,12 @@ def to_dict(self) -> dict[str, Any]: else: selling_date = self.selling_date + selling_place_id: int | None | Unset + if isinstance(self.selling_place_id, Unset): + selling_place_id = UNSET + else: + selling_place_id = self.selling_place_id + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -192,21 +268,42 @@ def to_dict(self) -> dict[str, Any]: field_dict["labels"] = labels if sold is not UNSET: field_dict["sold"] = sold + if package_size_id is not UNSET: + field_dict["packageSizeId"] = package_size_id + if material_ids is not UNSET: + field_dict["materialIds"] = material_ids + if measurement_length is not UNSET: + field_dict["measurementLength"] = measurement_length + if measurement_width is not UNSET: + field_dict["measurementWidth"] = measurement_width + if enum_values is not UNSET: + field_dict["enumValues"] = enum_values + if attributes is not UNSET: + field_dict["attributes"] = attributes + if custom_fields is not UNSET: + field_dict["customFields"] = custom_fields if estimated_price is not UNSET: field_dict["estimatedPrice"] = estimated_price if purchase_price is not UNSET: field_dict["purchasePrice"] = purchase_price if purchase_date is not UNSET: field_dict["purchaseDate"] = purchase_date + if purchase_place_id is not UNSET: + field_dict["purchasePlaceId"] = purchase_place_id if selling_price is not UNSET: field_dict["sellingPrice"] = selling_price if selling_date is not UNSET: field_dict["sellingDate"] = selling_date + if selling_place_id is not UNSET: + field_dict["sellingPlaceId"] = selling_place_id return field_dict @classmethod def from_dict(cls, src_dict: Mapping[str, Any]) -> Self: + from ..models.item_attribute import ItemAttribute + from ..models.item_custom_field import ItemCustomField + from ..models.item_enum_value import ItemEnumValue from ..models.money import Money d = dict(src_dict) @@ -290,6 +387,64 @@ def _parse_sex(data: object) -> None | str | Unset: sold = d.pop("sold", UNSET) + def _parse_package_size_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + package_size_id = _parse_package_size_id(d.pop("packageSizeId", UNSET)) + + material_ids = cast(list[int], d.pop("materialIds", UNSET)) + + def _parse_measurement_length(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + measurement_length = _parse_measurement_length( + d.pop("measurementLength", UNSET) + ) + + def _parse_measurement_width(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + measurement_width = _parse_measurement_width(d.pop("measurementWidth", UNSET)) + + _enum_values = d.pop("enumValues", UNSET) + enum_values: list[ItemEnumValue] | Unset = UNSET + if _enum_values is not UNSET: + enum_values = [] + for enum_values_item_data in _enum_values: + enum_values_item = ItemEnumValue.from_dict(enum_values_item_data) + + enum_values.append(enum_values_item) + + _attributes = d.pop("attributes", UNSET) + attributes: list[ItemAttribute] | Unset = UNSET + if _attributes is not UNSET: + attributes = [] + for attributes_item_data in _attributes: + attributes_item = ItemAttribute.from_dict(attributes_item_data) + + attributes.append(attributes_item) + + _custom_fields = d.pop("customFields", UNSET) + custom_fields: list[ItemCustomField] | Unset = UNSET + if _custom_fields is not UNSET: + custom_fields = [] + for custom_fields_item_data in _custom_fields: + custom_fields_item = ItemCustomField.from_dict(custom_fields_item_data) + + custom_fields.append(custom_fields_item) + def _parse_estimated_price(data: object) -> Money | None | Unset: if data is None: return data @@ -341,6 +496,15 @@ def _parse_purchase_date(data: object) -> datetime.datetime | None | Unset: purchase_date = _parse_purchase_date(d.pop("purchaseDate", UNSET)) + def _parse_purchase_place_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + purchase_place_id = _parse_purchase_place_id(d.pop("purchasePlaceId", UNSET)) + def _parse_selling_price(data: object) -> Money | None | Unset: if data is None: return data @@ -375,6 +539,15 @@ def _parse_selling_date(data: object) -> datetime.datetime | None | Unset: selling_date = _parse_selling_date(d.pop("sellingDate", UNSET)) + def _parse_selling_place_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + selling_place_id = _parse_selling_place_id(d.pop("sellingPlaceId", UNSET)) + item_create_request = cls( name=name, sku=sku, @@ -388,11 +561,20 @@ def _parse_selling_date(data: object) -> datetime.datetime | None | Unset: sex=sex, labels=labels, sold=sold, + package_size_id=package_size_id, + material_ids=material_ids, + measurement_length=measurement_length, + measurement_width=measurement_width, + enum_values=enum_values, + attributes=attributes, + custom_fields=custom_fields, estimated_price=estimated_price, purchase_price=purchase_price, purchase_date=purchase_date, + purchase_place_id=purchase_place_id, selling_price=selling_price, selling_date=selling_date, + selling_place_id=selling_place_id, ) item_create_request.additional_properties = d diff --git a/src/controlresell/generated/models/item_custom_field.py b/src/controlresell/generated/models/item_custom_field.py new file mode 100644 index 0000000..89ed95b --- /dev/null +++ b/src/controlresell/generated/models/item_custom_field.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Self, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ItemCustomField") + + +@_attrs_define +class ItemCustomField: + """ + Attributes: + field_id (int): + value (str): + """ + + field_id: int + value: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_id = self.field_id + + value = self.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "fieldId": field_id, + "value": value, + } + ) + + return field_dict + + @classmethod + def from_dict(cls, src_dict: Mapping[str, Any]) -> Self: + d = dict(src_dict) + field_id = d.pop("fieldId") + + value = d.pop("value") + + item_custom_field = cls( + field_id=field_id, + value=value, + ) + + item_custom_field.additional_properties = d + return item_custom_field + + @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 diff --git a/src/controlresell/generated/models/item_enum_value.py b/src/controlresell/generated/models/item_enum_value.py new file mode 100644 index 0000000..465b682 --- /dev/null +++ b/src/controlresell/generated/models/item_enum_value.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, Self, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ItemEnumValue") + + +@_attrs_define +class ItemEnumValue: + """ + Attributes: + enum_key (str): + enum_value (str): + """ + + enum_key: str + enum_value: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + enum_key = self.enum_key + + enum_value = self.enum_value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "enumKey": enum_key, + "enumValue": enum_value, + } + ) + + return field_dict + + @classmethod + def from_dict(cls, src_dict: Mapping[str, Any]) -> Self: + d = dict(src_dict) + enum_key = d.pop("enumKey") + + enum_value = d.pop("enumValue") + + item_enum_value = cls( + enum_key=enum_key, + enum_value=enum_value, + ) + + item_enum_value.additional_properties = d + return item_enum_value + + @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 diff --git a/src/controlresell/generated/models/item_update_request.py b/src/controlresell/generated/models/item_update_request.py index 22a9ac2..54c2c17 100644 --- a/src/controlresell/generated/models/item_update_request.py +++ b/src/controlresell/generated/models/item_update_request.py @@ -11,6 +11,9 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.item_attribute import ItemAttribute + from ..models.item_custom_field import ItemCustomField + from ..models.item_enum_value import ItemEnumValue from ..models.money import Money @@ -33,11 +36,20 @@ class ItemUpdateRequest: sex (None | str | Unset): labels (list[str] | None | Unset): sold (bool | None | Unset): + package_size_id (int | None | Unset): + material_ids (list[int] | None | Unset): + measurement_length (float | None | Unset): + measurement_width (float | None | Unset): + enum_values (list[ItemEnumValue] | None | Unset): + attributes (list[ItemAttribute] | None | Unset): + custom_fields (list[ItemCustomField] | None | Unset): estimated_price (Money | None | Unset): purchase_price (Money | None | Unset): purchase_date (datetime.datetime | None | Unset): + purchase_place_id (int | None | Unset): selling_price (Money | None | Unset): selling_date (datetime.datetime | None | Unset): + selling_place_id (int | None | Unset): """ name: None | str | Unset = UNSET @@ -52,11 +64,20 @@ class ItemUpdateRequest: sex: None | str | Unset = UNSET labels: list[str] | None | Unset = UNSET sold: bool | None | Unset = UNSET + package_size_id: int | None | Unset = UNSET + material_ids: list[int] | None | Unset = UNSET + measurement_length: float | None | Unset = UNSET + measurement_width: float | None | Unset = UNSET + enum_values: list[ItemEnumValue] | None | Unset = UNSET + attributes: list[ItemAttribute] | None | Unset = UNSET + custom_fields: list[ItemCustomField] | None | Unset = UNSET estimated_price: Money | None | Unset = UNSET purchase_price: Money | None | Unset = UNSET purchase_date: datetime.datetime | None | Unset = UNSET + purchase_place_id: int | None | Unset = UNSET selling_price: Money | None | Unset = UNSET selling_date: datetime.datetime | None | Unset = UNSET + selling_place_id: int | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -146,6 +167,69 @@ def to_dict(self) -> dict[str, Any]: else: sold = self.sold + package_size_id: int | None | Unset + if isinstance(self.package_size_id, Unset): + package_size_id = UNSET + else: + package_size_id = self.package_size_id + + material_ids: list[int] | None | Unset + if isinstance(self.material_ids, Unset): + material_ids = UNSET + elif isinstance(self.material_ids, list): + material_ids = self.material_ids + + else: + material_ids = self.material_ids + + measurement_length: float | None | Unset + if isinstance(self.measurement_length, Unset): + measurement_length = UNSET + else: + measurement_length = self.measurement_length + + measurement_width: float | None | Unset + if isinstance(self.measurement_width, Unset): + measurement_width = UNSET + else: + measurement_width = self.measurement_width + + enum_values: list[dict[str, Any]] | None | Unset + if isinstance(self.enum_values, Unset): + enum_values = UNSET + elif isinstance(self.enum_values, list): + enum_values = [] + for enum_values_type_0_item_data in self.enum_values: + enum_values_type_0_item = enum_values_type_0_item_data.to_dict() + enum_values.append(enum_values_type_0_item) + + else: + enum_values = self.enum_values + + attributes: list[dict[str, Any]] | None | Unset + if isinstance(self.attributes, Unset): + attributes = UNSET + elif isinstance(self.attributes, list): + attributes = [] + for attributes_type_0_item_data in self.attributes: + attributes_type_0_item = attributes_type_0_item_data.to_dict() + attributes.append(attributes_type_0_item) + + else: + attributes = self.attributes + + custom_fields: list[dict[str, Any]] | None | Unset + if isinstance(self.custom_fields, Unset): + custom_fields = UNSET + elif isinstance(self.custom_fields, list): + custom_fields = [] + for custom_fields_type_0_item_data in self.custom_fields: + custom_fields_type_0_item = custom_fields_type_0_item_data.to_dict() + custom_fields.append(custom_fields_type_0_item) + + else: + custom_fields = self.custom_fields + estimated_price: dict[str, Any] | None | Unset if isinstance(self.estimated_price, Unset): estimated_price = UNSET @@ -170,6 +254,12 @@ def to_dict(self) -> dict[str, Any]: else: purchase_date = self.purchase_date + purchase_place_id: int | None | Unset + if isinstance(self.purchase_place_id, Unset): + purchase_place_id = UNSET + else: + purchase_place_id = self.purchase_place_id + selling_price: dict[str, Any] | None | Unset if isinstance(self.selling_price, Unset): selling_price = UNSET @@ -186,6 +276,12 @@ def to_dict(self) -> dict[str, Any]: else: selling_date = self.selling_date + selling_place_id: int | None | Unset + if isinstance(self.selling_place_id, Unset): + selling_place_id = UNSET + else: + selling_place_id = self.selling_place_id + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) @@ -213,21 +309,42 @@ def to_dict(self) -> dict[str, Any]: field_dict["labels"] = labels if sold is not UNSET: field_dict["sold"] = sold + if package_size_id is not UNSET: + field_dict["packageSizeId"] = package_size_id + if material_ids is not UNSET: + field_dict["materialIds"] = material_ids + if measurement_length is not UNSET: + field_dict["measurementLength"] = measurement_length + if measurement_width is not UNSET: + field_dict["measurementWidth"] = measurement_width + if enum_values is not UNSET: + field_dict["enumValues"] = enum_values + if attributes is not UNSET: + field_dict["attributes"] = attributes + if custom_fields is not UNSET: + field_dict["customFields"] = custom_fields if estimated_price is not UNSET: field_dict["estimatedPrice"] = estimated_price if purchase_price is not UNSET: field_dict["purchasePrice"] = purchase_price if purchase_date is not UNSET: field_dict["purchaseDate"] = purchase_date + if purchase_place_id is not UNSET: + field_dict["purchasePlaceId"] = purchase_place_id if selling_price is not UNSET: field_dict["sellingPrice"] = selling_price if selling_date is not UNSET: field_dict["sellingDate"] = selling_date + if selling_place_id is not UNSET: + field_dict["sellingPlaceId"] = selling_place_id return field_dict @classmethod def from_dict(cls, src_dict: Mapping[str, Any]) -> Self: + from ..models.item_attribute import ItemAttribute + from ..models.item_custom_field import ItemCustomField + from ..models.item_enum_value import ItemEnumValue from ..models.money import Money d = dict(src_dict) @@ -369,6 +486,124 @@ def _parse_sold(data: object) -> bool | None | Unset: sold = _parse_sold(d.pop("sold", UNSET)) + def _parse_package_size_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + package_size_id = _parse_package_size_id(d.pop("packageSizeId", UNSET)) + + def _parse_material_ids(data: object) -> list[int] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + material_ids_type_0 = cast(list[int], data) + + return material_ids_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[int] | None | Unset, data) + + material_ids = _parse_material_ids(d.pop("materialIds", UNSET)) + + def _parse_measurement_length(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + measurement_length = _parse_measurement_length( + d.pop("measurementLength", UNSET) + ) + + def _parse_measurement_width(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + measurement_width = _parse_measurement_width(d.pop("measurementWidth", UNSET)) + + def _parse_enum_values(data: object) -> list[ItemEnumValue] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + enum_values_type_0 = [] + _enum_values_type_0 = data + for enum_values_type_0_item_data in _enum_values_type_0: + enum_values_type_0_item = ItemEnumValue.from_dict( + enum_values_type_0_item_data + ) + + enum_values_type_0.append(enum_values_type_0_item) + + return enum_values_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[ItemEnumValue] | None | Unset, data) + + enum_values = _parse_enum_values(d.pop("enumValues", UNSET)) + + def _parse_attributes(data: object) -> list[ItemAttribute] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + attributes_type_0 = [] + _attributes_type_0 = data + for attributes_type_0_item_data in _attributes_type_0: + attributes_type_0_item = ItemAttribute.from_dict( + attributes_type_0_item_data + ) + + attributes_type_0.append(attributes_type_0_item) + + return attributes_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[ItemAttribute] | None | Unset, data) + + attributes = _parse_attributes(d.pop("attributes", UNSET)) + + def _parse_custom_fields(data: object) -> list[ItemCustomField] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + custom_fields_type_0 = [] + _custom_fields_type_0 = data + for custom_fields_type_0_item_data in _custom_fields_type_0: + custom_fields_type_0_item = ItemCustomField.from_dict( + custom_fields_type_0_item_data + ) + + custom_fields_type_0.append(custom_fields_type_0_item) + + return custom_fields_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[ItemCustomField] | None | Unset, data) + + custom_fields = _parse_custom_fields(d.pop("customFields", UNSET)) + def _parse_estimated_price(data: object) -> Money | None | Unset: if data is None: return data @@ -420,6 +655,15 @@ def _parse_purchase_date(data: object) -> datetime.datetime | None | Unset: purchase_date = _parse_purchase_date(d.pop("purchaseDate", UNSET)) + def _parse_purchase_place_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + purchase_place_id = _parse_purchase_place_id(d.pop("purchasePlaceId", UNSET)) + def _parse_selling_price(data: object) -> Money | None | Unset: if data is None: return data @@ -454,6 +698,15 @@ def _parse_selling_date(data: object) -> datetime.datetime | None | Unset: selling_date = _parse_selling_date(d.pop("sellingDate", UNSET)) + def _parse_selling_place_id(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + selling_place_id = _parse_selling_place_id(d.pop("sellingPlaceId", UNSET)) + item_update_request = cls( name=name, sku=sku, @@ -467,11 +720,20 @@ def _parse_selling_date(data: object) -> datetime.datetime | None | Unset: sex=sex, labels=labels, sold=sold, + package_size_id=package_size_id, + material_ids=material_ids, + measurement_length=measurement_length, + measurement_width=measurement_width, + enum_values=enum_values, + attributes=attributes, + custom_fields=custom_fields, estimated_price=estimated_price, purchase_price=purchase_price, purchase_date=purchase_date, + purchase_place_id=purchase_place_id, selling_price=selling_price, selling_date=selling_date, + selling_place_id=selling_place_id, ) item_update_request.additional_properties = d diff --git a/tests/test_client.py b/tests/test_client.py index 95370e7..1ca691f 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -40,6 +40,7 @@ def item(id, sex="WOMEN"): return { "id": id, "name": "n", "sku": None, "description": None, "photos": [], "categoryId": None, "brandId": None, "sizeId": None, "colorIds": [], "state": None, "sex": sex, "labels": [], "sold": False, + "materialIds": [], "enumValues": [], "attributes": [], "customFields": [], "estimatedPrice": {"amount": "12.50", "currency": "EUR"}, "purchasePrice": None, "purchaseDate": None, "sellingPrice": None, "sellingDate": None, "createdAt": "2026-10-20T10:00:00Z", "updatedAt": "2026-10-20T10:00:00Z", "unknownField": 1,