From 63fe4b132a2a1c7bd19b66ec8f4763954e92f567 Mon Sep 17 00:00:00 2001 From: "Glenn R. Martin" Date: Fri, 12 Jul 2024 08:50:13 -0400 Subject: [PATCH] chore: Update to RAML as of 65f6591ee55531c699ab089cea8b6f7af78251e0 Had to bring rmf-codegen to: 11375a9fabc63fa8b3a9231c7879164717feeaa1 **BREAKING CHANGES** Base Python SDK: 929268c7649b1d6d3eca62778f30829387ee192f From Changelog: - Regenerate code with latest RAML specifications, bringing the SDK up to date again with new features released by commercetools. - Remove ML client as sunsetted - *BREAKING*: the SDK now returns `None` instead of raising an exception when a resource is not found. - *BREAKING*: the `scope` parameter in the `Client` class is now required. - *BREAKING*: the old `commercetools.services.*` is removed, use the - `commercetools.platform.*` instead. See release notes for `14.0.0` Other: The Client class seems to have moved. --- CHANGES.md | 11 + Makefile | 22 +- pyproject.toml | 2 +- setup.py | 11 +- src/commercetools/__init__.py | 3 +- src/commercetools/base_client.py | 17 +- src/commercetools/checkout/client/__init__.py | 14 - .../checkout/models/_schemas/responses.py | 275 - src/commercetools/checkout/models/common.py | 87 + src/commercetools/checkout/models/error.py | 145 + src/commercetools/checkout/models/payments.py | 113 + .../checkout/models/responses.py | 1089 +- src/commercetools/connect/models/common.py | 837 ++ src/commercetools/connect/models/connector.py | 976 ++ .../connect/models/deployment.py | 340 + src/commercetools/connect/models/error.py | 944 ++ src/commercetools/contrib/pytest.py | 19 +- .../models/__init__.py => frontend/.py} | 13 +- src/commercetools/frontend/client/__init__.py | 13 +- ..._by_namespace_by_action_request_builder.py | 1 + .../frontastic_action_request_builder.py | 1 + .../client/api}/__init__.py | 0 .../client/api/api_request_builder.py} | 18 +- .../client/build}/__init__.py | 0 .../build/api_build_request_builder.py} | 25 +- .../frontastic_context_request_builder.py | 9 +- ...ta_source_by_identifier_request_builder.py | 1 + .../frontastic_data_source_request_builder.py | 1 + .../frontastic/frontastic_request_builder.py | 1 + .../page/frontastic_page_request_builder.py | 11 +- .../frontastic_preview_request_builder.py | 9 +- .../client/upload}/__init__.py | 0 .../api_build_upload_request_builder.py} | 26 +- .../frontend/models/_schemas/common.py | 93 + src/commercetools/frontend/models/common.py | 117 + .../products/__init__.py => history/.py} | 13 + .../{checkout => history}/__init__.py | 0 .../{ml => history}/client/__init__.py | 9 +- ..._by_resource_type_by_id_request_builder.py | 87 + ...ct_key_by_resource_type_request_builder.py | 97 + .../client/by_project_key_request_builder.py | 99 + .../prices => history/models}/__init__.py | 7 + .../{checkout => history}/models/_abstract.py | 0 .../history/models/_schemas/change.py | 7025 ++++++++++ .../history/models/_schemas/change_history.py | 1106 ++ .../history/models/_schemas/change_value.py | 522 + .../history/models/_schemas/common.py | 1524 +++ .../history/models/_schemas/label.py | 263 + src/commercetools/history/models/change.py | 11386 ++++++++++++++++ .../history/models/change_history.py | 614 + .../history/models/change_value.py | 887 ++ src/commercetools/history/models/common.py | 2201 +++ src/commercetools/history/models/label.py | 428 + .../importapi/client/__init__.py | 5 +- .../client/by_project_key_request_builder.py | 10 + ..._project_key_categories_request_builder.py | 1 + ...y_project_key_customers_request_builder.py | 1 + .../client/discount_codes}/__init__.py | 0 ...ect_key_discount_codes_request_builder.py} | 13 +- ...by_import_container_key_request_builder.py | 1 + ...ories_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...omers_import_containers_request_builder.py | 1 + ...y_import_container_key_request_builder.py} | 33 +- ...codes_import_containers_request_builder.py | 40 + ...by_import_container_key_request_builder.py | 1 + ...t_key_import_containers_request_builder.py | 5 +- ...by_import_container_key_request_builder.py | 1 + ...ories_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...tches_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...rders_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...rices_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...rafts_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...types_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...tches_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...iants_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...ducts_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...rices_import_containers_request_builder.py | 1 + ...by_import_container_key_request_builder.py | 1 + ...types_import_containers_request_builder.py | 1 + ...r_key_import_operations_request_builder.py | 5 +- ...import_operations_by_id_request_builder.py | 1 + ...t_key_import_operations_request_builder.py | 1 + ...er_key_import_summaries_request_builder.py | 1 + ...project_key_inventories_request_builder.py | 1 + ...oject_key_order_patches_request_builder.py | 1 + .../by_project_key_orders_request_builder.py | 1 + .../by_project_key_prices_request_builder.py | 1 + ...ject_key_product_drafts_request_builder.py | 1 + ...oject_key_product_types_request_builder.py | 1 + ...product_variant_patches_request_builder.py | 1 + ...ct_key_product_variants_request_builder.py | 1 + ...by_project_key_products_request_builder.py | 1 + ...t_key_standalone_prices_request_builder.py | 1 + .../by_project_key_types_request_builder.py | 1 + .../importapi/models/__init__.py | 1 + .../importapi/models/_schemas/categories.py | 1 + .../importapi/models/_schemas/common.py | 32 + .../importapi/models/_schemas/customers.py | 2 + .../importapi/models/_schemas/customfields.py | 2 + .../models/_schemas/discount_codes.py | 97 + .../importapi/models/_schemas/errors.py | 12 + .../models/_schemas/importcontainers.py | 4 + .../models/_schemas/importoperations.py | 3 + .../models/_schemas/importrequests.py | 19 + .../models/_schemas/importsummaries.py | 2 + .../importapi/models/_schemas/inventories.py | 1 + .../models/_schemas/order_patches.py | 15 +- .../importapi/models/_schemas/orders.py | 43 +- .../importapi/models/_schemas/prices.py | 6 + .../models/_schemas/productdrafts.py | 3 + .../importapi/models/_schemas/products.py | 3 + .../importapi/models/_schemas/producttypes.py | 12 + .../models/_schemas/productvariants.py | 5 + .../models/_schemas/standalone_prices.py | 1 + .../importapi/models/_schemas/types.py | 12 + src/commercetools/importapi/models/common.py | 22 + .../importapi/models/discount_codes.py | 91 + src/commercetools/importapi/models/errors.py | 17 +- .../importapi/models/importrequests.py | 33 +- .../importapi/models/importsummaries.py | 2 + .../importapi/models/order_patches.py | 4 +- src/commercetools/importapi/models/orders.py | 42 +- src/commercetools/importapi/models/prices.py | 11 +- .../importapi/models/productdrafts.py | 4 +- .../importapi/models/products.py | 6 +- .../importapi/models/producttypes.py | 16 + .../importapi/models/productvariants.py | 5 + src/commercetools/importapi/models/types.py | 8 + src/commercetools/ml/__init__.py | 7 - .../client/by_project_key_request_builder.py | 62 - ...ions_general_categories_request_builder.py | 61 - ...roject_key_image_search_request_builder.py | 57 - ...key_missing_data_images_request_builder.py | 55 - ...roject_key_missing_data_request_builder.py | 52 - ...y_similarities_products_request_builder.py | 55 - .../ml/client/project_categories/__init__.py | 6 - ...ions_project_categories_request_builder.py | 37 - .../ml/client/recommendations/__init__.py | 6 - ...ect_key_recommendations_request_builder.py | 47 - .../ml/client/similarities/__init__.py | 6 - .../ml/client/status/__init__.py | 6 - ...butes_status_by_task_id_request_builder.py | 46 - ..._data_attributes_status_request_builder.py | 37 - ...ducts_status_by_task_id_request_builder.py | 46 - ...arities_products_status_request_builder.py | 37 - src/commercetools/ml/models/__init__.py | 14 - src/commercetools/ml/models/_abstract.py | 57 - .../_schemas/category_recommendations.py | 90 - .../ml/models/_schemas/common.py | 125 - .../general_category_recommendations.py | 52 - .../ml/models/_schemas/image_search.py | 59 - .../ml/models/_schemas/image_search_config.py | 86 - .../ml/models/_schemas/missing_data.py | 643 - .../ml/models/_schemas/similar_products.py | 292 - .../ml/models/category_recommendations.py | 136 - src/commercetools/ml/models/common.py | 217 - .../general_category_recommendations.py | 87 - src/commercetools/ml/models/image_search.py | 84 - .../ml/models/image_search_config.py | 120 - src/commercetools/ml/models/missing_data.py | 859 -- .../ml/models/similar_products.py | 368 - src/commercetools/platform/client/__init__.py | 5 +- ...tore_key_me_active_cart_request_builder.py | 1 + ...ject_key_me_active_cart_request_builder.py | 1 + ...t_key_api_clients_by_id_request_builder.py | 1 + ...project_key_api_clients_request_builder.py | 1 + ...rders_edits_by_id_apply_request_builder.py | 1 + ...ey_approval_flows_by_id_request_builder.py | 1 + ...unit_key_approval_flows_request_builder.py | 1 + ...ey_approval_rules_by_id_request_builder.py | 1 + ...proval_rules_key_by_key_request_builder.py | 1 + ...unit_key_approval_rules_request_builder.py | 1 + ...sociate_by_associate_id_request_builder.py | 1 + ...roject_key_as_associate_request_builder.py | 1 + ...y_associate_roles_by_id_request_builder.py | 1 + ...ociate_roles_key_by_key_request_builder.py | 1 + ...ect_key_associate_roles_request_builder.py | 1 + ..._attribute_groups_by_id_request_builder.py | 1 + ...ibute_groups_key_by_key_request_builder.py | 1 + ...ct_key_attribute_groups_request_builder.py | 1 + ...id_business_units_by_id_request_builder.py | 1 + ...siness_units_key_by_key_request_builder.py | 1 + ...ciate_id_business_units_request_builder.py | 1 + ...ey_business_units_by_id_request_builder.py | 1 + ...siness_units_key_by_key_request_builder.py | 1 + ...ject_key_business_units_request_builder.py | 1 + ...me_business_units_by_id_request_builder.py | 1 + ...siness_units_key_by_key_request_builder.py | 1 + ...t_key_me_business_units_request_builder.py | 1 + .../client/by_project_key_request_builder.py | 11 + ...ey_cart_discounts_by_id_request_builder.py | 2 + ...rt_discounts_key_by_key_request_builder.py | 2 + ...ject_key_cart_discounts_request_builder.py | 2 + ...ey_cart_discounts_by_id_request_builder.py | 7 +- ...rt_discounts_key_by_key_request_builder.py | 7 +- ...tore_key_cart_discounts_request_builder.py | 7 +- ...ss_unit_key_carts_by_id_request_builder.py | 1 + ...it_key_carts_key_by_key_request_builder.py | 1 + ...business_unit_key_carts_request_builder.py | 8 + ...project_key_carts_by_id_request_builder.py | 1 + ...tomer_id_by_customer_id_request_builder.py | 3 +- ...ct_key_carts_key_by_key_request_builder.py | 1 + .../by_project_key_carts_request_builder.py | 12 +- ...y_store_key_carts_by_id_request_builder.py | 1 + ...tomer_id_by_customer_id_request_builder.py | 3 +- ...re_key_carts_key_by_key_request_builder.py | 1 + ..._key_by_store_key_carts_request_builder.py | 13 +- ...tore_key_me_carts_by_id_request_builder.py | 24 +- ...y_by_store_key_me_carts_request_builder.py | 16 +- ...ject_key_me_carts_by_id_request_builder.py | 22 +- ...key_me_carts_key_by_key_request_builder.py | 1 + ...by_project_key_me_carts_request_builder.py | 14 +- ...ct_key_categories_by_id_request_builder.py | 1 + ...y_categories_key_by_key_request_builder.py | 1 + ..._project_key_categories_request_builder.py | 1 + ...ject_key_channels_by_id_request_builder.py | 2 + ...by_project_key_channels_request_builder.py | 1 + ...customers_email_confirm_request_builder.py | 1 + ...customers_email_confirm_request_builder.py | 1 + ...re_key_me_email_confirm_request_builder.py | 1 + ...ct_key_me_email_confirm_request_builder.py | 1 + ...cts_by_container_by_key_request_builder.py | 1 + ...om_objects_by_container_request_builder.py | 1 + ...ject_key_custom_objects_request_builder.py | 1 + ...y_customer_groups_by_id_request_builder.py | 1 + ...tomer_groups_key_by_key_request_builder.py | 1 + ...ect_key_customer_groups_request_builder.py | 1 + ...ect_key_customers_by_id_request_builder.py | 2 + ...il_token_by_email_token_request_builder.py | 1 + ...ey_customers_key_by_key_request_builder.py | 2 + ...token_by_password_token_request_builder.py | 1 + ...y_project_key_customers_request_builder.py | 26 +- ...s_unit_key_me_customers_request_builder.py | 1 + ...ore_key_customers_by_id_request_builder.py | 7 +- ...il_token_by_email_token_request_builder.py | 1 + ...ey_customers_key_by_key_request_builder.py | 7 +- ...token_by_password_token_request_builder.py | 1 + ..._by_store_key_customers_request_builder.py | 4 +- ...ey_discount_codes_by_id_request_builder.py | 7 +- ...scount_codes_key_by_key_request_builder.py | 134 + ...ject_key_discount_codes_request_builder.py | 17 +- ..._key_orders_edits_by_id_request_builder.py | 1 + ...orders_edits_key_by_key_request_builder.py | 1 + ...roject_key_orders_edits_request_builder.py | 7 +- ...y_customers_email_token_request_builder.py | 1 + ...y_customers_email_token_request_builder.py | 1 + ...ct_key_extensions_by_id_request_builder.py | 1 + ...y_extensions_key_by_key_request_builder.py | 1 + ..._project_key_extensions_request_builder.py | 1 + .../by_project_key_graphql_request_builder.py | 1 + ...scriptions_by_id_health_request_builder.py | 1 + ...oduct_tailoring_images_request_builder.py} | 40 +- ...roduct_tailoring_images_request_builder.py | 62 + ...y_products_by_id_images_request_builder.py | 1 + ...oject_key_orders_import_request_builder.py | 1 + ...ey_by_business_unit_key_request_builder.py | 1 + ...ey_by_business_unit_key_request_builder.py | 1 + ..._store_key_by_store_key_request_builder.py | 61 + .../client/indexing_status}/__init__.py | 0 ...search_indexing_status_request_builder.py} | 20 +- ...ect_key_inventory_by_id_request_builder.py | 1 + ...ey_inventory_key_by_key_request_builder.py | 1 + ...y_project_key_inventory_request_builder.py | 1 + ..._key_by_store_key_login_request_builder.py | 5 + ...y_by_store_key_me_login_request_builder.py | 3 +- .../by_project_key_login_request_builder.py | 7 +- ...by_project_key_me_login_request_builder.py | 3 +- ...duct_discounts_matching_request_builder.py | 1 + ...g_methods_matching_cart_request_builder.py | 5 +- ...g_methods_matching_cart_request_builder.py | 5 +- ..._matching_cart_location_request_builder.py | 5 +- ...thods_matching_location_request_builder.py | 5 +- ...hods_matching_orderedit_request_builder.py | 5 +- ...by_business_unit_key_me_request_builder.py | 1 + ...ore_key_by_store_key_me_request_builder.py | 1 + .../me/by_project_key_me_request_builder.py | 1 + ...ject_key_messages_by_id_request_builder.py | 1 + ...by_project_key_messages_request_builder.py | 1 + ...s_unit_key_orders_by_id_request_builder.py | 1 + ..._number_by_order_number_request_builder.py | 1 + ...usiness_unit_key_orders_request_builder.py | 11 + ...ore_key_me_orders_by_id_request_builder.py | 1 + ..._by_store_key_me_orders_request_builder.py | 11 +- ..._store_key_orders_by_id_request_builder.py | 1 + ..._number_by_order_number_request_builder.py | 1 + ...key_by_store_key_orders_request_builder.py | 14 + ...ect_key_me_orders_by_id_request_builder.py | 1 + ...y_project_key_me_orders_request_builder.py | 12 +- ...roject_key_orders_by_id_request_builder.py | 1 + ..._number_by_order_number_request_builder.py | 1 + .../by_project_key_orders_request_builder.py | 5 + ..._key_customers_password_request_builder.py | 1 + ..._key_customers_password_request_builder.py | 1 + ...y_store_key_me_password_request_builder.py | 1 + ...project_key_me_password_request_builder.py | 1 + ...ustomers_password_token_request_builder.py | 1 + ...ustomers_password_token_request_builder.py | 1 + ...t_key_me_payments_by_id_request_builder.py | 1 + ...project_key_me_payments_request_builder.py | 1 + ...ject_key_payments_by_id_request_builder.py | 1 + ...key_payments_key_by_key_request_builder.py | 1 + ...by_project_key_payments_request_builder.py | 1 + ...product_discounts_by_id_request_builder.py | 1 + ...ct_discounts_key_by_key_request_builder.py | 1 + ...t_key_product_discounts_request_builder.py | 1 + ...oduct_projections_by_id_request_builder.py | 9 +- ..._projections_key_by_key_request_builder.py | 9 +- ...key_product_projections_request_builder.py | 1 + ...oduct_projections_by_id_request_builder.py | 1 + ..._projections_key_by_key_request_builder.py | 1 + ...key_product_projections_request_builder.py | 1 + ...t_selection_assignments_request_builder.py | 1 + ...roduct_selections_by_id_request_builder.py | 3 +- ...t_selections_key_by_key_request_builder.py | 3 +- ..._key_product_selections_request_builder.py | 1 + ...y_id_product_selections_request_builder.py | 1 + ..._key_product_selections_request_builder.py | 1 + .../client/product_tailoring}/__init__.py | 0 ...e_key_product_tailoring_request_builder.py | 107 + ...ct_id_product_tailoring_request_builder.py | 123 + ...t_key_product_tailoring_request_builder.py | 123 + ...product_tailoring_by_id_request_builder.py | 105 + ...ct_tailoring_key_by_key_request_builder.py | 105 + ...t_key_product_tailoring_request_builder.py | 118 + ...key_product_types_by_id_request_builder.py | 1 + ...roduct_types_key_by_key_request_builder.py | 1 + ...oject_key_product_types_request_builder.py | 1 + ..._products_by_product_id_request_builder.py | 45 + ...ucts_key_by_product_key_request_builder.py | 45 + ...y_by_store_key_products_request_builder.py | 55 + ...lections_by_id_products_request_builder.py | 1 + ...ons_key_by_key_products_request_builder.py | 1 + ...ject_key_products_by_id_request_builder.py | 13 +- ...key_products_key_by_key_request_builder.py | 11 +- ...by_project_key_products_request_builder.py | 21 +- ...ey_quote_requests_by_id_request_builder.py | 1 + ...ote_requests_key_by_key_request_builder.py | 1 + ...unit_key_quote_requests_request_builder.py | 1 + ...ey_quote_requests_by_id_request_builder.py | 130 + ...ote_requests_key_by_key_request_builder.py | 130 + ...tore_key_quote_requests_request_builder.py | 150 + ...me_quote_requests_by_id_request_builder.py | 1 + ...ote_requests_key_by_key_request_builder.py | 1 + ...t_key_me_quote_requests_request_builder.py | 1 + ...ey_quote_requests_by_id_request_builder.py | 1 + ...ote_requests_key_by_key_request_builder.py | 1 + ...ject_key_quote_requests_request_builder.py | 1 + ..._unit_key_orders_quotes_request_builder.py | 6 + ...s_unit_key_quotes_by_id_request_builder.py | 1 + ...t_key_quotes_key_by_key_request_builder.py | 1 + ...usiness_unit_key_quotes_request_builder.py | 1 + ...store_key_orders_quotes_request_builder.py | 66 + ..._store_key_quotes_by_id_request_builder.py | 130 + ...e_key_quotes_key_by_key_request_builder.py | 130 + ...key_by_store_key_quotes_request_builder.py | 146 + ...ct_key_me_orders_quotes_request_builder.py | 1 + ...ect_key_me_quotes_by_id_request_builder.py | 1 + ...ey_me_quotes_key_by_key_request_builder.py | 1 + ...y_project_key_me_quotes_request_builder.py | 1 + ...oject_key_orders_quotes_request_builder.py | 7 +- ...roject_key_quotes_by_id_request_builder.py | 1 + ...t_key_quotes_key_by_key_request_builder.py | 1 + .../by_project_key_quotes_request_builder.py | 1 + ...nit_key_carts_replicate_request_builder.py | 6 + ...ect_key_carts_replicate_request_builder.py | 6 + ...ore_key_carts_replicate_request_builder.py | 6 + ..._key_me_carts_replicate_request_builder.py | 8 +- ...ustomers_password_reset_request_builder.py | 1 + ...ustomers_password_reset_request_builder.py | 1 + ...e_key_me_password_reset_request_builder.py | 1 + ...t_key_me_password_reset_request_builder.py | 1 + ...oject_key_reviews_by_id_request_builder.py | 1 + ..._key_reviews_key_by_key_request_builder.py | 1 + .../by_project_key_reviews_request_builder.py | 1 + ...t_key_customers_search_request_builder.py} | 53 +- ...oject_key_orders_search_request_builder.py | 1 + ...duct_projections_search_request_builder.py | 1 + ...ct_key_products_search_request_builder.py} | 31 +- ...re_key_shipping_methods_request_builder.py | 1 + ..._shipping_methods_by_id_request_builder.py | 1 + ...ping_methods_key_by_key_request_builder.py | 1 + ...ct_key_shipping_methods_request_builder.py | 1 + ...me_shopping_lists_by_id_request_builder.py | 1 + ...opping_lists_key_by_key_request_builder.py | 1 + ...e_key_me_shopping_lists_request_builder.py | 1 + ...ey_shopping_lists_by_id_request_builder.py | 1 + ...opping_lists_key_by_key_request_builder.py | 1 + ...tore_key_shopping_lists_request_builder.py | 1 + ...me_shopping_lists_by_id_request_builder.py | 1 + ...opping_lists_key_by_key_request_builder.py | 1 + ...t_key_me_shopping_lists_request_builder.py | 1 + ...ey_shopping_lists_by_id_request_builder.py | 1 + ...opping_lists_key_by_key_request_builder.py | 1 + ...ject_key_shopping_lists_request_builder.py | 1 + ..._by_store_key_me_signup_request_builder.py | 3 + ...y_project_key_me_signup_request_builder.py | 1 + ...key_staged_quotes_by_id_request_builder.py | 130 + ...taged_quotes_key_by_key_request_builder.py | 130 + ...store_key_staged_quotes_request_builder.py | 150 + ...key_staged_quotes_by_id_request_builder.py | 1 + ...taged_quotes_key_by_key_request_builder.py | 1 + ...oject_key_staged_quotes_request_builder.py | 1 + ...standalone_prices_by_id_request_builder.py | 1 + ...alone_prices_key_by_key_request_builder.py | 1 + ...t_key_standalone_prices_request_builder.py | 8 +- ...roject_key_states_by_id_request_builder.py | 1 + ...t_key_states_key_by_key_request_builder.py | 1 + .../by_project_key_states_request_builder.py | 1 + ...roject_key_stores_by_id_request_builder.py | 1 + ...t_key_stores_key_by_key_request_builder.py | 1 + .../by_project_key_stores_request_builder.py | 1 + ...key_subscriptions_by_id_request_builder.py | 1 + ...ubscriptions_key_by_key_request_builder.py | 1 + ...oject_key_subscriptions_request_builder.py | 1 + ...uct_projections_suggest_request_builder.py | 1 + ...ey_tax_categories_by_id_request_builder.py | 1 + ...x_categories_key_by_key_request_builder.py | 1 + ...ject_key_tax_categories_request_builder.py | 1 + ...project_key_types_by_id_request_builder.py | 1 + ...ct_key_types_key_by_key_request_builder.py | 1 + .../by_project_key_types_request_builder.py | 1 + ...project_key_zones_by_id_request_builder.py | 1 + ...ct_key_zones_key_by_key_request_builder.py | 1 + .../by_project_key_zones_request_builder.py | 1 + src/commercetools/platform/models/__init__.py | 4 + .../platform/models/_schemas/api_client.py | 3 + .../platform/models/_schemas/approval_flow.py | 59 + .../platform/models/_schemas/approval_rule.py | 14 + .../models/_schemas/associate_role.py | 6 + .../models/_schemas/attribute_group.py | 6 + .../platform/models/_schemas/business_unit.py | 51 +- .../platform/models/_schemas/cart.py | 318 +- .../platform/models/_schemas/cart_discount.py | 11 +- .../platform/models/_schemas/category.py | 5 + .../platform/models/_schemas/channel.py | 5 + .../platform/models/_schemas/common.py | 68 +- .../platform/models/_schemas/custom_object.py | 3 + .../platform/models/_schemas/customer.py | 21 +- .../models/_schemas/customer_group.py | 5 + .../models/_schemas/customer_search.py | 140 + .../platform/models/_schemas/discount_code.py | 29 + .../platform/models/_schemas/error.py | 170 +- .../platform/models/_schemas/extension.py | 9 + .../platform/models/_schemas/graph_ql.py | 10 +- .../platform/models/_schemas/inventory.py | 5 + .../platform/models/_schemas/me.py | 41 +- .../platform/models/_schemas/message.py | 5953 +++++--- .../platform/models/_schemas/order.py | 113 +- .../platform/models/_schemas/order_edit.py | 172 +- .../platform/models/_schemas/payment.py | 10 + .../platform/models/_schemas/product.py | 31 + .../models/_schemas/product_discount.py | 11 + .../models/_schemas/product_search.py | 559 + .../models/_schemas/product_selection.py | 12 + .../models/_schemas/product_tailoring.py | 1180 ++ .../platform/models/_schemas/product_type.py | 17 + .../platform/models/_schemas/project.py | 46 + .../platform/models/_schemas/quote.py | 5 + .../platform/models/_schemas/quote_request.py | 5 + .../platform/models/_schemas/review.py | 15 + .../platform/models/_schemas/search.py | 592 + .../models/_schemas/shipping_method.py | 63 +- .../platform/models/_schemas/shopping_list.py | 9 + .../platform/models/_schemas/staged_quote.py | 12 + .../models/_schemas/standalone_price.py | 9 + .../platform/models/_schemas/state.py | 5 + .../platform/models/_schemas/store.py | 8 + .../platform/models/_schemas/store_country.py | 1 + .../platform/models/_schemas/subscription.py | 12 + .../platform/models/_schemas/tax_category.py | 8 + .../platform/models/_schemas/type.py | 19 + .../platform/models/_schemas/zone.py | 6 + .../platform/models/api_client.py | 2 +- .../platform/models/approval_flow.py | 88 +- .../platform/models/approval_rule.py | 6 +- .../platform/models/associate_role.py | 16 +- .../platform/models/attribute_group.py | 12 +- .../platform/models/business_unit.py | 106 +- src/commercetools/platform/models/cart.py | 182 +- .../platform/models/cart_discount.py | 38 +- src/commercetools/platform/models/category.py | 17 +- src/commercetools/platform/models/channel.py | 8 +- src/commercetools/platform/models/common.py | 90 +- .../platform/models/custom_object.py | 4 +- src/commercetools/platform/models/customer.py | 40 +- .../platform/models/customer_group.py | 7 +- .../platform/models/customer_search.py | 197 + .../platform/models/discount_code.py | 58 +- src/commercetools/platform/models/error.py | 404 +- .../platform/models/extension.py | 11 +- .../platform/models/inventory.py | 8 +- src/commercetools/platform/models/me.py | 55 +- src/commercetools/platform/models/message.py | 7973 +++++++---- src/commercetools/platform/models/order.py | 130 +- .../platform/models/order_edit.py | 122 +- src/commercetools/platform/models/payment.py | 23 +- src/commercetools/platform/models/product.py | 47 +- .../platform/models/product_discount.py | 10 +- .../platform/models/product_search.py | 747 + .../platform/models/product_selection.py | 5 +- .../platform/models/product_tailoring.py | 1809 +++ .../platform/models/product_type.py | 26 +- src/commercetools/platform/models/project.py | 92 +- src/commercetools/platform/models/quote.py | 7 +- .../platform/models/quote_request.py | 7 +- src/commercetools/platform/models/review.py | 5 +- src/commercetools/platform/models/search.py | 857 ++ .../platform/models/shipping_method.py | 74 +- .../platform/models/shopping_list.py | 10 +- .../platform/models/staged_quote.py | 14 +- .../platform/models/standalone_price.py | 35 +- src/commercetools/platform/models/state.py | 8 +- src/commercetools/platform/models/store.py | 15 +- .../platform/models/subscription.py | 16 +- .../platform/models/tax_category.py | 16 +- src/commercetools/platform/models/type.py | 20 +- src/commercetools/platform/models/zone.py | 8 +- src/commercetools/protocols.py | 6 +- src/commercetools/services/__init__.py | 296 - src/commercetools/services/abstract.py | 17 - src/commercetools/services/api_clients.py | 91 - src/commercetools/services/cart_discounts.py | 170 - src/commercetools/services/carts.py | 159 - src/commercetools/services/categories.py | 166 - src/commercetools/services/channels.py | 123 - src/commercetools/services/custom_objects.py | 175 - src/commercetools/services/customer_groups.py | 169 - src/commercetools/services/customers.py | 274 - src/commercetools/services/discount_codes.py | 129 - src/commercetools/services/extensions.py | 168 - src/commercetools/services/graphqls.py | 25 - src/commercetools/services/in_stores.py | 677 - src/commercetools/services/inventory.py | 120 - src/commercetools/services/login.py | 31 - src/commercetools/services/me.py | 530 - src/commercetools/services/messages.py | 58 - src/commercetools/services/orders.py | 344 - src/commercetools/services/payments.py | 173 - .../services/product_discounts.py | 183 - .../services/product_projections.py | 330 - src/commercetools/services/product_types.py | 173 - src/commercetools/services/products.py | 398 - src/commercetools/services/project.py | 27 - src/commercetools/services/reviews.py | 162 - .../services/shipping_methods.py | 243 - src/commercetools/services/shopping_lists.py | 177 - src/commercetools/services/states.py | 169 - src/commercetools/services/stores.py | 156 - src/commercetools/services/subscriptions.py | 180 - src/commercetools/services/tax_categories.py | 169 - src/commercetools/services/types.py | 160 - src/commercetools/services/zones.py | 156 - src/commercetools/testing/abstract.py | 4 +- src/commercetools/testing/auth.py | 2 +- src/commercetools/testing/cart_discounts.py | 2 +- src/commercetools/testing/carts.py | 1 + src/commercetools/testing/predicates.py | 1 + .../testing/product_projections.py | 21 +- src/commercetools/testing/products.py | 21 +- .../{services => testing}/traits.py | 0 src/commercetools/testing/utils.py | 8 +- src/commercetools/types.py | 9 - tests/conftest.py | 5 - tests/platform/test_client.py | 148 +- tests/platform/test_expand.py | 86 +- tests/platform/test_mock_server.py | 49 +- tests/platform/test_service_api_clients.py | 16 +- tests/platform/test_service_cart.py | 8 +- tests/platform/test_service_cart_discounts.py | 144 +- tests/platform/test_service_categories.py | 201 +- tests/platform/test_service_channels.py | 81 +- tests/platform/test_service_custom_objects.py | 124 +- .../platform/test_service_customer_groups.py | 99 +- tests/platform/test_service_customers.py | 76 +- tests/platform/test_service_discount_codes.py | 250 +- tests/platform/test_service_extensions.py | 96 +- tests/platform/test_service_inventory.py | 46 +- tests/platform/test_service_order.py | 155 +- tests/platform/test_service_payment.py | 227 +- .../test_service_product_discounts.py | 23 +- .../test_service_product_projections.py | 97 +- tests/platform/test_service_product_types.py | 159 +- tests/platform/test_service_products.py | 367 +- tests/platform/test_service_project.py | 97 +- tests/platform/test_service_reviews.py | 95 +- .../platform/test_service_shipping_methods.py | 140 +- tests/platform/test_service_shopping_lists.py | 165 +- tests/platform/test_service_states.py | 36 +- tests/platform/test_service_stores.py | 18 +- tests/platform/test_service_tax_category.py | 55 +- tests/platform/test_testing_headers.py | 4 +- tests/test_pagination.py | 14 +- tox.ini | 2 +- 603 files changed, 54621 insertions(+), 17663 deletions(-) delete mode 100644 src/commercetools/checkout/client/__init__.py delete mode 100644 src/commercetools/checkout/models/_schemas/responses.py create mode 100644 src/commercetools/checkout/models/common.py create mode 100644 src/commercetools/checkout/models/error.py create mode 100644 src/commercetools/checkout/models/payments.py create mode 100644 src/commercetools/connect/models/common.py create mode 100644 src/commercetools/connect/models/connector.py create mode 100644 src/commercetools/connect/models/deployment.py create mode 100644 src/commercetools/connect/models/error.py rename src/commercetools/{checkout/models/__init__.py => frontend/.py} (66%) rename src/commercetools/{ml/client/attributes => frontend/client/api}/__init__.py (100%) rename src/commercetools/{ml/client/status/by_project_key_missing_data_images_status_request_builder.py => frontend/client/api/api_request_builder.py} (51%) rename src/commercetools/{ml/client/config => frontend/client/build}/__init__.py (100%) rename src/commercetools/{ml/client/status/by_project_key_missing_data_prices_status_request_builder.py => frontend/client/build/api_build_request_builder.py} (51%) rename src/commercetools/{ml/client/general_categories => frontend/client/upload}/__init__.py (100%) rename src/commercetools/{ml/client/status/by_project_key_missing_data_images_status_by_task_id_request_builder.py => frontend/client/upload/api_build_upload_request_builder.py} (61%) rename src/commercetools/{ml/client/products/__init__.py => history/.py} (66%) rename src/commercetools/{checkout => history}/__init__.py (100%) rename src/commercetools/{ml => history}/client/__init__.py (69%) create mode 100644 src/commercetools/history/client/by_project_key_by_resource_type_by_id_request_builder.py create mode 100644 src/commercetools/history/client/by_project_key_by_resource_type_request_builder.py create mode 100644 src/commercetools/history/client/by_project_key_request_builder.py rename src/commercetools/{ml/client/prices => history/models}/__init__.py (62%) rename src/commercetools/{checkout => history}/models/_abstract.py (100%) create mode 100644 src/commercetools/history/models/_schemas/change.py create mode 100644 src/commercetools/history/models/_schemas/change_history.py create mode 100644 src/commercetools/history/models/_schemas/change_value.py create mode 100644 src/commercetools/history/models/_schemas/common.py create mode 100644 src/commercetools/history/models/_schemas/label.py create mode 100644 src/commercetools/history/models/change.py create mode 100644 src/commercetools/history/models/change_history.py create mode 100644 src/commercetools/history/models/change_value.py create mode 100644 src/commercetools/history/models/common.py create mode 100644 src/commercetools/history/models/label.py rename src/commercetools/{ml/client/image_search => importapi/client/discount_codes}/__init__.py (100%) rename src/commercetools/{ml/client/similarities/by_project_key_similarities_request_builder.py => importapi/client/discount_codes/by_project_key_discount_codes_request_builder.py} (65%) rename src/commercetools/{ml/client/attributes/by_project_key_missing_data_attributes_request_builder.py => importapi/client/import_containers/by_project_key_discount_codes_import_containers_by_import_container_key_request_builder.py} (55%) create mode 100644 src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_request_builder.py create mode 100644 src/commercetools/importapi/models/_schemas/discount_codes.py create mode 100644 src/commercetools/importapi/models/discount_codes.py delete mode 100644 src/commercetools/ml/__init__.py delete mode 100644 src/commercetools/ml/client/by_project_key_request_builder.py delete mode 100644 src/commercetools/ml/client/general_categories/by_project_key_recommendations_general_categories_request_builder.py delete mode 100644 src/commercetools/ml/client/image_search/by_project_key_image_search_request_builder.py delete mode 100644 src/commercetools/ml/client/images/by_project_key_missing_data_images_request_builder.py delete mode 100644 src/commercetools/ml/client/missing_data/by_project_key_missing_data_request_builder.py delete mode 100644 src/commercetools/ml/client/products/by_project_key_similarities_products_request_builder.py delete mode 100644 src/commercetools/ml/client/project_categories/__init__.py delete mode 100644 src/commercetools/ml/client/project_categories/by_project_key_recommendations_project_categories_request_builder.py delete mode 100644 src/commercetools/ml/client/recommendations/__init__.py delete mode 100644 src/commercetools/ml/client/recommendations/by_project_key_recommendations_request_builder.py delete mode 100644 src/commercetools/ml/client/similarities/__init__.py delete mode 100644 src/commercetools/ml/client/status/__init__.py delete mode 100644 src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_by_task_id_request_builder.py delete mode 100644 src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_request_builder.py delete mode 100644 src/commercetools/ml/client/status/by_project_key_similarities_products_status_by_task_id_request_builder.py delete mode 100644 src/commercetools/ml/client/status/by_project_key_similarities_products_status_request_builder.py delete mode 100644 src/commercetools/ml/models/__init__.py delete mode 100644 src/commercetools/ml/models/_abstract.py delete mode 100644 src/commercetools/ml/models/_schemas/category_recommendations.py delete mode 100644 src/commercetools/ml/models/_schemas/common.py delete mode 100644 src/commercetools/ml/models/_schemas/general_category_recommendations.py delete mode 100644 src/commercetools/ml/models/_schemas/image_search.py delete mode 100644 src/commercetools/ml/models/_schemas/image_search_config.py delete mode 100644 src/commercetools/ml/models/_schemas/missing_data.py delete mode 100644 src/commercetools/ml/models/_schemas/similar_products.py delete mode 100644 src/commercetools/ml/models/category_recommendations.py delete mode 100644 src/commercetools/ml/models/common.py delete mode 100644 src/commercetools/ml/models/general_category_recommendations.py delete mode 100644 src/commercetools/ml/models/image_search.py delete mode 100644 src/commercetools/ml/models/image_search_config.py delete mode 100644 src/commercetools/ml/models/missing_data.py delete mode 100644 src/commercetools/ml/models/similar_products.py create mode 100644 src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_key_by_key_request_builder.py rename src/commercetools/{ml/client/project_categories/by_project_key_recommendations_project_categories_by_product_id_request_builder.py => platform/client/images/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_images_request_builder.py} (50%) create mode 100644 src/commercetools/platform/client/images/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_images_request_builder.py rename src/commercetools/{ml/client/images => platform/client/indexing_status}/__init__.py (100%) rename src/commercetools/{ml/client/status/by_project_key_missing_data_prices_status_by_task_id_request_builder.py => platform/client/indexing_status/by_project_key_customers_search_indexing_status_request_builder.py} (61%) rename src/commercetools/{ml/client/missing_data => platform/client/product_tailoring}/__init__.py (100%) create mode 100644 src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_product_tailoring_request_builder.py create mode 100644 src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_request_builder.py create mode 100644 src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_request_builder.py create mode 100644 src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_by_id_request_builder.py create mode 100644 src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_key_by_key_request_builder.py create mode 100644 src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_request_builder.py create mode 100644 src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder.py create mode 100644 src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder.py create mode 100644 src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_request_builder.py create mode 100644 src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_by_id_request_builder.py create mode 100644 src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_key_by_key_request_builder.py create mode 100644 src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_request_builder.py create mode 100644 src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_orders_quotes_request_builder.py create mode 100644 src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_by_id_request_builder.py create mode 100644 src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_key_by_key_request_builder.py create mode 100644 src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_request_builder.py rename src/commercetools/{ml/client/config/by_project_key_image_search_config_request_builder.py => platform/client/search/by_project_key_customers_search_request_builder.py} (54%) rename src/commercetools/{ml/client/prices/by_project_key_missing_data_prices_request_builder.py => platform/client/search/by_project_key_products_search_request_builder.py} (59%) create mode 100644 src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_by_id_request_builder.py create mode 100644 src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_key_by_key_request_builder.py create mode 100644 src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_request_builder.py create mode 100644 src/commercetools/platform/models/_schemas/customer_search.py create mode 100644 src/commercetools/platform/models/_schemas/product_search.py create mode 100644 src/commercetools/platform/models/_schemas/product_tailoring.py create mode 100644 src/commercetools/platform/models/_schemas/search.py create mode 100644 src/commercetools/platform/models/customer_search.py create mode 100644 src/commercetools/platform/models/product_search.py create mode 100644 src/commercetools/platform/models/product_tailoring.py create mode 100644 src/commercetools/platform/models/search.py delete mode 100644 src/commercetools/services/__init__.py delete mode 100644 src/commercetools/services/abstract.py delete mode 100644 src/commercetools/services/api_clients.py delete mode 100644 src/commercetools/services/cart_discounts.py delete mode 100644 src/commercetools/services/carts.py delete mode 100644 src/commercetools/services/categories.py delete mode 100644 src/commercetools/services/channels.py delete mode 100644 src/commercetools/services/custom_objects.py delete mode 100644 src/commercetools/services/customer_groups.py delete mode 100644 src/commercetools/services/customers.py delete mode 100644 src/commercetools/services/discount_codes.py delete mode 100644 src/commercetools/services/extensions.py delete mode 100644 src/commercetools/services/graphqls.py delete mode 100644 src/commercetools/services/in_stores.py delete mode 100644 src/commercetools/services/inventory.py delete mode 100644 src/commercetools/services/login.py delete mode 100644 src/commercetools/services/me.py delete mode 100644 src/commercetools/services/messages.py delete mode 100644 src/commercetools/services/orders.py delete mode 100644 src/commercetools/services/payments.py delete mode 100644 src/commercetools/services/product_discounts.py delete mode 100644 src/commercetools/services/product_projections.py delete mode 100644 src/commercetools/services/product_types.py delete mode 100644 src/commercetools/services/products.py delete mode 100644 src/commercetools/services/project.py delete mode 100644 src/commercetools/services/reviews.py delete mode 100644 src/commercetools/services/shipping_methods.py delete mode 100644 src/commercetools/services/shopping_lists.py delete mode 100644 src/commercetools/services/states.py delete mode 100644 src/commercetools/services/stores.py delete mode 100644 src/commercetools/services/subscriptions.py delete mode 100644 src/commercetools/services/tax_categories.py delete mode 100644 src/commercetools/services/types.py delete mode 100644 src/commercetools/services/zones.py rename src/commercetools/{services => testing}/traits.py (100%) delete mode 100644 src/commercetools/types.py diff --git a/CHANGES.md b/CHANGES.md index 2d051192..7774393a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,14 @@ +24.4.6 +------ +- Regenerate code with latest RAML specifications, bringing the SDK up to date + again with new features released by commercetools. +- Remove ML client as sunsetted +- *BREAKING*: the SDK now returns `None` instead of raising an exception when + a resource is not found. +- *BREAKING*: the `scope` parameter in the `Client` class is now required. +- *BREAKING*: the old `commercetools.services.*` is removed, use the +- `commercetools.platform.*` instead. See release notes for `14.0.0` + 23.6.29 -------- - Regenerate code with latest RAML specifications, bringing the SDK up to date diff --git a/Makefile b/Makefile index dc8f6875..19e47164 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,22 @@ install: pip install -e .[test] -generate: - java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/api/api.raml -o src/commercetools/platform/ -t PYTHON_CLIENT - java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/importapi/api.raml -o src/commercetools/importapi/ -t PYTHON_CLIENT - java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/ml/api.raml -o src/commercetools/ml/ -t PYTHON_CLIENT - java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/frontend-api/api.raml -o src/commercetools/frontend/ -t PYTHON_CLIENT - java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/checkout/api.raml -o src/commercetools/checkout/ -t PYTHON_CLIENT +clean: + rm -rf src/commercetools/platform/ + rm -rf src/commercetools/importapi/ + rm -rf src/commercetools/frontend/ + rm -rf src/commercetools/checkout/ + rm -rf src/commercetools/history/ + rm -rf src/commercetools/connect/ + rm -rf src/commercetools/ml/ + +generate: clean + java -jar ../rmf-codegen/rmf-codegen.jar generate -v ../commercetools-api-reference/api-specs/api/api.raml -o src/commercetools/platform/ -t PYTHON_CLIENT + java -jar ../rmf-codegen/rmf-codegen.jar generate -v ../commercetools-api-reference/api-specs/import/api.raml -o src/commercetools/importapi/ -t PYTHON_CLIENT + java -jar ../rmf-codegen/rmf-codegen.jar generate -v ../commercetools-api-reference/api-specs/frontend-api/api.raml -o src/commercetools/frontend/ -t PYTHON_CLIENT + java -jar ../rmf-codegen/rmf-codegen.jar generate -v ../commercetools-api-reference/api-specs/checkout/api.raml -o src/commercetools/checkout/ -t PYTHON_CLIENT + java -jar ../rmf-codegen/rmf-codegen.jar generate -v ../commercetools-api-reference/api-specs/history/api.raml -o src/commercetools/history/ -t PYTHON_CLIENT + java -jar ../rmf-codegen/rmf-codegen.jar generate -v ../commercetools-api-reference/api-specs/connect/api.raml -o src/commercetools/connect/ -t PYTHON_CLIENT find src/ -name "gen.properties" -delete isort src/commercetools/ black src/commercetools/ diff --git a/pyproject.toml b/pyproject.toml index 3d61200a..d083849f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ["setuptools>=40.6.0", "wheel"] build-backend = "setuptools.build_meta" [tool.coverage.paths] -source = ["src", ".tox/**/site-packages"] +source = ["src", ".tox/*/site-packages"] [tool.isort] line_length = 88 diff --git a/setup.py b/setup.py index f1a8a499..299eba8b 100644 --- a/setup.py +++ b/setup.py @@ -25,15 +25,15 @@ "mock==4.0.3", "pretend==1.0.9", "coverage[toml]>=6.2", - "pytest-cov==3.0.0", - "pytest==7.0.1", + "pytest-cov==5.0.0", + "pytest==8.1.1", # Linting "isort==5.10.1", "flake8==4.0.1", "flake8-blind-except==0.2.0", "flake8-debugger==4.0.0", "flake8-imports==0.1.1", - "mypy==0.931", + "mypy==1.9.0", ] @@ -44,7 +44,7 @@ setup( name="commercetools", - version="2023.6.29", + version="2024.4.6", description="SDK for Commercetools", long_description=long_description, author="Lab Digital B.V.", @@ -68,7 +68,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", ], zip_safe=False, diff --git a/src/commercetools/__init__.py b/src/commercetools/__init__.py index 3928bba7..ee0ae953 100644 --- a/src/commercetools/__init__.py +++ b/src/commercetools/__init__.py @@ -1,5 +1,4 @@ -from .client import Client from .exceptions import CommercetoolsError from .version import __version__ -__all__ = ["Client", "CommercetoolsError"] +__all__ = ["CommercetoolsError"] diff --git a/src/commercetools/base_client.py b/src/commercetools/base_client.py index eee950e6..6fbb62dd 100644 --- a/src/commercetools/base_client.py +++ b/src/commercetools/base_client.py @@ -11,7 +11,6 @@ from commercetools.constants import HEADER_CORRELATION_ID from commercetools.exceptions import CommercetoolsError from commercetools.helpers import _concurrent_retry -from commercetools.services import ServicesMixin from commercetools.utils import BaseTokenSaver, DefaultTokenSaver, fix_token_url from commercetools.version import __version__ @@ -26,7 +25,6 @@ def refresh_token(self, token_url, **kwargs): class BaseClient: """The Commercetools Client, used to interact with the Commercetools API. - :param project_key: the key for the project with which you want to interact :param client_id: the oauth2 client id :param client_secret: the oauth2 client secret :param scope: the oauth2 scope. If None then 'manage_project:{project_key}' @@ -42,7 +40,6 @@ class BaseClient: def __init__( self, - project_key: str = None, client_id: str = None, client_secret: str = None, scope: typing.List[str] = None, @@ -53,7 +50,6 @@ def __init__( ) -> None: # Use environment variables as fallback config = { - "project_key": project_key, "client_id": client_id, "client_secret": client_secret, "url": url, @@ -61,7 +57,7 @@ def __init__( "scope": scope, } # Make sure we use the config vars - del project_key, client_id, client_secret, url, token_url, scope + del client_id, client_secret, url, token_url, scope self._config = self._read_env_vars(config) self._config["token_url"] = fix_token_url(self._config["token_url"]) @@ -193,9 +189,6 @@ def _create_exception(self, obj, response) -> CommercetoolsError: return CommercetoolsError(obj.message, errors_raw, obj, correlation_id) def _read_env_vars(self, config: dict) -> dict: - if not config.get("project_key"): - config["project_key"] = os.environ.get("CTP_PROJECT_KEY") - if not config.get("client_id"): config["client_id"] = os.environ.get("CTP_CLIENT_ID") @@ -212,8 +205,6 @@ def _read_env_vars(self, config: dict) -> dict: config["scope"] = os.environ.get("CTP_SCOPES") if config["scope"]: config["scope"] = config["scope"].split(",") - else: - config["scope"] = ["manage_project:%s" % config["project_key"]] for key, value in config.items(): if value is None: @@ -231,9 +222,3 @@ def _get_user_agent(self): sys.platform, arch, ) - - -class Client(BaseClient, ServicesMixin): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self._base_url = f"{self._config['url']}/{self._config['project_key']}/" diff --git a/src/commercetools/checkout/client/__init__.py b/src/commercetools/checkout/client/__init__.py deleted file mode 100644 index 94d94053..00000000 --- a/src/commercetools/checkout/client/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -from commercetools.client import BaseClient - - -class Client(BaseClient): - def __init__(self, *args, **kwargs): - kwargs.setdefault("url", "https://checkout.{region}.commercetools.com") - super().__init__(self, **kwargs) diff --git a/src/commercetools/checkout/models/_schemas/responses.py b/src/commercetools/checkout/models/_schemas/responses.py deleted file mode 100644 index aa4b9122..00000000 --- a/src/commercetools/checkout/models/_schemas/responses.py +++ /dev/null @@ -1,275 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models - -# Fields - - -# Marshmallow Schemas -class ResponseMessageSchema(helpers.BaseSchema): - code = marshmallow.fields.String(allow_none=True, load_default=None) - type = marshmallow.fields.String(allow_none=True, load_default=None) - message = marshmallow.fields.String(allow_none=True, load_default=None) - payload = marshmallow.fields.Raw( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.ResponseMessage(**data) - - -class AdyenBadConfigSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.AdyenBadConfig(**data) - - -class AdyenInitErrorSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.AdyenInitError(**data) - - -class AdyenTimeoutSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.AdyenTimeout(**data) - - -class ApplicationDeactivatedSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.ApplicationDeactivated(**data) - - -class ApplicationNotFoundSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.ApplicationNotFound(**data) - - -class CartEmptiedDuringCheckoutSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.CartEmptiedDuringCheckout(**data) - - -class CartEmptySchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.CartEmpty(**data) - - -class CartNotFoundSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.CartNotFound(**data) - - -class CheckoutCancelledSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.CheckoutCancelled(**data) - - -class CheckoutCompletedSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.CheckoutCompleted(**data) - - -class CheckoutLoadedSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.CheckoutLoaded(**data) - - -class CheckoutStartedSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.CheckoutStarted(**data) - - -class InitTimeoutSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.InitTimeout(**data) - - -class BadInputDataSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.BadInputData(**data) - - -class InvalidTokenSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.InvalidToken(**data) - - -class NoAllowedOriginsSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.NoAllowedOrigins(**data) - - -class NoPaymentMethodsSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.NoPaymentMethods(**data) - - -class NoShippingMethodsSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.NoShippingMethods(**data) - - -class OrderCreatedSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.OrderCreated(**data) - - -class SellerIsDeactivatedSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.SellerIsDeactivated(**data) - - -class SellerNotFoundSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.SellerNotFound(**data) - - -class ShippingAddressMissingSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.ShippingAddressMissing(**data) - - -class UnallowedOriginSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.UnallowedOrigin(**data) - - -class UnavailableLocaleSchema(ResponseMessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["code"] - return models.UnavailableLocale(**data) diff --git a/src/commercetools/checkout/models/common.py b/src/commercetools/checkout/models/common.py new file mode 100644 index 00000000..a66f814a --- /dev/null +++ b/src/commercetools/checkout/models/common.py @@ -0,0 +1,87 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +__all__ = ["Amount", "PaymentAction", "PaymentOperation", "Region"] + + +class Region(enum.Enum): + """The Region in which the Checkout application is [hosted](/../checkout/hosts-and-authorization).""" + + EUROPE_WEST1.GCP = "europe-west1.gcp" + US_CENTRAL1.GCP = "us-central1.gcp" + AUSTRALIA_SOUTHEAST1.GCP = "australia-southeast1.gcp" + + +class Amount(_BaseType): + """The amount related to a [payment action](ctp:checkout:type:PaymentAction).""" + + #: Amount in the smallest indivisible unit of a currency, such as: + #: + #: * Cents for EUR and USD, pence for GBP, or centime for CHF (5 CHF is specified as `500`). + #: * The value in the major unit for currencies without minor units, like JPY (5 JPY is specified as `5`). + cent_amount: int + #: Currency code compliant to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). + currency_code: str + + def __init__(self, *, cent_amount: int, currency_code: str): + self.cent_amount = cent_amount + self.currency_code = currency_code + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Amount": + from ._schemas.common import AmountSchema + + return AmountSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AmountSchema + + return AmountSchema().dump(self) + + +class PaymentOperation(enum.Enum): + """The possible values for a [payment action](ctp:checkout:type:PaymentAction).""" + + CAPTURE_PAYMENT = "capturePayment" + REFUND_PAYMENT = "refundPayment" + CANCEL_PAYMENT = "cancelPayment" + + +class PaymentAction(_BaseType): + """Depending on the action specified, Checkout requests the [payment service provider](/../checkout/payment-connectors-applications#supported-psps-and-payment-methods) (PSP) to capture, refund, or cancel the authorization for the given Payment.""" + + #: Action to execute for the given Payment. + action: "PaymentOperation" + #: Amount to be captured or refunded. + amount: typing.Optional["Amount"] + + def __init__( + self, *, action: "PaymentOperation", amount: typing.Optional["Amount"] = None + ): + self.action = action + self.amount = amount + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentAction": + from ._schemas.common import PaymentActionSchema + + return PaymentActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import PaymentActionSchema + + return PaymentActionSchema().dump(self) diff --git a/src/commercetools/checkout/models/error.py b/src/commercetools/checkout/models/error.py new file mode 100644 index 00000000..041fe609 --- /dev/null +++ b/src/commercetools/checkout/models/error.py @@ -0,0 +1,145 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +__all__ = [ + "ErrorObject", + "GeneralError", + "MultipleActionsNotAllowedError", + "RequiredFieldError", + "ResourceNotFoundError", +] + + +class ErrorObject(_BaseType): + """This is the representation of a single error.""" + + #: Error identifier. + code: str + #: Plain text description of the cause of the error. + message: str + + def __init__(self, *, code: str, message: str): + self.code = code + self.message = message + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ErrorObject": + if data["code"] == "General": + from ._schemas.error import GeneralErrorSchema + + return GeneralErrorSchema().load(data) + if data["code"] == "MultipleActionsNotAllowed": + from ._schemas.error import MultipleActionsNotAllowedErrorSchema + + return MultipleActionsNotAllowedErrorSchema().load(data) + if data["code"] == "RequiredField": + from ._schemas.error import RequiredFieldErrorSchema + + return RequiredFieldErrorSchema().load(data) + if data["code"] == "ResourceNotFound": + from ._schemas.error import ResourceNotFoundErrorSchema + + return ResourceNotFoundErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ErrorObjectSchema + + return ErrorObjectSchema().dump(self) + + +class GeneralError(ErrorObject): + """Returned when a server-side problem occurs. In some cases, the requested action may successfully complete after the error is returned. Therefore, it is recommended to verify the status of the requested resource after receiving a 500 error. + + If you encounter this error, report it to the [Checkout support team](https://support.commercetools.com/). + + """ + + def __init__(self, *, message: str): + + super().__init__(message=message, code="General") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "GeneralError": + from ._schemas.error import GeneralErrorSchema + + return GeneralErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import GeneralErrorSchema + + return GeneralErrorSchema().dump(self) + + +class MultipleActionsNotAllowedError(ErrorObject): + """Returned when `actions` in the request body contains more than one object.""" + + def __init__(self, *, message: str): + + super().__init__(message=message, code="MultipleActionsNotAllowed") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "MultipleActionsNotAllowedError": + from ._schemas.error import MultipleActionsNotAllowedErrorSchema + + return MultipleActionsNotAllowedErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import MultipleActionsNotAllowedErrorSchema + + return MultipleActionsNotAllowedErrorSchema().dump(self) + + +class RequiredFieldError(ErrorObject): + """Returned when a value is not defined for a required field.""" + + #: Name of the field missing the value. + field: str + + def __init__(self, *, message: str, field: str): + self.field = field + + super().__init__(message=message, code="RequiredField") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RequiredFieldError": + from ._schemas.error import RequiredFieldErrorSchema + + return RequiredFieldErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import RequiredFieldErrorSchema + + return RequiredFieldErrorSchema().dump(self) + + +class ResourceNotFoundError(ErrorObject): + """Returned when the resource addressed by the request URL does not exist.""" + + def __init__(self, *, message: str): + + super().__init__(message=message, code="ResourceNotFound") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResourceNotFoundError": + from ._schemas.error import ResourceNotFoundErrorSchema + + return ResourceNotFoundErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ResourceNotFoundErrorSchema + + return ResourceNotFoundErrorSchema().dump(self) diff --git a/src/commercetools/checkout/models/payments.py b/src/commercetools/checkout/models/payments.py new file mode 100644 index 00000000..b1d60ef9 --- /dev/null +++ b/src/commercetools/checkout/models/payments.py @@ -0,0 +1,113 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +if typing.TYPE_CHECKING: + from . import Amount + from .common import PaymentAction + +__all__ = [ + "CancelPaymentAction", + "CapturePaymentAction", + "Payment", + "RefundPaymentAction", +] + + +class CapturePaymentAction(_BaseType): + """Requests to [capture](/payments-lifecycle#payment-capture) the given amount from the customer. Checkout will request the PSP to proceed with the financial process to capture the amount.""" + + #: Amount to be captured. It must be less than or equal to the [authorized](/payments-lifecycle#authorization) amount. + amount: "Amount" + + def __init__(self, *, amount: "Amount"): + self.amount = amount + + super().__init__(action="capturePayment") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CapturePaymentAction": + from ._schemas.payments import CapturePaymentActionSchema + + return CapturePaymentActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.payments import CapturePaymentActionSchema + + return CapturePaymentActionSchema().dump(self) + + +class RefundPaymentAction(_BaseType): + """Requests to [refund](/payments-lifecycle#refund) the given amount to the customer. Checkout will request the PSP to proceed with the financial process to refund the amount.""" + + #: Amount to be refunded. It must be less than or equal to the [captured](/payments-lifecycle#payment-capture) amount. + amount: typing.Optional["Amount"] + + def __init__(self, *, amount: typing.Optional["Amount"] = None): + self.amount = amount + + super().__init__(action="refundPayment") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RefundPaymentAction": + from ._schemas.payments import RefundPaymentActionSchema + + return RefundPaymentActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.payments import RefundPaymentActionSchema + + return RefundPaymentActionSchema().dump(self) + + +class CancelPaymentAction(_BaseType): + """Requests to [cancel the authorization](/payments-lifecycle#authorization-cancellation) for a Payment. Checkout will cancel the [Payment](/../api/projects/payments#payment) and will request the PSP to proceed with the financial process to cancel the authorization. + + You cannot request to cancel the authorization for a Payment that has already been [captured](/payments-lifecycle#payment-capture). + + """ + + def __init__(self): + + super().__init__(action="cancelPayment") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CancelPaymentAction": + from ._schemas.payments import CancelPaymentActionSchema + + return CancelPaymentActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.payments import CancelPaymentActionSchema + + return CancelPaymentActionSchema().dump(self) + + +class Payment(_BaseType): + #: Action to execute for the given Payment. + actions: typing.List["PaymentAction"] + + def __init__(self, *, actions: typing.List["PaymentAction"]): + self.actions = actions + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Payment": + from ._schemas.payments import PaymentSchema + + return PaymentSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.payments import PaymentSchema + + return PaymentSchema().dump(self) diff --git a/src/commercetools/checkout/models/responses.py b/src/commercetools/checkout/models/responses.py index c6ddfada..5b52f6af 100644 --- a/src/commercetools/checkout/models/responses.py +++ b/src/commercetools/checkout/models/responses.py @@ -12,102 +12,73 @@ from ._abstract import _BaseType __all__ = [ - "AdyenBadConfig", - "AdyenInitError", - "AdyenTimeout", "ApplicationDeactivated", "ApplicationNotFound", "BadInputData", "CartEmptiedDuringCheckout", "CartEmpty", "CartNotFound", + "CartWithExistingPayment", "CheckoutCancelled", "CheckoutCompleted", "CheckoutLoaded", "CheckoutStarted", + "DeprecatedFields", + "ExternalTermsAndConditionsPending", + "InitError", "InitTimeout", + "InvalidMode", "InvalidToken", - "NoAllowedOrigins", + "Message", "NoPaymentMethods", "NoShippingMethods", "OrderCreated", + "OrderCreationError", + "PaymentCancelled", + "PaymentConnectorError", + "PaymentFailed", + "PaymentMethodLoaded", + "PaymentMethodLoading", + "PaymentMethodLoadingError", + "PaymentMethodSelected", + "PaymentMethodSelectionConfirmation", + "PaymentMethodSelectionConfirmationFailed", + "PaymentMethodsReceived", + "PaymentStarted", + "PaymentValidationFailed", + "PaymentValidationPassed", + "PaymentValidationStarted", + "PaymentVerificationStarted", + "PaymentVerificationTimeout", + "ProjectIsDeactivated", "ResponseMessage", - "SellerIsDeactivated", - "SellerNotFound", - "ShippingAddressMissing", - "UnallowedOrigin", + "SetShippingAddressError", "UnavailableLocale", + "UnsupportedCountry", ] -class ResponseMessage(_BaseType): - #: The message code for the event. +class Message(_BaseType): + #: The Message code for the event. code: str - #: A string with the following pattern `{level}:{entity}:{subtype}` where `{level}` can be `info`, `warn`, or `error`. - #: This field allows filtering messages from a more generic to a more specific type. Messages for different events can be of the same `type`. - type: str + #: The severity level of the event. It can be `info`, `warn`, or `error`. + severity: str #: A human-readable description of the event. message: str - #: An object containing additional data about the event. - payload: typing.Optional[object] - - def __init__( - self, - *, - code: str, - type: str, - message: str, - payload: typing.Optional[object] = None - ): + + def __init__(self, *, code: str, severity: str, message: str): self.code = code - self.type = type + self.severity = severity self.message = message - self.payload = payload super().__init__() @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResponseMessage": - if data["code"] == "adyen_bad_config": - from ._schemas.responses import AdyenBadConfigSchema - - return AdyenBadConfigSchema().load(data) - if data["code"] == "adyen_init_error": - from ._schemas.responses import AdyenInitErrorSchema - - return AdyenInitErrorSchema().load(data) - if data["code"] == "adyen_timeout": - from ._schemas.responses import AdyenTimeoutSchema - - return AdyenTimeoutSchema().load(data) - if data["code"] == "application_disabled": - from ._schemas.responses import ApplicationDeactivatedSchema - - return ApplicationDeactivatedSchema().load(data) - if data["code"] == "application_not_found": - from ._schemas.responses import ApplicationNotFoundSchema - - return ApplicationNotFoundSchema().load(data) - if data["code"] == "cart_emptied_during_checkout": - from ._schemas.responses import CartEmptiedDuringCheckoutSchema - - return CartEmptiedDuringCheckoutSchema().load(data) - if data["code"] == "cart_empty": - from ._schemas.responses import CartEmptySchema - - return CartEmptySchema().load(data) - if data["code"] == "cart_not_found": - from ._schemas.responses import CartNotFoundSchema - - return CartNotFoundSchema().load(data) + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Message": if data["code"] == "checkout_cancelled": from ._schemas.responses import CheckoutCancelledSchema return CheckoutCancelledSchema().load(data) - if data["code"] == "checkout_completed": - from ._schemas.responses import CheckoutCompletedSchema - - return CheckoutCompletedSchema().load(data) if data["code"] == "checkout_loaded": from ._schemas.responses import CheckoutLoadedSchema @@ -120,131 +91,191 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResponseMessage": from ._schemas.responses import InitTimeoutSchema return InitTimeoutSchema().load(data) - if data["code"] == "invalid_fields": - from ._schemas.responses import BadInputDataSchema + if data["code"] == "invalid_mode": + from ._schemas.responses import InvalidModeSchema - return BadInputDataSchema().load(data) + return InvalidModeSchema().load(data) if data["code"] == "invalid_token": from ._schemas.responses import InvalidTokenSchema return InvalidTokenSchema().load(data) - if data["code"] == "no_allowed_origins": - from ._schemas.responses import NoAllowedOriginsSchema - - return NoAllowedOriginsSchema().load(data) if data["code"] == "no_payment_methods": from ._schemas.responses import NoPaymentMethodsSchema return NoPaymentMethodsSchema().load(data) - if data["code"] == "no_shipping_methods": - from ._schemas.responses import NoShippingMethodsSchema + if data["code"] == "payment_failed": + from ._schemas.responses import PaymentFailedSchema - return NoShippingMethodsSchema().load(data) - if data["code"] == "order_created": - from ._schemas.responses import OrderCreatedSchema + return PaymentFailedSchema().load(data) + if data["code"] == "init_error": + from ._schemas.responses import InitErrorSchema - return OrderCreatedSchema().load(data) - if data["code"] == "seller_deactivated": - from ._schemas.responses import SellerIsDeactivatedSchema + return InitErrorSchema().load(data) + if data["code"] == "payment_cancelled": + from ._schemas.responses import PaymentCancelledSchema - return SellerIsDeactivatedSchema().load(data) - if data["code"] == "seller_not_found": - from ._schemas.responses import SellerNotFoundSchema + return PaymentCancelledSchema().load(data) + if data["code"] == "payment_validation_failed": + from ._schemas.responses import PaymentValidationFailedSchema - return SellerNotFoundSchema().load(data) - if data["code"] == "shipping_address_missing": - from ._schemas.responses import ShippingAddressMissingSchema + return PaymentValidationFailedSchema().load(data) + if data["code"] == "payment_validation_passed": + from ._schemas.responses import PaymentValidationPassedSchema - return ShippingAddressMissingSchema().load(data) - if data["code"] == "unallowed_origin": - from ._schemas.responses import UnallowedOriginSchema + return PaymentValidationPassedSchema().load(data) + if data["code"] == "payment_validation_started": + from ._schemas.responses import PaymentValidationStartedSchema - return UnallowedOriginSchema().load(data) - if data["code"] == "unavailable_locale": - from ._schemas.responses import UnavailableLocaleSchema + return PaymentValidationStartedSchema().load(data) + if data["code"] == "payment_verification_started": + from ._schemas.responses import PaymentVerificationStartedSchema - return UnavailableLocaleSchema().load(data) + return PaymentVerificationStartedSchema().load(data) + if data["code"] == "payment_verification_timeout": + from ._schemas.responses import PaymentVerificationTimeoutSchema + + return PaymentVerificationTimeoutSchema().load(data) + if data["code"] == "external_terms_and_conditions_pending": + from ._schemas.responses import ExternalTermsAndConditionsPendingSchema + + return ExternalTermsAndConditionsPendingSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import ResponseMessageSchema + from ._schemas.responses import MessageSchema - return ResponseMessageSchema().dump(self) + return MessageSchema().dump(self) -class AdyenBadConfig(ResponseMessage): - """Generated when the configuration used to initialize Adyen contains at least one invalid field.""" +class ResponseMessage(Message): + #: Additional data about the event. + payload: object - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="adyen_bad_config" - ) + def __init__(self, *, code: str, severity: str, message: str, payload: object): + self.payload = payload + + super().__init__(code=code, severity=severity, message=message) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AdyenBadConfig": - from ._schemas.responses import AdyenBadConfigSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResponseMessage": + if data["code"] == "application_disabled": + from ._schemas.responses import ApplicationDeactivatedSchema - return AdyenBadConfigSchema().load(data) + return ApplicationDeactivatedSchema().load(data) + if data["code"] == "application_not_found": + from ._schemas.responses import ApplicationNotFoundSchema - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import AdyenBadConfigSchema + return ApplicationNotFoundSchema().load(data) + if data["code"] == "cart_emptied_during_checkout": + from ._schemas.responses import CartEmptiedDuringCheckoutSchema - return AdyenBadConfigSchema().dump(self) + return CartEmptiedDuringCheckoutSchema().load(data) + if data["code"] == "cart_empty": + from ._schemas.responses import CartEmptySchema + return CartEmptySchema().load(data) + if data["code"] == "cart_not_found": + from ._schemas.responses import CartNotFoundSchema -class AdyenInitError(ResponseMessage): - """Generated when Adyen cannot be initialized.""" + return CartNotFoundSchema().load(data) + if data["code"] == "checkout_completed": + from ._schemas.responses import CheckoutCompletedSchema - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="adyen_init_error" - ) + return CheckoutCompletedSchema().load(data) + if data["code"] == "invalid_fields": + from ._schemas.responses import BadInputDataSchema - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AdyenInitError": - from ._schemas.responses import AdyenInitErrorSchema + return BadInputDataSchema().load(data) + if data["code"] == "payment_started": + from ._schemas.responses import PaymentStartedSchema - return AdyenInitErrorSchema().load(data) + return PaymentStartedSchema().load(data) + if data["code"] == "payment_connector_error": + from ._schemas.responses import PaymentConnectorErrorSchema - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import AdyenInitErrorSchema + return PaymentConnectorErrorSchema().load(data) + if data["code"] == "payment_method_loaded": + from ._schemas.responses import PaymentMethodLoadedSchema - return AdyenInitErrorSchema().dump(self) + return PaymentMethodLoadedSchema().load(data) + if data["code"] == "payment_method_loading": + from ._schemas.responses import PaymentMethodLoadingSchema + return PaymentMethodLoadingSchema().load(data) + if data["code"] == "payment_method_loading_error": + from ._schemas.responses import PaymentMethodLoadingErrorSchema -class AdyenTimeout(ResponseMessage): - """Generated when a timeout error occurs while initializing Adyen.""" + return PaymentMethodLoadingErrorSchema().load(data) + if data["code"] == "payment_method_selected": + from ._schemas.responses import PaymentMethodSelectedSchema - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="adyen_timeout" - ) + return PaymentMethodSelectedSchema().load(data) + if data["code"] == "payment_method_selection_confirmation": + from ._schemas.responses import PaymentMethodSelectionConfirmationSchema - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AdyenTimeout": - from ._schemas.responses import AdyenTimeoutSchema + return PaymentMethodSelectionConfirmationSchema().load(data) + if data["code"] == "payment_method_selection_confirmation_failed": + from ._schemas.responses import ( + PaymentMethodSelectionConfirmationFailedSchema, + ) + + return PaymentMethodSelectionConfirmationFailedSchema().load(data) + if data["code"] == "payment_methods_received": + from ._schemas.responses import PaymentMethodsReceivedSchema + + return PaymentMethodsReceivedSchema().load(data) + if data["code"] == "set_shipping_address_error": + from ._schemas.responses import SetShippingAddressErrorSchema + + return SetShippingAddressErrorSchema().load(data) + if data["code"] == "no_shipping_methods": + from ._schemas.responses import NoShippingMethodsSchema + + return NoShippingMethodsSchema().load(data) + if data["code"] == "order_created": + from ._schemas.responses import OrderCreatedSchema + + return OrderCreatedSchema().load(data) + if data["code"] == "project_deactivated": + from ._schemas.responses import ProjectIsDeactivatedSchema + + return ProjectIsDeactivatedSchema().load(data) + if data["code"] == "unavailable_locale": + from ._schemas.responses import UnavailableLocaleSchema + + return UnavailableLocaleSchema().load(data) + if data["code"] == "deprecated_fields": + from ._schemas.responses import DeprecatedFieldsSchema + + return DeprecatedFieldsSchema().load(data) + if data["code"] == "order_creation_error": + from ._schemas.responses import OrderCreationErrorSchema + + return OrderCreationErrorSchema().load(data) + if data["code"] == "cart_with_exisiting_payment": + from ._schemas.responses import CartWithExistingPaymentSchema - return AdyenTimeoutSchema().load(data) + return CartWithExistingPaymentSchema().load(data) + if data["code"] == "unsupported_country": + from ._schemas.responses import UnsupportedCountrySchema + + return UnsupportedCountrySchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import AdyenTimeoutSchema + from ._schemas.responses import ResponseMessageSchema - return AdyenTimeoutSchema().dump(self) + return ResponseMessageSchema().dump(self) class ApplicationDeactivated(ResponseMessage): - """Generated when the requested application is deactivated. Activate the application in the Merchant Center to continue.""" + """Generated when the requested [Application](/payment-connectors-applications#applications) is deactivated. Activate the Application in the Merchant Center to continue.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="application_disabled" + severity=severity, + message=message, + payload=payload, + code="application_disabled", ) @classmethod @@ -262,13 +293,15 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ApplicationNotFound(ResponseMessage): - """Generated when the requested application is not found. The application may have been deleted or its configuration is incorrect.""" + """Generated when the requested [Application](/payment-connectors-applications#applications) is not found. The Application may have been deleted or its configuration is incorrect.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="application_not_found" + severity=severity, + message=message, + payload=payload, + code="application_not_found", ) @classmethod @@ -284,13 +317,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartEmptiedDuringCheckout(ResponseMessage): - """Generated when the Cart was emptied during the checkout. It is not possible to recover from this, the customer must restart the checkout process.""" + """Generated when the [Cart](/../api/projects/carts) was emptied during the checkout process. It is not possible to recover from this, the customer must restart the checkout process.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, + severity=severity, message=message, payload=payload, code="cart_emptied_during_checkout", @@ -311,12 +343,13 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartEmpty(ResponseMessage): - """Generated when the Cart for the current checkout is empty. The Cart must contain at least one Line Item.""" + """Generated when the [Cart](/../api/projects/carts) for the current checkout is empty. The Cart must contain at least one [Line Item](/../api/carts-orders-overview#line-items).""" - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__(type=type, message=message, payload=payload, code="cart_empty") + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, message=message, payload=payload, code="cart_empty" + ) @classmethod def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CartEmpty": @@ -331,13 +364,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartNotFound(ResponseMessage): - """Generated when the Cart is not found. A valid Cart with at least one Line Item is required to start the checkout.""" + """Generated when the [Cart](/../api/projects/carts) is not found. To start the checkout process, a valid Cart with at least one [Line Item](/../api/carts-orders-overview#line-items) is required.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="cart_not_found" + severity=severity, message=message, payload=payload, code="cart_not_found" ) @classmethod @@ -352,15 +384,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return CartNotFoundSchema().dump(self) -class CheckoutCancelled(ResponseMessage): - """Generated when the customer cancels the checkout.""" +class CheckoutCancelled(Message): + """Generated when the customer cancels the checkout process.""" - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="checkout_cancelled" - ) + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="checkout_cancelled") @classmethod def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CheckoutCancelled": @@ -375,13 +404,15 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CheckoutCompleted(ResponseMessage): - """Generated when the customer completes the checkout.""" + """Generated when the customer completes the checkout process.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="checkout_completed" + severity=severity, + message=message, + payload=payload, + code="checkout_completed", ) @classmethod @@ -396,15 +427,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return CheckoutCompletedSchema().dump(self) -class CheckoutLoaded(ResponseMessage): - """Generated when the checkout was loaded successfully and it is waiting for the configuration parameters passed through the `checkoutConfig` object.""" +class CheckoutLoaded(Message): + """Generated when Checkout is loaded and waiting for the configuration properties to be passed with the `checkoutFlow` or `paymentFlow` [method](/sdk).""" - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="checkout_loaded" - ) + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="checkout_loaded") @classmethod def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CheckoutLoaded": @@ -418,15 +446,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return CheckoutLoadedSchema().dump(self) -class CheckoutStarted(ResponseMessage): - """Generated when the checkout receives the configuration parameters passed through the `checkoutConfig` object and starts successfully.""" +class CheckoutStarted(Message): + """Generated when the configuration properties are passed successfully with the `checkoutFlow` or `paymentFlow` [method](/sdk) and the checkout process starts.""" - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="checkout_started" - ) + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="checkout_started") @classmethod def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CheckoutStarted": @@ -440,15 +465,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return CheckoutStartedSchema().dump(self) -class InitTimeout(ResponseMessage): - """Generated when the checkout has not received the configuration parameters passed through the `checkoutConfig` object on time.""" +class InitTimeout(Message): + """Generated when Checkout does not receive the configuration properties with the `checkoutFlow` or `paymentFlow` [method](/sdk) on time.""" - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="init_timeout" - ) + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="init_timeout") @classmethod def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "InitTimeout": @@ -462,14 +484,32 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return InitTimeoutSchema().dump(self) +class InvalidMode(Message): + """Generated when the Application does not support the requested Checkout [mode](/../checkout/overview#complete-checkout-and-payment-only-modes).""" + + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="invalid_mode") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "InvalidMode": + from ._schemas.responses import InvalidModeSchema + + return InvalidModeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import InvalidModeSchema + + return InvalidModeSchema().dump(self) + + class BadInputData(ResponseMessage): - """Generated when the `checkoutConfig` object contains one or more invalid fields.""" + """Generated when the `checkoutConfig` [object](/sdk) contains one or more invalid fields.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="invalid_fields" + severity=severity, message=message, payload=payload, code="invalid_fields" ) @classmethod @@ -484,15 +524,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return BadInputDataSchema().dump(self) -class InvalidToken(ResponseMessage): +class InvalidToken(Message): """Generated when the `accessToken` is invalid.""" - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): - super().__init__( - type=type, message=message, payload=payload, code="invalid_token" - ) + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="invalid_token") @classmethod def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "InvalidToken": @@ -506,58 +543,479 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return InvalidTokenSchema().dump(self) -class NoAllowedOrigins(ResponseMessage): - """Generated when there are no allowed origins configured for the current application. Add at least one **Origin URL** in your [application settings in the Merchant Center](/configuring-checkout#applications).""" +class NoPaymentMethods(Message): + """Generated when no payment method is set up for an [Application](/payment-connectors-applications#applications). Add at least one **Payment method** to the Application in the Merchant Center.""" + + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="no_payment_methods") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "NoPaymentMethods": + from ._schemas.responses import NoPaymentMethodsSchema + + return NoPaymentMethodsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import NoPaymentMethodsSchema + + return NoPaymentMethodsSchema().dump(self) + + +class PaymentFailed(Message): + """Generated when the payment fails.""" + + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="payment_failed") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentFailed": + from ._schemas.responses import PaymentFailedSchema + + return PaymentFailedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentFailedSchema + + return PaymentFailedSchema().dump(self) + + +class PaymentStarted(ResponseMessage): + """Generated when the payment starts.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="no_allowed_origins" + severity=severity, message=message, payload=payload, code="payment_started" ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "NoAllowedOrigins": - from ._schemas.responses import NoAllowedOriginsSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentStarted": + from ._schemas.responses import PaymentStartedSchema - return NoAllowedOriginsSchema().load(data) + return PaymentStartedSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import NoAllowedOriginsSchema + from ._schemas.responses import PaymentStartedSchema + + return PaymentStartedSchema().dump(self) + - return NoAllowedOriginsSchema().dump(self) +class InitError(Message): + """Generated when an error occurs during Checkout's initialization.""" + def __init__(self, *, severity: str, message: str): -class NoPaymentMethods(ResponseMessage): - """Generated when there are no payment methods available. Add at least one **Payment method** in your [application settings in the Merchant Center](/configuring-checkout#payment-connector).""" + super().__init__(severity=severity, message=message, code="init_error") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "InitError": + from ._schemas.responses import InitErrorSchema + + return InitErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import InitErrorSchema + + return InitErrorSchema().dump(self) + + +class PaymentConnectorError(ResponseMessage): + """Generated when the [payment Connector](/../checkout/payment-connectors-applications#payment-connectors) triggers an error.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="no_payment_methods" + severity=severity, + message=message, + payload=payload, + code="payment_connector_error", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "NoPaymentMethods": - from ._schemas.responses import NoPaymentMethodsSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentConnectorError": + from ._schemas.responses import PaymentConnectorErrorSchema - return NoPaymentMethodsSchema().load(data) + return PaymentConnectorErrorSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import NoPaymentMethodsSchema + from ._schemas.responses import PaymentConnectorErrorSchema - return NoPaymentMethodsSchema().dump(self) + return PaymentConnectorErrorSchema().dump(self) + + +class PaymentMethodLoaded(ResponseMessage): + """Generated when the selected payment method is loaded.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="payment_method_loaded", + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentMethodLoaded": + from ._schemas.responses import PaymentMethodLoadedSchema + + return PaymentMethodLoadedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentMethodLoadedSchema + + return PaymentMethodLoadedSchema().dump(self) + + +class PaymentMethodLoading(ResponseMessage): + """Generated when the selected payment method is loading.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="payment_method_loading", + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentMethodLoading": + from ._schemas.responses import PaymentMethodLoadingSchema + + return PaymentMethodLoadingSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentMethodLoadingSchema + + return PaymentMethodLoadingSchema().dump(self) + + +class PaymentMethodLoadingError(ResponseMessage): + """Generated when the loading of the selected payment method fails.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="payment_method_loading_error", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentMethodLoadingError": + from ._schemas.responses import PaymentMethodLoadingErrorSchema + + return PaymentMethodLoadingErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentMethodLoadingErrorSchema + + return PaymentMethodLoadingErrorSchema().dump(self) + + +class PaymentMethodSelected(ResponseMessage): + """Generated when the customer selects the payment method.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="payment_method_selected", + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentMethodSelected": + from ._schemas.responses import PaymentMethodSelectedSchema + + return PaymentMethodSelectedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentMethodSelectedSchema + + return PaymentMethodSelectedSchema().dump(self) + + +class PaymentMethodSelectionConfirmation(ResponseMessage): + """Generated when the customer has entered the payment method information and moves to the next step.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="payment_method_selection_confirmation", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentMethodSelectionConfirmation": + from ._schemas.responses import PaymentMethodSelectionConfirmationSchema + + return PaymentMethodSelectionConfirmationSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentMethodSelectionConfirmationSchema + + return PaymentMethodSelectionConfirmationSchema().dump(self) + + +class PaymentMethodSelectionConfirmationFailed(ResponseMessage): + """Generated when an error occurs when the customer selects the payment method.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="payment_method_selection_confirmation_failed", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentMethodSelectionConfirmationFailed": + from ._schemas.responses import PaymentMethodSelectionConfirmationFailedSchema + + return PaymentMethodSelectionConfirmationFailedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentMethodSelectionConfirmationFailedSchema + + return PaymentMethodSelectionConfirmationFailedSchema().dump(self) + + +class PaymentMethodsReceived(ResponseMessage): + """Generated when Checkout receives and loads the payment methods configured for the Application.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="payment_methods_received", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentMethodsReceived": + from ._schemas.responses import PaymentMethodsReceivedSchema + + return PaymentMethodsReceivedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentMethodsReceivedSchema + + return PaymentMethodsReceivedSchema().dump(self) + + +class PaymentCancelled(Message): + """Generated when the customer cancels the payment (for example, by closing the browser's window).""" + + def __init__(self, *, severity: str, message: str): + + super().__init__(severity=severity, message=message, code="payment_cancelled") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentCancelled": + from ._schemas.responses import PaymentCancelledSchema + + return PaymentCancelledSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentCancelledSchema + + return PaymentCancelledSchema().dump(self) + + +class PaymentValidationFailed(Message): + """Generated when Checkout and the payment service provider (PSP) do not validate the payment information entered by the customer.""" + + def __init__(self, *, severity: str, message: str): + + super().__init__( + severity=severity, message=message, code="payment_validation_failed" + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentValidationFailed": + from ._schemas.responses import PaymentValidationFailedSchema + + return PaymentValidationFailedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentValidationFailedSchema + + return PaymentValidationFailedSchema().dump(self) + + +class PaymentValidationPassed(Message): + """Generated when Checkout and the payment service provider (PSP) validate the payment information entered by the customer.""" + + def __init__(self, *, severity: str, message: str): + + super().__init__( + severity=severity, message=message, code="payment_validation_passed" + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentValidationPassed": + from ._schemas.responses import PaymentValidationPassedSchema + + return PaymentValidationPassedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentValidationPassedSchema + + return PaymentValidationPassedSchema().dump(self) + + +class PaymentValidationStarted(Message): + """Generated when the validation of the payment information entered by the customer starts.""" + + def __init__(self, *, severity: str, message: str): + + super().__init__( + severity=severity, message=message, code="payment_validation_started" + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentValidationStarted": + from ._schemas.responses import PaymentValidationStartedSchema + + return PaymentValidationStartedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentValidationStartedSchema + + return PaymentValidationStartedSchema().dump(self) + + +class PaymentVerificationStarted(Message): + """Generated when Checkout starts verifying the payment [authorization](/payments-lifecycle#authorization) given by the payment service provider (PSP).""" + + def __init__(self, *, severity: str, message: str): + + super().__init__( + severity=severity, message=message, code="payment_verification_started" + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentVerificationStarted": + from ._schemas.responses import PaymentVerificationStartedSchema + + return PaymentVerificationStartedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentVerificationStartedSchema + + return PaymentVerificationStartedSchema().dump(self) + + +class PaymentVerificationTimeout(Message): + """Generated when the verification of the payment [authorization](/payments-lifecycle#authorization) times out.""" + + def __init__(self, *, severity: str, message: str): + + super().__init__( + severity=severity, message=message, code="payment_verification_timeout" + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "PaymentVerificationTimeout": + from ._schemas.responses import PaymentVerificationTimeoutSchema + + return PaymentVerificationTimeoutSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import PaymentVerificationTimeoutSchema + + return PaymentVerificationTimeoutSchema().dump(self) + + +class ExternalTermsAndConditionsPending(Message): + """Generated in Payment Only [mode](/../checkout/overview#complete-checkout-and-payment-only-modes) when the customer hasn't accepted the terms and conditions yet.""" + + def __init__(self, *, severity: str, message: str): + + super().__init__( + severity=severity, + message=message, + code="external_terms_and_conditions_pending", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ExternalTermsAndConditionsPending": + from ._schemas.responses import ExternalTermsAndConditionsPendingSchema + + return ExternalTermsAndConditionsPendingSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import ExternalTermsAndConditionsPendingSchema + + return ExternalTermsAndConditionsPendingSchema().dump(self) + + +class SetShippingAddressError(ResponseMessage): + """Generated when the [Cart](/../api/projects/carts) cannot be updated with the shipping address.""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="set_shipping_address_error", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingAddressError": + from ._schemas.responses import SetShippingAddressErrorSchema + + return SetShippingAddressErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import SetShippingAddressErrorSchema + + return SetShippingAddressErrorSchema().dump(self) class NoShippingMethods(ResponseMessage): - """Generated when no Shipping Method is available for the shipping address of the Cart. This may indicate an incomplete configuration.""" + """Generated when no [Shipping Method](/../api/projects/shippingMethods) is available for the shipping address of the [Cart](/../api/projects/carts). This may indicate an incomplete configuration.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="no_shipping_methods" + severity=severity, + message=message, + payload=payload, + code="no_shipping_methods", ) @classmethod @@ -573,13 +1031,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderCreated(ResponseMessage): - """Generated when the checkout successfully creates an Order.""" + """Generated when an [Order](/../api/projects/orders) is created after a successful checkout process.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="order_created" + severity=severity, message=message, payload=payload, code="order_created" ) @classmethod @@ -594,113 +1051,147 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return OrderCreatedSchema().dump(self) -class SellerIsDeactivated(ResponseMessage): - """Generated when the seller is deactivated and the checkout cannot be initialized. Contact commercetools support.""" +class ProjectIsDeactivated(ResponseMessage): + """Generated when the commercetools Checkout [`projectKey`](/sdk) is deactivated and cannot be initialized. To activate it, contact the [Checkout support team](https://support.commercetools.com/).""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="seller_deactivated" + severity=severity, + message=message, + payload=payload, + code="project_deactivated", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SellerIsDeactivated": - from ._schemas.responses import SellerIsDeactivatedSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProjectIsDeactivated": + from ._schemas.responses import ProjectIsDeactivatedSchema - return SellerIsDeactivatedSchema().load(data) + return ProjectIsDeactivatedSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import SellerIsDeactivatedSchema + from ._schemas.responses import ProjectIsDeactivatedSchema - return SellerIsDeactivatedSchema().dump(self) + return ProjectIsDeactivatedSchema().dump(self) -class SellerNotFound(ResponseMessage): - """Generated when the seller is not found. The seller may have been deleted or the configuration may not be correct. Contact commercetools support.""" +class UnavailableLocale(ResponseMessage): + """Generated when the provided `locale` is not [available for localization](/installing-checkout#locales). The localization falls back to English.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="seller_not_found" + severity=severity, + message=message, + payload=payload, + code="unavailable_locale", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SellerNotFound": - from ._schemas.responses import SellerNotFoundSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "UnavailableLocale": + from ._schemas.responses import UnavailableLocaleSchema - return SellerNotFoundSchema().load(data) + return UnavailableLocaleSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import SellerNotFoundSchema + from ._schemas.responses import UnavailableLocaleSchema + + return UnavailableLocaleSchema().dump(self) - return SellerNotFoundSchema().dump(self) +class DeprecatedFields(ResponseMessage): + """Generated when the `checkoutConfig` [object](/sdk) contains one or more deprecated fields.""" -class ShippingAddressMissing(ResponseMessage): - """Generated when the checkout is initialised with [`skipShipping` set to `true`](/installing-checkout#placeholder-values). You must populate the `shippingAddress` field of the Cart with at least the shipping country.""" + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="shipping_address_missing" + severity=severity, + message=message, + payload=payload, + code="deprecated_fields", ) @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ShippingAddressMissing": - from ._schemas.responses import ShippingAddressMissingSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeprecatedFields": + from ._schemas.responses import DeprecatedFieldsSchema - return ShippingAddressMissingSchema().load(data) + return DeprecatedFieldsSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import ShippingAddressMissingSchema + from ._schemas.responses import DeprecatedFieldsSchema - return ShippingAddressMissingSchema().dump(self) + return DeprecatedFieldsSchema().dump(self) -class UnallowedOrigin(ResponseMessage): - """Generated when the currently used origin URL is not in the list of the [**Origin URLs** configured in the Merchant Center](/configuring-checkout#create-an-application) and the checkout cannot be initialized. Add the **Origin URL** in your application settings in the Merchant Center.""" +class OrderCreationError(ResponseMessage): + """Generated when an [Order](/../api/projects/orders) that references an approved [Payment](/../api/projects/payments) cannot be created.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="unallowed_origin" + severity=severity, + message=message, + payload=payload, + code="order_creation_error", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "UnallowedOrigin": - from ._schemas.responses import UnallowedOriginSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderCreationError": + from ._schemas.responses import OrderCreationErrorSchema - return UnallowedOriginSchema().load(data) + return OrderCreationErrorSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import UnallowedOriginSchema + from ._schemas.responses import OrderCreationErrorSchema - return UnallowedOriginSchema().dump(self) + return OrderCreationErrorSchema().dump(self) -class UnavailableLocale(ResponseMessage): - """Generated when the provided locale is not [available for localization](/installing-checkout#locales). The checkout falls back to English.""" +class CartWithExistingPayment(ResponseMessage): + """Generated when trying to add a [Payment](/../api/projects/payments) to a [Cart](/../api/projects/carts) that already references an approved Payment.""" + + def __init__(self, *, severity: str, message: str, payload: object): - def __init__( - self, *, type: str, message: str, payload: typing.Optional[object] = None - ): super().__init__( - type=type, message=message, payload=payload, code="unavailable_locale" + severity=severity, + message=message, + payload=payload, + code="cart_with_exisiting_payment", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "UnavailableLocale": - from ._schemas.responses import UnavailableLocaleSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CartWithExistingPayment": + from ._schemas.responses import CartWithExistingPaymentSchema - return UnavailableLocaleSchema().load(data) + return CartWithExistingPaymentSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.responses import UnavailableLocaleSchema + from ._schemas.responses import CartWithExistingPaymentSchema - return UnavailableLocaleSchema().dump(self) + return CartWithExistingPaymentSchema().dump(self) + + +class UnsupportedCountry(ResponseMessage): + """Generated when the country of the shipping address and/or billing address associated with the [Cart](/../api/projects/carts) does not match the countries set for the [Application](/payment-connectors-applications#applications).""" + + def __init__(self, *, severity: str, message: str, payload: object): + + super().__init__( + severity=severity, + message=message, + payload=payload, + code="unsupported_country", + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "UnsupportedCountry": + from ._schemas.responses import UnsupportedCountrySchema + + return UnsupportedCountrySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.responses import UnsupportedCountrySchema + + return UnsupportedCountrySchema().dump(self) diff --git a/src/commercetools/connect/models/common.py b/src/commercetools/connect/models/common.py new file mode 100644 index 00000000..1619130a --- /dev/null +++ b/src/commercetools/connect/models/common.py @@ -0,0 +1,837 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +__all__ = [ + "ApplicationDeployment", + "Artifact", + "CertificationInfo", + "CertificationInfoComment", + "ConfigurationKeySecured", + "ConfigurationKeyStandard", + "ConfigurationValue", + "ConnectorConfigurationApplication", + "ConnectorReference", + "ConnectorReport", + "ConnectorReportEntry", + "ConnectorReportEntryType", + "ConnectorStatus", + "Creator", + "DeploymentConfigurationApplication", + "DeploymentConnector", + "DeploymentCreator", + "DeploymentDetails", + "DeploymentDetailsBuild", + "DeploymentLogSeverity", + "DeploymentReport", + "DeploymentReportEntry", + "DeploymentReportEntryType", + "DeploymentStatus", + "DeploymentType", + "IntegrationType", + "IsPreviewable", + "Region", + "Repository", +] + + +class Artifact(_BaseType): + """A connector internal build artifact (ex: docker image).""" + + application_name: str + artifact_path: str + + def __init__(self, *, application_name: str, artifact_path: str): + self.application_name = application_name + self.artifact_path = artifact_path + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Artifact": + from ._schemas.common import ArtifactSchema + + return ArtifactSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ArtifactSchema + + return ArtifactSchema().dump(self) + + +class CertificationInfo(_BaseType): + #: Comments made during the certification process. + comments: typing.List["CertificationInfoComment"] + + def __init__(self, *, comments: typing.List["CertificationInfoComment"]): + self.comments = comments + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CertificationInfo": + from ._schemas.common import CertificationInfoSchema + + return CertificationInfoSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import CertificationInfoSchema + + return CertificationInfoSchema().dump(self) + + +class CertificationInfoComment(_BaseType): + """Contains metadata and body text of a comment made during the certification process.""" + + #: The commercetools Composable Commerce Project key associated with the person making the comment. + user_id: str + #: Date and time (UTC) the comment was added. + datetime: datetime.datetime + #: The body text of the comment. + comment: str + + def __init__(self, *, user_id: str, datetime: datetime.datetime, comment: str): + self.user_id = user_id + self.datetime = datetime + self.comment = comment + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CertificationInfoComment": + from ._schemas.common import CertificationInfoCommentSchema + + return CertificationInfoCommentSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import CertificationInfoCommentSchema + + return CertificationInfoCommentSchema().dump(self) + + +class ConfigurationKeyStandard(_BaseType): + """The name, description, and default value of a standard environment variable.""" + + #: Name of the environment variable. + key: str + #: Description of the environment variable. + description: str + #: Default value of the environment variable. + default: typing.Optional[str] + #: Indicates if the environment variable is required. + required: typing.Optional[bool] + + def __init__( + self, + *, + key: str, + description: str, + default: typing.Optional[str] = None, + required: typing.Optional[bool] = None + ): + self.key = key + self.description = description + self.default = default + self.required = required + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConfigurationKeyStandard": + from ._schemas.common import ConfigurationKeyStandardSchema + + return ConfigurationKeyStandardSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ConfigurationKeyStandardSchema + + return ConfigurationKeyStandardSchema().dump(self) + + +class ConfigurationKeySecured(_BaseType): + """The name and description of a secret environment variable.""" + + #: Name of the environment variable. + key: str + #: Description of the environment variable. + description: str + #: Indicates if the environment variable is required. + required: typing.Optional[bool] + + def __init__( + self, *, key: str, description: str, required: typing.Optional[bool] = None + ): + self.key = key + self.description = description + self.required = required + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConfigurationKeySecured": + from ._schemas.common import ConfigurationKeySecuredSchema + + return ConfigurationKeySecuredSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ConfigurationKeySecuredSchema + + return ConfigurationKeySecuredSchema().dump(self) + + +class ConfigurationValue(_BaseType): + #: Name of the environment variable. + key: str + #: Value of the environment variable. + value: str + + def __init__(self, *, key: str, value: str): + self.key = key + self.value = value + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConfigurationValue": + from ._schemas.common import ConfigurationValueSchema + + return ConfigurationValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ConfigurationValueSchema + + return ConfigurationValueSchema().dump(self) + + +class ConnectorConfigurationApplication(_BaseType): + """The configuration of a Connect application. These values are automatically obtained from the connect.yaml file in the GitHub repository.""" + + #: Name of the Connect application. + application_name: str + #: The Connect application type. + application_type: str + #: Contains the name, description, and default values of standard environment variables. + standard_configuration: typing.List["ConfigurationKeyStandard"] + #: Contains the name and description of secret environment variables. + secured_configuration: typing.List["ConfigurationKeySecured"] + + def __init__( + self, + *, + application_name: str, + application_type: str, + standard_configuration: typing.List["ConfigurationKeyStandard"], + secured_configuration: typing.List["ConfigurationKeySecured"] + ): + self.application_name = application_name + self.application_type = application_type + self.standard_configuration = standard_configuration + self.secured_configuration = secured_configuration + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorConfigurationApplication": + from ._schemas.common import ConnectorConfigurationApplicationSchema + + return ConnectorConfigurationApplicationSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ConnectorConfigurationApplicationSchema + + return ConnectorConfigurationApplicationSchema().dump(self) + + +class DeploymentConfigurationApplication(_BaseType): + """Describes the configuration set of a given application.""" + + #: Name of the application. Should match the value of `name` within the connect.yaml file of the Connect application. + application_name: str + #: Contains values of keys that are saved in plain text. Can be accessed after being set. + standard_configuration: typing.List["ConfigurationValue"] + #: Contains values of secret keys. Cannot be accessed after being set. + secured_configuration: typing.List["ConfigurationValue"] + + def __init__( + self, + *, + application_name: str, + standard_configuration: typing.List["ConfigurationValue"], + secured_configuration: typing.List["ConfigurationValue"] + ): + self.application_name = application_name + self.standard_configuration = standard_configuration + self.secured_configuration = secured_configuration + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentConfigurationApplication": + from ._schemas.common import DeploymentConfigurationApplicationSchema + + return DeploymentConfigurationApplicationSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeploymentConfigurationApplicationSchema + + return DeploymentConfigurationApplicationSchema().dump(self) + + +class ApplicationDeployment(_BaseType): + """Describes an application deployment of the Connector.""" + + #: Unique identifier of the application deployment. + id: str + #: Name of the application. Should match the value of `name` within the connect.yaml file of the Connector. + application_name: str + #: Contains values of keys that are saved in plain text. Can be accessed after being set. + standard_configuration: typing.List["ConfigurationValue"] + #: Contains values of secret keys. After being set, these values are encrypted and cannot be accessed. + secured_configuration: typing.List["ConfigurationValue"] + #: URL generated after deployment of service applications. + url: typing.Optional[str] + #: Pub/Sub Topic generated after deployment of event applications. + topic: typing.Optional[str] + #: Cron schedule for job applications. + schedule: typing.Optional[str] + + def __init__( + self, + *, + id: str, + application_name: str, + standard_configuration: typing.List["ConfigurationValue"], + secured_configuration: typing.List["ConfigurationValue"], + url: typing.Optional[str] = None, + topic: typing.Optional[str] = None, + schedule: typing.Optional[str] = None + ): + self.id = id + self.application_name = application_name + self.standard_configuration = standard_configuration + self.secured_configuration = secured_configuration + self.url = url + self.topic = topic + self.schedule = schedule + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ApplicationDeployment": + from ._schemas.common import ApplicationDeploymentSchema + + return ApplicationDeploymentSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ApplicationDeploymentSchema + + return ApplicationDeploymentSchema().dump(self) + + +class ConnectorReportEntryType(enum.Enum): + """The type of message being reported.""" + + INFORMATION = "Information" + WARNING = "Warning" + ERROR = "Error" + + +class ConnectorReportEntry(_BaseType): + """Describes an information, error, or warning notice.""" + + #: The report entry type. + type: "ConnectorReportEntryType" + #: The title of the report entry. + title: str + #: The message related to the report entry. + message: typing.Optional[str] + #: When the report entry was created. + created_at: datetime.datetime + + def __init__( + self, + *, + type: "ConnectorReportEntryType", + title: str, + message: typing.Optional[str] = None, + created_at: datetime.datetime + ): + self.type = type + self.title = title + self.message = message + self.created_at = created_at + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorReportEntry": + from ._schemas.common import ConnectorReportEntrySchema + + return ConnectorReportEntrySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ConnectorReportEntrySchema + + return ConnectorReportEntrySchema().dump(self) + + +class ConnectorReport(_BaseType): + """Contains report entries for publish/preview requests.""" + + #: Contains information, error, and warning notices. + entries: typing.List["ConnectorReportEntry"] + + def __init__(self, *, entries: typing.List["ConnectorReportEntry"]): + self.entries = entries + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorReport": + from ._schemas.common import ConnectorReportSchema + + return ConnectorReportSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ConnectorReportSchema + + return ConnectorReportSchema().dump(self) + + +class ConnectorStatus(enum.Enum): + """Indicates the current status of the ConnectorStaged.""" + + DRAFT = "Draft" + PROCESSING = "Processing" + READY_FOR_CERTIFICATION = "ReadyForCertification" + IN_CERTIFICATION = "InCertification" + PUBLISHED = "Published" + FAILED = "Failed" + + +class ConnectorReference(_BaseType): + """Reference to a [Connector](ctp:connect:type:Connector) or [ConnectorStaged](ctp:connect:type:ConnectorStaged). Either `id` or `key` is required.""" + + #: Unique identifier of the referenced Connector. + id: typing.Optional[str] + #: User-defined unique identifier of the referenced Connector. + key: typing.Optional[str] + #: If `true`, a previewable [ConnectorStaged](ctp:connect:type:ConnectorStaged) must be referenced in `id` or `key` instead of the published Connector. The `isPreviewable` field of the [ConnectorStaged](ctp:connect:type:ConnectorStaged) must be `true` to reference a previewable ConnectorStaged. + staged: typing.Optional[bool] + #: Version of the referenced Connector. + version: typing.Optional[int] + + def __init__( + self, + *, + id: typing.Optional[str] = None, + key: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + version: typing.Optional[int] = None + ): + self.id = id + self.key = key + self.staged = staged + self.version = version + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorReference": + from ._schemas.common import ConnectorReferenceSchema + + return ConnectorReferenceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ConnectorReferenceSchema + + return ConnectorReferenceSchema().dump(self) + + +class Creator(_BaseType): + """Details of the individual or organization who developed the Connector.""" + + #: Name of the person who owns the Connector. + name: typing.Optional[str] + #: Title of the person who owns the Connector. + title: typing.Optional[str] + #: Contact email address of the creator. + email: str + #: Name of the company that owns the Connector. + company: typing.Optional[str] + #: URL to a logo image used to represent the creator. + logo_url: typing.Optional[str] + #: Number of contributors currently working for the company. + no_of_contributors: typing.Optional[int] + #: URL to the support website of the Connector. + support_url: typing.Optional[str] + + def __init__( + self, + *, + name: typing.Optional[str] = None, + title: typing.Optional[str] = None, + email: str, + company: typing.Optional[str] = None, + logo_url: typing.Optional[str] = None, + no_of_contributors: typing.Optional[int] = None, + support_url: typing.Optional[str] = None + ): + self.name = name + self.title = title + self.email = email + self.company = company + self.logo_url = logo_url + self.no_of_contributors = no_of_contributors + self.support_url = support_url + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Creator": + from ._schemas.common import CreatorSchema + + return CreatorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import CreatorSchema + + return CreatorSchema().dump(self) + + +class DeploymentConnector(_BaseType): + """The details of the deployed [Connector](ctp:connect:type:Connector).""" + + #: `id` of the Connector. + id: str + #: User-defined unique identifier of the Connector. + key: typing.Optional[str] + #: Version of the Connector. + version: int + #: Name of the Connector. + name: str + #: Description of the Connector. + description: typing.Optional[str] + #: Connector integration type list. + integration_types: typing.List["IntegrationType"] + #: Owner of the Connector. + creator: "DeploymentCreator" + #: Details of the GitHub repository that contains the Connect applications. + repository: "Repository" + #: If `true`, the Connector is certified. + certified: bool + + def __init__( + self, + *, + id: str, + key: typing.Optional[str] = None, + version: int, + name: str, + description: typing.Optional[str] = None, + integration_types: typing.List["IntegrationType"], + creator: "DeploymentCreator", + repository: "Repository", + certified: bool + ): + self.id = id + self.key = key + self.version = version + self.name = name + self.description = description + self.integration_types = integration_types + self.creator = creator + self.repository = repository + self.certified = certified + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentConnector": + from ._schemas.common import DeploymentConnectorSchema + + return DeploymentConnectorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeploymentConnectorSchema + + return DeploymentConnectorSchema().dump(self) + + +class DeploymentCreator(_BaseType): + """The details of the deployed [DeploymentConnector](ctp:connect:type:DeploymentConnector) creator.""" + + #: Name of the person who owns the Connector. + name: typing.Optional[str] + #: Title of the person who owns the Connector. + title: typing.Optional[str] + #: Contact email address of the creator. + email: str + #: Name of the company that owns the Connector. + company: typing.Optional[str] + #: Number of contributors currently working for the company. + no_of_contributors: typing.Optional[int] + + def __init__( + self, + *, + name: typing.Optional[str] = None, + title: typing.Optional[str] = None, + email: str, + company: typing.Optional[str] = None, + no_of_contributors: typing.Optional[int] = None + ): + self.name = name + self.title = title + self.email = email + self.company = company + self.no_of_contributors = no_of_contributors + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentCreator": + from ._schemas.common import DeploymentCreatorSchema + + return DeploymentCreatorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeploymentCreatorSchema + + return DeploymentCreatorSchema().dump(self) + + +class DeploymentReportEntryType(enum.Enum): + """The type of message being reported.""" + + INFORMATION = "Information" + WARNING = "Warning" + ERROR = "Error" + + +class DeploymentReportEntry(_BaseType): + """Describes an information, error, or warning in the deployment report.""" + + #: The report entry type. + type: "DeploymentReportEntryType" + #: The title of the report entry. + title: str + #: The message related to the report entry. + message: typing.Optional[str] + #: The name of the Connect application related to the entry. + application: typing.Optional[str] + #: When the report entry was created. + created_at: datetime.datetime + + def __init__( + self, + *, + type: "DeploymentReportEntryType", + title: str, + message: typing.Optional[str] = None, + application: typing.Optional[str] = None, + created_at: datetime.datetime + ): + self.type = type + self.title = title + self.message = message + self.application = application + self.created_at = created_at + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentReportEntry": + from ._schemas.common import DeploymentReportEntrySchema + + return DeploymentReportEntrySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeploymentReportEntrySchema + + return DeploymentReportEntrySchema().dump(self) + + +class DeploymentReport(_BaseType): + """Describes a report of the Connector deployment process.""" + + #: Contains informations, errors and warnings about the Connector deployment. + entries: typing.List["DeploymentReportEntry"] + + def __init__(self, *, entries: typing.List["DeploymentReportEntry"]): + self.entries = entries + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentReport": + from ._schemas.common import DeploymentReportSchema + + return DeploymentReportSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeploymentReportSchema + + return DeploymentReportSchema().dump(self) + + +class DeploymentDetailsBuild(_BaseType): + #: The build execution id of the deployed application. + id: str + #: The build report of the deployed Connector. + report: typing.Optional["DeploymentReport"] + + def __init__(self, *, id: str, report: typing.Optional["DeploymentReport"] = None): + self.id = id + self.report = report + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentDetailsBuild": + from ._schemas.common import DeploymentDetailsBuildSchema + + return DeploymentDetailsBuildSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeploymentDetailsBuildSchema + + return DeploymentDetailsBuildSchema().dump(self) + + +class DeploymentDetails(_BaseType): + """Additional details about the deployed Connector.""" + + #: The build details of deployed applications. + build: "DeploymentDetailsBuild" + + def __init__(self, *, build: "DeploymentDetailsBuild"): + self.build = build + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentDetails": + from ._schemas.common import DeploymentDetailsSchema + + return DeploymentDetailsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeploymentDetailsSchema + + return DeploymentDetailsSchema().dump(self) + + +class DeploymentStatus(enum.Enum): + """Indicates the current status of the Deployment.""" + + DRAFT = "Draft" + QUEUED = "Queued" + DEPLOYING = "Deploying" + DEPLOYED = "Deployed" + FAILED = "Failed" + UNDEPLOYING = "Undeploying" + UNDEPLOY_FAILED = "UndeployFailed" + + +class DeploymentLogSeverity(enum.Enum): + """The severity of the log message.""" + + DEFAULT = "DEFAULT" + DEBUG = "DEBUG" + INFO = "INFO" + NOTICE = "NOTICE" + WARNING = "WARNING" + ERROR = "ERROR" + CRITICAL = "CRITICAL" + ALERT = "ALERT" + EMERGENCY = "EMERGENCY" + + +class Region(enum.Enum): + """The Region of a commercetools Composable Commerce Project or Deployment. For more information, see [Hosts](/hosts-and-authorization#hosts).""" + + EUROPE_WEST1.GCP = "europe-west1.gcp" + US_CENTRAL1.GCP = "us-central1.gcp" + AUSTRALIA_SOUTHEAST1.GCP = "australia-southeast1.gcp" + + +class IntegrationType(enum.Enum): + """Integration type of the Connector.""" + + TAX = "tax" + MARKETPLACE = "marketplace" + OMS = "oms" + PSP = "psp" + PIM = "pim" + PROMOTION = "promotion" + SEARCH = "search" + ERP = "erp" + CRM = "crm" + EMAIL = "email" + ANALYTICS = "analytics" + SHIPPING = "shipping" + OTHER = "other" + + +class DeploymentType(enum.Enum): + """Deployment type of the Connector.""" + + PREVIEW = "preview" + PRODUCTION = "production" + + +class Repository(_BaseType): + """Details of the GitHub repository that contains the Connect applications.""" + + #: HTTPS or SSH GitHub URL of the GitHub repository. Private repositories must use an SSH URL. + url: str + #: Git tag of the release to use. + tag: str + + def __init__(self, *, url: str, tag: str): + self.url = url + self.tag = tag + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Repository": + from ._schemas.common import RepositorySchema + + return RepositorySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import RepositorySchema + + return RepositorySchema().dump(self) + + +class IsPreviewable(enum.Enum): + """The previewable status of the ConnectorStaged.""" + + TRUE = "true" + FALSE = "false" + PENDING = "pending" + NONE = "none" diff --git a/src/commercetools/connect/models/connector.py b/src/commercetools/connect/models/connector.py new file mode 100644 index 00000000..5f654dc8 --- /dev/null +++ b/src/commercetools/connect/models/connector.py @@ -0,0 +1,976 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType +from .common import IntegrationType, Region + +if typing.TYPE_CHECKING: + from . import CertificationInfo, ConnectorReport, Creator, Repository + from .common import ConnectorConfigurationApplication, IntegrationType, Region + +__all__ = [ + "Connector", + "ConnectorAddCertificationCommentAction", + "ConnectorAddPrivateProjectAction", + "ConnectorDraft", + "ConnectorPublishAction", + "ConnectorRemovePrivateProjectAction", + "ConnectorSearchPagedQueryResponse", + "ConnectorSetCreatorCompanyAction", + "ConnectorSetCreatorEmailAction", + "ConnectorSetCreatorLogoAction", + "ConnectorSetCreatorNameAction", + "ConnectorSetCreatorNoOfContributorsAction", + "ConnectorSetCreatorSupportUrlAction", + "ConnectorSetCreatorTitleAction", + "ConnectorSetDescriptionAction", + "ConnectorSetDocumentationUrlAction", + "ConnectorSetIntegrationTypesAction", + "ConnectorSetNameAction", + "ConnectorSetRepositoryAction", + "ConnectorSetSupportedRegionsAction", + "ConnectorStaged", + "ConnectorStagedPagedQueryResponse", + "ConnectorUnlistAction", + "ConnectorUpdate", + "ConnectorUpdateAction", + "ConnectorUpdatePreviewableAction", +] + + +class Connector(_BaseType): + #: Unique identifier of the Connector. + id: str + #: User-defined unique identifier of the Connector. + key: typing.Optional[str] + #: Current version of the Connector. + version: int + #: Name of the Connector. + name: str + #: Description of the Connector. + description: typing.Optional[str] + #: Integration types of the Connector. Can be used to filter search and query results. + integration_types: typing.List["IntegrationType"] + #: Owner of the Connector. + creator: "Creator" + #: GitHub repository details of the Connector. + repository: "Repository" + #: Configurations needed by Connectors for hosting. Loaded as environment variables in the workload. + configurations: typing.Optional[typing.List["ConnectorConfigurationApplication"]] + #: If `true`, only Composable Commerce Projects specified in `privateProjects` can access the Connector. + private: bool + #: If not empty, Connectors can only be deployed in these Regions. If empty, Connectors can be deployed in any [supported Region](hosts-and-authorization#hosts). + supported_regions: typing.List["Region"] + #: If `true`, the Connector is certified. + certified: bool + #: URL to the documentation of the Connector. + documentation_url: typing.Optional[str] + + def __init__( + self, + *, + id: str, + key: typing.Optional[str] = None, + version: int, + name: str, + description: typing.Optional[str] = None, + integration_types: typing.List["IntegrationType"], + creator: "Creator", + repository: "Repository", + configurations: typing.Optional[ + typing.List["ConnectorConfigurationApplication"] + ] = None, + private: bool, + supported_regions: typing.List["Region"], + certified: bool, + documentation_url: typing.Optional[str] = None + ): + self.id = id + self.key = key + self.version = version + self.name = name + self.description = description + self.integration_types = integration_types + self.creator = creator + self.repository = repository + self.configurations = configurations + self.private = private + self.supported_regions = supported_regions + self.certified = certified + self.documentation_url = documentation_url + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Connector": + from ._schemas.connector import ConnectorSchema + + return ConnectorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSchema + + return ConnectorSchema().dump(self) + + +class ConnectorDraft(_BaseType): + #: User-defined unique identifier of the Connector. + key: typing.Optional[str] + #: Name of the Connector. + name: str + #: Description of the Connector. + description: typing.Optional[str] + #: Integration types of the Connector. Can be used to filter search and query results. + integration_types: typing.Optional[typing.List["IntegrationType"]] + #: Owner of the Connector. + creator: "Creator" + #: GitHub repository details of the Connector. + repository: "Repository" + #: If provided, Connectors can only be deployed in these Regions. If not provided, Connectors can be deployed in any [supported Region](hosts-and-authorization#hosts). + supported_regions: typing.Optional[typing.List["Region"]] + #: Composable Commerce Projects that can access the Connector. If empty, only the creator can access this Connector. + private_projects: typing.Optional[typing.List["str"]] + #: URL to the documentation of the Connector. + documentation_url: typing.Optional[str] + + def __init__( + self, + *, + key: typing.Optional[str] = None, + name: str, + description: typing.Optional[str] = None, + integration_types: typing.Optional[typing.List["IntegrationType"]] = None, + creator: "Creator", + repository: "Repository", + supported_regions: typing.Optional[typing.List["Region"]] = None, + private_projects: typing.Optional[typing.List["str"]] = None, + documentation_url: typing.Optional[str] = None + ): + self.key = key + self.name = name + self.description = description + self.integration_types = integration_types + self.creator = creator + self.repository = repository + self.supported_regions = supported_regions + self.private_projects = private_projects + self.documentation_url = documentation_url + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorDraft": + from ._schemas.connector import ConnectorDraftSchema + + return ConnectorDraftSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorDraftSchema + + return ConnectorDraftSchema().dump(self) + + +class ConnectorStaged(_BaseType): + #: Unique identifier of the Connector. + id: str + #: User-defined unique identifier of the Connector. + key: typing.Optional[str] + #: Current version of the Connector. + version: int + #: Name of the Connector. + name: str + #: Description of the Connector. + description: str + #: Integration types of the Connector. Can be used to filter search and query results. + integration_types: typing.List["IntegrationType"] + #: Owner of the Connector. + creator: "Creator" + #: GitHub repository details of the Connector. + repository: "Repository" + #: Configurations needed by Connectors for hosting. Loaded as environment variables in the workload. + configurations: typing.List["ConnectorConfigurationApplication"] + #: If `true`, only Composable Commerce Projects specified in `privateProjects` can access the Connector. + private: bool + #: If `private` is true, only these Composable Commerce Projects can access the Connector. + private_projects: typing.List["str"] + #: If not empty, Connectors can only be deployed in these Regions. If empty, Connectors can be deployed in any [supported Region](hosts-and-authorization#hosts). + supported_regions: typing.List["Region"] + #: Comments made during the certification process. + certification_info: typing.Optional["CertificationInfo"] + #: Current status of the Connector. + status: str + #: The publishing request report of the Connector. + publishing_report: typing.Optional["ConnectorReport"] + #: If `true`, the Connector is published and ready for use. + already_listed: bool + #: If `true`, the ConnectorStaged data is different from the production [Connector](ctp:connect:type:Connector) data. + has_changes: bool + #: The previewable status of the ConnectorStaged. + is_previewable: str + #: The previewable request report. + previewable_report: typing.Optional["ConnectorReport"] + #: URL to the documentation of the Connector. + documentation_url: typing.Optional[str] + + def __init__( + self, + *, + id: str, + key: typing.Optional[str] = None, + version: int, + name: str, + description: str, + integration_types: typing.List["IntegrationType"], + creator: "Creator", + repository: "Repository", + configurations: typing.List["ConnectorConfigurationApplication"], + private: bool, + private_projects: typing.List["str"], + supported_regions: typing.List["Region"], + certification_info: typing.Optional["CertificationInfo"] = None, + status: str, + publishing_report: typing.Optional["ConnectorReport"] = None, + already_listed: bool, + has_changes: bool, + is_previewable: str, + previewable_report: typing.Optional["ConnectorReport"] = None, + documentation_url: typing.Optional[str] = None + ): + self.id = id + self.key = key + self.version = version + self.name = name + self.description = description + self.integration_types = integration_types + self.creator = creator + self.repository = repository + self.configurations = configurations + self.private = private + self.private_projects = private_projects + self.supported_regions = supported_regions + self.certification_info = certification_info + self.status = status + self.publishing_report = publishing_report + self.already_listed = already_listed + self.has_changes = has_changes + self.is_previewable = is_previewable + self.previewable_report = previewable_report + self.documentation_url = documentation_url + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorStaged": + from ._schemas.connector import ConnectorStagedSchema + + return ConnectorStagedSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorStagedSchema + + return ConnectorStagedSchema().dump(self) + + +class ConnectorStagedPagedQueryResponse(_BaseType): + """[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [ConnectorStaged](ctp:connect:type:ConnectorStaged).""" + + #: The maximum number of the ConnectorStaged returned. + limit: int + #: The offset of the ConnectorStaged returned. + offset: int + #: The number of ConnectorStaged returned. + count: int + #: The total number of ConnectorStaged matching the query. + total: int + #: ConnectorStaged matching the query. + results: typing.List["ConnectorStaged"] + + def __init__( + self, + *, + limit: int, + offset: int, + count: int, + total: int, + results: typing.List["ConnectorStaged"] + ): + self.limit = limit + self.offset = offset + self.count = count + self.total = total + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorStagedPagedQueryResponse": + from ._schemas.connector import ConnectorStagedPagedQueryResponseSchema + + return ConnectorStagedPagedQueryResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorStagedPagedQueryResponseSchema + + return ConnectorStagedPagedQueryResponseSchema().dump(self) + + +class ConnectorSearchPagedQueryResponse(_BaseType): + """[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [Connector](ctp:connect:type:Connector).""" + + #: The maximum number of Connectors returned. + limit: int + #: The offset of the Connectors returned. + offset: int + #: The number of Connectors returned. + count: int + #: The total number of Connectors matching the query. + total: int + #: Connectors matching the query. + results: typing.List["Connector"] + + def __init__( + self, + *, + limit: int, + offset: int, + count: int, + total: int, + results: typing.List["Connector"] + ): + self.limit = limit + self.offset = offset + self.count = count + self.total = total + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSearchPagedQueryResponse": + from ._schemas.connector import ConnectorSearchPagedQueryResponseSchema + + return ConnectorSearchPagedQueryResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSearchPagedQueryResponseSchema + + return ConnectorSearchPagedQueryResponseSchema().dump(self) + + +class ConnectorUpdate(_BaseType): + #: Expected version of the Connector on which the changes apply. + version: int + #: Update actions to be performed on the Connector. + actions: typing.List["ConnectorUpdateAction"] + + def __init__(self, *, version: int, actions: typing.List["ConnectorUpdateAction"]): + self.version = version + self.actions = actions + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorUpdate": + from ._schemas.connector import ConnectorUpdateSchema + + return ConnectorUpdateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorUpdateSchema + + return ConnectorUpdateSchema().dump(self) + + +class ConnectorUpdateAction(_BaseType): + action: str + + def __init__(self, *, action: str): + self.action = action + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorUpdateAction": + if data["action"] == "setCreatorCompany": + from ._schemas.connector import ConnectorSetCreatorCompanyActionSchema + + return ConnectorSetCreatorCompanyActionSchema().load(data) + if data["action"] == "setCreatorEmail": + from ._schemas.connector import ConnectorSetCreatorEmailActionSchema + + return ConnectorSetCreatorEmailActionSchema().load(data) + if data["action"] == "setCreatorName": + from ._schemas.connector import ConnectorSetCreatorNameActionSchema + + return ConnectorSetCreatorNameActionSchema().load(data) + if data["action"] == "setCreatorTitle": + from ._schemas.connector import ConnectorSetCreatorTitleActionSchema + + return ConnectorSetCreatorTitleActionSchema().load(data) + if data["action"] == "setDescription": + from ._schemas.connector import ConnectorSetDescriptionActionSchema + + return ConnectorSetDescriptionActionSchema().load(data) + if data["action"] == "setCreatorSupportUrl": + from ._schemas.connector import ConnectorSetCreatorSupportUrlActionSchema + + return ConnectorSetCreatorSupportUrlActionSchema().load(data) + if data["action"] == "setName": + from ._schemas.connector import ConnectorSetNameActionSchema + + return ConnectorSetNameActionSchema().load(data) + if data["action"] == "setCreatorLogo": + from ._schemas.connector import ConnectorSetCreatorLogoActionSchema + + return ConnectorSetCreatorLogoActionSchema().load(data) + if data["action"] == "setCreatorNoOfContributors": + from ._schemas.connector import ( + ConnectorSetCreatorNoOfContributorsActionSchema, + ) + + return ConnectorSetCreatorNoOfContributorsActionSchema().load(data) + if data["action"] == "addPrivateProject": + from ._schemas.connector import ConnectorAddPrivateProjectActionSchema + + return ConnectorAddPrivateProjectActionSchema().load(data) + if data["action"] == "removePrivateProject": + from ._schemas.connector import ConnectorRemovePrivateProjectActionSchema + + return ConnectorRemovePrivateProjectActionSchema().load(data) + if data["action"] == "setRepository": + from ._schemas.connector import ConnectorSetRepositoryActionSchema + + return ConnectorSetRepositoryActionSchema().load(data) + if data["action"] == "setSupportedRegions": + from ._schemas.connector import ConnectorSetSupportedRegionsActionSchema + + return ConnectorSetSupportedRegionsActionSchema().load(data) + if data["action"] == "setDocumentationUrl": + from ._schemas.connector import ConnectorSetDocumentationUrlActionSchema + + return ConnectorSetDocumentationUrlActionSchema().load(data) + if data["action"] == "setIntegrationTypes": + from ._schemas.connector import ConnectorSetIntegrationTypesActionSchema + + return ConnectorSetIntegrationTypesActionSchema().load(data) + if data["action"] == "unlist": + from ._schemas.connector import ConnectorUnlistActionSchema + + return ConnectorUnlistActionSchema().load(data) + if data["action"] == "addCertificationComment": + from ._schemas.connector import ConnectorAddCertificationCommentActionSchema + + return ConnectorAddCertificationCommentActionSchema().load(data) + if data["action"] == "updatePreviewable": + from ._schemas.connector import ConnectorUpdatePreviewableActionSchema + + return ConnectorUpdatePreviewableActionSchema().load(data) + if data["action"] == "publish": + from ._schemas.connector import ConnectorPublishActionSchema + + return ConnectorPublishActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorUpdateActionSchema + + return ConnectorUpdateActionSchema().dump(self) + + +class ConnectorSetCreatorCompanyAction(ConnectorUpdateAction): + """Updates the company of the creator.""" + + #: Value to set. + creator_company: str + + def __init__(self, *, creator_company: str): + self.creator_company = creator_company + + super().__init__(action="setCreatorCompany") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetCreatorCompanyAction": + from ._schemas.connector import ConnectorSetCreatorCompanyActionSchema + + return ConnectorSetCreatorCompanyActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetCreatorCompanyActionSchema + + return ConnectorSetCreatorCompanyActionSchema().dump(self) + + +class ConnectorSetCreatorEmailAction(ConnectorUpdateAction): + """Updates the email address of the creator.""" + + #: Value to set. + creator_email: str + + def __init__(self, *, creator_email: str): + self.creator_email = creator_email + + super().__init__(action="setCreatorEmail") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetCreatorEmailAction": + from ._schemas.connector import ConnectorSetCreatorEmailActionSchema + + return ConnectorSetCreatorEmailActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetCreatorEmailActionSchema + + return ConnectorSetCreatorEmailActionSchema().dump(self) + + +class ConnectorSetCreatorNameAction(ConnectorUpdateAction): + """Updates the name of the creator.""" + + #: Value to set. + creator_name: str + + def __init__(self, *, creator_name: str): + self.creator_name = creator_name + + super().__init__(action="setCreatorName") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetCreatorNameAction": + from ._schemas.connector import ConnectorSetCreatorNameActionSchema + + return ConnectorSetCreatorNameActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetCreatorNameActionSchema + + return ConnectorSetCreatorNameActionSchema().dump(self) + + +class ConnectorSetCreatorTitleAction(ConnectorUpdateAction): + """Updates the title of the creator.""" + + #: Value to set. + creator_title: str + + def __init__(self, *, creator_title: str): + self.creator_title = creator_title + + super().__init__(action="setCreatorTitle") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetCreatorTitleAction": + from ._schemas.connector import ConnectorSetCreatorTitleActionSchema + + return ConnectorSetCreatorTitleActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetCreatorTitleActionSchema + + return ConnectorSetCreatorTitleActionSchema().dump(self) + + +class ConnectorSetDescriptionAction(ConnectorUpdateAction): + """Updates the description of the Connector.""" + + #: Value to set. + description: str + + def __init__(self, *, description: str): + self.description = description + + super().__init__(action="setDescription") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetDescriptionAction": + from ._schemas.connector import ConnectorSetDescriptionActionSchema + + return ConnectorSetDescriptionActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetDescriptionActionSchema + + return ConnectorSetDescriptionActionSchema().dump(self) + + +class ConnectorSetCreatorSupportUrlAction(ConnectorUpdateAction): + """Updates the support URL of the creator.""" + + #: Value to set. + creator_support_url: str + + def __init__(self, *, creator_support_url: str): + self.creator_support_url = creator_support_url + + super().__init__(action="setCreatorSupportUrl") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetCreatorSupportUrlAction": + from ._schemas.connector import ConnectorSetCreatorSupportUrlActionSchema + + return ConnectorSetCreatorSupportUrlActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetCreatorSupportUrlActionSchema + + return ConnectorSetCreatorSupportUrlActionSchema().dump(self) + + +class ConnectorSetNameAction(ConnectorUpdateAction): + """Updates the name of the Connector.""" + + #: Value to set. + name: str + + def __init__(self, *, name: str): + self.name = name + + super().__init__(action="setName") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetNameAction": + from ._schemas.connector import ConnectorSetNameActionSchema + + return ConnectorSetNameActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetNameActionSchema + + return ConnectorSetNameActionSchema().dump(self) + + +class ConnectorSetCreatorLogoAction(ConnectorUpdateAction): + """Updates the logo of the creator.""" + + #: Value to set. + logo_url: str + + def __init__(self, *, logo_url: str): + self.logo_url = logo_url + + super().__init__(action="setCreatorLogo") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetCreatorLogoAction": + from ._schemas.connector import ConnectorSetCreatorLogoActionSchema + + return ConnectorSetCreatorLogoActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetCreatorLogoActionSchema + + return ConnectorSetCreatorLogoActionSchema().dump(self) + + +class ConnectorSetCreatorNoOfContributorsAction(ConnectorUpdateAction): + """Updates the number of contributors of the creator.""" + + #: Value to set. + creator_no_of_contributors: int + + def __init__(self, *, creator_no_of_contributors: int): + self.creator_no_of_contributors = creator_no_of_contributors + + super().__init__(action="setCreatorNoOfContributors") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetCreatorNoOfContributorsAction": + from ._schemas.connector import ConnectorSetCreatorNoOfContributorsActionSchema + + return ConnectorSetCreatorNoOfContributorsActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetCreatorNoOfContributorsActionSchema + + return ConnectorSetCreatorNoOfContributorsActionSchema().dump(self) + + +class ConnectorAddPrivateProjectAction(ConnectorUpdateAction): + """Allow a Composable Commerce Project to access a private Connector. + + Attempting to add a `privateProject` to a non-private ConnectorStaged returns the [ConnectorStagedNotPrivate](ctp:connect:type:ConnectorStagedNotPrivateError) error. + + """ + + #: The Composable Commerce Project to add to `privateProjects`. + private_project: str + + def __init__(self, *, private_project: str): + self.private_project = private_project + + super().__init__(action="addPrivateProject") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorAddPrivateProjectAction": + from ._schemas.connector import ConnectorAddPrivateProjectActionSchema + + return ConnectorAddPrivateProjectActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorAddPrivateProjectActionSchema + + return ConnectorAddPrivateProjectActionSchema().dump(self) + + +class ConnectorRemovePrivateProjectAction(ConnectorUpdateAction): + """Remove a Composable Commerce Project's access to a private Connector. + + Attempting to remove a `privateProject` from a non-private ConnectorStaged returns the [ConnectorStagedNotPrivate](ctp:connect:type:ConnectorStagedNotPrivateError) error. + + """ + + #: The Composable Commerce Project to remove from `privateProjects`. + private_project: str + + def __init__(self, *, private_project: str): + self.private_project = private_project + + super().__init__(action="removePrivateProject") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorRemovePrivateProjectAction": + from ._schemas.connector import ConnectorRemovePrivateProjectActionSchema + + return ConnectorRemovePrivateProjectActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorRemovePrivateProjectActionSchema + + return ConnectorRemovePrivateProjectActionSchema().dump(self) + + +class ConnectorSetRepositoryAction(ConnectorUpdateAction): + """Updates the GitHub repository details of the Connector.""" + + #: New HTTPS or SSH GitHub URL to assign to the Connector. + url: str + #: New Git tag to assign to the Connector. + tag: str + + def __init__(self, *, url: str, tag: str): + self.url = url + self.tag = tag + + super().__init__(action="setRepository") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetRepositoryAction": + from ._schemas.connector import ConnectorSetRepositoryActionSchema + + return ConnectorSetRepositoryActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetRepositoryActionSchema + + return ConnectorSetRepositoryActionSchema().dump(self) + + +class ConnectorSetSupportedRegionsAction(ConnectorUpdateAction): + """Updates the regions that the Connector can be deployed in.""" + + #: New value to set. + regions: typing.List["Region"] + + def __init__(self, *, regions: typing.List["Region"]): + self.regions = regions + + super().__init__(action="setSupportedRegions") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetSupportedRegionsAction": + from ._schemas.connector import ConnectorSetSupportedRegionsActionSchema + + return ConnectorSetSupportedRegionsActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetSupportedRegionsActionSchema + + return ConnectorSetSupportedRegionsActionSchema().dump(self) + + +class ConnectorSetDocumentationUrlAction(ConnectorUpdateAction): + """Updates the documentation URL of the Connector.""" + + #: Value to set. + documentation_url: str + + def __init__(self, *, documentation_url: str): + self.documentation_url = documentation_url + + super().__init__(action="setDocumentationUrl") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetDocumentationUrlAction": + from ._schemas.connector import ConnectorSetDocumentationUrlActionSchema + + return ConnectorSetDocumentationUrlActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetDocumentationUrlActionSchema + + return ConnectorSetDocumentationUrlActionSchema().dump(self) + + +class ConnectorSetIntegrationTypesAction(ConnectorUpdateAction): + """Updates the integration types of the Connector.""" + + #: New value to set. + integration_types: typing.List["IntegrationType"] + + def __init__(self, *, integration_types: typing.List["IntegrationType"]): + self.integration_types = integration_types + + super().__init__(action="setIntegrationTypes") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSetIntegrationTypesAction": + from ._schemas.connector import ConnectorSetIntegrationTypesActionSchema + + return ConnectorSetIntegrationTypesActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorSetIntegrationTypesActionSchema + + return ConnectorSetIntegrationTypesActionSchema().dump(self) + + +class ConnectorUnlistAction(ConnectorUpdateAction): + """Removes a certified and listed Connector from search results and listings. This update action does not affect deployed instances of the Connector.""" + + def __init__(self): + + super().__init__(action="unlist") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ConnectorUnlistAction": + from ._schemas.connector import ConnectorUnlistActionSchema + + return ConnectorUnlistActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorUnlistActionSchema + + return ConnectorUnlistActionSchema().dump(self) + + +class ConnectorAddCertificationCommentAction(ConnectorUpdateAction): + """Add a comment during the certification process of the Connector.""" + + #: Comment to add. + comment: str + + def __init__(self, *, comment: str): + self.comment = comment + + super().__init__(action="addCertificationComment") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorAddCertificationCommentAction": + from ._schemas.connector import ConnectorAddCertificationCommentActionSchema + + return ConnectorAddCertificationCommentActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorAddCertificationCommentActionSchema + + return ConnectorAddCertificationCommentActionSchema().dump(self) + + +class ConnectorUpdatePreviewableAction(ConnectorUpdateAction): + """Requests the previewable status of a ConnectorStaged. A previewable ConnectorStaged can be used in a Deployment for testing and preview purposes. + + After using this update action, the status of `isPreviewable` will change to `pending`. Following validation, the status of `isPreviewable` will change to `true` if the previewable status is granted, or `false` if it is rejected. + In the case of a `false` status, contact the [Connect support team](https://support.commercetools.com/) regarding any issues raised during the validation process. + + Requesting the previewable status for a ConnectorStaged that is currently being reviewed returns the [ConnectorStagedPreviewRequestUnderProcess](ctp:connect:type:ConnectorStagedPreviewRequestUnderProcessError) error. + + """ + + def __init__(self): + + super().__init__(action="updatePreviewable") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorUpdatePreviewableAction": + from ._schemas.connector import ConnectorUpdatePreviewableActionSchema + + return ConnectorUpdatePreviewableActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorUpdatePreviewableActionSchema + + return ConnectorUpdatePreviewableActionSchema().dump(self) + + +class ConnectorPublishAction(ConnectorUpdateAction): + """Starts the Connector publishing process. You will be unable to update the Connector until the process completes. + + `certification` should only be `true` if you want to make the Connector publicly available. + + """ + + #: - Set to `false` to make the Connector private and skip the [certification process](/certification). The published Connector will only be deployable on Projects listed in `ConnectorStaged.privateProjects`. + #: - Set to `true` to make the Connector public. This will submit the ConnectorStaged to the [certification process](/certification). After completing the certification process, the Connector will become publicly available. + certification: bool + + def __init__(self, *, certification: bool): + self.certification = certification + + super().__init__(action="publish") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorPublishAction": + from ._schemas.connector import ConnectorPublishActionSchema + + return ConnectorPublishActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.connector import ConnectorPublishActionSchema + + return ConnectorPublishActionSchema().dump(self) diff --git a/src/commercetools/connect/models/deployment.py b/src/commercetools/connect/models/deployment.py new file mode 100644 index 00000000..aad82bcb --- /dev/null +++ b/src/commercetools/connect/models/deployment.py @@ -0,0 +1,340 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +if typing.TYPE_CHECKING: + from . import ConnectorReference, DeploymentConnector, DeploymentDetails + from .common import ApplicationDeployment, DeploymentConfigurationApplication + +__all__ = [ + "Deployment", + "DeploymentDraft", + "DeploymentLog", + "DeploymentLogCursorPagedQueryResponse", + "DeploymentPagedQueryResponse", + "DeploymentRedeployAction", + "DeploymentUpdate", + "DeploymentUpdateAction", +] + + +class Deployment(_BaseType): + #: Unique identifier of the Deployment. + id: str + #: User-defined unique identifier of the Deployment. + key: typing.Optional[str] + #: Current version of the Deployment. + version: int + #: Details of the [Connector](ctp:connect:type:Connector) being deployed. + connector: "DeploymentConnector" + #: Build reference id and outcome of the Deployment. + details: "DeploymentDetails" + #: Region of the Deployment. + deployed_region: str + #: Application deployments needed by the connector for hosting and configuration, refer to Connector configurations for details. + applications: typing.List["ApplicationDeployment"] + #: If `true`, the Deployment is a preview. + preview: bool + #: The current status of the Deployment. + status: str + + def __init__( + self, + *, + id: str, + key: typing.Optional[str] = None, + version: int, + connector: "DeploymentConnector", + details: "DeploymentDetails", + deployed_region: str, + applications: typing.List["ApplicationDeployment"], + preview: bool, + status: str + ): + self.id = id + self.key = key + self.version = version + self.connector = connector + self.details = details + self.deployed_region = deployed_region + self.applications = applications + self.preview = preview + self.status = status + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Deployment": + from ._schemas.deployment import DeploymentSchema + + return DeploymentSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentSchema + + return DeploymentSchema().dump(self) + + +class DeploymentPagedQueryResponse(_BaseType): + """[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [Deployment](ctp:connect:type:Deployment).""" + + #: The limit of the Deployments returned. + limit: int + #: The offset of the Deployments returned. + offset: int + #: The number of Deployments returned. + count: int + #: The total number of Deployments available. + total: int + #: Deployments matching the query. + results: typing.List["Deployment"] + + def __init__( + self, + *, + limit: int, + offset: int, + count: int, + total: int, + results: typing.List["Deployment"] + ): + self.limit = limit + self.offset = offset + self.count = count + self.total = total + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentPagedQueryResponse": + from ._schemas.deployment import DeploymentPagedQueryResponseSchema + + return DeploymentPagedQueryResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentPagedQueryResponseSchema + + return DeploymentPagedQueryResponseSchema().dump(self) + + +class DeploymentDraft(_BaseType): + #: User-defined unique identifier for the Deployment. + key: typing.Optional[str] + #: Reference to the [Connector](ctp:connect:type:Connector) or [ConnectorStaged](ctp:connect:type:ConnectorStaged) being deployed. + connector: "ConnectorReference" + #: Configuration values needed by the [Connector](ctp:connect:type:Connector) for hosting. Keys should match those in the Connector's `configurations` field. + configurations: typing.Optional[typing.List["DeploymentConfigurationApplication"]] + #: Region of Deployment. + region: str + + def __init__( + self, + *, + key: typing.Optional[str] = None, + connector: "ConnectorReference", + configurations: typing.Optional[ + typing.List["DeploymentConfigurationApplication"] + ] = None, + region: str + ): + self.key = key + self.connector = connector + self.configurations = configurations + self.region = region + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentDraft": + from ._schemas.deployment import DeploymentDraftSchema + + return DeploymentDraftSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentDraftSchema + + return DeploymentDraftSchema().dump(self) + + +class DeploymentUpdate(_BaseType): + #: Expected version of the Deployment on which the changes apply. + version: int + #: Update actions to be performed on the Deployment. + actions: typing.List["DeploymentUpdateAction"] + + def __init__(self, *, version: int, actions: typing.List["DeploymentUpdateAction"]): + self.version = version + self.actions = actions + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentUpdate": + from ._schemas.deployment import DeploymentUpdateSchema + + return DeploymentUpdateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentUpdateSchema + + return DeploymentUpdateSchema().dump(self) + + +class DeploymentUpdateAction(_BaseType): + action: str + + def __init__(self, *, action: str): + self.action = action + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentUpdateAction": + if data["action"] == "redeploy": + from ._schemas.deployment import DeploymentRedeployActionSchema + + return DeploymentRedeployActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentUpdateActionSchema + + return DeploymentUpdateActionSchema().dump(self) + + +class DeploymentRedeployAction(DeploymentUpdateAction): + """Updates configuration values and redeploys a Deployment in `Draft`, `Deployed`, `Failed`, or `UndeployFailed` states. The new configuration values must include at least one valid application. Ensure that all deployment configuration keys and values match those specified in the application's `connect.yaml` file. + + Specific error codes: + - [DeploymentUnknownApplicationConfiguration](ctp:connect:type:DeploymentUnknownApplicationConfigurationError) + - [DeploymentUnknownApplicationConfigurationKey](ctp:connect:type:DeploymentUnknownApplicationConfigurationKeyError) + - [DeploymentInvalidStatusTransition](ctp:connect:type:DeploymentInvalidStatusTransitionError) + - [DeploymentApplicationDoNotBelong](ctp:connect:type:DeploymentApplicationDoNotBelongError) + - [DeploymentMustIncludeApplication](ctp:connect:type:DeploymentMustIncludeApplicationError) + - [DeploymentConnectorUpdateFailure](ctp:connect:type:DeploymentConnectorUpdateFailureError) + + """ + + #: Whether the scripts execution should be skipped during redeployment. + skip_scripts: typing.Optional[bool] + #: New configuration values for Deployment. If empty, any existing value is unchanged. + configuration_values: typing.Optional[ + typing.List["DeploymentConfigurationApplication"] + ] + #: Whether the Deployment Connector should be updated to its latest state during redeployment. + update_connector: typing.Optional[bool] + + def __init__( + self, + *, + skip_scripts: typing.Optional[bool] = None, + configuration_values: typing.Optional[ + typing.List["DeploymentConfigurationApplication"] + ] = None, + update_connector: typing.Optional[bool] = None + ): + self.skip_scripts = skip_scripts + self.configuration_values = configuration_values + self.update_connector = update_connector + + super().__init__(action="redeploy") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentRedeployAction": + from ._schemas.deployment import DeploymentRedeployActionSchema + + return DeploymentRedeployActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentRedeployActionSchema + + return DeploymentRedeployActionSchema().dump(self) + + +class DeploymentLog(_BaseType): + """The data representation of a Deployment log.""" + + type: str + #: Unique identifier of the [Deployment](ctp:connect:type:Deployment). + deployment_id: str + #: Name of the Connect application. + application_name: str + #: Severity of the log message. + severity: str + #: Timestamp of the log message. + timestamp: datetime.datetime + #: Event details of the log message. + details: typing.Any + + def __init__( + self, + *, + type: str, + deployment_id: str, + application_name: str, + severity: str, + timestamp: datetime.datetime, + details: typing.Any + ): + self.type = type + self.deployment_id = deployment_id + self.application_name = application_name + self.severity = severity + self.timestamp = timestamp + self.details = details + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeploymentLog": + from ._schemas.deployment import DeploymentLogSchema + + return DeploymentLogSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentLogSchema + + return DeploymentLogSchema().dump(self) + + +class DeploymentLogCursorPagedQueryResponse(_BaseType): + """A cursor paged query result containing an array of [DeploymentLog](ctp:connect:type:DeploymentLog).""" + + #: Array of DeploymentLog objects. + data: typing.List["DeploymentLog"] + #: The next page token. + next: str + + def __init__(self, *, data: typing.List["DeploymentLog"], next: str): + self.data = data + self.next = next + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentLogCursorPagedQueryResponse": + from ._schemas.deployment import DeploymentLogCursorPagedQueryResponseSchema + + return DeploymentLogCursorPagedQueryResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.deployment import DeploymentLogCursorPagedQueryResponseSchema + + return DeploymentLogCursorPagedQueryResponseSchema().dump(self) diff --git a/src/commercetools/connect/models/error.py b/src/commercetools/connect/models/error.py new file mode 100644 index 00000000..92266e95 --- /dev/null +++ b/src/commercetools/connect/models/error.py @@ -0,0 +1,944 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +__all__ = [ + "AuthenticationError", + "AuthorizationError", + "BadGatewayError", + "ConcurrentModificationError", + "ConnectorAlreadyCertifiedError", + "ConnectorReferenceNotFoundError", + "ConnectorSpecificationFileNotFoundError", + "ConnectorSpecificationFileNotValidError", + "ConnectorStagedInCertificationError", + "ConnectorStagedNotPreviewableError", + "ConnectorStagedNotPrivateError", + "ConnectorStagedPreviewRequestUnderProcessError", + "DeploymentApplicationDoNotBelongError", + "DeploymentApplicationRequiredError", + "DeploymentConnectorUpdateFailureError", + "DeploymentInvalidStatusTransitionError", + "DeploymentMustIncludeApplicationError", + "DeploymentUnknownApplicationConfigurationError", + "DeploymentUnknownApplicationConfigurationKeyError", + "DeploymentUnsupportedRegionError", + "DuplicateFieldError", + "ErrorObject", + "ErrorResponse", + "FieldValueNotFoundError", + "GeneralError", + "GitRepositoryNotReachableError", + "InvalidJsonInputError", + "InvalidPathParamError", + "InvalidQueryParamError", + "ResourceNotFoundError", +] + + +class ErrorObject(_BaseType): + """Represents a single error. Multiple errors may be included in an [ErrorResponse](ctp:connect:type:ErrorResponse).""" + + #: Error identifier. + code: str + #: Plain text description of the cause of the error. + message: str + + def __init__(self, *, code: str, message: str, **kwargs): + self.code = code + self.message = message + self.__dict__.update(kwargs) + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ErrorObject": + if data["code"] == "AuthenticationError": + from ._schemas.error import AuthenticationErrorSchema + + return AuthenticationErrorSchema().load(data) + if data["code"] == "AuthorizationError": + from ._schemas.error import AuthorizationErrorSchema + + return AuthorizationErrorSchema().load(data) + if data["code"] == "BadGateway": + from ._schemas.error import BadGatewayErrorSchema + + return BadGatewayErrorSchema().load(data) + if data["code"] == "ConcurrentModification": + from ._schemas.error import ConcurrentModificationErrorSchema + + return ConcurrentModificationErrorSchema().load(data) + if data["code"] == "DuplicateField": + from ._schemas.error import DuplicateFieldErrorSchema + + return DuplicateFieldErrorSchema().load(data) + if data["code"] == "FieldValueNotFound": + from ._schemas.error import FieldValueNotFoundErrorSchema + + return FieldValueNotFoundErrorSchema().load(data) + if data["code"] == "General": + from ._schemas.error import GeneralErrorSchema + + return GeneralErrorSchema().load(data) + if data["code"] == "InvalidJsonInput": + from ._schemas.error import InvalidJsonInputErrorSchema + + return InvalidJsonInputErrorSchema().load(data) + if data["code"] == "InvalidPathParam": + from ._schemas.error import InvalidPathParamErrorSchema + + return InvalidPathParamErrorSchema().load(data) + if data["code"] == "InvalidQueryParam": + from ._schemas.error import InvalidQueryParamErrorSchema + + return InvalidQueryParamErrorSchema().load(data) + if data["code"] == "ResourceNotFound": + from ._schemas.error import ResourceNotFoundErrorSchema + + return ResourceNotFoundErrorSchema().load(data) + if data["code"] == "ConnectorAlreadyCertified": + from ._schemas.error import ConnectorAlreadyCertifiedErrorSchema + + return ConnectorAlreadyCertifiedErrorSchema().load(data) + if data["code"] == "ConnectorStagedInCertification": + from ._schemas.error import ConnectorStagedInCertificationErrorSchema + + return ConnectorStagedInCertificationErrorSchema().load(data) + if data["code"] == "ConnectorStagedNotPreviewable": + from ._schemas.error import ConnectorStagedNotPreviewableErrorSchema + + return ConnectorStagedNotPreviewableErrorSchema().load(data) + if data["code"] == "ConnectorStagedNotPrivate": + from ._schemas.error import ConnectorStagedNotPrivateErrorSchema + + return ConnectorStagedNotPrivateErrorSchema().load(data) + if data["code"] == "ConnectorStagedPreviewRequestUnderProcess": + from ._schemas.error import ( + ConnectorStagedPreviewRequestUnderProcessErrorSchema, + ) + + return ConnectorStagedPreviewRequestUnderProcessErrorSchema().load(data) + if data["code"] == "GitRepositoryNotReachable": + from ._schemas.error import GitRepositoryNotReachableErrorSchema + + return GitRepositoryNotReachableErrorSchema().load(data) + if data["code"] == "ConnectorSpecificationFileNotFound": + from ._schemas.error import ConnectorSpecificationFileNotFoundErrorSchema + + return ConnectorSpecificationFileNotFoundErrorSchema().load(data) + if data["code"] == "ConnectorSpecificationFileNotValid": + from ._schemas.error import ConnectorSpecificationFileNotValidErrorSchema + + return ConnectorSpecificationFileNotValidErrorSchema().load(data) + if data["code"] == "ConnectorReferenceNotFound": + from ._schemas.error import ConnectorReferenceNotFoundErrorSchema + + return ConnectorReferenceNotFoundErrorSchema().load(data) + if data["code"] == "DeploymentConnectorUpdateFailure": + from ._schemas.error import DeploymentConnectorUpdateFailureErrorSchema + + return DeploymentConnectorUpdateFailureErrorSchema().load(data) + if data["code"] == "DeploymentInvalidStatusTransition": + from ._schemas.error import DeploymentInvalidStatusTransitionErrorSchema + + return DeploymentInvalidStatusTransitionErrorSchema().load(data) + if data["code"] == "DeploymentUnknownApplicationConfiguration": + from ._schemas.error import ( + DeploymentUnknownApplicationConfigurationErrorSchema, + ) + + return DeploymentUnknownApplicationConfigurationErrorSchema().load(data) + if data["code"] == "DeploymentUnknownApplicationConfigurationKey": + from ._schemas.error import ( + DeploymentUnknownApplicationConfigurationKeyErrorSchema, + ) + + return DeploymentUnknownApplicationConfigurationKeyErrorSchema().load(data) + if data["code"] == "DeploymentUnsupportedRegion": + from ._schemas.error import DeploymentUnsupportedRegionErrorSchema + + return DeploymentUnsupportedRegionErrorSchema().load(data) + if data["code"] == "DeploymentApplicationDoNotBelong": + from ._schemas.error import DeploymentApplicationDoNotBelongErrorSchema + + return DeploymentApplicationDoNotBelongErrorSchema().load(data) + if data["code"] == "DeploymentApplicationRequired": + from ._schemas.error import DeploymentApplicationRequiredErrorSchema + + return DeploymentApplicationRequiredErrorSchema().load(data) + if data["code"] == "DeploymentMustIncludeApplication": + from ._schemas.error import DeploymentMustIncludeApplicationErrorSchema + + return DeploymentMustIncludeApplicationErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ErrorObjectSchema + + return ErrorObjectSchema().dump(self) + + +class ErrorResponse(_BaseType): + """Base representation of an error response containing common fields to all errors.""" + + #: HTTP status code corresponding to the error. + status_code: int + #: First error message in the `errors` array. + message: str + #: Errors returned for a request. + #: + #: A single error response can contain multiple errors if the errors are related to the same HTTP status code such as `400`. + errors: typing.Optional[typing.List["ErrorObject"]] + + def __init__( + self, + *, + status_code: int, + message: str, + errors: typing.Optional[typing.List["ErrorObject"]] = None + ): + self.status_code = status_code + self.message = message + self.errors = errors + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ErrorResponse": + from ._schemas.error import ErrorResponseSchema + + return ErrorResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ErrorResponseSchema + + return ErrorResponseSchema().dump(self) + + +class AuthenticationError(ErrorObject): + """Returned when the client cannot be authenticated.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="AuthenticationError", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AuthenticationError": + from ._schemas.error import AuthenticationErrorSchema + + return AuthenticationErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import AuthenticationErrorSchema + + return AuthenticationErrorSchema().dump(self) + + +class AuthorizationError(ErrorObject): + """Returned when the client does not have sufficient permissions for this operation.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="AuthorizationError", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AuthorizationError": + from ._schemas.error import AuthorizationErrorSchema + + return AuthorizationErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import AuthorizationErrorSchema + + return AuthorizationErrorSchema().dump(self) + + +class BadGatewayError(ErrorObject): + """Returned when a server-side problem is caused by scaling infrastructure resources. + + The client application should retry the request with exponential backoff up to a point where further delay is unacceptable. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="BadGateway", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "BadGatewayError": + from ._schemas.error import BadGatewayErrorSchema + + return BadGatewayErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import BadGatewayErrorSchema + + return BadGatewayErrorSchema().dump(self) + + +class ConcurrentModificationError(ErrorObject): + """Returned when the request conflicts with the current state of the involved resources. Typically, the request attempts to modify a resource that is out of date (that is modified by another client since it was last retrieved). + The client application should resolve the conflict (with or without involving the end-user) before retrying the request. + + """ + + #: Expected version of the resource. + expected_version: int + #: Current version of the resource. + current_version: typing.Optional[int] + + def __init__( + self, + *, + message: str, + expected_version: int, + current_version: typing.Optional[int] = None, + **kwargs + ): + self.expected_version = expected_version + self.current_version = current_version + kwargs.pop("code", None) + super().__init__(message=message, code="ConcurrentModification", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConcurrentModificationError": + from ._schemas.error import ConcurrentModificationErrorSchema + + return ConcurrentModificationErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConcurrentModificationErrorSchema + + return ConcurrentModificationErrorSchema().dump(self) + + +class DuplicateFieldError(ErrorObject): + """Returned when a field value conflicts with an existing value causing a duplicate.""" + + #: Name of the conflicting field. + field: str + #: Conflicting duplicate value. + duplicate_value: typing.Any + + def __init__( + self, *, message: str, field: str, duplicate_value: typing.Any, **kwargs + ): + self.field = field + self.duplicate_value = duplicate_value + kwargs.pop("code", None) + super().__init__(message=message, code="DuplicateField", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DuplicateFieldError": + from ._schemas.error import DuplicateFieldErrorSchema + + return DuplicateFieldErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DuplicateFieldErrorSchema + + return DuplicateFieldErrorSchema().dump(self) + + +class FieldValueNotFoundError(ErrorObject): + """Returned when a value for a field is not found.""" + + #: Name of the field. + field: str + #: Conflicting value. + value: typing.Any + + def __init__(self, *, message: str, field: str, value: typing.Any, **kwargs): + self.field = field + self.value = value + kwargs.pop("code", None) + super().__init__(message=message, code="FieldValueNotFound", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "FieldValueNotFoundError": + from ._schemas.error import FieldValueNotFoundErrorSchema + + return FieldValueNotFoundErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import FieldValueNotFoundErrorSchema + + return FieldValueNotFoundErrorSchema().dump(self) + + +class GeneralError(ErrorObject): + """Returned when a server-side problem occurs before or after data persistence. In some cases, the requested action may successfully complete after the error is returned. Therefore, it is recommended to verify the status of the requested resource after receiving a 500 error. + + If you encounter this error, report it to the [Connect support team](https://support.commercetools.com/). + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="General", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "GeneralError": + from ._schemas.error import GeneralErrorSchema + + return GeneralErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import GeneralErrorSchema + + return GeneralErrorSchema().dump(self) + + +class InvalidJsonInputError(ErrorObject): + """Returned when an invalid JSON input has been sent. + Either the JSON is syntactically incorrect or does not conform to the expected shape (for example is missing a required field). + + The client application should validate the input according to the constraints described in the error message before sending the request. + + """ + + #: Further explanation about why the JSON is invalid. + detailed_error_message: str + + def __init__(self, *, message: str, detailed_error_message: str, **kwargs): + self.detailed_error_message = detailed_error_message + kwargs.pop("code", None) + super().__init__(message=message, code="InvalidJsonInput", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "InvalidJsonInputError": + from ._schemas.error import InvalidJsonInputErrorSchema + + return InvalidJsonInputErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import InvalidJsonInputErrorSchema + + return InvalidJsonInputErrorSchema().dump(self) + + +class InvalidPathParamError(ErrorObject): + """Returned when an invalid path parameter has been sent.""" + + #: Further explanation about why the path parameter is invalid. + detailed_error_message: str + + def __init__(self, *, message: str, detailed_error_message: str, **kwargs): + self.detailed_error_message = detailed_error_message + kwargs.pop("code", None) + super().__init__(message=message, code="InvalidPathParam", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "InvalidPathParamError": + from ._schemas.error import InvalidPathParamErrorSchema + + return InvalidPathParamErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import InvalidPathParamErrorSchema + + return InvalidPathParamErrorSchema().dump(self) + + +class InvalidQueryParamError(ErrorObject): + """Returned when an invalid query parameter has been sent.""" + + #: Further explanation about why the query parameter is invalid. + detailed_error_message: str + + def __init__(self, *, message: str, detailed_error_message: str, **kwargs): + self.detailed_error_message = detailed_error_message + kwargs.pop("code", None) + super().__init__(message=message, code="InvalidQueryParam", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "InvalidQueryParamError": + from ._schemas.error import InvalidQueryParamErrorSchema + + return InvalidQueryParamErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import InvalidQueryParamErrorSchema + + return InvalidQueryParamErrorSchema().dump(self) + + +class ResourceNotFoundError(ErrorObject): + """Returned when the resource addressed by the request URL does not exist.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="ResourceNotFound", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResourceNotFoundError": + from ._schemas.error import ResourceNotFoundErrorSchema + + return ResourceNotFoundErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ResourceNotFoundErrorSchema + + return ResourceNotFoundErrorSchema().dump(self) + + +class ConnectorAlreadyCertifiedError(ErrorObject): + """Returned when trying to certify a Connector that is already certified. + + The error is returned as a failed response to the [Publish](ctp:connect:type:ConnectorPublishAction) update action only when certification is required. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="ConnectorAlreadyCertified", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorAlreadyCertifiedError": + from ._schemas.error import ConnectorAlreadyCertifiedErrorSchema + + return ConnectorAlreadyCertifiedErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorAlreadyCertifiedErrorSchema + + return ConnectorAlreadyCertifiedErrorSchema().dump(self) + + +class ConnectorStagedInCertificationError(ErrorObject): + """Returned when trying to publish a Connector that requires certification but is already in the certification process. + + The error is returned as a failed response to the [Publish](ctp:connect:type:ConnectorPublishAction) update actiononly when certification is required. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="ConnectorStagedInCertification", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorStagedInCertificationError": + from ._schemas.error import ConnectorStagedInCertificationErrorSchema + + return ConnectorStagedInCertificationErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorStagedInCertificationErrorSchema + + return ConnectorStagedInCertificationErrorSchema().dump(self) + + +class ConnectorStagedNotPreviewableError(ErrorObject): + """Returned when a ConnectorStaged to be deployed is not previewable. + + The error is returned as a failed response to the [Create a Deployment](ctp:connect:endpoint:/{projectKey}/deployments:POST) request. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="ConnectorStagedNotPreviewable", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorStagedNotPreviewableError": + from ._schemas.error import ConnectorStagedNotPreviewableErrorSchema + + return ConnectorStagedNotPreviewableErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorStagedNotPreviewableErrorSchema + + return ConnectorStagedNotPreviewableErrorSchema().dump(self) + + +class ConnectorStagedNotPrivateError(ErrorObject): + """Returned when attempting to change the `privateProjects` of a non-private ConnectorStaged. + + The error is returned as a failed response to the [Add Project to Private Connector](ctp:connect:type:ConnectorAddPrivateProjectAction) and [Remove Project from Private Connector](ctp:connect:type:ConnectorRemovePrivateProjectAction) update actions. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="ConnectorStagedNotPrivate", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorStagedNotPrivateError": + from ._schemas.error import ConnectorStagedNotPrivateErrorSchema + + return ConnectorStagedNotPrivateErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorStagedNotPrivateErrorSchema + + return ConnectorStagedNotPrivateErrorSchema().dump(self) + + +class ConnectorStagedPreviewRequestUnderProcessError(ErrorObject): + """Returned when attempting to request previewable status of a ConnectorStaged that is currently being reviewed for previewable status. + + The error is returned as a failed response to the [Preview Connector](ctp:connect:type:ConnectorUpdatePreviewableAction) update action. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="ConnectorStagedPreviewRequestUnderProcess", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorStagedPreviewRequestUnderProcessError": + from ._schemas.error import ConnectorStagedPreviewRequestUnderProcessErrorSchema + + return ConnectorStagedPreviewRequestUnderProcessErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorStagedPreviewRequestUnderProcessErrorSchema + + return ConnectorStagedPreviewRequestUnderProcessErrorSchema().dump(self) + + +class GitRepositoryNotReachableError(ErrorObject): + """Returned when the GitHub repository is unreachable or not found.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="GitRepositoryNotReachable", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "GitRepositoryNotReachableError": + from ._schemas.error import GitRepositoryNotReachableErrorSchema + + return GitRepositoryNotReachableErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import GitRepositoryNotReachableErrorSchema + + return GitRepositoryNotReachableErrorSchema().dump(self) + + +class ConnectorSpecificationFileNotFoundError(ErrorObject): + """Returned when the Connector specification file was not found.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="ConnectorSpecificationFileNotFound", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSpecificationFileNotFoundError": + from ._schemas.error import ConnectorSpecificationFileNotFoundErrorSchema + + return ConnectorSpecificationFileNotFoundErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorSpecificationFileNotFoundErrorSchema + + return ConnectorSpecificationFileNotFoundErrorSchema().dump(self) + + +class ConnectorSpecificationFileNotValidError(ErrorObject): + """Returned when the Connector specification file is not valid.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="ConnectorSpecificationFileNotValid", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorSpecificationFileNotValidError": + from ._schemas.error import ConnectorSpecificationFileNotValidErrorSchema + + return ConnectorSpecificationFileNotValidErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorSpecificationFileNotValidErrorSchema + + return ConnectorSpecificationFileNotValidErrorSchema().dump(self) + + +class ConnectorReferenceNotFoundError(ErrorObject): + """Returned when the referenced Connector was not found.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="ConnectorReferenceNotFound", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ConnectorReferenceNotFoundError": + from ._schemas.error import ConnectorReferenceNotFoundErrorSchema + + return ConnectorReferenceNotFoundErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ConnectorReferenceNotFoundErrorSchema + + return ConnectorReferenceNotFoundErrorSchema().dump(self) + + +class DeploymentConnectorUpdateFailureError(ErrorObject): + """Returned when updating a Connector fails during [redeployment](ctp:connect:type:DeploymentRedeploy).""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="DeploymentConnectorUpdateFailure", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentConnectorUpdateFailureError": + from ._schemas.error import DeploymentConnectorUpdateFailureErrorSchema + + return DeploymentConnectorUpdateFailureErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DeploymentConnectorUpdateFailureErrorSchema + + return DeploymentConnectorUpdateFailureErrorSchema().dump(self) + + +class DeploymentInvalidStatusTransitionError(ErrorObject): + """Returned when the Deployment operation results in a invalid status transition. + + The error is returned as a failed response to the [Redeploy](ctp:connect:type:DeploymentRedeploy) update action. + + The message will contain `Already queued`, `Already deploying`, or `Already undeploying` based on the [DeploymentStatus](ctp:connect:type:DeploymentStatus) of the Deployment. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="DeploymentInvalidStatusTransition", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentInvalidStatusTransitionError": + from ._schemas.error import DeploymentInvalidStatusTransitionErrorSchema + + return DeploymentInvalidStatusTransitionErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DeploymentInvalidStatusTransitionErrorSchema + + return DeploymentInvalidStatusTransitionErrorSchema().dump(self) + + +class DeploymentUnknownApplicationConfigurationError(ErrorObject): + """Returned when the Deployment contains configuration values that are not defined in the Connect application's connect.yaml file. + + The error is returned as a failed response to the [Redeploy](ctp:connect:type:DeploymentRedeploy) update action and [Create a Deployment](ctp:connect:endpoint:/{projectKey}/deployments:POST) request. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="DeploymentUnknownApplicationConfiguration", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentUnknownApplicationConfigurationError": + from ._schemas.error import DeploymentUnknownApplicationConfigurationErrorSchema + + return DeploymentUnknownApplicationConfigurationErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DeploymentUnknownApplicationConfigurationErrorSchema + + return DeploymentUnknownApplicationConfigurationErrorSchema().dump(self) + + +class DeploymentUnknownApplicationConfigurationKeyError(ErrorObject): + """Returned when the Deployment contains a configuration key that is not defined in the Connect application's connect.yaml file. + + The error is returned as a failed response to the [Redeploy](ctp:connect:type:DeploymentRedeploy) update action and [Create a Deployment](ctp:connect:endpoint:/{projectKey}/deployments:POST) request. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, + code="DeploymentUnknownApplicationConfigurationKey", + **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentUnknownApplicationConfigurationKeyError": + from ._schemas.error import ( + DeploymentUnknownApplicationConfigurationKeyErrorSchema, + ) + + return DeploymentUnknownApplicationConfigurationKeyErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import ( + DeploymentUnknownApplicationConfigurationKeyErrorSchema, + ) + + return DeploymentUnknownApplicationConfigurationKeyErrorSchema().dump(self) + + +class DeploymentUnsupportedRegionError(ErrorObject): + """Returned when the Deployment region is not supported. + + The error is returned as a failed response to the [Create a Deployment](ctp:connect:endpoint:/{projectKey}/deployments:POST) request. + + """ + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__(message=message, code="DeploymentUnsupportedRegion", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentUnsupportedRegionError": + from ._schemas.error import DeploymentUnsupportedRegionErrorSchema + + return DeploymentUnsupportedRegionErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DeploymentUnsupportedRegionErrorSchema + + return DeploymentUnsupportedRegionErrorSchema().dump(self) + + +class DeploymentApplicationDoNotBelongError(ErrorObject): + """Returned when attempting to add an application that does not belong to the Deployment.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="DeploymentApplicationDoNotBelong", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentApplicationDoNotBelongError": + from ._schemas.error import DeploymentApplicationDoNotBelongErrorSchema + + return DeploymentApplicationDoNotBelongErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DeploymentApplicationDoNotBelongErrorSchema + + return DeploymentApplicationDoNotBelongErrorSchema().dump(self) + + +class DeploymentApplicationRequiredError(ErrorObject): + """Returned when a Deployment does not contain any applications.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="DeploymentApplicationRequired", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentApplicationRequiredError": + from ._schemas.error import DeploymentApplicationRequiredErrorSchema + + return DeploymentApplicationRequiredErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DeploymentApplicationRequiredErrorSchema + + return DeploymentApplicationRequiredErrorSchema().dump(self) + + +class DeploymentMustIncludeApplicationError(ErrorObject): + """Returned when attempting to remove an application that belongs to the Deployment.""" + + def __init__(self, *, message: str, **kwargs): + + kwargs.pop("code", None) + super().__init__( + message=message, code="DeploymentMustIncludeApplication", **kwargs + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeploymentMustIncludeApplicationError": + from ._schemas.error import DeploymentMustIncludeApplicationErrorSchema + + return DeploymentMustIncludeApplicationErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import DeploymentMustIncludeApplicationErrorSchema + + return DeploymentMustIncludeApplicationErrorSchema().dump(self) diff --git a/src/commercetools/contrib/pytest.py b/src/commercetools/contrib/pytest.py index 7d366cc5..e5ddfbcc 100644 --- a/src/commercetools/contrib/pytest.py +++ b/src/commercetools/contrib/pytest.py @@ -5,7 +5,6 @@ import pytest import requests -from commercetools import Client from commercetools.platform.client import Client as PlatformClient from commercetools.testing import backend_mocker from commercetools.testing.server import Server @@ -25,23 +24,13 @@ def commercetools_api(): @pytest.fixture -def ct_platform_client(commercetools_api) -> typing.Generator[Client, None, None]: +def ct_platform_client( + commercetools_api, +) -> typing.Generator[PlatformClient, None, None]: yield PlatformClient( client_id="client-id", client_secret="client-secret", - scope=[], - url="https://api.europe-west1.gcp.commercetools.com", - token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", - ) - - -@pytest.fixture -def commercetools_client(commercetools_api) -> typing.Generator[Client, None, None]: - yield Client( - project_key="unittest", - client_id="client-id", - client_secret="client-secret", - scope=[], + scope=["manage_project:test"], url="https://api.europe-west1.gcp.commercetools.com", token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", ) diff --git a/src/commercetools/checkout/models/__init__.py b/src/commercetools/frontend/.py similarity index 66% rename from src/commercetools/checkout/models/__init__.py rename to src/commercetools/frontend/.py index 8718d094..a73ba478 100644 --- a/src/commercetools/checkout/models/__init__.py +++ b/src/commercetools/frontend/.py @@ -4,5 +4,16 @@ # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen +import re -from .responses import * # noqa +import marshmallow +import marshmallow_enum + +from commercetools import helpers +from ... import models +import typing + +# Fields + + +# Marshmallow Schemas diff --git a/src/commercetools/frontend/client/__init__.py b/src/commercetools/frontend/client/__init__.py index 304ee4b7..e0d2b207 100644 --- a/src/commercetools/frontend/client/__init__.py +++ b/src/commercetools/frontend/client/__init__.py @@ -4,17 +4,24 @@ # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen -from commercetools.client import BaseClient +from commercetools.base_client import BaseClient +from .api.api_request_builder import ApiRequestBuilder from .frontastic.frontastic_request_builder import FrontasticRequestBuilder class Client(BaseClient): + def __init__(self, *args, **kwargs): - kwargs.setdefault("url", "https://{project}-{customer}.frontastic.io") - super().__init__(self, **kwargs) + kwargs.setdefault("url", "https://PROJECT_NAME-COMPANY_NAME.frontastic.TLD") + super().__init__(**kwargs) def frontastic(self) -> FrontasticRequestBuilder: return FrontasticRequestBuilder( client=self, ) + + def api(self) -> ApiRequestBuilder: + return ApiRequestBuilder( + client=self, + ) diff --git a/src/commercetools/frontend/client/action/frontastic_action_by_namespace_by_action_request_builder.py b/src/commercetools/frontend/client/action/frontastic_action_by_namespace_by_action_request_builder.py index 5fbb47ab..4681a3fc 100644 --- a/src/commercetools/frontend/client/action/frontastic_action_by_namespace_by_action_request_builder.py +++ b/src/commercetools/frontend/client/action/frontastic_action_by_namespace_by_action_request_builder.py @@ -14,6 +14,7 @@ class FrontasticActionByNamespaceByActionRequestBuilder: + _client: "BaseClient" _namespace: str _action: str diff --git a/src/commercetools/frontend/client/action/frontastic_action_request_builder.py b/src/commercetools/frontend/client/action/frontastic_action_request_builder.py index 391b0b03..12f72c59 100644 --- a/src/commercetools/frontend/client/action/frontastic_action_request_builder.py +++ b/src/commercetools/frontend/client/action/frontastic_action_request_builder.py @@ -16,6 +16,7 @@ class FrontasticActionRequestBuilder: + _client: "BaseClient" def __init__( diff --git a/src/commercetools/ml/client/attributes/__init__.py b/src/commercetools/frontend/client/api/__init__.py similarity index 100% rename from src/commercetools/ml/client/attributes/__init__.py rename to src/commercetools/frontend/client/api/__init__.py diff --git a/src/commercetools/ml/client/status/by_project_key_missing_data_images_status_request_builder.py b/src/commercetools/frontend/client/api/api_request_builder.py similarity index 51% rename from src/commercetools/ml/client/status/by_project_key_missing_data_images_status_request_builder.py rename to src/commercetools/frontend/client/api/api_request_builder.py index e87af584..77945ee6 100644 --- a/src/commercetools/ml/client/status/by_project_key_missing_data_images_status_request_builder.py +++ b/src/commercetools/frontend/client/api/api_request_builder.py @@ -7,31 +7,23 @@ import typing import warnings -from .by_project_key_missing_data_images_status_by_task_id_request_builder import ( - ByProjectKeyMissingDataImagesStatusByTaskIdRequestBuilder, -) +from ..build.api_build_request_builder import ApiBuildRequestBuilder if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyMissingDataImagesStatusRequestBuilder: +class ApiRequestBuilder: + _client: "BaseClient" - _project_key: str def __init__( self, - project_key: str, client: "BaseClient", ): - self._project_key = project_key self._client = client - def with_task_id( - self, task_id: str - ) -> ByProjectKeyMissingDataImagesStatusByTaskIdRequestBuilder: - return ByProjectKeyMissingDataImagesStatusByTaskIdRequestBuilder( - task_id=task_id, - project_key=self._project_key, + def build(self) -> ApiBuildRequestBuilder: + return ApiBuildRequestBuilder( client=self._client, ) diff --git a/src/commercetools/ml/client/config/__init__.py b/src/commercetools/frontend/client/build/__init__.py similarity index 100% rename from src/commercetools/ml/client/config/__init__.py rename to src/commercetools/frontend/client/build/__init__.py diff --git a/src/commercetools/ml/client/status/by_project_key_missing_data_prices_status_request_builder.py b/src/commercetools/frontend/client/build/api_build_request_builder.py similarity index 51% rename from src/commercetools/ml/client/status/by_project_key_missing_data_prices_status_request_builder.py rename to src/commercetools/frontend/client/build/api_build_request_builder.py index b9ae66d7..1d4d1e3f 100644 --- a/src/commercetools/ml/client/status/by_project_key_missing_data_prices_status_request_builder.py +++ b/src/commercetools/frontend/client/build/api_build_request_builder.py @@ -1,37 +1,30 @@ + # This file is automatically generated by the rmf-codegen project. # # The Python code generator is maintained by Lab Digital. If you want to # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen +from ..upload.api_build_upload_request_builder import ApiBuildUploadRequestBuilder import typing import warnings -from .by_project_key_missing_data_prices_status_by_task_id_request_builder import ( - ByProjectKeyMissingDataPricesStatusByTaskIdRequestBuilder, -) - if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyMissingDataPricesStatusRequestBuilder: - _client: "BaseClient" - _project_key: str +class ApiBuildRequestBuilder: + _client: "BaseClient" + + def __init__( self, - project_key: str, client: "BaseClient", ): - self._project_key = project_key self._client = client - - def with_task_id( - self, task_id: str - ) -> ByProjectKeyMissingDataPricesStatusByTaskIdRequestBuilder: - return ByProjectKeyMissingDataPricesStatusByTaskIdRequestBuilder( - task_id=task_id, - project_key=self._project_key, + + def upload(self) -> ApiBuildUploadRequestBuilder: + return ApiBuildUploadRequestBuilder( client=self._client, ) diff --git a/src/commercetools/frontend/client/context/frontastic_context_request_builder.py b/src/commercetools/frontend/client/context/frontastic_context_request_builder.py index 8815b28b..d7273daf 100644 --- a/src/commercetools/frontend/client/context/frontastic_context_request_builder.py +++ b/src/commercetools/frontend/client/context/frontastic_context_request_builder.py @@ -14,6 +14,7 @@ class FrontasticContextRequestBuilder: + _client: "BaseClient" def __init__( @@ -28,13 +29,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> "ProjectContext": - """Returns information about the project locales setup and the environment in which the requested host acts in. \ - - Headers: - - - `Accept` - `application/json` - Required - - """ + """Returns information about the project locales setup and the environment in which the requested host acts in.""" headers = {} if headers is None else headers response = self._client._get( endpoint=f"/frontastic/context", params={}, headers=headers, options=options diff --git a/src/commercetools/frontend/client/data_source/frontastic_data_source_by_identifier_request_builder.py b/src/commercetools/frontend/client/data_source/frontastic_data_source_by_identifier_request_builder.py index 0c66b186..0dd7ad44 100644 --- a/src/commercetools/frontend/client/data_source/frontastic_data_source_by_identifier_request_builder.py +++ b/src/commercetools/frontend/client/data_source/frontastic_data_source_by_identifier_request_builder.py @@ -14,6 +14,7 @@ class FrontasticDataSourceByIdentifierRequestBuilder: + _client: "BaseClient" _identifier: str diff --git a/src/commercetools/frontend/client/data_source/frontastic_data_source_request_builder.py b/src/commercetools/frontend/client/data_source/frontastic_data_source_request_builder.py index c1169c7c..d3fd3b4d 100644 --- a/src/commercetools/frontend/client/data_source/frontastic_data_source_request_builder.py +++ b/src/commercetools/frontend/client/data_source/frontastic_data_source_request_builder.py @@ -16,6 +16,7 @@ class FrontasticDataSourceRequestBuilder: + _client: "BaseClient" def __init__( diff --git a/src/commercetools/frontend/client/frontastic/frontastic_request_builder.py b/src/commercetools/frontend/client/frontastic/frontastic_request_builder.py index b63d9b2c..88d3e679 100644 --- a/src/commercetools/frontend/client/frontastic/frontastic_request_builder.py +++ b/src/commercetools/frontend/client/frontastic/frontastic_request_builder.py @@ -20,6 +20,7 @@ class FrontasticRequestBuilder: + _client: "BaseClient" def __init__( diff --git a/src/commercetools/frontend/client/page/frontastic_page_request_builder.py b/src/commercetools/frontend/client/page/frontastic_page_request_builder.py index f33ec8cb..b58da639 100644 --- a/src/commercetools/frontend/client/page/frontastic_page_request_builder.py +++ b/src/commercetools/frontend/client/page/frontastic_page_request_builder.py @@ -14,6 +14,7 @@ class FrontasticPageRequestBuilder: + _client: "BaseClient" def __init__( @@ -28,15 +29,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> "PageDataResponse": - """Returns the structure and data of the published page displayed from commercetools Frontend. \ - - Headers: - - - `Frontastic-Path` - `^/.*$` - Required - - `Accept` - `application/json` - Required - - `Frontastic-Locale` - [Locale](ctp:frontend-api:type:Locale) - Required - - """ + """Returns the structure and data of the published page displayed from commercetools Frontend.""" headers = {} if headers is None else headers response = self._client._get( endpoint=f"/frontastic/page", params={}, headers=headers, options=options diff --git a/src/commercetools/frontend/client/preview/frontastic_preview_request_builder.py b/src/commercetools/frontend/client/preview/frontastic_preview_request_builder.py index 5f78b4d2..c0b28d3d 100644 --- a/src/commercetools/frontend/client/preview/frontastic_preview_request_builder.py +++ b/src/commercetools/frontend/client/preview/frontastic_preview_request_builder.py @@ -14,6 +14,7 @@ class FrontasticPreviewRequestBuilder: + _client: "BaseClient" def __init__( @@ -30,13 +31,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> "PagePreviewDataResponse": - """Returns the page structure and data for a specific [preview](/../frontend-studio/previewing-page-versions#accessing-page-version-preview) by its `previewId`. \ - - Headers: - - - `Accept` - `application/json` - Required - - """ + """Returns the page structure and data for a specific [preview](/../frontend-studio/using-the-page-builder) by its `previewId`.""" headers = {} if headers is None else headers response = self._client._get( endpoint=f"/frontastic/preview", diff --git a/src/commercetools/ml/client/general_categories/__init__.py b/src/commercetools/frontend/client/upload/__init__.py similarity index 100% rename from src/commercetools/ml/client/general_categories/__init__.py rename to src/commercetools/frontend/client/upload/__init__.py diff --git a/src/commercetools/ml/client/status/by_project_key_missing_data_images_status_by_task_id_request_builder.py b/src/commercetools/frontend/client/upload/api_build_upload_request_builder.py similarity index 61% rename from src/commercetools/ml/client/status/by_project_key_missing_data_images_status_by_task_id_request_builder.py rename to src/commercetools/frontend/client/upload/api_build_upload_request_builder.py index 54ce0073..37c77a39 100644 --- a/src/commercetools/ml/client/status/by_project_key_missing_data_images_status_by_task_id_request_builder.py +++ b/src/commercetools/frontend/client/upload/api_build_upload_request_builder.py @@ -7,40 +7,38 @@ import typing import warnings -from ...models.missing_data import MissingImagesTaskStatus +from ...models.common import BuildUpload if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyMissingDataImagesStatusByTaskIdRequestBuilder: +class ApiBuildUploadRequestBuilder: + _client: "BaseClient" - _project_key: str - _task_id: str def __init__( self, - project_key: str, - task_id: str, client: "BaseClient", ): - self._project_key = project_key - self._task_id = task_id self._client = client - def get( + def post( self, + body: "BuildUpload", *, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, - ) -> "MissingImagesTaskStatus": + ) -> object: + """Uploads your backend builds from your custom CI environment to the Studio.""" headers = {} if headers is None else headers - response = self._client._get( - endpoint=f"/{self._project_key}/missing-data/images/status/{self._task_id}", + response = self._client._post( + endpoint=f"/api/build/upload", params={}, - headers=headers, + json=body.serialize(), + headers={"Content-Type": "multipart/form-data", **headers}, options=options, ) if response.status_code == 200: - return MissingImagesTaskStatus.deserialize(response.json()) + return object.deserialize(response.json()) warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/frontend/models/_schemas/common.py b/src/commercetools/frontend/models/_schemas/common.py index 20d02391..e17d9af2 100644 --- a/src/commercetools/frontend/models/_schemas/common.py +++ b/src/commercetools/frontend/models/_schemas/common.py @@ -32,6 +32,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DataSourceConfiguration(**data) @@ -48,15 +49,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DataSourceResponse(**data) class DataSourcesSchema(helpers.BaseSchema): + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DataSources(**data) @@ -69,6 +73,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Error(**data) @@ -87,6 +92,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Footer(**data) @@ -105,6 +111,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Head(**data) @@ -131,6 +138,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LayoutElement(**data) @@ -145,6 +153,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LayoutElementConfiguration(**data) @@ -163,6 +172,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Main(**data) @@ -183,6 +193,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Page(**data) @@ -212,6 +223,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PageDataResponse(**data) @@ -248,6 +260,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PageFolder(**data) @@ -261,6 +274,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PagePreviewContext(**data) @@ -281,6 +295,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PagePreviewDataResponse(**data) @@ -298,6 +313,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PathConfiguration(**data) @@ -317,6 +333,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProjectContext(**data) @@ -335,6 +352,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.RedirectResponse(**data) @@ -363,6 +381,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Sections(**data) @@ -385,6 +404,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Tastic(**data) @@ -398,6 +418,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TasticConfiguration(**data) @@ -415,4 +436,76 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ViewData(**data) + + +class BuildUploadSchema(helpers.BaseSchema): + metadata = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".BuildMetadataSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + extension = marshmallow.fields.ToDo(allow_none=True, load_default=None) + extension_map = marshmallow.fields.ToDo( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.BuildUpload(**data) + + +class BuildMetadataSchema(helpers.BaseSchema): + branch = marshmallow.fields.String(allow_none=True, load_default=None) + revision = marshmallow.fields.String(allow_none=True, load_default=None) + version_number = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="versionNumber" + ) + node_js_version = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="nodeJsVersion", + ) + build_successful = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="buildSuccessful" + ) + build_time = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="buildTime" + ) + build_duration = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="buildDuration" + ) + build_log = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="buildLog" + ) + deploy = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.BuildMetadata(**data) + + +class BuildUploadResultSchema(helpers.BaseSchema): + status = marshmallow.fields.String(allow_none=True, load_default=None) + message = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.BuildUploadResult(**data) diff --git a/src/commercetools/frontend/models/common.py b/src/commercetools/frontend/models/common.py index 63f4f645..86f91564 100644 --- a/src/commercetools/frontend/models/common.py +++ b/src/commercetools/frontend/models/common.py @@ -12,6 +12,9 @@ from ._abstract import _BaseType __all__ = [ + "BuildMetadata", + "BuildUpload", + "BuildUploadResult", "DataSourceConfiguration", "DataSourceResponse", "DataSources", @@ -565,3 +568,117 @@ def serialize(self) -> typing.Dict[str, typing.Any]: from ._schemas.common import ViewDataSchema return ViewDataSchema().dump(self) + + +class BuildUpload(_BaseType): + #: Metadata about the build. + metadata: "BuildMetadata" + #: Javascript bundle containing all code of the backend extensions. + extension: typing.BinaryIO + #: Map for the build file. When provided, exceptions will be logged with readable stack traces. + extension_map: typing.Optional[typing.BinaryIO] + + def __init__( + self, + *, + metadata: "BuildMetadata", + extension: typing.BinaryIO, + extension_map: typing.Optional[typing.BinaryIO] = None + ): + self.metadata = metadata + self.extension = extension + self.extension_map = extension_map + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "BuildUpload": + from ._schemas.common import BuildUploadSchema + + return BuildUploadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import BuildUploadSchema + + return BuildUploadSchema().dump(self) + + +class BuildMetadata(_BaseType): + #: Name of the Git branch to deploy. + branch: str + #: Full commit ID hash of the current HEAD. + revision: str + #: Current time represented in the format `YYYY.MM.DD.HH.mm`. This value should be unique and sortable. + version_number: str + #: Node.js version for the [Extension runner](/../frontend-getting-started/development-concepts#extension-runner). + node_js_version: typing.Optional[int] + #: If `true`, the build is marked as successful and [displayed in the Studio](/../frontend-studio/using-deployment-in-the-studio). + build_successful: bool + #: Date and time of the build in the [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339) format. For example, `2023-11-21T08:14:31.830Z`. + build_time: str + #: Build duration in seconds. + build_duration: int + #: CI execution logs. + build_log: str + #: If `true`, the build is automatically deployed to the staging environment, if `buildSuccessful` is `true`. + deploy: typing.Optional[bool] + + def __init__( + self, + *, + branch: str, + revision: str, + version_number: str, + node_js_version: typing.Optional[int] = None, + build_successful: bool, + build_time: str, + build_duration: int, + build_log: str, + deploy: typing.Optional[bool] = None + ): + self.branch = branch + self.revision = revision + self.version_number = version_number + self.node_js_version = node_js_version + self.build_successful = build_successful + self.build_time = build_time + self.build_duration = build_duration + self.build_log = build_log + self.deploy = deploy + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "BuildMetadata": + from ._schemas.common import BuildMetadataSchema + + return BuildMetadataSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import BuildMetadataSchema + + return BuildMetadataSchema().dump(self) + + +class BuildUploadResult(_BaseType): + #: Status of the build. + status: str + #: Description of the upload result. + message: str + + def __init__(self, *, status: str, message: str): + self.status = status + self.message = message + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "BuildUploadResult": + from ._schemas.common import BuildUploadResultSchema + + return BuildUploadResultSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import BuildUploadResultSchema + + return BuildUploadResultSchema().dump(self) diff --git a/src/commercetools/ml/client/products/__init__.py b/src/commercetools/history/.py similarity index 66% rename from src/commercetools/ml/client/products/__init__.py rename to src/commercetools/history/.py index 77902f62..a73ba478 100644 --- a/src/commercetools/ml/client/products/__init__.py +++ b/src/commercetools/history/.py @@ -4,3 +4,16 @@ # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen +import re + +import marshmallow +import marshmallow_enum + +from commercetools import helpers +from ... import models +import typing + +# Fields + + +# Marshmallow Schemas diff --git a/src/commercetools/checkout/__init__.py b/src/commercetools/history/__init__.py similarity index 100% rename from src/commercetools/checkout/__init__.py rename to src/commercetools/history/__init__.py diff --git a/src/commercetools/ml/client/__init__.py b/src/commercetools/history/client/__init__.py similarity index 69% rename from src/commercetools/ml/client/__init__.py rename to src/commercetools/history/client/__init__.py index 7828ae70..6d334bc1 100644 --- a/src/commercetools/ml/client/__init__.py +++ b/src/commercetools/history/client/__init__.py @@ -4,17 +4,18 @@ # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen -from commercetools.client import BaseClient +from commercetools.base_client import BaseClient from .by_project_key_request_builder import ByProjectKeyRequestBuilder class Client(BaseClient): + def __init__(self, *args, **kwargs): - kwargs.setdefault("url", "https://ml-eu.europe-west1.gcp.commercetools.com") - super().__init__(self, **kwargs) + kwargs.setdefault("url", "https://history.europe-west1.gcp.commercetools.com") + super().__init__(**kwargs) - def with_project_key(self, project_key: str) -> ByProjectKeyRequestBuilder: + def with_project_key_value(self, project_key: str) -> ByProjectKeyRequestBuilder: return ByProjectKeyRequestBuilder( project_key=project_key, client=self, diff --git a/src/commercetools/history/client/by_project_key_by_resource_type_by_id_request_builder.py b/src/commercetools/history/client/by_project_key_by_resource_type_by_id_request_builder.py new file mode 100644 index 00000000..c59b5fb1 --- /dev/null +++ b/src/commercetools/history/client/by_project_key_by_resource_type_by_id_request_builder.py @@ -0,0 +1,87 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ..models.change_history import ErrorResponse, RecordPagedQueryResponse + +if typing.TYPE_CHECKING: + from ..base_client import BaseClient + + +class ByProjectKeyByResourceTypeByIDRequestBuilder: + + _client: "BaseClient" + _project_key: str + _resource_type: str + _id: str + + def __init__( + self, + project_key: str, + resource_type: str, + id: str, + client: "BaseClient", + ): + self._project_key = project_key + self._resource_type = resource_type + self._id = id + self._client = client + + def get( + self, + *, + date_from: object = None, + date_to: object = None, + limit: int = None, + offset: int = None, + user_id: str = None, + client_id: str = None, + customer_id: str = None, + associate_id: str = None, + business_unit: str = None, + type: str = None, + source: str = None, + changes: typing.List["str"] = None, + stores: typing.List["str"] = None, + exclude_platform_initiated_changes: typing.List[ + "PlatformInitiatedChange" + ] = None, + expand: bool = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> "RecordPagedQueryResponse": + """The `view_audit_log:{projectKey}` scope is required, and depending on the [resource type](ctp:history:type:ChangeHistoryResourceType) queried, their respective scopes must be granted.""" + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/{self._resource_type}/{self._id}", + params={ + "date.from": date_from, + "date.to": date_to, + "limit": limit, + "offset": offset, + "userId": user_id, + "clientId": client_id, + "customerId": customer_id, + "associateId": associate_id, + "businessUnit": business_unit, + "type": type, + "source": source, + "changes": changes, + "stores": stores, + "excludePlatformInitiatedChanges": exclude_platform_initiated_changes, + "expand": expand, + }, + headers=headers, + options=options, + ) + if response.status_code == 200: + return RecordPagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/history/client/by_project_key_by_resource_type_request_builder.py b/src/commercetools/history/client/by_project_key_by_resource_type_request_builder.py new file mode 100644 index 00000000..8600789f --- /dev/null +++ b/src/commercetools/history/client/by_project_key_by_resource_type_request_builder.py @@ -0,0 +1,97 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ..models.change_history import ErrorResponse, RecordPagedQueryResponse +from .by_project_key_by_resource_type_by_id_request_builder import ( + ByProjectKeyByResourceTypeByIDRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ..base_client import BaseClient + + +class ByProjectKeyByResourceTypeRequestBuilder: + + _client: "BaseClient" + _project_key: str + _resource_type: str + + def __init__( + self, + project_key: str, + resource_type: str, + client: "BaseClient", + ): + self._project_key = project_key + self._resource_type = resource_type + self._client = client + + def with_id_value(self, id: str) -> ByProjectKeyByResourceTypeByIDRequestBuilder: + return ByProjectKeyByResourceTypeByIDRequestBuilder( + id=id, + project_key=self._project_key, + resource_type=self._resource_type, + client=self._client, + ) + + def get( + self, + *, + date_from: object = None, + date_to: object = None, + limit: int = None, + offset: int = None, + user_id: str = None, + client_id: str = None, + customer_id: str = None, + associate_id: str = None, + business_unit: str = None, + type: str = None, + resource_key: str = None, + source: str = None, + changes: typing.List["str"] = None, + stores: typing.List["str"] = None, + exclude_platform_initiated_changes: typing.List[ + "PlatformInitiatedChange" + ] = None, + expand: bool = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> "RecordPagedQueryResponse": + """The `view_audit_log:{projectKey}` scope is required, and depending on the [resource type](ctp:history:type:ChangeHistoryResourceType) queried, their respective scopes must be granted.""" + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/{self._resource_type}", + params={ + "date.from": date_from, + "date.to": date_to, + "limit": limit, + "offset": offset, + "userId": user_id, + "clientId": client_id, + "customerId": customer_id, + "associateId": associate_id, + "businessUnit": business_unit, + "type": type, + "resourceKey": resource_key, + "source": source, + "changes": changes, + "stores": stores, + "excludePlatformInitiatedChanges": exclude_platform_initiated_changes, + "expand": expand, + }, + headers=headers, + options=options, + ) + if response.status_code == 200: + return RecordPagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/history/client/by_project_key_request_builder.py b/src/commercetools/history/client/by_project_key_request_builder.py new file mode 100644 index 00000000..a2506384 --- /dev/null +++ b/src/commercetools/history/client/by_project_key_request_builder.py @@ -0,0 +1,99 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ..models.change_history import ErrorResponse, RecordPagedQueryResponse +from .by_project_key_by_resource_type_request_builder import ( + ByProjectKeyByResourceTypeRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ..base_client import BaseClient + + +class ByProjectKeyRequestBuilder: + + _client: "BaseClient" + _project_key: str + + def __init__( + self, + project_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._client = client + + def with_resource_type_value( + self, resource_type: str + ) -> ByProjectKeyByResourceTypeRequestBuilder: + return ByProjectKeyByResourceTypeRequestBuilder( + resource_type=resource_type, + project_key=self._project_key, + client=self._client, + ) + + def get( + self, + *, + resource_types: typing.List["ChangeHistoryResourceType"] = None, + date_from: object = None, + date_to: object = None, + limit: int = None, + offset: int = None, + user_id: str = None, + client_id: str = None, + customer_id: str = None, + associate_id: str = None, + business_unit: str = None, + type: str = None, + resource_id: str = None, + resource_key: str = None, + source: str = None, + changes: typing.List["str"] = None, + stores: typing.List["str"] = None, + exclude_platform_initiated_changes: typing.List[ + "PlatformInitiatedChange" + ] = None, + expand: bool = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> "RecordPagedQueryResponse": + """The `view_audit_log:{projectKey}` scope is required, and depending on the [resource type](ctp:history:type:ChangeHistoryResourceType) queried, their respective scopes must be granted.""" + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}", + params={ + "resourceTypes": resource_types, + "date.from": date_from, + "date.to": date_to, + "limit": limit, + "offset": offset, + "userId": user_id, + "clientId": client_id, + "customerId": customer_id, + "associateId": associate_id, + "businessUnit": business_unit, + "type": type, + "resourceId": resource_id, + "resourceKey": resource_key, + "source": source, + "changes": changes, + "stores": stores, + "excludePlatformInitiatedChanges": exclude_platform_initiated_changes, + "expand": expand, + }, + headers=headers, + options=options, + ) + if response.status_code == 200: + return RecordPagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/ml/client/prices/__init__.py b/src/commercetools/history/models/__init__.py similarity index 62% rename from src/commercetools/ml/client/prices/__init__.py rename to src/commercetools/history/models/__init__.py index 77902f62..4a80a21e 100644 --- a/src/commercetools/ml/client/prices/__init__.py +++ b/src/commercetools/history/models/__init__.py @@ -4,3 +4,10 @@ # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen + +from . import * # noqa +from .change import * # noqa +from .change_history import * # noqa +from .change_value import * # noqa +from .common import * # noqa +from .label import * # noqa diff --git a/src/commercetools/checkout/models/_abstract.py b/src/commercetools/history/models/_abstract.py similarity index 100% rename from src/commercetools/checkout/models/_abstract.py rename to src/commercetools/history/models/_abstract.py diff --git a/src/commercetools/history/models/_schemas/change.py b/src/commercetools/history/models/_schemas/change.py new file mode 100644 index 00000000..882f19de --- /dev/null +++ b/src/commercetools/history/models/_schemas/change.py @@ -0,0 +1,7025 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from ..common import ( + AttributeConstraintEnum, + AuthenticationMode, + BusinessUnitAssociateMode, + BusinessUnitStatus, + BusinessUnitStoreMode, + ChannelRoleEnum, + OrderState, + PaymentState, + Permission, + QuoteRequestState, + QuoteState, + ReturnPaymentState, + ReturnShipmentState, + RoundingMode, + ShipmentState, + StackingMode, + StagedQuoteState, + StateRoleEnum, + StateTypeEnum, + TaxCalculationMode, + TaxMode, + TextInputHint, + TransactionState, +) +from .common import LocalizedStringField + +# Fields + + +# Marshmallow Schemas +class ChangeSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + change = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.Change(**data) + + +class AddAddressChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddAddressChange(**data) + + +class AddAssetChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddAssetChange(**data) + + +class AddAssociateChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddAssociateChange(**data) + + +class AddAttributeDefinitionChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AttributeDefinitionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddAttributeDefinitionChange(**data) + + +class AddBillingAddressIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddBillingAddressIdChange(**data) + + +class AddChannelRolesChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow_enum.EnumField(ChannelRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow_enum.EnumField(ChannelRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddChannelRolesChange(**data) + + +class AddCustomLineItemChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddCustomLineItemChange(**data) + + +class AddDeliveryChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.DeliveryChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.DeliveryChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddDeliveryChange(**data) + + +class AddDiscountCodeChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountCodeInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddDiscountCodeChange(**data) + + +class AddEnumValueChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.EnumValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddEnumValueChange(**data) + + +class AddExternalImageChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddExternalImageChange(**data) + + +class AddFieldDefinitionChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.FieldDefinitionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddFieldDefinitionChange(**data) + + +class AddInheritedAssociateChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.InheritedAssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddInheritedAssociateChange(**data) + + +class AddInterfaceInteractionChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.CustomFieldExpandedValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddInterfaceInteractionChange(**data) + + +class AddItemShippingAddressesChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddItemShippingAddressesChange(**data) + + +class AddLocalizedEnumValueChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AttributeLocalizedEnumValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddLocalizedEnumValueChange(**data) + + +class AddLocationChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LocationSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddLocationChange(**data) + + +class AddOrderLineItemChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddOrderLineItemChange(**data) + + +class AddParcelToDeliveryChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ParcelSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddParcelToDeliveryChange(**data) + + +class AddPaymentChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PaymentInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PaymentInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddPaymentChange(**data) + + +class AddPlainEnumValueChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AttributePlainEnumValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddPlainEnumValueChange(**data) + + +class AddPriceChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddPriceChange(**data) + + +class AddProductChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + variant_selection = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductVariantSelectionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="variantSelection", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddProductChange(**data) + + +class AddProductSelectionChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductSelectionSettingSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductSelectionSettingSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddProductSelectionChange(**data) + + +class AddPropertyChangeSchema(ChangeSchema): + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + path = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddPropertyChange(**data) + + +class AddReturnInfoChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReturnInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddReturnInfoChange(**data) + + +class AddShippingAddressIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddShippingAddressIdChange(**data) + + +class AddShoppingListLineItemChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddShoppingListLineItemChange(**data) + + +class AddStateRolesChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow_enum.EnumField(StateRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow_enum.EnumField(StateRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddStateRolesChange(**data) + + +class AddTaxRateChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddTaxRateChange(**data) + + +class AddTextLineItemChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TextLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddTextLineItemChange(**data) + + +class AddToCategoryChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + category = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddToCategoryChange(**data) + + +class AddTransactionChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TransactionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddTransactionChange(**data) + + +class AddVariantChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.VariantSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.VariantSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AddVariantChange(**data) + + +class ChangeAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAddressChange(**data) + + +class ChangeAmountAuthorizedChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAmountAuthorizedChange(**data) + + +class ChangeAmountPlannedChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAmountPlannedChange(**data) + + +class ChangeAssetNameChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AssetChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAssetNameChange(**data) + + +class ChangeAssetOrderChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + LocalizedStringField( + allow_none=True, values=marshmallow.fields.String(allow_none=True) + ), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + LocalizedStringField( + allow_none=True, values=marshmallow.fields.String(allow_none=True) + ), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAssetOrderChange(**data) + + +class ChangeAssociateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAssociateChange(**data) + + +class ChangeAssociateModeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + BusinessUnitAssociateMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + BusinessUnitAssociateMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAssociateModeChange(**data) + + +class ChangeAttributeConstraintChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + AttributeConstraintEnum, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + AttributeConstraintEnum, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAttributeConstraintChange(**data) + + +class ChangeAttributeOrderByNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeAttributeOrderByNameChange(**data) + + +class ChangeBuyerAssignableChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeBuyerAssignableChange(**data) + + +class ChangeCartDiscountsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeCartDiscountsChange(**data) + + +class ChangeCartPredicateChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeCartPredicateChange(**data) + + +class ChangeCustomLineItemQuantityChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeCustomLineItemQuantityChange(**data) + + +class ChangeDescriptionChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeDescriptionChange(**data) + + +class ChangeEmailChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeEmailChange(**data) + + +class ChangeEnumValueLabelChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + value_key = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="valueKey" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeEnumValueLabelChange(**data) + + +class ChangeEnumValueOrderChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.EnumValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.EnumValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeEnumValueOrderChange(**data) + + +class ChangeFieldDefinitionOrderChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.FieldDefinitionOrderValueSchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.FieldDefinitionOrderValueSchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeFieldDefinitionOrderChange(**data) + + +class ChangeGroupsChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeGroupsChange(**data) + + +class ChangeInheritedAssociateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.InheritedAssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.InheritedAssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeInheritedAssociateChange(**data) + + +class ChangeInitialChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeInitialChange(**data) + + +class ChangeInputHintChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + TextInputHint, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + TextInputHint, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeInputHintChange(**data) + + +class ChangeIsActiveChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeIsActiveChange(**data) + + +class ChangeIsSearchableChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="nextValue" + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeIsSearchableChange(**data) + + +class ChangeKeyChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeKeyChange(**data) + + +class ChangeLabelChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeLabelChange(**data) + + +class ChangeLineItemQuantityChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeLineItemQuantityChange(**data) + + +class ChangeLocalizedDescriptionChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeLocalizedDescriptionChange(**data) + + +class ChangeLocalizedEnumValueLabelChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + value_key = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="valueKey" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeLocalizedEnumValueLabelChange(**data) + + +class ChangeLocalizedEnumValueOrderChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.LocalizedEnumValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.LocalizedEnumValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + field_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="fieldName" + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeLocalizedEnumValueOrderChange(**data) + + +class ChangeLocalizedNameChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeLocalizedNameChange(**data) + + +class ChangeMasterVariantChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.VariantSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.VariantSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeMasterVariantChange(**data) + + +class ChangeNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeNameChange(**data) + + +class ChangeOrderHintChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeOrderHintChange(**data) + + +class ChangeOrderStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + OrderState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + OrderState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeOrderStateChange(**data) + + +class ChangeParentChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeParentChange(**data) + + +class ChangeParentUnitChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.KeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.KeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeParentUnitChange(**data) + + +class ChangePaymentStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + PaymentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + PaymentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangePaymentStateChange(**data) + + +class ChangePlainEnumValueLabelChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + value_key = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="valueKey" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangePlainEnumValueLabelChange(**data) + + +class ChangePlainEnumValueOrderChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.EnumValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.EnumValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangePlainEnumValueOrderChange(**data) + + +class ChangePredicateChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangePredicateChange(**data) + + +class ChangePriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangePriceChange(**data) + + +class ChangeProductSelectionActiveChangeSchema(ChangeSchema): + product_selection = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="productSelection", + ) + previous_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeProductSelectionActiveChange(**data) + + +class ChangeQuantityChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.InventoryQuantityValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.InventoryQuantityValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeQuantityChange(**data) + + +class ChangeQuoteRequestStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + QuoteRequestState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + QuoteRequestState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeQuoteRequestStateChange(**data) + + +class ChangeQuoteStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + QuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + QuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeQuoteStateChange(**data) + + +class ChangeRequiresDiscountCodeChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeRequiresDiscountCodeChange(**data) + + +class ChangeReviewRatingStatisticsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReviewRatingStatisticsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReviewRatingStatisticsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeReviewRatingStatisticsChange(**data) + + +class ChangeShipmentStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + ShipmentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + ShipmentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeShipmentStateChange(**data) + + +class ChangeShoppingListLineItemQuantityChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + line_item = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShoppingListLineItemValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="lineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeShoppingListLineItemQuantityChange(**data) + + +class ChangeShoppingListLineItemsOrderChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShoppingListLineItemValueSchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShoppingListLineItemValueSchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeShoppingListLineItemsOrderChange(**data) + + +class ChangeSlugChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeSlugChange(**data) + + +class ChangeSortOrderChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeSortOrderChange(**data) + + +class ChangeStackingModeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + StackingMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + StackingMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeStackingModeChange(**data) + + +class ChangeStagedQuoteStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + StagedQuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + StagedQuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeStagedQuoteStateChange(**data) + + +class ChangeStateTypeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + StateTypeEnum, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + StateTypeEnum, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeStateTypeChange(**data) + + +class ChangeStatusChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + BusinessUnitStatus, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + BusinessUnitStatus, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeStatusChange(**data) + + +class ChangeTargetChangeSchema(ChangeSchema): + previous_value = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "customLineItems": helpers.absmod( + __name__, ".change_value.ChangeTargetCustomLineItemsChangeValueSchema" + ), + "lineItems": helpers.absmod( + __name__, ".change_value.ChangeTargetLineItemsChangeValueSchema" + ), + "multiBuyCustomLineItems": helpers.absmod( + __name__, + ".change_value.ChangeTargetMultiBuyCustomLineItemsChangeValueSchema", + ), + "multiBuyLineItems": helpers.absmod( + __name__, ".change_value.ChangeTargetMultiBuyLineItemsChangeValueSchema" + ), + "shipping": helpers.absmod( + __name__, ".change_value.ChangeTargetShippingChangeValueSchema" + ), + }, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "customLineItems": helpers.absmod( + __name__, ".change_value.ChangeTargetCustomLineItemsChangeValueSchema" + ), + "lineItems": helpers.absmod( + __name__, ".change_value.ChangeTargetLineItemsChangeValueSchema" + ), + "multiBuyCustomLineItems": helpers.absmod( + __name__, + ".change_value.ChangeTargetMultiBuyCustomLineItemsChangeValueSchema", + ), + "multiBuyLineItems": helpers.absmod( + __name__, ".change_value.ChangeTargetMultiBuyLineItemsChangeValueSchema" + ), + "shipping": helpers.absmod( + __name__, ".change_value.ChangeTargetShippingChangeValueSchema" + ), + }, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTargetChange(**data) + + +class ChangeTaxCalculationModeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + TaxCalculationMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + TaxCalculationMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTaxCalculationModeChange(**data) + + +class ChangeTaxModeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + TaxMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTaxModeChange(**data) + + +class ChangeTaxRoundingModeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + RoundingMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + RoundingMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTaxRoundingModeChange(**data) + + +class ChangeTextLineItemNameChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + text_line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TextLineItemValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="textLineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTextLineItemNameChange(**data) + + +class ChangeTextLineItemQuantityChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + text_line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TextLineItemValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="textLineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTextLineItemQuantityChange(**data) + + +class ChangeTextLineItemsOrderChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TextLineItemValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TextLineItemValueSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTextLineItemsOrderChange(**data) + + +class ChangeTransactionInteractionIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + transaction = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TransactionChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTransactionInteractionIdChange(**data) + + +class ChangeTransactionStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + TransactionState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + TransactionState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + transaction = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TransactionChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTransactionStateChange(**data) + + +class ChangeTransactionTimestampChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + transaction = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TransactionChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTransactionTimestampChange(**data) + + +class ChangeValueChangeSchema(ChangeSchema): + previous_value = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "absolute": helpers.absmod( + __name__, ".change_value.ChangeValueAbsoluteChangeValueSchema" + ), + "external": helpers.absmod( + __name__, ".change_value.ChangeValueExternalChangeValueSchema" + ), + "giftLineItem": helpers.absmod( + __name__, ".change_value.ChangeValueGiftLineItemChangeValueSchema" + ), + "relative": helpers.absmod( + __name__, ".change_value.ChangeValueRelativeChangeValueSchema" + ), + }, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "absolute": helpers.absmod( + __name__, ".change_value.ChangeValueAbsoluteChangeValueSchema" + ), + "external": helpers.absmod( + __name__, ".change_value.ChangeValueExternalChangeValueSchema" + ), + "giftLineItem": helpers.absmod( + __name__, ".change_value.ChangeValueGiftLineItemChangeValueSchema" + ), + "relative": helpers.absmod( + __name__, ".change_value.ChangeValueRelativeChangeValueSchema" + ), + }, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeValueChange(**data) + + +class MoveImageToPositionChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.MoveImageToPositionChange(**data) + + +class PublishChangeSchema(ChangeSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.PublishChange(**data) + + +class RemoveAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveAddressChange(**data) + + +class RemoveAssetChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveAssetChange(**data) + + +class RemoveAssociateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveAssociateChange(**data) + + +class RemoveAttributeDefinitionChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AttributeDefinitionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveAttributeDefinitionChange(**data) + + +class RemoveBillingAddressIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveBillingAddressIdChange(**data) + + +class RemoveChannelRolesChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow_enum.EnumField(ChannelRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow_enum.EnumField(ChannelRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveChannelRolesChange(**data) + + +class RemoveCustomLineItemChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveCustomLineItemChange(**data) + + +class RemoveDeliveryItemsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DeliverySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveDeliveryItemsChange(**data) + + +class RemoveDiscountCodeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountCodeInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveDiscountCodeChange(**data) + + +class RemoveEnumValuesChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.EnumValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveEnumValuesChange(**data) + + +class RemoveFieldDefinitionChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.FieldDefinitionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveFieldDefinitionChange(**data) + + +class RemoveFromCategoryChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + category = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveFromCategoryChange(**data) + + +class RemoveImageChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveImageChange(**data) + + +class RemoveInheritedAssociateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.InheritedAssociateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveInheritedAssociateChange(**data) + + +class RemoveItemShippingAddressesChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveItemShippingAddressesChange(**data) + + +class RemoveLocalizedEnumValuesChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.LocalizedEnumValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveLocalizedEnumValuesChange(**data) + + +class RemoveLocationChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LocationSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveLocationChange(**data) + + +class RemoveOrderLineItemChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveOrderLineItemChange(**data) + + +class RemoveParcelFromDeliveryChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ParcelSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveParcelFromDeliveryChange(**data) + + +class RemovePaymentChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PaymentInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PaymentInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemovePaymentChange(**data) + + +class RemovePriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemovePriceChange(**data) + + +class RemoveProductChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveProductChange(**data) + + +class RemoveProductSelectionChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductSelectionSettingSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveProductSelectionChange(**data) + + +class RemovePropertyChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + path = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemovePropertyChange(**data) + + +class RemoveShippingAddressIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveShippingAddressIdChange(**data) + + +class RemoveShoppingListLineItemChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveShoppingListLineItemChange(**data) + + +class RemoveStateRolesChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow_enum.EnumField(StateRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow_enum.EnumField(StateRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveStateRolesChange(**data) + + +class RemoveTaxRateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveTaxRateChange(**data) + + +class RemoveTextLineItemChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TextLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TextLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveTextLineItemChange(**data) + + +class RemoveVariantChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.VariantSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.VariantSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RemoveVariantChange(**data) + + +class RequestQuoteRenegotiationChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + QuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + QuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + buyer_comment = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="buyerComment" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.RequestQuoteRenegotiationChange(**data) + + +class SetAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAddressChange(**data) + + +class SetAddressCustomFieldChangeSchema(ChangeSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + custom_type_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customTypeId" + ) + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAddressCustomFieldChange(**data) + + +class SetAddressCustomTypeChangeSchema(ChangeSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAddressCustomTypeChange(**data) + + +class SetAnonymousIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAnonymousIdChange(**data) + + +class SetApplicationVersionChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetApplicationVersionChange(**data) + + +class SetAssetCustomFieldChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + custom_type_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customTypeId" + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AssetChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAssetCustomFieldChange(**data) + + +class SetAssetCustomTypeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AssetChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAssetCustomTypeChange(**data) + + +class SetAssetDescriptionChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AssetChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAssetDescriptionChange(**data) + + +class SetAssetKeyChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AssetChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAssetKeyChange(**data) + + +class SetAssetSourcesChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSourceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSourceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AssetChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAssetSourcesChange(**data) + + +class SetAssetTagsChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AssetChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAssetTagsChange(**data) + + +class SetAttributeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AttributeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.AttributeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAttributeChange(**data) + + +class SetAuthenticationModeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + AuthenticationMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + AuthenticationMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAuthenticationModeChange(**data) + + +class SetAuthorNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetAuthorNameChange(**data) + + +class SetBillingAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetBillingAddressChange(**data) + + +class SetCartPredicateChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCartPredicateChange(**data) + + +class SetCategoryOrderHintChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CategoryOrderHintsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CategoryOrderHintsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + category_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="categoryId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCategoryOrderHintChange(**data) + + +class SetChannelRolesChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow_enum.EnumField(ChannelRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow_enum.EnumField(ChannelRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetChannelRolesChange(**data) + + +class SetCompanyNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCompanyNameChange(**data) + + +class SetContactEmailChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetContactEmailChange(**data) + + +class SetCountriesChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.StoreCountrySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.StoreCountrySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCountriesChange(**data) + + +class SetCountryChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCountryChange(**data) + + +class SetCustomFieldChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + custom_type_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customTypeId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomFieldChange(**data) + + +class SetCustomLineItemCustomFieldChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemCustomFieldChange(**data) + + +class SetCustomLineItemCustomTypeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemCustomTypeChange(**data) + + +class SetCustomLineItemMoneyChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemMoneyChange(**data) + + +class SetCustomLineItemShippingDetailsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemShippingDetailsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemShippingDetailsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemShippingDetailsChange(**data) + + +class SetCustomLineItemTaxAmountChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemTaxAmountChange(**data) + + +class SetCustomLineItemTaxCategoryChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemTaxCategoryChange(**data) + + +class SetCustomLineItemTaxRateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemTaxRateChange(**data) + + +class SetCustomLineItemTaxedPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemTaxedPriceChange(**data) + + +class SetCustomLineItemTotalPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + custom_line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="customLineItem", + ) + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomLineItemTotalPriceChange(**data) + + +class SetCustomShippingMethodChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.CustomShippingMethodChangeValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.CustomShippingMethodChangeValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomShippingMethodChange(**data) + + +class SetCustomTypeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomTypeChange(**data) + + +class SetCustomerChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomerChange(**data) + + +class SetCustomerEmailChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomerEmailChange(**data) + + +class SetCustomerGroupChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomerGroupChange(**data) + + +class SetCustomerIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomerIdChange(**data) + + +class SetCustomerNumberChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetCustomerNumberChange(**data) + + +class SetDateOfBirthChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDateOfBirthChange(**data) + + +class SetDefaultBillingAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDefaultBillingAddressChange(**data) + + +class SetDefaultShippingAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDefaultShippingAddressChange(**data) + + +class SetDeleteDaysAfterLastModificationChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDeleteDaysAfterLastModificationChange(**data) + + +class SetDeliveryAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDeliveryAddressChange(**data) + + +class SetDeliveryItemsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDeliveryItemsChange(**data) + + +class SetDescriptionChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDescriptionChange(**data) + + +class SetDiscountedPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDiscountedPriceChange(**data) + + +class SetDistributionChannelsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetDistributionChannelsChange(**data) + + +class SetExpectedDeliveryChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetExpectedDeliveryChange(**data) + + +class SetExternalIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetExternalIdChange(**data) + + +class SetFirstNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetFirstNameChange(**data) + + +class SetGeoLocationChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.GeoLocationSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.GeoLocationSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetGeoLocationChange(**data) + + +class SetImageLabelChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetImageLabelChange(**data) + + +class SetInputTipChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + attribute_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="attributeName" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetInputTipChange(**data) + + +class SetInterfaceIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetInterfaceIdChange(**data) + + +class SetIsValidChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetIsValidChange(**data) + + +class SetKeyChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetKeyChange(**data) + + +class SetLanguagesChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLanguagesChange(**data) + + +class SetLastNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLastNameChange(**data) + + +class SetLineItemDeactivatedAtChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + line_item = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShoppingListLineItemValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="lineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemDeactivatedAtChange(**data) + + +class SetLineItemDiscountedPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountedLineItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountedLineItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemDiscountedPriceChange(**data) + + +class SetLineItemDiscountedPricePerQuantityChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".common.DiscountedLineItemPriceForQuantitySchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".common.DiscountedLineItemPriceForQuantitySchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemDiscountedPricePerQuantityChange(**data) + + +class SetLineItemDistributionChannelChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemDistributionChannelChange(**data) + + +class SetLineItemPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemPriceChange(**data) + + +class SetLineItemProductKeyChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemProductKeyChange(**data) + + +class SetLineItemProductSlugChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemProductSlugChange(**data) + + +class SetLineItemShippingDetailsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemShippingDetailsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemShippingDetailsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemShippingDetailsChange(**data) + + +class SetLineItemTaxAmountChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemTaxAmountChange(**data) + + +class SetLineItemTaxRateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemTaxRateChange(**data) + + +class SetLineItemTaxedPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxedItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxedItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemTaxedPriceChange(**data) + + +class SetLineItemTotalPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLineItemTotalPriceChange(**data) + + +class SetLocaleChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLocaleChange(**data) + + +class SetLocalizedDescriptionChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLocalizedDescriptionChange(**data) + + +class SetMaxApplicationsChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMaxApplicationsChange(**data) + + +class SetMaxApplicationsPerCustomerChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMaxApplicationsPerCustomerChange(**data) + + +class SetMetaDescriptionChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMetaDescriptionChange(**data) + + +class SetMetaKeywordsChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMetaKeywordsChange(**data) + + +class SetMetaTitleChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMetaTitleChange(**data) + + +class SetMethodInfoInterfaceChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMethodInfoInterfaceChange(**data) + + +class SetMethodInfoMethodChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMethodInfoMethodChange(**data) + + +class SetMethodInfoNameChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMethodInfoNameChange(**data) + + +class SetMiddleNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetMiddleNameChange(**data) + + +class SetNameChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetNameChange(**data) + + +class SetLocalizedNameChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetLocalizedNameChange(**data) + + +class SetOrderLineItemCustomFieldChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + custom_type_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customTypeId" + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetOrderLineItemCustomFieldChange(**data) + + +class SetOrderLineItemCustomTypeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="lineItem", + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetOrderLineItemCustomTypeChange(**data) + + +class SetOrderNumberChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetOrderNumberChange(**data) + + +class SetOrderTaxedPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxedItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxedItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetOrderTaxedPriceChange(**data) + + +class SetOrderTotalPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetOrderTotalPriceChange(**data) + + +class SetOrderTotalTaxChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetOrderTotalTaxChange(**data) + + +class SetParcelItemsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + parcel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.ParcelChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetParcelItemsChange(**data) + + +class SetParcelMeasurementsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ParcelMeasurementsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ParcelMeasurementsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + parcel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.ParcelChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetParcelMeasurementsChange(**data) + + +class SetParcelTrackingDataChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TrackingDataSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TrackingDataSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + parcel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.ParcelChangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetParcelTrackingDataChange(**data) + + +class SetPermissionsChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow_enum.EnumField(Permission, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow_enum.EnumField(Permission, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetPermissionsChange(**data) + + +class SetPricesChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetPricesChange(**data) + + +class SetProductCountChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetProductCountChange(**data) + + +class SetProductPriceCustomFieldChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetProductPriceCustomFieldChange(**data) + + +class SetProductPriceCustomTypeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetProductPriceCustomTypeChange(**data) + + +class SetProductSelectionsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductSelectionSettingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductSelectionSettingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetProductSelectionsChange(**data) + + +class SetProductVariantKeyChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetProductVariantKeyChange(**data) + + +class SetPropertyChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + path = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetPropertyChange(**data) + + +class SetPurchaseOrderNumberChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetPurchaseOrderNumberChange(**data) + + +class SetRatingChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetRatingChange(**data) + + +class SetReservationsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReservationSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReservationSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetReservationsChange(**data) + + +class SetRestockableInDaysChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetRestockableInDaysChange(**data) + + +class SetReturnPaymentStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + ReturnPaymentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + ReturnPaymentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetReturnPaymentStateChange(**data) + + +class SetReturnShipmentStateChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + ReturnShipmentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + ReturnShipmentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetReturnShipmentStateChange(**data) + + +class SetSalutationChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetSalutationChange(**data) + + +class SetSearchKeywordsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.SearchKeywordsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.SearchKeywordsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetSearchKeywordsChange(**data) + + +class SetSellerCommentChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetSellerCommentChange(**data) + + +class SetShippingAddressChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingAddressChange(**data) + + +class SetShippingInfoPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingInfoPriceChange(**data) + + +class SetShippingInfoTaxedPriceChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxedPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxedPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingInfoTaxedPriceChange(**data) + + +class SetShippingMethodChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShippingMethodChangeValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShippingMethodChangeValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingMethodChange(**data) + + +class SetShippingMethodTaxAmountChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShippingMethodTaxAmountChangeValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShippingMethodTaxAmountChangeValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingMethodTaxAmountChange(**data) + + +class SetShippingMethodTaxRateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + tax_mode = marshmallow_enum.EnumField( + TaxMode, by_value=True, allow_none=True, load_default=None, data_key="taxMode" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingMethodTaxRateChange(**data) + + +class SetShippingRateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingRateChange(**data) + + +class SetShippingRateInputChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.SetCartClassificationShippingRateInputValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.SetCartClassificationShippingRateInputValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShippingRateInputChange(**data) + + +class SetShoppingListLineItemCustomFieldChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + custom_type_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customTypeId" + ) + line_item = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShoppingListLineItemValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="lineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShoppingListLineItemCustomFieldChange(**data) + + +class SetShoppingListLineItemCustomTypeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".change_value.ShoppingListLineItemValueSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="lineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetShoppingListLineItemCustomTypeChange(**data) + + +class SetSkuChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetSkuChange(**data) + + +class SetSlugChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetSlugChange(**data) + + +class SetStateRolesChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.List( + marshmallow_enum.EnumField(StateRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow.fields.List( + marshmallow_enum.EnumField(StateRoleEnum, by_value=True, allow_none=True), + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetStateRolesChange(**data) + + +class SetStatusInterfaceCodeChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetStatusInterfaceCodeChange(**data) + + +class SetStatusInterfaceTextChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetStatusInterfaceTextChange(**data) + + +class SetStoreChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetStoreChange(**data) + + +class SetStoreModeChangeSchema(ChangeSchema): + previous_value = marshmallow_enum.EnumField( + BusinessUnitStoreMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="previousValue", + ) + next_value = marshmallow_enum.EnumField( + BusinessUnitStoreMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetStoreModeChange(**data) + + +class SetStoresChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetStoresChange(**data) + + +class SetSupplyChannelChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetSupplyChannelChange(**data) + + +class SetSupplyChannelsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetSupplyChannelsChange(**data) + + +class SetTargetChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTargetChange(**data) + + +class SetTaxCategoryChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTaxCategoryChange(**data) + + +class SetTextChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTextChange(**data) + + +class SetTextLineItemCustomFieldChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + custom_type_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customTypeId" + ) + text_line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TextLineItemValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="textLineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTextLineItemCustomFieldChange(**data) + + +class SetTextLineItemCustomTypeChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + text_line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TextLineItemValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="textLineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTextLineItemCustomTypeChange(**data) + + +class SetTextLineItemDescriptionChangeSchema(ChangeSchema): + previous_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="previousValue", + ) + next_value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="nextValue", + ) + text_line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.TextLineItemValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="textLineItem", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTextLineItemDescriptionChange(**data) + + +class SetTitleChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTitleChange(**data) + + +class SetTransitionsChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetTransitionsChange(**data) + + +class SetValidFromAndUntilChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.ValidFromAndUntilValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".change_value.ValidFromAndUntilValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetValidFromAndUntilChange(**data) + + +class SetValidFromChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetValidFromChange(**data) + + +class SetValidToChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetValidToChange(**data) + + +class SetValidUntilChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetValidUntilChange(**data) + + +class SetValueChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetValueChange(**data) + + +class SetVariantAvailabilityChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductVariantAvailabilitySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductVariantAvailabilitySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + catalog_data = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="catalogData" + ) + variant = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetVariantAvailabilityChange(**data) + + +class SetVariantSelectionChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductVariantSelectionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ProductVariantSelectionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetVariantSelectionChange(**data) + + +class SetVatIdChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.SetVatIdChange(**data) + + +class TransitionCustomLineItemStateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemStateSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemStateSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + state_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="stateId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.TransitionCustomLineItemStateChange(**data) + + +class TransitionLineItemStateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemStateSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ItemStateSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + state_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="stateId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.TransitionLineItemStateChange(**data) + + +class TransitionStateChangeSchema(ChangeSchema): + previous_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousValue", + ) + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.TransitionStateChange(**data) + + +class UnknownChangeSchema(ChangeSchema): + previous_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="previousValue" + ) + next_value = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="nextValue" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.UnknownChange(**data) + + +class UnpublishChangeSchema(ChangeSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.UnpublishChange(**data) + + +class UpdateSyncInfoChangeSchema(ChangeSchema): + next_value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.SyncInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="nextValue", + ) + channel_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="channelId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.UpdateSyncInfoChange(**data) + + +class VerifyEmailChangeSchema(ChangeSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.VerifyEmailChange(**data) diff --git a/src/commercetools/history/models/_schemas/change_history.py b/src/commercetools/history/models/_schemas/change_history.py new file mode 100644 index 00000000..d8687261 --- /dev/null +++ b/src/commercetools/history/models/_schemas/change_history.py @@ -0,0 +1,1106 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models + +# Fields + + +# Marshmallow Schemas +class RecordSchema(helpers.BaseSchema): + version = marshmallow.fields.Integer(allow_none=True, load_default=None) + previous_version = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="previousVersion" + ) + type = marshmallow.fields.String(allow_none=True, load_default=None) + modified_by = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ModifiedBySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="modifiedBy", + ) + modified_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="modifiedAt" + ) + label = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "AssociateRoleLabel": helpers.absmod( + __name__, ".label.AssociateRoleLabelSchema" + ), + "BusinessUnitLabel": helpers.absmod( + __name__, ".label.BusinessUnitLabelSchema" + ), + "CustomObjectLabel": helpers.absmod( + __name__, ".label.CustomObjectLabelSchema" + ), + "CustomerLabel": helpers.absmod(__name__, ".label.CustomerLabelSchema"), + "LocalizedLabel": helpers.absmod(__name__, ".label.LocalizedLabelSchema"), + "OrderLabel": helpers.absmod(__name__, ".label.OrderLabelSchema"), + "PaymentLabel": helpers.absmod(__name__, ".label.PaymentLabelSchema"), + "ProductLabel": helpers.absmod(__name__, ".label.ProductLabelSchema"), + "QuoteLabel": helpers.absmod(__name__, ".label.QuoteLabelSchema"), + "QuoteRequestLabel": helpers.absmod( + __name__, ".label.QuoteRequestLabelSchema" + ), + "ReviewLabel": helpers.absmod(__name__, ".label.ReviewLabelSchema"), + "StagedQuoteLabel": helpers.absmod( + __name__, ".label.StagedQuoteLabelSchema" + ), + "StringLabel": helpers.absmod(__name__, ".label.StringLabelSchema"), + }, + load_default=None, + ) + previous_label = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "AssociateRoleLabel": helpers.absmod( + __name__, ".label.AssociateRoleLabelSchema" + ), + "BusinessUnitLabel": helpers.absmod( + __name__, ".label.BusinessUnitLabelSchema" + ), + "CustomObjectLabel": helpers.absmod( + __name__, ".label.CustomObjectLabelSchema" + ), + "CustomerLabel": helpers.absmod(__name__, ".label.CustomerLabelSchema"), + "LocalizedLabel": helpers.absmod(__name__, ".label.LocalizedLabelSchema"), + "OrderLabel": helpers.absmod(__name__, ".label.OrderLabelSchema"), + "PaymentLabel": helpers.absmod(__name__, ".label.PaymentLabelSchema"), + "ProductLabel": helpers.absmod(__name__, ".label.ProductLabelSchema"), + "QuoteLabel": helpers.absmod(__name__, ".label.QuoteLabelSchema"), + "QuoteRequestLabel": helpers.absmod( + __name__, ".label.QuoteRequestLabelSchema" + ), + "ReviewLabel": helpers.absmod(__name__, ".label.ReviewLabelSchema"), + "StagedQuoteLabel": helpers.absmod( + __name__, ".label.StagedQuoteLabelSchema" + ), + "StringLabel": helpers.absmod(__name__, ".label.StringLabelSchema"), + }, + load_default=None, + data_key="previousLabel", + ) + changes = marshmallow.fields.List( + helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "AddAddressChange": helpers.absmod( + __name__, ".change.AddAddressChangeSchema" + ), + "AddAssetChange": helpers.absmod( + __name__, ".change.AddAssetChangeSchema" + ), + "AddAssociateChange": helpers.absmod( + __name__, ".change.AddAssociateChangeSchema" + ), + "AddAttributeDefinitionChange": helpers.absmod( + __name__, ".change.AddAttributeDefinitionChangeSchema" + ), + "AddBillingAddressIdChange": helpers.absmod( + __name__, ".change.AddBillingAddressIdChangeSchema" + ), + "AddChannelRolesChange": helpers.absmod( + __name__, ".change.AddChannelRolesChangeSchema" + ), + "AddCustomLineItemChange": helpers.absmod( + __name__, ".change.AddCustomLineItemChangeSchema" + ), + "AddDeliveryChange": helpers.absmod( + __name__, ".change.AddDeliveryChangeSchema" + ), + "AddDiscountCodeChange": helpers.absmod( + __name__, ".change.AddDiscountCodeChangeSchema" + ), + "AddEnumValueChange": helpers.absmod( + __name__, ".change.AddEnumValueChangeSchema" + ), + "AddExternalImageChange": helpers.absmod( + __name__, ".change.AddExternalImageChangeSchema" + ), + "AddFieldDefinitionChange": helpers.absmod( + __name__, ".change.AddFieldDefinitionChangeSchema" + ), + "AddInheritedAssociateChange": helpers.absmod( + __name__, ".change.AddInheritedAssociateChangeSchema" + ), + "AddInterfaceInteractionChange": helpers.absmod( + __name__, ".change.AddInterfaceInteractionChangeSchema" + ), + "AddItemShippingAddressesChange": helpers.absmod( + __name__, ".change.AddItemShippingAddressesChangeSchema" + ), + "AddLocalizedEnumValueChange": helpers.absmod( + __name__, ".change.AddLocalizedEnumValueChangeSchema" + ), + "AddLocationChange": helpers.absmod( + __name__, ".change.AddLocationChangeSchema" + ), + "AddOrderLineItemChange": helpers.absmod( + __name__, ".change.AddOrderLineItemChangeSchema" + ), + "AddParcelToDeliveryChange": helpers.absmod( + __name__, ".change.AddParcelToDeliveryChangeSchema" + ), + "AddPaymentChange": helpers.absmod( + __name__, ".change.AddPaymentChangeSchema" + ), + "AddPlainEnumValueChange": helpers.absmod( + __name__, ".change.AddPlainEnumValueChangeSchema" + ), + "AddPriceChange": helpers.absmod( + __name__, ".change.AddPriceChangeSchema" + ), + "AddProductChange": helpers.absmod( + __name__, ".change.AddProductChangeSchema" + ), + "AddProductSelectionChange": helpers.absmod( + __name__, ".change.AddProductSelectionChangeSchema" + ), + "AddPropertyChange": helpers.absmod( + __name__, ".change.AddPropertyChangeSchema" + ), + "AddReturnInfoChange": helpers.absmod( + __name__, ".change.AddReturnInfoChangeSchema" + ), + "AddShippingAddressIdChange": helpers.absmod( + __name__, ".change.AddShippingAddressIdChangeSchema" + ), + "AddShoppingListLineItemChange": helpers.absmod( + __name__, ".change.AddShoppingListLineItemChangeSchema" + ), + "AddStateRolesChange": helpers.absmod( + __name__, ".change.AddStateRolesChangeSchema" + ), + "AddTaxRateChange": helpers.absmod( + __name__, ".change.AddTaxRateChangeSchema" + ), + "AddTextLineItemChange": helpers.absmod( + __name__, ".change.AddTextLineItemChangeSchema" + ), + "AddToCategoryChange": helpers.absmod( + __name__, ".change.AddToCategoryChangeSchema" + ), + "AddTransactionChange": helpers.absmod( + __name__, ".change.AddTransactionChangeSchema" + ), + "AddVariantChange": helpers.absmod( + __name__, ".change.AddVariantChangeSchema" + ), + "ChangeAddressChange": helpers.absmod( + __name__, ".change.ChangeAddressChangeSchema" + ), + "ChangeAmountAuthorizedChange": helpers.absmod( + __name__, ".change.ChangeAmountAuthorizedChangeSchema" + ), + "ChangeAmountPlannedChange": helpers.absmod( + __name__, ".change.ChangeAmountPlannedChangeSchema" + ), + "ChangeAssetNameChange": helpers.absmod( + __name__, ".change.ChangeAssetNameChangeSchema" + ), + "ChangeAssetOrderChange": helpers.absmod( + __name__, ".change.ChangeAssetOrderChangeSchema" + ), + "ChangeAssociateChange": helpers.absmod( + __name__, ".change.ChangeAssociateChangeSchema" + ), + "ChangeAssociateModeChange": helpers.absmod( + __name__, ".change.ChangeAssociateModeChangeSchema" + ), + "ChangeAttributeConstraintChange": helpers.absmod( + __name__, ".change.ChangeAttributeConstraintChangeSchema" + ), + "ChangeAttributeOrderByNameChange": helpers.absmod( + __name__, ".change.ChangeAttributeOrderByNameChangeSchema" + ), + "ChangeBuyerAssignableChange": helpers.absmod( + __name__, ".change.ChangeBuyerAssignableChangeSchema" + ), + "ChangeCartDiscountsChange": helpers.absmod( + __name__, ".change.ChangeCartDiscountsChangeSchema" + ), + "ChangeCartPredicateChange": helpers.absmod( + __name__, ".change.ChangeCartPredicateChangeSchema" + ), + "ChangeCustomLineItemQuantityChange": helpers.absmod( + __name__, ".change.ChangeCustomLineItemQuantityChangeSchema" + ), + "ChangeDescriptionChange": helpers.absmod( + __name__, ".change.ChangeDescriptionChangeSchema" + ), + "ChangeEmailChange": helpers.absmod( + __name__, ".change.ChangeEmailChangeSchema" + ), + "ChangeEnumValueLabelChange": helpers.absmod( + __name__, ".change.ChangeEnumValueLabelChangeSchema" + ), + "ChangeEnumValueOrderChange": helpers.absmod( + __name__, ".change.ChangeEnumValueOrderChangeSchema" + ), + "ChangeFieldDefinitionOrderChange": helpers.absmod( + __name__, ".change.ChangeFieldDefinitionOrderChangeSchema" + ), + "ChangeGroupsChange": helpers.absmod( + __name__, ".change.ChangeGroupsChangeSchema" + ), + "ChangeInheritedAssociateChange": helpers.absmod( + __name__, ".change.ChangeInheritedAssociateChangeSchema" + ), + "ChangeInitialChange": helpers.absmod( + __name__, ".change.ChangeInitialChangeSchema" + ), + "ChangeInputHintChange": helpers.absmod( + __name__, ".change.ChangeInputHintChangeSchema" + ), + "ChangeIsActiveChange": helpers.absmod( + __name__, ".change.ChangeIsActiveChangeSchema" + ), + "ChangeIsSearchableChange": helpers.absmod( + __name__, ".change.ChangeIsSearchableChangeSchema" + ), + "ChangeKeyChange": helpers.absmod( + __name__, ".change.ChangeKeyChangeSchema" + ), + "ChangeLabelChange": helpers.absmod( + __name__, ".change.ChangeLabelChangeSchema" + ), + "ChangeLineItemQuantityChange": helpers.absmod( + __name__, ".change.ChangeLineItemQuantityChangeSchema" + ), + "ChangeLocalizedDescriptionChange": helpers.absmod( + __name__, ".change.ChangeLocalizedDescriptionChangeSchema" + ), + "ChangeLocalizedEnumValueLabelChange": helpers.absmod( + __name__, ".change.ChangeLocalizedEnumValueLabelChangeSchema" + ), + "ChangeLocalizedEnumValueOrderChange": helpers.absmod( + __name__, ".change.ChangeLocalizedEnumValueOrderChangeSchema" + ), + "ChangeLocalizedNameChange": helpers.absmod( + __name__, ".change.ChangeLocalizedNameChangeSchema" + ), + "ChangeMasterVariantChange": helpers.absmod( + __name__, ".change.ChangeMasterVariantChangeSchema" + ), + "ChangeNameChange": helpers.absmod( + __name__, ".change.ChangeNameChangeSchema" + ), + "ChangeOrderHintChange": helpers.absmod( + __name__, ".change.ChangeOrderHintChangeSchema" + ), + "ChangeOrderStateChange": helpers.absmod( + __name__, ".change.ChangeOrderStateChangeSchema" + ), + "ChangeParentChange": helpers.absmod( + __name__, ".change.ChangeParentChangeSchema" + ), + "ChangeParentUnitChange": helpers.absmod( + __name__, ".change.ChangeParentUnitChangeSchema" + ), + "ChangePaymentStateChange": helpers.absmod( + __name__, ".change.ChangePaymentStateChangeSchema" + ), + "ChangePlainEnumValueLabelChange": helpers.absmod( + __name__, ".change.ChangePlainEnumValueLabelChangeSchema" + ), + "ChangePlainEnumValueOrderChange": helpers.absmod( + __name__, ".change.ChangePlainEnumValueOrderChangeSchema" + ), + "ChangePredicateChange": helpers.absmod( + __name__, ".change.ChangePredicateChangeSchema" + ), + "ChangePriceChange": helpers.absmod( + __name__, ".change.ChangePriceChangeSchema" + ), + "ChangeProductSelectionActiveChange": helpers.absmod( + __name__, ".change.ChangeProductSelectionActiveChangeSchema" + ), + "ChangeQuantityChange": helpers.absmod( + __name__, ".change.ChangeQuantityChangeSchema" + ), + "ChangeQuoteRequestStateChange": helpers.absmod( + __name__, ".change.ChangeQuoteRequestStateChangeSchema" + ), + "ChangeQuoteStateChange": helpers.absmod( + __name__, ".change.ChangeQuoteStateChangeSchema" + ), + "ChangeRequiresDiscountCodeChange": helpers.absmod( + __name__, ".change.ChangeRequiresDiscountCodeChangeSchema" + ), + "ChangeReviewRatingStatisticsChange": helpers.absmod( + __name__, ".change.ChangeReviewRatingStatisticsChangeSchema" + ), + "ChangeShipmentStateChange": helpers.absmod( + __name__, ".change.ChangeShipmentStateChangeSchema" + ), + "ChangeShoppingListLineItemQuantityChange": helpers.absmod( + __name__, ".change.ChangeShoppingListLineItemQuantityChangeSchema" + ), + "ChangeShoppingListLineItemsOrderChange": helpers.absmod( + __name__, ".change.ChangeShoppingListLineItemsOrderChangeSchema" + ), + "ChangeSlugChange": helpers.absmod( + __name__, ".change.ChangeSlugChangeSchema" + ), + "ChangeSortOrderChange": helpers.absmod( + __name__, ".change.ChangeSortOrderChangeSchema" + ), + "ChangeStackingModeChange": helpers.absmod( + __name__, ".change.ChangeStackingModeChangeSchema" + ), + "ChangeStagedQuoteStateChange": helpers.absmod( + __name__, ".change.ChangeStagedQuoteStateChangeSchema" + ), + "ChangeStateTypeChange": helpers.absmod( + __name__, ".change.ChangeStateTypeChangeSchema" + ), + "ChangeStatusChange": helpers.absmod( + __name__, ".change.ChangeStatusChangeSchema" + ), + "ChangeTargetChange": helpers.absmod( + __name__, ".change.ChangeTargetChangeSchema" + ), + "ChangeTaxCalculationModeChange": helpers.absmod( + __name__, ".change.ChangeTaxCalculationModeChangeSchema" + ), + "ChangeTaxModeChange": helpers.absmod( + __name__, ".change.ChangeTaxModeChangeSchema" + ), + "ChangeTaxRoundingModeChange": helpers.absmod( + __name__, ".change.ChangeTaxRoundingModeChangeSchema" + ), + "ChangeTextLineItemNameChange": helpers.absmod( + __name__, ".change.ChangeTextLineItemNameChangeSchema" + ), + "ChangeTextLineItemQuantityChange": helpers.absmod( + __name__, ".change.ChangeTextLineItemQuantityChangeSchema" + ), + "ChangeTextLineItemsOrderChange": helpers.absmod( + __name__, ".change.ChangeTextLineItemsOrderChangeSchema" + ), + "ChangeTransactionInteractionIdChange": helpers.absmod( + __name__, ".change.ChangeTransactionInteractionIdChangeSchema" + ), + "ChangeTransactionStateChange": helpers.absmod( + __name__, ".change.ChangeTransactionStateChangeSchema" + ), + "ChangeTransactionTimestampChange": helpers.absmod( + __name__, ".change.ChangeTransactionTimestampChangeSchema" + ), + "ChangeValueChange": helpers.absmod( + __name__, ".change.ChangeValueChangeSchema" + ), + "MoveImageToPositionChange": helpers.absmod( + __name__, ".change.MoveImageToPositionChangeSchema" + ), + "PublishChange": helpers.absmod( + __name__, ".change.PublishChangeSchema" + ), + "RemoveAddressChange": helpers.absmod( + __name__, ".change.RemoveAddressChangeSchema" + ), + "RemoveAssetChange": helpers.absmod( + __name__, ".change.RemoveAssetChangeSchema" + ), + "RemoveAssociateChange": helpers.absmod( + __name__, ".change.RemoveAssociateChangeSchema" + ), + "RemoveAttributeDefinitionChange": helpers.absmod( + __name__, ".change.RemoveAttributeDefinitionChangeSchema" + ), + "RemoveBillingAddressIdChange": helpers.absmod( + __name__, ".change.RemoveBillingAddressIdChangeSchema" + ), + "RemoveChannelRolesChange": helpers.absmod( + __name__, ".change.RemoveChannelRolesChangeSchema" + ), + "RemoveCustomLineItemChange": helpers.absmod( + __name__, ".change.RemoveCustomLineItemChangeSchema" + ), + "RemoveDeliveryItemsChange": helpers.absmod( + __name__, ".change.RemoveDeliveryItemsChangeSchema" + ), + "RemoveDiscountCodeChange": helpers.absmod( + __name__, ".change.RemoveDiscountCodeChangeSchema" + ), + "RemoveEnumValuesChange": helpers.absmod( + __name__, ".change.RemoveEnumValuesChangeSchema" + ), + "RemoveFieldDefinitionChange": helpers.absmod( + __name__, ".change.RemoveFieldDefinitionChangeSchema" + ), + "RemoveFromCategoryChange": helpers.absmod( + __name__, ".change.RemoveFromCategoryChangeSchema" + ), + "RemoveImageChange": helpers.absmod( + __name__, ".change.RemoveImageChangeSchema" + ), + "RemoveInheritedAssociateChange": helpers.absmod( + __name__, ".change.RemoveInheritedAssociateChangeSchema" + ), + "RemoveItemShippingAddressesChange": helpers.absmod( + __name__, ".change.RemoveItemShippingAddressesChangeSchema" + ), + "RemoveLocalizedEnumValuesChange": helpers.absmod( + __name__, ".change.RemoveLocalizedEnumValuesChangeSchema" + ), + "RemoveLocationChange": helpers.absmod( + __name__, ".change.RemoveLocationChangeSchema" + ), + "RemoveOrderLineItemChange": helpers.absmod( + __name__, ".change.RemoveOrderLineItemChangeSchema" + ), + "RemoveParcelFromDeliveryChange": helpers.absmod( + __name__, ".change.RemoveParcelFromDeliveryChangeSchema" + ), + "RemovePaymentChange": helpers.absmod( + __name__, ".change.RemovePaymentChangeSchema" + ), + "RemovePriceChange": helpers.absmod( + __name__, ".change.RemovePriceChangeSchema" + ), + "RemoveProductChange": helpers.absmod( + __name__, ".change.RemoveProductChangeSchema" + ), + "RemoveProductSelectionChange": helpers.absmod( + __name__, ".change.RemoveProductSelectionChangeSchema" + ), + "RemovePropertyChange": helpers.absmod( + __name__, ".change.RemovePropertyChangeSchema" + ), + "RemoveShippingAddressIdChange": helpers.absmod( + __name__, ".change.RemoveShippingAddressIdChangeSchema" + ), + "RemoveShoppingListLineItemChange": helpers.absmod( + __name__, ".change.RemoveShoppingListLineItemChangeSchema" + ), + "RemoveStateRolesChange": helpers.absmod( + __name__, ".change.RemoveStateRolesChangeSchema" + ), + "RemoveTaxRateChange": helpers.absmod( + __name__, ".change.RemoveTaxRateChangeSchema" + ), + "RemoveTextLineItemChange": helpers.absmod( + __name__, ".change.RemoveTextLineItemChangeSchema" + ), + "RemoveVariantChange": helpers.absmod( + __name__, ".change.RemoveVariantChangeSchema" + ), + "RequestQuoteRenegotiationChange": helpers.absmod( + __name__, ".change.RequestQuoteRenegotiationChangeSchema" + ), + "SetAddressChange": helpers.absmod( + __name__, ".change.SetAddressChangeSchema" + ), + "SetAddressCustomFieldChange": helpers.absmod( + __name__, ".change.SetAddressCustomFieldChangeSchema" + ), + "SetAddressCustomTypeChange": helpers.absmod( + __name__, ".change.SetAddressCustomTypeChangeSchema" + ), + "SetAnonymousIdChange": helpers.absmod( + __name__, ".change.SetAnonymousIdChangeSchema" + ), + "SetApplicationVersionChange": helpers.absmod( + __name__, ".change.SetApplicationVersionChangeSchema" + ), + "SetAssetCustomFieldChange": helpers.absmod( + __name__, ".change.SetAssetCustomFieldChangeSchema" + ), + "SetAssetCustomTypeChange": helpers.absmod( + __name__, ".change.SetAssetCustomTypeChangeSchema" + ), + "SetAssetDescriptionChange": helpers.absmod( + __name__, ".change.SetAssetDescriptionChangeSchema" + ), + "SetAssetKeyChange": helpers.absmod( + __name__, ".change.SetAssetKeyChangeSchema" + ), + "SetAssetSourcesChange": helpers.absmod( + __name__, ".change.SetAssetSourcesChangeSchema" + ), + "SetAssetTagsChange": helpers.absmod( + __name__, ".change.SetAssetTagsChangeSchema" + ), + "SetAttributeChange": helpers.absmod( + __name__, ".change.SetAttributeChangeSchema" + ), + "SetAuthenticationModeChange": helpers.absmod( + __name__, ".change.SetAuthenticationModeChangeSchema" + ), + "SetAuthorNameChange": helpers.absmod( + __name__, ".change.SetAuthorNameChangeSchema" + ), + "SetBillingAddressChange": helpers.absmod( + __name__, ".change.SetBillingAddressChangeSchema" + ), + "SetCartPredicateChange": helpers.absmod( + __name__, ".change.SetCartPredicateChangeSchema" + ), + "SetCategoryOrderHintChange": helpers.absmod( + __name__, ".change.SetCategoryOrderHintChangeSchema" + ), + "SetChannelRolesChange": helpers.absmod( + __name__, ".change.SetChannelRolesChangeSchema" + ), + "SetCompanyNameChange": helpers.absmod( + __name__, ".change.SetCompanyNameChangeSchema" + ), + "SetContactEmailChange": helpers.absmod( + __name__, ".change.SetContactEmailChangeSchema" + ), + "SetCountriesChange": helpers.absmod( + __name__, ".change.SetCountriesChangeSchema" + ), + "SetCountryChange": helpers.absmod( + __name__, ".change.SetCountryChangeSchema" + ), + "SetCustomFieldChange": helpers.absmod( + __name__, ".change.SetCustomFieldChangeSchema" + ), + "SetCustomLineItemCustomFieldChange": helpers.absmod( + __name__, ".change.SetCustomLineItemCustomFieldChangeSchema" + ), + "SetCustomLineItemCustomTypeChange": helpers.absmod( + __name__, ".change.SetCustomLineItemCustomTypeChangeSchema" + ), + "SetCustomLineItemMoneyChange": helpers.absmod( + __name__, ".change.SetCustomLineItemMoneyChangeSchema" + ), + "SetCustomLineItemShippingDetailsChange": helpers.absmod( + __name__, ".change.SetCustomLineItemShippingDetailsChangeSchema" + ), + "SetCustomLineItemTaxAmountChange": helpers.absmod( + __name__, ".change.SetCustomLineItemTaxAmountChangeSchema" + ), + "SetCustomLineItemTaxCategoryChange": helpers.absmod( + __name__, ".change.SetCustomLineItemTaxCategoryChangeSchema" + ), + "SetCustomLineItemTaxRateChange": helpers.absmod( + __name__, ".change.SetCustomLineItemTaxRateChangeSchema" + ), + "SetCustomLineItemTaxedPriceChange": helpers.absmod( + __name__, ".change.SetCustomLineItemTaxedPriceChangeSchema" + ), + "SetCustomLineItemTotalPriceChange": helpers.absmod( + __name__, ".change.SetCustomLineItemTotalPriceChangeSchema" + ), + "SetCustomShippingMethodChange": helpers.absmod( + __name__, ".change.SetCustomShippingMethodChangeSchema" + ), + "SetCustomTypeChange": helpers.absmod( + __name__, ".change.SetCustomTypeChangeSchema" + ), + "SetCustomerChange": helpers.absmod( + __name__, ".change.SetCustomerChangeSchema" + ), + "SetCustomerEmailChange": helpers.absmod( + __name__, ".change.SetCustomerEmailChangeSchema" + ), + "SetCustomerGroupChange": helpers.absmod( + __name__, ".change.SetCustomerGroupChangeSchema" + ), + "SetCustomerIdChange": helpers.absmod( + __name__, ".change.SetCustomerIdChangeSchema" + ), + "SetCustomerNumberChange": helpers.absmod( + __name__, ".change.SetCustomerNumberChangeSchema" + ), + "SetDateOfBirthChange": helpers.absmod( + __name__, ".change.SetDateOfBirthChangeSchema" + ), + "SetDefaultBillingAddressChange": helpers.absmod( + __name__, ".change.SetDefaultBillingAddressChangeSchema" + ), + "SetDefaultShippingAddressChange": helpers.absmod( + __name__, ".change.SetDefaultShippingAddressChangeSchema" + ), + "SetDeleteDaysAfterLastModificationChange": helpers.absmod( + __name__, ".change.SetDeleteDaysAfterLastModificationChangeSchema" + ), + "SetDeliveryAddressChange": helpers.absmod( + __name__, ".change.SetDeliveryAddressChangeSchema" + ), + "SetDeliveryItemsChange": helpers.absmod( + __name__, ".change.SetDeliveryItemsChangeSchema" + ), + "SetDescriptionChange": helpers.absmod( + __name__, ".change.SetDescriptionChangeSchema" + ), + "SetDiscountedPriceChange": helpers.absmod( + __name__, ".change.SetDiscountedPriceChangeSchema" + ), + "SetDistributionChannelsChange": helpers.absmod( + __name__, ".change.SetDistributionChannelsChangeSchema" + ), + "SetExpectedDeliveryChange": helpers.absmod( + __name__, ".change.SetExpectedDeliveryChangeSchema" + ), + "SetExternalIdChange": helpers.absmod( + __name__, ".change.SetExternalIdChangeSchema" + ), + "SetFirstNameChange": helpers.absmod( + __name__, ".change.SetFirstNameChangeSchema" + ), + "SetGeoLocationChange": helpers.absmod( + __name__, ".change.SetGeoLocationChangeSchema" + ), + "SetImageLabelChange": helpers.absmod( + __name__, ".change.SetImageLabelChangeSchema" + ), + "SetInputTipChange": helpers.absmod( + __name__, ".change.SetInputTipChangeSchema" + ), + "SetInterfaceIdChange": helpers.absmod( + __name__, ".change.SetInterfaceIdChangeSchema" + ), + "SetIsValidChange": helpers.absmod( + __name__, ".change.SetIsValidChangeSchema" + ), + "SetKeyChange": helpers.absmod(__name__, ".change.SetKeyChangeSchema"), + "SetLanguagesChange": helpers.absmod( + __name__, ".change.SetLanguagesChangeSchema" + ), + "SetLastNameChange": helpers.absmod( + __name__, ".change.SetLastNameChangeSchema" + ), + "SetLineItemDeactivatedAtChange": helpers.absmod( + __name__, ".change.SetLineItemDeactivatedAtChangeSchema" + ), + "SetLineItemDiscountedPriceChange": helpers.absmod( + __name__, ".change.SetLineItemDiscountedPriceChangeSchema" + ), + "SetLineItemDiscountedPricePerQuantityChange": helpers.absmod( + __name__, + ".change.SetLineItemDiscountedPricePerQuantityChangeSchema", + ), + "SetLineItemDistributionChannelChange": helpers.absmod( + __name__, ".change.SetLineItemDistributionChannelChangeSchema" + ), + "SetLineItemPriceChange": helpers.absmod( + __name__, ".change.SetLineItemPriceChangeSchema" + ), + "SetLineItemProductKeyChange": helpers.absmod( + __name__, ".change.SetLineItemProductKeyChangeSchema" + ), + "SetLineItemProductSlugChange": helpers.absmod( + __name__, ".change.SetLineItemProductSlugChangeSchema" + ), + "SetLineItemShippingDetailsChange": helpers.absmod( + __name__, ".change.SetLineItemShippingDetailsChangeSchema" + ), + "SetLineItemTaxAmountChange": helpers.absmod( + __name__, ".change.SetLineItemTaxAmountChangeSchema" + ), + "SetLineItemTaxRateChange": helpers.absmod( + __name__, ".change.SetLineItemTaxRateChangeSchema" + ), + "SetLineItemTaxedPriceChange": helpers.absmod( + __name__, ".change.SetLineItemTaxedPriceChangeSchema" + ), + "SetLineItemTotalPriceChange": helpers.absmod( + __name__, ".change.SetLineItemTotalPriceChangeSchema" + ), + "SetLocaleChange": helpers.absmod( + __name__, ".change.SetLocaleChangeSchema" + ), + "SetLocalizedDescriptionChange": helpers.absmod( + __name__, ".change.SetLocalizedDescriptionChangeSchema" + ), + "SetMaxApplicationsChange": helpers.absmod( + __name__, ".change.SetMaxApplicationsChangeSchema" + ), + "SetMaxApplicationsPerCustomerChange": helpers.absmod( + __name__, ".change.SetMaxApplicationsPerCustomerChangeSchema" + ), + "SetMetaDescriptionChange": helpers.absmod( + __name__, ".change.SetMetaDescriptionChangeSchema" + ), + "SetMetaKeywordsChange": helpers.absmod( + __name__, ".change.SetMetaKeywordsChangeSchema" + ), + "SetMetaTitleChange": helpers.absmod( + __name__, ".change.SetMetaTitleChangeSchema" + ), + "SetMethodInfoInterfaceChange": helpers.absmod( + __name__, ".change.SetMethodInfoInterfaceChangeSchema" + ), + "SetMethodInfoMethodChange": helpers.absmod( + __name__, ".change.SetMethodInfoMethodChangeSchema" + ), + "SetMethodInfoNameChange": helpers.absmod( + __name__, ".change.SetMethodInfoNameChangeSchema" + ), + "SetMiddleNameChange": helpers.absmod( + __name__, ".change.SetMiddleNameChangeSchema" + ), + "SetNameChange": helpers.absmod( + __name__, ".change.SetNameChangeSchema" + ), + "SetLocalizedNameChange": helpers.absmod( + __name__, ".change.SetLocalizedNameChangeSchema" + ), + "SetOrderLineItemCustomFieldChange": helpers.absmod( + __name__, ".change.SetOrderLineItemCustomFieldChangeSchema" + ), + "SetOrderLineItemCustomTypeChange": helpers.absmod( + __name__, ".change.SetOrderLineItemCustomTypeChangeSchema" + ), + "SetOrderNumberChange": helpers.absmod( + __name__, ".change.SetOrderNumberChangeSchema" + ), + "SetOrderTaxedPriceChange": helpers.absmod( + __name__, ".change.SetOrderTaxedPriceChangeSchema" + ), + "SetOrderTotalPriceChange": helpers.absmod( + __name__, ".change.SetOrderTotalPriceChangeSchema" + ), + "SetOrderTotalTaxChange": helpers.absmod( + __name__, ".change.SetOrderTotalTaxChangeSchema" + ), + "SetParcelItemsChange": helpers.absmod( + __name__, ".change.SetParcelItemsChangeSchema" + ), + "SetParcelMeasurementsChange": helpers.absmod( + __name__, ".change.SetParcelMeasurementsChangeSchema" + ), + "SetParcelTrackingDataChange": helpers.absmod( + __name__, ".change.SetParcelTrackingDataChangeSchema" + ), + "SetPermissionsChange": helpers.absmod( + __name__, ".change.SetPermissionsChangeSchema" + ), + "SetPricesChange": helpers.absmod( + __name__, ".change.SetPricesChangeSchema" + ), + "SetProductCountChange": helpers.absmod( + __name__, ".change.SetProductCountChangeSchema" + ), + "SetProductPriceCustomFieldChange": helpers.absmod( + __name__, ".change.SetProductPriceCustomFieldChangeSchema" + ), + "SetProductPriceCustomTypeChange": helpers.absmod( + __name__, ".change.SetProductPriceCustomTypeChangeSchema" + ), + "SetProductSelectionsChange": helpers.absmod( + __name__, ".change.SetProductSelectionsChangeSchema" + ), + "SetProductVariantKeyChange": helpers.absmod( + __name__, ".change.SetProductVariantKeyChangeSchema" + ), + "SetPropertyChange": helpers.absmod( + __name__, ".change.SetPropertyChangeSchema" + ), + "SetPurchaseOrderNumberChange": helpers.absmod( + __name__, ".change.SetPurchaseOrderNumberChangeSchema" + ), + "SetRatingChange": helpers.absmod( + __name__, ".change.SetRatingChangeSchema" + ), + "SetReservationsChange": helpers.absmod( + __name__, ".change.SetReservationsChangeSchema" + ), + "SetRestockableInDaysChange": helpers.absmod( + __name__, ".change.SetRestockableInDaysChangeSchema" + ), + "SetReturnPaymentStateChange": helpers.absmod( + __name__, ".change.SetReturnPaymentStateChangeSchema" + ), + "SetReturnShipmentStateChange": helpers.absmod( + __name__, ".change.SetReturnShipmentStateChangeSchema" + ), + "SetSalutationChange": helpers.absmod( + __name__, ".change.SetSalutationChangeSchema" + ), + "SetSearchKeywordsChange": helpers.absmod( + __name__, ".change.SetSearchKeywordsChangeSchema" + ), + "SetSellerCommentChange": helpers.absmod( + __name__, ".change.SetSellerCommentChangeSchema" + ), + "SetShippingAddressChange": helpers.absmod( + __name__, ".change.SetShippingAddressChangeSchema" + ), + "SetShippingInfoPriceChange": helpers.absmod( + __name__, ".change.SetShippingInfoPriceChangeSchema" + ), + "SetShippingInfoTaxedPriceChange": helpers.absmod( + __name__, ".change.SetShippingInfoTaxedPriceChangeSchema" + ), + "SetShippingMethodChange": helpers.absmod( + __name__, ".change.SetShippingMethodChangeSchema" + ), + "SetShippingMethodTaxAmountChange": helpers.absmod( + __name__, ".change.SetShippingMethodTaxAmountChangeSchema" + ), + "SetShippingMethodTaxRateChange": helpers.absmod( + __name__, ".change.SetShippingMethodTaxRateChangeSchema" + ), + "SetShippingRateChange": helpers.absmod( + __name__, ".change.SetShippingRateChangeSchema" + ), + "SetShippingRateInputChange": helpers.absmod( + __name__, ".change.SetShippingRateInputChangeSchema" + ), + "SetShoppingListLineItemCustomFieldChange": helpers.absmod( + __name__, ".change.SetShoppingListLineItemCustomFieldChangeSchema" + ), + "SetShoppingListLineItemCustomTypeChange": helpers.absmod( + __name__, ".change.SetShoppingListLineItemCustomTypeChangeSchema" + ), + "SetSkuChange": helpers.absmod(__name__, ".change.SetSkuChangeSchema"), + "SetSlugChange": helpers.absmod( + __name__, ".change.SetSlugChangeSchema" + ), + "SetStateRolesChange": helpers.absmod( + __name__, ".change.SetStateRolesChangeSchema" + ), + "SetStatusInterfaceCodeChange": helpers.absmod( + __name__, ".change.SetStatusInterfaceCodeChangeSchema" + ), + "SetStatusInterfaceTextChange": helpers.absmod( + __name__, ".change.SetStatusInterfaceTextChangeSchema" + ), + "SetStoreChange": helpers.absmod( + __name__, ".change.SetStoreChangeSchema" + ), + "SetStoreModeChange": helpers.absmod( + __name__, ".change.SetStoreModeChangeSchema" + ), + "SetStoresChange": helpers.absmod( + __name__, ".change.SetStoresChangeSchema" + ), + "SetSupplyChannelChange": helpers.absmod( + __name__, ".change.SetSupplyChannelChangeSchema" + ), + "SetSupplyChannelsChange": helpers.absmod( + __name__, ".change.SetSupplyChannelsChangeSchema" + ), + "SetTargetChange": helpers.absmod( + __name__, ".change.SetTargetChangeSchema" + ), + "SetTaxCategoryChange": helpers.absmod( + __name__, ".change.SetTaxCategoryChangeSchema" + ), + "SetTextChange": helpers.absmod( + __name__, ".change.SetTextChangeSchema" + ), + "SetTextLineItemCustomFieldChange": helpers.absmod( + __name__, ".change.SetTextLineItemCustomFieldChangeSchema" + ), + "SetTextLineItemCustomTypeChange": helpers.absmod( + __name__, ".change.SetTextLineItemCustomTypeChangeSchema" + ), + "SetTextLineItemDescriptionChange": helpers.absmod( + __name__, ".change.SetTextLineItemDescriptionChangeSchema" + ), + "SetTitleChange": helpers.absmod( + __name__, ".change.SetTitleChangeSchema" + ), + "SetTransitionsChange": helpers.absmod( + __name__, ".change.SetTransitionsChangeSchema" + ), + "SetValidFromAndUntilChange": helpers.absmod( + __name__, ".change.SetValidFromAndUntilChangeSchema" + ), + "SetValidFromChange": helpers.absmod( + __name__, ".change.SetValidFromChangeSchema" + ), + "SetValidToChange": helpers.absmod( + __name__, ".change.SetValidToChangeSchema" + ), + "SetValidUntilChange": helpers.absmod( + __name__, ".change.SetValidUntilChangeSchema" + ), + "SetValueChange": helpers.absmod( + __name__, ".change.SetValueChangeSchema" + ), + "SetVariantAvailabilityChange": helpers.absmod( + __name__, ".change.SetVariantAvailabilityChangeSchema" + ), + "SetVariantSelectionChange": helpers.absmod( + __name__, ".change.SetVariantSelectionChangeSchema" + ), + "SetVatIdChange": helpers.absmod( + __name__, ".change.SetVatIdChangeSchema" + ), + "TransitionCustomLineItemStateChange": helpers.absmod( + __name__, ".change.TransitionCustomLineItemStateChangeSchema" + ), + "TransitionLineItemStateChange": helpers.absmod( + __name__, ".change.TransitionLineItemStateChangeSchema" + ), + "TransitionStateChange": helpers.absmod( + __name__, ".change.TransitionStateChangeSchema" + ), + "UnknownChange": helpers.absmod( + __name__, ".change.UnknownChangeSchema" + ), + "UnpublishChange": helpers.absmod( + __name__, ".change.UnpublishChangeSchema" + ), + "UpdateSyncInfoChange": helpers.absmod( + __name__, ".change.UpdateSyncInfoChangeSchema" + ), + "VerifyEmailChange": helpers.absmod( + __name__, ".change.VerifyEmailChangeSchema" + ), + }, + ), + allow_none=True, + load_default=None, + ) + resource = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + stores = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.KeyReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + business_unit = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.KeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="businessUnit", + ) + without_changes = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="withoutChanges" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Record(**data) + + +class RecordPagedQueryResponseSchema(helpers.BaseSchema): + limit = marshmallow.fields.Integer(allow_none=True, load_default=None) + count = marshmallow.fields.Integer(allow_none=True, load_default=None) + total = marshmallow.fields.Integer(allow_none=True, load_default=None) + offset = marshmallow.fields.Integer(allow_none=True, load_default=None) + results = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".RecordSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.RecordPagedQueryResponse(**data) + + +class ErrorObjectSchema(helpers.BaseSchema): + code = marshmallow.fields.String(allow_none=True, load_default=None) + message = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ErrorObject(**data) + + +class ErrorResponseSchema(helpers.BaseSchema): + status_code = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="statusCode" + ) + message = marshmallow.fields.String(allow_none=True, load_default=None) + error = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + error_description = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + errors = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ErrorObjectSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ErrorResponse(**data) + + +class ModifiedBySchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + type = marshmallow.fields.String(allow_none=True, load_default=None) + client_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="clientId", + ) + anonymous_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="anonymousId", + ) + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + associate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + is_platform_client = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isPlatformClient" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ModifiedBy(**data) diff --git a/src/commercetools/history/models/_schemas/change_value.py b/src/commercetools/history/models/_schemas/change_value.py new file mode 100644 index 00000000..3e18ea6d --- /dev/null +++ b/src/commercetools/history/models/_schemas/change_value.py @@ -0,0 +1,522 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from ..common import SelectionMode +from .common import LocalizedStringField + +# Fields + + +# Marshmallow Schemas +class ChangeTargetChangeValueSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTargetChangeValue(**data) + + +class ChangeValueChangeValueSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeValueChangeValue(**data) + + +class AssetChangeValueSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AssetChangeValue(**data) + + +class AttributeValueSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AttributeValue(**data) + + +class ChangeTargetCustomLineItemsChangeValueSchema(ChangeTargetChangeValueSchema): + predicate = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTargetCustomLineItemsChangeValue(**data) + + +class ChangeTargetLineItemsChangeValueSchema(ChangeTargetChangeValueSchema): + predicate = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTargetLineItemsChangeValue(**data) + + +class ChangeTargetMultiBuyCustomLineItemsChangeValueSchema( + ChangeTargetChangeValueSchema +): + predicate = marshmallow.fields.String(allow_none=True, load_default=None) + trigger_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="triggerQuantity" + ) + discounted_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="discountedQuantity" + ) + max_occurrence = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="maxOccurrence" + ) + selection_mode = marshmallow_enum.EnumField( + SelectionMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="selectionMode", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTargetMultiBuyCustomLineItemsChangeValue(**data) + + +class ChangeTargetMultiBuyLineItemsChangeValueSchema(ChangeTargetChangeValueSchema): + predicate = marshmallow.fields.String(allow_none=True, load_default=None) + trigger_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="triggerQuantity" + ) + discounted_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="discountedQuantity" + ) + max_occurrence = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="maxOccurrence" + ) + selection_mode = marshmallow_enum.EnumField( + SelectionMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="selectionMode", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTargetMultiBuyLineItemsChangeValue(**data) + + +class ChangeTargetShippingChangeValueSchema(ChangeTargetChangeValueSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeTargetShippingChangeValue(**data) + + +class ChangeValueAbsoluteChangeValueSchema(ChangeValueChangeValueSchema): + money = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeValueAbsoluteChangeValue(**data) + + +class ChangeValueExternalChangeValueSchema(ChangeValueChangeValueSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeValueExternalChangeValue(**data) + + +class ChangeValueGiftLineItemChangeValueSchema(ChangeValueChangeValueSchema): + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + supply_channel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="supplyChannel", + ) + distribution_channel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="distributionChannel", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeValueGiftLineItemChangeValue(**data) + + +class ChangeValueRelativeChangeValueSchema(ChangeValueChangeValueSchema): + permyriad = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ChangeValueRelativeChangeValue(**data) + + +class CustomFieldExpandedValueSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + label = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomFieldExpandedValue(**data) + + +class CustomShippingMethodChangeValueSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomShippingMethodChangeValue(**data) + + +class DeliveryChangeValueSchema(helpers.BaseSchema): + items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + parcels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ParcelSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DeliveryChangeValue(**data) + + +class EnumValueSchema(helpers.BaseSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + label = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.EnumValue(**data) + + +class FieldDefinitionOrderValueSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + label = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.FieldDefinitionOrderValue(**data) + + +class InventoryQuantityValueSchema(helpers.BaseSchema): + quantity_on_stock = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="quantityOnStock" + ) + available_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="availableQuantity" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.InventoryQuantityValue(**data) + + +class LocalizedEnumValueSchema(helpers.BaseSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + label = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.LocalizedEnumValue(**data) + + +class ParcelChangeValueSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + created_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="createdAt" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ParcelChangeValue(**data) + + +class SetCartClassificationShippingRateInputValueSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + key = marshmallow.fields.String(allow_none=True, load_default=None) + label = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SetCartClassificationShippingRateInputValue(**data) + + +class SetCartScoreShippingRateInputValueSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + score = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SetCartScoreShippingRateInputValue(**data) + + +class ShippingMethodChangeValueSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ShippingMethodChangeValue(**data) + + +class ShippingMethodTaxAmountChangeValueSchema(helpers.BaseSchema): + taxed_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxedPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="taxedPrice", + ) + tax_rate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.TaxRateSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="taxRate", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ShippingMethodTaxAmountChangeValue(**data) + + +class ShoppingListLineItemValueSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ShoppingListLineItemValue(**data) + + +class TextLineItemValueSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.TextLineItemValue(**data) + + +class TransactionChangeValueSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + interaction_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="interactionId" + ) + timestamp = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.TransactionChangeValue(**data) + + +class ValidFromAndUntilValueSchema(helpers.BaseSchema): + valid_from = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="validFrom" + ) + valid_until = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="validUntil" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ValidFromAndUntilValue(**data) diff --git a/src/commercetools/history/models/_schemas/common.py b/src/commercetools/history/models/_schemas/common.py new file mode 100644 index 00000000..147a2732 --- /dev/null +++ b/src/commercetools/history/models/_schemas/common.py @@ -0,0 +1,1524 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from ..common import ( + AssociateRoleInheritanceMode, + AttributeConstraintEnum, + DiscountCodeState, + MoneyType, + ProductVariantSelectionTypeEnum, + ReferenceTypeId, + ReturnPaymentState, + ReturnShipmentState, + ShippingRateTierType, + TextInputHint, + TransactionState, + TransactionType, +) + + +# Fields +class LocalizedStringField(marshmallow.fields.Dict): + + def _deserialize(self, value, attr, data, **kwargs): + result = super()._deserialize(value, attr, data) + return models.LocalizedString(**result) + + +# Marshmallow Schemas +class AddressSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + key = marshmallow.fields.String(allow_none=True, load_default=None) + title = marshmallow.fields.String(allow_none=True, load_default=None) + salutation = marshmallow.fields.String(allow_none=True, load_default=None) + first_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="firstName" + ) + last_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lastName" + ) + street_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="streetName" + ) + street_number = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="streetNumber" + ) + additional_street_info = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="additionalStreetInfo" + ) + postal_code = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="postalCode" + ) + city = marshmallow.fields.String(allow_none=True, load_default=None) + region = marshmallow.fields.String(allow_none=True, load_default=None) + state = marshmallow.fields.String(allow_none=True, load_default=None) + country = marshmallow.fields.String(allow_none=True, load_default=None) + company = marshmallow.fields.String(allow_none=True, load_default=None) + department = marshmallow.fields.String(allow_none=True, load_default=None) + building = marshmallow.fields.String(allow_none=True, load_default=None) + apartment = marshmallow.fields.String(allow_none=True, load_default=None) + p_o_box = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="pOBox" + ) + phone = marshmallow.fields.String(allow_none=True, load_default=None) + mobile = marshmallow.fields.String(allow_none=True, load_default=None) + email = marshmallow.fields.String(allow_none=True, load_default=None) + fax = marshmallow.fields.String(allow_none=True, load_default=None) + additional_address_info = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="additionalAddressInfo" + ) + external_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="externalId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Address(**data) + + +class AssetSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + custom = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + key = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Asset(**data) + + +class AssetDimensionsSchema(helpers.BaseSchema): + w = marshmallow.fields.Integer(allow_none=True, load_default=None) + h = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AssetDimensions(**data) + + +class AssetSourceSchema(helpers.BaseSchema): + uri = marshmallow.fields.String(allow_none=True, load_default=None) + key = marshmallow.fields.String(allow_none=True, load_default=None) + dimensions = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".AssetDimensionsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + content_type = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="contentType" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AssetSource(**data) + + +class AssociateSchema(helpers.BaseSchema): + associate_role_assignments = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".AssociateRoleAssignmentSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="associateRoleAssignments", + ) + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Associate(**data) + + +class AssociateRoleAssignmentSchema(helpers.BaseSchema): + associate_role = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".KeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="associateRole", + ) + inheritance = marshmallow_enum.EnumField( + AssociateRoleInheritanceMode, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AssociateRoleAssignment(**data) + + +class AttributeDefinitionSchema(helpers.BaseSchema): + type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".AttributeTypeSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + label = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + is_required = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isRequired" + ) + attribute_constraint = marshmallow_enum.EnumField( + AttributeConstraintEnum, + by_value=True, + allow_none=True, + load_default=None, + data_key="attributeConstraint", + ) + input_tip = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="inputTip", + ) + input_hint = marshmallow_enum.EnumField( + TextInputHint, + by_value=True, + allow_none=True, + load_default=None, + data_key="inputHint", + ) + is_searchable = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isSearchable" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AttributeDefinition(**data) + + +class AttributeLocalizedEnumValueSchema(helpers.BaseSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + label = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AttributeLocalizedEnumValue(**data) + + +class AttributePlainEnumValueSchema(helpers.BaseSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + label = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AttributePlainEnumValue(**data) + + +class AttributeTypeSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.AttributeType(**data) + + +class CategoryOrderHintsSchema(helpers.BaseSchema): + _regex = helpers.RegexField( + unknown=marshmallow.EXCLUDE, + metadata={ + "pattern": re.compile( + "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + ), + "type": marshmallow.fields.String( + allow_none=True, + load_default=None, + data_key="/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/", + ), + }, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.pre_load + def pre_load(self, data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.pre_load(self, data) + + @marshmallow.post_load(pass_original=True) + def post_load(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + data = field.post_load(data, original_data) + return models.CategoryOrderHints(**data) + + @marshmallow.post_dump(pass_original=True) + def post_dump(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.post_dump(data, original_data) + + +class CustomFieldsSchema(helpers.BaseSchema): + type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + fields = marshmallow.fields.Raw(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomFields(**data) + + +class CustomLineItemSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + money = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + taxed_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".TaxedItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="taxedPrice", + ) + total_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="totalPrice", + ) + slug = marshmallow.fields.String(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomLineItem(**data) + + +class DeliverySchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + created_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="createdAt" + ) + items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + parcels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ParcelSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + custom = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Delivery(**data) + + +class DeliveryItemSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DeliveryItem(**data) + + +class DiscountCodeInfoSchema(helpers.BaseSchema): + discount_code = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="discountCode", + ) + state = marshmallow_enum.EnumField( + DiscountCodeState, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DiscountCodeInfo(**data) + + +class DiscountedLineItemPortionSchema(helpers.BaseSchema): + discount = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + discounted_amount = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="discountedAmount", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DiscountedLineItemPortion(**data) + + +class DiscountedLineItemPriceSchema(helpers.BaseSchema): + value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + included_discounts = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".DiscountedLineItemPortionSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="includedDiscounts", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DiscountedLineItemPrice(**data) + + +class DiscountedLineItemPriceForQuantitySchema(helpers.BaseSchema): + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + discounted_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".DiscountedLineItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="discountedPrice", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DiscountedLineItemPriceForQuantity(**data) + + +class FieldDefinitionSchema(helpers.BaseSchema): + type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".FieldTypeSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + label = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + input_hint = marshmallow_enum.EnumField( + TextInputHint, + by_value=True, + allow_none=True, + load_default=None, + data_key="inputHint", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.FieldDefinition(**data) + + +class FieldTypeSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.FieldType(**data) + + +class GeoLocationSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + coordinates = marshmallow.fields.List( + marshmallow.fields.Integer(allow_none=True), allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.GeoLocation(**data) + + +class ImageSchema(helpers.BaseSchema): + url = marshmallow.fields.String(allow_none=True, load_default=None) + dimensions = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ImageDimensionsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + label = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Image(**data) + + +class ImageDimensionsSchema(helpers.BaseSchema): + w = marshmallow.fields.Integer(allow_none=True, load_default=None) + h = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ImageDimensions(**data) + + +class InheritedAssociateSchema(helpers.BaseSchema): + associate_role_assignments = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".InheritedAssociateRoleAssignmentSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="associateRoleAssignments", + ) + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.InheritedAssociate(**data) + + +class InheritedAssociateRoleAssignmentSchema(helpers.BaseSchema): + associate_role = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".KeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="associateRole", + ) + source = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".KeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.InheritedAssociateRoleAssignment(**data) + + +class ItemShippingDetailsSchema(helpers.BaseSchema): + targets = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ItemShippingTargetSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + valid = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ItemShippingDetails(**data) + + +class ItemShippingTargetSchema(helpers.BaseSchema): + address_key = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="addressKey" + ) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ItemShippingTarget(**data) + + +class ItemStateSchema(helpers.BaseSchema): + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ItemState(**data) + + +class KeyReferenceSchema(helpers.BaseSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + type_id = marshmallow_enum.EnumField( + ReferenceTypeId, + by_value=True, + allow_none=True, + load_default=None, + data_key="typeId", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.KeyReference(**data) + + +class LineItemSchema(helpers.BaseSchema): + added_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="addedAt" + ) + custom = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + product_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="productId" + ) + product_slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + data_key="productSlug", + ) + product_type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="productType", + ) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + variant = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".VariantSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.LineItem(**data) + + +class LocationSchema(helpers.BaseSchema): + country = marshmallow.fields.String(allow_none=True, load_default=None) + state = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Location(**data) + + +class MoneySchema(helpers.BaseSchema): + currency_code = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="currencyCode" + ) + cent_amount = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="centAmount" + ) + fraction_digits = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="fractionDigits" + ) + type = marshmallow_enum.EnumField( + MoneyType, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Money(**data) + + +class ParcelSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + created_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="createdAt" + ) + measurements = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ParcelMeasurementsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + tracking_data = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".TrackingDataSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="trackingData", + ) + items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Parcel(**data) + + +class ParcelMeasurementsSchema(helpers.BaseSchema): + height_in_millimeter = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="heightInMillimeter" + ) + length_in_millimeter = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="lengthInMillimeter" + ) + width_in_millimeter = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="widthInMillimeter" + ) + weight_in_gram = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="weightInGram" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ParcelMeasurements(**data) + + +class PaymentInfoSchema(helpers.BaseSchema): + payments = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.PaymentInfo(**data) + + +class PriceSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + value = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Price(**data) + + +class ProductSelectionSettingSchema(helpers.BaseSchema): + product_selection = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="productSelection", + ) + active = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSelectionSetting(**data) + + +class ProductVariantAvailabilitySchema(helpers.BaseSchema): + is_on_stock = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isOnStock" + ) + restockable_in_days = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="restockableInDays" + ) + available_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="availableQuantity" + ) + channels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductVariantChannelAvailabilityMapSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductVariantAvailability(**data) + + +class ProductVariantChannelAvailabilitySchema(helpers.BaseSchema): + is_on_stock = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isOnStock" + ) + restockable_in_days = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="restockableInDays" + ) + available_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="availableQuantity" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductVariantChannelAvailability(**data) + + +class ProductVariantChannelAvailabilityMapSchema(helpers.BaseSchema): + _regex = helpers.RegexField( + unknown=marshmallow.EXCLUDE, + metadata={ + "pattern": re.compile(""), + "type": helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".ProductVariantChannelAvailabilitySchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ), + }, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.pre_load + def pre_load(self, data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.pre_load(self, data) + + @marshmallow.post_load(pass_original=True) + def post_load(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + data = field.post_load(data, original_data) + return models.ProductVariantChannelAvailabilityMap(**data) + + @marshmallow.post_dump(pass_original=True) + def post_dump(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.post_dump(data, original_data) + + +class ProductVariantSelectionSchema(helpers.BaseSchema): + type = marshmallow_enum.EnumField( + ProductVariantSelectionTypeEnum, + by_value=True, + allow_none=True, + load_default=None, + ) + skus = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductVariantSelection(**data) + + +class ReferenceSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + type_id = marshmallow_enum.EnumField( + ReferenceTypeId, + by_value=True, + allow_none=True, + load_default=None, + data_key="typeId", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Reference(**data) + + +class ReservationSchema(helpers.BaseSchema): + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + owner = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + created_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="createdAt" + ) + checkout_started_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="checkoutStartedAt" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Reservation(**data) + + +class ResourceIdentifierSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + key = marshmallow.fields.String(allow_none=True, load_default=None) + type_id = marshmallow_enum.EnumField( + ReferenceTypeId, + by_value=True, + allow_none=True, + load_default=None, + data_key="typeId", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ResourceIdentifier(**data) + + +class ReturnInfoSchema(helpers.BaseSchema): + items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReturnItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + return_tracking_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="returnTrackingId" + ) + return_date = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="returnDate" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ReturnInfo(**data) + + +class ReturnItemSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + type = marshmallow.fields.String(allow_none=True, load_default=None) + comment = marshmallow.fields.String(allow_none=True, load_default=None) + shipment_state = marshmallow_enum.EnumField( + ReturnShipmentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="shipmentState", + ) + payment_state = marshmallow_enum.EnumField( + ReturnPaymentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="paymentState", + ) + last_modified_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lastModifiedAt" + ) + created_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="createdAt" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ReturnItem(**data) + + +class ReviewRatingStatisticsSchema(helpers.BaseSchema): + average_rating = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="averageRating" + ) + highest_rating = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="highestRating" + ) + lowest_rating = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="lowestRating" + ) + count = marshmallow.fields.Integer(allow_none=True, load_default=None) + ratings_distribution = marshmallow.fields.Raw( + allow_none=True, load_default=None, data_key="ratingsDistribution" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ReviewRatingStatistics(**data) + + +class SearchKeywordSchema(helpers.BaseSchema): + text = marshmallow.fields.String(allow_none=True, load_default=None) + suggest_tokenizer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SuggestTokenizerSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="suggestTokenizer", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchKeyword(**data) + + +class SearchKeywordsSchema(helpers.BaseSchema): + _regex = helpers.RegexField( + unknown=marshmallow.EXCLUDE, + metadata={ + "pattern": re.compile("^[a-z]{2}(-[A-Z]{2})?$"), + "type": helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchKeywordSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="/^[a-z]{2}(-[A-Z]{2})?$/", + ), + }, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.pre_load + def pre_load(self, data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.pre_load(self, data) + + @marshmallow.post_load(pass_original=True) + def post_load(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + data = field.post_load(data, original_data) + return models.SearchKeywords(**data) + + @marshmallow.post_dump(pass_original=True) + def post_dump(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.post_dump(data, original_data) + + +class ShippingRateSchema(helpers.BaseSchema): + price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + free_above = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="freeAbove", + ) + is_matching = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isMatching" + ) + tiers = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ShippingRatePriceTierSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ShippingRate(**data) + + +class ShippingRatePriceTierSchema(helpers.BaseSchema): + type = marshmallow_enum.EnumField( + ShippingRateTierType, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ShippingRatePriceTier(**data) + + +class StoreCountrySchema(helpers.BaseSchema): + code = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.StoreCountry(**data) + + +class SubRateSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + amount = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SubRate(**data) + + +class SuggestTokenizerSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SuggestTokenizer(**data) + + +class SyncInfoSchema(helpers.BaseSchema): + channel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + external_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="externalId" + ) + synced_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="syncedAt" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SyncInfo(**data) + + +class TaxRateSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + amount = marshmallow.fields.Integer(allow_none=True, load_default=None) + included_in_price = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="includedInPrice" + ) + country = marshmallow.fields.String(allow_none=True, load_default=None) + state = marshmallow.fields.String(allow_none=True, load_default=None) + sub_rates = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SubRateSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="subRates", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.TaxRate(**data) + + +class TaxedItemPriceSchema(helpers.BaseSchema): + total_net = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="totalNet", + ) + total_gross = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="totalGross", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.TaxedItemPrice(**data) + + +class TaxedPriceSchema(helpers.BaseSchema): + total_net = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="totalNet", + ) + total_gross = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="totalGross", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.TaxedPrice(**data) + + +class TextLineItemSchema(helpers.BaseSchema): + added_at = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="addedAt" + ) + custom = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + id = marshmallow.fields.String(allow_none=True, load_default=None) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.TextLineItem(**data) + + +class TrackingDataSchema(helpers.BaseSchema): + tracking_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="trackingId" + ) + carrier = marshmallow.fields.String(allow_none=True, load_default=None) + provider = marshmallow.fields.String(allow_none=True, load_default=None) + provider_transaction = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="providerTransaction" + ) + is_return = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isReturn" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.TrackingData(**data) + + +class TransactionSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + timestamp = marshmallow.fields.String(allow_none=True, load_default=None) + type = marshmallow_enum.EnumField( + TransactionType, by_value=True, allow_none=True, load_default=None + ) + amount = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + interaction_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="interactionId" + ) + state = marshmallow_enum.EnumField( + TransactionState, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Transaction(**data) + + +class VariantSchema(helpers.BaseSchema): + id = marshmallow.fields.Integer(allow_none=True, load_default=None) + sku = marshmallow.fields.String(allow_none=True, load_default=None) + key = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Variant(**data) diff --git a/src/commercetools/history/models/_schemas/label.py b/src/commercetools/history/models/_schemas/label.py new file mode 100644 index 00000000..f60e7bda --- /dev/null +++ b/src/commercetools/history/models/_schemas/label.py @@ -0,0 +1,263 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from .common import LocalizedStringField + +# Fields + + +# Marshmallow Schemas +class LabelSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.Label(**data) + + +class AssociateRoleLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AssociateRoleLabel(**data) + + +class BusinessUnitLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.BusinessUnitLabel(**data) + + +class CustomObjectLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + container = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.CustomObjectLabel(**data) + + +class CustomerLabelSchema(LabelSchema): + first_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="firstName" + ) + last_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lastName" + ) + customer_number = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customerNumber" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.CustomerLabel(**data) + + +class LocalizedLabelSchema(LabelSchema): + value = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.LocalizedLabel(**data) + + +class OrderLabelSchema(LabelSchema): + customer_email = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customerEmail" + ) + order_number = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="orderNumber" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.OrderLabel(**data) + + +class PaymentLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + amount_planned = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.MoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="amountPlanned", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.PaymentLabel(**data) + + +class ProductLabelSchema(LabelSchema): + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductLabel(**data) + + +class QuoteLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + staged_quote = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="stagedQuote", + ) + quote_request = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="quoteRequest", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteLabel(**data) + + +class QuoteRequestLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteRequestLabel(**data) + + +class ReviewLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + title = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ReviewLabel(**data) + + +class StagedQuoteLabelSchema(LabelSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + quote_request = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="quoteRequest", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StagedQuoteLabel(**data) + + +class StringLabelSchema(LabelSchema): + value = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StringLabel(**data) diff --git a/src/commercetools/history/models/change.py b/src/commercetools/history/models/change.py new file mode 100644 index 00000000..1678c819 --- /dev/null +++ b/src/commercetools/history/models/change.py @@ -0,0 +1,11386 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType +from .common import ( + AttributeConstraintEnum, + AuthenticationMode, + BusinessUnitAssociateMode, + BusinessUnitStatus, + BusinessUnitStoreMode, + ChannelRoleEnum, + OrderState, + PaymentState, + Permission, + QuoteRequestState, + QuoteState, + ReturnPaymentState, + ReturnShipmentState, + RoundingMode, + ShipmentState, + StackingMode, + StagedQuoteState, + StateRoleEnum, + StateTypeEnum, + TaxCalculationMode, + TaxMode, + TextInputHint, + TransactionState, +) + +if typing.TYPE_CHECKING: + from .change_value import ( + AssetChangeValue, + AttributeValue, + ChangeTargetChangeValue, + ChangeValueChangeValue, + CustomFieldExpandedValue, + CustomShippingMethodChangeValue, + DeliveryChangeValue, + EnumValue, + FieldDefinitionOrderValue, + InventoryQuantityValue, + LocalizedEnumValue, + ParcelChangeValue, + SetCartClassificationShippingRateInputValue, + SetCartScoreShippingRateInputValue, + ShippingMethodChangeValue, + ShippingMethodTaxAmountChangeValue, + ShoppingListLineItemValue, + TextLineItemValue, + TransactionChangeValue, + ValidFromAndUntilValue, + ) + from .common import ( + Address, + Asset, + AssetSource, + Associate, + AttributeConstraintEnum, + AttributeDefinition, + AttributeLocalizedEnumValue, + AttributePlainEnumValue, + AuthenticationMode, + BusinessUnitAssociateMode, + BusinessUnitStatus, + BusinessUnitStoreMode, + CategoryOrderHints, + ChannelRoleEnum, + CustomFields, + CustomLineItem, + Delivery, + DeliveryItem, + DiscountCodeInfo, + DiscountedLineItemPrice, + DiscountedLineItemPriceForQuantity, + FieldDefinition, + GeoLocation, + Image, + InheritedAssociate, + ItemShippingDetails, + ItemState, + KeyReference, + LineItem, + LocalizedString, + Location, + Money, + OrderState, + Parcel, + ParcelMeasurements, + PaymentInfo, + PaymentState, + Permission, + Price, + ProductSelectionSetting, + ProductVariantAvailability, + ProductVariantSelection, + QuoteRequestState, + QuoteState, + Reference, + Reservation, + ReturnInfo, + ReturnPaymentState, + ReturnShipmentState, + ReviewRatingStatistics, + RoundingMode, + SearchKeywords, + ShipmentState, + StackingMode, + StagedQuoteState, + StateRoleEnum, + StateTypeEnum, + StoreCountry, + SyncInfo, + TaxCalculationMode, + TaxedItemPrice, + TaxedPrice, + TaxMode, + TaxRate, + TextInputHint, + TextLineItem, + TrackingData, + Transaction, + TransactionState, + Variant, + ) + +__all__ = [ + "AddAddressChange", + "AddAssetChange", + "AddAssociateChange", + "AddAttributeDefinitionChange", + "AddBillingAddressIdChange", + "AddChannelRolesChange", + "AddCustomLineItemChange", + "AddDeliveryChange", + "AddDiscountCodeChange", + "AddEnumValueChange", + "AddExternalImageChange", + "AddFieldDefinitionChange", + "AddInheritedAssociateChange", + "AddInterfaceInteractionChange", + "AddItemShippingAddressesChange", + "AddLocalizedEnumValueChange", + "AddLocationChange", + "AddOrderLineItemChange", + "AddParcelToDeliveryChange", + "AddPaymentChange", + "AddPlainEnumValueChange", + "AddPriceChange", + "AddProductChange", + "AddProductSelectionChange", + "AddPropertyChange", + "AddReturnInfoChange", + "AddShippingAddressIdChange", + "AddShoppingListLineItemChange", + "AddStateRolesChange", + "AddTaxRateChange", + "AddTextLineItemChange", + "AddToCategoryChange", + "AddTransactionChange", + "AddVariantChange", + "Change", + "ChangeAddressChange", + "ChangeAmountAuthorizedChange", + "ChangeAmountPlannedChange", + "ChangeAssetNameChange", + "ChangeAssetOrderChange", + "ChangeAssociateChange", + "ChangeAssociateModeChange", + "ChangeAttributeConstraintChange", + "ChangeAttributeOrderByNameChange", + "ChangeBuyerAssignableChange", + "ChangeCartDiscountsChange", + "ChangeCartPredicateChange", + "ChangeCustomLineItemQuantityChange", + "ChangeDescriptionChange", + "ChangeEmailChange", + "ChangeEnumValueLabelChange", + "ChangeEnumValueOrderChange", + "ChangeFieldDefinitionOrderChange", + "ChangeGroupsChange", + "ChangeInheritedAssociateChange", + "ChangeInitialChange", + "ChangeInputHintChange", + "ChangeIsActiveChange", + "ChangeIsSearchableChange", + "ChangeKeyChange", + "ChangeLabelChange", + "ChangeLineItemQuantityChange", + "ChangeLocalizedDescriptionChange", + "ChangeLocalizedEnumValueLabelChange", + "ChangeLocalizedEnumValueOrderChange", + "ChangeLocalizedNameChange", + "ChangeMasterVariantChange", + "ChangeNameChange", + "ChangeOrderHintChange", + "ChangeOrderStateChange", + "ChangeParentChange", + "ChangeParentUnitChange", + "ChangePaymentStateChange", + "ChangePlainEnumValueLabelChange", + "ChangePlainEnumValueOrderChange", + "ChangePredicateChange", + "ChangePriceChange", + "ChangeProductSelectionActiveChange", + "ChangeQuantityChange", + "ChangeQuoteRequestStateChange", + "ChangeQuoteStateChange", + "ChangeRequiresDiscountCodeChange", + "ChangeReviewRatingStatisticsChange", + "ChangeShipmentStateChange", + "ChangeShoppingListLineItemQuantityChange", + "ChangeShoppingListLineItemsOrderChange", + "ChangeSlugChange", + "ChangeSortOrderChange", + "ChangeStackingModeChange", + "ChangeStagedQuoteStateChange", + "ChangeStateTypeChange", + "ChangeStatusChange", + "ChangeTargetChange", + "ChangeTaxCalculationModeChange", + "ChangeTaxModeChange", + "ChangeTaxRoundingModeChange", + "ChangeTextLineItemNameChange", + "ChangeTextLineItemQuantityChange", + "ChangeTextLineItemsOrderChange", + "ChangeTransactionInteractionIdChange", + "ChangeTransactionStateChange", + "ChangeTransactionTimestampChange", + "ChangeValueChange", + "MoveImageToPositionChange", + "PublishChange", + "RemoveAddressChange", + "RemoveAssetChange", + "RemoveAssociateChange", + "RemoveAttributeDefinitionChange", + "RemoveBillingAddressIdChange", + "RemoveChannelRolesChange", + "RemoveCustomLineItemChange", + "RemoveDeliveryItemsChange", + "RemoveDiscountCodeChange", + "RemoveEnumValuesChange", + "RemoveFieldDefinitionChange", + "RemoveFromCategoryChange", + "RemoveImageChange", + "RemoveInheritedAssociateChange", + "RemoveItemShippingAddressesChange", + "RemoveLocalizedEnumValuesChange", + "RemoveLocationChange", + "RemoveOrderLineItemChange", + "RemoveParcelFromDeliveryChange", + "RemovePaymentChange", + "RemovePriceChange", + "RemoveProductChange", + "RemoveProductSelectionChange", + "RemovePropertyChange", + "RemoveShippingAddressIdChange", + "RemoveShoppingListLineItemChange", + "RemoveStateRolesChange", + "RemoveTaxRateChange", + "RemoveTextLineItemChange", + "RemoveVariantChange", + "RequestQuoteRenegotiationChange", + "SetAddressChange", + "SetAddressCustomFieldChange", + "SetAddressCustomTypeChange", + "SetAnonymousIdChange", + "SetApplicationVersionChange", + "SetAssetCustomFieldChange", + "SetAssetCustomTypeChange", + "SetAssetDescriptionChange", + "SetAssetKeyChange", + "SetAssetSourcesChange", + "SetAssetTagsChange", + "SetAttributeChange", + "SetAuthenticationModeChange", + "SetAuthorNameChange", + "SetBillingAddressChange", + "SetCartPredicateChange", + "SetCategoryOrderHintChange", + "SetChannelRolesChange", + "SetCompanyNameChange", + "SetContactEmailChange", + "SetCountriesChange", + "SetCountryChange", + "SetCustomFieldChange", + "SetCustomLineItemCustomFieldChange", + "SetCustomLineItemCustomTypeChange", + "SetCustomLineItemMoneyChange", + "SetCustomLineItemShippingDetailsChange", + "SetCustomLineItemTaxAmountChange", + "SetCustomLineItemTaxCategoryChange", + "SetCustomLineItemTaxRateChange", + "SetCustomLineItemTaxedPriceChange", + "SetCustomLineItemTotalPriceChange", + "SetCustomShippingMethodChange", + "SetCustomTypeChange", + "SetCustomerChange", + "SetCustomerEmailChange", + "SetCustomerGroupChange", + "SetCustomerIdChange", + "SetCustomerNumberChange", + "SetDateOfBirthChange", + "SetDefaultBillingAddressChange", + "SetDefaultShippingAddressChange", + "SetDeleteDaysAfterLastModificationChange", + "SetDeliveryAddressChange", + "SetDeliveryItemsChange", + "SetDescriptionChange", + "SetDiscountedPriceChange", + "SetDistributionChannelsChange", + "SetExpectedDeliveryChange", + "SetExternalIdChange", + "SetFirstNameChange", + "SetGeoLocationChange", + "SetImageLabelChange", + "SetInputTipChange", + "SetInterfaceIdChange", + "SetIsValidChange", + "SetKeyChange", + "SetLanguagesChange", + "SetLastNameChange", + "SetLineItemDeactivatedAtChange", + "SetLineItemDiscountedPriceChange", + "SetLineItemDiscountedPricePerQuantityChange", + "SetLineItemDistributionChannelChange", + "SetLineItemPriceChange", + "SetLineItemProductKeyChange", + "SetLineItemProductSlugChange", + "SetLineItemShippingDetailsChange", + "SetLineItemTaxAmountChange", + "SetLineItemTaxRateChange", + "SetLineItemTaxedPriceChange", + "SetLineItemTotalPriceChange", + "SetLocaleChange", + "SetLocalizedDescriptionChange", + "SetLocalizedNameChange", + "SetMaxApplicationsChange", + "SetMaxApplicationsPerCustomerChange", + "SetMetaDescriptionChange", + "SetMetaKeywordsChange", + "SetMetaTitleChange", + "SetMethodInfoInterfaceChange", + "SetMethodInfoMethodChange", + "SetMethodInfoNameChange", + "SetMiddleNameChange", + "SetNameChange", + "SetOrderLineItemCustomFieldChange", + "SetOrderLineItemCustomTypeChange", + "SetOrderNumberChange", + "SetOrderTaxedPriceChange", + "SetOrderTotalPriceChange", + "SetOrderTotalTaxChange", + "SetParcelItemsChange", + "SetParcelMeasurementsChange", + "SetParcelTrackingDataChange", + "SetPermissionsChange", + "SetPricesChange", + "SetProductCountChange", + "SetProductPriceCustomFieldChange", + "SetProductPriceCustomTypeChange", + "SetProductSelectionsChange", + "SetProductVariantKeyChange", + "SetPropertyChange", + "SetPurchaseOrderNumberChange", + "SetRatingChange", + "SetReservationsChange", + "SetRestockableInDaysChange", + "SetReturnPaymentStateChange", + "SetReturnShipmentStateChange", + "SetSalutationChange", + "SetSearchKeywordsChange", + "SetSellerCommentChange", + "SetShippingAddressChange", + "SetShippingInfoPriceChange", + "SetShippingInfoTaxedPriceChange", + "SetShippingMethodChange", + "SetShippingMethodTaxAmountChange", + "SetShippingMethodTaxRateChange", + "SetShippingRateChange", + "SetShippingRateInputChange", + "SetShoppingListLineItemCustomFieldChange", + "SetShoppingListLineItemCustomTypeChange", + "SetSkuChange", + "SetSlugChange", + "SetStateRolesChange", + "SetStatusInterfaceCodeChange", + "SetStatusInterfaceTextChange", + "SetStoreChange", + "SetStoreModeChange", + "SetStoresChange", + "SetSupplyChannelChange", + "SetSupplyChannelsChange", + "SetTargetChange", + "SetTaxCategoryChange", + "SetTextChange", + "SetTextLineItemCustomFieldChange", + "SetTextLineItemCustomTypeChange", + "SetTextLineItemDescriptionChange", + "SetTitleChange", + "SetTransitionsChange", + "SetValidFromAndUntilChange", + "SetValidFromChange", + "SetValidToChange", + "SetValidUntilChange", + "SetValueChange", + "SetVariantAvailabilityChange", + "SetVariantSelectionChange", + "SetVatIdChange", + "TransitionCustomLineItemStateChange", + "TransitionLineItemStateChange", + "TransitionStateChange", + "UnknownChange", + "UnpublishChange", + "UpdateSyncInfoChange", + "VerifyEmailChange", +] + + +class Change(_BaseType): + """Difference between the previous and next version of a resource represented by `previousValue` (omitted, for example, on creations) and `nextValue` of the associated change. A Change can also contain extra fields that provide further information. + + They are not identical to the actual update actions sent. + + """ + + #: Unique discriminator value to reliably deserialize the data type. + type: str + #: [Type of change](#type-of-change) on a resource that is similar to the update action it relates to, where possible. + #: It is not a unique identifier for the data structure, for example, the `setDescription` change can occur with a localized and non-localized representation. + #: + #: [Records](ctp:history:type:Record) can be filtered by this value using the `changes` query parameter. + change: str + + def __init__(self, *, type: str, change: str): + self.type = type + self.change = change + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Change": + if data["type"] == "AddAddressChange": + from ._schemas.change import AddAddressChangeSchema + + return AddAddressChangeSchema().load(data) + if data["type"] == "AddAssetChange": + from ._schemas.change import AddAssetChangeSchema + + return AddAssetChangeSchema().load(data) + if data["type"] == "AddAssociateChange": + from ._schemas.change import AddAssociateChangeSchema + + return AddAssociateChangeSchema().load(data) + if data["type"] == "AddAttributeDefinitionChange": + from ._schemas.change import AddAttributeDefinitionChangeSchema + + return AddAttributeDefinitionChangeSchema().load(data) + if data["type"] == "AddBillingAddressIdChange": + from ._schemas.change import AddBillingAddressIdChangeSchema + + return AddBillingAddressIdChangeSchema().load(data) + if data["type"] == "AddChannelRolesChange": + from ._schemas.change import AddChannelRolesChangeSchema + + return AddChannelRolesChangeSchema().load(data) + if data["type"] == "AddCustomLineItemChange": + from ._schemas.change import AddCustomLineItemChangeSchema + + return AddCustomLineItemChangeSchema().load(data) + if data["type"] == "AddDeliveryChange": + from ._schemas.change import AddDeliveryChangeSchema + + return AddDeliveryChangeSchema().load(data) + if data["type"] == "AddDiscountCodeChange": + from ._schemas.change import AddDiscountCodeChangeSchema + + return AddDiscountCodeChangeSchema().load(data) + if data["type"] == "AddEnumValueChange": + from ._schemas.change import AddEnumValueChangeSchema + + return AddEnumValueChangeSchema().load(data) + if data["type"] == "AddExternalImageChange": + from ._schemas.change import AddExternalImageChangeSchema + + return AddExternalImageChangeSchema().load(data) + if data["type"] == "AddFieldDefinitionChange": + from ._schemas.change import AddFieldDefinitionChangeSchema + + return AddFieldDefinitionChangeSchema().load(data) + if data["type"] == "AddInheritedAssociateChange": + from ._schemas.change import AddInheritedAssociateChangeSchema + + return AddInheritedAssociateChangeSchema().load(data) + if data["type"] == "AddInterfaceInteractionChange": + from ._schemas.change import AddInterfaceInteractionChangeSchema + + return AddInterfaceInteractionChangeSchema().load(data) + if data["type"] == "AddItemShippingAddressesChange": + from ._schemas.change import AddItemShippingAddressesChangeSchema + + return AddItemShippingAddressesChangeSchema().load(data) + if data["type"] == "AddLocalizedEnumValueChange": + from ._schemas.change import AddLocalizedEnumValueChangeSchema + + return AddLocalizedEnumValueChangeSchema().load(data) + if data["type"] == "AddLocationChange": + from ._schemas.change import AddLocationChangeSchema + + return AddLocationChangeSchema().load(data) + if data["type"] == "AddOrderLineItemChange": + from ._schemas.change import AddOrderLineItemChangeSchema + + return AddOrderLineItemChangeSchema().load(data) + if data["type"] == "AddParcelToDeliveryChange": + from ._schemas.change import AddParcelToDeliveryChangeSchema + + return AddParcelToDeliveryChangeSchema().load(data) + if data["type"] == "AddPaymentChange": + from ._schemas.change import AddPaymentChangeSchema + + return AddPaymentChangeSchema().load(data) + if data["type"] == "AddPlainEnumValueChange": + from ._schemas.change import AddPlainEnumValueChangeSchema + + return AddPlainEnumValueChangeSchema().load(data) + if data["type"] == "AddPriceChange": + from ._schemas.change import AddPriceChangeSchema + + return AddPriceChangeSchema().load(data) + if data["type"] == "AddProductChange": + from ._schemas.change import AddProductChangeSchema + + return AddProductChangeSchema().load(data) + if data["type"] == "AddProductSelectionChange": + from ._schemas.change import AddProductSelectionChangeSchema + + return AddProductSelectionChangeSchema().load(data) + if data["type"] == "AddPropertyChange": + from ._schemas.change import AddPropertyChangeSchema + + return AddPropertyChangeSchema().load(data) + if data["type"] == "AddReturnInfoChange": + from ._schemas.change import AddReturnInfoChangeSchema + + return AddReturnInfoChangeSchema().load(data) + if data["type"] == "AddShippingAddressIdChange": + from ._schemas.change import AddShippingAddressIdChangeSchema + + return AddShippingAddressIdChangeSchema().load(data) + if data["type"] == "AddShoppingListLineItemChange": + from ._schemas.change import AddShoppingListLineItemChangeSchema + + return AddShoppingListLineItemChangeSchema().load(data) + if data["type"] == "AddStateRolesChange": + from ._schemas.change import AddStateRolesChangeSchema + + return AddStateRolesChangeSchema().load(data) + if data["type"] == "AddTaxRateChange": + from ._schemas.change import AddTaxRateChangeSchema + + return AddTaxRateChangeSchema().load(data) + if data["type"] == "AddTextLineItemChange": + from ._schemas.change import AddTextLineItemChangeSchema + + return AddTextLineItemChangeSchema().load(data) + if data["type"] == "AddToCategoryChange": + from ._schemas.change import AddToCategoryChangeSchema + + return AddToCategoryChangeSchema().load(data) + if data["type"] == "AddTransactionChange": + from ._schemas.change import AddTransactionChangeSchema + + return AddTransactionChangeSchema().load(data) + if data["type"] == "AddVariantChange": + from ._schemas.change import AddVariantChangeSchema + + return AddVariantChangeSchema().load(data) + if data["type"] == "ChangeAddressChange": + from ._schemas.change import ChangeAddressChangeSchema + + return ChangeAddressChangeSchema().load(data) + if data["type"] == "ChangeAmountAuthorizedChange": + from ._schemas.change import ChangeAmountAuthorizedChangeSchema + + return ChangeAmountAuthorizedChangeSchema().load(data) + if data["type"] == "ChangeAmountPlannedChange": + from ._schemas.change import ChangeAmountPlannedChangeSchema + + return ChangeAmountPlannedChangeSchema().load(data) + if data["type"] == "ChangeAssetNameChange": + from ._schemas.change import ChangeAssetNameChangeSchema + + return ChangeAssetNameChangeSchema().load(data) + if data["type"] == "ChangeAssetOrderChange": + from ._schemas.change import ChangeAssetOrderChangeSchema + + return ChangeAssetOrderChangeSchema().load(data) + if data["type"] == "ChangeAssociateChange": + from ._schemas.change import ChangeAssociateChangeSchema + + return ChangeAssociateChangeSchema().load(data) + if data["type"] == "ChangeAssociateModeChange": + from ._schemas.change import ChangeAssociateModeChangeSchema + + return ChangeAssociateModeChangeSchema().load(data) + if data["type"] == "ChangeAttributeConstraintChange": + from ._schemas.change import ChangeAttributeConstraintChangeSchema + + return ChangeAttributeConstraintChangeSchema().load(data) + if data["type"] == "ChangeAttributeOrderByNameChange": + from ._schemas.change import ChangeAttributeOrderByNameChangeSchema + + return ChangeAttributeOrderByNameChangeSchema().load(data) + if data["type"] == "ChangeBuyerAssignableChange": + from ._schemas.change import ChangeBuyerAssignableChangeSchema + + return ChangeBuyerAssignableChangeSchema().load(data) + if data["type"] == "ChangeCartDiscountsChange": + from ._schemas.change import ChangeCartDiscountsChangeSchema + + return ChangeCartDiscountsChangeSchema().load(data) + if data["type"] == "ChangeCartPredicateChange": + from ._schemas.change import ChangeCartPredicateChangeSchema + + return ChangeCartPredicateChangeSchema().load(data) + if data["type"] == "ChangeCustomLineItemQuantityChange": + from ._schemas.change import ChangeCustomLineItemQuantityChangeSchema + + return ChangeCustomLineItemQuantityChangeSchema().load(data) + if data["type"] == "ChangeDescriptionChange": + from ._schemas.change import ChangeDescriptionChangeSchema + + return ChangeDescriptionChangeSchema().load(data) + if data["type"] == "ChangeEmailChange": + from ._schemas.change import ChangeEmailChangeSchema + + return ChangeEmailChangeSchema().load(data) + if data["type"] == "ChangeEnumValueLabelChange": + from ._schemas.change import ChangeEnumValueLabelChangeSchema + + return ChangeEnumValueLabelChangeSchema().load(data) + if data["type"] == "ChangeEnumValueOrderChange": + from ._schemas.change import ChangeEnumValueOrderChangeSchema + + return ChangeEnumValueOrderChangeSchema().load(data) + if data["type"] == "ChangeFieldDefinitionOrderChange": + from ._schemas.change import ChangeFieldDefinitionOrderChangeSchema + + return ChangeFieldDefinitionOrderChangeSchema().load(data) + if data["type"] == "ChangeGroupsChange": + from ._schemas.change import ChangeGroupsChangeSchema + + return ChangeGroupsChangeSchema().load(data) + if data["type"] == "ChangeInheritedAssociateChange": + from ._schemas.change import ChangeInheritedAssociateChangeSchema + + return ChangeInheritedAssociateChangeSchema().load(data) + if data["type"] == "ChangeInitialChange": + from ._schemas.change import ChangeInitialChangeSchema + + return ChangeInitialChangeSchema().load(data) + if data["type"] == "ChangeInputHintChange": + from ._schemas.change import ChangeInputHintChangeSchema + + return ChangeInputHintChangeSchema().load(data) + if data["type"] == "ChangeIsActiveChange": + from ._schemas.change import ChangeIsActiveChangeSchema + + return ChangeIsActiveChangeSchema().load(data) + if data["type"] == "ChangeIsSearchableChange": + from ._schemas.change import ChangeIsSearchableChangeSchema + + return ChangeIsSearchableChangeSchema().load(data) + if data["type"] == "ChangeKeyChange": + from ._schemas.change import ChangeKeyChangeSchema + + return ChangeKeyChangeSchema().load(data) + if data["type"] == "ChangeLabelChange": + from ._schemas.change import ChangeLabelChangeSchema + + return ChangeLabelChangeSchema().load(data) + if data["type"] == "ChangeLineItemQuantityChange": + from ._schemas.change import ChangeLineItemQuantityChangeSchema + + return ChangeLineItemQuantityChangeSchema().load(data) + if data["type"] == "ChangeLocalizedDescriptionChange": + from ._schemas.change import ChangeLocalizedDescriptionChangeSchema + + return ChangeLocalizedDescriptionChangeSchema().load(data) + if data["type"] == "ChangeLocalizedEnumValueLabelChange": + from ._schemas.change import ChangeLocalizedEnumValueLabelChangeSchema + + return ChangeLocalizedEnumValueLabelChangeSchema().load(data) + if data["type"] == "ChangeLocalizedEnumValueOrderChange": + from ._schemas.change import ChangeLocalizedEnumValueOrderChangeSchema + + return ChangeLocalizedEnumValueOrderChangeSchema().load(data) + if data["type"] == "ChangeLocalizedNameChange": + from ._schemas.change import ChangeLocalizedNameChangeSchema + + return ChangeLocalizedNameChangeSchema().load(data) + if data["type"] == "ChangeMasterVariantChange": + from ._schemas.change import ChangeMasterVariantChangeSchema + + return ChangeMasterVariantChangeSchema().load(data) + if data["type"] == "ChangeNameChange": + from ._schemas.change import ChangeNameChangeSchema + + return ChangeNameChangeSchema().load(data) + if data["type"] == "ChangeOrderHintChange": + from ._schemas.change import ChangeOrderHintChangeSchema + + return ChangeOrderHintChangeSchema().load(data) + if data["type"] == "ChangeOrderStateChange": + from ._schemas.change import ChangeOrderStateChangeSchema + + return ChangeOrderStateChangeSchema().load(data) + if data["type"] == "ChangeParentChange": + from ._schemas.change import ChangeParentChangeSchema + + return ChangeParentChangeSchema().load(data) + if data["type"] == "ChangeParentUnitChange": + from ._schemas.change import ChangeParentUnitChangeSchema + + return ChangeParentUnitChangeSchema().load(data) + if data["type"] == "ChangePaymentStateChange": + from ._schemas.change import ChangePaymentStateChangeSchema + + return ChangePaymentStateChangeSchema().load(data) + if data["type"] == "ChangePlainEnumValueLabelChange": + from ._schemas.change import ChangePlainEnumValueLabelChangeSchema + + return ChangePlainEnumValueLabelChangeSchema().load(data) + if data["type"] == "ChangePlainEnumValueOrderChange": + from ._schemas.change import ChangePlainEnumValueOrderChangeSchema + + return ChangePlainEnumValueOrderChangeSchema().load(data) + if data["type"] == "ChangePredicateChange": + from ._schemas.change import ChangePredicateChangeSchema + + return ChangePredicateChangeSchema().load(data) + if data["type"] == "ChangePriceChange": + from ._schemas.change import ChangePriceChangeSchema + + return ChangePriceChangeSchema().load(data) + if data["type"] == "ChangeProductSelectionActiveChange": + from ._schemas.change import ChangeProductSelectionActiveChangeSchema + + return ChangeProductSelectionActiveChangeSchema().load(data) + if data["type"] == "ChangeQuantityChange": + from ._schemas.change import ChangeQuantityChangeSchema + + return ChangeQuantityChangeSchema().load(data) + if data["type"] == "ChangeQuoteRequestStateChange": + from ._schemas.change import ChangeQuoteRequestStateChangeSchema + + return ChangeQuoteRequestStateChangeSchema().load(data) + if data["type"] == "ChangeQuoteStateChange": + from ._schemas.change import ChangeQuoteStateChangeSchema + + return ChangeQuoteStateChangeSchema().load(data) + if data["type"] == "ChangeRequiresDiscountCodeChange": + from ._schemas.change import ChangeRequiresDiscountCodeChangeSchema + + return ChangeRequiresDiscountCodeChangeSchema().load(data) + if data["type"] == "ChangeReviewRatingStatisticsChange": + from ._schemas.change import ChangeReviewRatingStatisticsChangeSchema + + return ChangeReviewRatingStatisticsChangeSchema().load(data) + if data["type"] == "ChangeShipmentStateChange": + from ._schemas.change import ChangeShipmentStateChangeSchema + + return ChangeShipmentStateChangeSchema().load(data) + if data["type"] == "ChangeShoppingListLineItemQuantityChange": + from ._schemas.change import ChangeShoppingListLineItemQuantityChangeSchema + + return ChangeShoppingListLineItemQuantityChangeSchema().load(data) + if data["type"] == "ChangeShoppingListLineItemsOrderChange": + from ._schemas.change import ChangeShoppingListLineItemsOrderChangeSchema + + return ChangeShoppingListLineItemsOrderChangeSchema().load(data) + if data["type"] == "ChangeSlugChange": + from ._schemas.change import ChangeSlugChangeSchema + + return ChangeSlugChangeSchema().load(data) + if data["type"] == "ChangeSortOrderChange": + from ._schemas.change import ChangeSortOrderChangeSchema + + return ChangeSortOrderChangeSchema().load(data) + if data["type"] == "ChangeStackingModeChange": + from ._schemas.change import ChangeStackingModeChangeSchema + + return ChangeStackingModeChangeSchema().load(data) + if data["type"] == "ChangeStagedQuoteStateChange": + from ._schemas.change import ChangeStagedQuoteStateChangeSchema + + return ChangeStagedQuoteStateChangeSchema().load(data) + if data["type"] == "ChangeStateTypeChange": + from ._schemas.change import ChangeStateTypeChangeSchema + + return ChangeStateTypeChangeSchema().load(data) + if data["type"] == "ChangeStatusChange": + from ._schemas.change import ChangeStatusChangeSchema + + return ChangeStatusChangeSchema().load(data) + if data["type"] == "ChangeTargetChange": + from ._schemas.change import ChangeTargetChangeSchema + + return ChangeTargetChangeSchema().load(data) + if data["type"] == "ChangeTaxCalculationModeChange": + from ._schemas.change import ChangeTaxCalculationModeChangeSchema + + return ChangeTaxCalculationModeChangeSchema().load(data) + if data["type"] == "ChangeTaxModeChange": + from ._schemas.change import ChangeTaxModeChangeSchema + + return ChangeTaxModeChangeSchema().load(data) + if data["type"] == "ChangeTaxRoundingModeChange": + from ._schemas.change import ChangeTaxRoundingModeChangeSchema + + return ChangeTaxRoundingModeChangeSchema().load(data) + if data["type"] == "ChangeTextLineItemNameChange": + from ._schemas.change import ChangeTextLineItemNameChangeSchema + + return ChangeTextLineItemNameChangeSchema().load(data) + if data["type"] == "ChangeTextLineItemQuantityChange": + from ._schemas.change import ChangeTextLineItemQuantityChangeSchema + + return ChangeTextLineItemQuantityChangeSchema().load(data) + if data["type"] == "ChangeTextLineItemsOrderChange": + from ._schemas.change import ChangeTextLineItemsOrderChangeSchema + + return ChangeTextLineItemsOrderChangeSchema().load(data) + if data["type"] == "ChangeTransactionInteractionIdChange": + from ._schemas.change import ChangeTransactionInteractionIdChangeSchema + + return ChangeTransactionInteractionIdChangeSchema().load(data) + if data["type"] == "ChangeTransactionStateChange": + from ._schemas.change import ChangeTransactionStateChangeSchema + + return ChangeTransactionStateChangeSchema().load(data) + if data["type"] == "ChangeTransactionTimestampChange": + from ._schemas.change import ChangeTransactionTimestampChangeSchema + + return ChangeTransactionTimestampChangeSchema().load(data) + if data["type"] == "ChangeValueChange": + from ._schemas.change import ChangeValueChangeSchema + + return ChangeValueChangeSchema().load(data) + if data["type"] == "MoveImageToPositionChange": + from ._schemas.change import MoveImageToPositionChangeSchema + + return MoveImageToPositionChangeSchema().load(data) + if data["type"] == "PublishChange": + from ._schemas.change import PublishChangeSchema + + return PublishChangeSchema().load(data) + if data["type"] == "RemoveAddressChange": + from ._schemas.change import RemoveAddressChangeSchema + + return RemoveAddressChangeSchema().load(data) + if data["type"] == "RemoveAssetChange": + from ._schemas.change import RemoveAssetChangeSchema + + return RemoveAssetChangeSchema().load(data) + if data["type"] == "RemoveAssociateChange": + from ._schemas.change import RemoveAssociateChangeSchema + + return RemoveAssociateChangeSchema().load(data) + if data["type"] == "RemoveAttributeDefinitionChange": + from ._schemas.change import RemoveAttributeDefinitionChangeSchema + + return RemoveAttributeDefinitionChangeSchema().load(data) + if data["type"] == "RemoveBillingAddressIdChange": + from ._schemas.change import RemoveBillingAddressIdChangeSchema + + return RemoveBillingAddressIdChangeSchema().load(data) + if data["type"] == "RemoveChannelRolesChange": + from ._schemas.change import RemoveChannelRolesChangeSchema + + return RemoveChannelRolesChangeSchema().load(data) + if data["type"] == "RemoveCustomLineItemChange": + from ._schemas.change import RemoveCustomLineItemChangeSchema + + return RemoveCustomLineItemChangeSchema().load(data) + if data["type"] == "RemoveDeliveryItemsChange": + from ._schemas.change import RemoveDeliveryItemsChangeSchema + + return RemoveDeliveryItemsChangeSchema().load(data) + if data["type"] == "RemoveDiscountCodeChange": + from ._schemas.change import RemoveDiscountCodeChangeSchema + + return RemoveDiscountCodeChangeSchema().load(data) + if data["type"] == "RemoveEnumValuesChange": + from ._schemas.change import RemoveEnumValuesChangeSchema + + return RemoveEnumValuesChangeSchema().load(data) + if data["type"] == "RemoveFieldDefinitionChange": + from ._schemas.change import RemoveFieldDefinitionChangeSchema + + return RemoveFieldDefinitionChangeSchema().load(data) + if data["type"] == "RemoveFromCategoryChange": + from ._schemas.change import RemoveFromCategoryChangeSchema + + return RemoveFromCategoryChangeSchema().load(data) + if data["type"] == "RemoveImageChange": + from ._schemas.change import RemoveImageChangeSchema + + return RemoveImageChangeSchema().load(data) + if data["type"] == "RemoveInheritedAssociateChange": + from ._schemas.change import RemoveInheritedAssociateChangeSchema + + return RemoveInheritedAssociateChangeSchema().load(data) + if data["type"] == "RemoveItemShippingAddressesChange": + from ._schemas.change import RemoveItemShippingAddressesChangeSchema + + return RemoveItemShippingAddressesChangeSchema().load(data) + if data["type"] == "RemoveLocalizedEnumValuesChange": + from ._schemas.change import RemoveLocalizedEnumValuesChangeSchema + + return RemoveLocalizedEnumValuesChangeSchema().load(data) + if data["type"] == "RemoveLocationChange": + from ._schemas.change import RemoveLocationChangeSchema + + return RemoveLocationChangeSchema().load(data) + if data["type"] == "RemoveOrderLineItemChange": + from ._schemas.change import RemoveOrderLineItemChangeSchema + + return RemoveOrderLineItemChangeSchema().load(data) + if data["type"] == "RemoveParcelFromDeliveryChange": + from ._schemas.change import RemoveParcelFromDeliveryChangeSchema + + return RemoveParcelFromDeliveryChangeSchema().load(data) + if data["type"] == "RemovePaymentChange": + from ._schemas.change import RemovePaymentChangeSchema + + return RemovePaymentChangeSchema().load(data) + if data["type"] == "RemovePriceChange": + from ._schemas.change import RemovePriceChangeSchema + + return RemovePriceChangeSchema().load(data) + if data["type"] == "RemoveProductChange": + from ._schemas.change import RemoveProductChangeSchema + + return RemoveProductChangeSchema().load(data) + if data["type"] == "RemoveProductSelectionChange": + from ._schemas.change import RemoveProductSelectionChangeSchema + + return RemoveProductSelectionChangeSchema().load(data) + if data["type"] == "RemovePropertyChange": + from ._schemas.change import RemovePropertyChangeSchema + + return RemovePropertyChangeSchema().load(data) + if data["type"] == "RemoveShippingAddressIdChange": + from ._schemas.change import RemoveShippingAddressIdChangeSchema + + return RemoveShippingAddressIdChangeSchema().load(data) + if data["type"] == "RemoveShoppingListLineItemChange": + from ._schemas.change import RemoveShoppingListLineItemChangeSchema + + return RemoveShoppingListLineItemChangeSchema().load(data) + if data["type"] == "RemoveStateRolesChange": + from ._schemas.change import RemoveStateRolesChangeSchema + + return RemoveStateRolesChangeSchema().load(data) + if data["type"] == "RemoveTaxRateChange": + from ._schemas.change import RemoveTaxRateChangeSchema + + return RemoveTaxRateChangeSchema().load(data) + if data["type"] == "RemoveTextLineItemChange": + from ._schemas.change import RemoveTextLineItemChangeSchema + + return RemoveTextLineItemChangeSchema().load(data) + if data["type"] == "RemoveVariantChange": + from ._schemas.change import RemoveVariantChangeSchema + + return RemoveVariantChangeSchema().load(data) + if data["type"] == "RequestQuoteRenegotiationChange": + from ._schemas.change import RequestQuoteRenegotiationChangeSchema + + return RequestQuoteRenegotiationChangeSchema().load(data) + if data["type"] == "SetAddressChange": + from ._schemas.change import SetAddressChangeSchema + + return SetAddressChangeSchema().load(data) + if data["type"] == "SetAddressCustomFieldChange": + from ._schemas.change import SetAddressCustomFieldChangeSchema + + return SetAddressCustomFieldChangeSchema().load(data) + if data["type"] == "SetAddressCustomTypeChange": + from ._schemas.change import SetAddressCustomTypeChangeSchema + + return SetAddressCustomTypeChangeSchema().load(data) + if data["type"] == "SetAnonymousIdChange": + from ._schemas.change import SetAnonymousIdChangeSchema + + return SetAnonymousIdChangeSchema().load(data) + if data["type"] == "SetApplicationVersionChange": + from ._schemas.change import SetApplicationVersionChangeSchema + + return SetApplicationVersionChangeSchema().load(data) + if data["type"] == "SetAssetCustomFieldChange": + from ._schemas.change import SetAssetCustomFieldChangeSchema + + return SetAssetCustomFieldChangeSchema().load(data) + if data["type"] == "SetAssetCustomTypeChange": + from ._schemas.change import SetAssetCustomTypeChangeSchema + + return SetAssetCustomTypeChangeSchema().load(data) + if data["type"] == "SetAssetDescriptionChange": + from ._schemas.change import SetAssetDescriptionChangeSchema + + return SetAssetDescriptionChangeSchema().load(data) + if data["type"] == "SetAssetKeyChange": + from ._schemas.change import SetAssetKeyChangeSchema + + return SetAssetKeyChangeSchema().load(data) + if data["type"] == "SetAssetSourcesChange": + from ._schemas.change import SetAssetSourcesChangeSchema + + return SetAssetSourcesChangeSchema().load(data) + if data["type"] == "SetAssetTagsChange": + from ._schemas.change import SetAssetTagsChangeSchema + + return SetAssetTagsChangeSchema().load(data) + if data["type"] == "SetAttributeChange": + from ._schemas.change import SetAttributeChangeSchema + + return SetAttributeChangeSchema().load(data) + if data["type"] == "SetAuthenticationModeChange": + from ._schemas.change import SetAuthenticationModeChangeSchema + + return SetAuthenticationModeChangeSchema().load(data) + if data["type"] == "SetAuthorNameChange": + from ._schemas.change import SetAuthorNameChangeSchema + + return SetAuthorNameChangeSchema().load(data) + if data["type"] == "SetBillingAddressChange": + from ._schemas.change import SetBillingAddressChangeSchema + + return SetBillingAddressChangeSchema().load(data) + if data["type"] == "SetCartPredicateChange": + from ._schemas.change import SetCartPredicateChangeSchema + + return SetCartPredicateChangeSchema().load(data) + if data["type"] == "SetCategoryOrderHintChange": + from ._schemas.change import SetCategoryOrderHintChangeSchema + + return SetCategoryOrderHintChangeSchema().load(data) + if data["type"] == "SetChannelRolesChange": + from ._schemas.change import SetChannelRolesChangeSchema + + return SetChannelRolesChangeSchema().load(data) + if data["type"] == "SetCompanyNameChange": + from ._schemas.change import SetCompanyNameChangeSchema + + return SetCompanyNameChangeSchema().load(data) + if data["type"] == "SetContactEmailChange": + from ._schemas.change import SetContactEmailChangeSchema + + return SetContactEmailChangeSchema().load(data) + if data["type"] == "SetCountriesChange": + from ._schemas.change import SetCountriesChangeSchema + + return SetCountriesChangeSchema().load(data) + if data["type"] == "SetCountryChange": + from ._schemas.change import SetCountryChangeSchema + + return SetCountryChangeSchema().load(data) + if data["type"] == "SetCustomFieldChange": + from ._schemas.change import SetCustomFieldChangeSchema + + return SetCustomFieldChangeSchema().load(data) + if data["type"] == "SetCustomLineItemCustomFieldChange": + from ._schemas.change import SetCustomLineItemCustomFieldChangeSchema + + return SetCustomLineItemCustomFieldChangeSchema().load(data) + if data["type"] == "SetCustomLineItemCustomTypeChange": + from ._schemas.change import SetCustomLineItemCustomTypeChangeSchema + + return SetCustomLineItemCustomTypeChangeSchema().load(data) + if data["type"] == "SetCustomLineItemMoneyChange": + from ._schemas.change import SetCustomLineItemMoneyChangeSchema + + return SetCustomLineItemMoneyChangeSchema().load(data) + if data["type"] == "SetCustomLineItemShippingDetailsChange": + from ._schemas.change import SetCustomLineItemShippingDetailsChangeSchema + + return SetCustomLineItemShippingDetailsChangeSchema().load(data) + if data["type"] == "SetCustomLineItemTaxAmountChange": + from ._schemas.change import SetCustomLineItemTaxAmountChangeSchema + + return SetCustomLineItemTaxAmountChangeSchema().load(data) + if data["type"] == "SetCustomLineItemTaxCategoryChange": + from ._schemas.change import SetCustomLineItemTaxCategoryChangeSchema + + return SetCustomLineItemTaxCategoryChangeSchema().load(data) + if data["type"] == "SetCustomLineItemTaxRateChange": + from ._schemas.change import SetCustomLineItemTaxRateChangeSchema + + return SetCustomLineItemTaxRateChangeSchema().load(data) + if data["type"] == "SetCustomLineItemTaxedPriceChange": + from ._schemas.change import SetCustomLineItemTaxedPriceChangeSchema + + return SetCustomLineItemTaxedPriceChangeSchema().load(data) + if data["type"] == "SetCustomLineItemTotalPriceChange": + from ._schemas.change import SetCustomLineItemTotalPriceChangeSchema + + return SetCustomLineItemTotalPriceChangeSchema().load(data) + if data["type"] == "SetCustomShippingMethodChange": + from ._schemas.change import SetCustomShippingMethodChangeSchema + + return SetCustomShippingMethodChangeSchema().load(data) + if data["type"] == "SetCustomTypeChange": + from ._schemas.change import SetCustomTypeChangeSchema + + return SetCustomTypeChangeSchema().load(data) + if data["type"] == "SetCustomerChange": + from ._schemas.change import SetCustomerChangeSchema + + return SetCustomerChangeSchema().load(data) + if data["type"] == "SetCustomerEmailChange": + from ._schemas.change import SetCustomerEmailChangeSchema + + return SetCustomerEmailChangeSchema().load(data) + if data["type"] == "SetCustomerGroupChange": + from ._schemas.change import SetCustomerGroupChangeSchema + + return SetCustomerGroupChangeSchema().load(data) + if data["type"] == "SetCustomerIdChange": + from ._schemas.change import SetCustomerIdChangeSchema + + return SetCustomerIdChangeSchema().load(data) + if data["type"] == "SetCustomerNumberChange": + from ._schemas.change import SetCustomerNumberChangeSchema + + return SetCustomerNumberChangeSchema().load(data) + if data["type"] == "SetDateOfBirthChange": + from ._schemas.change import SetDateOfBirthChangeSchema + + return SetDateOfBirthChangeSchema().load(data) + if data["type"] == "SetDefaultBillingAddressChange": + from ._schemas.change import SetDefaultBillingAddressChangeSchema + + return SetDefaultBillingAddressChangeSchema().load(data) + if data["type"] == "SetDefaultShippingAddressChange": + from ._schemas.change import SetDefaultShippingAddressChangeSchema + + return SetDefaultShippingAddressChangeSchema().load(data) + if data["type"] == "SetDeleteDaysAfterLastModificationChange": + from ._schemas.change import SetDeleteDaysAfterLastModificationChangeSchema + + return SetDeleteDaysAfterLastModificationChangeSchema().load(data) + if data["type"] == "SetDeliveryAddressChange": + from ._schemas.change import SetDeliveryAddressChangeSchema + + return SetDeliveryAddressChangeSchema().load(data) + if data["type"] == "SetDeliveryItemsChange": + from ._schemas.change import SetDeliveryItemsChangeSchema + + return SetDeliveryItemsChangeSchema().load(data) + if data["type"] == "SetDescriptionChange": + from ._schemas.change import SetDescriptionChangeSchema + + return SetDescriptionChangeSchema().load(data) + if data["type"] == "SetDiscountedPriceChange": + from ._schemas.change import SetDiscountedPriceChangeSchema + + return SetDiscountedPriceChangeSchema().load(data) + if data["type"] == "SetDistributionChannelsChange": + from ._schemas.change import SetDistributionChannelsChangeSchema + + return SetDistributionChannelsChangeSchema().load(data) + if data["type"] == "SetExpectedDeliveryChange": + from ._schemas.change import SetExpectedDeliveryChangeSchema + + return SetExpectedDeliveryChangeSchema().load(data) + if data["type"] == "SetExternalIdChange": + from ._schemas.change import SetExternalIdChangeSchema + + return SetExternalIdChangeSchema().load(data) + if data["type"] == "SetFirstNameChange": + from ._schemas.change import SetFirstNameChangeSchema + + return SetFirstNameChangeSchema().load(data) + if data["type"] == "SetGeoLocationChange": + from ._schemas.change import SetGeoLocationChangeSchema + + return SetGeoLocationChangeSchema().load(data) + if data["type"] == "SetImageLabelChange": + from ._schemas.change import SetImageLabelChangeSchema + + return SetImageLabelChangeSchema().load(data) + if data["type"] == "SetInputTipChange": + from ._schemas.change import SetInputTipChangeSchema + + return SetInputTipChangeSchema().load(data) + if data["type"] == "SetInterfaceIdChange": + from ._schemas.change import SetInterfaceIdChangeSchema + + return SetInterfaceIdChangeSchema().load(data) + if data["type"] == "SetIsValidChange": + from ._schemas.change import SetIsValidChangeSchema + + return SetIsValidChangeSchema().load(data) + if data["type"] == "SetKeyChange": + from ._schemas.change import SetKeyChangeSchema + + return SetKeyChangeSchema().load(data) + if data["type"] == "SetLanguagesChange": + from ._schemas.change import SetLanguagesChangeSchema + + return SetLanguagesChangeSchema().load(data) + if data["type"] == "SetLastNameChange": + from ._schemas.change import SetLastNameChangeSchema + + return SetLastNameChangeSchema().load(data) + if data["type"] == "SetLineItemDeactivatedAtChange": + from ._schemas.change import SetLineItemDeactivatedAtChangeSchema + + return SetLineItemDeactivatedAtChangeSchema().load(data) + if data["type"] == "SetLineItemDiscountedPriceChange": + from ._schemas.change import SetLineItemDiscountedPriceChangeSchema + + return SetLineItemDiscountedPriceChangeSchema().load(data) + if data["type"] == "SetLineItemDiscountedPricePerQuantityChange": + from ._schemas.change import ( + SetLineItemDiscountedPricePerQuantityChangeSchema, + ) + + return SetLineItemDiscountedPricePerQuantityChangeSchema().load(data) + if data["type"] == "SetLineItemDistributionChannelChange": + from ._schemas.change import SetLineItemDistributionChannelChangeSchema + + return SetLineItemDistributionChannelChangeSchema().load(data) + if data["type"] == "SetLineItemPriceChange": + from ._schemas.change import SetLineItemPriceChangeSchema + + return SetLineItemPriceChangeSchema().load(data) + if data["type"] == "SetLineItemProductKeyChange": + from ._schemas.change import SetLineItemProductKeyChangeSchema + + return SetLineItemProductKeyChangeSchema().load(data) + if data["type"] == "SetLineItemProductSlugChange": + from ._schemas.change import SetLineItemProductSlugChangeSchema + + return SetLineItemProductSlugChangeSchema().load(data) + if data["type"] == "SetLineItemShippingDetailsChange": + from ._schemas.change import SetLineItemShippingDetailsChangeSchema + + return SetLineItemShippingDetailsChangeSchema().load(data) + if data["type"] == "SetLineItemTaxAmountChange": + from ._schemas.change import SetLineItemTaxAmountChangeSchema + + return SetLineItemTaxAmountChangeSchema().load(data) + if data["type"] == "SetLineItemTaxRateChange": + from ._schemas.change import SetLineItemTaxRateChangeSchema + + return SetLineItemTaxRateChangeSchema().load(data) + if data["type"] == "SetLineItemTaxedPriceChange": + from ._schemas.change import SetLineItemTaxedPriceChangeSchema + + return SetLineItemTaxedPriceChangeSchema().load(data) + if data["type"] == "SetLineItemTotalPriceChange": + from ._schemas.change import SetLineItemTotalPriceChangeSchema + + return SetLineItemTotalPriceChangeSchema().load(data) + if data["type"] == "SetLocaleChange": + from ._schemas.change import SetLocaleChangeSchema + + return SetLocaleChangeSchema().load(data) + if data["type"] == "SetLocalizedDescriptionChange": + from ._schemas.change import SetLocalizedDescriptionChangeSchema + + return SetLocalizedDescriptionChangeSchema().load(data) + if data["type"] == "SetMaxApplicationsChange": + from ._schemas.change import SetMaxApplicationsChangeSchema + + return SetMaxApplicationsChangeSchema().load(data) + if data["type"] == "SetMaxApplicationsPerCustomerChange": + from ._schemas.change import SetMaxApplicationsPerCustomerChangeSchema + + return SetMaxApplicationsPerCustomerChangeSchema().load(data) + if data["type"] == "SetMetaDescriptionChange": + from ._schemas.change import SetMetaDescriptionChangeSchema + + return SetMetaDescriptionChangeSchema().load(data) + if data["type"] == "SetMetaKeywordsChange": + from ._schemas.change import SetMetaKeywordsChangeSchema + + return SetMetaKeywordsChangeSchema().load(data) + if data["type"] == "SetMetaTitleChange": + from ._schemas.change import SetMetaTitleChangeSchema + + return SetMetaTitleChangeSchema().load(data) + if data["type"] == "SetMethodInfoInterfaceChange": + from ._schemas.change import SetMethodInfoInterfaceChangeSchema + + return SetMethodInfoInterfaceChangeSchema().load(data) + if data["type"] == "SetMethodInfoMethodChange": + from ._schemas.change import SetMethodInfoMethodChangeSchema + + return SetMethodInfoMethodChangeSchema().load(data) + if data["type"] == "SetMethodInfoNameChange": + from ._schemas.change import SetMethodInfoNameChangeSchema + + return SetMethodInfoNameChangeSchema().load(data) + if data["type"] == "SetMiddleNameChange": + from ._schemas.change import SetMiddleNameChangeSchema + + return SetMiddleNameChangeSchema().load(data) + if data["type"] == "SetNameChange": + from ._schemas.change import SetNameChangeSchema + + return SetNameChangeSchema().load(data) + if data["type"] == "SetLocalizedNameChange": + from ._schemas.change import SetLocalizedNameChangeSchema + + return SetLocalizedNameChangeSchema().load(data) + if data["type"] == "SetOrderLineItemCustomFieldChange": + from ._schemas.change import SetOrderLineItemCustomFieldChangeSchema + + return SetOrderLineItemCustomFieldChangeSchema().load(data) + if data["type"] == "SetOrderLineItemCustomTypeChange": + from ._schemas.change import SetOrderLineItemCustomTypeChangeSchema + + return SetOrderLineItemCustomTypeChangeSchema().load(data) + if data["type"] == "SetOrderNumberChange": + from ._schemas.change import SetOrderNumberChangeSchema + + return SetOrderNumberChangeSchema().load(data) + if data["type"] == "SetOrderTaxedPriceChange": + from ._schemas.change import SetOrderTaxedPriceChangeSchema + + return SetOrderTaxedPriceChangeSchema().load(data) + if data["type"] == "SetOrderTotalPriceChange": + from ._schemas.change import SetOrderTotalPriceChangeSchema + + return SetOrderTotalPriceChangeSchema().load(data) + if data["type"] == "SetOrderTotalTaxChange": + from ._schemas.change import SetOrderTotalTaxChangeSchema + + return SetOrderTotalTaxChangeSchema().load(data) + if data["type"] == "SetParcelItemsChange": + from ._schemas.change import SetParcelItemsChangeSchema + + return SetParcelItemsChangeSchema().load(data) + if data["type"] == "SetParcelMeasurementsChange": + from ._schemas.change import SetParcelMeasurementsChangeSchema + + return SetParcelMeasurementsChangeSchema().load(data) + if data["type"] == "SetParcelTrackingDataChange": + from ._schemas.change import SetParcelTrackingDataChangeSchema + + return SetParcelTrackingDataChangeSchema().load(data) + if data["type"] == "SetPermissionsChange": + from ._schemas.change import SetPermissionsChangeSchema + + return SetPermissionsChangeSchema().load(data) + if data["type"] == "SetPricesChange": + from ._schemas.change import SetPricesChangeSchema + + return SetPricesChangeSchema().load(data) + if data["type"] == "SetProductCountChange": + from ._schemas.change import SetProductCountChangeSchema + + return SetProductCountChangeSchema().load(data) + if data["type"] == "SetProductPriceCustomFieldChange": + from ._schemas.change import SetProductPriceCustomFieldChangeSchema + + return SetProductPriceCustomFieldChangeSchema().load(data) + if data["type"] == "SetProductPriceCustomTypeChange": + from ._schemas.change import SetProductPriceCustomTypeChangeSchema + + return SetProductPriceCustomTypeChangeSchema().load(data) + if data["type"] == "SetProductSelectionsChange": + from ._schemas.change import SetProductSelectionsChangeSchema + + return SetProductSelectionsChangeSchema().load(data) + if data["type"] == "SetProductVariantKeyChange": + from ._schemas.change import SetProductVariantKeyChangeSchema + + return SetProductVariantKeyChangeSchema().load(data) + if data["type"] == "SetPropertyChange": + from ._schemas.change import SetPropertyChangeSchema + + return SetPropertyChangeSchema().load(data) + if data["type"] == "SetPurchaseOrderNumberChange": + from ._schemas.change import SetPurchaseOrderNumberChangeSchema + + return SetPurchaseOrderNumberChangeSchema().load(data) + if data["type"] == "SetRatingChange": + from ._schemas.change import SetRatingChangeSchema + + return SetRatingChangeSchema().load(data) + if data["type"] == "SetReservationsChange": + from ._schemas.change import SetReservationsChangeSchema + + return SetReservationsChangeSchema().load(data) + if data["type"] == "SetRestockableInDaysChange": + from ._schemas.change import SetRestockableInDaysChangeSchema + + return SetRestockableInDaysChangeSchema().load(data) + if data["type"] == "SetReturnPaymentStateChange": + from ._schemas.change import SetReturnPaymentStateChangeSchema + + return SetReturnPaymentStateChangeSchema().load(data) + if data["type"] == "SetReturnShipmentStateChange": + from ._schemas.change import SetReturnShipmentStateChangeSchema + + return SetReturnShipmentStateChangeSchema().load(data) + if data["type"] == "SetSalutationChange": + from ._schemas.change import SetSalutationChangeSchema + + return SetSalutationChangeSchema().load(data) + if data["type"] == "SetSearchKeywordsChange": + from ._schemas.change import SetSearchKeywordsChangeSchema + + return SetSearchKeywordsChangeSchema().load(data) + if data["type"] == "SetSellerCommentChange": + from ._schemas.change import SetSellerCommentChangeSchema + + return SetSellerCommentChangeSchema().load(data) + if data["type"] == "SetShippingAddressChange": + from ._schemas.change import SetShippingAddressChangeSchema + + return SetShippingAddressChangeSchema().load(data) + if data["type"] == "SetShippingInfoPriceChange": + from ._schemas.change import SetShippingInfoPriceChangeSchema + + return SetShippingInfoPriceChangeSchema().load(data) + if data["type"] == "SetShippingInfoTaxedPriceChange": + from ._schemas.change import SetShippingInfoTaxedPriceChangeSchema + + return SetShippingInfoTaxedPriceChangeSchema().load(data) + if data["type"] == "SetShippingMethodChange": + from ._schemas.change import SetShippingMethodChangeSchema + + return SetShippingMethodChangeSchema().load(data) + if data["type"] == "SetShippingMethodTaxAmountChange": + from ._schemas.change import SetShippingMethodTaxAmountChangeSchema + + return SetShippingMethodTaxAmountChangeSchema().load(data) + if data["type"] == "SetShippingMethodTaxRateChange": + from ._schemas.change import SetShippingMethodTaxRateChangeSchema + + return SetShippingMethodTaxRateChangeSchema().load(data) + if data["type"] == "SetShippingRateChange": + from ._schemas.change import SetShippingRateChangeSchema + + return SetShippingRateChangeSchema().load(data) + if data["type"] == "SetShippingRateInputChange": + from ._schemas.change import SetShippingRateInputChangeSchema + + return SetShippingRateInputChangeSchema().load(data) + if data["type"] == "SetShoppingListLineItemCustomFieldChange": + from ._schemas.change import SetShoppingListLineItemCustomFieldChangeSchema + + return SetShoppingListLineItemCustomFieldChangeSchema().load(data) + if data["type"] == "SetShoppingListLineItemCustomTypeChange": + from ._schemas.change import SetShoppingListLineItemCustomTypeChangeSchema + + return SetShoppingListLineItemCustomTypeChangeSchema().load(data) + if data["type"] == "SetSkuChange": + from ._schemas.change import SetSkuChangeSchema + + return SetSkuChangeSchema().load(data) + if data["type"] == "SetSlugChange": + from ._schemas.change import SetSlugChangeSchema + + return SetSlugChangeSchema().load(data) + if data["type"] == "SetStateRolesChange": + from ._schemas.change import SetStateRolesChangeSchema + + return SetStateRolesChangeSchema().load(data) + if data["type"] == "SetStatusInterfaceCodeChange": + from ._schemas.change import SetStatusInterfaceCodeChangeSchema + + return SetStatusInterfaceCodeChangeSchema().load(data) + if data["type"] == "SetStatusInterfaceTextChange": + from ._schemas.change import SetStatusInterfaceTextChangeSchema + + return SetStatusInterfaceTextChangeSchema().load(data) + if data["type"] == "SetStoreChange": + from ._schemas.change import SetStoreChangeSchema + + return SetStoreChangeSchema().load(data) + if data["type"] == "SetStoreModeChange": + from ._schemas.change import SetStoreModeChangeSchema + + return SetStoreModeChangeSchema().load(data) + if data["type"] == "SetStoresChange": + from ._schemas.change import SetStoresChangeSchema + + return SetStoresChangeSchema().load(data) + if data["type"] == "SetSupplyChannelChange": + from ._schemas.change import SetSupplyChannelChangeSchema + + return SetSupplyChannelChangeSchema().load(data) + if data["type"] == "SetSupplyChannelsChange": + from ._schemas.change import SetSupplyChannelsChangeSchema + + return SetSupplyChannelsChangeSchema().load(data) + if data["type"] == "SetTargetChange": + from ._schemas.change import SetTargetChangeSchema + + return SetTargetChangeSchema().load(data) + if data["type"] == "SetTaxCategoryChange": + from ._schemas.change import SetTaxCategoryChangeSchema + + return SetTaxCategoryChangeSchema().load(data) + if data["type"] == "SetTextChange": + from ._schemas.change import SetTextChangeSchema + + return SetTextChangeSchema().load(data) + if data["type"] == "SetTextLineItemCustomFieldChange": + from ._schemas.change import SetTextLineItemCustomFieldChangeSchema + + return SetTextLineItemCustomFieldChangeSchema().load(data) + if data["type"] == "SetTextLineItemCustomTypeChange": + from ._schemas.change import SetTextLineItemCustomTypeChangeSchema + + return SetTextLineItemCustomTypeChangeSchema().load(data) + if data["type"] == "SetTextLineItemDescriptionChange": + from ._schemas.change import SetTextLineItemDescriptionChangeSchema + + return SetTextLineItemDescriptionChangeSchema().load(data) + if data["type"] == "SetTitleChange": + from ._schemas.change import SetTitleChangeSchema + + return SetTitleChangeSchema().load(data) + if data["type"] == "SetTransitionsChange": + from ._schemas.change import SetTransitionsChangeSchema + + return SetTransitionsChangeSchema().load(data) + if data["type"] == "SetValidFromAndUntilChange": + from ._schemas.change import SetValidFromAndUntilChangeSchema + + return SetValidFromAndUntilChangeSchema().load(data) + if data["type"] == "SetValidFromChange": + from ._schemas.change import SetValidFromChangeSchema + + return SetValidFromChangeSchema().load(data) + if data["type"] == "SetValidToChange": + from ._schemas.change import SetValidToChangeSchema + + return SetValidToChangeSchema().load(data) + if data["type"] == "SetValidUntilChange": + from ._schemas.change import SetValidUntilChangeSchema + + return SetValidUntilChangeSchema().load(data) + if data["type"] == "SetValueChange": + from ._schemas.change import SetValueChangeSchema + + return SetValueChangeSchema().load(data) + if data["type"] == "SetVariantAvailabilityChange": + from ._schemas.change import SetVariantAvailabilityChangeSchema + + return SetVariantAvailabilityChangeSchema().load(data) + if data["type"] == "SetVariantSelectionChange": + from ._schemas.change import SetVariantSelectionChangeSchema + + return SetVariantSelectionChangeSchema().load(data) + if data["type"] == "SetVatIdChange": + from ._schemas.change import SetVatIdChangeSchema + + return SetVatIdChangeSchema().load(data) + if data["type"] == "TransitionCustomLineItemStateChange": + from ._schemas.change import TransitionCustomLineItemStateChangeSchema + + return TransitionCustomLineItemStateChangeSchema().load(data) + if data["type"] == "TransitionLineItemStateChange": + from ._schemas.change import TransitionLineItemStateChangeSchema + + return TransitionLineItemStateChangeSchema().load(data) + if data["type"] == "TransitionStateChange": + from ._schemas.change import TransitionStateChangeSchema + + return TransitionStateChangeSchema().load(data) + if data["type"] == "UnknownChange": + from ._schemas.change import UnknownChangeSchema + + return UnknownChangeSchema().load(data) + if data["type"] == "UnpublishChange": + from ._schemas.change import UnpublishChangeSchema + + return UnpublishChangeSchema().load(data) + if data["type"] == "UpdateSyncInfoChange": + from ._schemas.change import UpdateSyncInfoChangeSchema + + return UpdateSyncInfoChangeSchema().load(data) + if data["type"] == "VerifyEmailChange": + from ._schemas.change import VerifyEmailChangeSchema + + return VerifyEmailChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeSchema + + return ChangeSchema().dump(self) + + +class AddAddressChange(Change): + """Change triggered by the [Add Address](ctp:api:type:CustomerAddAddressAction) update action.""" + + #: Value after the change. + next_value: "Address" + + def __init__(self, *, change: str, next_value: "Address"): + self.next_value = next_value + + super().__init__(change=change, type="AddAddressChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddAddressChange": + from ._schemas.change import AddAddressChangeSchema + + return AddAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddAddressChangeSchema + + return AddAddressChangeSchema().dump(self) + + +class AddAssetChange(Change): + """Change triggered by the following update actions: + + - [Add Asset](ctp:api:type:CategoryAddAssetAction) on Categories. + - [Add Asset](ctp:api:type:ProductAddAssetAction) on Products. + + """ + + #: Value before the change. + previous_value: "Asset" + #: Value after the change. + next_value: "Asset" + + def __init__(self, *, change: str, previous_value: "Asset", next_value: "Asset"): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddAssetChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddAssetChange": + from ._schemas.change import AddAssetChangeSchema + + return AddAssetChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddAssetChangeSchema + + return AddAssetChangeSchema().dump(self) + + +class AddAssociateChange(Change): + """Change triggered by the [Add Associate](ctp:api:type:BusinessUnitAddAssociateAction) update action.""" + + #: Value after the change. + next_value: "Associate" + + def __init__(self, *, change: str, next_value: "Associate"): + self.next_value = next_value + + super().__init__(change=change, type="AddAssociateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddAssociateChange": + from ._schemas.change import AddAssociateChangeSchema + + return AddAssociateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddAssociateChangeSchema + + return AddAssociateChangeSchema().dump(self) + + +class AddAttributeDefinitionChange(Change): + """Change triggered by the [Add Attribute Definition](ctp:api:type:ProductTypeAddAttributeDefinitionAction) update action.""" + + #: Value after the change. + next_value: "AttributeDefinition" + + def __init__(self, *, change: str, next_value: "AttributeDefinition"): + self.next_value = next_value + + super().__init__(change=change, type="AddAttributeDefinitionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddAttributeDefinitionChange": + from ._schemas.change import AddAttributeDefinitionChangeSchema + + return AddAttributeDefinitionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddAttributeDefinitionChangeSchema + + return AddAttributeDefinitionChangeSchema().dump(self) + + +class AddBillingAddressIdChange(Change): + """Change triggered by the [Add Billing Address ID](ctp:api:type:CustomerAddBillingAddressIdAction) update action.""" + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + #: Address added to `billingAddressIds`. + address: "Address" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"], + address: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + self.address = address + + super().__init__(change=change, type="AddBillingAddressIdChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddBillingAddressIdChange": + from ._schemas.change import AddBillingAddressIdChangeSchema + + return AddBillingAddressIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddBillingAddressIdChangeSchema + + return AddBillingAddressIdChangeSchema().dump(self) + + +class AddChannelRolesChange(Change): + """Change triggered by the [Add Roles](ctp:api:type:ChannelAddRolesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["ChannelRoleEnum"] + #: Value after the change. + next_value: typing.List["ChannelRoleEnum"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["ChannelRoleEnum"], + next_value: typing.List["ChannelRoleEnum"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddChannelRolesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddChannelRolesChange": + from ._schemas.change import AddChannelRolesChangeSchema + + return AddChannelRolesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddChannelRolesChangeSchema + + return AddChannelRolesChangeSchema().dump(self) + + +class AddCustomLineItemChange(Change): + """Change triggered by the [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction) update action.""" + + #: Value before the change. + previous_value: "CustomLineItem" + #: Value after the change. + next_value: "CustomLineItem" + + def __init__( + self, + *, + change: str, + previous_value: "CustomLineItem", + next_value: "CustomLineItem" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddCustomLineItemChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddCustomLineItemChange": + from ._schemas.change import AddCustomLineItemChangeSchema + + return AddCustomLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddCustomLineItemChangeSchema + + return AddCustomLineItemChangeSchema().dump(self) + + +class AddDeliveryChange(Change): + """Change triggered by the [Add Delivery](ctp:api:type:OrderAddDeliveryAction) update action.""" + + #: Value before the change. + previous_value: "DeliveryChangeValue" + #: Value after the change. + next_value: "DeliveryChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "DeliveryChangeValue", + next_value: "DeliveryChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddDeliveryChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddDeliveryChange": + from ._schemas.change import AddDeliveryChangeSchema + + return AddDeliveryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddDeliveryChangeSchema + + return AddDeliveryChangeSchema().dump(self) + + +class AddDiscountCodeChange(Change): + """Change triggered by the [Add DiscountCode](ctp:api:type:StagedOrderAddDiscountCodeAction) update action.""" + + #: Value after the change. + next_value: "DiscountCodeInfo" + + def __init__(self, *, change: str, next_value: "DiscountCodeInfo"): + self.next_value = next_value + + super().__init__(change=change, type="AddDiscountCodeChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddDiscountCodeChange": + from ._schemas.change import AddDiscountCodeChangeSchema + + return AddDiscountCodeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddDiscountCodeChangeSchema + + return AddDiscountCodeChangeSchema().dump(self) + + +class AddEnumValueChange(Change): + """Change triggered by the [Add EnumValue to FieldDefinition](ctp:api:type:TypeAddEnumValueAction) update action.""" + + #: Value after the change. + next_value: "EnumValue" + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition). + field_name: str + + def __init__(self, *, change: str, next_value: "EnumValue", field_name: str): + self.next_value = next_value + self.field_name = field_name + + super().__init__(change=change, type="AddEnumValueChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddEnumValueChange": + from ._schemas.change import AddEnumValueChangeSchema + + return AddEnumValueChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddEnumValueChangeSchema + + return AddEnumValueChangeSchema().dump(self) + + +class AddExternalImageChange(Change): + """Change triggered by the [Add External Image](ctp:api:type:ProductAddExternalImageAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Image"] + #: Value after the change. + next_value: typing.List["Image"] + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Image"], + next_value: typing.List["Image"], + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="AddExternalImageChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddExternalImageChange": + from ._schemas.change import AddExternalImageChangeSchema + + return AddExternalImageChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddExternalImageChangeSchema + + return AddExternalImageChangeSchema().dump(self) + + +class AddFieldDefinitionChange(Change): + """Change triggered by the [Add FieldDefinition](ctp:api:type:TypeAddFieldDefinitionAction) update action.""" + + #: Value after the change. + next_value: "FieldDefinition" + + def __init__(self, *, change: str, next_value: "FieldDefinition"): + self.next_value = next_value + + super().__init__(change=change, type="AddFieldDefinitionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddFieldDefinitionChange": + from ._schemas.change import AddFieldDefinitionChangeSchema + + return AddFieldDefinitionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddFieldDefinitionChangeSchema + + return AddFieldDefinitionChangeSchema().dump(self) + + +class AddInheritedAssociateChange(Change): + """Change triggered by the [Add Associate](ctp:api:type:BusinessUnitAddAssociateAction) update action on a parent of a Business Unit in cases where [inheritance applies](/../api/associates-overview#conditions-for-inheritance).""" + + #: Value after the change. + next_value: "InheritedAssociate" + + def __init__(self, *, change: str, next_value: "InheritedAssociate"): + self.next_value = next_value + + super().__init__(change=change, type="AddInheritedAssociateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddInheritedAssociateChange": + from ._schemas.change import AddInheritedAssociateChangeSchema + + return AddInheritedAssociateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddInheritedAssociateChangeSchema + + return AddInheritedAssociateChangeSchema().dump(self) + + +class AddInterfaceInteractionChange(Change): + """Change triggered by the [Add InterfaceInteraction](ctp:api:type:PaymentAddInterfaceInteractionAction) update action.""" + + #: Value after the change. + next_value: "CustomFieldExpandedValue" + + def __init__(self, *, change: str, next_value: "CustomFieldExpandedValue"): + self.next_value = next_value + + super().__init__(change=change, type="AddInterfaceInteractionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddInterfaceInteractionChange": + from ._schemas.change import AddInterfaceInteractionChangeSchema + + return AddInterfaceInteractionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddInterfaceInteractionChangeSchema + + return AddInterfaceInteractionChangeSchema().dump(self) + + +class AddItemShippingAddressesChange(Change): + """Change triggered by the following update actions: + + - [Add ItemShippingAddress](ctp:api:type:OrderAddItemShippingAddressAction) on Orders. + - [Add ItemShippingAddress](ctp:api:type:StagedOrderAddItemShippingAddressAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddItemShippingAddressesChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddItemShippingAddressesChange": + from ._schemas.change import AddItemShippingAddressesChangeSchema + + return AddItemShippingAddressesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddItemShippingAddressesChangeSchema + + return AddItemShippingAddressesChangeSchema().dump(self) + + +class AddLocalizedEnumValueChange(Change): + """Change triggered by the following update actions: + + - [Add LocalizableEnumValue to AttributeDefinition](ctp:api:type:ProductTypeAddLocalizedEnumValueAction) on Product Types. + - [Add LocalizedEnumValue to FieldDefinition](ctp:api:type:TypeAddLocalizedEnumValueAction) on Types. + + """ + + #: Value after the change. + next_value: "AttributeLocalizedEnumValue" + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition); only present on changes to Types. + field_name: str + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition); only present on changes to Product Types. + attribute_name: str + + def __init__( + self, + *, + change: str, + next_value: "AttributeLocalizedEnumValue", + field_name: str, + attribute_name: str + ): + self.next_value = next_value + self.field_name = field_name + self.attribute_name = attribute_name + + super().__init__(change=change, type="AddLocalizedEnumValueChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddLocalizedEnumValueChange": + from ._schemas.change import AddLocalizedEnumValueChangeSchema + + return AddLocalizedEnumValueChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddLocalizedEnumValueChangeSchema + + return AddLocalizedEnumValueChangeSchema().dump(self) + + +class AddLocationChange(Change): + """Change triggered by the [Add Location](ctp:api:type:ZoneAddLocationAction) update action.""" + + #: Value after the change. + next_value: "Location" + + def __init__(self, *, change: str, next_value: "Location"): + self.next_value = next_value + + super().__init__(change=change, type="AddLocationChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddLocationChange": + from ._schemas.change import AddLocationChangeSchema + + return AddLocationChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddLocationChangeSchema + + return AddLocationChangeSchema().dump(self) + + +class AddOrderLineItemChange(Change): + """Change triggered by the [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction) update action.""" + + #: Value before the change. + previous_value: "LineItem" + #: Value after the change. + next_value: "LineItem" + + def __init__( + self, *, change: str, previous_value: "LineItem", next_value: "LineItem" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddOrderLineItemChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddOrderLineItemChange": + from ._schemas.change import AddOrderLineItemChangeSchema + + return AddOrderLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddOrderLineItemChangeSchema + + return AddOrderLineItemChangeSchema().dump(self) + + +class AddParcelToDeliveryChange(Change): + """Change triggered by the following update actions: + + - [Add Parcel](ctp:api:type:OrderAddParcelToDeliveryAction) on Orders. + - [Add Parcel](ctp:api:type:StagedOrderAddParcelToDeliveryAction) on Staged Orders. + + """ + + #: Value after the change. + next_value: "Parcel" + #: `id` of the [Delivery](ctp:api:type:Delivery) to which the Parcel was added. + delivery_id: str + + def __init__(self, *, change: str, next_value: "Parcel", delivery_id: str): + self.next_value = next_value + self.delivery_id = delivery_id + + super().__init__(change=change, type="AddParcelToDeliveryChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddParcelToDeliveryChange": + from ._schemas.change import AddParcelToDeliveryChangeSchema + + return AddParcelToDeliveryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddParcelToDeliveryChangeSchema + + return AddParcelToDeliveryChangeSchema().dump(self) + + +class AddPaymentChange(Change): + """Change triggered by the following update actions: + + - [Add Payment](ctp:api:type:OrderAddPaymentAction) on Orders. + - [Add Payment](ctp:api:type:StagedOrderAddPaymentAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "PaymentInfo" + #: Value after the change. + next_value: "PaymentInfo" + + def __init__( + self, *, change: str, previous_value: "PaymentInfo", next_value: "PaymentInfo" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddPaymentChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddPaymentChange": + from ._schemas.change import AddPaymentChangeSchema + + return AddPaymentChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddPaymentChangeSchema + + return AddPaymentChangeSchema().dump(self) + + +class AddPlainEnumValueChange(Change): + """Change triggered by the [Add PlainEnumValue to AttributeDefinition](ctp:api:type:ProductTypeAddPlainEnumValueAction) update action.""" + + #: Value after the change. + next_value: "AttributePlainEnumValue" + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + + def __init__( + self, *, change: str, next_value: "AttributePlainEnumValue", attribute_name: str + ): + self.next_value = next_value + self.attribute_name = attribute_name + + super().__init__(change=change, type="AddPlainEnumValueChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddPlainEnumValueChange": + from ._schemas.change import AddPlainEnumValueChangeSchema + + return AddPlainEnumValueChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddPlainEnumValueChangeSchema + + return AddPlainEnumValueChangeSchema().dump(self) + + +class AddPriceChange(Change): + """Change triggered by the [Add Price](ctp:api:type:ProductAddPriceAction) update action.""" + + #: Value after the change. + next_value: "Price" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + #: `id` of the Embedded [Price](ctp:api:type:Price). + price_id: str + + def __init__( + self, *, change: str, next_value: "Price", catalog_data: str, price_id: str + ): + self.next_value = next_value + self.catalog_data = catalog_data + self.price_id = price_id + + super().__init__(change=change, type="AddPriceChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddPriceChange": + from ._schemas.change import AddPriceChangeSchema + + return AddPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddPriceChangeSchema + + return AddPriceChangeSchema().dump(self) + + +class AddProductChange(Change): + """Change triggered by the [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action.""" + + #: Value after the change. + next_value: "Reference" + #: The [Product Variants](ctp:api:type:ProductVariant) included in the [Product Selection](ctp:api:type:ProductSelection). + variant_selection: "ProductVariantSelection" + + def __init__( + self, + *, + change: str, + next_value: "Reference", + variant_selection: "ProductVariantSelection" + ): + self.next_value = next_value + self.variant_selection = variant_selection + + super().__init__(change=change, type="AddProductChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddProductChange": + from ._schemas.change import AddProductChangeSchema + + return AddProductChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddProductChangeSchema + + return AddProductChangeSchema().dump(self) + + +class AddProductSelectionChange(Change): + """Change triggered by the [Add Product Selection](ctp:api:type:StoreAddProductSelectionAction) update action.""" + + previous_value: "ProductSelectionSetting" + next_value: "ProductSelectionSetting" + + def __init__( + self, + *, + change: str, + previous_value: "ProductSelectionSetting", + next_value: "ProductSelectionSetting" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddProductSelectionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddProductSelectionChange": + from ._schemas.change import AddProductSelectionChangeSchema + + return AddProductSelectionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddProductSelectionChangeSchema + + return AddProductSelectionChangeSchema().dump(self) + + +class AddPropertyChange(Change): + """Change triggered by the [Update CustomObject](ctp:api:endpoint:/{projectKey}/custom-objects:POST) request when a new property is added.""" + + #: Value after the change. + next_value: typing.Any + #: Path to the new property that was added. + path: str + + def __init__(self, *, change: str, next_value: typing.Any, path: str): + self.next_value = next_value + self.path = path + + super().__init__(change=change, type="AddPropertyChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddPropertyChange": + from ._schemas.change import AddPropertyChangeSchema + + return AddPropertyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddPropertyChangeSchema + + return AddPropertyChangeSchema().dump(self) + + +class AddReturnInfoChange(Change): + """Change triggered by the following update actions: + + - [Add ReturnInfo](ctp:api:type:OrderAddReturnInfoAction) on Orders. + - [Add ReturnInfo](ctp:api:type:StagedOrderAddReturnInfoAction) on Staged Orders. + + """ + + #: Value after the change. + next_value: "ReturnInfo" + + def __init__(self, *, change: str, next_value: "ReturnInfo"): + self.next_value = next_value + + super().__init__(change=change, type="AddReturnInfoChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddReturnInfoChange": + from ._schemas.change import AddReturnInfoChangeSchema + + return AddReturnInfoChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddReturnInfoChangeSchema + + return AddReturnInfoChangeSchema().dump(self) + + +class AddShippingAddressIdChange(Change): + """Change triggered by the [Add Shipping Address ID](ctp:api:type:CustomerAddShippingAddressIdAction) update action.""" + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + #: Address added to `shippingAddressIds`. + address: "Address" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"], + address: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + self.address = address + + super().__init__(change=change, type="AddShippingAddressIdChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddShippingAddressIdChange": + from ._schemas.change import AddShippingAddressIdChangeSchema + + return AddShippingAddressIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddShippingAddressIdChangeSchema + + return AddShippingAddressIdChangeSchema().dump(self) + + +class AddShoppingListLineItemChange(Change): + """Change triggered by the [Add ShoppingListLineItem](ctp:api:type:ShoppingListAddLineItemAction) update action.""" + + #: Value before the change. + previous_value: "LineItem" + #: Value after the change. + next_value: "LineItem" + + def __init__( + self, *, change: str, previous_value: "LineItem", next_value: "LineItem" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddShoppingListLineItemChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AddShoppingListLineItemChange": + from ._schemas.change import AddShoppingListLineItemChangeSchema + + return AddShoppingListLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddShoppingListLineItemChangeSchema + + return AddShoppingListLineItemChangeSchema().dump(self) + + +class AddStateRolesChange(Change): + """Change triggered by the [Add State roles](ctp:api:type:StateAddRolesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["StateRoleEnum"] + #: Value after the change. + next_value: typing.List["StateRoleEnum"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["StateRoleEnum"], + next_value: typing.List["StateRoleEnum"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="AddStateRolesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddStateRolesChange": + from ._schemas.change import AddStateRolesChangeSchema + + return AddStateRolesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddStateRolesChangeSchema + + return AddStateRolesChangeSchema().dump(self) + + +class AddTaxRateChange(Change): + """Change triggered by the [Add TaxRate](ctp:api:type:TaxCategoryAddTaxRateAction) update action.""" + + #: Value after the change. + next_value: "TaxRate" + + def __init__(self, *, change: str, next_value: "TaxRate"): + self.next_value = next_value + + super().__init__(change=change, type="AddTaxRateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddTaxRateChange": + from ._schemas.change import AddTaxRateChangeSchema + + return AddTaxRateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddTaxRateChangeSchema + + return AddTaxRateChangeSchema().dump(self) + + +class AddTextLineItemChange(Change): + """Change triggered by the [Add TextLineItem](ctp:api:type:ShoppingListAddTextLineItemAction) update action.""" + + #: Value after the change. + next_value: "TextLineItem" + + def __init__(self, *, change: str, next_value: "TextLineItem"): + self.next_value = next_value + + super().__init__(change=change, type="AddTextLineItemChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddTextLineItemChange": + from ._schemas.change import AddTextLineItemChangeSchema + + return AddTextLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddTextLineItemChangeSchema + + return AddTextLineItemChangeSchema().dump(self) + + +class AddToCategoryChange(Change): + """Change triggered by the [Add to Category](ctp:api:type:ProductAddToCategoryAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Reference"] + #: Value after the change. + next_value: typing.List["Reference"] + #: Category to which the Product was added. + category: "Reference" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reference"], + next_value: typing.List["Reference"], + category: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + self.category = category + + super().__init__(change=change, type="AddToCategoryChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddToCategoryChange": + from ._schemas.change import AddToCategoryChangeSchema + + return AddToCategoryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddToCategoryChangeSchema + + return AddToCategoryChangeSchema().dump(self) + + +class AddTransactionChange(Change): + """Change triggered by the [Add Transaction](ctp:api:type:PaymentAddTransactionAction) update action.""" + + #: Value after the change. + next_value: "Transaction" + + def __init__(self, *, change: str, next_value: "Transaction"): + self.next_value = next_value + + super().__init__(change=change, type="AddTransactionChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddTransactionChange": + from ._schemas.change import AddTransactionChangeSchema + + return AddTransactionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddTransactionChangeSchema + + return AddTransactionChangeSchema().dump(self) + + +class AddVariantChange(Change): + """Change triggered by the [Add ProductVariant](ctp:api:type:ProductAddVariantAction) update action.""" + + #: Value before the change. + previous_value: "Variant" + #: Value after the change. + next_value: "Variant" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "Variant", + next_value: "Variant", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="AddVariantChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AddVariantChange": + from ._schemas.change import AddVariantChangeSchema + + return AddVariantChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import AddVariantChangeSchema + + return AddVariantChangeSchema().dump(self) + + +class ChangeAddressChange(Change): + """Change triggered by the [Change Address](ctp:api:type:CustomerChangeAddressAction) update action.""" + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeAddressChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeAddressChange": + from ._schemas.change import ChangeAddressChangeSchema + + return ChangeAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAddressChangeSchema + + return ChangeAddressChangeSchema().dump(self) + + +class ChangeAmountAuthorizedChange(Change): + """Change triggered automatically due to a user-initiated change.""" + + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + + def __init__(self, *, change: str, previous_value: "Money", next_value: "Money"): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeAmountAuthorizedChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeAmountAuthorizedChange": + from ._schemas.change import ChangeAmountAuthorizedChangeSchema + + return ChangeAmountAuthorizedChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAmountAuthorizedChangeSchema + + return ChangeAmountAuthorizedChangeSchema().dump(self) + + +class ChangeAmountPlannedChange(Change): + """Change triggered by the [Change AmountPlanned](ctp:api:type:PaymentChangeAmountPlannedAction) update action.""" + + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + + def __init__(self, *, change: str, previous_value: "Money", next_value: "Money"): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeAmountPlannedChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeAmountPlannedChange": + from ._schemas.change import ChangeAmountPlannedChangeSchema + + return ChangeAmountPlannedChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAmountPlannedChangeSchema + + return ChangeAmountPlannedChangeSchema().dump(self) + + +class ChangeAssetNameChange(Change): + """Change triggered by the following update actions: + + - [Change Asset Name](ctp:api:type:CategoryChangeAssetNameAction) on Categories. + - [Change Asset Name](ctp:api:type:ProductChangeAssetNameAction) on Products. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Information about the updated Asset. + asset: "AssetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + asset: "AssetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.asset = asset + + super().__init__(change=change, type="ChangeAssetNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeAssetNameChange": + from ._schemas.change import ChangeAssetNameChangeSchema + + return ChangeAssetNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAssetNameChangeSchema + + return ChangeAssetNameChangeSchema().dump(self) + + +class ChangeAssetOrderChange(Change): + """Change triggered by the following update actions: + + - [Change Asset Order](ctp:api:type:CategoryChangeAssetOrderAction) on Categories. + - [Change Asset Order](ctp:api:type:ProductChangeAssetOrderAction) on Products. + + """ + + #: Value before the change. + previous_value: typing.List["LocalizedString"] + #: Value after the change. + next_value: typing.List["LocalizedString"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["LocalizedString"], + next_value: typing.List["LocalizedString"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeAssetOrderChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeAssetOrderChange": + from ._schemas.change import ChangeAssetOrderChangeSchema + + return ChangeAssetOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAssetOrderChangeSchema + + return ChangeAssetOrderChangeSchema().dump(self) + + +class ChangeAssociateChange(Change): + """Change triggered by the [Change Associate](ctp:api:type:BusinessUnitChangeAssociateAction) update action.""" + + #: Value before the change. + previous_value: "Associate" + #: Value after the change. + next_value: "Associate" + + def __init__( + self, *, change: str, previous_value: "Associate", next_value: "Associate" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeAssociateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeAssociateChange": + from ._schemas.change import ChangeAssociateChangeSchema + + return ChangeAssociateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAssociateChangeSchema + + return ChangeAssociateChangeSchema().dump(self) + + +class ChangeAssociateModeChange(Change): + """Change triggered by the [Change Associate Mode](ctp:api:type:BusinessUnitChangeAssociateModeAction) update action.""" + + #: Value before the change. + previous_value: "BusinessUnitAssociateMode" + #: Value after the change. + next_value: "BusinessUnitAssociateMode" + + def __init__( + self, + *, + change: str, + previous_value: "BusinessUnitAssociateMode", + next_value: "BusinessUnitAssociateMode" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeAssociateModeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeAssociateModeChange": + from ._schemas.change import ChangeAssociateModeChangeSchema + + return ChangeAssociateModeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAssociateModeChangeSchema + + return ChangeAssociateModeChangeSchema().dump(self) + + +class ChangeAttributeConstraintChange(Change): + """Change triggered by the [Change AttributeDefinition AttributeConstraint](ctp:api:type:ProductTypeChangeAttributeConstraintAction) update action.""" + + #: Value before the change. + previous_value: "AttributeConstraintEnum" + #: Value after the change. + next_value: "AttributeConstraintEnum" + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + + def __init__( + self, + *, + change: str, + previous_value: "AttributeConstraintEnum", + next_value: "AttributeConstraintEnum", + attribute_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.attribute_name = attribute_name + + super().__init__(change=change, type="ChangeAttributeConstraintChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeAttributeConstraintChange": + from ._schemas.change import ChangeAttributeConstraintChangeSchema + + return ChangeAttributeConstraintChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAttributeConstraintChangeSchema + + return ChangeAttributeConstraintChangeSchema().dump(self) + + +class ChangeAttributeOrderByNameChange(Change): + """Change triggered by the [Change the order of AttributeDefinitions](ctp:api:type:ProductTypeChangeAttributeOrderByNameAction) update action.""" + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeAttributeOrderByNameChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeAttributeOrderByNameChange": + from ._schemas.change import ChangeAttributeOrderByNameChangeSchema + + return ChangeAttributeOrderByNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeAttributeOrderByNameChangeSchema + + return ChangeAttributeOrderByNameChangeSchema().dump(self) + + +class ChangeBuyerAssignableChange(Change): + """Change triggered by the [Change BuyerAssignable](ctp:api:type:AssociateRoleChangeBuyerAssignableAction) update action.""" + + #: Value before the change. + previous_value: bool + #: Value after the change. + next_value: bool + + def __init__(self, *, change: str, previous_value: bool, next_value: bool): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeBuyerAssignableChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeBuyerAssignableChange": + from ._schemas.change import ChangeBuyerAssignableChangeSchema + + return ChangeBuyerAssignableChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeBuyerAssignableChangeSchema + + return ChangeBuyerAssignableChangeSchema().dump(self) + + +class ChangeCartDiscountsChange(Change): + """Change triggered by the [Change CartDiscounts](ctp:api:type:DiscountCodeChangeCartDiscountsAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Reference"] + #: Value after the change. + next_value: typing.List["Reference"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reference"], + next_value: typing.List["Reference"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeCartDiscountsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeCartDiscountsChange": + from ._schemas.change import ChangeCartDiscountsChangeSchema + + return ChangeCartDiscountsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeCartDiscountsChangeSchema + + return ChangeCartDiscountsChangeSchema().dump(self) + + +class ChangeCartPredicateChange(Change): + """Change triggered by the [Change Cart Predicate](ctp:api:type:CartDiscountChangeCartPredicateAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeCartPredicateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeCartPredicateChange": + from ._schemas.change import ChangeCartPredicateChangeSchema + + return ChangeCartPredicateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeCartPredicateChangeSchema + + return ChangeCartPredicateChangeSchema().dump(self) + + +class ChangeCustomLineItemQuantityChange(Change): + """Change triggered by the [Change CustomLineItem Quantity](ctp:api:type:StagedOrderChangeCustomLineItemQuantityAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + #: Name of the CustomLineItem. + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: int, + next_value: int, + custom_line_item: "LocalizedString", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="ChangeCustomLineItemQuantityChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeCustomLineItemQuantityChange": + from ._schemas.change import ChangeCustomLineItemQuantityChangeSchema + + return ChangeCustomLineItemQuantityChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeCustomLineItemQuantityChangeSchema + + return ChangeCustomLineItemQuantityChangeSchema().dump(self) + + +class ChangeDescriptionChange(Change): + """Change triggered by the [Change Description](ctp:api:type:ProductTypeChangeDescriptionAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeDescriptionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeDescriptionChange": + from ._schemas.change import ChangeDescriptionChangeSchema + + return ChangeDescriptionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeDescriptionChangeSchema + + return ChangeDescriptionChangeSchema().dump(self) + + +class ChangeEmailChange(Change): + """Change triggered by the [Change Email](ctp:api:type:CustomerChangeEmailAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeEmailChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeEmailChange": + from ._schemas.change import ChangeEmailChangeSchema + + return ChangeEmailChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeEmailChangeSchema + + return ChangeEmailChangeSchema().dump(self) + + +class ChangeEnumValueLabelChange(Change): + """Change triggered by the [Change EnumValue Label](ctp:api:type:TypeChangeEnumValueLabelAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition). + field_name: str + #: Key of the updated values. + value_key: str + + def __init__( + self, + *, + change: str, + previous_value: str, + next_value: str, + field_name: str, + value_key: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.field_name = field_name + self.value_key = value_key + + super().__init__(change=change, type="ChangeEnumValueLabelChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeEnumValueLabelChange": + from ._schemas.change import ChangeEnumValueLabelChangeSchema + + return ChangeEnumValueLabelChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeEnumValueLabelChangeSchema + + return ChangeEnumValueLabelChangeSchema().dump(self) + + +class ChangeEnumValueOrderChange(Change): + """Change triggered by the [Change the order of EnumValues](ctp:api:type:TypeChangeEnumValueOrderAction) update action.""" + + #: Value before the change. + previous_value: typing.List["EnumValue"] + #: Value after the change. + next_value: typing.List["EnumValue"] + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition). + field_name: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["EnumValue"], + next_value: typing.List["EnumValue"], + field_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.field_name = field_name + + super().__init__(change=change, type="ChangeEnumValueOrderChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeEnumValueOrderChange": + from ._schemas.change import ChangeEnumValueOrderChangeSchema + + return ChangeEnumValueOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeEnumValueOrderChangeSchema + + return ChangeEnumValueOrderChangeSchema().dump(self) + + +class ChangeFieldDefinitionOrderChange(Change): + """Change triggered by the [Change the order of FieldDefinitions](ctp:api:type:TypeChangeFieldDefinitionOrderAction) update action.""" + + #: Value before the change. + previous_value: typing.List["FieldDefinitionOrderValue"] + #: Value after the change. + next_value: typing.List["FieldDefinitionOrderValue"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["FieldDefinitionOrderValue"], + next_value: typing.List["FieldDefinitionOrderValue"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeFieldDefinitionOrderChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeFieldDefinitionOrderChange": + from ._schemas.change import ChangeFieldDefinitionOrderChangeSchema + + return ChangeFieldDefinitionOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeFieldDefinitionOrderChangeSchema + + return ChangeFieldDefinitionOrderChangeSchema().dump(self) + + +class ChangeGroupsChange(Change): + """Change triggered by the [Change Groups](ctp:api:type:DiscountCodeChangeGroupsAction) update action.""" + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeGroupsChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeGroupsChange": + from ._schemas.change import ChangeGroupsChangeSchema + + return ChangeGroupsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeGroupsChangeSchema + + return ChangeGroupsChangeSchema().dump(self) + + +class ChangeInheritedAssociateChange(Change): + """Change triggered by the [Change Associate](ctp:api:type:BusinessUnitChangeAssociateAction) update action on a parent of a Business Unit in cases where [inheritance applies](/../api/associates-overview#conditions-for-inheritance).""" + + #: Value before the change. + previous_value: "InheritedAssociate" + #: Value after the change. + next_value: "InheritedAssociate" + + def __init__( + self, + *, + change: str, + previous_value: "InheritedAssociate", + next_value: "InheritedAssociate" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeInheritedAssociateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeInheritedAssociateChange": + from ._schemas.change import ChangeInheritedAssociateChangeSchema + + return ChangeInheritedAssociateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeInheritedAssociateChangeSchema + + return ChangeInheritedAssociateChangeSchema().dump(self) + + +class ChangeInitialChange(Change): + """Change triggered by the [Change initial State](ctp:api:type:StateChangeInitialAction) update action.""" + + #: Value before the change. + previous_value: bool + #: Value after the change. + next_value: bool + + def __init__(self, *, change: str, previous_value: bool, next_value: bool): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeInitialChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeInitialChange": + from ._schemas.change import ChangeInitialChangeSchema + + return ChangeInitialChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeInitialChangeSchema + + return ChangeInitialChangeSchema().dump(self) + + +class ChangeInputHintChange(Change): + """Change triggered by the following update actions: + + - [Change AttributeDefinition InputHint](ctp:api:type:ProductTypeChangeInputHintAction) on Product Types. + - [Change InputHint](ctp:api:type:TypeChangeInputHintAction) on Types. + + """ + + #: Value before the change. + previous_value: "TextInputHint" + #: Value after the change. + next_value: "TextInputHint" + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition); only present on changes to Types. + field_name: str + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition); only present on changes to Product Types. + attribute_name: str + + def __init__( + self, + *, + change: str, + previous_value: "TextInputHint", + next_value: "TextInputHint", + field_name: str, + attribute_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.field_name = field_name + self.attribute_name = attribute_name + + super().__init__(change=change, type="ChangeInputHintChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeInputHintChange": + from ._schemas.change import ChangeInputHintChangeSchema + + return ChangeInputHintChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeInputHintChangeSchema + + return ChangeInputHintChangeSchema().dump(self) + + +class ChangeIsActiveChange(Change): + """Change triggered by the following update actions: + + - [Change IsActive](ctp:api:type:CartDiscountChangeIsActiveAction) on Cart Discounts. + - [Change IsActive](ctp:api:type:DiscountCodeChangeIsActiveAction) on Discount Codes. + - [Change IsActive](ctp:api:type:ProductDiscountChangeIsActiveAction) on Product Discounts. + + """ + + #: Value before the change. + previous_value: bool + #: Value after the change. + next_value: bool + + def __init__(self, *, change: str, previous_value: bool, next_value: bool): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeIsActiveChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeIsActiveChange": + from ._schemas.change import ChangeIsActiveChangeSchema + + return ChangeIsActiveChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeIsActiveChangeSchema + + return ChangeIsActiveChangeSchema().dump(self) + + +class ChangeIsSearchableChange(Change): + """Change triggered by the [Change AttributeDefinition IsSearchable](ctp:api:type:ProductTypeChangeIsSearchableAction) update action.""" + + #: Value before the change. + previous_value: bool + #: Value after the change. + next_value: bool + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + + def __init__( + self, + *, + change: str, + previous_value: bool, + next_value: bool, + attribute_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.attribute_name = attribute_name + + super().__init__(change=change, type="ChangeIsSearchableChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeIsSearchableChange": + from ._schemas.change import ChangeIsSearchableChangeSchema + + return ChangeIsSearchableChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeIsSearchableChangeSchema + + return ChangeIsSearchableChangeSchema().dump(self) + + +class ChangeKeyChange(Change): + """Change triggered by the following update actions: + + - [Change Key](ctp:api:type:ChannelChangeKeyAction) on Channels. + - [Change State key](ctp:api:type:StateChangeKeyAction) on States. + - [Change Key](ctp:api:type:TypeChangeKeyAction) on Types. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeKeyChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeKeyChange": + from ._schemas.change import ChangeKeyChangeSchema + + return ChangeKeyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeKeyChangeSchema + + return ChangeKeyChangeSchema().dump(self) + + +class ChangeLabelChange(Change): + """Change triggered by the following update actions: + + - [Change AttributeDefinition Label](ctp:api:type:ProductTypeChangeLabelAction) on Product Types. + - [Change FieldDefinition Label](ctp:api:type:TypeChangeLabelAction) on Types. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition); only present on changes to Types). + field_name: str + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition); only present on changes to Product Types. + attribute_name: str + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + field_name: str, + attribute_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.field_name = field_name + self.attribute_name = attribute_name + + super().__init__(change=change, type="ChangeLabelChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeLabelChange": + from ._schemas.change import ChangeLabelChangeSchema + + return ChangeLabelChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeLabelChangeSchema + + return ChangeLabelChangeSchema().dump(self) + + +class ChangeLineItemQuantityChange(Change): + """Change triggered by the [Change LineItem Quantity](ctp:api:type:StagedOrderChangeLineItemQuantityAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change + next_value: int + #: Name of the [Product](ctp:api:type:Product) the updated Line Item is based on. + line_item: "LocalizedString" + #: `id` of the updated [LineItem](ctp:api:type:LineItem). + line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: int, + next_value: int, + line_item: "LocalizedString", + line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.line_item_id = line_item_id + + super().__init__(change=change, type="ChangeLineItemQuantityChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeLineItemQuantityChange": + from ._schemas.change import ChangeLineItemQuantityChangeSchema + + return ChangeLineItemQuantityChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeLineItemQuantityChangeSchema + + return ChangeLineItemQuantityChangeSchema().dump(self) + + +class ChangeLocalizedDescriptionChange(Change): + """Change triggered by the [Change Description](ctp:api:type:ChannelChangeDescriptionAction) update action.""" + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeLocalizedDescriptionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeLocalizedDescriptionChange": + from ._schemas.change import ChangeLocalizedDescriptionChangeSchema + + return ChangeLocalizedDescriptionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeLocalizedDescriptionChangeSchema + + return ChangeLocalizedDescriptionChangeSchema().dump(self) + + +class ChangeLocalizedEnumValueLabelChange(Change): + """Change triggered by the following update actions: + + - [Change the label of a LocalizedEnumValue](ctp:api:type:ProductTypeChangeLocalizedEnumValueLabelAction) on Product Types. + - [Change LocalizedEnumValue Label](ctp:api:type:TypeChangeLocalizedEnumValueLabelAction) on Types. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition); only present on changes to Types. + field_name: str + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition); only present on changes to Product Types. + attribute_name: str + #: Key of the updated values. + value_key: str + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + field_name: str, + attribute_name: str, + value_key: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.field_name = field_name + self.attribute_name = attribute_name + self.value_key = value_key + + super().__init__(change=change, type="ChangeLocalizedEnumValueLabelChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeLocalizedEnumValueLabelChange": + from ._schemas.change import ChangeLocalizedEnumValueLabelChangeSchema + + return ChangeLocalizedEnumValueLabelChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeLocalizedEnumValueLabelChangeSchema + + return ChangeLocalizedEnumValueLabelChangeSchema().dump(self) + + +class ChangeLocalizedEnumValueOrderChange(Change): + """Change triggered by the following update actions: + + - [Change the order of LocalizedEnumValues](ctp:api:type:ProductTypeChangeLocalizedEnumValueOrderAction) on Product Types. + - [Change the order of LocalizedEnumValues](ctp:api:type:TypeChangeLocalizedEnumValueOrderAction) on Types. + + """ + + #: Value before the change. + previous_value: typing.List["LocalizedEnumValue"] + #: Value after the change. + next_value: typing.List["LocalizedEnumValue"] + #: Name of the updated [FieldDefinition](ctp:api:type:FieldDefinition); only present on changes to Types. + field_name: str + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition); only present on changes to Product Types. + attribute_name: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["LocalizedEnumValue"], + next_value: typing.List["LocalizedEnumValue"], + field_name: str, + attribute_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.field_name = field_name + self.attribute_name = attribute_name + + super().__init__(change=change, type="ChangeLocalizedEnumValueOrderChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeLocalizedEnumValueOrderChange": + from ._schemas.change import ChangeLocalizedEnumValueOrderChangeSchema + + return ChangeLocalizedEnumValueOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeLocalizedEnumValueOrderChangeSchema + + return ChangeLocalizedEnumValueOrderChangeSchema().dump(self) + + +class ChangeLocalizedNameChange(Change): + """Change triggered by the following update actions: + + - [Change Name](ctp:api:type:CartDiscountChangeNameAction) on Cart Discounts. + - [Change Name](ctp:api:type:CategoryChangeNameAction) on Categories. + - [Change Name](ctp:api:type:ChannelChangeNameAction) on Channels. + - [Change Name](ctp:api:type:ProductChangeNameAction) on Products. + - [Change Name](ctp:api:type:ProductDiscountChangeNameAction) on Product Discounts. + - [Change Name](ctp:api:type:ProductSelectionChangeNameAction) on Product Selections. + - [Change Name](ctp:api:type:ShoppingListChangeNameAction) on Shopping Lists. + - [Change Name](ctp:api:type:ZoneChangeNameAction) on Zones. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeLocalizedNameChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeLocalizedNameChange": + from ._schemas.change import ChangeLocalizedNameChangeSchema + + return ChangeLocalizedNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeLocalizedNameChangeSchema + + return ChangeLocalizedNameChangeSchema().dump(self) + + +class ChangeMasterVariantChange(Change): + """Change triggered by the [Change Master Variant](ctp:api:type:ProductChangeMasterVariantAction) update action.""" + + #: Value before the change. + previous_value: "Variant" + #: Value after the change. + next_value: "Variant" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "Variant", + next_value: "Variant", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="ChangeMasterVariantChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeMasterVariantChange": + from ._schemas.change import ChangeMasterVariantChangeSchema + + return ChangeMasterVariantChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeMasterVariantChangeSchema + + return ChangeMasterVariantChangeSchema().dump(self) + + +class ChangeNameChange(Change): + """Change triggered by the following update actions: + + - [Change Name](ctp:api:type:CustomerGroupChangeNameAction) on Customer Groups. + - [Change Name](ctp:api:type:ProductTypeChangeNameAction) on Product Types. + - [Change Name](ctp:api:type:TaxCategoryChangeNameAction) on Tax Categories. + - [Change Name](ctp:api:type:ZoneChangeNameAction) on Zones. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeNameChange": + from ._schemas.change import ChangeNameChangeSchema + + return ChangeNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeNameChangeSchema + + return ChangeNameChangeSchema().dump(self) + + +class ChangeOrderHintChange(Change): + """Change triggered by the [Change OrderHint](ctp:api:type:CategoryChangeOrderHintAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeOrderHintChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeOrderHintChange": + from ._schemas.change import ChangeOrderHintChangeSchema + + return ChangeOrderHintChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeOrderHintChangeSchema + + return ChangeOrderHintChangeSchema().dump(self) + + +class ChangeOrderStateChange(Change): + """Change triggered by the following update actions: + + - [Change OrderState](ctp:api:type:OrderChangeOrderStateAction) on Orders. + - [Change OrderState](ctp:api:type:StagedOrderChangeOrderStateAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "OrderState" + #: Value after the change. + next_value: "OrderState" + + def __init__( + self, *, change: str, previous_value: "OrderState", next_value: "OrderState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeOrderStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeOrderStateChange": + from ._schemas.change import ChangeOrderStateChangeSchema + + return ChangeOrderStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeOrderStateChangeSchema + + return ChangeOrderStateChangeSchema().dump(self) + + +class ChangeParentChange(Change): + """Change triggered by the [Change Parent](ctp:api:type:CategoryChangeParentAction) update action.""" + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeParentChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeParentChange": + from ._schemas.change import ChangeParentChangeSchema + + return ChangeParentChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeParentChangeSchema + + return ChangeParentChangeSchema().dump(self) + + +class ChangeParentUnitChange(Change): + """Change triggered by the [Change Parent Unit](ctp:api:type:BusinessUnitChangeParentUnitAction) update action.""" + + #: Value before the change. + previous_value: "KeyReference" + #: Value after the change. + next_value: "KeyReference" + + def __init__( + self, *, change: str, previous_value: "KeyReference", next_value: "KeyReference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeParentUnitChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeParentUnitChange": + from ._schemas.change import ChangeParentUnitChangeSchema + + return ChangeParentUnitChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeParentUnitChangeSchema + + return ChangeParentUnitChangeSchema().dump(self) + + +class ChangePaymentStateChange(Change): + """Change triggered by the following update actions: + + - [Change PaymentState](ctp:api:type:OrderChangePaymentStateAction) on Orders. + - [Change PaymentState](ctp:api:type:StagedOrderChangePaymentStateAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "PaymentState" + #: Value after the change. + next_value: "PaymentState" + + def __init__( + self, *, change: str, previous_value: "PaymentState", next_value: "PaymentState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangePaymentStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangePaymentStateChange": + from ._schemas.change import ChangePaymentStateChangeSchema + + return ChangePaymentStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangePaymentStateChangeSchema + + return ChangePaymentStateChangeSchema().dump(self) + + +class ChangePlainEnumValueLabelChange(Change): + """Change triggered by the [Change the label of an EnumValue](ctp:api:type:ProductTypeChangePlainEnumValueLabelAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + #: Key of the updated values. + value_key: str + + def __init__( + self, + *, + change: str, + previous_value: str, + next_value: str, + attribute_name: str, + value_key: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.attribute_name = attribute_name + self.value_key = value_key + + super().__init__(change=change, type="ChangePlainEnumValueLabelChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangePlainEnumValueLabelChange": + from ._schemas.change import ChangePlainEnumValueLabelChangeSchema + + return ChangePlainEnumValueLabelChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangePlainEnumValueLabelChangeSchema + + return ChangePlainEnumValueLabelChangeSchema().dump(self) + + +class ChangePlainEnumValueOrderChange(Change): + """Change triggered by the [Change the order of EnumValues](ctp:api:type:ProductTypeChangePlainEnumValueOrderAction) update action.""" + + #: Value before the change. + previous_value: typing.List["EnumValue"] + #: Value after the change. + next_value: typing.List["EnumValue"] + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["EnumValue"], + next_value: typing.List["EnumValue"], + attribute_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.attribute_name = attribute_name + + super().__init__(change=change, type="ChangePlainEnumValueOrderChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangePlainEnumValueOrderChange": + from ._schemas.change import ChangePlainEnumValueOrderChangeSchema + + return ChangePlainEnumValueOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangePlainEnumValueOrderChangeSchema + + return ChangePlainEnumValueOrderChangeSchema().dump(self) + + +class ChangePredicateChange(Change): + """Change triggered by the [Change Predicate](ctp:api:type:ProductDiscountChangePredicateAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangePredicateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangePredicateChange": + from ._schemas.change import ChangePredicateChangeSchema + + return ChangePredicateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangePredicateChangeSchema + + return ChangePredicateChangeSchema().dump(self) + + +class ChangePriceChange(Change): + """Change triggered by the [Change Price](ctp:api:type:ProductChangePriceAction) update action.""" + + #: Value before the change. + previous_value: "Price" + #: Value after the change. + next_value: "Price" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + #: `id` of the Embedded [Price](ctp:api:type:Price). + price_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Price", + next_value: "Price", + catalog_data: str, + price_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + self.price_id = price_id + + super().__init__(change=change, type="ChangePriceChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangePriceChange": + from ._schemas.change import ChangePriceChangeSchema + + return ChangePriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangePriceChangeSchema + + return ChangePriceChangeSchema().dump(self) + + +class ChangeProductSelectionActiveChange(Change): + """Change triggered by the [Change Product Selection Active](ctp:api:type:StoreChangeProductSelectionAction) update action.""" + + #: Reference to the Product Selection which was changed. + product_selection: "Reference" + #: Value before the change. + previous_value: bool + #: Value after the change. + next_value: bool + + def __init__( + self, + *, + change: str, + product_selection: "Reference", + previous_value: bool, + next_value: bool + ): + self.product_selection = product_selection + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeProductSelectionActiveChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeProductSelectionActiveChange": + from ._schemas.change import ChangeProductSelectionActiveChangeSchema + + return ChangeProductSelectionActiveChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeProductSelectionActiveChangeSchema + + return ChangeProductSelectionActiveChangeSchema().dump(self) + + +class ChangeQuantityChange(Change): + """Change triggered by the [Change Quantity](ctp:api:type:InventoryEntryChangeQuantityAction) update action.""" + + #: Value before the change. + previous_value: "InventoryQuantityValue" + #: Value after the change. + next_value: "InventoryQuantityValue" + + def __init__( + self, + *, + change: str, + previous_value: "InventoryQuantityValue", + next_value: "InventoryQuantityValue" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeQuantityChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeQuantityChange": + from ._schemas.change import ChangeQuantityChangeSchema + + return ChangeQuantityChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeQuantityChangeSchema + + return ChangeQuantityChangeSchema().dump(self) + + +class ChangeQuoteRequestStateChange(Change): + """Change triggered by the [Change Quote Request State](ctp:api:type:QuoteRequestChangeQuoteRequestStateAction) update action.""" + + #: Value before the change. + previous_value: "QuoteRequestState" + #: Value after the change. + next_value: "QuoteRequestState" + + def __init__( + self, + *, + change: str, + previous_value: "QuoteRequestState", + next_value: "QuoteRequestState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeQuoteRequestStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeQuoteRequestStateChange": + from ._schemas.change import ChangeQuoteRequestStateChangeSchema + + return ChangeQuoteRequestStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeQuoteRequestStateChangeSchema + + return ChangeQuoteRequestStateChangeSchema().dump(self) + + +class ChangeQuoteStateChange(Change): + """Change triggered by the [Change Quote State](ctp:api:type:QuoteChangeQuoteStateAction) update action.""" + + #: Value before the change. + previous_value: "QuoteState" + #: Value after the change. + next_value: "QuoteState" + + def __init__( + self, *, change: str, previous_value: "QuoteState", next_value: "QuoteState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeQuoteStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeQuoteStateChange": + from ._schemas.change import ChangeQuoteStateChangeSchema + + return ChangeQuoteStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeQuoteStateChangeSchema + + return ChangeQuoteStateChangeSchema().dump(self) + + +class ChangeRequiresDiscountCodeChange(Change): + """Change triggered by the [Change Requires DiscountCode](ctp:api:type:CartDiscountChangeRequiresDiscountCodeAction) update action.""" + + #: Value before the change. + previous_value: bool + #: Value after the change. + next_value: bool + + def __init__(self, *, change: str, previous_value: bool, next_value: bool): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeRequiresDiscountCodeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeRequiresDiscountCodeChange": + from ._schemas.change import ChangeRequiresDiscountCodeChangeSchema + + return ChangeRequiresDiscountCodeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeRequiresDiscountCodeChangeSchema + + return ChangeRequiresDiscountCodeChangeSchema().dump(self) + + +class ChangeReviewRatingStatisticsChange(Change): + #: Value before the change. + previous_value: "ReviewRatingStatistics" + #: Value after the change. + next_value: "ReviewRatingStatistics" + + def __init__( + self, + *, + change: str, + previous_value: "ReviewRatingStatistics", + next_value: "ReviewRatingStatistics" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeReviewRatingStatisticsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeReviewRatingStatisticsChange": + from ._schemas.change import ChangeReviewRatingStatisticsChangeSchema + + return ChangeReviewRatingStatisticsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeReviewRatingStatisticsChangeSchema + + return ChangeReviewRatingStatisticsChangeSchema().dump(self) + + +class ChangeShipmentStateChange(Change): + """Change triggered by the following update actions: + + - [Change ShipmentState](ctp:api:type:OrderChangeShipmentStateAction) on Orders. + - [Change ShipmentState](ctp:api:type:StagedOrderChangeShipmentStateAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "ShipmentState" + #: Value after the change. + next_value: "ShipmentState" + + def __init__( + self, + *, + change: str, + previous_value: "ShipmentState", + next_value: "ShipmentState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeShipmentStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeShipmentStateChange": + from ._schemas.change import ChangeShipmentStateChangeSchema + + return ChangeShipmentStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeShipmentStateChangeSchema + + return ChangeShipmentStateChangeSchema().dump(self) + + +class ChangeShoppingListLineItemQuantityChange(Change): + """Change triggered by the [Change ShoppingListLineItem Quantity](ctp:api:type:ShoppingListChangeLineItemQuantityAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + #: Holds information about the updated Shopping List Line Item. + line_item: "ShoppingListLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: int, + next_value: int, + line_item: "ShoppingListLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + + super().__init__(change=change, type="ChangeShoppingListLineItemQuantityChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeShoppingListLineItemQuantityChange": + from ._schemas.change import ChangeShoppingListLineItemQuantityChangeSchema + + return ChangeShoppingListLineItemQuantityChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeShoppingListLineItemQuantityChangeSchema + + return ChangeShoppingListLineItemQuantityChangeSchema().dump(self) + + +class ChangeShoppingListLineItemsOrderChange(Change): + """Change triggered by the [Change ShoppingListLineItems Order](ctp:api:type:ShoppingListChangeLineItemsOrderAction) update action.""" + + #: Value before the change. + previous_value: typing.List["ShoppingListLineItemValue"] + #: Value after the change. + next_value: typing.List["ShoppingListLineItemValue"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["ShoppingListLineItemValue"], + next_value: typing.List["ShoppingListLineItemValue"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeShoppingListLineItemsOrderChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeShoppingListLineItemsOrderChange": + from ._schemas.change import ChangeShoppingListLineItemsOrderChangeSchema + + return ChangeShoppingListLineItemsOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeShoppingListLineItemsOrderChangeSchema + + return ChangeShoppingListLineItemsOrderChangeSchema().dump(self) + + +class ChangeSlugChange(Change): + """Change triggered by the following update actions: + + - [Change Slug](ctp:api:type:CategoryChangeSlugAction) on Categories. + - [Change Slug](ctp:api:type:ProductChangeSlugAction) on Products. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeSlugChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeSlugChange": + from ._schemas.change import ChangeSlugChangeSchema + + return ChangeSlugChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeSlugChangeSchema + + return ChangeSlugChangeSchema().dump(self) + + +class ChangeSortOrderChange(Change): + """Change triggered by the following update actions: + + - [Change Sort Order](ctp:api:type:CartDiscountChangeSortOrderAction) on Cart Discounts. + - [Change Sort Order](ctp:api:type:ProductDiscountChangeSortOrderAction) on Product Discounts. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeSortOrderChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeSortOrderChange": + from ._schemas.change import ChangeSortOrderChangeSchema + + return ChangeSortOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeSortOrderChangeSchema + + return ChangeSortOrderChangeSchema().dump(self) + + +class ChangeStackingModeChange(Change): + """Change triggered by the [Change Stacking Mode](ctp:api:type:CartDiscountChangeStackingModeAction) update action.""" + + #: Value before the change. + previous_value: "StackingMode" + #: Value after the change. + next_value: "StackingMode" + + def __init__( + self, *, change: str, previous_value: "StackingMode", next_value: "StackingMode" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeStackingModeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeStackingModeChange": + from ._schemas.change import ChangeStackingModeChangeSchema + + return ChangeStackingModeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeStackingModeChangeSchema + + return ChangeStackingModeChangeSchema().dump(self) + + +class ChangeStagedQuoteStateChange(Change): + """Change triggered by the [ChangeStagedQuoteState](ctp:api:type:StagedQuoteChangeStagedQuoteStateAction) update action.""" + + #: Value before the change. + previous_value: "StagedQuoteState" + #: Value after the change. + next_value: "StagedQuoteState" + + def __init__( + self, + *, + change: str, + previous_value: "StagedQuoteState", + next_value: "StagedQuoteState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeStagedQuoteStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeStagedQuoteStateChange": + from ._schemas.change import ChangeStagedQuoteStateChangeSchema + + return ChangeStagedQuoteStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeStagedQuoteStateChangeSchema + + return ChangeStagedQuoteStateChangeSchema().dump(self) + + +class ChangeStateTypeChange(Change): + """Change triggered by the [Change State Type](ctp:api:type:StateChangeTypeAction) update action.""" + + #: Value before the change. + previous_value: "StateTypeEnum" + #: Value after the change. + next_value: "StateTypeEnum" + + def __init__( + self, + *, + change: str, + previous_value: "StateTypeEnum", + next_value: "StateTypeEnum" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeStateTypeChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeStateTypeChange": + from ._schemas.change import ChangeStateTypeChangeSchema + + return ChangeStateTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeStateTypeChangeSchema + + return ChangeStateTypeChangeSchema().dump(self) + + +class ChangeStatusChange(Change): + """Change triggered by the [Change Status](ctp:api:type:BusinessUnitChangeStatusAction) update action.""" + + #: Value before the change. + previous_value: "BusinessUnitStatus" + #: Value after the change. + next_value: "BusinessUnitStatus" + + def __init__( + self, + *, + change: str, + previous_value: "BusinessUnitStatus", + next_value: "BusinessUnitStatus" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeStatusChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeStatusChange": + from ._schemas.change import ChangeStatusChangeSchema + + return ChangeStatusChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeStatusChangeSchema + + return ChangeStatusChangeSchema().dump(self) + + +class ChangeTargetChange(Change): + """Change triggered by the [Change Target](ctp:api:type:CartDiscountChangeTargetAction) update action.""" + + #: Value before the change. + previous_value: "ChangeTargetChangeValue" + #: Value after the change. + next_value: "ChangeTargetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "ChangeTargetChangeValue", + next_value: "ChangeTargetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeTargetChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeTargetChange": + from ._schemas.change import ChangeTargetChangeSchema + + return ChangeTargetChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTargetChangeSchema + + return ChangeTargetChangeSchema().dump(self) + + +class ChangeTaxCalculationModeChange(Change): + """Change triggered by the [Change TaxCalculationMode](ctp:api:type:StagedOrderChangeTaxCalculationModeAction) update action.""" + + #: Value before the change. + previous_value: "TaxCalculationMode" + #: Value after the change. + next_value: "TaxCalculationMode" + + def __init__( + self, + *, + change: str, + previous_value: "TaxCalculationMode", + next_value: "TaxCalculationMode" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeTaxCalculationModeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTaxCalculationModeChange": + from ._schemas.change import ChangeTaxCalculationModeChangeSchema + + return ChangeTaxCalculationModeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTaxCalculationModeChangeSchema + + return ChangeTaxCalculationModeChangeSchema().dump(self) + + +class ChangeTaxModeChange(Change): + """Change triggered by the [Change TaxMode](ctp:api:type:StagedOrderChangeTaxModeAction) update action.""" + + #: Value before the change. + previous_value: "TaxMode" + #: Value after the change. + next_value: "TaxMode" + + def __init__( + self, *, change: str, previous_value: "TaxMode", next_value: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeTaxModeChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeTaxModeChange": + from ._schemas.change import ChangeTaxModeChangeSchema + + return ChangeTaxModeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTaxModeChangeSchema + + return ChangeTaxModeChangeSchema().dump(self) + + +class ChangeTaxRoundingModeChange(Change): + """Change triggered by the [Change Tax RoundingMode](ctp:api:type:StagedOrderChangeTaxRoundingModeAction) update action.""" + + #: Value before the change. + previous_value: "RoundingMode" + #: Value after the change. + next_value: "RoundingMode" + + def __init__( + self, *, change: str, previous_value: "RoundingMode", next_value: "RoundingMode" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeTaxRoundingModeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTaxRoundingModeChange": + from ._schemas.change import ChangeTaxRoundingModeChangeSchema + + return ChangeTaxRoundingModeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTaxRoundingModeChangeSchema + + return ChangeTaxRoundingModeChangeSchema().dump(self) + + +class ChangeTextLineItemNameChange(Change): + """Change triggered by the [Change TextLineItem Name](ctp:api:type:ShoppingListChangeTextLineItemNameAction) update action.""" + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Holds information about the updated Text Line Item. + text_line_item: "TextLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + text_line_item: "TextLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.text_line_item = text_line_item + + super().__init__(change=change, type="ChangeTextLineItemNameChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTextLineItemNameChange": + from ._schemas.change import ChangeTextLineItemNameChangeSchema + + return ChangeTextLineItemNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTextLineItemNameChangeSchema + + return ChangeTextLineItemNameChangeSchema().dump(self) + + +class ChangeTextLineItemQuantityChange(Change): + """Change triggered by the [Change TextLineItem Quantity](ctp:api:type:ShoppingListChangeTextLineItemQuantityAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + #: Holds information about the updated Text Line Item. + text_line_item: "TextLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: int, + next_value: int, + text_line_item: "TextLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.text_line_item = text_line_item + + super().__init__(change=change, type="ChangeTextLineItemQuantityChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTextLineItemQuantityChange": + from ._schemas.change import ChangeTextLineItemQuantityChangeSchema + + return ChangeTextLineItemQuantityChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTextLineItemQuantityChangeSchema + + return ChangeTextLineItemQuantityChangeSchema().dump(self) + + +class ChangeTextLineItemsOrderChange(Change): + """Change triggered by the [Change TextLineItems Order](ctp:api:type:ShoppingListChangeTextLineItemsOrderAction) update action.""" + + #: Value before the change. + previous_value: typing.List["TextLineItemValue"] + #: Value after the change. + next_value: typing.List["TextLineItemValue"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["TextLineItemValue"], + next_value: typing.List["TextLineItemValue"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeTextLineItemsOrderChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTextLineItemsOrderChange": + from ._schemas.change import ChangeTextLineItemsOrderChangeSchema + + return ChangeTextLineItemsOrderChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTextLineItemsOrderChangeSchema + + return ChangeTextLineItemsOrderChangeSchema().dump(self) + + +class ChangeTransactionInteractionIdChange(Change): + """Change triggered by the [Change TransactionInteractionId](ctp:api:type:PaymentChangeTransactionInteractionIdAction) update action.""" + + #: Value after the change. + previous_value: str + #: Value before the change. + next_value: str + #: Holds information about the updated Transaction. + transaction: "TransactionChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: str, + next_value: str, + transaction: "TransactionChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.transaction = transaction + + super().__init__(change=change, type="ChangeTransactionInteractionIdChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTransactionInteractionIdChange": + from ._schemas.change import ChangeTransactionInteractionIdChangeSchema + + return ChangeTransactionInteractionIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTransactionInteractionIdChangeSchema + + return ChangeTransactionInteractionIdChangeSchema().dump(self) + + +class ChangeTransactionStateChange(Change): + """Change triggered by the [Change TransactionState](ctp:api:type:PaymentChangeTransactionStateAction) update action.""" + + #: Value before the change. + previous_value: "TransactionState" + #: Value after the change. + next_value: "TransactionState" + #: Holds information about the updated Transaction. + transaction: "TransactionChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "TransactionState", + next_value: "TransactionState", + transaction: "TransactionChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.transaction = transaction + + super().__init__(change=change, type="ChangeTransactionStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTransactionStateChange": + from ._schemas.change import ChangeTransactionStateChangeSchema + + return ChangeTransactionStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTransactionStateChangeSchema + + return ChangeTransactionStateChangeSchema().dump(self) + + +class ChangeTransactionTimestampChange(Change): + """Change triggered by the [Change TransactionTimestamp](ctp:api:type:PaymentChangeTransactionTimestampAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: Holds information about the updated Transaction. + transaction: "TransactionChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: str, + next_value: str, + transaction: "TransactionChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.transaction = transaction + + super().__init__(change=change, type="ChangeTransactionTimestampChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTransactionTimestampChange": + from ._schemas.change import ChangeTransactionTimestampChangeSchema + + return ChangeTransactionTimestampChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeTransactionTimestampChangeSchema + + return ChangeTransactionTimestampChangeSchema().dump(self) + + +class ChangeValueChange(Change): + """Change triggered by the following update actions: + + - [Change Value](ctp:api:type:CartDiscountChangeValueAction) on Cart Discounts. + - [Change Value](ctp:api:type:ProductDiscountChangeValueAction) on Product Discounts. + + """ + + #: Value before the change. + previous_value: "ChangeValueChangeValue" + #: Value after the change. + next_value: "ChangeValueChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "ChangeValueChangeValue", + next_value: "ChangeValueChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="ChangeValueChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ChangeValueChange": + from ._schemas.change import ChangeValueChangeSchema + + return ChangeValueChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import ChangeValueChangeSchema + + return ChangeValueChangeSchema().dump(self) + + +class MoveImageToPositionChange(Change): + """Change triggered by the [Move image to position](ctp:api:type:ProductMoveImageToPositionAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Image"] + #: Value after the change. + next_value: typing.List["Image"] + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Image"], + next_value: typing.List["Image"], + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="MoveImageToPositionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "MoveImageToPositionChange": + from ._schemas.change import MoveImageToPositionChangeSchema + + return MoveImageToPositionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import MoveImageToPositionChangeSchema + + return MoveImageToPositionChangeSchema().dump(self) + + +class PublishChange(Change): + """Change triggered by the [Publish](ctp:api:type:ProductPublishAction) update action.""" + + def __init__(self, *, change: str): + + super().__init__(change=change, type="PublishChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PublishChange": + from ._schemas.change import PublishChangeSchema + + return PublishChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import PublishChangeSchema + + return PublishChangeSchema().dump(self) + + +class RemoveAddressChange(Change): + """Change triggered by the [Remove Address](ctp:api:type:CustomerRemoveAddressAction) update action.""" + + #: Value before the change. + previous_value: "Address" + + def __init__(self, *, change: str, previous_value: "Address"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveAddressChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveAddressChange": + from ._schemas.change import RemoveAddressChangeSchema + + return RemoveAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveAddressChangeSchema + + return RemoveAddressChangeSchema().dump(self) + + +class RemoveAssetChange(Change): + """Change triggered by the following update actions: + + - [Remove Asset](ctp:api:type:CategoryRemoveAssetAction) on Categories. + - [Remove Asset](ctp:api:type:ProductRemoveAssetAction) on Products. + + """ + + #: Value before the change. + previous_value: "Asset" + + def __init__(self, *, change: str, previous_value: "Asset"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveAssetChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveAssetChange": + from ._schemas.change import RemoveAssetChangeSchema + + return RemoveAssetChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveAssetChangeSchema + + return RemoveAssetChangeSchema().dump(self) + + +class RemoveAssociateChange(Change): + """Change triggered by the [Remove Associate](ctp:api:type:BusinessUnitRemoveAssociateAction) update action.""" + + #: Value before the change. + previous_value: "Associate" + + def __init__(self, *, change: str, previous_value: "Associate"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveAssociateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveAssociateChange": + from ._schemas.change import RemoveAssociateChangeSchema + + return RemoveAssociateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveAssociateChangeSchema + + return RemoveAssociateChangeSchema().dump(self) + + +class RemoveAttributeDefinitionChange(Change): + """Change triggered by the [Remove AttributeDefinition](ctp:api:type:ProductTypeRemoveAttributeDefinitionAction) update action.""" + + #: Value before the change. + previous_value: "AttributeDefinition" + + def __init__(self, *, change: str, previous_value: "AttributeDefinition"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveAttributeDefinitionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveAttributeDefinitionChange": + from ._schemas.change import RemoveAttributeDefinitionChangeSchema + + return RemoveAttributeDefinitionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveAttributeDefinitionChangeSchema + + return RemoveAttributeDefinitionChangeSchema().dump(self) + + +class RemoveBillingAddressIdChange(Change): + """Change triggered by the [Remove Billing Address ID](ctp:api:type:CustomerRemoveBillingAddressIdAction) update action.""" + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + #: Address removed from `billingAddressesIds`. + address: "Address" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"], + address: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + self.address = address + + super().__init__(change=change, type="RemoveBillingAddressIdChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveBillingAddressIdChange": + from ._schemas.change import RemoveBillingAddressIdChangeSchema + + return RemoveBillingAddressIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveBillingAddressIdChangeSchema + + return RemoveBillingAddressIdChangeSchema().dump(self) + + +class RemoveChannelRolesChange(Change): + """Change triggered by the [Remove Roles](ctp:api:type:ChannelRemoveRolesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["ChannelRoleEnum"] + #: Value after the change. + next_value: typing.List["ChannelRoleEnum"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["ChannelRoleEnum"], + next_value: typing.List["ChannelRoleEnum"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemoveChannelRolesChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveChannelRolesChange": + from ._schemas.change import RemoveChannelRolesChangeSchema + + return RemoveChannelRolesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveChannelRolesChangeSchema + + return RemoveChannelRolesChangeSchema().dump(self) + + +class RemoveCustomLineItemChange(Change): + """Change triggered by the [Remove CustomLineItem](ctp:api:type:StagedOrderRemoveCustomLineItemAction) update action.""" + + #: Value before the change. + previous_value: "CustomLineItem" + #: Value after the change. + next_value: "CustomLineItem" + + def __init__( + self, + *, + change: str, + previous_value: "CustomLineItem", + next_value: "CustomLineItem" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemoveCustomLineItemChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveCustomLineItemChange": + from ._schemas.change import RemoveCustomLineItemChangeSchema + + return RemoveCustomLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveCustomLineItemChangeSchema + + return RemoveCustomLineItemChangeSchema().dump(self) + + +class RemoveDeliveryItemsChange(Change): + """Change triggered by the [Remove Delivery](ctp:api:type:OrderRemoveDeliveryAction) update action.""" + + #: Value before the change. + previous_value: "Delivery" + + def __init__(self, *, change: str, previous_value: "Delivery"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveDeliveryItemsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveDeliveryItemsChange": + from ._schemas.change import RemoveDeliveryItemsChangeSchema + + return RemoveDeliveryItemsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveDeliveryItemsChangeSchema + + return RemoveDeliveryItemsChangeSchema().dump(self) + + +class RemoveDiscountCodeChange(Change): + """Change triggered by the [Remove DiscountCode](ctp:api:type:StagedOrderRemoveDiscountCodeAction) update action.""" + + #: Value before the change. + previous_value: "DiscountCodeInfo" + + def __init__(self, *, change: str, previous_value: "DiscountCodeInfo"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveDiscountCodeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveDiscountCodeChange": + from ._schemas.change import RemoveDiscountCodeChangeSchema + + return RemoveDiscountCodeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveDiscountCodeChangeSchema + + return RemoveDiscountCodeChangeSchema().dump(self) + + +class RemoveEnumValuesChange(Change): + """Change triggered by the [Remove EnumValues from AttributeDefinition](ctp:api:type:ProductTypeRemoveEnumValuesAction) update action.""" + + #: Value before the change. + previous_value: "EnumValue" + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + + def __init__( + self, *, change: str, previous_value: "EnumValue", attribute_name: str + ): + self.previous_value = previous_value + self.attribute_name = attribute_name + + super().__init__(change=change, type="RemoveEnumValuesChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveEnumValuesChange": + from ._schemas.change import RemoveEnumValuesChangeSchema + + return RemoveEnumValuesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveEnumValuesChangeSchema + + return RemoveEnumValuesChangeSchema().dump(self) + + +class RemoveFieldDefinitionChange(Change): + """Change triggered by the [Remove FieldDefinition](ctp:api:type:TypeRemoveFieldDefinitionAction) update action.""" + + #: Value before the change. + previous_value: "FieldDefinition" + + def __init__(self, *, change: str, previous_value: "FieldDefinition"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveFieldDefinitionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveFieldDefinitionChange": + from ._schemas.change import RemoveFieldDefinitionChangeSchema + + return RemoveFieldDefinitionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveFieldDefinitionChangeSchema + + return RemoveFieldDefinitionChangeSchema().dump(self) + + +class RemoveFromCategoryChange(Change): + """Change triggered by the [Remove from Category](ctp:api:type:ProductRemoveFromCategoryAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Reference"] + #: Value after the change. + next_value: typing.List["Reference"] + #: Category from which the Product was removed. + category: "Reference" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reference"], + next_value: typing.List["Reference"], + category: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + self.category = category + + super().__init__(change=change, type="RemoveFromCategoryChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveFromCategoryChange": + from ._schemas.change import RemoveFromCategoryChangeSchema + + return RemoveFromCategoryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveFromCategoryChangeSchema + + return RemoveFromCategoryChangeSchema().dump(self) + + +class RemoveImageChange(Change): + """Change triggered by the [Remove Image](ctp:api:type:ProductRemoveImageAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Image"] + #: Value after the change. + next_value: typing.List["Image"] + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Image"], + next_value: typing.List["Image"], + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="RemoveImageChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveImageChange": + from ._schemas.change import RemoveImageChangeSchema + + return RemoveImageChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveImageChangeSchema + + return RemoveImageChangeSchema().dump(self) + + +class RemoveInheritedAssociateChange(Change): + """Change triggered by the [Remove Associate](ctp:api:type:BusinessUnitRemoveAssociateAction) update action on a parent of a Business Unit in cases where [inheritance applies](/../api/associates-overview#conditions-for-inheritance).""" + + #: The value before the change. + previous_value: "InheritedAssociate" + + def __init__(self, *, change: str, previous_value: "InheritedAssociate"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveInheritedAssociateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveInheritedAssociateChange": + from ._schemas.change import RemoveInheritedAssociateChangeSchema + + return RemoveInheritedAssociateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveInheritedAssociateChangeSchema + + return RemoveInheritedAssociateChangeSchema().dump(self) + + +class RemoveItemShippingAddressesChange(Change): + """Change triggered by the [Remove Item Shipping Address](ctp:api:type:OrderRemoveItemShippingAddressAction) update action.""" + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemoveItemShippingAddressesChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveItemShippingAddressesChange": + from ._schemas.change import RemoveItemShippingAddressesChangeSchema + + return RemoveItemShippingAddressesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveItemShippingAddressesChangeSchema + + return RemoveItemShippingAddressesChangeSchema().dump(self) + + +class RemoveLocalizedEnumValuesChange(Change): + """Change triggered by the [Remove EnumValues from AttributeDefinition](ctp:api:type:ProductTypeRemoveEnumValuesAction) update action.""" + + #: Value before the change. + previous_value: "LocalizedEnumValue" + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + + def __init__( + self, *, change: str, previous_value: "LocalizedEnumValue", attribute_name: str + ): + self.previous_value = previous_value + self.attribute_name = attribute_name + + super().__init__(change=change, type="RemoveLocalizedEnumValuesChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveLocalizedEnumValuesChange": + from ._schemas.change import RemoveLocalizedEnumValuesChangeSchema + + return RemoveLocalizedEnumValuesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveLocalizedEnumValuesChangeSchema + + return RemoveLocalizedEnumValuesChangeSchema().dump(self) + + +class RemoveLocationChange(Change): + """Change triggered by the [Remove Location](ctp:api:type:ZoneRemoveLocationAction) update action.""" + + #: Value before the change. + previous_value: "Location" + + def __init__(self, *, change: str, previous_value: "Location"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveLocationChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveLocationChange": + from ._schemas.change import RemoveLocationChangeSchema + + return RemoveLocationChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveLocationChangeSchema + + return RemoveLocationChangeSchema().dump(self) + + +class RemoveOrderLineItemChange(Change): + """Change triggered by the [Remove Parcel From Delivery](ctp:api:type:StagedOrderRemoveLineItemAction) update action.""" + + #: Value before the change. + previous_value: "LineItem" + #: Value after the change. + next_value: "LineItem" + + def __init__( + self, *, change: str, previous_value: "LineItem", next_value: "LineItem" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemoveOrderLineItemChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveOrderLineItemChange": + from ._schemas.change import RemoveOrderLineItemChangeSchema + + return RemoveOrderLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveOrderLineItemChangeSchema + + return RemoveOrderLineItemChangeSchema().dump(self) + + +class RemoveParcelFromDeliveryChange(Change): + """Change triggered by the following update actions: + + - [Remove Parcel From Delivery](ctp:api:type:OrderRemoveParcelFromDeliveryAction) on Orders. + - [Remove Parcel From Delivery](ctp:api:type:StagedOrderRemoveParcelFromDeliveryAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "Parcel" + #: `id` of the [Delivery](ctp:api:type:Delivery) from which the Parcel was removed. + delivery_id: str + + def __init__(self, *, change: str, previous_value: "Parcel", delivery_id: str): + self.previous_value = previous_value + self.delivery_id = delivery_id + + super().__init__(change=change, type="RemoveParcelFromDeliveryChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveParcelFromDeliveryChange": + from ._schemas.change import RemoveParcelFromDeliveryChangeSchema + + return RemoveParcelFromDeliveryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveParcelFromDeliveryChangeSchema + + return RemoveParcelFromDeliveryChangeSchema().dump(self) + + +class RemovePaymentChange(Change): + """Change triggered by the following update actions: + + - [Remove Payment](ctp:api:type:OrderRemovePaymentAction) on Orders. + - [Remove Payment](ctp:api:type:StagedOrderRemovePaymentAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "PaymentInfo" + #: Value after the change. + next_value: "PaymentInfo" + + def __init__( + self, *, change: str, previous_value: "PaymentInfo", next_value: "PaymentInfo" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemovePaymentChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemovePaymentChange": + from ._schemas.change import RemovePaymentChangeSchema + + return RemovePaymentChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemovePaymentChangeSchema + + return RemovePaymentChangeSchema().dump(self) + + +class RemovePriceChange(Change): + """Change triggered by the [Remove Embedded Price](ctp:api:type:ProductRemovePriceAction) update action.""" + + #: Value before the change. + previous_value: "Price" + #: Value after the change. + next_value: "Price" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + #: `id` of the Embedded [Price](ctp:api:type:Price). + price_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Price", + next_value: "Price", + catalog_data: str, + price_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + self.price_id = price_id + + super().__init__(change=change, type="RemovePriceChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemovePriceChange": + from ._schemas.change import RemovePriceChangeSchema + + return RemovePriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemovePriceChangeSchema + + return RemovePriceChangeSchema().dump(self) + + +class RemoveProductChange(Change): + """Change triggered by the [Remove Product](ctp:api:type:ProductSelectionRemoveProductAction) update action.""" + + #: Value before the change. + previous_value: "Reference" + + def __init__(self, *, change: str, previous_value: "Reference"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveProductChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveProductChange": + from ._schemas.change import RemoveProductChangeSchema + + return RemoveProductChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveProductChangeSchema + + return RemoveProductChangeSchema().dump(self) + + +class RemoveProductSelectionChange(Change): + """Change triggered by the [Remove Product Selection](ctp:api:type:StoreRemoveProductSelectionAction) update action.""" + + #: Value before the change. + previous_value: "ProductSelectionSetting" + + def __init__(self, *, change: str, previous_value: "ProductSelectionSetting"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveProductSelectionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveProductSelectionChange": + from ._schemas.change import RemoveProductSelectionChangeSchema + + return RemoveProductSelectionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveProductSelectionChangeSchema + + return RemoveProductSelectionChangeSchema().dump(self) + + +class RemovePropertyChange(Change): + """Change triggered by the [Update CustomObject](ctp:api:endpoint:/{projectKey}/custom-objects:POST) request when an existing property is removed.""" + + #: Value before the change. + previous_value: typing.Any + #: Path to the property that was removed. + path: str + + def __init__(self, *, change: str, previous_value: typing.Any, path: str): + self.previous_value = previous_value + self.path = path + + super().__init__(change=change, type="RemovePropertyChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemovePropertyChange": + from ._schemas.change import RemovePropertyChangeSchema + + return RemovePropertyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemovePropertyChangeSchema + + return RemovePropertyChangeSchema().dump(self) + + +class RemoveShippingAddressIdChange(Change): + """Change triggered by the [Remove Shipping Address ID](ctp:api:type:CustomerRemoveShippingAddressIdAction) update action.""" + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + #: Address removed from `shippingAddressesIds`. + address: "Address" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"], + address: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + self.address = address + + super().__init__(change=change, type="RemoveShippingAddressIdChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveShippingAddressIdChange": + from ._schemas.change import RemoveShippingAddressIdChangeSchema + + return RemoveShippingAddressIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveShippingAddressIdChangeSchema + + return RemoveShippingAddressIdChangeSchema().dump(self) + + +class RemoveShoppingListLineItemChange(Change): + """Change triggered by the [Remove ShoppingListLineItem](ctp:api:type:ShoppingListRemoveLineItemAction) update action.""" + + #: Value before the change. + previous_value: "LineItem" + #: Value after the change. + next_value: "LineItem" + + def __init__( + self, *, change: str, previous_value: "LineItem", next_value: "LineItem" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemoveShoppingListLineItemChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveShoppingListLineItemChange": + from ._schemas.change import RemoveShoppingListLineItemChangeSchema + + return RemoveShoppingListLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveShoppingListLineItemChangeSchema + + return RemoveShoppingListLineItemChangeSchema().dump(self) + + +class RemoveStateRolesChange(Change): + """Change triggered by the [Remove State roles](ctp:api:type:StateRemoveRolesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["StateRoleEnum"] + #: Value after the change. + next_value: typing.List["StateRoleEnum"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["StateRoleEnum"], + next_value: typing.List["StateRoleEnum"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemoveStateRolesChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveStateRolesChange": + from ._schemas.change import RemoveStateRolesChangeSchema + + return RemoveStateRolesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveStateRolesChangeSchema + + return RemoveStateRolesChangeSchema().dump(self) + + +class RemoveTaxRateChange(Change): + """Change triggered by the [Remove TaxRate](ctp:api:type:TaxCategoryRemoveTaxRateAction) update action.""" + + #: Value before the change. + previous_value: "TaxRate" + + def __init__(self, *, change: str, previous_value: "TaxRate"): + self.previous_value = previous_value + + super().__init__(change=change, type="RemoveTaxRateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveTaxRateChange": + from ._schemas.change import RemoveTaxRateChangeSchema + + return RemoveTaxRateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveTaxRateChangeSchema + + return RemoveTaxRateChangeSchema().dump(self) + + +class RemoveTextLineItemChange(Change): + """Change triggered by the [Remove TextLineItem](ctp:api:type:ShoppingListRemoveTextLineItemAction) update action.""" + + #: Value before the change. + previous_value: "TextLineItem" + #: Value after the change. + next_value: "TextLineItem" + + def __init__( + self, *, change: str, previous_value: "TextLineItem", next_value: "TextLineItem" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="RemoveTextLineItemChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RemoveTextLineItemChange": + from ._schemas.change import RemoveTextLineItemChangeSchema + + return RemoveTextLineItemChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveTextLineItemChangeSchema + + return RemoveTextLineItemChangeSchema().dump(self) + + +class RemoveVariantChange(Change): + """Change triggered by the [Remove ProductVariant](ctp:api:type:ProductRemoveVariantAction) update action.""" + + #: Value before the change. + previous_value: "Variant" + #: Value after the change. + next_value: "Variant" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "Variant", + next_value: "Variant", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="RemoveVariantChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "RemoveVariantChange": + from ._schemas.change import RemoveVariantChangeSchema + + return RemoveVariantChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RemoveVariantChangeSchema + + return RemoveVariantChangeSchema().dump(self) + + +class RequestQuoteRenegotiationChange(Change): + """Change triggered by the [Request Quote Renegotiation](ctp:api:type:QuoteRequestQuoteRenegotiationAction) update action.""" + + #: Value before the change. + previous_value: "QuoteState" + #: Value after the change. + next_value: "QuoteState" + #: Message from the [Buyer](/../api/quotes-overview#buyer) regarding the [Quote](ctp:api:type:Quote) renegotiation request. + buyer_comment: str + + def __init__( + self, + *, + change: str, + previous_value: "QuoteState", + next_value: "QuoteState", + buyer_comment: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.buyer_comment = buyer_comment + + super().__init__(change=change, type="RequestQuoteRenegotiationChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RequestQuoteRenegotiationChange": + from ._schemas.change import RequestQuoteRenegotiationChangeSchema + + return RequestQuoteRenegotiationChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import RequestQuoteRenegotiationChangeSchema + + return RequestQuoteRenegotiationChangeSchema().dump(self) + + +class SetAddressChange(Change): + """Change triggered by the [Set Address](ctp:api:type:ChannelSetAddressAction) update action.""" + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetAddressChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetAddressChange": + from ._schemas.change import SetAddressChangeSchema + + return SetAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAddressChangeSchema + + return SetAddressChangeSchema().dump(self) + + +class SetAddressCustomFieldChange(Change): + """Change triggered by the [Set Address Custom Field](ctp:api:type:BusinessUnitSetAddressCustomFieldAction) update action.""" + + #: [Address](ctp:api:type:Address) which was extended. + address: "Address" + #: Name of the [Custom Field](ctp:api:type:CustomFields). + name: str + #: `id` of the referenced [Type](ctp:api:type:Type). + custom_type_id: str + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + + def __init__( + self, + *, + change: str, + address: "Address", + name: str, + custom_type_id: str, + previous_value: typing.Any, + next_value: typing.Any + ): + self.address = address + self.name = name + self.custom_type_id = custom_type_id + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetAddressCustomFieldChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetAddressCustomFieldChange": + from ._schemas.change import SetAddressCustomFieldChangeSchema + + return SetAddressCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAddressCustomFieldChangeSchema + + return SetAddressCustomFieldChangeSchema().dump(self) + + +class SetAddressCustomTypeChange(Change): + """Change triggered by the [Set Address Custom Type](ctp:api:type:BusinessUnitSetAddressCustomTypeAction) update action.""" + + #: [Address](ctp:api:type:Address) which was extended. + address: "Address" + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + + def __init__( + self, + *, + change: str, + address: "Address", + previous_value: "CustomFields", + next_value: "CustomFields" + ): + self.address = address + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetAddressCustomTypeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetAddressCustomTypeChange": + from ._schemas.change import SetAddressCustomTypeChangeSchema + + return SetAddressCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAddressCustomTypeChangeSchema + + return SetAddressCustomTypeChangeSchema().dump(self) + + +class SetAnonymousIdChange(Change): + """Change triggered by the following update actions: + + - [Set AnonymousId](ctp:api:type:PaymentSetAnonymousIdAction) on Payments. + - [Set AnonymousId](ctp:api:type:ShoppingListSetAnonymousIdAction) on Shopping Lists. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetAnonymousIdChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetAnonymousIdChange": + from ._schemas.change import SetAnonymousIdChangeSchema + + return SetAnonymousIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAnonymousIdChangeSchema + + return SetAnonymousIdChangeSchema().dump(self) + + +class SetApplicationVersionChange(Change): + """Change triggered automatically due to a user-initiated change.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + + def __init__(self, *, change: str, previous_value: int, next_value: int): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetApplicationVersionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetApplicationVersionChange": + from ._schemas.change import SetApplicationVersionChangeSchema + + return SetApplicationVersionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetApplicationVersionChangeSchema + + return SetApplicationVersionChangeSchema().dump(self) + + +class SetAssetCustomFieldChange(Change): + """Change triggered by the following update actions: + + - [Set Asset CustomField](ctp:api:type:CategorySetAssetCustomFieldAction) on Categories. + - [Set Asset CustomField](ctp:api:type:ProductSetAssetCustomFieldAction) on Products. + + """ + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: `id` of the referenced [Type](ctp:api:type:Type). + custom_type_id: str + #: Information about the updated Asset. + asset: "AssetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: typing.Any, + next_value: typing.Any, + name: str, + custom_type_id: str, + asset: "AssetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.name = name + self.custom_type_id = custom_type_id + self.asset = asset + + super().__init__(change=change, type="SetAssetCustomFieldChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetAssetCustomFieldChange": + from ._schemas.change import SetAssetCustomFieldChangeSchema + + return SetAssetCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAssetCustomFieldChangeSchema + + return SetAssetCustomFieldChangeSchema().dump(self) + + +class SetAssetCustomTypeChange(Change): + """Change triggered by the following update actions: + + - [Set Asset Custom Type](ctp:api:type:CategorySetAssetCustomTypeAction) on Categories. + - [Set Asset Custom Type](ctp:api:type:ProductSetAssetCustomTypeAction) on Products. + + """ + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + #: Information about the updated Asset. + asset: "AssetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "CustomFields", + next_value: "CustomFields", + asset: "AssetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.asset = asset + + super().__init__(change=change, type="SetAssetCustomTypeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetAssetCustomTypeChange": + from ._schemas.change import SetAssetCustomTypeChangeSchema + + return SetAssetCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAssetCustomTypeChangeSchema + + return SetAssetCustomTypeChangeSchema().dump(self) + + +class SetAssetDescriptionChange(Change): + """Change triggered by the following update actions: + + - [Set Asset Description](ctp:api:type:CategorySetAssetDescriptionAction) on Categories. + - [Set Asset Description](ctp:api:type:ProductSetAssetDescriptionAction) on Products. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Information about the updated Asset. + asset: "AssetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + asset: "AssetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.asset = asset + + super().__init__(change=change, type="SetAssetDescriptionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetAssetDescriptionChange": + from ._schemas.change import SetAssetDescriptionChangeSchema + + return SetAssetDescriptionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAssetDescriptionChangeSchema + + return SetAssetDescriptionChangeSchema().dump(self) + + +class SetAssetKeyChange(Change): + """Change triggered by the following update actions: + + - [Set Asset Key](ctp:api:type:CategorySetAssetKeyAction) on Categories. + - [Set Asset Key](ctp:api:type:ProductSetAssetKeyAction) on Products. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: Information about the updated Asset. + asset: "AssetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: str, + next_value: str, + asset: "AssetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.asset = asset + + super().__init__(change=change, type="SetAssetKeyChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetAssetKeyChange": + from ._schemas.change import SetAssetKeyChangeSchema + + return SetAssetKeyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAssetKeyChangeSchema + + return SetAssetKeyChangeSchema().dump(self) + + +class SetAssetSourcesChange(Change): + """Change triggered by the following update actions: + + - [Set Asset Sources](ctp:api:type:CategorySetAssetSourcesAction) on Categories. + - [Set Asset Sources](ctp:api:type:ProductSetAssetSourcesAction) on Products. + + """ + + #: Value before the change. + previous_value: typing.List["AssetSource"] + #: Value after the change. + next_value: typing.List["AssetSource"] + #: Information about the updated Asset. + asset: "AssetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["AssetSource"], + next_value: typing.List["AssetSource"], + asset: "AssetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.asset = asset + + super().__init__(change=change, type="SetAssetSourcesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetAssetSourcesChange": + from ._schemas.change import SetAssetSourcesChangeSchema + + return SetAssetSourcesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAssetSourcesChangeSchema + + return SetAssetSourcesChangeSchema().dump(self) + + +class SetAssetTagsChange(Change): + """Change triggered by the following update actions: + + - [Change Asset Tags](ctp:api:type:CategorySetAssetTagsAction) on Categories. + - [Change Asset Tags](ctp:api:type:ProductSetAssetTagsAction) on Products. + + """ + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + #: Information about the updated Asset. + asset: "AssetChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"], + asset: "AssetChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.asset = asset + + super().__init__(change=change, type="SetAssetTagsChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetAssetTagsChange": + from ._schemas.change import SetAssetTagsChangeSchema + + return SetAssetTagsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAssetTagsChangeSchema + + return SetAssetTagsChangeSchema().dump(self) + + +class SetAttributeChange(Change): + """Change triggered by the [Set Attribute](ctp:api:type:ProductSetAttributeAction) update action.""" + + #: Value before the change. + previous_value: "AttributeValue" + #: Value after the change. + next_value: "AttributeValue" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "AttributeValue", + next_value: "AttributeValue", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="SetAttributeChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetAttributeChange": + from ._schemas.change import SetAttributeChangeSchema + + return SetAttributeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAttributeChangeSchema + + return SetAttributeChangeSchema().dump(self) + + +class SetAuthenticationModeChange(Change): + """Change triggered by the [Set AuthenticationMode](ctp:api:type:CustomerSetAuthenticationModeAction) update action.""" + + #: Value before the change. + previous_value: "AuthenticationMode" + #: Value after the change. + next_value: "AuthenticationMode" + + def __init__( + self, + *, + change: str, + previous_value: "AuthenticationMode", + next_value: "AuthenticationMode" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetAuthenticationModeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetAuthenticationModeChange": + from ._schemas.change import SetAuthenticationModeChangeSchema + + return SetAuthenticationModeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAuthenticationModeChangeSchema + + return SetAuthenticationModeChangeSchema().dump(self) + + +class SetAuthorNameChange(Change): + """Change triggered by the [Set Author Name](ctp:api:type:ReviewSetAuthorNameAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetAuthorNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetAuthorNameChange": + from ._schemas.change import SetAuthorNameChangeSchema + + return SetAuthorNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetAuthorNameChangeSchema + + return SetAuthorNameChangeSchema().dump(self) + + +class SetBillingAddressChange(Change): + """Change triggered by the following update actions: + + - [Set Billing Address](ctp:api:type:OrderSetBillingAddressAction) on Orders. + - [Set Billing Address](ctp:api:type:StagedOrderSetBillingAddressAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetBillingAddressChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetBillingAddressChange": + from ._schemas.change import SetBillingAddressChangeSchema + + return SetBillingAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetBillingAddressChangeSchema + + return SetBillingAddressChangeSchema().dump(self) + + +class SetCartPredicateChange(Change): + """Change triggered by the [Set Cart Predicate](ctp:api:type:DiscountCodeSetCartPredicateAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCartPredicateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCartPredicateChange": + from ._schemas.change import SetCartPredicateChangeSchema + + return SetCartPredicateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCartPredicateChangeSchema + + return SetCartPredicateChangeSchema().dump(self) + + +class SetCategoryOrderHintChange(Change): + """Change triggered by the [Set Category Order Hint](ctp:api:type:ProductSetCategoryOrderHintAction) update action.""" + + #: Value before the change. + previous_value: "CategoryOrderHints" + #: Value after the change. + next_value: "CategoryOrderHints" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + #: `id` of the updated [Category](ctp:api:type:Category). + category_id: str + + def __init__( + self, + *, + change: str, + previous_value: "CategoryOrderHints", + next_value: "CategoryOrderHints", + catalog_data: str, + category_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + self.category_id = category_id + + super().__init__(change=change, type="SetCategoryOrderHintChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCategoryOrderHintChange": + from ._schemas.change import SetCategoryOrderHintChangeSchema + + return SetCategoryOrderHintChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCategoryOrderHintChangeSchema + + return SetCategoryOrderHintChangeSchema().dump(self) + + +class SetChannelRolesChange(Change): + """Change triggered by the [Set Roles](ctp:api:type:ChannelSetRolesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["ChannelRoleEnum"] + #: Value after the change. + next_value: typing.List["ChannelRoleEnum"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["ChannelRoleEnum"], + next_value: typing.List["ChannelRoleEnum"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetChannelRolesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetChannelRolesChange": + from ._schemas.change import SetChannelRolesChangeSchema + + return SetChannelRolesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetChannelRolesChangeSchema + + return SetChannelRolesChangeSchema().dump(self) + + +class SetCompanyNameChange(Change): + """Change triggered by the [Set Company Name](ctp:api:type:CustomerSetCompanyNameAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCompanyNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetCompanyNameChange": + from ._schemas.change import SetCompanyNameChangeSchema + + return SetCompanyNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCompanyNameChangeSchema + + return SetCompanyNameChangeSchema().dump(self) + + +class SetContactEmailChange(Change): + """Change triggered by the [Set Contact Email](ctp:api:type:BusinessUnitSetContactEmailAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetContactEmailChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetContactEmailChange": + from ._schemas.change import SetContactEmailChangeSchema + + return SetContactEmailChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetContactEmailChangeSchema + + return SetContactEmailChangeSchema().dump(self) + + +class SetCountriesChange(Change): + """Change triggered by the [Set Countries](ctp:api:type:StoreSetCountriesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["StoreCountry"] + #: Value after the change. + next_value: typing.List["StoreCountry"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["StoreCountry"], + next_value: typing.List["StoreCountry"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCountriesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetCountriesChange": + from ._schemas.change import SetCountriesChangeSchema + + return SetCountriesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCountriesChangeSchema + + return SetCountriesChangeSchema().dump(self) + + +class SetCountryChange(Change): + """Change triggered by the [Set Country](ctp:api:type:StagedOrderSetCountryAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCountryChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetCountryChange": + from ._schemas.change import SetCountryChangeSchema + + return SetCountryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCountryChangeSchema + + return SetCountryChangeSchema().dump(self) + + +class SetCustomFieldChange(Change): + """Change triggered by the following update actions: + + - [Set CustomField](ctp:api:type:CartDiscountSetCustomFieldAction) on Cart Discounts. + - [Set CustomField](ctp:api:type:CategorySetCustomFieldAction) on Categories. + - [Set CustomField](ctp:api:type:ChannelSetCustomFieldAction) on Channels. + - [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) on Customers. + - [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) on Customer Groups. + - [Set CustomField](ctp:api:type:DiscountCodeSetCustomFieldAction) on Discount Codes. + - [Set CustomField](ctp:api:type:InventoryEntrySetCustomFieldAction) on Inventories. + - [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) on Orders. + - [Set CustomField](ctp:api:type:OrderEditSetCustomFieldAction) on Order Edits. + - [Set CustomField](ctp:api:type:PaymentSetCustomFieldAction) on Payments. + - [Set CustomField](ctp:api:type:ProductSelectionSetCustomFieldAction) on Product Selections. + - [Set CustomField](ctp:api:type:QuoteSetCustomFieldAction) on Quotes. + - [Set CustomField](ctp:api:type:QuoteRequestSetCustomFieldAction) on Quote Requests. + - [Set CustomField](ctp:api:type:ReviewSetCustomFieldAction) on Reviews. + - [Set CustomField](ctp:api:type:ShoppingListSetCustomFieldAction) on Shopping Lists. + - [Set CustomField](ctp:api:type:StagedOrderSetCustomFieldAction) on Staged Orders. + - [Set CustomField](ctp:api:type:StagedQuoteSetCustomFieldAction) on Staged Quotes. + - [Set CustomField](ctp:api:type:StoreSetCustomFieldAction) on Stores. + + """ + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: `id` of the referenced [Type](ctp:api:type:Type). + custom_type_id: str + + def __init__( + self, + *, + change: str, + previous_value: typing.Any, + next_value: typing.Any, + name: str, + custom_type_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.name = name + self.custom_type_id = custom_type_id + + super().__init__(change=change, type="SetCustomFieldChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetCustomFieldChange": + from ._schemas.change import SetCustomFieldChangeSchema + + return SetCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomFieldChangeSchema + + return SetCustomFieldChangeSchema().dump(self) + + +class SetCustomLineItemCustomFieldChange(Change): + """Change triggered by the following update actions: + + - [Set CustomLineItem Custom Type](ctp:api:type:OrderSetCustomLineItemCustomFieldAction) on Orders. + - [Set CustomLineItem Custom Type](ctp:api:type:StagedOrderSetCustomLineItemCustomFieldAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: typing.Any, + next_value: typing.Any, + name: str, + custom_line_item: "LocalizedString", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.name = name + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="SetCustomLineItemCustomFieldChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemCustomFieldChange": + from ._schemas.change import SetCustomLineItemCustomFieldChangeSchema + + return SetCustomLineItemCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemCustomFieldChangeSchema + + return SetCustomLineItemCustomFieldChangeSchema().dump(self) + + +class SetCustomLineItemCustomTypeChange(Change): + """Change triggered by the following update actions: + + - [Set CustomLineItem CustomField](ctp:api:type:OrderSetCustomLineItemCustomTypeAction) on Orders. + - [Set CustomLineItem CustomField](ctp:api:type:StagedOrderSetCustomLineItemCustomTypeAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "CustomFields", + next_value: "CustomFields", + custom_line_item: "LocalizedString", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="SetCustomLineItemCustomTypeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemCustomTypeChange": + from ._schemas.change import SetCustomLineItemCustomTypeChangeSchema + + return SetCustomLineItemCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemCustomTypeChangeSchema + + return SetCustomLineItemCustomTypeChangeSchema().dump(self) + + +class SetCustomLineItemMoneyChange(Change): + """Change triggered by the [Set CustomLineItem Money](ctp:api:type:StagedOrderChangeCustomLineItemMoneyAction) update action.""" + + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Money", + next_value: "Money", + custom_line_item: "LocalizedString", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="SetCustomLineItemMoneyChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemMoneyChange": + from ._schemas.change import SetCustomLineItemMoneyChangeSchema + + return SetCustomLineItemMoneyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemMoneyChangeSchema + + return SetCustomLineItemMoneyChangeSchema().dump(self) + + +class SetCustomLineItemShippingDetailsChange(Change): + """Change triggered by the following update actions: + + - [Set CustomLineItem ShippingDetails](ctp:api:type:OrderSetCustomLineItemShippingDetailsAction) on Orders. + - [Set CustomLineItem ShippingDetails](ctp:api:type:StagedOrderSetCustomLineItemShippingDetailsAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "ItemShippingDetails" + #: Value after the change. + next_value: "ItemShippingDetails" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "ItemShippingDetails", + next_value: "ItemShippingDetails", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="SetCustomLineItemShippingDetailsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemShippingDetailsChange": + from ._schemas.change import SetCustomLineItemShippingDetailsChangeSchema + + return SetCustomLineItemShippingDetailsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemShippingDetailsChangeSchema + + return SetCustomLineItemShippingDetailsChangeSchema().dump(self) + + +class SetCustomLineItemTaxAmountChange(Change): + """Change triggered by the [Set CustomLineItem TaxAmount](ctp:api:type:StagedOrderSetCustomLineItemTaxAmountAction) update action.""" + + #: Value before the change. + previous_value: "TaxRate" + #: Value after the change. + next_value: "TaxRate" + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + #: `"ExternalAmount"` + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "TaxRate", + next_value: "TaxRate", + custom_line_item: "LocalizedString", + custom_line_item_id: str, + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetCustomLineItemTaxAmountChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemTaxAmountChange": + from ._schemas.change import SetCustomLineItemTaxAmountChangeSchema + + return SetCustomLineItemTaxAmountChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemTaxAmountChangeSchema + + return SetCustomLineItemTaxAmountChangeSchema().dump(self) + + +class SetCustomLineItemTaxCategoryChange(Change): + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Reference", + next_value: "Reference", + custom_line_item: "LocalizedString", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="SetCustomLineItemTaxCategoryChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemTaxCategoryChange": + from ._schemas.change import SetCustomLineItemTaxCategoryChangeSchema + + return SetCustomLineItemTaxCategoryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemTaxCategoryChangeSchema + + return SetCustomLineItemTaxCategoryChangeSchema().dump(self) + + +class SetCustomLineItemTaxRateChange(Change): + """Change triggered by the [Set CustomLineItem TaxRate](ctp:api:type:StagedOrderSetCustomLineItemTaxRateAction) update action.""" + + #: Value before the change. + previous_value: "TaxRate" + #: Value after the change. + next_value: "TaxRate" + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + #: `"External"` + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "TaxRate", + next_value: "TaxRate", + custom_line_item: "LocalizedString", + custom_line_item_id: str, + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetCustomLineItemTaxRateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemTaxRateChange": + from ._schemas.change import SetCustomLineItemTaxRateChangeSchema + + return SetCustomLineItemTaxRateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemTaxRateChangeSchema + + return SetCustomLineItemTaxRateChangeSchema().dump(self) + + +class SetCustomLineItemTaxedPriceChange(Change): + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Money", + next_value: "Money", + custom_line_item: "LocalizedString", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="SetCustomLineItemTaxedPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemTaxedPriceChange": + from ._schemas.change import SetCustomLineItemTaxedPriceChangeSchema + + return SetCustomLineItemTaxedPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemTaxedPriceChangeSchema + + return SetCustomLineItemTaxedPriceChangeSchema().dump(self) + + +class SetCustomLineItemTotalPriceChange(Change): + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + #: Name of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item: "LocalizedString" + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + custom_line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Money", + next_value: "Money", + custom_line_item: "LocalizedString", + custom_line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_line_item = custom_line_item + self.custom_line_item_id = custom_line_item_id + + super().__init__(change=change, type="SetCustomLineItemTotalPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomLineItemTotalPriceChange": + from ._schemas.change import SetCustomLineItemTotalPriceChangeSchema + + return SetCustomLineItemTotalPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomLineItemTotalPriceChangeSchema + + return SetCustomLineItemTotalPriceChangeSchema().dump(self) + + +class SetCustomShippingMethodChange(Change): + """Change triggered by the [Set Custom ShippingMethod](ctp:api:type:StagedOrderSetCustomShippingMethodAction) update action.""" + + #: Value before the change. + previous_value: "CustomShippingMethodChangeValue" + #: Value after the change. + next_value: "CustomShippingMethodChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "CustomShippingMethodChangeValue", + next_value: "CustomShippingMethodChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCustomShippingMethodChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomShippingMethodChange": + from ._schemas.change import SetCustomShippingMethodChangeSchema + + return SetCustomShippingMethodChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomShippingMethodChangeSchema + + return SetCustomShippingMethodChangeSchema().dump(self) + + +class SetCustomTypeChange(Change): + """Change triggered by the following update actions: + + - [Set Custom Type](ctp:api:type:CartDiscountSetCustomTypeAction) on Cart Discounts. + - [Set Custom Type](ctp:api:type:CategorySetCustomTypeAction) on Categories. + - [Set Custom Type](ctp:api:type:ChannelSetCustomTypeAction) on Channels. + - [Set Custom Type](ctp:api:type:CustomerSetCustomTypeAction) on Customers. + - [Set Custom Type](ctp:api:type:CustomerGroupSetCustomTypeAction) on Customer Groups. + - [Set Custom Type](ctp:api:type:DiscountCodeSetCustomTypeAction) on Discount Codes. + - [Set Custom Type](ctp:api:type:InventoryEntrySetCustomTypeAction) on Inventories. + - [Set Custom Type](ctp:api:type:OrderSetCustomTypeAction) on Orders. + - [Set Custom Type](ctp:api:type:OrderEditSetCustomTypeAction) on Order Edits. + - [Set Custom Type](ctp:api:type:StagedOrderSetCustomTypeAction) on Staged Orders. + - [Set Custom Type](ctp:api:type:PaymentSetCustomTypeAction) on Payments. + - [Set Custom Type](ctp:api:type:ProductSelectionSetCustomTypeAction) on Product Selections. + - [Set Custom Type](ctp:api:type:QuoteSetCustomTypeAction) on Quotes. + - [Set Custom Type](ctp:api:type:StagedQuoteSetCustomTypeAction) on Staged Quotes. + - [Set Custom Type](ctp:api:type:QuoteRequestSetCustomTypeAction) on Quote Requests. + - [Set Custom Type](ctp:api:type:ReviewSetCustomTypeAction) on Reviews. + - [Set Custom Type](ctp:api:type:ShoppingListSetCustomTypeAction) on Shopping Lists. + - [Set Custom Type](ctp:api:type:StoreSetCustomTypeAction) on Stores. + + """ + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + + def __init__( + self, *, change: str, previous_value: "CustomFields", next_value: "CustomFields" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCustomTypeChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetCustomTypeChange": + from ._schemas.change import SetCustomTypeChangeSchema + + return SetCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomTypeChangeSchema + + return SetCustomTypeChangeSchema().dump(self) + + +class SetCustomerChange(Change): + """Change triggered by the following update actions: + + - [Set Customer](ctp:api:type:PaymentSetCustomerAction) on Payments. + - [Set Customer](ctp:api:type:ReviewSetCustomerAction) on Reviews. + - [Set Customer](ctp:api:type:ShoppingListSetCustomerAction) on Shopping Lists. + + """ + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCustomerChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetCustomerChange": + from ._schemas.change import SetCustomerChangeSchema + + return SetCustomerChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomerChangeSchema + + return SetCustomerChangeSchema().dump(self) + + +class SetCustomerEmailChange(Change): + """Change triggered by the following update actions: + + - [Set Customer Email](ctp:api:type:OrderSetCustomerEmailAction) on Orders. + - [Set Customer Email](ctp:api:type:StagedOrderSetCustomerEmailAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCustomerEmailChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomerEmailChange": + from ._schemas.change import SetCustomerEmailChangeSchema + + return SetCustomerEmailChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomerEmailChangeSchema + + return SetCustomerEmailChangeSchema().dump(self) + + +class SetCustomerGroupChange(Change): + """Change triggered by the [Set CustomerGroup](ctp:api:type:CustomerSetCustomerGroupAction) update action.""" + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCustomerGroupChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomerGroupChange": + from ._schemas.change import SetCustomerGroupChangeSchema + + return SetCustomerGroupChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomerGroupChangeSchema + + return SetCustomerGroupChangeSchema().dump(self) + + +class SetCustomerIdChange(Change): + """Change triggered by the following update actions: + + - [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) on Orders. + - [Set Customer ID](ctp:api:type:StagedOrderSetCustomerIdAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCustomerIdChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetCustomerIdChange": + from ._schemas.change import SetCustomerIdChangeSchema + + return SetCustomerIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomerIdChangeSchema + + return SetCustomerIdChangeSchema().dump(self) + + +class SetCustomerNumberChange(Change): + """Change triggered by the [Set Customer Number](ctp:api:type:CustomerSetCustomerNumberAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetCustomerNumberChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCustomerNumberChange": + from ._schemas.change import SetCustomerNumberChangeSchema + + return SetCustomerNumberChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetCustomerNumberChangeSchema + + return SetCustomerNumberChangeSchema().dump(self) + + +class SetDateOfBirthChange(Change): + """Change triggered by the [Set Date of Birth](ctp:api:type:CustomerSetDateOfBirthAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetDateOfBirthChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetDateOfBirthChange": + from ._schemas.change import SetDateOfBirthChangeSchema + + return SetDateOfBirthChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDateOfBirthChangeSchema + + return SetDateOfBirthChangeSchema().dump(self) + + +class SetDefaultBillingAddressChange(Change): + """Change triggered by the [Set Default Billing Address](ctp:api:type:CustomerSetDefaultBillingAddressAction) update action.""" + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetDefaultBillingAddressChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetDefaultBillingAddressChange": + from ._schemas.change import SetDefaultBillingAddressChangeSchema + + return SetDefaultBillingAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDefaultBillingAddressChangeSchema + + return SetDefaultBillingAddressChangeSchema().dump(self) + + +class SetDefaultShippingAddressChange(Change): + """Change triggered by the [Set Default Shipping Address](ctp:api:type:CustomerSetDefaultShippingAddressAction) update action.""" + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetDefaultShippingAddressChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetDefaultShippingAddressChange": + from ._schemas.change import SetDefaultShippingAddressChangeSchema + + return SetDefaultShippingAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDefaultShippingAddressChangeSchema + + return SetDefaultShippingAddressChangeSchema().dump(self) + + +class SetDeleteDaysAfterLastModificationChange(Change): + """Change triggered by the [Set DeleteDaysAfterLastModification](ctp:api:type:ShoppingListSetDeleteDaysAfterLastModificationAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + + def __init__(self, *, change: str, previous_value: int, next_value: int): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetDeleteDaysAfterLastModificationChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetDeleteDaysAfterLastModificationChange": + from ._schemas.change import SetDeleteDaysAfterLastModificationChangeSchema + + return SetDeleteDaysAfterLastModificationChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDeleteDaysAfterLastModificationChangeSchema + + return SetDeleteDaysAfterLastModificationChangeSchema().dump(self) + + +class SetDeliveryAddressChange(Change): + """Change triggered by the following update actions: + + - [Set DeliveryAddress](ctp:api:type:OrderSetDeliveryAddressAction) on Orders. + - [Set DeliveryAddress](ctp:api:type:StagedOrderSetDeliveryAddressAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + #: `id` of the updated [Delivery](ctp:api:type:Delivery). + delivery_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Address", + next_value: "Address", + delivery_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.delivery_id = delivery_id + + super().__init__(change=change, type="SetDeliveryAddressChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetDeliveryAddressChange": + from ._schemas.change import SetDeliveryAddressChangeSchema + + return SetDeliveryAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDeliveryAddressChangeSchema + + return SetDeliveryAddressChangeSchema().dump(self) + + +class SetDeliveryItemsChange(Change): + """Change triggered by the following update actions: + + - [Set Delivery Items](ctp:api:type:OrderSetDeliveryItemsAction) on Orders. + - [Set Delivery Items](ctp:api:type:StagedOrderSetDeliveryItemsAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: typing.List["DeliveryItem"] + #: Value after the change. + next_value: typing.List["DeliveryItem"] + #: `id` of the updated [Delivery](ctp:api:type:Delivery). + delivery_id: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["DeliveryItem"], + next_value: typing.List["DeliveryItem"], + delivery_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.delivery_id = delivery_id + + super().__init__(change=change, type="SetDeliveryItemsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetDeliveryItemsChange": + from ._schemas.change import SetDeliveryItemsChangeSchema + + return SetDeliveryItemsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDeliveryItemsChangeSchema + + return SetDeliveryItemsChangeSchema().dump(self) + + +class SetDescriptionChange(Change): + """Change triggered by the following update actions: + + - [Set Description](ctp:api:type:TaxCategorySetDescriptionAction) on Tax Categories. + - [Set Description](ctp:api:type:ZoneSetDescriptionAction) on Zones. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetDescriptionChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetDescriptionChange": + from ._schemas.change import SetDescriptionChangeSchema + + return SetDescriptionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDescriptionChangeSchema + + return SetDescriptionChangeSchema().dump(self) + + +class SetDiscountedPriceChange(Change): + """Change triggered by the [Set Discounted Embedded Price](ctp:api:type:ProductSetDiscountedPriceAction) update action.""" + + #: Value before the change. + previous_value: "Price" + #: Value after the change. + next_value: "Price" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + #: `sku` or `key` of the updated [ProductVariant](ctp:api:type:ProductVariant). + variant: str + #: `id` of the Embedded [Price](ctp:api:type:Price). + price_id: str + + def __init__( + self, + *, + change: str, + previous_value: "Price", + next_value: "Price", + catalog_data: str, + variant: str, + price_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + self.variant = variant + self.price_id = price_id + + super().__init__(change=change, type="SetDiscountedPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetDiscountedPriceChange": + from ._schemas.change import SetDiscountedPriceChangeSchema + + return SetDiscountedPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDiscountedPriceChangeSchema + + return SetDiscountedPriceChangeSchema().dump(self) + + +class SetDistributionChannelsChange(Change): + """Change triggered by the [Set Distribution Channels](ctp:api:type:StoreSetDistributionChannelsAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Reference"] + #: Value after the change. + next_value: typing.List["Reference"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reference"], + next_value: typing.List["Reference"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetDistributionChannelsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetDistributionChannelsChange": + from ._schemas.change import SetDistributionChannelsChangeSchema + + return SetDistributionChannelsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetDistributionChannelsChangeSchema + + return SetDistributionChannelsChangeSchema().dump(self) + + +class SetExpectedDeliveryChange(Change): + """Change triggered by the [Set ExpectedDelivery](ctp:api:type:InventoryEntrySetExpectedDeliveryAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetExpectedDeliveryChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetExpectedDeliveryChange": + from ._schemas.change import SetExpectedDeliveryChangeSchema + + return SetExpectedDeliveryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetExpectedDeliveryChangeSchema + + return SetExpectedDeliveryChangeSchema().dump(self) + + +class SetExternalIdChange(Change): + """Change triggered by the following update actions: + + - [Set External ID](ctp:api:type:CategorySetExternalIdAction) on Categories. + - [Set External ID](ctp:api:type:CustomerSetExternalIdAction) on Customers. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetExternalIdChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetExternalIdChange": + from ._schemas.change import SetExternalIdChangeSchema + + return SetExternalIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetExternalIdChangeSchema + + return SetExternalIdChangeSchema().dump(self) + + +class SetFirstNameChange(Change): + """Change triggered by the [Set First Name](ctp:api:type:CustomerSetFirstNameAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetFirstNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetFirstNameChange": + from ._schemas.change import SetFirstNameChangeSchema + + return SetFirstNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetFirstNameChangeSchema + + return SetFirstNameChangeSchema().dump(self) + + +class SetGeoLocationChange(Change): + """Change triggered by the [Set GeoLocation](ctp:api:type:ChannelSetGeoLocationAction) update action.""" + + #: Value before the change. + previous_value: "GeoLocation" + #: Value after the change. + next_value: "GeoLocation" + + def __init__( + self, *, change: str, previous_value: "GeoLocation", next_value: "GeoLocation" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetGeoLocationChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetGeoLocationChange": + from ._schemas.change import SetGeoLocationChangeSchema + + return SetGeoLocationChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetGeoLocationChangeSchema + + return SetGeoLocationChangeSchema().dump(self) + + +class SetImageLabelChange(Change): + """Change triggered by the [Set Image Label](ctp:api:type:ProductSetImageLabelAction) update action.""" + + #: Value before the change. + previous_value: "Image" + #: Value after the change. + next_value: "Image" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "Image", + next_value: "Image", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="SetImageLabelChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetImageLabelChange": + from ._schemas.change import SetImageLabelChangeSchema + + return SetImageLabelChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetImageLabelChangeSchema + + return SetImageLabelChangeSchema().dump(self) + + +class SetInputTipChange(Change): + """Change triggered by the [Set AttributeDefinition InputTip](ctp:api:type:ProductTypeSetInputTipAction) update action.""" + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Name of the updated [AttributeDefinition](ctp:api:type:AttributeDefinition). + attribute_name: str + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + attribute_name: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.attribute_name = attribute_name + + super().__init__(change=change, type="SetInputTipChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetInputTipChange": + from ._schemas.change import SetInputTipChangeSchema + + return SetInputTipChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetInputTipChangeSchema + + return SetInputTipChangeSchema().dump(self) + + +class SetInterfaceIdChange(Change): + """Change triggered by the [Set InterfaceId](ctp:api:type:PaymentSetInterfaceIdAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetInterfaceIdChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetInterfaceIdChange": + from ._schemas.change import SetInterfaceIdChangeSchema + + return SetInterfaceIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetInterfaceIdChangeSchema + + return SetInterfaceIdChangeSchema().dump(self) + + +class SetIsValidChange(Change): + """Change triggered automatically due to a user-initiated change.""" + + #: Value before the change. + previous_value: bool + #: Value after the change. + next_value: bool + + def __init__(self, *, change: str, previous_value: bool, next_value: bool): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetIsValidChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetIsValidChange": + from ._schemas.change import SetIsValidChangeSchema + + return SetIsValidChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetIsValidChangeSchema + + return SetIsValidChangeSchema().dump(self) + + +class SetKeyChange(Change): + """Change triggered by the following update actions: + + - [Set Key](ctp:api:type:CartDiscountSetKeyAction) on Cart Discounts. + - [Set Key](ctp:api:type:CategorySetKeyAction) on Categories. + - [Set Key](ctp:api:type:CustomerSetKeyAction) on Customers. + - [Set Key](ctp:api:type:CustomerGroupSetKeyAction) on Customer Groups. + - [Set Key](ctp:api:type:PaymentSetKeyAction) on Payments. + - [Set Key](ctp:api:type:ProductSetKeyAction) on Products. + - [Set Key](ctp:api:type:ProductDiscountSetKeyAction) on Product Discounts. + - [Set Key](ctp:api:type:ProductSelectionSetKeyAction) on Product Selections. + - [Set Key](ctp:api:type:ProductTypeSetKeyAction) on Product Types. + - [Set Key](ctp:api:type:ReviewSetKeyAction) on Reviews. + - [Set Key](ctp:api:type:ShoppingListSetKeyAction) on Shopping Lists. + - [Set Key](ctp:api:type:ZoneSetKeyAction) on Zones. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetKeyChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetKeyChange": + from ._schemas.change import SetKeyChangeSchema + + return SetKeyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetKeyChangeSchema + + return SetKeyChangeSchema().dump(self) + + +class SetLanguagesChange(Change): + """Change triggered by [Set Languages](ctp:api:type:StoreSetLanguagesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["str"] + #: Value after the change. + next_value: typing.List["str"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["str"], + next_value: typing.List["str"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetLanguagesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetLanguagesChange": + from ._schemas.change import SetLanguagesChangeSchema + + return SetLanguagesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLanguagesChangeSchema + + return SetLanguagesChangeSchema().dump(self) + + +class SetLastNameChange(Change): + """Change triggered by [Set Last Name](ctp:api:type:CustomerSetLastNameAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetLastNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetLastNameChange": + from ._schemas.change import SetLastNameChangeSchema + + return SetLastNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLastNameChangeSchema + + return SetLastNameChangeSchema().dump(self) + + +class SetLineItemDeactivatedAtChange(Change): + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: Holds information about the updated Shopping List Line Item. + line_item: "ShoppingListLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: str, + next_value: str, + line_item: "ShoppingListLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + + super().__init__(change=change, type="SetLineItemDeactivatedAtChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemDeactivatedAtChange": + from ._schemas.change import SetLineItemDeactivatedAtChangeSchema + + return SetLineItemDeactivatedAtChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemDeactivatedAtChangeSchema + + return SetLineItemDeactivatedAtChangeSchema().dump(self) + + +class SetLineItemDiscountedPriceChange(Change): + #: Value before the change. + previous_value: "DiscountedLineItemPrice" + #: Value after the change. + next_value: "DiscountedLineItemPrice" + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the updated [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: "DiscountedLineItemPrice", + next_value: "DiscountedLineItemPrice", + line_item: "LocalizedString", + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.variant = variant + + super().__init__(change=change, type="SetLineItemDiscountedPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemDiscountedPriceChange": + from ._schemas.change import SetLineItemDiscountedPriceChangeSchema + + return SetLineItemDiscountedPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemDiscountedPriceChangeSchema + + return SetLineItemDiscountedPriceChangeSchema().dump(self) + + +class SetLineItemDiscountedPricePerQuantityChange(Change): + #: Value before the change. + previous_value: "DiscountedLineItemPriceForQuantity" + #: Value after the change. + next_value: "DiscountedLineItemPriceForQuantity" + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the updated [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: "DiscountedLineItemPriceForQuantity", + next_value: "DiscountedLineItemPriceForQuantity", + line_item: "LocalizedString", + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.variant = variant + + super().__init__( + change=change, type="SetLineItemDiscountedPricePerQuantityChange" + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemDiscountedPricePerQuantityChange": + from ._schemas.change import SetLineItemDiscountedPricePerQuantityChangeSchema + + return SetLineItemDiscountedPricePerQuantityChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemDiscountedPricePerQuantityChangeSchema + + return SetLineItemDiscountedPricePerQuantityChangeSchema().dump(self) + + +class SetLineItemDistributionChannelChange(Change): + """Change triggered by the [Set LineItem DistributionChannel](ctp:api:type:StagedOrderSetLineItemDistributionChannelAction) update action.""" + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the updated [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: "Reference", + next_value: "Reference", + line_item: "LocalizedString", + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.variant = variant + + super().__init__(change=change, type="SetLineItemDistributionChannelChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemDistributionChannelChange": + from ._schemas.change import SetLineItemDistributionChannelChangeSchema + + return SetLineItemDistributionChannelChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemDistributionChannelChangeSchema + + return SetLineItemDistributionChannelChangeSchema().dump(self) + + +class SetLineItemPriceChange(Change): + """Change triggered by the [Set LineItem Price](ctp:api:type:StagedOrderSetLineItemPriceAction) update action.""" + + #: Value before the change. + previous_value: "Price" + #: Value after the change. + next_value: "Price" + #: Name of the [Product](ctp:api:type:Product) the updated Line Item is based on. + line_item: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "Price", + next_value: "Price", + line_item: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + + super().__init__(change=change, type="SetLineItemPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemPriceChange": + from ._schemas.change import SetLineItemPriceChangeSchema + + return SetLineItemPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemPriceChangeSchema + + return SetLineItemPriceChangeSchema().dump(self) + + +class SetLineItemProductKeyChange(Change): + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `id` of the updated [LineItem](ctp:api:type:LineItem). + line_item_id: str + #: `sku` or `key` of the updated [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: str, + next_value: str, + line_item: "LocalizedString", + line_item_id: str, + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.line_item_id = line_item_id + self.variant = variant + + super().__init__(change=change, type="SetLineItemProductKeyChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemProductKeyChange": + from ._schemas.change import SetLineItemProductKeyChangeSchema + + return SetLineItemProductKeyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemProductKeyChangeSchema + + return SetLineItemProductKeyChangeSchema().dump(self) + + +class SetLineItemProductSlugChange(Change): + """Change triggered automatically due to a user-initiated change.""" + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Name of the [Product](ctp:api:type:Product) the updated Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the updated [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + line_item: "LocalizedString", + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.variant = variant + + super().__init__(change=change, type="SetLineItemProductSlugChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemProductSlugChange": + from ._schemas.change import SetLineItemProductSlugChangeSchema + + return SetLineItemProductSlugChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemProductSlugChangeSchema + + return SetLineItemProductSlugChangeSchema().dump(self) + + +class SetLineItemShippingDetailsChange(Change): + """Change triggered by the following update actions: + + - [Set LineItem ShippingDetails](ctp:api:type:OrderSetLineItemShippingDetailsAction) on Orders. + - [Set LineItem ShippingDetails](ctp:api:type:StagedOrderSetLineItemShippingDetailsAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "ItemShippingDetails" + #: Value after the change. + next_value: "ItemShippingDetails" + #: `id` of the updated [LineItem](ctp:api:type:LineItem). + line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "ItemShippingDetails", + next_value: "ItemShippingDetails", + line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item_id = line_item_id + + super().__init__(change=change, type="SetLineItemShippingDetailsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemShippingDetailsChange": + from ._schemas.change import SetLineItemShippingDetailsChangeSchema + + return SetLineItemShippingDetailsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemShippingDetailsChangeSchema + + return SetLineItemShippingDetailsChangeSchema().dump(self) + + +class SetLineItemTaxAmountChange(Change): + """Change triggered by the [Set LineItem TaxAmount](ctp:api:type:StagedOrderSetLineItemTaxAmountAction) update action.""" + + #: Value before the change. + previous_value: "TaxRate" + #: Value after the change. + next_value: "TaxRate" + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the [ProductVariant](ctp:api:type:ProductVariant). + variant: str + #: `"ExternalAmount"` + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "TaxRate", + next_value: "TaxRate", + line_item: "LocalizedString", + variant: str, + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.variant = variant + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetLineItemTaxAmountChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemTaxAmountChange": + from ._schemas.change import SetLineItemTaxAmountChangeSchema + + return SetLineItemTaxAmountChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemTaxAmountChangeSchema + + return SetLineItemTaxAmountChangeSchema().dump(self) + + +class SetLineItemTaxRateChange(Change): + """Change triggered by the [Set LineItemTaxRate](ctp:api:type:StagedOrderSetLineItemTaxRateAction) update action.""" + + #: Value before the change. + previous_value: "TaxRate" + #: Value after the change. + next_value: "TaxRate" + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the [ProductVariant](ctp:api:type:ProductVariant). + variant: str + #: `"External"` + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "TaxRate", + next_value: "TaxRate", + line_item: "LocalizedString", + variant: str, + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.variant = variant + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetLineItemTaxRateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemTaxRateChange": + from ._schemas.change import SetLineItemTaxRateChangeSchema + + return SetLineItemTaxRateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemTaxRateChangeSchema + + return SetLineItemTaxRateChangeSchema().dump(self) + + +class SetLineItemTaxedPriceChange(Change): + #: Value before the change. + previous_value: "TaxedItemPrice" + #: Value after the change. + next_value: "TaxedItemPrice" + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `id` of the updated [LineItem](ctp:api:type:LineItem). + line_item_id: str + + def __init__( + self, + *, + change: str, + previous_value: "TaxedItemPrice", + next_value: "TaxedItemPrice", + line_item: "LocalizedString", + line_item_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.line_item_id = line_item_id + + super().__init__(change=change, type="SetLineItemTaxedPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemTaxedPriceChange": + from ._schemas.change import SetLineItemTaxedPriceChangeSchema + + return SetLineItemTaxedPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemTaxedPriceChangeSchema + + return SetLineItemTaxedPriceChangeSchema().dump(self) + + +class SetLineItemTotalPriceChange(Change): + """Change triggered by the [Set LineItemTotalPrice](ctp:api:type:StagedOrderSetLineItemTotalPriceAction) update action.""" + + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + #: Name of the [Product](ctp:api:type:Product) the updated Line Item is based on. + line_item: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "Money", + next_value: "Money", + line_item: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + + super().__init__(change=change, type="SetLineItemTotalPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLineItemTotalPriceChange": + from ._schemas.change import SetLineItemTotalPriceChangeSchema + + return SetLineItemTotalPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLineItemTotalPriceChangeSchema + + return SetLineItemTotalPriceChangeSchema().dump(self) + + +class SetLocaleChange(Change): + """Change triggered by the following update actions: + + - [Set Locale](ctp:api:type:CustomerSetLocaleAction) on Customers. + - [Set Locale](ctp:api:type:OrderSetLocaleAction) on Orders. + - [Set Locale](ctp:api:type:StagedOrderSetLocaleAction) on Staged Orders. + - [Set Locale](ctp:api:type:ReviewSetLocaleAction) on Reviews. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetLocaleChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetLocaleChange": + from ._schemas.change import SetLocaleChangeSchema + + return SetLocaleChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLocaleChangeSchema + + return SetLocaleChangeSchema().dump(self) + + +class SetLocalizedDescriptionChange(Change): + """Change triggered by the following update actions: + + - [Set Description](ctp:api:type:CartDiscountSetDescriptionAction) on Cart Discounts. + - [Set Description](ctp:api:type:CategorySetDescriptionAction) on Categories. + - [Set Description](ctp:api:type:DiscountCodeSetDescriptionAction) on Discount Codes. + - [Set Description](ctp:api:type:ProductSetDescriptionAction) on Products. + - [Set Description](ctp:api:type:ProductDiscountSetDescriptionAction) on Product Discounts. + - [Set Description](ctp:api:type:ShoppingListSetDescriptionAction) on Shopping Lists. + - [Set Description](ctp:api:type:StateSetDescriptionAction) on States. + - [Set Description](ctp:api:type:TypeSetDescriptionAction) on Types. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetLocalizedDescriptionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLocalizedDescriptionChange": + from ._schemas.change import SetLocalizedDescriptionChangeSchema + + return SetLocalizedDescriptionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLocalizedDescriptionChangeSchema + + return SetLocalizedDescriptionChangeSchema().dump(self) + + +class SetMaxApplicationsChange(Change): + """Change triggered by the [Set Max Applications](ctp:api:type:DiscountCodeSetMaxApplicationsAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + + def __init__(self, *, change: str, previous_value: int, next_value: int): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMaxApplicationsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetMaxApplicationsChange": + from ._schemas.change import SetMaxApplicationsChangeSchema + + return SetMaxApplicationsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMaxApplicationsChangeSchema + + return SetMaxApplicationsChangeSchema().dump(self) + + +class SetMaxApplicationsPerCustomerChange(Change): + """Change triggered by the [Set Max Applications Per Customer](ctp:api:type:DiscountCodeSetMaxApplicationsPerCustomerAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + + def __init__(self, *, change: str, previous_value: int, next_value: int): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMaxApplicationsPerCustomerChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetMaxApplicationsPerCustomerChange": + from ._schemas.change import SetMaxApplicationsPerCustomerChangeSchema + + return SetMaxApplicationsPerCustomerChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMaxApplicationsPerCustomerChangeSchema + + return SetMaxApplicationsPerCustomerChangeSchema().dump(self) + + +class SetMetaDescriptionChange(Change): + """Change triggered by the following update actions: + + - [Set Meta Description](ctp:api:type:CategorySetMetaDescriptionAction) on Categories. + - [Set Meta Description](ctp:api:type:ProductSetMetaDescriptionAction) on Products. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMetaDescriptionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetMetaDescriptionChange": + from ._schemas.change import SetMetaDescriptionChangeSchema + + return SetMetaDescriptionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMetaDescriptionChangeSchema + + return SetMetaDescriptionChangeSchema().dump(self) + + +class SetMetaKeywordsChange(Change): + """Change triggered by the following update actions: + + - [Set Meta Keywords](ctp:api:type:CategorySetMetaKeywordsAction) on Categories. + - [Set Meta Keywords](ctp:api:type:ProductSetMetaKeywordsAction) on Products. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMetaKeywordsChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetMetaKeywordsChange": + from ._schemas.change import SetMetaKeywordsChangeSchema + + return SetMetaKeywordsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMetaKeywordsChangeSchema + + return SetMetaKeywordsChangeSchema().dump(self) + + +class SetMetaTitleChange(Change): + """Change triggered by the following update actions: + + - [Set Meta Title](ctp:api:type:CategorySetMetaTitleAction) on Categories. + - [Set Meta Title](ctp:api:type:ProductSetMetaTitleAction) on Products. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMetaTitleChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetMetaTitleChange": + from ._schemas.change import SetMetaTitleChangeSchema + + return SetMetaTitleChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMetaTitleChangeSchema + + return SetMetaTitleChangeSchema().dump(self) + + +class SetMethodInfoInterfaceChange(Change): + """Change triggered by the [Set MethodInfoInterface](ctp:api:type:PaymentSetMethodInfoInterfaceAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMethodInfoInterfaceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetMethodInfoInterfaceChange": + from ._schemas.change import SetMethodInfoInterfaceChangeSchema + + return SetMethodInfoInterfaceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMethodInfoInterfaceChangeSchema + + return SetMethodInfoInterfaceChangeSchema().dump(self) + + +class SetMethodInfoMethodChange(Change): + """Change triggered by the [Set MethodInfoInterface](ctp:api:type:PaymentSetMethodInfoMethodAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMethodInfoMethodChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetMethodInfoMethodChange": + from ._schemas.change import SetMethodInfoMethodChangeSchema + + return SetMethodInfoMethodChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMethodInfoMethodChangeSchema + + return SetMethodInfoMethodChangeSchema().dump(self) + + +class SetMethodInfoNameChange(Change): + """Change triggered by the [Set MethodInfoName](ctp:api:type:PaymentSetMethodInfoNameAction) update action.""" + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMethodInfoNameChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetMethodInfoNameChange": + from ._schemas.change import SetMethodInfoNameChangeSchema + + return SetMethodInfoNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMethodInfoNameChangeSchema + + return SetMethodInfoNameChangeSchema().dump(self) + + +class SetMiddleNameChange(Change): + """Change triggered by the [Set Middle Name](ctp:api:type:CustomerSetMiddleNameAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetMiddleNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetMiddleNameChange": + from ._schemas.change import SetMiddleNameChangeSchema + + return SetMiddleNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetMiddleNameChangeSchema + + return SetMiddleNameChangeSchema().dump(self) + + +class SetNameChange(Change): + """Change triggered by the [Set Name](ctp:api:type:AssociateRoleSetNameAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetNameChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetNameChange": + from ._schemas.change import SetNameChangeSchema + + return SetNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetNameChangeSchema + + return SetNameChangeSchema().dump(self) + + +class SetLocalizedNameChange(Change): + """Change triggered by the following update actions: + + - [Set Name](ctp:api:type:DiscountCodeSetNameAction) on Discount Codes. + - [Set State Name](ctp:api:type:StateSetNameAction) on States. + - [Set Name](ctp:api:type:StoreSetNameAction) on Stores. + + """ + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetLocalizedNameChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetLocalizedNameChange": + from ._schemas.change import SetLocalizedNameChangeSchema + + return SetLocalizedNameChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetLocalizedNameChangeSchema + + return SetLocalizedNameChangeSchema().dump(self) + + +class SetOrderLineItemCustomFieldChange(Change): + """Change triggered by the following update actions: + + - [Set LineItem CustomField](ctp:api:type:OrderSetLineItemCustomFieldAction) on Orders. + - [Set LineItem CustomField](ctp:api:type:StagedOrderSetLineItemCustomFieldAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + #: `id` of the referenced [Type](ctp:api:type:Type). + custom_type_id: str + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: Name of the [Product](ctp:api:type:Product) the Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: typing.Any, + next_value: typing.Any, + custom_type_id: str, + name: str, + line_item: "LocalizedString", + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.custom_type_id = custom_type_id + self.name = name + self.line_item = line_item + self.variant = variant + + super().__init__(change=change, type="SetOrderLineItemCustomFieldChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetOrderLineItemCustomFieldChange": + from ._schemas.change import SetOrderLineItemCustomFieldChangeSchema + + return SetOrderLineItemCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetOrderLineItemCustomFieldChangeSchema + + return SetOrderLineItemCustomFieldChangeSchema().dump(self) + + +class SetOrderLineItemCustomTypeChange(Change): + """Change triggered by the following update actions: + + - [Set LineItem Custom Type](ctp:api:type:OrderSetLineItemCustomTypeAction) on Orders. + - [Set LineItem Custom Type](ctp:api:type:StagedOrderSetLineItemCustomTypeAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + #: Name of the [Product](ctp:api:type:Product) the updated Line Item is based on. + line_item: "LocalizedString" + #: `sku` or `key` of the [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: "CustomFields", + next_value: "CustomFields", + line_item: "LocalizedString", + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + self.variant = variant + + super().__init__(change=change, type="SetOrderLineItemCustomTypeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetOrderLineItemCustomTypeChange": + from ._schemas.change import SetOrderLineItemCustomTypeChangeSchema + + return SetOrderLineItemCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetOrderLineItemCustomTypeChangeSchema + + return SetOrderLineItemCustomTypeChangeSchema().dump(self) + + +class SetOrderNumberChange(Change): + """Change triggered by the following update actions: + + - [Set Order Number](ctp:api:type:OrderSetOrderNumberAction) on Orders. + - [Set Order Number](ctp:api:type:StagedOrderSetOrderNumberAction) on Staged Order. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetOrderNumberChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetOrderNumberChange": + from ._schemas.change import SetOrderNumberChangeSchema + + return SetOrderNumberChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetOrderNumberChangeSchema + + return SetOrderNumberChangeSchema().dump(self) + + +class SetOrderTaxedPriceChange(Change): + #: Value before the change. + previous_value: "TaxedItemPrice" + #: Value after the change. + next_value: "TaxedItemPrice" + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "TaxedItemPrice", + next_value: "TaxedItemPrice", + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetOrderTaxedPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetOrderTaxedPriceChange": + from ._schemas.change import SetOrderTaxedPriceChangeSchema + + return SetOrderTaxedPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetOrderTaxedPriceChangeSchema + + return SetOrderTaxedPriceChangeSchema().dump(self) + + +class SetOrderTotalPriceChange(Change): + """Change triggered automatically due to a user-initiated change.""" + + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + + def __init__(self, *, change: str, previous_value: "Money", next_value: "Money"): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetOrderTotalPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetOrderTotalPriceChange": + from ._schemas.change import SetOrderTotalPriceChangeSchema + + return SetOrderTotalPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetOrderTotalPriceChangeSchema + + return SetOrderTotalPriceChangeSchema().dump(self) + + +class SetOrderTotalTaxChange(Change): + """Change triggered by the [Set OrderTotalTax](ctp:api:type:StagedOrderSetOrderTotalTaxAction) update action.""" + + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + #: `"ExternalAmount"` + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "Money", + next_value: "Money", + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetOrderTotalTaxChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetOrderTotalTaxChange": + from ._schemas.change import SetOrderTotalTaxChangeSchema + + return SetOrderTotalTaxChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetOrderTotalTaxChangeSchema + + return SetOrderTotalTaxChangeSchema().dump(self) + + +class SetParcelItemsChange(Change): + """Change triggered by the following update actions: + + - [Set Parcel Items](ctp:api:type:OrderSetParcelItemsAction) on Orders. + - [Set Parcel Items](ctp:api:type:StagedOrderSetParcelItemsAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: typing.List["DeliveryItem"] + #: Value after the change. + next_value: typing.List["DeliveryItem"] + #: Information about the updated Parcel. + parcel: "ParcelChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: typing.List["DeliveryItem"], + next_value: typing.List["DeliveryItem"], + parcel: "ParcelChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.parcel = parcel + + super().__init__(change=change, type="SetParcelItemsChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetParcelItemsChange": + from ._schemas.change import SetParcelItemsChangeSchema + + return SetParcelItemsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetParcelItemsChangeSchema + + return SetParcelItemsChangeSchema().dump(self) + + +class SetParcelMeasurementsChange(Change): + """Change triggered by the following update actions: + + - [SetParcelMeasurements](ctp:api:type:OrderSetParcelMeasurementsAction) on Orders. + - [SetParcelMeasurements](ctp:api:type:StagedOrderSetParcelMeasurementsAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "ParcelMeasurements" + #: Value after the change. + next_value: "ParcelMeasurements" + #: Information about the updated Parcel. + parcel: "ParcelChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "ParcelMeasurements", + next_value: "ParcelMeasurements", + parcel: "ParcelChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.parcel = parcel + + super().__init__(change=change, type="SetParcelMeasurementsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetParcelMeasurementsChange": + from ._schemas.change import SetParcelMeasurementsChangeSchema + + return SetParcelMeasurementsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetParcelMeasurementsChangeSchema + + return SetParcelMeasurementsChangeSchema().dump(self) + + +class SetParcelTrackingDataChange(Change): + """Change triggered by the following update actions: + + - [Set Parcel Tracking Data](ctp:api:type:OrderSetParcelTrackingDataAction) on Orders. + - [Set Parcel Tracking Data](ctp:api:type:StagedOrderSetParcelTrackingDataAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "TrackingData" + #: Value after the change. + next_value: "TrackingData" + #: Information about the updated Parcel. + parcel: "ParcelChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "TrackingData", + next_value: "TrackingData", + parcel: "ParcelChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.parcel = parcel + + super().__init__(change=change, type="SetParcelTrackingDataChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetParcelTrackingDataChange": + from ._schemas.change import SetParcelTrackingDataChangeSchema + + return SetParcelTrackingDataChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetParcelTrackingDataChangeSchema + + return SetParcelTrackingDataChangeSchema().dump(self) + + +class SetPermissionsChange(Change): + """Change triggered by the [Set Permissions](ctp:api:type:AssociateRoleSetPermissionsAction), [Add Permission](ctp:api:type:AssociateRoleAddPermissionAction), and [Remove Permission](ctp:api:type:AssociateRoleRemovePermissionAction) update actions.""" + + #: Value before the change. + previous_value: typing.List["Permission"] + #: Value after the change. + next_value: typing.List["Permission"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Permission"], + next_value: typing.List["Permission"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetPermissionsChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetPermissionsChange": + from ._schemas.change import SetPermissionsChangeSchema + + return SetPermissionsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetPermissionsChangeSchema + + return SetPermissionsChangeSchema().dump(self) + + +class SetPricesChange(Change): + """Change triggered by the [Set Prices](ctp:api:type:ProductSetPricesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Price"] + #: Value after the change. + next_value: typing.List["Price"] + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + #: `sku` or `key` of the [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Price"], + next_value: typing.List["Price"], + catalog_data: str, + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + self.variant = variant + + super().__init__(change=change, type="SetPricesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetPricesChange": + from ._schemas.change import SetPricesChangeSchema + + return SetPricesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetPricesChangeSchema + + return SetPricesChangeSchema().dump(self) + + +class SetProductCountChange(Change): + """Change triggered automatically by the [Add Product](ctp:api:type:ProductSelectionAddProductAction) or [Remove Product](ctp:api:type:ProductSelectionRemoveProductAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + + def __init__(self, *, change: str, previous_value: int, next_value: int): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetProductCountChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetProductCountChange": + from ._schemas.change import SetProductCountChangeSchema + + return SetProductCountChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetProductCountChangeSchema + + return SetProductCountChangeSchema().dump(self) + + +class SetProductPriceCustomFieldChange(Change): + """Change triggered by the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action.""" + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "CustomFields", + next_value: "CustomFields", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="SetProductPriceCustomFieldChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetProductPriceCustomFieldChange": + from ._schemas.change import SetProductPriceCustomFieldChangeSchema + + return SetProductPriceCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetProductPriceCustomFieldChangeSchema + + return SetProductPriceCustomFieldChangeSchema().dump(self) + + +class SetProductPriceCustomTypeChange(Change): + """Change triggered by the [Set Price Custom Type](ctp:api:type:ProductSetProductPriceCustomTypeAction) update action.""" + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "CustomFields", + next_value: "CustomFields", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="SetProductPriceCustomTypeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetProductPriceCustomTypeChange": + from ._schemas.change import SetProductPriceCustomTypeChangeSchema + + return SetProductPriceCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetProductPriceCustomTypeChangeSchema + + return SetProductPriceCustomTypeChangeSchema().dump(self) + + +class SetProductSelectionsChange(Change): + """Change triggered by the [Set Product Selections](ctp:api:type:StoreSetProductSelectionsAction) update action.""" + + #: Value before the change. + previous_value: typing.List["ProductSelectionSetting"] + #: Value after the change. + next_value: typing.List["ProductSelectionSetting"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["ProductSelectionSetting"], + next_value: typing.List["ProductSelectionSetting"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetProductSelectionsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetProductSelectionsChange": + from ._schemas.change import SetProductSelectionsChangeSchema + + return SetProductSelectionsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetProductSelectionsChangeSchema + + return SetProductSelectionsChangeSchema().dump(self) + + +class SetProductVariantKeyChange(Change): + """Change triggered by the [Set ProductVariant Key](ctp:api:type:ProductSetProductVariantKeyAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, *, change: str, previous_value: str, next_value: str, catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="SetProductVariantKeyChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetProductVariantKeyChange": + from ._schemas.change import SetProductVariantKeyChangeSchema + + return SetProductVariantKeyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetProductVariantKeyChangeSchema + + return SetProductVariantKeyChangeSchema().dump(self) + + +class SetPropertyChange(Change): + """Change triggered by the [Update CustomObject](ctp:api:endpoint:/{projectKey}/custom-objects:POST) request when an existing property is updated.""" + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + #: Path to the property that was updated. + path: str + + def __init__( + self, + *, + change: str, + previous_value: typing.Any, + next_value: typing.Any, + path: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.path = path + + super().__init__(change=change, type="SetPropertyChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetPropertyChange": + from ._schemas.change import SetPropertyChangeSchema + + return SetPropertyChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetPropertyChangeSchema + + return SetPropertyChangeSchema().dump(self) + + +class SetPurchaseOrderNumberChange(Change): + """Change triggered by the following update actions: + + - [Set Purchase Order Number](ctp:api:type:OrderSetPurchaseOrderNumberAction) on Orders. + - [Set Purchase Order Number](ctp:api:type:StagedOrderSetPurchaseOrderNumberAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetPurchaseOrderNumberChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetPurchaseOrderNumberChange": + from ._schemas.change import SetPurchaseOrderNumberChangeSchema + + return SetPurchaseOrderNumberChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetPurchaseOrderNumberChangeSchema + + return SetPurchaseOrderNumberChangeSchema().dump(self) + + +class SetRatingChange(Change): + """Change triggered by the [Set Rating](ctp:api:type:ReviewSetRatingAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + + def __init__(self, *, change: str, previous_value: int, next_value: int): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetRatingChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetRatingChange": + from ._schemas.change import SetRatingChangeSchema + + return SetRatingChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetRatingChangeSchema + + return SetRatingChangeSchema().dump(self) + + +class SetReservationsChange(Change): + #: Value before the change. + previous_value: typing.List["Reservation"] + #: Value after the change. + next_value: typing.List["Reservation"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reservation"], + next_value: typing.List["Reservation"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetReservationsChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetReservationsChange": + from ._schemas.change import SetReservationsChangeSchema + + return SetReservationsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetReservationsChangeSchema + + return SetReservationsChangeSchema().dump(self) + + +class SetRestockableInDaysChange(Change): + """Change triggered by the [Set RestockableInDays](ctp:api:type:InventoryEntrySetRestockableInDaysAction) update action.""" + + #: Value before the change. + previous_value: int + #: Value after the change. + next_value: int + + def __init__(self, *, change: str, previous_value: int, next_value: int): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetRestockableInDaysChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetRestockableInDaysChange": + from ._schemas.change import SetRestockableInDaysChangeSchema + + return SetRestockableInDaysChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetRestockableInDaysChangeSchema + + return SetRestockableInDaysChangeSchema().dump(self) + + +class SetReturnPaymentStateChange(Change): + """Change triggered by the following update actions: + + - [Set PaymentShipmentState](ctp:api:type:OrderSetReturnPaymentStateAction) on Orders. + - [Set PaymentShipmentState](ctp:api:type:StagedOrderSetReturnPaymentStateAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "ReturnPaymentState" + #: Value after the change. + next_value: "ReturnPaymentState" + + def __init__( + self, + *, + change: str, + previous_value: "ReturnPaymentState", + next_value: "ReturnPaymentState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetReturnPaymentStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetReturnPaymentStateChange": + from ._schemas.change import SetReturnPaymentStateChangeSchema + + return SetReturnPaymentStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetReturnPaymentStateChangeSchema + + return SetReturnPaymentStateChangeSchema().dump(self) + + +class SetReturnShipmentStateChange(Change): + """Change triggered by the following update actions: + + - [Set ReturnShipmentState](ctp:api:type:OrderSetReturnShipmentStateAction) on Orders. + - [Set ReturnShipmentState](ctp:api:type:StagedOrderSetReturnShipmentStateAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "ReturnShipmentState" + #: Value after the change. + next_value: "ReturnShipmentState" + + def __init__( + self, + *, + change: str, + previous_value: "ReturnShipmentState", + next_value: "ReturnShipmentState" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetReturnShipmentStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetReturnShipmentStateChange": + from ._schemas.change import SetReturnShipmentStateChangeSchema + + return SetReturnShipmentStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetReturnShipmentStateChangeSchema + + return SetReturnShipmentStateChangeSchema().dump(self) + + +class SetSalutationChange(Change): + """Change triggered by the [Set Salutation](ctp:api:type:CustomerSetSalutationAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetSalutationChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetSalutationChange": + from ._schemas.change import SetSalutationChangeSchema + + return SetSalutationChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetSalutationChangeSchema + + return SetSalutationChangeSchema().dump(self) + + +class SetSearchKeywordsChange(Change): + """Change triggered by the [Set SearchKeywords](ctp:api:type:ProductSetSearchKeywordsAction) update action.""" + + #: Value before the change. + previous_value: "SearchKeywords" + #: Value after the change. + next_value: "SearchKeywords" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, + *, + change: str, + previous_value: "SearchKeywords", + next_value: "SearchKeywords", + catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="SetSearchKeywordsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetSearchKeywordsChange": + from ._schemas.change import SetSearchKeywordsChangeSchema + + return SetSearchKeywordsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetSearchKeywordsChangeSchema + + return SetSearchKeywordsChangeSchema().dump(self) + + +class SetSellerCommentChange(Change): + """Change triggered by the [Set Seller Comment](ctp:api:type:StagedQuoteSetSellerCommentAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetSellerCommentChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetSellerCommentChange": + from ._schemas.change import SetSellerCommentChangeSchema + + return SetSellerCommentChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetSellerCommentChangeSchema + + return SetSellerCommentChangeSchema().dump(self) + + +class SetShippingAddressChange(Change): + """Change triggered by the following update actions: + + - [Set Shipping Address](ctp:api:type:OrderSetShippingAddressAction) on Orders. + - [Set Shipping Address](ctp:api:type:StagedOrderSetShippingAddressAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: "Address" + #: Value after the change. + next_value: "Address" + + def __init__( + self, *, change: str, previous_value: "Address", next_value: "Address" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetShippingAddressChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingAddressChange": + from ._schemas.change import SetShippingAddressChangeSchema + + return SetShippingAddressChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingAddressChangeSchema + + return SetShippingAddressChangeSchema().dump(self) + + +class SetShippingInfoPriceChange(Change): + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + + def __init__(self, *, change: str, previous_value: "Money", next_value: "Money"): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetShippingInfoPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingInfoPriceChange": + from ._schemas.change import SetShippingInfoPriceChangeSchema + + return SetShippingInfoPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingInfoPriceChangeSchema + + return SetShippingInfoPriceChangeSchema().dump(self) + + +class SetShippingInfoTaxedPriceChange(Change): + #: Value before the change. + previous_value: "TaxedPrice" + #: Value after the change. + next_value: "TaxedPrice" + + def __init__( + self, *, change: str, previous_value: "TaxedPrice", next_value: "TaxedPrice" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetShippingInfoTaxedPriceChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingInfoTaxedPriceChange": + from ._schemas.change import SetShippingInfoTaxedPriceChangeSchema + + return SetShippingInfoTaxedPriceChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingInfoTaxedPriceChangeSchema + + return SetShippingInfoTaxedPriceChangeSchema().dump(self) + + +class SetShippingMethodChange(Change): + """Change triggered by the [Set ShippingMethod](ctp:api:type:StagedOrderSetShippingMethodAction) update action.""" + + #: Value before the change. + previous_value: "ShippingMethodChangeValue" + #: Value after the change. + next_value: "ShippingMethodChangeValue" + + def __init__( + self, + *, + change: str, + previous_value: "ShippingMethodChangeValue", + next_value: "ShippingMethodChangeValue" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetShippingMethodChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingMethodChange": + from ._schemas.change import SetShippingMethodChangeSchema + + return SetShippingMethodChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingMethodChangeSchema + + return SetShippingMethodChangeSchema().dump(self) + + +class SetShippingMethodTaxAmountChange(Change): + """Change triggered by the [Set ShippingMethod TaxAmount](ctp:api:type:StagedOrderSetShippingMethodTaxAmountAction) update action.""" + + #: Value before the change. + previous_value: "ShippingMethodTaxAmountChangeValue" + #: Value after the change. + next_value: "ShippingMethodTaxAmountChangeValue" + #: `"ExternalAmount"` + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "ShippingMethodTaxAmountChangeValue", + next_value: "ShippingMethodTaxAmountChangeValue", + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetShippingMethodTaxAmountChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingMethodTaxAmountChange": + from ._schemas.change import SetShippingMethodTaxAmountChangeSchema + + return SetShippingMethodTaxAmountChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingMethodTaxAmountChangeSchema + + return SetShippingMethodTaxAmountChangeSchema().dump(self) + + +class SetShippingMethodTaxRateChange(Change): + """Change triggered by the [Set ShippingMethod TaxRate](ctp:api:type:StagedOrderSetShippingMethodTaxRateAction) update action.""" + + #: Value before the change. + previous_value: "TaxRate" + #: Value after the change. + next_value: "TaxRate" + #: `"External"` + tax_mode: "TaxMode" + + def __init__( + self, + *, + change: str, + previous_value: "TaxRate", + next_value: "TaxRate", + tax_mode: "TaxMode" + ): + self.previous_value = previous_value + self.next_value = next_value + self.tax_mode = tax_mode + + super().__init__(change=change, type="SetShippingMethodTaxRateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingMethodTaxRateChange": + from ._schemas.change import SetShippingMethodTaxRateChangeSchema + + return SetShippingMethodTaxRateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingMethodTaxRateChangeSchema + + return SetShippingMethodTaxRateChangeSchema().dump(self) + + +class SetShippingRateChange(Change): + #: Value before the change. + previous_value: "Money" + #: Value after the change. + next_value: "Money" + + def __init__(self, *, change: str, previous_value: "Money", next_value: "Money"): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetShippingRateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetShippingRateChange": + from ._schemas.change import SetShippingRateChangeSchema + + return SetShippingRateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingRateChangeSchema + + return SetShippingRateChangeSchema().dump(self) + + +class SetShippingRateInputChange(Change): + """Change triggered by the [Set Shipping Rate Input](ctp:api:type:StagedOrderSetShippingRateInputAction) update action.""" + + #: Value before the change. + previous_value: typing.Union[ + "SetCartClassificationShippingRateInputValue", + "SetCartScoreShippingRateInputValue", + ] + #: Value after the change. + next_value: typing.Union[ + "SetCartClassificationShippingRateInputValue", + "SetCartScoreShippingRateInputValue", + ] + + def __init__( + self, + *, + change: str, + previous_value: typing.Union[ + "SetCartClassificationShippingRateInputValue", + "SetCartScoreShippingRateInputValue", + ], + next_value: typing.Union[ + "SetCartClassificationShippingRateInputValue", + "SetCartScoreShippingRateInputValue", + ] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetShippingRateInputChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShippingRateInputChange": + from ._schemas.change import SetShippingRateInputChangeSchema + + return SetShippingRateInputChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShippingRateInputChangeSchema + + return SetShippingRateInputChangeSchema().dump(self) + + +class SetShoppingListLineItemCustomFieldChange(Change): + """Change triggered by the [Set ShoppingListLineItem Custom Field](ctp:api:type:ShoppingListSetLineItemCustomFieldAction) update action.""" + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: `id` of the referenced [Type](ctp:api:type:Type). + custom_type_id: str + #: Holds information about the updated Shopping List Line Item. + line_item: "ShoppingListLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: typing.Any, + next_value: typing.Any, + name: str, + custom_type_id: str, + line_item: "ShoppingListLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.name = name + self.custom_type_id = custom_type_id + self.line_item = line_item + + super().__init__(change=change, type="SetShoppingListLineItemCustomFieldChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShoppingListLineItemCustomFieldChange": + from ._schemas.change import SetShoppingListLineItemCustomFieldChangeSchema + + return SetShoppingListLineItemCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShoppingListLineItemCustomFieldChangeSchema + + return SetShoppingListLineItemCustomFieldChangeSchema().dump(self) + + +class SetShoppingListLineItemCustomTypeChange(Change): + """Change triggered by the [Set ShoppingListLineItem Custom Type](ctp:api:type:ShoppingListSetLineItemCustomTypeAction) update action.""" + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + #: Holds information about the updated Shopping List Line Item. + line_item: "ShoppingListLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: "CustomFields", + next_value: "CustomFields", + line_item: "ShoppingListLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item = line_item + + super().__init__(change=change, type="SetShoppingListLineItemCustomTypeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetShoppingListLineItemCustomTypeChange": + from ._schemas.change import SetShoppingListLineItemCustomTypeChangeSchema + + return SetShoppingListLineItemCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetShoppingListLineItemCustomTypeChangeSchema + + return SetShoppingListLineItemCustomTypeChangeSchema().dump(self) + + +class SetSkuChange(Change): + """Change triggered by the [Set SKU](ctp:api:type:ProductSetSkuAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + + def __init__( + self, *, change: str, previous_value: str, next_value: str, catalog_data: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + + super().__init__(change=change, type="SetSkuChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetSkuChange": + from ._schemas.change import SetSkuChangeSchema + + return SetSkuChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetSkuChangeSchema + + return SetSkuChangeSchema().dump(self) + + +class SetSlugChange(Change): + """Change triggered by the [Set Slug](ctp:api:type:ShoppingListSetSlugAction) update action.""" + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetSlugChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetSlugChange": + from ._schemas.change import SetSlugChangeSchema + + return SetSlugChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetSlugChangeSchema + + return SetSlugChangeSchema().dump(self) + + +class SetStateRolesChange(Change): + """Change triggered by the [Set State roles](ctp:api:type:StateSetRolesAction) update action.""" + + #: Value before the change. + previous_value: typing.List["StateRoleEnum"] + #: Value after the change. + next_value: typing.List["StateRoleEnum"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["StateRoleEnum"], + next_value: typing.List["StateRoleEnum"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetStateRolesChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetStateRolesChange": + from ._schemas.change import SetStateRolesChangeSchema + + return SetStateRolesChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetStateRolesChangeSchema + + return SetStateRolesChangeSchema().dump(self) + + +class SetStatusInterfaceCodeChange(Change): + """Change triggered by the [Set StatusInterfaceCode](ctp:api:type:PaymentSetStatusInterfaceCodeAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetStatusInterfaceCodeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetStatusInterfaceCodeChange": + from ._schemas.change import SetStatusInterfaceCodeChangeSchema + + return SetStatusInterfaceCodeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetStatusInterfaceCodeChangeSchema + + return SetStatusInterfaceCodeChangeSchema().dump(self) + + +class SetStatusInterfaceTextChange(Change): + """Change triggered by the [Set StatusInterfaceText](ctp:api:type:PaymentSetStatusInterfaceTextAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetStatusInterfaceTextChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetStatusInterfaceTextChange": + from ._schemas.change import SetStatusInterfaceTextChangeSchema + + return SetStatusInterfaceTextChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetStatusInterfaceTextChangeSchema + + return SetStatusInterfaceTextChangeSchema().dump(self) + + +class SetStoreChange(Change): + """Change triggered by the following update actions: + + - [Set Store](ctp:api:type:OrderSetStoreAction) on Orders. + - [Set Store](ctp:api:type:ShoppingListSetStoreAction) on Shopping Lists. + + """ + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetStoreChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetStoreChange": + from ._schemas.change import SetStoreChangeSchema + + return SetStoreChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetStoreChangeSchema + + return SetStoreChangeSchema().dump(self) + + +class SetStoreModeChange(Change): + """Change triggered by the [Set Store Mode](ctp:api:type:BusinessUnitSetStoreModeAction) update action.""" + + #: Value before the change. + previous_value: "BusinessUnitStoreMode" + #: Value after the change. + next_value: "BusinessUnitStoreMode" + + def __init__( + self, + *, + change: str, + previous_value: "BusinessUnitStoreMode", + next_value: "BusinessUnitStoreMode" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetStoreModeChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetStoreModeChange": + from ._schemas.change import SetStoreModeChangeSchema + + return SetStoreModeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetStoreModeChangeSchema + + return SetStoreModeChangeSchema().dump(self) + + +class SetStoresChange(Change): + """Change triggered by the [Set Stores](ctp:api:type:CustomerSetStoresAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Reference"] + #: Value after the change. + next_value: typing.List["Reference"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reference"], + next_value: typing.List["Reference"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetStoresChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetStoresChange": + from ._schemas.change import SetStoresChangeSchema + + return SetStoresChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetStoresChangeSchema + + return SetStoresChangeSchema().dump(self) + + +class SetSupplyChannelChange(Change): + """Change triggered by the [Set SupplyChannel](ctp:api:type:InventoryEntrySetSupplyChannelAction) update action.""" + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetSupplyChannelChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetSupplyChannelChange": + from ._schemas.change import SetSupplyChannelChangeSchema + + return SetSupplyChannelChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetSupplyChannelChangeSchema + + return SetSupplyChannelChangeSchema().dump(self) + + +class SetSupplyChannelsChange(Change): + """Change triggered by the [Set Supply Channels](ctp:api:type:StoreSetSupplyChannelsAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Reference"] + #: Value after the change. + next_value: typing.List["Reference"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reference"], + next_value: typing.List["Reference"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetSupplyChannelsChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetSupplyChannelsChange": + from ._schemas.change import SetSupplyChannelsChangeSchema + + return SetSupplyChannelsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetSupplyChannelsChangeSchema + + return SetSupplyChannelsChangeSchema().dump(self) + + +class SetTargetChange(Change): + """Change triggered by the [Set Target](ctp:api:type:ReviewSetTargetAction) update action.""" + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetTargetChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetTargetChange": + from ._schemas.change import SetTargetChangeSchema + + return SetTargetChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTargetChangeSchema + + return SetTargetChangeSchema().dump(self) + + +class SetTaxCategoryChange(Change): + """Change triggered by the [Set TaxCategory](ctp:api:type:ProductSetTaxCategoryAction) update action.""" + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetTaxCategoryChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetTaxCategoryChange": + from ._schemas.change import SetTaxCategoryChangeSchema + + return SetTaxCategoryChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTaxCategoryChangeSchema + + return SetTaxCategoryChangeSchema().dump(self) + + +class SetTextChange(Change): + """Change triggered by the [Set Text](ctp:api:type:ReviewSetTextAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetTextChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetTextChange": + from ._schemas.change import SetTextChangeSchema + + return SetTextChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTextChangeSchema + + return SetTextChangeSchema().dump(self) + + +class SetTextLineItemCustomFieldChange(Change): + """Change triggered by the [Set TextLineItem CustomField](ctp:api:type:ShoppingListSetTextLineItemCustomFieldAction) update action.""" + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: `id` of the referenced [Type](ctp:api:type:Type). + custom_type_id: str + #: Holds information about the updated Text Line Item. + text_line_item: "TextLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: typing.Any, + next_value: typing.Any, + name: str, + custom_type_id: str, + text_line_item: "TextLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.name = name + self.custom_type_id = custom_type_id + self.text_line_item = text_line_item + + super().__init__(change=change, type="SetTextLineItemCustomFieldChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetTextLineItemCustomFieldChange": + from ._schemas.change import SetTextLineItemCustomFieldChangeSchema + + return SetTextLineItemCustomFieldChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTextLineItemCustomFieldChangeSchema + + return SetTextLineItemCustomFieldChangeSchema().dump(self) + + +class SetTextLineItemCustomTypeChange(Change): + """Change triggered by the [Set TextLineItem Custom Type](ctp:api:type:ShoppingListSetTextLineItemCustomTypeAction) update action.""" + + #: Value before the change. + previous_value: "CustomFields" + #: Value after the change. + next_value: "CustomFields" + #: Holds information about the updated Text Line Item. + text_line_item: "TextLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: "CustomFields", + next_value: "CustomFields", + text_line_item: "TextLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.text_line_item = text_line_item + + super().__init__(change=change, type="SetTextLineItemCustomTypeChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetTextLineItemCustomTypeChange": + from ._schemas.change import SetTextLineItemCustomTypeChangeSchema + + return SetTextLineItemCustomTypeChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTextLineItemCustomTypeChangeSchema + + return SetTextLineItemCustomTypeChangeSchema().dump(self) + + +class SetTextLineItemDescriptionChange(Change): + """Change triggered by the [Set TextLineItem Description](ctp:api:type:ShoppingListSetTextLineItemDescriptionAction) update action.""" + + #: Value before the change. + previous_value: "LocalizedString" + #: Value after the change. + next_value: "LocalizedString" + #: Holds information about the updated Text Line Item. + text_line_item: "TextLineItemValue" + + def __init__( + self, + *, + change: str, + previous_value: "LocalizedString", + next_value: "LocalizedString", + text_line_item: "TextLineItemValue" + ): + self.previous_value = previous_value + self.next_value = next_value + self.text_line_item = text_line_item + + super().__init__(change=change, type="SetTextLineItemDescriptionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetTextLineItemDescriptionChange": + from ._schemas.change import SetTextLineItemDescriptionChangeSchema + + return SetTextLineItemDescriptionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTextLineItemDescriptionChangeSchema + + return SetTextLineItemDescriptionChangeSchema().dump(self) + + +class SetTitleChange(Change): + """Change triggered by the following update actions: + + - [Set Title](ctp:api:type:CustomerSetTitleAction) on Customers. + - [Set Title](ctp:api:type:ReviewSetTitleAction) on Reviews. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetTitleChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetTitleChange": + from ._schemas.change import SetTitleChangeSchema + + return SetTitleChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTitleChangeSchema + + return SetTitleChangeSchema().dump(self) + + +class SetTransitionsChange(Change): + """Change triggered by the [Set Transitions](ctp:api:type:StateSetTransitionsAction) update action.""" + + #: Value before the change. + previous_value: typing.List["Reference"] + #: Value after the change. + next_value: typing.List["Reference"] + + def __init__( + self, + *, + change: str, + previous_value: typing.List["Reference"], + next_value: typing.List["Reference"] + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetTransitionsChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetTransitionsChange": + from ._schemas.change import SetTransitionsChangeSchema + + return SetTransitionsChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetTransitionsChangeSchema + + return SetTransitionsChangeSchema().dump(self) + + +class SetValidFromAndUntilChange(Change): + """Change triggered by the following update actions: + + - [Set Valid From and Until](ctp:api:type:CartDiscountSetValidFromAndUntilAction) on Cart Discounts. + - [Set Valid From and Until](ctp:api:type:DiscountCodeSetValidFromAndUntilAction) on Discount Codes. + - [Set Valid From and Until](ctp:api:type:ProductDiscountSetValidFromAndUntilAction) on Product Discounts. + + """ + + #: Value before the change. + previous_value: "ValidFromAndUntilValue" + #: Value after the change. + next_value: "ValidFromAndUntilValue" + + def __init__( + self, + *, + change: str, + previous_value: "ValidFromAndUntilValue", + next_value: "ValidFromAndUntilValue" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetValidFromAndUntilChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetValidFromAndUntilChange": + from ._schemas.change import SetValidFromAndUntilChangeSchema + + return SetValidFromAndUntilChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetValidFromAndUntilChangeSchema + + return SetValidFromAndUntilChangeSchema().dump(self) + + +class SetValidFromChange(Change): + """Change triggered by the following update actions: + + - [Set Valid From](ctp:api:type:CartDiscountSetValidFromAction) on Cart Discounts. + - [Set Valid From](ctp:api:type:DiscountCodeSetValidFromAction) on Discount Codes. + - [Set Valid From](ctp:api:type:ProductDiscountSetValidFromAction) on Product Discounts. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetValidFromChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetValidFromChange": + from ._schemas.change import SetValidFromChangeSchema + + return SetValidFromChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetValidFromChangeSchema + + return SetValidFromChangeSchema().dump(self) + + +class SetValidToChange(Change): + """Change triggered by the [Set Valid To](ctp:api:type:StagedQuoteSetValidToAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetValidToChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetValidToChange": + from ._schemas.change import SetValidToChangeSchema + + return SetValidToChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetValidToChangeSchema + + return SetValidToChangeSchema().dump(self) + + +class SetValidUntilChange(Change): + """Change triggered by the following update actions: + + - [Set Valid Until](ctp:api:type:CartDiscountSetValidUntilAction) on Cart Discounts. + - [Set Valid Until](ctp:api:type:DiscountCodeSetValidUntilAction) on Discount Codes. + - [Set Valid Until](ctp:api:type:ProductDiscountSetValidUntilAction) on Product Discounts. + + """ + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetValidUntilChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetValidUntilChange": + from ._schemas.change import SetValidUntilChangeSchema + + return SetValidUntilChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetValidUntilChangeSchema + + return SetValidUntilChangeSchema().dump(self) + + +class SetValueChange(Change): + """Change triggered by the [Update CustomObject](ctp:api:endpoint:/{projectKey}/custom-objects:POST) request when a value of a property is updated.""" + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + + def __init__( + self, *, change: str, previous_value: typing.Any, next_value: typing.Any + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetValueChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetValueChange": + from ._schemas.change import SetValueChangeSchema + + return SetValueChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetValueChangeSchema + + return SetValueChangeSchema().dump(self) + + +class SetVariantAvailabilityChange(Change): + """Change triggered automatically when an [InventoryEntry](ctp:api:type:InventoryEntry) associated with a Product changes.""" + + #: Value before the change. + previous_value: "ProductVariantAvailability" + #: Value after the change. + next_value: "ProductVariantAvailability" + #: - `staged`, if the staged [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + #: - `current`, if the current [ProductCatalogData](ctp:api:type:ProductCatalogData) was updated. + catalog_data: str + #: `sku` or `key` of the [ProductVariant](ctp:api:type:ProductVariant). + variant: str + + def __init__( + self, + *, + change: str, + previous_value: "ProductVariantAvailability", + next_value: "ProductVariantAvailability", + catalog_data: str, + variant: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.catalog_data = catalog_data + self.variant = variant + + super().__init__(change=change, type="SetVariantAvailabilityChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetVariantAvailabilityChange": + from ._schemas.change import SetVariantAvailabilityChangeSchema + + return SetVariantAvailabilityChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetVariantAvailabilityChangeSchema + + return SetVariantAvailabilityChangeSchema().dump(self) + + +class SetVariantSelectionChange(Change): + """Change triggered by the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action.""" + + #: Value before the change. + previous_value: "ProductVariantSelection" + #: Value after the change. + next_value: "ProductVariantSelection" + #: Reference to the updated [Product](ctp:api:type:Product). + product: "Reference" + + def __init__( + self, + *, + change: str, + previous_value: "ProductVariantSelection", + next_value: "ProductVariantSelection", + product: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + self.product = product + + super().__init__(change=change, type="SetVariantSelectionChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetVariantSelectionChange": + from ._schemas.change import SetVariantSelectionChangeSchema + + return SetVariantSelectionChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetVariantSelectionChangeSchema + + return SetVariantSelectionChangeSchema().dump(self) + + +class SetVatIdChange(Change): + """Change triggered by the [Set Vat ID](ctp:api:type:CustomerSetVatIdAction) update action.""" + + #: Value before the change. + previous_value: str + #: Value after the change. + next_value: str + + def __init__(self, *, change: str, previous_value: str, next_value: str): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="SetVatIdChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SetVatIdChange": + from ._schemas.change import SetVatIdChangeSchema + + return SetVatIdChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import SetVatIdChangeSchema + + return SetVatIdChangeSchema().dump(self) + + +class TransitionCustomLineItemStateChange(Change): + """Change triggered by the following update actions: + + - [Change the state of CustomLineItem according to allowed transitions](ctp:api:type:OrderTransitionCustomLineItemStateAction) on Orders. + - [Change the state of CustomLineItem according to allowed transitions](ctp:api:type:StagedOrderTransitionCustomLineItemStateAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: typing.List["ItemState"] + #: Value after the change. + next_value: typing.List["ItemState"] + #: `id` of the updated [CustomLineItem](ctp:api:type:CustomLineItem). + line_item_id: str + #: `id` of the [State](ctp:api:type:State) involved in the transition. + state_id: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["ItemState"], + next_value: typing.List["ItemState"], + line_item_id: str, + state_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item_id = line_item_id + self.state_id = state_id + + super().__init__(change=change, type="TransitionCustomLineItemStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "TransitionCustomLineItemStateChange": + from ._schemas.change import TransitionCustomLineItemStateChangeSchema + + return TransitionCustomLineItemStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import TransitionCustomLineItemStateChangeSchema + + return TransitionCustomLineItemStateChangeSchema().dump(self) + + +class TransitionLineItemStateChange(Change): + """Change triggered by the following update actions: + + - [Change the state of LineItem according to allowed transitions](ctp:api:type:OrderTransitionLineItemStateAction) on Orders. + - [Change the state of LineItem according to allowed transitions](ctp:api:type:OrderTransitionLineItemStateAction) on Staged Orders. + + """ + + #: Value before the change. + previous_value: typing.List["ItemState"] + #: Value after the change. + next_value: typing.List["ItemState"] + #: `id` of the updated [LineItem](ctp:api:type:LineItem). + line_item_id: str + #: `id` of the [State](ctp:api:type:State) involved in the transition. + state_id: str + + def __init__( + self, + *, + change: str, + previous_value: typing.List["ItemState"], + next_value: typing.List["ItemState"], + line_item_id: str, + state_id: str + ): + self.previous_value = previous_value + self.next_value = next_value + self.line_item_id = line_item_id + self.state_id = state_id + + super().__init__(change=change, type="TransitionLineItemStateChange") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "TransitionLineItemStateChange": + from ._schemas.change import TransitionLineItemStateChangeSchema + + return TransitionLineItemStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import TransitionLineItemStateChangeSchema + + return TransitionLineItemStateChangeSchema().dump(self) + + +class TransitionStateChange(Change): + """Change triggered by the following update actions: + + - [Transition State](ctp:api:type:OrderTransitionStateAction) on Orders. + - [Transition State](ctp:api:type:StagedOrderTransitionStateAction) on Staged Orders. + - [Transition State](ctp:api:type:PaymentTransitionStateAction) on Payments. + - [Transition State](ctp:api:type:ProductTransitionStateAction) on Products. + - [Transition State](ctp:api:type:QuoteTransitionStateAction) on Quotes. + - [Transition State](ctp:api:type:StagedQuoteTransitionStateAction) on Staged Quotes. + - [Transition State](ctp:api:type:QuoteRequestTransitionStateAction) on Quote Requests. + - [Transition State](ctp:api:type:ReviewTransitionStateAction) on Reviews. + - [Transition State](ctp:api:type:StateSetTransitionsAction) on States. + + """ + + #: Value before the change. + previous_value: "Reference" + #: Value after the change. + next_value: "Reference" + + def __init__( + self, *, change: str, previous_value: "Reference", next_value: "Reference" + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="TransitionStateChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TransitionStateChange": + from ._schemas.change import TransitionStateChangeSchema + + return TransitionStateChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import TransitionStateChangeSchema + + return TransitionStateChangeSchema().dump(self) + + +class UnknownChange(Change): + """Change triggered when the format of changes on an entity is not identified by Audit Log.""" + + #: Value before the change. + previous_value: typing.Any + #: Value after the change. + next_value: typing.Any + + def __init__( + self, *, change: str, previous_value: typing.Any, next_value: typing.Any + ): + self.previous_value = previous_value + self.next_value = next_value + + super().__init__(change=change, type="UnknownChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "UnknownChange": + from ._schemas.change import UnknownChangeSchema + + return UnknownChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import UnknownChangeSchema + + return UnknownChangeSchema().dump(self) + + +class UnpublishChange(Change): + """Change triggered by the [Unpublish](ctp:api:type:ProductUnpublishAction) update action.""" + + def __init__(self, *, change: str): + + super().__init__(change=change, type="UnpublishChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "UnpublishChange": + from ._schemas.change import UnpublishChangeSchema + + return UnpublishChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import UnpublishChangeSchema + + return UnpublishChangeSchema().dump(self) + + +class UpdateSyncInfoChange(Change): + """Change triggered by the following update actions: + + - [Update SyncInfo](ctp:api:type:OrderUpdateSyncInfoAction) on Orders. + - [Update SyncInfo](ctp:api:type:StagedOrderUpdateSyncInfoAction) on Staged Orders. + + """ + + #: Value after the change. + next_value: "SyncInfo" + #: `id` of the updated [Channel](ctp:api:type:Channel). + channel_id: str + + def __init__(self, *, change: str, next_value: "SyncInfo", channel_id: str): + self.next_value = next_value + self.channel_id = channel_id + + super().__init__(change=change, type="UpdateSyncInfoChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "UpdateSyncInfoChange": + from ._schemas.change import UpdateSyncInfoChangeSchema + + return UpdateSyncInfoChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import UpdateSyncInfoChangeSchema + + return UpdateSyncInfoChangeSchema().dump(self) + + +class VerifyEmailChange(Change): + """Change triggered by a Customer email verification.""" + + def __init__(self, *, change: str): + + super().__init__(change=change, type="VerifyEmailChange") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "VerifyEmailChange": + from ._schemas.change import VerifyEmailChangeSchema + + return VerifyEmailChangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change import VerifyEmailChangeSchema + + return VerifyEmailChangeSchema().dump(self) diff --git a/src/commercetools/history/models/change_history.py b/src/commercetools/history/models/change_history.py new file mode 100644 index 00000000..8c3f4c91 --- /dev/null +++ b/src/commercetools/history/models/change_history.py @@ -0,0 +1,614 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +if typing.TYPE_CHECKING: + from .change import Change + from .common import KeyReference, Reference, ResourceIdentifier + from .label import Label + +__all__ = [ + "ChangeHistoryResourceType", + "DateStringFilter", + "ErrorObject", + "ErrorResponse", + "ModifiedBy", + "PlatformInitiatedChange", + "Record", + "RecordPagedQueryResponse", + "Source", + "UpdateType", +] + + +class Record(_BaseType): + """Captures the differences between the previous and next version of a resource. + + The maximum number of Records that can be stored and their retention period are subject to a [limit](/../api/limits#records). + + """ + + #: Version of the resource after the change. + #: + #: For more information on how the version is incremented, see [Optimistic Concurrency Control](/../api/general-concepts#optimistic-concurrency-control). + version: int + #: Version of the resource before the change. + previous_version: int + #: Indicates the type of change. + #: For creation, update, or deletion, the value is `"ResourceCreated"`, `"ResourceUpdated"`, or `"ResourceDeleted"` respectively. + type: str + #: Information about the user or API Client who performed the change. + modified_by: "ModifiedBy" + #: Date and time (UTC) the change was made. + modified_at: str + #: Information that describes the resource after the change. + label: "Label" + #: Information that describes the resource before the change. + previous_label: "Label" + #: Shows the differences in the resource between `previousVersion` and `version`. + #: + #: The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, [Optimistic Concurrency Control](/general-concepts#optimistic-concurrency-control)). + changes: typing.List["Change"] + #: ResourceIdentifier of the changed resource. + resource: "ResourceIdentifier" + #: References to the [Stores](ctp:api:type:Store) associated with the [Change](ctp:history:type:Change). + stores: typing.List["KeyReference"] + #: Reference to the [Business Unit](ctp:api:type:BusinessUnit) associated with the [Change](ctp:history:type:Change). + business_unit: typing.Optional["KeyReference"] + #: `true` if no change was detected. + #: + #: The version number of the resource can be increased even without any change in the resource. + without_changes: bool + + def __init__( + self, + *, + version: int, + previous_version: int, + type: str, + modified_by: "ModifiedBy", + modified_at: str, + label: "Label", + previous_label: "Label", + changes: typing.List["Change"], + resource: "ResourceIdentifier", + stores: typing.List["KeyReference"], + business_unit: typing.Optional["KeyReference"] = None, + without_changes: bool + ): + self.version = version + self.previous_version = previous_version + self.type = type + self.modified_by = modified_by + self.modified_at = modified_at + self.label = label + self.previous_label = previous_label + self.changes = changes + self.resource = resource + self.stores = stores + self.business_unit = business_unit + self.without_changes = without_changes + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Record": + from ._schemas.change_history import RecordSchema + + return RecordSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_history import RecordSchema + + return RecordSchema().dump(self) + + +class RecordPagedQueryResponse(_BaseType): + """[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with `results` containing an array of [Record](ctp:history:type:Record).""" + + #: Number of [results requested](/../api/general-concepts#limit). + limit: int + #: Actual number of results returned. + count: int + #: Total number of results matching the query. + #: This number is an estimation and not [strongly consistent](/../api/general-concepts#strong-consistency). + total: int + #: Number of [elements skipped](/../api/general-concepts#offset). + offset: int + #: Records matching the query. + results: typing.List["Record"] + + def __init__( + self, + *, + limit: int, + count: int, + total: int, + offset: int, + results: typing.List["Record"] + ): + self.limit = limit + self.count = count + self.total = total + self.offset = offset + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "RecordPagedQueryResponse": + from ._schemas.change_history import RecordPagedQueryResponseSchema + + return RecordPagedQueryResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_history import RecordPagedQueryResponseSchema + + return RecordPagedQueryResponseSchema().dump(self) + + +class ChangeHistoryResourceType(enum.Enum): + """This data type represents the supported resource types. + The value must be one of the following: + + """ + + ASSOCIATE_ROLE = "associate-role" + BUSINESS_UNIT = "business-unit" + CART_DISCOUNT = "cart-discount" + CATEGORY = "category" + CHANNEL = "channel" + CUSTOMER = "customer" + CUSTOMER_GROUP = "customer-group" + DISCOUNT_CODE = "discount-code" + INVENTORY_ENTRY = "inventory-entry" + KEY_VALUE_DOCUMENT = "key-value-document" + ORDER = "order" + PAYMENT = "payment" + PRODUCT = "product" + PRODUCT_DISCOUNT = "product-discount" + PRODUCT_SELECTION = "product-selection" + PRODUCT_TYPE = "product-type" + QUOTE_REQUEST = "quote-request" + QUOTE = "quote" + REVIEW = "review" + SHOPPING_LIST = "shopping-list" + STAGED_QUOTE = "staged-quote" + STATE = "state" + STORE = "store" + TAX_CATEGORY = "tax-category" + TYPE = "type" + ZONE = "zone" + + +class DateStringFilter(enum.Enum): + """This type consists of one enum value:""" + + NOW = "now" + + +class ErrorObject(_BaseType): + code: str + message: str + + def __init__(self, *, code: str, message: str): + self.code = code + self.message = message + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ErrorObject": + from ._schemas.change_history import ErrorObjectSchema + + return ErrorObjectSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_history import ErrorObjectSchema + + return ErrorObjectSchema().dump(self) + + +class ErrorResponse(_BaseType): + status_code: int + message: str + error: typing.Optional[str] + error_description: typing.Optional[str] + errors: typing.Optional[typing.List["ErrorObject"]] + + def __init__( + self, + *, + status_code: int, + message: str, + error: typing.Optional[str] = None, + error_description: typing.Optional[str] = None, + errors: typing.Optional[typing.List["ErrorObject"]] = None + ): + self.status_code = status_code + self.message = message + self.error = error + self.error_description = error_description + self.errors = errors + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ErrorResponse": + from ._schemas.change_history import ErrorResponseSchema + + return ErrorResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_history import ErrorResponseSchema + + return ErrorResponseSchema().dump(self) + + +class ModifiedBy(_BaseType): + """Information about the user or API Client who performed the change. This is a variant of [LastModifiedBy](ctp:api:type:LastModifiedBy).""" + + #: [ID](/general-concepts#identifier) of the Merchant Center user who made the change. + #: + #: Present only if the change was made in the Merchant Center. + id: str + #: Indicates who performed the change. + #: + #: - If the change was made by a user, the value is `"user"`. + #: - If the change was made by an API Client with or without an [external user ID](/general-concepts#external-user-ids), the value is `"external-user"`. + #: - If the change was made by an [Associate](ctp:api:type:Associate), the value is `"associate"`. + type: str + #: [ID](/general-concepts#identifier) of the [API Client](ctp:api:type:ApiClient) that made the change. + #: + #: Present only if the change was made using an API Client. + client_id: typing.Optional[str] + #: Present only if the change was made using a token from an [anonymous session](/authorization#tokens-for-anonymous-sessions). + anonymous_id: typing.Optional[str] + #: The [Customer](ctp:api:type:Customer) who made the change. + #: + #: Present only if the change was made using a token from the [password flow](/authorization#password-flow). + customer: typing.Optional["Reference"] + #: The [Associate](ctp:api:type:Associate) who made the change in the context of a [Business Unit](ctp:api:type:BusinessUnit). Present only if the Associate acts on behalf of a company using the [associate endpoints](/associates-overview#on-the-associate-endpoints). + associate: typing.Optional["Reference"] + #: `true` if the change was made using the Merchant Center or [ImpEx](https://impex.europe-west1.gcp.commercetools.com/). + is_platform_client: bool + + def __init__( + self, + *, + id: str, + type: str, + client_id: typing.Optional[str] = None, + anonymous_id: typing.Optional[str] = None, + customer: typing.Optional["Reference"] = None, + associate: typing.Optional["Reference"] = None, + is_platform_client: bool + ): + self.id = id + self.type = type + self.client_id = client_id + self.anonymous_id = anonymous_id + self.customer = customer + self.associate = associate + self.is_platform_client = is_platform_client + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ModifiedBy": + from ._schemas.change_history import ModifiedBySchema + + return ModifiedBySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_history import ModifiedBySchema + + return ModifiedBySchema().dump(self) + + +class PlatformInitiatedChange(enum.Enum): + """Updates that are triggered automatically as a result of a user-initiated change.""" + + EXCLUDE_ALL = "excludeAll" + CHANGE_LINE_ITEM_NAME = "changeLineItemName" + CHANGE_REVIEW_RATING_STATISTICS = "changeReviewRatingStatistics" + SET_APPLICATION_VERSION = "setApplicationVersion" + SET_IS_VALID = "setIsValid" + SET_VARIANT_AVAILABILITY = "setVariantAvailability" + + +class Source(enum.Enum): + """Values for the Source enumeration.""" + + MERCHANT_CENTER = "MerchantCenter" + IMP_EX = "ImpEx" + API_CLIENT = "ApiClient" + + +class UpdateType(enum.Enum): + ADD_ADDRESS = "addAddress" + ADD_ASSET = "addAsset" + ADD_ASSOCIATE = "addAssociate" + ADD_ATTRIBUTE_DEFINITION = "addAttributeDefinition" + ADD_BILLING_ADDRESS_ID = "addBillingAddressId" + ADD_CUSTOM_LINE_ITEM = "addCustomLineItem" + ADD_DELIVERY = "addDelivery" + ADD_DISCOUNT_CODE = "addDiscountCode" + ADD_ENUM_VALUE = "addEnumValue" + ADD_EXTERNAL_IMAGE = "addExternalImage" + ADD_FIELD_DEFINITION = "addFieldDefinition" + ADD_INTERFACE_INTERACTION = "addInterfaceInteraction" + ADD_ITEM_SHIPPING_ADDRESS = "addItemShippingAddress" + ADD_LINE_ITEM = "addLineItem" + ADD_LOCALIZED_ENUM_VALUE = "addLocalizedEnumValue" + ADD_LOCATION = "addLocation" + ADD_PARCEL_TO_DELIVERY = "addParcelToDelivery" + ADD_PAYMENT = "addPayment" + ADD_PLAIN_ENUM_VALUE = "addPlainEnumValue" + ADD_PRICE = "addPrice" + ADD_PRODUCT = "addProduct" + ADD_PRODUCT_SELECTION = "addProductSelection" + ADD_PROPERTY = "addProperty" + ADD_RETURN_INFO = "addReturnInfo" + ADD_ROLES = "addRoles" + ADD_SHIPPING_ADDRESS_ID = "addShippingAddressId" + ADD_TAX_RATE = "addTaxRate" + ADD_TEXT_LINE_ITEM = "addTextLineItem" + ADD_TO_CATEGORY = "addToCategory" + ADD_TRANSACTION = "addTransaction" + ADD_VARIANT = "addVariant" + CHANGE_ADDRESS = "changeAddress" + CHANGE_AMOUNT_AUTHORIZED = "changeAmountAuthorized" + CHANGE_AMOUNT_PLANNED = "changeAmountPlanned" + CHANGE_ASSET_NAME = "changeAssetName" + CHANGE_ASSET_ORDER = "changeAssetOrder" + CHANGE_ASSOCIATE = "changeAssociate" + CHANGE_ASSOCIATE_MODE = "changeAssociateMode" + CHANGE_ATTRIBUTE_CONSTRAINT = "changeAttributeConstraint" + CHANGE_ATTRIBUTE_NAME = "changeAttributeName" + CHANGE_ATTRIBUTE_ORDER_BY_NAME = "changeAttributeOrderByName" + CHANGE_CART_DISCOUNTS = "changeCartDiscounts" + CHANGE_CART_PREDICATE = "changeCartPredicate" + CHANGE_CUSTOM_LINE_ITEM_QUANTITY = "changeCustomLineItemQuantity" + CHANGE_DESCRIPTION = "changeDescription" + CHANGE_EMAIL = "changeEmail" + CHANGE_ENUM_KEY = "changeEnumKey" + CHANGE_ENUM_VALUE_LABEL = "changeEnumValueLabel" + CHANGE_ENUM_VALUE_ORDER = "changeEnumValueOrder" + CHANGE_FIELD_DEFINITION_ORDER = "changeFieldDefinitionOrder" + CHANGE_GROUPS = "changeGroups" + CHANGE_INITIAL = "changeInitial" + CHANGE_INPUT_HINT = "changeInputHint" + CHANGE_IS_ACTIVE = "changeIsActive" + CHANGE_IS_SEARCHABLE = "changeIsSearchable" + CHANGE_KEY = "changeKey" + CHANGE_LABEL = "changeLabel" + CHANGE_LINE_ITEM_NAME = "changeLineItemName" + CHANGE_LINE_ITEM_QUANTITY = "changeLineItemQuantity" + CHANGE_LINE_ITEMS_ORDER = "changeLineItemsOrder" + CHANGE_LOCALIZED_ENUM_VALUE_LABEL = "changeLocalizedEnumValueLabel" + CHANGE_LOCALIZED_ENUM_VALUE_ORDER = "changeLocalizedEnumValueOrder" + CHANGE_MASTER_VARIANT = "changeMasterVariant" + CHANGE_NAME = "changeName" + CHANGE_ORDER_HINT = "changeOrderHint" + CHANGE_ORDER_STATE = "changeOrderState" + CHANGE_PARENT = "changeParent" + CHANGE_PARENT_UNIT = "changeParentUnit" + CHANGE_PAYMENT_STATE = "changePaymentState" + CHANGE_PLAIN_ENUM_VALUE_LABEL = "changePlainEnumValueLabel" + CHANGE_PREDICATE = "changePredicate" + CHANGE_PRICE = "changePrice" + CHANGE_PRODUCT_SELECTION_ACTIVE = "changeProductSelectionActive" + CHANGE_QUANTITY = "changeQuantity" + CHANGE_QUOTE_REQUEST_STATE = "changeQuoteRequestState" + CHANGE_QUOTE_STATE = "changeQuoteState" + CHANGE_REQUIRES_DISCOUNT_CODE = "changeRequiresDiscountCode" + CHANGE_REVIEW_RATING_STATISTICS = "changeReviewRatingStatistics" + CHANGE_SHIPMENT_STATE = "changeShipmentState" + CHANGE_SLUG = "changeSlug" + CHANGE_SORT_ORDER = "changeSortOrder" + CHANGE_STACKING_MODE = "changeStackingMode" + CHANGE_STAGED_QUOTE_STATE = "changeStagedQuoteState" + CHANGE_STATUS = "changeStatus" + CHANGE_TARGET = "changeTarget" + CHANGE_TAX_CALCULATION_MODE = "changeTaxCalculationMode" + CHANGE_TAX_MODE = "changeTaxMode" + CHANGE_TAX_ROUNDING_MODE = "changeTaxRoundingMode" + CHANGE_TEXT_LINE_ITEM_NAME = "changeTextLineItemName" + CHANGE_TEXT_LINE_ITEM_QUANTITY = "changeTextLineItemQuantity" + CHANGE_TEXT_LINE_ITEMS_ORDER = "changeTextLineItemsOrder" + CHANGE_TRANSACTION_INTERACTION_ID = "changeTransactionInteractionId" + CHANGE_TRANSACTION_STATE = "changeTransactionState" + CHANGE_TRANSACTION_TIMESTAMP = "changeTransactionTimestamp" + CHANGE_TYPE = "changeType" + CHANGE_VALUE = "changeValue" + MOVE_IMAGE_TO_POSITION = "moveImageToPosition" + PUBLISH = "publish" + REMOVE_ADDRESS = "removeAddress" + REMOVE_ASSET = "removeAsset" + REMOVE_ASSOCIATE = "removeAssociate" + REMOVE_ATTRIBUTE_DEFINITION = "removeAttributeDefinition" + REMOVE_BILLING_ADDRESS_ID = "removeBillingAddressId" + REMOVE_CUSTOM_LINE_ITEM = "removeCustomLineItem" + REMOVE_DELIVERY = "removeDelivery" + REMOVE_DISCOUNT_CODE = "removeDiscountCode" + REMOVE_ENUM_VALUES = "removeEnumValues" + REMOVE_FIELD_DEFINITION = "removeFieldDefinition" + REMOVE_FROM_CATEGORY = "removeFromCategory" + REMOVE_IMAGE = "removeImage" + REMOVE_ITEM_SHIPPING_ADDRESS = "removeItemShippingAddress" + REMOVE_LINE_ITEM = "removeLineItem" + REMOVE_LOCATION = "removeLocation" + REMOVE_PARCEL_FROM_DELIVERY = "removeParcelFromDelivery" + REMOVE_PAYMENT = "removePayment" + REMOVE_PRICE = "removePrice" + REMOVE_PRODUCT = "removeProduct" + REMOVE_PRODUCT_SELECTION = "removeProductSelection" + REMOVE_PROPERTY = "removeProperty" + REMOVE_ROLES = "removeRoles" + REMOVE_SHIPPING_ADDRESS_ID = "removeShippingAddressId" + REMOVE_TAX_RATE = "removeTaxRate" + REMOVE_TEXT_LINE_ITEM = "removeTextLineItem" + REMOVE_VARIANT = "removeVariant" + REQUEST_QUOTE_RENEGOTIATION = "requestQuoteRenegotiation" + SET_ADDRESS = "setAddress" + SET_ADDRESS_CUSTOM_FIELD = "setAddressCustomField" + SET_ADDRESS_CUSTOM_TYPE = "setAddressCustomType" + SET_ANONYMOUS_ID = "setAnonymousId" + SET_APPLICATION_VERSION = "setApplicationVersion" + SET_ASSET_CUSTOM_FIELD = "setAssetCustomField" + SET_ASSET_CUSTOM_TYPE = "setAssetCustomType" + SET_ASSET_DESCRIPTION = "setAssetDescription" + SET_ASSET_SOURCES = "setAssetSources" + SET_ASSET_TAGS = "setAssetTags" + SET_ASSSET_KEY = "setAsssetKey" + SET_ATTRIBUTE = "setAttribute" + SET_AUTHENTICATION_MODE = "setAuthenticationMode" + SET_AUTHOR_NAME = "setAuthorName" + SET_BILLING_ADDRESS = "setBillingAddress" + SET_CART_PREDICATE = "setCartPredicate" + SET_CATEGORY_ORDER_HINT = "setCategoryOrderHint" + SET_COMPANY_NAME = "setCompanyName" + SET_CONTACT_EMAIL = "setContactEmail" + SET_COUNTRIES = "setCountries" + SET_COUNTRY = "setCountry" + SET_CUSTOM_FIELD = "setCustomField" + SET_CUSTOM_LINE_ITEM_CUSTOM_FIELD = "setCustomLineItemCustomField" + SET_CUSTOM_LINE_ITEM_CUSTOM_TYPE = "setCustomLineItemCustomType" + SET_CUSTOM_LINE_ITEM_MONEY = "setCustomLineItemMoney" + SET_CUSTOM_LINE_ITEM_SHIPPING_DETAILS = "setCustomLineItemShippingDetails" + SET_CUSTOM_LINE_ITEM_TAX_AMOUNT = "setCustomLineItemTaxAmount" + SET_CUSTOM_LINE_ITEM_TAX_CATEGORY = "setCustomLineItemTaxCategory" + SET_CUSTOM_LINE_ITEM_TAX_RATE = "setCustomLineItemTaxRate" + SET_CUSTOM_LINE_ITEM_TAXED_PRICE = "setCustomLineItemTaxedPrice" + SET_CUSTOM_LINE_ITEM_TOTAL_PRICE = "setCustomLineItemTotalPrice" + SET_CUSTOM_SHIPPING_METHOD = "setCustomShippingMethod" + SET_CUSTOM_TYPE = "setCustomType" + SET_CUSTOMER = "setCustomer" + SET_CUSTOMER_EMAIL = "setCustomerEmail" + SET_CUSTOMER_GROUP = "setCustomerGroup" + SET_CUSTOMER_ID = "setCustomerId" + SET_CUSTOMER_NUMBER = "setCustomerNumber" + SET_DATE_OF_BIRTH = "setDateOfBirth" + SET_DEFAULT_BILLING_ADDRESS = "setDefaultBillingAddress" + SET_DEFAULT_SHIPPING_ADDRESS = "setDefaultShippingAddress" + SET_DELETE_DAYS_AFTER_LAST_MODIFICATION = "setDeleteDaysAfterLastModification" + SET_DELIVERY_ADDRESS = "setDeliveryAddress" + SET_DELIVERY_ITEMS = "setDeliveryItems" + SET_DESCRIPTION = "setDescription" + SET_DISCOUNTED_PRICE = "setDiscountedPrice" + SET_DISTRIBUTION_CHANNELS = "setDistributionChannels" + SET_EXPECTED_DELIVERY = "setExpectedDelivery" + SET_EXTERNAL_ID = "setExternalId" + SET_FIRST_NAME = "setFirstName" + SET_GEO_LOCATION = "setGeoLocation" + SET_IMAGE_LABEL = "setImageLabel" + SET_INPUT_TIP = "setInputTip" + SET_INTERFACE_ID = "setInterfaceId" + SET_IS_VALID = "setIsValid" + SET_KEY = "setKey" + SET_LANGUAGES = "setLanguages" + SET_LAST_NAME = "setLastName" + SET_LINE_ITEM_CUSTOM_FIELD = "setLineItemCustomField" + SET_LINE_ITEM_CUSTOM_TYPE = "setLineItemCustomType" + SET_LINE_ITEM_DEACTIVATED_AT = "setLineItemDeactivatedAt" + SET_LINE_ITEM_DISCOUNTED_PRICE = "setLineItemDiscountedPrice" + SET_LINE_ITEM_DISCOUNTED_PRICE_PER_QUANTITY = ( + "setLineItemDiscountedPricePerQuantity" + ) + SET_LINE_ITEM_DISTRIBUTION_CHANNEL = "setLineItemDistributionChannel" + SET_LINE_ITEM_PRICE = "setLineItemPrice" + SET_LINE_ITEM_PRODUCT_KEY = "setLineItemProductKey" + SET_LINE_ITEM_PRODUCT_SLUG = "setLineItemProductSlug" + SET_LINE_ITEM_SHIPPING_DETAILS = "setLineItemShippingDetails" + SET_LINE_ITEM_TAX_AMOUNT = "setLineItemTaxAmount" + SET_LINE_ITEM_TAX_RATE = "setLineItemTaxRate" + SET_LINE_ITEM_TAXED_PRICE = "setLineItemTaxedPrice" + SET_LINE_ITEM_TOTAL_PRICE = "setLineItemTotalPrice" + SET_LOCALE = "setLocale" + SET_MAX_APPLICATIONS = "setMaxApplications" + SET_MAX_APPLICATIONS_PER_CUSTOMER = "setMaxApplicationsPerCustomer" + SET_META_DESCRIPTION = "setMetaDescription" + SET_META_KEYWORDS = "setMetaKeywords" + SET_META_TITLE = "setMetaTitle" + SET_METHOD_INFO_INTERFACE = "setMethodInfoInterface" + SET_METHOD_INFO_METHOD = "setMethodInfoMethod" + SET_METHOD_INFO_NAME = "setMethodInfoName" + SET_MIDDLE_NAME = "setMiddleName" + SET_NAME = "setName" + SET_ORDER_NUMBER = "setOrderNumber" + SET_ORDER_TAXED_PRICE = "setOrderTaxedPrice" + SET_ORDER_TOTAL_PRICE = "setOrderTotalPrice" + SET_ORDER_TOTAL_TAX = "setOrderTotalTax" + SET_PARCEL_ITEMS = "setParcelItems" + SET_PARCEL_MEASUREMENTS = "setParcelMeasurements" + SET_PARCEL_TRACKING_DATA = "setParcelTrackingData" + SET_PASSWORD = "setPassword" + SET_PRICES = "setPrices" + SET_PRODUCT_COUNT = "setProductCount" + SET_PRODUCT_PRICE_CUSTOM_FIELD = "setProductPriceCustomField" + SET_PRODUCT_PRICE_CUSTOM_TYPE = "setProductPriceCustomType" + SET_PRODUCT_SELECTIONS = "setProductSelections" + SET_PRODUCT_VARIANT_KEY = "setProductVariantKey" + SET_PROPERTY = "setProperty" + SET_PURCHASE_ORDER_NUMBER = "setPurchaseOrderNumber" + SET_RATING = "setRating" + SET_RESERVATIONS = "setReservations" + SET_RESTOCKABLE_IN_DAYS = "setRestockableInDays" + SET_RETURN_PAYMENT_STATE = "setReturnPaymentState" + SET_RETURN_SHIPMENT_STATE = "setReturnShipmentState" + SET_ROLES = "setRoles" + SET_SALUTATION = "setSalutation" + SET_SEARCH_KEYWORDS = "setSearchKeywords" + SET_SELLER_COMMENT = "setSellerComment" + SET_SHIPPING_ADDRESS = "setShippingAddress" + SET_SHIPPING_INFO_PRICE = "setShippingInfoPrice" + SET_SHIPPING_INFO_TAXED_PRICE = "setShippingInfoTaxedPrice" + SET_SHIPPING_METHOD = "setShippingMethod" + SET_SHIPPING_METHOD_TAX_AMOUNT = "setShippingMethodTaxAmount" + SET_SHIPPING_METHOD_TAX_RATE = "setShippingMethodTaxRate" + SET_SHIPPING_RATE = "setShippingRate" + SET_SHIPPING_RATE_INPUT = "setShippingRateInput" + SET_SKU = "setSku" + SET_SLUG = "setSlug" + SET_STATUS_INTERFACE_CODE = "setStatusInterfaceCode" + SET_STATUS_INTERFACE_TEXT = "setStatusInterfaceText" + SET_STORE = "setStore" + SET_STORE_MODE = "setStoreMode" + SET_STORES = "setStores" + SET_SUPPLY_CHANNEL = "setSupplyChannel" + SET_SUPPLY_CHANNELS = "setSupplyChannels" + SET_TARGET = "setTarget" + SET_TAX_CATEGORY = "setTaxCategory" + SET_TEXT = "setText" + SET_TEXT_LINE_ITEM_CUSTOM_FIELD = "setTextLineItemCustomField" + SET_TEXT_LINE_ITEM_CUSTOM_TYPE = "setTextLineItemCustomType" + SET_TEXT_LINE_ITEM_DESCRIPTION = "setTextLineItemDescription" + SET_TITLE = "setTitle" + SET_TRANSITIONS = "setTransitions" + SET_VALID_FROM = "setValidFrom" + SET_VALID_FROM_AND_UNTIL = "setValidFromAndUntil" + SET_VALID_TO = "setValidTo" + SET_VALID_UNTIL = "setValidUntil" + SET_VALUE = "setValue" + SET_VARIANT_AVAILABILITY = "setVariantAvailability" + SET_VARIANT_SELECTION = "setVariantSelection" + SET_VAT_ID = "setVatId" + TRANSITION_CUSTOM_LINE_ITEM_STATE = "transitionCustomLineItemState" + TRANSITION_LINE_ITEM_STATE = "transitionLineItemState" + TRANSITION_STATE = "transitionState" + UNPUBLISH = "unpublish" + UPDATE_ITEM_SHIPPING_ADDRESS = "updateItemShippingAddress" + UPDATE_SYNC_INFO = "updateSyncInfo" + VERIFY_EMAIL = "verifyEmail" diff --git a/src/commercetools/history/models/change_value.py b/src/commercetools/history/models/change_value.py new file mode 100644 index 00000000..2d848e9a --- /dev/null +++ b/src/commercetools/history/models/change_value.py @@ -0,0 +1,887 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType +from .common import SelectionMode + +if typing.TYPE_CHECKING: + from .common import ( + Address, + DeliveryItem, + LocalizedString, + Money, + Parcel, + Reference, + SelectionMode, + TaxedPrice, + TaxRate, + ) + +__all__ = [ + "AssetChangeValue", + "AttributeValue", + "ChangeTargetChangeValue", + "ChangeTargetCustomLineItemsChangeValue", + "ChangeTargetLineItemsChangeValue", + "ChangeTargetMultiBuyCustomLineItemsChangeValue", + "ChangeTargetMultiBuyLineItemsChangeValue", + "ChangeTargetShippingChangeValue", + "ChangeValueAbsoluteChangeValue", + "ChangeValueChangeValue", + "ChangeValueExternalChangeValue", + "ChangeValueGiftLineItemChangeValue", + "ChangeValueRelativeChangeValue", + "CustomFieldExpandedValue", + "CustomShippingMethodChangeValue", + "DeliveryChangeValue", + "EnumValue", + "FieldDefinitionOrderValue", + "InventoryQuantityValue", + "LocalizedEnumValue", + "ParcelChangeValue", + "SetCartClassificationShippingRateInputValue", + "SetCartScoreShippingRateInputValue", + "ShippingMethodChangeValue", + "ShippingMethodTaxAmountChangeValue", + "ShoppingListLineItemValue", + "TextLineItemValue", + "TransactionChangeValue", + "ValidFromAndUntilValue", +] + + +class ChangeTargetChangeValue(_BaseType): + type: str + + def __init__(self, *, type: str): + self.type = type + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTargetChangeValue": + if data["type"] == "customLineItems": + from ._schemas.change_value import ( + ChangeTargetCustomLineItemsChangeValueSchema, + ) + + return ChangeTargetCustomLineItemsChangeValueSchema().load(data) + if data["type"] == "lineItems": + from ._schemas.change_value import ChangeTargetLineItemsChangeValueSchema + + return ChangeTargetLineItemsChangeValueSchema().load(data) + if data["type"] == "multiBuyCustomLineItems": + from ._schemas.change_value import ( + ChangeTargetMultiBuyCustomLineItemsChangeValueSchema, + ) + + return ChangeTargetMultiBuyCustomLineItemsChangeValueSchema().load(data) + if data["type"] == "multiBuyLineItems": + from ._schemas.change_value import ( + ChangeTargetMultiBuyLineItemsChangeValueSchema, + ) + + return ChangeTargetMultiBuyLineItemsChangeValueSchema().load(data) + if data["type"] == "shipping": + from ._schemas.change_value import ChangeTargetShippingChangeValueSchema + + return ChangeTargetShippingChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeTargetChangeValueSchema + + return ChangeTargetChangeValueSchema().dump(self) + + +class ChangeValueChangeValue(_BaseType): + type: str + + def __init__(self, *, type: str): + self.type = type + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeValueChangeValue": + if data["type"] == "absolute": + from ._schemas.change_value import ChangeValueAbsoluteChangeValueSchema + + return ChangeValueAbsoluteChangeValueSchema().load(data) + if data["type"] == "external": + from ._schemas.change_value import ChangeValueExternalChangeValueSchema + + return ChangeValueExternalChangeValueSchema().load(data) + if data["type"] == "giftLineItem": + from ._schemas.change_value import ChangeValueGiftLineItemChangeValueSchema + + return ChangeValueGiftLineItemChangeValueSchema().load(data) + if data["type"] == "relative": + from ._schemas.change_value import ChangeValueRelativeChangeValueSchema + + return ChangeValueRelativeChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeValueChangeValueSchema + + return ChangeValueChangeValueSchema().dump(self) + + +class AssetChangeValue(_BaseType): + #: `id` of the [Asset](ctp:api:type:Asset). + id: str + #: Name of the Asset. + name: "LocalizedString" + + def __init__(self, *, id: str, name: "LocalizedString"): + self.id = id + self.name = name + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AssetChangeValue": + from ._schemas.change_value import AssetChangeValueSchema + + return AssetChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import AssetChangeValueSchema + + return AssetChangeValueSchema().dump(self) + + +class AttributeValue(_BaseType): + #: Name of the Attribute set. + name: str + #: Value set for the Attribute determined by the [AttributeType](ctp:api:type:AttributeType): + #: + #: - For [Enum Type](ctp:api:type:AttributeEnumType) and [Localized Enum Type](ctp:api:type:AttributeLocalizedEnumType), `value` is the `key` of the [Plain Enum Value](ctp:api:type:AttributePlainEnumValue) or [Localized Enum Value](ctp:api:type:AttributeLocalizedEnumValue) objects, + #: or the complete objects. + #: - For [Localizable Text Type](ctp:api:type:AttributeLocalizableTextType), `value` is the [LocalizedString](ctp:api:type:LocalizedString) object. + #: - For [Money Type](ctp:api:type:AttributeMoneyType) Attributes, `value` is the [Money](ctp:api:type:Money) object. + #: - For [Set Type](ctp:api:type:AttributeSetType) Attributes, `value` is the entire `set` object. + #: - For [Nested Type](ctp:api:type:AttributeNestedType) Attributes, `value` is the list of values of all Attributes of the nested Product. + #: - For [Reference Type](ctp:api:type:AttributeReferenceType) Attributes, `value` is the [Reference](ctp:api:type:Reference) object. + value: typing.Any + + def __init__(self, *, name: str, value: typing.Any): + self.name = name + self.value = value + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AttributeValue": + from ._schemas.change_value import AttributeValueSchema + + return AttributeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import AttributeValueSchema + + return AttributeValueSchema().dump(self) + + +class ChangeTargetCustomLineItemsChangeValue(ChangeTargetChangeValue): + #: Valid [CustomLineItem target predicate](/../api/projects/predicates#customlineitem-field-identifiers). + predicate: str + + def __init__(self, *, predicate: str): + self.predicate = predicate + + super().__init__(type="customLineItems") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTargetCustomLineItemsChangeValue": + from ._schemas.change_value import ChangeTargetCustomLineItemsChangeValueSchema + + return ChangeTargetCustomLineItemsChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeTargetCustomLineItemsChangeValueSchema + + return ChangeTargetCustomLineItemsChangeValueSchema().dump(self) + + +class ChangeTargetLineItemsChangeValue(ChangeTargetChangeValue): + #: Valid [LineItem target predicate](/../api/projects/predicates#lineitem-field-identifiers). + predicate: str + + def __init__(self, *, predicate: str): + self.predicate = predicate + + super().__init__(type="lineItems") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTargetLineItemsChangeValue": + from ._schemas.change_value import ChangeTargetLineItemsChangeValueSchema + + return ChangeTargetLineItemsChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeTargetLineItemsChangeValueSchema + + return ChangeTargetLineItemsChangeValueSchema().dump(self) + + +class ChangeTargetMultiBuyCustomLineItemsChangeValue(ChangeTargetChangeValue): + #: Valid [CustomLineItem target predicate](/../api/projects/predicates#customlineitem-field-identifiers). + predicate: str + #: Quantity of Custom Line Items that triggered the application of the discount. + trigger_quantity: int + #: Quantity of Custom Line Items discounted per application of this discount. + discounted_quantity: int + #: Maximum number of times the discount is applicable. + max_occurrence: int + #: SelectionMode based on which particular Custom Line Items were discounted. + selection_mode: "SelectionMode" + + def __init__( + self, + *, + predicate: str, + trigger_quantity: int, + discounted_quantity: int, + max_occurrence: int, + selection_mode: "SelectionMode" + ): + self.predicate = predicate + self.trigger_quantity = trigger_quantity + self.discounted_quantity = discounted_quantity + self.max_occurrence = max_occurrence + self.selection_mode = selection_mode + + super().__init__(type="multiBuyCustomLineItems") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTargetMultiBuyCustomLineItemsChangeValue": + from ._schemas.change_value import ( + ChangeTargetMultiBuyCustomLineItemsChangeValueSchema, + ) + + return ChangeTargetMultiBuyCustomLineItemsChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ( + ChangeTargetMultiBuyCustomLineItemsChangeValueSchema, + ) + + return ChangeTargetMultiBuyCustomLineItemsChangeValueSchema().dump(self) + + +class ChangeTargetMultiBuyLineItemsChangeValue(ChangeTargetChangeValue): + #: Valid [LineItem target predicate](/../api/projects/predicates#lineitem-field-identifiers). + predicate: str + #: Quantity of Line Items that triggered the application of the discount. + trigger_quantity: int + #: Quantity of Line Items discounted per application of this discount. + discounted_quantity: int + #: Maximum number of times the discount is applicable. + max_occurrence: int + #: SelectionMode based on which particular Line Items were discounted. + selection_mode: "SelectionMode" + + def __init__( + self, + *, + predicate: str, + trigger_quantity: int, + discounted_quantity: int, + max_occurrence: int, + selection_mode: "SelectionMode" + ): + self.predicate = predicate + self.trigger_quantity = trigger_quantity + self.discounted_quantity = discounted_quantity + self.max_occurrence = max_occurrence + self.selection_mode = selection_mode + + super().__init__(type="multiBuyLineItems") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTargetMultiBuyLineItemsChangeValue": + from ._schemas.change_value import ( + ChangeTargetMultiBuyLineItemsChangeValueSchema, + ) + + return ChangeTargetMultiBuyLineItemsChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ( + ChangeTargetMultiBuyLineItemsChangeValueSchema, + ) + + return ChangeTargetMultiBuyLineItemsChangeValueSchema().dump(self) + + +class ChangeTargetShippingChangeValue(ChangeTargetChangeValue): + + def __init__(self): + + super().__init__(type="shipping") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeTargetShippingChangeValue": + from ._schemas.change_value import ChangeTargetShippingChangeValueSchema + + return ChangeTargetShippingChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeTargetShippingChangeValueSchema + + return ChangeTargetShippingChangeValueSchema().dump(self) + + +class ChangeValueAbsoluteChangeValue(ChangeValueChangeValue): + #: Money values in different currencies. + money: typing.List["Money"] + + def __init__(self, *, money: typing.List["Money"]): + self.money = money + + super().__init__(type="absolute") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeValueAbsoluteChangeValue": + from ._schemas.change_value import ChangeValueAbsoluteChangeValueSchema + + return ChangeValueAbsoluteChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeValueAbsoluteChangeValueSchema + + return ChangeValueAbsoluteChangeValueSchema().dump(self) + + +class ChangeValueExternalChangeValue(ChangeValueChangeValue): + + def __init__(self): + + super().__init__(type="external") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeValueExternalChangeValue": + from ._schemas.change_value import ChangeValueExternalChangeValueSchema + + return ChangeValueExternalChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeValueExternalChangeValueSchema + + return ChangeValueExternalChangeValueSchema().dump(self) + + +class ChangeValueGiftLineItemChangeValue(ChangeValueChangeValue): + #: Reference to a [Product](ctp:api:type:Product). + product: "Reference" + #: `id` of the [ProductVariant](ctp:api:type:ProductVariant). + variant_id: int + #: Channel with [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum) `InventorySupply`. + supply_channel: typing.Optional["Reference"] + #: Channel with [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum) `ProductDistribution`. + distribution_channel: "Reference" + + def __init__( + self, + *, + product: "Reference", + variant_id: int, + supply_channel: typing.Optional["Reference"] = None, + distribution_channel: "Reference" + ): + self.product = product + self.variant_id = variant_id + self.supply_channel = supply_channel + self.distribution_channel = distribution_channel + + super().__init__(type="giftLineItem") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeValueGiftLineItemChangeValue": + from ._schemas.change_value import ChangeValueGiftLineItemChangeValueSchema + + return ChangeValueGiftLineItemChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeValueGiftLineItemChangeValueSchema + + return ChangeValueGiftLineItemChangeValueSchema().dump(self) + + +class ChangeValueRelativeChangeValue(ChangeValueChangeValue): + #: Fraction (per ten thousand) the price is reduced by. For example, 1000 results in a 10% price reduction. + permyriad: int + + def __init__(self, *, permyriad: int): + self.permyriad = permyriad + + super().__init__(type="relative") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ChangeValueRelativeChangeValue": + from ._schemas.change_value import ChangeValueRelativeChangeValueSchema + + return ChangeValueRelativeChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ChangeValueRelativeChangeValueSchema + + return ChangeValueRelativeChangeValueSchema().dump(self) + + +class CustomFieldExpandedValue(_BaseType): + """Only present if `expand` is set to `true`.""" + + #: Name of the Custom Field. + name: str + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). + value: typing.Any + #: User-defined label of the Custom Field. + label: "LocalizedString" + + def __init__(self, *, name: str, value: typing.Any, label: "LocalizedString"): + self.name = name + self.value = value + self.label = label + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CustomFieldExpandedValue": + from ._schemas.change_value import CustomFieldExpandedValueSchema + + return CustomFieldExpandedValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import CustomFieldExpandedValueSchema + + return CustomFieldExpandedValueSchema().dump(self) + + +class CustomShippingMethodChangeValue(_BaseType): + #: Name of the Custom ShippingMethod. + name: str + + def __init__(self, *, name: str): + self.name = name + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CustomShippingMethodChangeValue": + from ._schemas.change_value import CustomShippingMethodChangeValueSchema + + return CustomShippingMethodChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import CustomShippingMethodChangeValueSchema + + return CustomShippingMethodChangeValueSchema().dump(self) + + +class DeliveryChangeValue(_BaseType): + #: Line Items or Custom Line Items shipped in the [Delivery](ctp:api:type:Delivery). + items: typing.List["DeliveryItem"] + #: Address to which the parcels are delivered. + address: "Address" + #: Parcels included in the [Delivery](ctp:api:type:Delivery). + parcels: typing.List["Parcel"] + + def __init__( + self, + *, + items: typing.List["DeliveryItem"], + address: "Address", + parcels: typing.List["Parcel"] + ): + self.items = items + self.address = address + self.parcels = parcels + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeliveryChangeValue": + from ._schemas.change_value import DeliveryChangeValueSchema + + return DeliveryChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import DeliveryChangeValueSchema + + return DeliveryChangeValueSchema().dump(self) + + +class EnumValue(_BaseType): + #: Key of the value used as a programmatic identifier. + key: str + #: Descriptive label of the value. + label: str + + def __init__(self, *, key: str, label: str): + self.key = key + self.label = label + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "EnumValue": + from ._schemas.change_value import EnumValueSchema + + return EnumValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import EnumValueSchema + + return EnumValueSchema().dump(self) + + +class FieldDefinitionOrderValue(_BaseType): + #: Name of the [FieldDefinition](ctp:api:type:FieldDefinition). + name: str + #: Descriptive label of the field. + label: "LocalizedString" + + def __init__(self, *, name: str, label: "LocalizedString"): + self.name = name + self.label = label + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "FieldDefinitionOrderValue": + from ._schemas.change_value import FieldDefinitionOrderValueSchema + + return FieldDefinitionOrderValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import FieldDefinitionOrderValueSchema + + return FieldDefinitionOrderValueSchema().dump(self) + + +class InventoryQuantityValue(_BaseType): + #: Overall amount of stock (`availableQuantity` + reserved). + quantity_on_stock: int + #: Available amount of stock (`quantityOnStock` - reserved). + available_quantity: int + + def __init__(self, *, quantity_on_stock: int, available_quantity: int): + self.quantity_on_stock = quantity_on_stock + self.available_quantity = available_quantity + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "InventoryQuantityValue": + from ._schemas.change_value import InventoryQuantityValueSchema + + return InventoryQuantityValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import InventoryQuantityValueSchema + + return InventoryQuantityValueSchema().dump(self) + + +class LocalizedEnumValue(_BaseType): + #: Key of the value used as a programmatic identifier. + key: str + #: Descriptive localized label of the value. + label: "LocalizedString" + + def __init__(self, *, key: str, label: "LocalizedString"): + self.key = key + self.label = label + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "LocalizedEnumValue": + from ._schemas.change_value import LocalizedEnumValueSchema + + return LocalizedEnumValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import LocalizedEnumValueSchema + + return LocalizedEnumValueSchema().dump(self) + + +class ParcelChangeValue(_BaseType): + #: `id` of the [Parcel](ctp:api:type:Parcel). + id: str + #: Date and time (UTC) the Parcel was created. + created_at: str + + def __init__(self, *, id: str, created_at: str): + self.id = id + self.created_at = created_at + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ParcelChangeValue": + from ._schemas.change_value import ParcelChangeValueSchema + + return ParcelChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ParcelChangeValueSchema + + return ParcelChangeValueSchema().dump(self) + + +class SetCartClassificationShippingRateInputValue(_BaseType): + type: str + #: Key of the value used as a programmatic identifier. + key: str + #: Descriptive localized label of the value. + label: "LocalizedString" + + def __init__(self, *, type: str, key: str, label: "LocalizedString"): + self.type = type + self.key = key + self.label = label + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCartClassificationShippingRateInputValue": + from ._schemas.change_value import ( + SetCartClassificationShippingRateInputValueSchema, + ) + + return SetCartClassificationShippingRateInputValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ( + SetCartClassificationShippingRateInputValueSchema, + ) + + return SetCartClassificationShippingRateInputValueSchema().dump(self) + + +class SetCartScoreShippingRateInputValue(_BaseType): + type: str + #: Abstract value for categorizing a Cart. + score: int + + def __init__(self, *, type: str, score: int): + self.type = type + self.score = score + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SetCartScoreShippingRateInputValue": + from ._schemas.change_value import SetCartScoreShippingRateInputValueSchema + + return SetCartScoreShippingRateInputValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import SetCartScoreShippingRateInputValueSchema + + return SetCartScoreShippingRateInputValueSchema().dump(self) + + +class ShippingMethodChangeValue(_BaseType): + #: `id` of the [ShippingMethod](ctp:api:type:ShippingMethod). + id: str + #: Name of the ShippingMethod. + name: str + + def __init__(self, *, id: str, name: str): + self.id = id + self.name = name + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ShippingMethodChangeValue": + from ._schemas.change_value import ShippingMethodChangeValueSchema + + return ShippingMethodChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ShippingMethodChangeValueSchema + + return ShippingMethodChangeValueSchema().dump(self) + + +class ShippingMethodTaxAmountChangeValue(_BaseType): + #: Taxed price for the Shipping Method based on `taxRate`. + taxed_price: "TaxedPrice" + #: Tax rate set externally for the Shipping Method. + tax_rate: "TaxRate" + + def __init__(self, *, taxed_price: "TaxedPrice", tax_rate: "TaxRate"): + self.taxed_price = taxed_price + self.tax_rate = tax_rate + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ShippingMethodTaxAmountChangeValue": + from ._schemas.change_value import ShippingMethodTaxAmountChangeValueSchema + + return ShippingMethodTaxAmountChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ShippingMethodTaxAmountChangeValueSchema + + return ShippingMethodTaxAmountChangeValueSchema().dump(self) + + +class ShoppingListLineItemValue(_BaseType): + #: `id` of the [ShoppingListLineItem](ctp:api:type:ShoppingListLineItem). + id: str + #: Name of the corresponding Product the Product Variant belongs to. + name: "LocalizedString" + #: `id` of the [ProductVariant](ctp:api:type:ProductVariant) the ShoppingListLineItem refers to. + variant_id: int + + def __init__(self, *, id: str, name: "LocalizedString", variant_id: int): + self.id = id + self.name = name + self.variant_id = variant_id + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ShoppingListLineItemValue": + from ._schemas.change_value import ShoppingListLineItemValueSchema + + return ShoppingListLineItemValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ShoppingListLineItemValueSchema + + return ShoppingListLineItemValueSchema().dump(self) + + +class TextLineItemValue(_BaseType): + #: `id` of the [TextLineItem](ctp:api:type:TextLineItem). + id: str + #: Name of the TextLineItem. + name: "LocalizedString" + + def __init__(self, *, id: str, name: "LocalizedString"): + self.id = id + self.name = name + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TextLineItemValue": + from ._schemas.change_value import TextLineItemValueSchema + + return TextLineItemValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import TextLineItemValueSchema + + return TextLineItemValueSchema().dump(self) + + +class TransactionChangeValue(_BaseType): + #: `id` of the [Transaction](ctp:api:type:Transaction). + id: str + #: Identifier used by the interface that manages the Transaction (usually the PSP). + interaction_id: str + #: Date and time (UTC) the Transaction took place. + timestamp: str + + def __init__(self, *, id: str, interaction_id: str, timestamp: str): + self.id = id + self.interaction_id = interaction_id + self.timestamp = timestamp + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "TransactionChangeValue": + from ._schemas.change_value import TransactionChangeValueSchema + + return TransactionChangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import TransactionChangeValueSchema + + return TransactionChangeValueSchema().dump(self) + + +class ValidFromAndUntilValue(_BaseType): + #: Date and time (UTC) from when the Discount is effective. + valid_from: str + #: Date and time (UTC) until when the Discount is effective. + valid_until: str + + def __init__(self, *, valid_from: str, valid_until: str): + self.valid_from = valid_from + self.valid_until = valid_until + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ValidFromAndUntilValue": + from ._schemas.change_value import ValidFromAndUntilValueSchema + + return ValidFromAndUntilValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.change_value import ValidFromAndUntilValueSchema + + return ValidFromAndUntilValueSchema().dump(self) diff --git a/src/commercetools/history/models/common.py b/src/commercetools/history/models/common.py new file mode 100644 index 00000000..dc7831c9 --- /dev/null +++ b/src/commercetools/history/models/common.py @@ -0,0 +1,2201 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +__all__ = [ + "Address", + "Asset", + "AssetDimensions", + "AssetSource", + "Associate", + "AssociateRoleAssignment", + "AssociateRoleInheritanceMode", + "AttributeConstraintEnum", + "AttributeDefinition", + "AttributeLocalizedEnumValue", + "AttributePlainEnumValue", + "AttributeType", + "AuthenticationMode", + "BusinessUnitAssociateMode", + "BusinessUnitStatus", + "BusinessUnitStoreMode", + "CategoryOrderHints", + "ChannelRoleEnum", + "CustomFields", + "CustomLineItem", + "Delivery", + "DeliveryItem", + "DiscountCodeInfo", + "DiscountCodeState", + "DiscountedLineItemPortion", + "DiscountedLineItemPrice", + "DiscountedLineItemPriceForQuantity", + "FieldDefinition", + "FieldType", + "GeoLocation", + "Image", + "ImageDimensions", + "InheritedAssociate", + "InheritedAssociateRoleAssignment", + "ItemShippingDetails", + "ItemShippingTarget", + "ItemState", + "KeyReference", + "LineItem", + "LocalizedString", + "Location", + "Money", + "MoneyType", + "OrderState", + "Parcel", + "ParcelMeasurements", + "PaymentInfo", + "PaymentState", + "Permission", + "Price", + "ProductSelectionSetting", + "ProductVariantAvailability", + "ProductVariantChannelAvailability", + "ProductVariantChannelAvailabilityMap", + "ProductVariantSelection", + "ProductVariantSelectionTypeEnum", + "QuoteRequestState", + "QuoteState", + "Reference", + "ReferenceTypeId", + "Reservation", + "ResourceIdentifier", + "ReturnInfo", + "ReturnItem", + "ReturnPaymentState", + "ReturnShipmentState", + "ReviewRatingStatistics", + "RoundingMode", + "SearchKeyword", + "SearchKeywords", + "SelectionMode", + "ShipmentState", + "ShippingRate", + "ShippingRatePriceTier", + "ShippingRateTierType", + "StackingMode", + "StagedQuoteState", + "StateRoleEnum", + "StateTypeEnum", + "StoreCountry", + "SubRate", + "SuggestTokenizer", + "SyncInfo", + "TaxCalculationMode", + "TaxMode", + "TaxRate", + "TaxedItemPrice", + "TaxedPrice", + "TextInputHint", + "TextLineItem", + "TrackingData", + "Transaction", + "TransactionState", + "TransactionType", + "Variant", +] + + +class LocalizedString(typing.Dict[str, str]): + pass + + +class Address(_BaseType): + #: Unique ID of the Address. + id: str + key: str + title: str + salutation: str + first_name: str + last_name: str + street_name: str + street_number: str + additional_street_info: str + postal_code: str + city: str + region: str + state: str + #: Two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + country: str + company: str + department: str + building: str + apartment: str + p_o_box: str + phone: str + mobile: str + email: str + fax: str + additional_address_info: str + external_id: str + + def __init__( + self, + *, + id: str, + key: str, + title: str, + salutation: str, + first_name: str, + last_name: str, + street_name: str, + street_number: str, + additional_street_info: str, + postal_code: str, + city: str, + region: str, + state: str, + country: str, + company: str, + department: str, + building: str, + apartment: str, + p_o_box: str, + phone: str, + mobile: str, + email: str, + fax: str, + additional_address_info: str, + external_id: str + ): + self.id = id + self.key = key + self.title = title + self.salutation = salutation + self.first_name = first_name + self.last_name = last_name + self.street_name = street_name + self.street_number = street_number + self.additional_street_info = additional_street_info + self.postal_code = postal_code + self.city = city + self.region = region + self.state = state + self.country = country + self.company = company + self.department = department + self.building = building + self.apartment = apartment + self.p_o_box = p_o_box + self.phone = phone + self.mobile = mobile + self.email = email + self.fax = fax + self.additional_address_info = additional_address_info + self.external_id = external_id + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Address": + from ._schemas.common import AddressSchema + + return AddressSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AddressSchema + + return AddressSchema().dump(self) + + +class Asset(_BaseType): + id: str + name: "LocalizedString" + description: "LocalizedString" + custom: "CustomFields" + key: str + + def __init__( + self, + *, + id: str, + name: "LocalizedString", + description: "LocalizedString", + custom: "CustomFields", + key: str + ): + self.id = id + self.name = name + self.description = description + self.custom = custom + self.key = key + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Asset": + from ._schemas.common import AssetSchema + + return AssetSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AssetSchema + + return AssetSchema().dump(self) + + +class AssetDimensions(_BaseType): + w: int + h: int + + def __init__(self, *, w: int, h: int): + self.w = w + self.h = h + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AssetDimensions": + from ._schemas.common import AssetDimensionsSchema + + return AssetDimensionsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AssetDimensionsSchema + + return AssetDimensionsSchema().dump(self) + + +class AssetSource(_BaseType): + uri: str + key: str + dimensions: "AssetDimensions" + content_type: str + + def __init__( + self, *, uri: str, key: str, dimensions: "AssetDimensions", content_type: str + ): + self.uri = uri + self.key = key + self.dimensions = dimensions + self.content_type = content_type + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AssetSource": + from ._schemas.common import AssetSourceSchema + + return AssetSourceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AssetSourceSchema + + return AssetSourceSchema().dump(self) + + +class Associate(_BaseType): + associate_role_assignments: typing.List["AssociateRoleAssignment"] + customer: "Reference" + + def __init__( + self, + *, + associate_role_assignments: typing.List["AssociateRoleAssignment"], + customer: "Reference" + ): + self.associate_role_assignments = associate_role_assignments + self.customer = customer + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Associate": + from ._schemas.common import AssociateSchema + + return AssociateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AssociateSchema + + return AssociateSchema().dump(self) + + +class AssociateRoleAssignment(_BaseType): + associate_role: "KeyReference" + #: Determines whether an [AssociateRoleAssignment](ctp:api:type:AssociateRoleAssignment) can be inherited by child Business Units. + inheritance: "AssociateRoleInheritanceMode" + + def __init__( + self, + *, + associate_role: "KeyReference", + inheritance: "AssociateRoleInheritanceMode" + ): + self.associate_role = associate_role + self.inheritance = inheritance + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AssociateRoleAssignment": + from ._schemas.common import AssociateRoleAssignmentSchema + + return AssociateRoleAssignmentSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AssociateRoleAssignmentSchema + + return AssociateRoleAssignmentSchema().dump(self) + + +class AssociateRoleInheritanceMode(enum.Enum): + """Determines whether an [AssociateRoleAssignment](ctp:api:type:AssociateRoleAssignment) can be inherited by child Business Units.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class AttributeConstraintEnum(enum.Enum): + NONE = "None" + UNIQUE = "Unique" + COMBINATION_UNIQUE = "CombinationUnique" + SAME_FOR_ALL = "SameForAll" + + +class AttributeDefinition(_BaseType): + type: "AttributeType" + #: The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (`_`) and the hyphen-minus (`-`). When using the same `name` for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an `enum` or `lenum` type and sets thereof. + name: str + label: "LocalizedString" + #: Whether the attribute is required to have a value. + is_required: bool + attribute_constraint: "AttributeConstraintEnum" + input_tip: "LocalizedString" + input_hint: "TextInputHint" + #: Whether the attribute's values should generally be enabled in product search. This determines whether the value is stored in products for matching terms in the context of full-text search queries and can be used in facets & filters as part of product search queries. The exact features that are enabled/disabled with this flag depend on the concrete attribute type and are described there. The max size of a searchable field is **restricted to 10922 characters**. This constraint is enforced at both product creation and product update. If the length of the input exceeds the maximum size an InvalidField error is returned. + is_searchable: bool + + def __init__( + self, + *, + type: "AttributeType", + name: str, + label: "LocalizedString", + is_required: bool, + attribute_constraint: "AttributeConstraintEnum", + input_tip: "LocalizedString", + input_hint: "TextInputHint", + is_searchable: bool + ): + self.type = type + self.name = name + self.label = label + self.is_required = is_required + self.attribute_constraint = attribute_constraint + self.input_tip = input_tip + self.input_hint = input_hint + self.is_searchable = is_searchable + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AttributeDefinition": + from ._schemas.common import AttributeDefinitionSchema + + return AttributeDefinitionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AttributeDefinitionSchema + + return AttributeDefinitionSchema().dump(self) + + +class AttributeLocalizedEnumValue(_BaseType): + """A localized enum value must be unique within the enum, else a [DuplicateEnumValues](ctp:api:type:DuplicateEnumValuesError) error is returned.""" + + #: Key of the value used as a programmatic identifier, for example in facets & filters. + key: str + #: Descriptive, localized label of the value. + label: "LocalizedString" + + def __init__(self, *, key: str, label: "LocalizedString"): + self.key = key + self.label = label + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AttributeLocalizedEnumValue": + from ._schemas.common import AttributeLocalizedEnumValueSchema + + return AttributeLocalizedEnumValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AttributeLocalizedEnumValueSchema + + return AttributeLocalizedEnumValueSchema().dump(self) + + +class AttributePlainEnumValue(_BaseType): + """A plain enum value must be unique within the enum, else a [DuplicateEnumValues](ctp:api:type:DuplicateEnumValuesError) error is returned.""" + + #: Key of the value used as a programmatic identifier, for example in facets & filters. + key: str + #: Descriptive label of the value. + label: str + + def __init__(self, *, key: str, label: str): + self.key = key + self.label = label + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "AttributePlainEnumValue": + from ._schemas.common import AttributePlainEnumValueSchema + + return AttributePlainEnumValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AttributePlainEnumValueSchema + + return AttributePlainEnumValueSchema().dump(self) + + +class AttributeType(_BaseType): + name: str + + def __init__(self, *, name: str): + self.name = name + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AttributeType": + from ._schemas.common import AttributeTypeSchema + + return AttributeTypeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AttributeTypeSchema + + return AttributeTypeSchema().dump(self) + + +class AuthenticationMode(enum.Enum): + PASSWORD = "Password" + EXTERNAL_AUTH = "ExternalAuth" + + +class BusinessUnitAssociateMode(enum.Enum): + """Determines whether a Business Unit can inherit Associates from a parent.""" + + EXPLICIT = "Explicit" + EXPLICIT_AND_FROM_PARENT = "ExplicitAndFromParent" + + +class BusinessUnitStatus(enum.Enum): + """Indicates whether the Business Unit can be edited and used in [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [Quote Requests](ctp:api:type:QuoteRequest), or [Quotes](ctp:api:type:Quote).""" + + ACTIVE = "Active" + INACTIVE = "Inactive" + + +class BusinessUnitStoreMode(enum.Enum): + """Defines whether the Stores of the Business Unit are set directly on the Business Unit or are inherited from its parent unit.""" + + EXPLICIT = "Explicit" + FROM_PARENT = "FromParent" + + +class CategoryOrderHints(typing.Dict[str, str]): + pass + + +class ChannelRoleEnum(enum.Enum): + """Describes the purpose and type of the Channel. A Channel can have one or more roles.""" + + INVENTORY_SUPPLY = "InventorySupply" + PRODUCT_DISTRIBUTION = "ProductDistribution" + ORDER_EXPORT = "OrderExport" + ORDER_IMPORT = "OrderImport" + PRIMARY = "Primary" + + +class CustomFields(_BaseType): + type: "Reference" + #: A valid JSON object, based on FieldDefinition. + fields: object + + def __init__(self, *, type: "Reference", fields: object): + self.type = type + self.fields = fields + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CustomFields": + from ._schemas.common import CustomFieldsSchema + + return CustomFieldsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import CustomFieldsSchema + + return CustomFieldsSchema().dump(self) + + +class CustomLineItem(_BaseType): + #: The unique ID of this CustomLineItem. + id: str + name: "LocalizedString" + money: "Money" + taxed_price: "TaxedItemPrice" + total_price: "Money" + #: A unique String in the cart to identify this CustomLineItem. + slug: str + #: The amount of a CustomLineItem in the cart. Must be a positive integer. + quantity: int + + def __init__( + self, + *, + id: str, + name: "LocalizedString", + money: "Money", + taxed_price: "TaxedItemPrice", + total_price: "Money", + slug: str, + quantity: int + ): + self.id = id + self.name = name + self.money = money + self.taxed_price = taxed_price + self.total_price = total_price + self.slug = slug + self.quantity = quantity + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CustomLineItem": + from ._schemas.common import CustomLineItemSchema + + return CustomLineItemSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import CustomLineItemSchema + + return CustomLineItemSchema().dump(self) + + +class Delivery(_BaseType): + id: str + created_at: str + items: typing.List["DeliveryItem"] + parcels: typing.List["Parcel"] + address: typing.Optional["Address"] + #: Custom Fields for the Transaction. + custom: typing.Optional["CustomFields"] + + def __init__( + self, + *, + id: str, + created_at: str, + items: typing.List["DeliveryItem"], + parcels: typing.List["Parcel"], + address: typing.Optional["Address"] = None, + custom: typing.Optional["CustomFields"] = None + ): + self.id = id + self.created_at = created_at + self.items = items + self.parcels = parcels + self.address = address + self.custom = custom + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Delivery": + from ._schemas.common import DeliverySchema + + return DeliverySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeliverySchema + + return DeliverySchema().dump(self) + + +class DeliveryItem(_BaseType): + id: str + quantity: int + + def __init__(self, *, id: str, quantity: int): + self.id = id + self.quantity = quantity + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeliveryItem": + from ._schemas.common import DeliveryItemSchema + + return DeliveryItemSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DeliveryItemSchema + + return DeliveryItemSchema().dump(self) + + +class DiscountCodeInfo(_BaseType): + discount_code: "Reference" + state: "DiscountCodeState" + + def __init__(self, *, discount_code: "Reference", state: "DiscountCodeState"): + self.discount_code = discount_code + self.state = state + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DiscountCodeInfo": + from ._schemas.common import DiscountCodeInfoSchema + + return DiscountCodeInfoSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DiscountCodeInfoSchema + + return DiscountCodeInfoSchema().dump(self) + + +class DiscountCodeState(enum.Enum): + NOT_ACTIVE = "NotActive" + DOES_NOT_MATCH_CART = "DoesNotMatchCart" + MATCHES_CART = "MatchesCart" + MAX_APPLICATION_REACHED = "MaxApplicationReached" + APPLICATION_STOPPED_BY_PREVIOUS_DISCOUNT = "ApplicationStoppedByPreviousDiscount" + NOT_VALID = "NotValid" + + +class DiscountedLineItemPortion(_BaseType): + discount: "Reference" + discounted_amount: "Money" + + def __init__(self, *, discount: "Reference", discounted_amount: "Money"): + self.discount = discount + self.discounted_amount = discounted_amount + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountedLineItemPortion": + from ._schemas.common import DiscountedLineItemPortionSchema + + return DiscountedLineItemPortionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DiscountedLineItemPortionSchema + + return DiscountedLineItemPortionSchema().dump(self) + + +class DiscountedLineItemPrice(_BaseType): + value: "Money" + included_discounts: typing.List["DiscountedLineItemPortion"] + + def __init__( + self, + *, + value: "Money", + included_discounts: typing.List["DiscountedLineItemPortion"] + ): + self.value = value + self.included_discounts = included_discounts + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountedLineItemPrice": + from ._schemas.common import DiscountedLineItemPriceSchema + + return DiscountedLineItemPriceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DiscountedLineItemPriceSchema + + return DiscountedLineItemPriceSchema().dump(self) + + +class DiscountedLineItemPriceForQuantity(_BaseType): + quantity: int + discounted_price: "DiscountedLineItemPrice" + + def __init__(self, *, quantity: int, discounted_price: "DiscountedLineItemPrice"): + self.quantity = quantity + self.discounted_price = discounted_price + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountedLineItemPriceForQuantity": + from ._schemas.common import DiscountedLineItemPriceForQuantitySchema + + return DiscountedLineItemPriceForQuantitySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import DiscountedLineItemPriceForQuantitySchema + + return DiscountedLineItemPriceForQuantitySchema().dump(self) + + +class FieldDefinition(_BaseType): + type: "FieldType" + #: The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (`_`) and the hyphen-minus (`-`). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also. + name: str + label: "LocalizedString" + input_hint: "TextInputHint" + + def __init__( + self, + *, + type: "FieldType", + name: str, + label: "LocalizedString", + input_hint: "TextInputHint" + ): + self.type = type + self.name = name + self.label = label + self.input_hint = input_hint + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "FieldDefinition": + from ._schemas.common import FieldDefinitionSchema + + return FieldDefinitionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import FieldDefinitionSchema + + return FieldDefinitionSchema().dump(self) + + +class FieldType(_BaseType): + name: str + + def __init__(self, *, name: str): + self.name = name + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "FieldType": + from ._schemas.common import FieldTypeSchema + + return FieldTypeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import FieldTypeSchema + + return FieldTypeSchema().dump(self) + + +class GeoLocation(_BaseType): + type: str + coordinates: typing.List["int"] + + def __init__(self, *, type: str, coordinates: typing.List["int"]): + self.type = type + self.coordinates = coordinates + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "GeoLocation": + from ._schemas.common import GeoLocationSchema + + return GeoLocationSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import GeoLocationSchema + + return GeoLocationSchema().dump(self) + + +class Image(_BaseType): + url: str + dimensions: "ImageDimensions" + label: str + + def __init__(self, *, url: str, dimensions: "ImageDimensions", label: str): + self.url = url + self.dimensions = dimensions + self.label = label + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Image": + from ._schemas.common import ImageSchema + + return ImageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ImageSchema + + return ImageSchema().dump(self) + + +class ImageDimensions(_BaseType): + w: int + h: int + + def __init__(self, *, w: int, h: int): + self.w = w + self.h = h + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ImageDimensions": + from ._schemas.common import ImageDimensionsSchema + + return ImageDimensionsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ImageDimensionsSchema + + return ImageDimensionsSchema().dump(self) + + +class InheritedAssociate(_BaseType): + associate_role_assignments: typing.List["InheritedAssociateRoleAssignment"] + customer: "Reference" + + def __init__( + self, + *, + associate_role_assignments: typing.List["InheritedAssociateRoleAssignment"], + customer: "Reference" + ): + self.associate_role_assignments = associate_role_assignments + self.customer = customer + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "InheritedAssociate": + from ._schemas.common import InheritedAssociateSchema + + return InheritedAssociateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import InheritedAssociateSchema + + return InheritedAssociateSchema().dump(self) + + +class InheritedAssociateRoleAssignment(_BaseType): + associate_role: "KeyReference" + source: "KeyReference" + + def __init__(self, *, associate_role: "KeyReference", source: "KeyReference"): + self.associate_role = associate_role + self.source = source + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "InheritedAssociateRoleAssignment": + from ._schemas.common import InheritedAssociateRoleAssignmentSchema + + return InheritedAssociateRoleAssignmentSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import InheritedAssociateRoleAssignmentSchema + + return InheritedAssociateRoleAssignmentSchema().dump(self) + + +class ItemShippingDetails(_BaseType): + targets: typing.List["ItemShippingTarget"] + #: true if the quantity of the (custom) line item is equal to the sum of the sub-quantities in `targets`, `false` otherwise. A cart cannot be ordered when the value is `false`. The error InvalidItemShippingDetails will be triggered. + valid: bool + + def __init__(self, *, targets: typing.List["ItemShippingTarget"], valid: bool): + self.targets = targets + self.valid = valid + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ItemShippingDetails": + from ._schemas.common import ItemShippingDetailsSchema + + return ItemShippingDetailsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ItemShippingDetailsSchema + + return ItemShippingDetailsSchema().dump(self) + + +class ItemShippingTarget(_BaseType): + #: The key of the address in the cart's `itemShippingAddresses` + address_key: str + #: The quantity of items that should go to the address with the specified `addressKey`. Only positive values are allowed. Using `0` as quantity is also possible in a draft object, but the element will not be present in the resulting ItemShippingDetails. + quantity: int + + def __init__(self, *, address_key: str, quantity: int): + self.address_key = address_key + self.quantity = quantity + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ItemShippingTarget": + from ._schemas.common import ItemShippingTargetSchema + + return ItemShippingTargetSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ItemShippingTargetSchema + + return ItemShippingTargetSchema().dump(self) + + +class ItemState(_BaseType): + quantity: int + state: "Reference" + + def __init__(self, *, quantity: int, state: "Reference"): + self.quantity = quantity + self.state = state + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ItemState": + from ._schemas.common import ItemStateSchema + + return ItemStateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ItemStateSchema + + return ItemStateSchema().dump(self) + + +class KeyReference(_BaseType): + key: str + type_id: "ReferenceTypeId" + + def __init__(self, *, key: str, type_id: "ReferenceTypeId"): + self.key = key + self.type_id = type_id + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "KeyReference": + from ._schemas.common import KeyReferenceSchema + + return KeyReferenceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import KeyReferenceSchema + + return KeyReferenceSchema().dump(self) + + +class LineItem(_BaseType): + added_at: str + custom: "CustomFields" + id: str + name: "LocalizedString" + product_id: str + product_slug: "LocalizedString" + product_type: "Reference" + quantity: int + variant: "Variant" + variant_id: int + + def __init__( + self, + *, + added_at: str, + custom: "CustomFields", + id: str, + name: "LocalizedString", + product_id: str, + product_slug: "LocalizedString", + product_type: "Reference", + quantity: int, + variant: "Variant", + variant_id: int + ): + self.added_at = added_at + self.custom = custom + self.id = id + self.name = name + self.product_id = product_id + self.product_slug = product_slug + self.product_type = product_type + self.quantity = quantity + self.variant = variant + self.variant_id = variant_id + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "LineItem": + from ._schemas.common import LineItemSchema + + return LineItemSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import LineItemSchema + + return LineItemSchema().dump(self) + + +class Location(_BaseType): + """Shape of the value for `addLocation` and `removeLocation` actions""" + + #: Two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + country: str + state: str + + def __init__(self, *, country: str, state: str): + self.country = country + self.state = state + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Location": + from ._schemas.common import LocationSchema + + return LocationSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import LocationSchema + + return LocationSchema().dump(self) + + +class Money(_BaseType): + #: Currency code compliant to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). + currency_code: str + cent_amount: int + fraction_digits: int + type: "MoneyType" + + def __init__( + self, + *, + currency_code: str, + cent_amount: int, + fraction_digits: int, + type: "MoneyType" + ): + self.currency_code = currency_code + self.cent_amount = cent_amount + self.fraction_digits = fraction_digits + self.type = type + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Money": + from ._schemas.common import MoneySchema + + return MoneySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import MoneySchema + + return MoneySchema().dump(self) + + +class MoneyType(enum.Enum): + CENT_PRECISION = "centPrecision" + HIGH_PRECISION = "highPrecision" + + +class OrderState(enum.Enum): + OPEN = "Open" + CONFIRMED = "Confirmed" + COMPLETE = "Complete" + CANCELLED = "Cancelled" + + +class Parcel(_BaseType): + id: str + created_at: str + measurements: "ParcelMeasurements" + tracking_data: "TrackingData" + items: typing.List["DeliveryItem"] + + def __init__( + self, + *, + id: str, + created_at: str, + measurements: "ParcelMeasurements", + tracking_data: "TrackingData", + items: typing.List["DeliveryItem"] + ): + self.id = id + self.created_at = created_at + self.measurements = measurements + self.tracking_data = tracking_data + self.items = items + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Parcel": + from ._schemas.common import ParcelSchema + + return ParcelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ParcelSchema + + return ParcelSchema().dump(self) + + +class ParcelMeasurements(_BaseType): + height_in_millimeter: int + length_in_millimeter: int + width_in_millimeter: int + weight_in_gram: int + + def __init__( + self, + *, + height_in_millimeter: int, + length_in_millimeter: int, + width_in_millimeter: int, + weight_in_gram: int + ): + self.height_in_millimeter = height_in_millimeter + self.length_in_millimeter = length_in_millimeter + self.width_in_millimeter = width_in_millimeter + self.weight_in_gram = weight_in_gram + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ParcelMeasurements": + from ._schemas.common import ParcelMeasurementsSchema + + return ParcelMeasurementsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ParcelMeasurementsSchema + + return ParcelMeasurementsSchema().dump(self) + + +class PaymentInfo(_BaseType): + payments: typing.List["Reference"] + + def __init__(self, *, payments: typing.List["Reference"]): + self.payments = payments + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentInfo": + from ._schemas.common import PaymentInfoSchema + + return PaymentInfoSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import PaymentInfoSchema + + return PaymentInfoSchema().dump(self) + + +class PaymentState(enum.Enum): + BALANCE_DUE = "BalanceDue" + FAILED = "Failed" + PENDING = "Pending" + CREDIT_OWED = "CreditOwed" + PAID = "Paid" + + +class Permission(enum.Enum): + """Permissions grant granular access to [Business Units](ctp:api:type:BusinessUnit), [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [Quotes](ctp:api:type:Quote), and [Quote Requests](ctp:api:type:QuoteRequest).""" + + ADD_CHILD_UNITS = "AddChildUnits" + UPDATE_ASSOCIATES = "UpdateAssociates" + UPDATE_BUSINESS_UNIT_DETAILS = "UpdateBusinessUnitDetails" + UPDATE_PARENT_UNIT = "UpdateParentUnit" + VIEW_MY_CARTS = "ViewMyCarts" + VIEW_OTHERS_CARTS = "ViewOthersCarts" + UPDATE_MY_CARTS = "UpdateMyCarts" + UPDATE_OTHERS_CARTS = "UpdateOthersCarts" + CREATE_MY_CARTS = "CreateMyCarts" + CREATE_OTHERS_CARTS = "CreateOthersCarts" + DELETE_MY_CARTS = "DeleteMyCarts" + DELETE_OTHERS_CARTS = "DeleteOthersCarts" + VIEW_MY_ORDERS = "ViewMyOrders" + VIEW_OTHERS_ORDERS = "ViewOthersOrders" + UPDATE_MY_ORDERS = "UpdateMyOrders" + UPDATE_OTHERS_ORDERS = "UpdateOthersOrders" + CREATE_MY_ORDERS_FROM_MY_CARTS = "CreateMyOrdersFromMyCarts" + CREATE_MY_ORDERS_FROM_MY_QUOTES = "CreateMyOrdersFromMyQuotes" + CREATE_ORDERS_FROM_OTHERS_CARTS = "CreateOrdersFromOthersCarts" + CREATE_ORDERS_FROM_OTHERS_QUOTES = "CreateOrdersFromOthersQuotes" + VIEW_MY_QUOTES = "ViewMyQuotes" + VIEW_OTHERS_QUOTES = "ViewOthersQuotes" + ACCEPT_MY_QUOTES = "AcceptMyQuotes" + ACCEPT_OTHERS_QUOTES = "AcceptOthersQuotes" + DECLINE_MY_QUOTES = "DeclineMyQuotes" + DECLINE_OTHERS_QUOTES = "DeclineOthersQuotes" + RENEGOTIATE_MY_QUOTES = "RenegotiateMyQuotes" + RENEGOTIATE_OTHERS_QUOTES = "RenegotiateOthersQuotes" + REASSIGN_MY_QUOTES = "ReassignMyQuotes" + REASSIGN_OTHERS_QUOTES = "ReassignOthersQuotes" + VIEW_MY_QUOTE_REQUESTS = "ViewMyQuoteRequests" + VIEW_OTHERS_QUOTE_REQUESTS = "ViewOthersQuoteRequests" + UPDATE_MY_QUOTE_REQUESTS = "UpdateMyQuoteRequests" + UPDATE_OTHERS_QUOTE_REQUESTS = "UpdateOthersQuoteRequests" + CREATE_MY_QUOTE_REQUESTS_FROM_MY_CARTS = "CreateMyQuoteRequestsFromMyCarts" + CREATE_QUOTE_REQUESTS_FROM_OTHERS_CARTS = "CreateQuoteRequestsFromOthersCarts" + + +class Price(_BaseType): + id: str + value: "Money" + + def __init__(self, *, id: str, value: "Money"): + self.id = id + self.value = value + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Price": + from ._schemas.common import PriceSchema + + return PriceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import PriceSchema + + return PriceSchema().dump(self) + + +class ProductSelectionSetting(_BaseType): + product_selection: "Reference" + active: bool + + def __init__(self, *, product_selection: "Reference", active: bool): + self.product_selection = product_selection + self.active = active + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSelectionSetting": + from ._schemas.common import ProductSelectionSettingSchema + + return ProductSelectionSettingSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ProductSelectionSettingSchema + + return ProductSelectionSettingSchema().dump(self) + + +class ProductVariantAvailability(_BaseType): + is_on_stock: bool + restockable_in_days: int + available_quantity: int + channels: "ProductVariantChannelAvailabilityMap" + + def __init__( + self, + *, + is_on_stock: bool, + restockable_in_days: int, + available_quantity: int, + channels: "ProductVariantChannelAvailabilityMap" + ): + self.is_on_stock = is_on_stock + self.restockable_in_days = restockable_in_days + self.available_quantity = available_quantity + self.channels = channels + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantAvailability": + from ._schemas.common import ProductVariantAvailabilitySchema + + return ProductVariantAvailabilitySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ProductVariantAvailabilitySchema + + return ProductVariantAvailabilitySchema().dump(self) + + +class ProductVariantChannelAvailability(_BaseType): + is_on_stock: bool + restockable_in_days: int + available_quantity: int + + def __init__( + self, *, is_on_stock: bool, restockable_in_days: int, available_quantity: int + ): + self.is_on_stock = is_on_stock + self.restockable_in_days = restockable_in_days + self.available_quantity = available_quantity + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantChannelAvailability": + from ._schemas.common import ProductVariantChannelAvailabilitySchema + + return ProductVariantChannelAvailabilitySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ProductVariantChannelAvailabilitySchema + + return ProductVariantChannelAvailabilitySchema().dump(self) + + +class ProductVariantChannelAvailabilityMap( + typing.Dict[str, "ProductVariantChannelAvailability"] +): + pass + + +class ProductVariantSelection(_BaseType): + type: "ProductVariantSelectionTypeEnum" + skus: typing.List["str"] + + def __init__( + self, *, type: "ProductVariantSelectionTypeEnum", skus: typing.List["str"] + ): + self.type = type + self.skus = skus + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantSelection": + from ._schemas.common import ProductVariantSelectionSchema + + return ProductVariantSelectionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ProductVariantSelectionSchema + + return ProductVariantSelectionSchema().dump(self) + + +class ProductVariantSelectionTypeEnum(enum.Enum): + INCLUSION = "inclusion" + EXCLUSION = "exclusion" + + +class QuoteRequestState(enum.Enum): + SUBMITTED = "Submitted" + ACCEPTED = "Accepted" + CLOSED = "Closed" + REJECTED = "Rejected" + CANCELLED = "Cancelled" + + +class QuoteState(enum.Enum): + PENDING = "Pending" + DECLINED = "Declined" + DECLINED_FOR_RENEGOTIATION = "DeclinedForRenegotiation" + ACCEPTED = "Accepted" + FAILED = "Failed" + WITHDRAWN = "Withdrawn" + + +class Reference(_BaseType): + id: str + type_id: "ReferenceTypeId" + + def __init__(self, *, id: str, type_id: "ReferenceTypeId"): + self.id = id + self.type_id = type_id + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Reference": + from ._schemas.common import ReferenceSchema + + return ReferenceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ReferenceSchema + + return ReferenceSchema().dump(self) + + +class ReferenceTypeId(enum.Enum): + ASSOCIATE_ROLE = "associate-role" + BUSINESS_UNIT = "business-unit" + CART = "cart" + CART_DISCOUNT = "cart-discount" + CATEGORY = "category" + CHANNEL = "channel" + CUSTOMER = "customer" + CUSTOMER_EMAIL_TOKEN = "customer-email-token" + CUSTOMER_GROUP = "customer-group" + CUSTOMER_PASSWORD_TOKEN = "customer-password-token" + DISCOUNT_CODE = "discount-code" + EXTENSION = "extension" + INVENTORY_ENTRY = "inventory-entry" + KEY_VALUE_DOCUMENT = "key-value-document" + ORDER = "order" + ORDER_EDIT = "order-edit" + PAYMENT = "payment" + PRODUCT = "product" + PRODUCT_DISCOUNT = "product-discount" + PRODUCT_SELECTION = "product-selection" + PRODUCT_TYPE = "product-type" + QUOTE = "quote" + QUOTE_REQUEST = "quote-request" + REVIEW = "review" + SHIPPING_METHOD = "shipping-method" + SHOPPING_LIST = "shopping-list" + STAGED_QUOTE = "staged-quote" + STATE = "state" + STORE = "store" + SUBSCRIPTION = "subscription" + TAX_CATEGORY = "tax-category" + TYPE = "type" + ZONE = "zone" + + +class Reservation(_BaseType): + quantity: int + owner: "Reference" + created_at: str + checkout_started_at: str + + def __init__( + self, + *, + quantity: int, + owner: "Reference", + created_at: str, + checkout_started_at: str + ): + self.quantity = quantity + self.owner = owner + self.created_at = created_at + self.checkout_started_at = checkout_started_at + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Reservation": + from ._schemas.common import ReservationSchema + + return ReservationSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ReservationSchema + + return ReservationSchema().dump(self) + + +class ResourceIdentifier(_BaseType): + id: str + key: str + type_id: "ReferenceTypeId" + + def __init__(self, *, id: str, key: str, type_id: "ReferenceTypeId"): + self.id = id + self.key = key + self.type_id = type_id + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResourceIdentifier": + from ._schemas.common import ResourceIdentifierSchema + + return ResourceIdentifierSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ResourceIdentifierSchema + + return ResourceIdentifierSchema().dump(self) + + +class ReturnInfo(_BaseType): + items: typing.List["ReturnItem"] + #: Identifies, which return tracking ID is connected to this particular return. + return_tracking_id: str + return_date: str + + def __init__( + self, + *, + items: typing.List["ReturnItem"], + return_tracking_id: str, + return_date: str + ): + self.items = items + self.return_tracking_id = return_tracking_id + self.return_date = return_date + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ReturnInfo": + from ._schemas.common import ReturnInfoSchema + + return ReturnInfoSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ReturnInfoSchema + + return ReturnInfoSchema().dump(self) + + +class ReturnItem(_BaseType): + id: str + quantity: int + type: str + comment: str + shipment_state: "ReturnShipmentState" + payment_state: "ReturnPaymentState" + last_modified_at: str + created_at: str + + def __init__( + self, + *, + id: str, + quantity: int, + type: str, + comment: str, + shipment_state: "ReturnShipmentState", + payment_state: "ReturnPaymentState", + last_modified_at: str, + created_at: str + ): + self.id = id + self.quantity = quantity + self.type = type + self.comment = comment + self.shipment_state = shipment_state + self.payment_state = payment_state + self.last_modified_at = last_modified_at + self.created_at = created_at + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ReturnItem": + from ._schemas.common import ReturnItemSchema + + return ReturnItemSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ReturnItemSchema + + return ReturnItemSchema().dump(self) + + +class ReturnPaymentState(enum.Enum): + NON_REFUNDABLE = "NonRefundable" + INITIAL = "Initial" + REFUNDED = "Refunded" + NOT_REFUNDED = "NotRefunded" + + +class ReturnShipmentState(enum.Enum): + ADVISED = "Advised" + RETURNED = "Returned" + BACK_IN_STOCK = "BackInStock" + UNUSABLE = "Unusable" + + +class ReviewRatingStatistics(_BaseType): + #: Average rating of one target This number is rounded with 5 decimals. + average_rating: int + #: Highest rating of one target + highest_rating: int + #: Lowest rating of one target + lowest_rating: int + #: Number of ratings taken into account + count: int + #: The full distribution of the ratings. The keys are the different ratings and the values are the count of reviews having this rating. Only the used ratings appear in this object. + ratings_distribution: object + + def __init__( + self, + *, + average_rating: int, + highest_rating: int, + lowest_rating: int, + count: int, + ratings_distribution: object + ): + self.average_rating = average_rating + self.highest_rating = highest_rating + self.lowest_rating = lowest_rating + self.count = count + self.ratings_distribution = ratings_distribution + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ReviewRatingStatistics": + from ._schemas.common import ReviewRatingStatisticsSchema + + return ReviewRatingStatisticsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ReviewRatingStatisticsSchema + + return ReviewRatingStatisticsSchema().dump(self) + + +class RoundingMode(enum.Enum): + HALF_EVEN = "HalfEven" + HALF_UP = "HalfUp" + HALF_DOWN = "HalfDown" + + +class SearchKeyword(_BaseType): + text: str + suggest_tokenizer: "SuggestTokenizer" + + def __init__(self, *, text: str, suggest_tokenizer: "SuggestTokenizer"): + self.text = text + self.suggest_tokenizer = suggest_tokenizer + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchKeyword": + from ._schemas.common import SearchKeywordSchema + + return SearchKeywordSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import SearchKeywordSchema + + return SearchKeywordSchema().dump(self) + + +class SearchKeywords(typing.Dict[str, typing.List["SearchKeyword"]]): + pass + + +class SelectionMode(enum.Enum): + CHEAPEST = "Cheapest" + MOST_EXPENSIVE = "MostExpensive" + + +class ShipmentState(enum.Enum): + SHIPPED = "Shipped" + READY = "Ready" + PENDING = "Pending" + DELAYED = "Delayed" + PARTIAL = "Partial" + BACKORDER = "Backorder" + + +class ShippingRate(_BaseType): + price: "Money" + free_above: "Money" + #: Only appears in response to requests for ShippingMethods by Cart or location to mark this shipping rate as one that matches the Cart or location. + is_matching: bool + tiers: typing.List["ShippingRatePriceTier"] + + def __init__( + self, + *, + price: "Money", + free_above: "Money", + is_matching: bool, + tiers: typing.List["ShippingRatePriceTier"] + ): + self.price = price + self.free_above = free_above + self.is_matching = is_matching + self.tiers = tiers + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ShippingRate": + from ._schemas.common import ShippingRateSchema + + return ShippingRateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ShippingRateSchema + + return ShippingRateSchema().dump(self) + + +class ShippingRatePriceTier(_BaseType): + type: "ShippingRateTierType" + + def __init__(self, *, type: "ShippingRateTierType"): + self.type = type + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ShippingRatePriceTier": + from ._schemas.common import ShippingRatePriceTierSchema + + return ShippingRatePriceTierSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import ShippingRatePriceTierSchema + + return ShippingRatePriceTierSchema().dump(self) + + +class ShippingRateTierType(enum.Enum): + CART_VALUE = "CartValue" + CART_CLASSIFICATION = "CartClassification" + CART_SCORE = "CartScore" + + +class StackingMode(enum.Enum): + STACKING = "Stacking" + STOP_AFTER_THIS_DISCOUNT = "StopAfterThisDiscount" + + +class StagedQuoteState(enum.Enum): + IN_PROGRESS = "InProgress" + SENT = "Sent" + CLOSED = "Closed" + + +class StateRoleEnum(enum.Enum): + """For some resource types, a State can fulfill the following predefined roles:""" + + REVIEW_INCLUDED_IN_STATISTICS = "ReviewIncludedInStatistics" + RETURN = "Return" + + +class StateTypeEnum(enum.Enum): + """Resource or object type the State can be assigned to.""" + + ORDER_STATE = "OrderState" + LINE_ITEM_STATE = "LineItemState" + PRODUCT_STATE = "ProductState" + REVIEW_STATE = "ReviewState" + PAYMENT_STATE = "PaymentState" + QUOTE_REQUEST_STATE = "QuoteRequestState" + STAGED_QUOTE_STATE = "StagedQuoteState" + QUOTE_STATE = "QuoteState" + + +class StoreCountry(_BaseType): + #: Two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + code: str + + def __init__(self, *, code: str): + self.code = code + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "StoreCountry": + from ._schemas.common import StoreCountrySchema + + return StoreCountrySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import StoreCountrySchema + + return StoreCountrySchema().dump(self) + + +class SubRate(_BaseType): + name: str + amount: int + + def __init__(self, *, name: str, amount: int): + self.name = name + self.amount = amount + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SubRate": + from ._schemas.common import SubRateSchema + + return SubRateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import SubRateSchema + + return SubRateSchema().dump(self) + + +class SuggestTokenizer(_BaseType): + type: str + + def __init__(self, *, type: str): + self.type = type + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SuggestTokenizer": + from ._schemas.common import SuggestTokenizerSchema + + return SuggestTokenizerSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import SuggestTokenizerSchema + + return SuggestTokenizerSchema().dump(self) + + +class SyncInfo(_BaseType): + channel: "Reference" + #: Can be used to reference an external order instance, file etc. + external_id: str + synced_at: str + + def __init__(self, *, channel: "Reference", external_id: str, synced_at: str): + self.channel = channel + self.external_id = external_id + self.synced_at = synced_at + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SyncInfo": + from ._schemas.common import SyncInfoSchema + + return SyncInfoSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import SyncInfoSchema + + return SyncInfoSchema().dump(self) + + +class TaxCalculationMode(enum.Enum): + LINE_ITEM_LEVEL = "LineItemLevel" + UNIT_PRICE_LEVEL = "UnitPriceLevel" + + +class TaxMode(enum.Enum): + PLATFORM = "Platform" + EXTERNAL = "External" + EXTERNAL_AMOUNT = "ExternalAmount" + DISABLED = "Disabled" + + +class TaxRate(_BaseType): + """Shape of the value for `addTaxRate` and `removeTaxRate` actions""" + + #: The ID is always set if the tax rate is part of a TaxCategory. The external tax rates in a Cart do not contain an `id`. + id: str + name: str + #: Percentage in the range of [0..1]. The sum of the amounts of all `subRates`, if there are any. + amount: int + included_in_price: bool + #: Two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + country: str + #: The state in the country + state: str + sub_rates: typing.List["SubRate"] + + def __init__( + self, + *, + id: str, + name: str, + amount: int, + included_in_price: bool, + country: str, + state: str, + sub_rates: typing.List["SubRate"] + ): + self.id = id + self.name = name + self.amount = amount + self.included_in_price = included_in_price + self.country = country + self.state = state + self.sub_rates = sub_rates + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TaxRate": + from ._schemas.common import TaxRateSchema + + return TaxRateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import TaxRateSchema + + return TaxRateSchema().dump(self) + + +class TaxedItemPrice(_BaseType): + total_net: "Money" + total_gross: "Money" + + def __init__(self, *, total_net: "Money", total_gross: "Money"): + self.total_net = total_net + self.total_gross = total_gross + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TaxedItemPrice": + from ._schemas.common import TaxedItemPriceSchema + + return TaxedItemPriceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import TaxedItemPriceSchema + + return TaxedItemPriceSchema().dump(self) + + +class TaxedPrice(_BaseType): + #: Total net price of the Order. + total_net: "Money" + #: Total gross price of the Order. + total_gross: "Money" + + def __init__(self, *, total_net: "Money", total_gross: "Money"): + self.total_net = total_net + self.total_gross = total_gross + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TaxedPrice": + from ._schemas.common import TaxedPriceSchema + + return TaxedPriceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import TaxedPriceSchema + + return TaxedPriceSchema().dump(self) + + +class TextInputHint(enum.Enum): + SINGLE_LINE = "SingleLine" + MULTI_LINE = "MultiLine" + + +class TextLineItem(_BaseType): + added_at: str + custom: "CustomFields" + description: "LocalizedString" + id: str + name: "LocalizedString" + quantity: int + + def __init__( + self, + *, + added_at: str, + custom: "CustomFields", + description: "LocalizedString", + id: str, + name: "LocalizedString", + quantity: int + ): + self.added_at = added_at + self.custom = custom + self.description = description + self.id = id + self.name = name + self.quantity = quantity + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TextLineItem": + from ._schemas.common import TextLineItemSchema + + return TextLineItemSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import TextLineItemSchema + + return TextLineItemSchema().dump(self) + + +class TrackingData(_BaseType): + #: The ID to track one parcel. + tracking_id: str + #: The carrier that delivers the parcel. + carrier: str + provider: str + provider_transaction: str + #: Flag to distinguish if the parcel is on the way to the customer (false) or on the way back (true). + is_return: bool + + def __init__( + self, + *, + tracking_id: str, + carrier: str, + provider: str, + provider_transaction: str, + is_return: bool + ): + self.tracking_id = tracking_id + self.carrier = carrier + self.provider = provider + self.provider_transaction = provider_transaction + self.is_return = is_return + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TrackingData": + from ._schemas.common import TrackingDataSchema + + return TrackingDataSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import TrackingDataSchema + + return TrackingDataSchema().dump(self) + + +class Transaction(_BaseType): + #: Unique identifier of the Transaction. + id: str + #: Time at which the transaction took place. + timestamp: str + type: "TransactionType" + amount: "Money" + #: Identifier used by the interface that manages the transaction (usually the PSP). If a matching interaction was logged in the `interfaceInteractions` array, the corresponding interaction should be findable with this ID. + interaction_id: str + state: "TransactionState" + + def __init__( + self, + *, + id: str, + timestamp: str, + type: "TransactionType", + amount: "Money", + interaction_id: str, + state: "TransactionState" + ): + self.id = id + self.timestamp = timestamp + self.type = type + self.amount = amount + self.interaction_id = interaction_id + self.state = state + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Transaction": + from ._schemas.common import TransactionSchema + + return TransactionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import TransactionSchema + + return TransactionSchema().dump(self) + + +class TransactionState(enum.Enum): + INITIAL = "Initial" + PENDING = "Pending" + SUCCESS = "Success" + FAILURE = "Failure" + + +class TransactionType(enum.Enum): + AUTHORIZATION = "Authorization" + CANCEL_AUTHORIZATION = "CancelAuthorization" + CHARGE = "Charge" + REFUND = "Refund" + CHARGEBACK = "Chargeback" + + +class Variant(_BaseType): + id: int + sku: str + key: str + + def __init__(self, *, id: int, sku: str, key: str): + self.id = id + self.sku = sku + self.key = key + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Variant": + from ._schemas.common import VariantSchema + + return VariantSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import VariantSchema + + return VariantSchema().dump(self) diff --git a/src/commercetools/history/models/label.py b/src/commercetools/history/models/label.py new file mode 100644 index 00000000..cef8c9b4 --- /dev/null +++ b/src/commercetools/history/models/label.py @@ -0,0 +1,428 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +if typing.TYPE_CHECKING: + from .common import LocalizedString, Money, Reference + +__all__ = [ + "AssociateRoleLabel", + "BusinessUnitLabel", + "CustomObjectLabel", + "CustomerLabel", + "Label", + "LocalizedLabel", + "OrderLabel", + "PaymentLabel", + "ProductLabel", + "QuoteLabel", + "QuoteRequestLabel", + "ReviewLabel", + "StagedQuoteLabel", + "StringLabel", +] + + +class Label(_BaseType): + """Provides descriptive information specific to the resource.""" + + type: str + + def __init__(self, *, type: str): + self.type = type + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Label": + if data["type"] == "AssociateRoleLabel": + from ._schemas.label import AssociateRoleLabelSchema + + return AssociateRoleLabelSchema().load(data) + if data["type"] == "BusinessUnitLabel": + from ._schemas.label import BusinessUnitLabelSchema + + return BusinessUnitLabelSchema().load(data) + if data["type"] == "CustomObjectLabel": + from ._schemas.label import CustomObjectLabelSchema + + return CustomObjectLabelSchema().load(data) + if data["type"] == "CustomerLabel": + from ._schemas.label import CustomerLabelSchema + + return CustomerLabelSchema().load(data) + if data["type"] == "LocalizedLabel": + from ._schemas.label import LocalizedLabelSchema + + return LocalizedLabelSchema().load(data) + if data["type"] == "OrderLabel": + from ._schemas.label import OrderLabelSchema + + return OrderLabelSchema().load(data) + if data["type"] == "PaymentLabel": + from ._schemas.label import PaymentLabelSchema + + return PaymentLabelSchema().load(data) + if data["type"] == "ProductLabel": + from ._schemas.label import ProductLabelSchema + + return ProductLabelSchema().load(data) + if data["type"] == "QuoteLabel": + from ._schemas.label import QuoteLabelSchema + + return QuoteLabelSchema().load(data) + if data["type"] == "QuoteRequestLabel": + from ._schemas.label import QuoteRequestLabelSchema + + return QuoteRequestLabelSchema().load(data) + if data["type"] == "ReviewLabel": + from ._schemas.label import ReviewLabelSchema + + return ReviewLabelSchema().load(data) + if data["type"] == "StagedQuoteLabel": + from ._schemas.label import StagedQuoteLabelSchema + + return StagedQuoteLabelSchema().load(data) + if data["type"] == "StringLabel": + from ._schemas.label import StringLabelSchema + + return StringLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import LabelSchema + + return LabelSchema().dump(self) + + +class AssociateRoleLabel(Label): + #: User-defined unique identifier of the [Associate Role](ctp:api:type:AssociateRole). + key: str + #: Name of the Associate Role. + name: str + + def __init__(self, *, key: str, name: str): + self.key = key + self.name = name + + super().__init__(type="AssociateRoleLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AssociateRoleLabel": + from ._schemas.label import AssociateRoleLabelSchema + + return AssociateRoleLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import AssociateRoleLabelSchema + + return AssociateRoleLabelSchema().dump(self) + + +class BusinessUnitLabel(Label): + #: User-defined unique identifier of the [Business Unit](ctp:api:type:BusinessUnit). + key: str + #: Name of the Business Unit. + name: str + + def __init__(self, *, key: str, name: str): + self.key = key + self.name = name + + super().__init__(type="BusinessUnitLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "BusinessUnitLabel": + from ._schemas.label import BusinessUnitLabelSchema + + return BusinessUnitLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import BusinessUnitLabelSchema + + return BusinessUnitLabelSchema().dump(self) + + +class CustomObjectLabel(Label): + #: User-defined unique identifier of the CustomObject within the defined `container`. + key: str + #: Namespace to group Custom Objects. + container: str + + def __init__(self, *, key: str, container: str): + self.key = key + self.container = container + + super().__init__(type="CustomObjectLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CustomObjectLabel": + from ._schemas.label import CustomObjectLabelSchema + + return CustomObjectLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import CustomObjectLabelSchema + + return CustomObjectLabelSchema().dump(self) + + +class CustomerLabel(Label): + #: Given name (first name) of the Customer. + first_name: str + #: Family name (last name) of the Customer. + last_name: str + #: User-defined unique identifier of the [Customer](ctp:api:type:Customer). + customer_number: str + + def __init__(self, *, first_name: str, last_name: str, customer_number: str): + self.first_name = first_name + self.last_name = last_name + self.customer_number = customer_number + + super().__init__(type="CustomerLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CustomerLabel": + from ._schemas.label import CustomerLabelSchema + + return CustomerLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import CustomerLabelSchema + + return CustomerLabelSchema().dump(self) + + +class LocalizedLabel(Label): + #: Changed value. + value: "LocalizedString" + + def __init__(self, *, value: "LocalizedString"): + self.value = value + + super().__init__(type="LocalizedLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "LocalizedLabel": + from ._schemas.label import LocalizedLabelSchema + + return LocalizedLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import LocalizedLabelSchema + + return LocalizedLabelSchema().dump(self) + + +class OrderLabel(Label): + #: Email address of the Customer that the Order belongs to. + customer_email: str + #: User-defined unique identifier of the Order that is unique across a Project. + order_number: str + + def __init__(self, *, customer_email: str, order_number: str): + self.customer_email = customer_email + self.order_number = order_number + + super().__init__(type="OrderLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderLabel": + from ._schemas.label import OrderLabelSchema + + return OrderLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import OrderLabelSchema + + return OrderLabelSchema().dump(self) + + +class PaymentLabel(Label): + #: User-defined unique identifier of the Payment. + key: str + #: Money value the Payment intends to receive from the Customer. + amount_planned: "Money" + + def __init__(self, *, key: str, amount_planned: "Money"): + self.key = key + self.amount_planned = amount_planned + + super().__init__(type="PaymentLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentLabel": + from ._schemas.label import PaymentLabelSchema + + return PaymentLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import PaymentLabelSchema + + return PaymentLabelSchema().dump(self) + + +class ProductLabel(Label): + #: User-defined identifier used in a deep-link URL for the Product. + slug: "LocalizedString" + #: Name of the Product. + name: "LocalizedString" + + def __init__(self, *, slug: "LocalizedString", name: "LocalizedString"): + self.slug = slug + self.name = name + + super().__init__(type="ProductLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductLabel": + from ._schemas.label import ProductLabelSchema + + return ProductLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import ProductLabelSchema + + return ProductLabelSchema().dump(self) + + +class QuoteLabel(Label): + #: User-defined unique identifier of the Quote. + key: str + #: The [Buyer](/../api/quotes-overview#buyer) who requested the Quote. + customer: "Reference" + #: Staged Quote related to the Quote. + staged_quote: "Reference" + #: Quote Request related to the Quote. + quote_request: "Reference" + + def __init__( + self, + *, + key: str, + customer: "Reference", + staged_quote: "Reference", + quote_request: "Reference" + ): + self.key = key + self.customer = customer + self.staged_quote = staged_quote + self.quote_request = quote_request + + super().__init__(type="QuoteLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "QuoteLabel": + from ._schemas.label import QuoteLabelSchema + + return QuoteLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import QuoteLabelSchema + + return QuoteLabelSchema().dump(self) + + +class QuoteRequestLabel(Label): + #: User-defined unique identifier of the Quote Request. + key: str + #: The [Buyer](/../api/quotes-overview#buyer) who raised the Quote Request. + customer: "Reference" + + def __init__(self, *, key: str, customer: "Reference"): + self.key = key + self.customer = customer + + super().__init__(type="QuoteRequestLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "QuoteRequestLabel": + from ._schemas.label import QuoteRequestLabelSchema + + return QuoteRequestLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import QuoteRequestLabelSchema + + return QuoteRequestLabelSchema().dump(self) + + +class ReviewLabel(Label): + #: User-defined unique identifier of the Review. + key: str + #: Title of the Review. + title: str + + def __init__(self, *, key: str, title: str): + self.key = key + self.title = title + + super().__init__(type="ReviewLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ReviewLabel": + from ._schemas.label import ReviewLabelSchema + + return ReviewLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import ReviewLabelSchema + + return ReviewLabelSchema().dump(self) + + +class StagedQuoteLabel(Label): + #: User-defined unique identifier of the Staged Quote. + key: str + #: The [Buyer](/../api/quotes-overview#buyer) who requested the Quote. + customer: "Reference" + #: Quote Request related to the Staged Quote. + quote_request: "Reference" + + def __init__(self, *, key: str, customer: "Reference", quote_request: "Reference"): + self.key = key + self.customer = customer + self.quote_request = quote_request + + super().__init__(type="StagedQuoteLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "StagedQuoteLabel": + from ._schemas.label import StagedQuoteLabelSchema + + return StagedQuoteLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import StagedQuoteLabelSchema + + return StagedQuoteLabelSchema().dump(self) + + +class StringLabel(Label): + #: Changed value. + value: str + + def __init__(self, *, value: str): + self.value = value + + super().__init__(type="StringLabel") + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "StringLabel": + from ._schemas.label import StringLabelSchema + + return StringLabelSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.label import StringLabelSchema + + return StringLabelSchema().dump(self) diff --git a/src/commercetools/importapi/client/__init__.py b/src/commercetools/importapi/client/__init__.py index 18e199a3..c3fbccad 100644 --- a/src/commercetools/importapi/client/__init__.py +++ b/src/commercetools/importapi/client/__init__.py @@ -4,15 +4,16 @@ # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen -from commercetools.client import BaseClient +from commercetools.base_client import BaseClient from .by_project_key_request_builder import ByProjectKeyRequestBuilder class Client(BaseClient): + def __init__(self, *args, **kwargs): kwargs.setdefault("url", "https://import.europe-west1.gcp.commercetools.com") - super().__init__(self, **kwargs) + super().__init__(**kwargs) def with_project_key_value(self, project_key: str) -> ByProjectKeyRequestBuilder: return ByProjectKeyRequestBuilder( diff --git a/src/commercetools/importapi/client/by_project_key_request_builder.py b/src/commercetools/importapi/client/by_project_key_request_builder.py index 2f563291..d9a55774 100644 --- a/src/commercetools/importapi/client/by_project_key_request_builder.py +++ b/src/commercetools/importapi/client/by_project_key_request_builder.py @@ -13,6 +13,9 @@ from .customers.by_project_key_customers_request_builder import ( ByProjectKeyCustomersRequestBuilder, ) +from .discount_codes.by_project_key_discount_codes_request_builder import ( + ByProjectKeyDiscountCodesRequestBuilder, +) from .import_containers.by_project_key_import_containers_request_builder import ( ByProjectKeyImportContainersRequestBuilder, ) @@ -56,6 +59,7 @@ class ByProjectKeyRequestBuilder: + _client: "BaseClient" _project_key: str @@ -158,3 +162,9 @@ def types(self) -> ByProjectKeyTypesRequestBuilder: project_key=self._project_key, client=self._client, ) + + def discount_codes(self) -> ByProjectKeyDiscountCodesRequestBuilder: + return ByProjectKeyDiscountCodesRequestBuilder( + project_key=self._project_key, + client=self._client, + ) diff --git a/src/commercetools/importapi/client/categories/by_project_key_categories_request_builder.py b/src/commercetools/importapi/client/categories/by_project_key_categories_request_builder.py index c3c4619b..ff3b4774 100644 --- a/src/commercetools/importapi/client/categories/by_project_key_categories_request_builder.py +++ b/src/commercetools/importapi/client/categories/by_project_key_categories_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyCategoriesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/customers/by_project_key_customers_request_builder.py b/src/commercetools/importapi/client/customers/by_project_key_customers_request_builder.py index 6395a6a8..1c4ac70d 100644 --- a/src/commercetools/importapi/client/customers/by_project_key_customers_request_builder.py +++ b/src/commercetools/importapi/client/customers/by_project_key_customers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyCustomersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/ml/client/image_search/__init__.py b/src/commercetools/importapi/client/discount_codes/__init__.py similarity index 100% rename from src/commercetools/ml/client/image_search/__init__.py rename to src/commercetools/importapi/client/discount_codes/__init__.py diff --git a/src/commercetools/ml/client/similarities/by_project_key_similarities_request_builder.py b/src/commercetools/importapi/client/discount_codes/by_project_key_discount_codes_request_builder.py similarity index 65% rename from src/commercetools/ml/client/similarities/by_project_key_similarities_request_builder.py rename to src/commercetools/importapi/client/discount_codes/by_project_key_discount_codes_request_builder.py index 222b2259..b0ccd42d 100644 --- a/src/commercetools/ml/client/similarities/by_project_key_similarities_request_builder.py +++ b/src/commercetools/importapi/client/discount_codes/by_project_key_discount_codes_request_builder.py @@ -7,15 +7,16 @@ import typing import warnings -from ..products.by_project_key_similarities_products_request_builder import ( - ByProjectKeySimilaritiesProductsRequestBuilder, +from ..import_containers.by_project_key_discount_codes_import_containers_request_builder import ( + ByProjectKeyDiscountCodesImportContainersRequestBuilder, ) if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeySimilaritiesRequestBuilder: +class ByProjectKeyDiscountCodesRequestBuilder: + _client: "BaseClient" _project_key: str @@ -27,8 +28,10 @@ def __init__( self._project_key = project_key self._client = client - def products(self) -> ByProjectKeySimilaritiesProductsRequestBuilder: - return ByProjectKeySimilaritiesProductsRequestBuilder( + def import_containers( + self, + ) -> ByProjectKeyDiscountCodesImportContainersRequestBuilder: + return ByProjectKeyDiscountCodesImportContainersRequestBuilder( project_key=self._project_key, client=self._client, ) diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_by_import_container_key_request_builder.py index 45aec139..6f33b2a1 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCategoriesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_request_builder.py index c237a141..29db8076 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyCategoriesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_by_import_container_key_request_builder.py index faaca99e..8b63ed46 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_request_builder.py index ea6b405a..5a4bcdfb 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyCustomersImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/ml/client/attributes/by_project_key_missing_data_attributes_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_by_import_container_key_request_builder.py similarity index 55% rename from src/commercetools/ml/client/attributes/by_project_key_missing_data_attributes_request_builder.py rename to src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_by_import_container_key_request_builder.py index 24ba4250..7601401a 100644 --- a/src/commercetools/ml/client/attributes/by_project_key_missing_data_attributes_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_by_import_container_key_request_builder.py @@ -7,49 +7,48 @@ import typing import warnings -from ...models.common import TaskToken -from ...models.missing_data import MissingAttributesSearchRequest -from ..status.by_project_key_missing_data_attributes_status_request_builder import ( - ByProjectKeyMissingDataAttributesStatusRequestBuilder, -) +from ...models.errors import ErrorResponse +from ...models.importrequests import DiscountCodeImportRequest, ImportResponse if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyMissingDataAttributesRequestBuilder: +class ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str + _import_container_key: str def __init__( self, project_key: str, + import_container_key: str, client: "BaseClient", ): self._project_key = project_key + self._import_container_key = import_container_key self._client = client - def status(self) -> ByProjectKeyMissingDataAttributesStatusRequestBuilder: - return ByProjectKeyMissingDataAttributesStatusRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - def post( self, - body: "MissingAttributesSearchRequest", + body: "DiscountCodeImportRequest", *, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, - ) -> "TaskToken": + ) -> "ImportResponse": + """Creates a request for creating new Discount Codes or updating existing ones.""" headers = {} if headers is None else headers response = self._client._post( - endpoint=f"/{self._project_key}/missing-data/attributes", + endpoint=f"/{self._project_key}/discount-codes/import-containers/{self._import_container_key}", params={}, json=body.serialize(), headers={"Content-Type": "application/json", **headers}, options=options, ) - if response.status_code == 202: - return TaskToken.deserialize(response.json()) + if response.status_code in (201, 200): + return ImportResponse.deserialize(response.json()) + elif response.status_code == 400: + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_request_builder.py new file mode 100644 index 00000000..6c0dcafc --- /dev/null +++ b/src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_request_builder.py @@ -0,0 +1,40 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from .by_project_key_discount_codes_import_containers_by_import_container_key_request_builder import ( + ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyDiscountCodesImportContainersRequestBuilder: + + _client: "BaseClient" + _project_key: str + + def __init__( + self, + project_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._client = client + + def with_import_container_key_value( + self, import_container_key: str + ) -> ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder: + return ( + ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder( + import_container_key=import_container_key, + project_key=self._project_key, + client=self._client, + ) + ) diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_by_import_container_key_request_builder.py index 162865cc..8144adb3 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_by_import_container_key_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_request_builder.py index 5d509155..a4d3308f 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_import_containers_request_builder.py @@ -22,6 +22,7 @@ class ByProjectKeyImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str @@ -68,8 +69,8 @@ def post( def get( self, *, - limit: float = None, - offset: float = None, + limit: int = None, + offset: int = None, sort: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_by_import_container_key_request_builder.py index afe078c8..681bd4e2 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInventoriesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_request_builder.py index 67c06b44..d70a9ef8 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInventoriesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_by_import_container_key_request_builder.py index f3ca916e..a7751ecf 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrderPatchesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_request_builder.py index 824031c4..fafd995f 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyOrderPatchesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_by_import_container_key_request_builder.py index 772550ec..4f2bf017 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_request_builder.py index 652348d0..ee2100de 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyOrdersImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_by_import_container_key_request_builder.py index 9d32a9db..35620a6a 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyPricesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_request_builder.py index ee706f18..633be05a 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyPricesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_by_import_container_key_request_builder.py index 9b9b2529..f95bd0a4 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductDraftsImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_request_builder.py index df2157c6..3f7425bc 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductDraftsImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_by_import_container_key_request_builder.py index 3edaf5fe..55083f95 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductTypesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_request_builder.py index 5394c5ae..c6b718b0 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductTypesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_by_import_container_key_request_builder.py index 9e7b00a1..35f0fcda 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductVariantPatchesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_request_builder.py index a2494086..47153489 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductVariantPatchesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_by_import_container_key_request_builder.py index 70b034bb..1b00c0d3 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductVariantsImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_request_builder.py index f6d2479b..7956bd21 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductVariantsImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_by_import_container_key_request_builder.py index 322e53f1..5f082372 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductsImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_request_builder.py index e1e12c6c..14d4a93b 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductsImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_by_import_container_key_request_builder.py index 58c953b2..9845b0e0 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_request_builder.py index 5b8a8e18..84dd69cd 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyStandalonePricesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_by_import_container_key_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_by_import_container_key_request_builder.py index 89f4f384..40797707 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_by_import_container_key_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_by_import_container_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_request_builder.py b/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_request_builder.py index f19b9975..a03b29ce 100644 --- a/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_request_builder.py +++ b/src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyTypesImportContainersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_operations/by_project_key_import_containers_by_import_container_key_import_operations_request_builder.py b/src/commercetools/importapi/client/import_operations/by_project_key_import_containers_by_import_container_key_import_operations_request_builder.py index 3ef2e12c..1f6e745a 100644 --- a/src/commercetools/importapi/client/import_operations/by_project_key_import_containers_by_import_container_key_import_operations_request_builder.py +++ b/src/commercetools/importapi/client/import_operations/by_project_key_import_containers_by_import_container_key_import_operations_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyImportContainersByImportContainerKeyImportOperationsRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str @@ -32,8 +33,8 @@ def __init__( def get( self, *, - limit: float = None, - offset: float = None, + limit: int = None, + offset: int = None, sort: typing.List["str"] = None, resource_key: str = None, state: "ProcessingState" = None, diff --git a/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_by_id_request_builder.py b/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_by_id_request_builder.py index 7d12154c..86aeb8fe 100644 --- a/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_by_id_request_builder.py +++ b/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyImportOperationsByIdRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_request_builder.py b/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_request_builder.py index cee982dc..bc21e9dd 100644 --- a/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_request_builder.py +++ b/src/commercetools/importapi/client/import_operations/by_project_key_import_operations_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyImportOperationsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/import_summaries/by_project_key_import_containers_by_import_container_key_import_summaries_request_builder.py b/src/commercetools/importapi/client/import_summaries/by_project_key_import_containers_by_import_container_key_import_summaries_request_builder.py index 2d57d790..79ec34ec 100644 --- a/src/commercetools/importapi/client/import_summaries/by_project_key_import_containers_by_import_container_key_import_summaries_request_builder.py +++ b/src/commercetools/importapi/client/import_summaries/by_project_key_import_containers_by_import_container_key_import_summaries_request_builder.py @@ -14,6 +14,7 @@ class ByProjectKeyImportContainersByImportContainerKeyImportSummariesRequestBuilder: + _client: "BaseClient" _project_key: str _import_container_key: str diff --git a/src/commercetools/importapi/client/inventories/by_project_key_inventories_request_builder.py b/src/commercetools/importapi/client/inventories/by_project_key_inventories_request_builder.py index 21ec5c3c..b6b24f16 100644 --- a/src/commercetools/importapi/client/inventories/by_project_key_inventories_request_builder.py +++ b/src/commercetools/importapi/client/inventories/by_project_key_inventories_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInventoriesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/order_patches/by_project_key_order_patches_request_builder.py b/src/commercetools/importapi/client/order_patches/by_project_key_order_patches_request_builder.py index 7bd8721c..cb4d1576 100644 --- a/src/commercetools/importapi/client/order_patches/by_project_key_order_patches_request_builder.py +++ b/src/commercetools/importapi/client/order_patches/by_project_key_order_patches_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyOrderPatchesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/orders/by_project_key_orders_request_builder.py b/src/commercetools/importapi/client/orders/by_project_key_orders_request_builder.py index 2471193d..88785ecb 100644 --- a/src/commercetools/importapi/client/orders/by_project_key_orders_request_builder.py +++ b/src/commercetools/importapi/client/orders/by_project_key_orders_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyOrdersRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/prices/by_project_key_prices_request_builder.py b/src/commercetools/importapi/client/prices/by_project_key_prices_request_builder.py index 9e7f07b8..6a1fc4cf 100644 --- a/src/commercetools/importapi/client/prices/by_project_key_prices_request_builder.py +++ b/src/commercetools/importapi/client/prices/by_project_key_prices_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyPricesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/product_drafts/by_project_key_product_drafts_request_builder.py b/src/commercetools/importapi/client/product_drafts/by_project_key_product_drafts_request_builder.py index 4b33916e..12af1919 100644 --- a/src/commercetools/importapi/client/product_drafts/by_project_key_product_drafts_request_builder.py +++ b/src/commercetools/importapi/client/product_drafts/by_project_key_product_drafts_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductDraftsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/product_types/by_project_key_product_types_request_builder.py b/src/commercetools/importapi/client/product_types/by_project_key_product_types_request_builder.py index c2405091..423ac648 100644 --- a/src/commercetools/importapi/client/product_types/by_project_key_product_types_request_builder.py +++ b/src/commercetools/importapi/client/product_types/by_project_key_product_types_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductTypesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/product_variant_patches/by_project_key_product_variant_patches_request_builder.py b/src/commercetools/importapi/client/product_variant_patches/by_project_key_product_variant_patches_request_builder.py index 1d9fcf58..2ebab3ab 100644 --- a/src/commercetools/importapi/client/product_variant_patches/by_project_key_product_variant_patches_request_builder.py +++ b/src/commercetools/importapi/client/product_variant_patches/by_project_key_product_variant_patches_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductVariantPatchesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/product_variants/by_project_key_product_variants_request_builder.py b/src/commercetools/importapi/client/product_variants/by_project_key_product_variants_request_builder.py index d60f06cf..97db86e6 100644 --- a/src/commercetools/importapi/client/product_variants/by_project_key_product_variants_request_builder.py +++ b/src/commercetools/importapi/client/product_variants/by_project_key_product_variants_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductVariantsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/products/by_project_key_products_request_builder.py b/src/commercetools/importapi/client/products/by_project_key_products_request_builder.py index 713d654a..70960f84 100644 --- a/src/commercetools/importapi/client/products/by_project_key_products_request_builder.py +++ b/src/commercetools/importapi/client/products/by_project_key_products_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyProductsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/standalone_prices/by_project_key_standalone_prices_request_builder.py b/src/commercetools/importapi/client/standalone_prices/by_project_key_standalone_prices_request_builder.py index 566e44c3..06c6d67b 100644 --- a/src/commercetools/importapi/client/standalone_prices/by_project_key_standalone_prices_request_builder.py +++ b/src/commercetools/importapi/client/standalone_prices/by_project_key_standalone_prices_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyStandalonePricesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/client/types/by_project_key_types_request_builder.py b/src/commercetools/importapi/client/types/by_project_key_types_request_builder.py index 5911eabc..f4f2255b 100644 --- a/src/commercetools/importapi/client/types/by_project_key_types_request_builder.py +++ b/src/commercetools/importapi/client/types/by_project_key_types_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyTypesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/importapi/models/__init__.py b/src/commercetools/importapi/models/__init__.py index bc10c75f..c25af944 100644 --- a/src/commercetools/importapi/models/__init__.py +++ b/src/commercetools/importapi/models/__init__.py @@ -9,6 +9,7 @@ from .common import * # noqa from .customers import * # noqa from .customfields import * # noqa +from .discount_codes import * # noqa from .errors import * # noqa from .importcontainers import * # noqa from .importoperations import * # noqa diff --git a/src/commercetools/importapi/models/_schemas/categories.py b/src/commercetools/importapi/models/_schemas/categories.py index efbd658c..ce6b2d1e 100644 --- a/src/commercetools/importapi/models/_schemas/categories.py +++ b/src/commercetools/importapi/models/_schemas/categories.py @@ -97,4 +97,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CategoryImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/common.py b/src/commercetools/importapi/models/_schemas/common.py index fa5a6799..a08cfda6 100644 --- a/src/commercetools/importapi/models/_schemas/common.py +++ b/src/commercetools/importapi/models/_schemas/common.py @@ -18,6 +18,7 @@ # Fields class LocalizedStringField(marshmallow.fields.Dict): + def _deserialize(self, value, attr, data, **kwargs): result = super()._deserialize(value, attr, data) return models.LocalizedString(**result) @@ -63,6 +64,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Asset(**data) @@ -75,6 +77,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssetDimensions(**data) @@ -102,6 +105,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssetSource(**data) @@ -122,6 +126,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Image(**data) @@ -134,6 +139,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.EnumValue(**data) @@ -150,6 +156,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LocalizedEnumValue(**data) @@ -161,6 +168,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportResource(**data) @@ -184,6 +192,7 @@ def post_load(self, data, **kwargs): class CartKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -194,6 +203,7 @@ def post_load(self, data, **kwargs): class CartDiscountKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -204,6 +214,7 @@ def post_load(self, data, **kwargs): class CategoryKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -214,6 +225,7 @@ def post_load(self, data, **kwargs): class ChannelKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -224,6 +236,7 @@ def post_load(self, data, **kwargs): class CustomerKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -234,6 +247,7 @@ def post_load(self, data, **kwargs): class CustomerGroupKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -244,6 +258,7 @@ def post_load(self, data, **kwargs): class DiscountCodeKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -254,6 +269,7 @@ def post_load(self, data, **kwargs): class OrderKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -264,6 +280,7 @@ def post_load(self, data, **kwargs): class PaymentKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -274,6 +291,7 @@ def post_load(self, data, **kwargs): class PriceKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -284,6 +302,7 @@ def post_load(self, data, **kwargs): class ProductKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -294,6 +313,7 @@ def post_load(self, data, **kwargs): class ProductDiscountKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -304,6 +324,7 @@ def post_load(self, data, **kwargs): class ProductTypeKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -314,6 +335,7 @@ def post_load(self, data, **kwargs): class ProductVariantKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -324,6 +346,7 @@ def post_load(self, data, **kwargs): class ShippingMethodKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -334,6 +357,7 @@ def post_load(self, data, **kwargs): class StateKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -344,6 +368,7 @@ def post_load(self, data, **kwargs): class StoreKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -354,6 +379,7 @@ def post_load(self, data, **kwargs): class TaxCategoryKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -364,6 +390,7 @@ def post_load(self, data, **kwargs): class TypeKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -400,6 +427,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.UnresolvedReferences(**data) @@ -444,6 +472,7 @@ def post_load(self, data, **kwargs): class MoneySchema(TypedMoneySchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -475,6 +504,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedPrice(**data) @@ -497,6 +527,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PriceTier(**data) @@ -614,4 +645,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Address(**data) diff --git a/src/commercetools/importapi/models/_schemas/customers.py b/src/commercetools/importapi/models/_schemas/customers.py index 022147b7..da9b7bb0 100644 --- a/src/commercetools/importapi/models/_schemas/customers.py +++ b/src/commercetools/importapi/models/_schemas/customers.py @@ -131,6 +131,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerAddress(**data) @@ -273,4 +274,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/customfields.py b/src/commercetools/importapi/models/_schemas/customfields.py index 9220bab8..9b1dbb86 100644 --- a/src/commercetools/importapi/models/_schemas/customfields.py +++ b/src/commercetools/importapi/models/_schemas/customfields.py @@ -18,6 +18,7 @@ # Fields class FieldContainerField(marshmallow.fields.Dict): + def _deserialize(self, value, attr, data, **kwargs): result = super()._deserialize(value, attr, data) return models.FieldContainer(**result) @@ -76,6 +77,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Custom(**data) diff --git a/src/commercetools/importapi/models/_schemas/discount_codes.py b/src/commercetools/importapi/models/_schemas/discount_codes.py new file mode 100644 index 00000000..8c34f58d --- /dev/null +++ b/src/commercetools/importapi/models/_schemas/discount_codes.py @@ -0,0 +1,97 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from .common import ImportResourceSchema, LocalizedStringField + +# Fields + + +# Marshmallow Schemas +class DiscountCodeImportSchema(ImportResourceSchema): + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + code = marshmallow.fields.String(allow_none=True, load_default=None) + cart_discounts = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CartDiscountKeyReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="cartDiscounts", + ) + cart_predicate = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="cartPredicate", + ) + is_active = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="isActive" + ) + max_applications = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="maxApplications", + ) + max_applications_per_customer = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="maxApplicationsPerCustomer", + ) + groups = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + valid_from = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="validFrom", + ) + valid_until = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="validUntil", + ) + custom = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customfields.CustomSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DiscountCodeImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/errors.py b/src/commercetools/importapi/models/_schemas/errors.py index 052f37c7..3bd4ba15 100644 --- a/src/commercetools/importapi/models/_schemas/errors.py +++ b/src/commercetools/importapi/models/_schemas/errors.py @@ -93,6 +93,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ErrorResponse(**data) @@ -110,6 +111,7 @@ def post_load(self, data, **kwargs): class AccessDeniedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -120,6 +122,7 @@ def post_load(self, data, **kwargs): class InvalidScopeErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -130,6 +133,7 @@ def post_load(self, data, **kwargs): class InvalidOperationSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -431,10 +435,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.VariantValues(**data) class InsufficientScopeErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -445,6 +451,7 @@ def post_load(self, data, **kwargs): class InvalidCredentialsErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -455,6 +462,7 @@ def post_load(self, data, **kwargs): class InvalidTokenErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -493,6 +501,7 @@ def post_load(self, data, **kwargs): class InvalidJsonInputSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -503,6 +512,7 @@ def post_load(self, data, **kwargs): class InvalidInputSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -632,6 +642,7 @@ def post_load(self, data, **kwargs): class ContentionErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -642,6 +653,7 @@ def post_load(self, data, **kwargs): class GenericErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/importapi/models/_schemas/importcontainers.py b/src/commercetools/importapi/models/_schemas/importcontainers.py index 9a08ce3f..8fd4735b 100644 --- a/src/commercetools/importapi/models/_schemas/importcontainers.py +++ b/src/commercetools/importapi/models/_schemas/importcontainers.py @@ -42,6 +42,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportContainer(**data) @@ -61,6 +62,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportContainerDraft(**data) @@ -80,6 +82,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportContainerUpdateDraft(**data) @@ -101,4 +104,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportContainerPagedResponse(**data) diff --git a/src/commercetools/importapi/models/_schemas/importoperations.py b/src/commercetools/importapi/models/_schemas/importoperations.py index f978e04d..2b2f2702 100644 --- a/src/commercetools/importapi/models/_schemas/importoperations.py +++ b/src/commercetools/importapi/models/_schemas/importoperations.py @@ -133,6 +133,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportOperation(**data) @@ -154,6 +155,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportOperationPagedResponse(**data) @@ -244,4 +246,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportOperationStatus(**data) diff --git a/src/commercetools/importapi/models/_schemas/importrequests.py b/src/commercetools/importapi/models/_schemas/importrequests.py index 7f85187b..d3a705f5 100644 --- a/src/commercetools/importapi/models/_schemas/importrequests.py +++ b/src/commercetools/importapi/models/_schemas/importrequests.py @@ -50,6 +50,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportResponse(**data) @@ -287,3 +288,21 @@ class Meta: def post_load(self, data, **kwargs): del data["type"] return models.TypeImportRequest(**data) + + +class DiscountCodeImportRequestSchema(ImportRequestSchema): + resources = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".discount_codes.DiscountCodeImportSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.DiscountCodeImportRequest(**data) diff --git a/src/commercetools/importapi/models/_schemas/importsummaries.py b/src/commercetools/importapi/models/_schemas/importsummaries.py index 407e44c8..c36b2956 100644 --- a/src/commercetools/importapi/models/_schemas/importsummaries.py +++ b/src/commercetools/importapi/models/_schemas/importsummaries.py @@ -32,6 +32,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImportSummary(**data) @@ -53,4 +54,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OperationStates(**data) diff --git a/src/commercetools/importapi/models/_schemas/inventories.py b/src/commercetools/importapi/models/_schemas/inventories.py index 96662593..dd47e6fe 100644 --- a/src/commercetools/importapi/models/_schemas/inventories.py +++ b/src/commercetools/importapi/models/_schemas/inventories.py @@ -57,4 +57,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.InventoryImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/order_patches.py b/src/commercetools/importapi/models/_schemas/order_patches.py index b4792fcf..cdd3be54 100644 --- a/src/commercetools/importapi/models/_schemas/order_patches.py +++ b/src/commercetools/importapi/models/_schemas/order_patches.py @@ -22,7 +22,7 @@ class ReturnItemDraftSchema(helpers.BaseSchema): - quantity = marshmallow.fields.Float(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) line_item_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, @@ -51,6 +51,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReturnItemDraft(**data) @@ -80,6 +81,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReturnInfo(**data) @@ -116,6 +118,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DeliveryParcel(**data) @@ -149,6 +152,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DeliveryParcelDraft(**data) @@ -180,6 +184,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DeliveryDraft(**data) @@ -200,6 +205,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DeliveryAddressDraft(**data) @@ -220,6 +226,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ParcelMeasurementDraft(**data) @@ -241,6 +248,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ParcelTrackingData(**data) @@ -262,6 +270,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ParcelItems(**data) @@ -273,6 +282,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.RemoveDeliveryDraft(**data) @@ -286,6 +296,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.RemoveParcelFromDeliveryDraft(**data) @@ -370,6 +381,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderField(**data) @@ -389,4 +401,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderPatchImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/orders.py b/src/commercetools/importapi/models/_schemas/orders.py index 40bd7d06..8d10bede 100644 --- a/src/commercetools/importapi/models/_schemas/orders.py +++ b/src/commercetools/importapi/models/_schemas/orders.py @@ -33,7 +33,7 @@ # Marshmallow Schemas class ItemStateSchema(helpers.BaseSchema): - quantity = marshmallow.fields.Float(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) state = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.StateKeyReferenceSchema"), allow_none=True, @@ -46,6 +46,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ItemState(**data) @@ -53,13 +54,14 @@ class ItemShippingTargetSchema(helpers.BaseSchema): address_key = marshmallow.fields.String( allow_none=True, load_default=None, data_key="addressKey" ) - quantity = marshmallow.fields.Float(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ItemShippingTarget(**data) @@ -77,6 +79,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ItemShippingDetailsDraft(**data) @@ -150,6 +153,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LineItemPrice(**data) @@ -264,6 +268,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LineItemProductVariantImportDraft(**data) @@ -292,7 +297,7 @@ class LineItemImportDraftSchema(helpers.BaseSchema): unknown=marshmallow.EXCLUDE, load_default=None, ) - quantity = marshmallow.fields.Float(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) state = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".ItemStateSchema"), allow_none=True, @@ -346,6 +351,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LineItemImportDraft(**data) @@ -435,29 +441,30 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingRateDraft(**data) class ParcelMeasurementsSchema(helpers.BaseSchema): - height_in_millimeter = marshmallow.fields.Float( + height_in_millimeter = marshmallow.fields.Integer( allow_none=True, metadata={"omit_empty": True}, load_default=None, data_key="heightInMillimeter", ) - length_in_millimeter = marshmallow.fields.Float( + length_in_millimeter = marshmallow.fields.Integer( allow_none=True, metadata={"omit_empty": True}, load_default=None, data_key="lengthInMillimeter", ) - width_in_millimeter = marshmallow.fields.Float( + width_in_millimeter = marshmallow.fields.Integer( allow_none=True, metadata={"omit_empty": True}, load_default=None, data_key="widthInMillimeter", ) - weight_in_gram = marshmallow.fields.Float( + weight_in_gram = marshmallow.fields.Integer( allow_none=True, metadata={"omit_empty": True}, load_default=None, @@ -469,6 +476,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ParcelMeasurements(**data) @@ -503,18 +511,20 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TrackingData(**data) class DeliveryItemSchema(helpers.BaseSchema): id = marshmallow.fields.String(allow_none=True, load_default=None) - quantity = marshmallow.fields.Float(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DeliveryItem(**data) @@ -559,6 +569,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Parcel(**data) @@ -594,6 +605,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Delivery(**data) @@ -617,6 +629,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedLineItemPortion(**data) @@ -641,6 +654,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedLineItemPriceDraft(**data) @@ -720,6 +734,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingInfoImportDraft(**data) @@ -753,6 +768,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExternalTaxRateDraft(**data) @@ -787,6 +803,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomLineItemTaxedPrice(**data) @@ -828,7 +845,7 @@ class CustomLineItemDraftSchema(helpers.BaseSchema): data_key="totalPrice", ) slug = marshmallow.fields.String(allow_none=True, load_default=None) - quantity = marshmallow.fields.Float(allow_none=True, load_default=None) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) state = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".ItemStateSchema"), allow_none=True, @@ -884,6 +901,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomLineItemDraft(**data) @@ -909,6 +927,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxPortion(**data) @@ -941,6 +960,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxedPrice(**data) @@ -966,6 +986,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SyncInfo(**data) @@ -990,6 +1011,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountCodeInfo(**data) @@ -1025,7 +1047,7 @@ def post_load(self, data, **kwargs): class ScoreShippingRateInputSchema(ShippingRateInputSchema): - score = marshmallow.fields.Float(allow_none=True, load_default=None) + score = marshmallow.fields.Integer(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -1223,4 +1245,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/prices.py b/src/commercetools/importapi/models/_schemas/prices.py index a25ba67a..ff6fd949 100644 --- a/src/commercetools/importapi/models/_schemas/prices.py +++ b/src/commercetools/importapi/models/_schemas/prices.py @@ -28,6 +28,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SubRate(**data) @@ -59,6 +60,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxRate(**data) @@ -114,6 +116,9 @@ class PriceImportSchema(ImportResourceSchema): publish = marshmallow.fields.Boolean( allow_none=True, metadata={"omit_empty": True}, load_default=None ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) tiers = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.PriceTierSchema"), allow_none=True, @@ -148,4 +153,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PriceImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/productdrafts.py b/src/commercetools/importapi/models/_schemas/productdrafts.py index f3a9c85a..66fbea40 100644 --- a/src/commercetools/importapi/models/_schemas/productdrafts.py +++ b/src/commercetools/importapi/models/_schemas/productdrafts.py @@ -129,6 +129,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductDraftImport(**data) @@ -244,6 +245,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantDraftImport(**data) @@ -318,4 +320,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PriceDraftImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/products.py b/src/commercetools/importapi/models/_schemas/products.py index ce7a1066..c8794a76 100644 --- a/src/commercetools/importapi/models/_schemas/products.py +++ b/src/commercetools/importapi/models/_schemas/products.py @@ -75,6 +75,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SearchKeyword(**data) @@ -105,6 +106,7 @@ def post_load(self, data, **kwargs): class WhitespaceTokenizerSchema(SuggestTokenizerSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -207,4 +209,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/producttypes.py b/src/commercetools/importapi/models/_schemas/producttypes.py index bc2d062b..60bc6735 100644 --- a/src/commercetools/importapi/models/_schemas/producttypes.py +++ b/src/commercetools/importapi/models/_schemas/producttypes.py @@ -86,6 +86,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeDefinition(**data) @@ -102,6 +103,7 @@ def post_load(self, data, **kwargs): class AttributeBooleanTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -112,6 +114,7 @@ def post_load(self, data, **kwargs): class AttributeDateTimeTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -122,6 +125,7 @@ def post_load(self, data, **kwargs): class AttributeDateTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -158,10 +162,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributePlainEnumValue(**data) class AttributeLocalizableTextTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -202,10 +208,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeLocalizedEnumValue(**data) class AttributeMoneyTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -234,6 +242,7 @@ def post_load(self, data, **kwargs): class AttributeNumberTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -294,6 +303,7 @@ def post_load(self, data, **kwargs): class AttributeTextTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -304,6 +314,7 @@ def post_load(self, data, **kwargs): class AttributeTimeTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -330,4 +341,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductTypeImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/productvariants.py b/src/commercetools/importapi/models/_schemas/productvariants.py index b47ff13c..e16895e3 100644 --- a/src/commercetools/importapi/models/_schemas/productvariants.py +++ b/src/commercetools/importapi/models/_schemas/productvariants.py @@ -513,6 +513,9 @@ class ProductVariantImportSchema(ImportResourceSchema): publish = marshmallow.fields.Boolean( allow_none=True, metadata={"omit_empty": True}, load_default=None ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) product = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.ProductKeyReferenceSchema"), allow_none=True, @@ -525,6 +528,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantImport(**data) @@ -559,6 +563,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantPatch(**data) diff --git a/src/commercetools/importapi/models/_schemas/standalone_prices.py b/src/commercetools/importapi/models/_schemas/standalone_prices.py index 75639354..96463194 100644 --- a/src/commercetools/importapi/models/_schemas/standalone_prices.py +++ b/src/commercetools/importapi/models/_schemas/standalone_prices.py @@ -90,4 +90,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StandalonePriceImport(**data) diff --git a/src/commercetools/importapi/models/_schemas/types.py b/src/commercetools/importapi/models/_schemas/types.py index 2186cf63..f656de3a 100644 --- a/src/commercetools/importapi/models/_schemas/types.py +++ b/src/commercetools/importapi/models/_schemas/types.py @@ -35,6 +35,7 @@ def post_load(self, data, **kwargs): class CustomFieldBooleanTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -45,6 +46,7 @@ def post_load(self, data, **kwargs): class CustomFieldDateTimeTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -55,6 +57,7 @@ def post_load(self, data, **kwargs): class CustomFieldDateTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -91,6 +94,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomFieldEnumValue(**data) @@ -125,10 +129,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomFieldLocalizedEnumValue(**data) class CustomFieldLocalizedStringTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -139,6 +145,7 @@ def post_load(self, data, **kwargs): class CustomFieldMoneyTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -149,6 +156,7 @@ def post_load(self, data, **kwargs): class CustomFieldNumberTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -212,6 +220,7 @@ def post_load(self, data, **kwargs): class CustomFieldStringTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -222,6 +231,7 @@ def post_load(self, data, **kwargs): class CustomFieldTimeTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -276,6 +286,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.FieldDefinition(**data) @@ -312,4 +323,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TypeImport(**data) diff --git a/src/commercetools/importapi/models/common.py b/src/commercetools/importapi/models/common.py index 74a8790c..4f018b16 100644 --- a/src/commercetools/importapi/models/common.py +++ b/src/commercetools/importapi/models/common.py @@ -401,6 +401,7 @@ class CartKeyReference(KeyReference): """References a cart by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.CART) @classmethod @@ -419,6 +420,7 @@ class CartDiscountKeyReference(KeyReference): """References a cart discount by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.CART_DISCOUNT) @classmethod @@ -439,6 +441,7 @@ class CategoryKeyReference(KeyReference): """References a category by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.CATEGORY) @classmethod @@ -457,6 +460,7 @@ class ChannelKeyReference(KeyReference): """References a channel by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.CHANNEL) @classmethod @@ -475,6 +479,7 @@ class CustomerKeyReference(KeyReference): """References a customer by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.CUSTOMER) @classmethod @@ -493,6 +498,7 @@ class CustomerGroupKeyReference(KeyReference): """References a customer group by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.CUSTOMER_GROUP) @classmethod @@ -513,6 +519,7 @@ class DiscountCodeKeyReference(KeyReference): """References a discount code by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.DISCOUNT_CODE) @classmethod @@ -533,6 +540,7 @@ class OrderKeyReference(KeyReference): """References an order by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.ORDER) @classmethod @@ -551,6 +559,7 @@ class PaymentKeyReference(KeyReference): """References a payment by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.PAYMENT) @classmethod @@ -569,6 +578,7 @@ class PriceKeyReference(KeyReference): """References a price by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.PRICE) @classmethod @@ -587,6 +597,7 @@ class ProductKeyReference(KeyReference): """References a product by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.PRODUCT) @classmethod @@ -605,6 +616,7 @@ class ProductDiscountKeyReference(KeyReference): """References a product discount by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.PRODUCT_DISCOUNT) @classmethod @@ -625,6 +637,7 @@ class ProductTypeKeyReference(KeyReference): """References a product type by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.PRODUCT_TYPE) @classmethod @@ -645,6 +658,7 @@ class ProductVariantKeyReference(KeyReference): """References a product variant by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.PRODUCT_VARIANT) @classmethod @@ -665,6 +679,7 @@ class ShippingMethodKeyReference(KeyReference): """References a shipping method by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.SHIPPING_METHOD) @classmethod @@ -685,6 +700,7 @@ class StateKeyReference(KeyReference): """References a state by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.STATE) @classmethod @@ -703,6 +719,7 @@ class StoreKeyReference(KeyReference): """References a store by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.STORE) @classmethod @@ -721,6 +738,7 @@ class TaxCategoryKeyReference(KeyReference): """References a tax category by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.TAX_CATEGORY) @classmethod @@ -741,6 +759,7 @@ class TypeKeyReference(KeyReference): """References a type by key.""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceType.TYPE) @classmethod @@ -879,6 +898,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class Money(TypedMoney): + def __init__( self, *, @@ -886,6 +906,7 @@ def __init__( cent_amount: int, currency_code: str ): + super().__init__( fraction_digits=fraction_digits, cent_amount=cent_amount, @@ -970,6 +991,7 @@ class ImportResourceType(enum.Enum): PRODUCT_VARIANT_PATCH = "product-variant-patch" STANDALONE_PRICE = "standalone-price" TYPE = "type" + DISCOUNT_CODE = "discount-code" class ReferenceType(enum.Enum): diff --git a/src/commercetools/importapi/models/discount_codes.py b/src/commercetools/importapi/models/discount_codes.py new file mode 100644 index 00000000..38d475bc --- /dev/null +++ b/src/commercetools/importapi/models/discount_codes.py @@ -0,0 +1,91 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType +from .common import ImportResource + +if typing.TYPE_CHECKING: + from .common import CartDiscountKeyReference, LocalizedString + from .customfields import Custom + +__all__ = ["DiscountCodeImport"] + + +class DiscountCodeImport(ImportResource): + """The data representation for a Discount Code to be imported that is persisted as a [Discount Code](/../api/projects/discountCodes#discountcode) in the Project.""" + + #: Maps to `DiscountCode.name`. + name: typing.Optional["LocalizedString"] + #: Maps to `DiscountCode.description`. + description: typing.Optional["LocalizedString"] + #: User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount. + code: str + #: Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied. + cart_discounts: typing.List["CartDiscountKeyReference"] + #: DiscountCode can only be applied to Carts that match this predicate. + cart_predicate: typing.Optional[str] + #: Indicates if the DiscountCode is active and can be applied to the Cart. + is_active: bool + #: Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or update. However, Order cancellation or deletion does not decrement the count. + max_applications: typing.Optional[int] + #: Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or update. However, Order cancellation or deletion does not decrement the count. + max_applications_per_customer: typing.Optional[int] + #: Groups to which the DiscountCode belongs. + groups: typing.Optional[typing.List["str"]] + #: Date and time (UTC) from which the DiscountCode is effective. + valid_from: typing.Optional[datetime.datetime] + #: Date and time (UTC) until which the DiscountCode is effective. + valid_until: typing.Optional[datetime.datetime] + #: Custom Fields of the DiscountCode. + custom: typing.Optional["Custom"] + + def __init__( + self, + *, + key: str, + name: typing.Optional["LocalizedString"] = None, + description: typing.Optional["LocalizedString"] = None, + code: str, + cart_discounts: typing.List["CartDiscountKeyReference"], + cart_predicate: typing.Optional[str] = None, + is_active: bool, + max_applications: typing.Optional[int] = None, + max_applications_per_customer: typing.Optional[int] = None, + groups: typing.Optional[typing.List["str"]] = None, + valid_from: typing.Optional[datetime.datetime] = None, + valid_until: typing.Optional[datetime.datetime] = None, + custom: typing.Optional["Custom"] = None + ): + self.name = name + self.description = description + self.code = code + self.cart_discounts = cart_discounts + self.cart_predicate = cart_predicate + self.is_active = is_active + self.max_applications = max_applications + self.max_applications_per_customer = max_applications_per_customer + self.groups = groups + self.valid_from = valid_from + self.valid_until = valid_until + self.custom = custom + + super().__init__(key=key) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DiscountCodeImport": + from ._schemas.discount_codes import DiscountCodeImportSchema + + return DiscountCodeImportSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.discount_codes import DiscountCodeImportSchema + + return DiscountCodeImportSchema().dump(self) diff --git a/src/commercetools/importapi/models/errors.py b/src/commercetools/importapi/models/errors.py index cebc95ae..c4bfb22c 100644 --- a/src/commercetools/importapi/models/errors.py +++ b/src/commercetools/importapi/models/errors.py @@ -49,7 +49,7 @@ class ErrorResponse(_BaseType): """The response in case of an error.""" - #: The http status code of the response. + #: The HTTP status code of the response. status_code: int #: Describes the error. message: str @@ -203,6 +203,7 @@ class AccessDeniedError(ErrorObject): """This is the generic error code for access denied. In case of a wrong scope, an [InvalidScopeError](#invalidscopeerror) will be returned.""" def __init__(self, *, message: str): + super().__init__(message=message, code="access_denied") @classmethod @@ -221,6 +222,7 @@ class InvalidScopeError(ErrorObject): """The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner.""" def __init__(self, *, message: str): + super().__init__(message=message, code="invalid_scope") @classmethod @@ -242,6 +244,7 @@ class InvalidOperation(ErrorObject): """ def __init__(self, *, message: str): + super().__init__(message=message, code="InvalidOperation") @classmethod @@ -396,7 +399,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InsufficientScopeError(ErrorObject): + def __init__(self, *, message: str): + super().__init__(message=message, code="insufficient_scope") @classmethod @@ -414,7 +419,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InvalidCredentialsError(ErrorObject): + def __init__(self, *, message: str): + super().__init__(message=message, code="InvalidCredentials") @classmethod @@ -432,7 +439,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InvalidTokenError(ErrorObject): + def __init__(self, *, message: str): + super().__init__(message=message, code="invalid_token") @classmethod @@ -497,6 +506,7 @@ class InvalidJsonInput(ErrorObject): """ def __init__(self, *, message: str): + super().__init__(message=message, code="InvalidJsonInput") @classmethod @@ -518,6 +528,7 @@ class InvalidInput(ErrorObject): """ def __init__(self, *, message: str): + super().__init__(message=message, code="InvalidInput") @classmethod @@ -710,7 +721,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ContentionError(ErrorObject): + def __init__(self, *, message: str): + super().__init__(message=message, code="Contention") @classmethod @@ -726,7 +739,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GenericError(ErrorObject): + def __init__(self, *, message: str): + super().__init__(message=message, code="Generic") @classmethod diff --git a/src/commercetools/importapi/models/importrequests.py b/src/commercetools/importapi/models/importrequests.py index e2912a8d..7f5c37d5 100644 --- a/src/commercetools/importapi/models/importrequests.py +++ b/src/commercetools/importapi/models/importrequests.py @@ -16,6 +16,7 @@ from .categories import CategoryImport from .common import ImportResourceType from .customers import CustomerImport + from .discount_codes import DiscountCodeImport from .importoperations import ImportOperationStatus from .inventories import InventoryImport from .order_patches import OrderPatchImport @@ -31,6 +32,7 @@ __all__ = [ "CategoryImportRequest", "CustomerImportRequest", + "DiscountCodeImportRequest", "ImportRequest", "ImportResponse", "InventoryImportRequest", @@ -112,6 +114,10 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ImportRequest": from ._schemas.importrequests import TypeImportRequestSchema return TypeImportRequestSchema().load(data) + if data["type"] == "discount-code": + from ._schemas.importrequests import DiscountCodeImportRequestSchema + + return DiscountCodeImportRequestSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: from ._schemas.importrequests import ImportRequestSchema @@ -266,7 +272,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PriceImportRequest(ImportRequest): - """The request body to [import Embedded Prices](#import-embedded-prices). Contains data for [Embedded Prices](/../api/projects/products#embedded-price) to be created or updated in a Project.""" + """The request body to [import Embedded Prices](#import-embedded-prices). Contains data for [Embedded Prices](/../api/types#price) to be created or updated in a Project.""" #: The price import resources of this request. resources: typing.List["PriceImport"] @@ -455,3 +461,28 @@ def serialize(self) -> typing.Dict[str, typing.Any]: from ._schemas.importrequests import TypeImportRequestSchema return TypeImportRequestSchema().dump(self) + + +class DiscountCodeImportRequest(ImportRequest): + """The request body to [import Discount Codes](#import-discount-codes). Contains data for [Discount Codes](/../api/projects/discountCodes#discountcode) to be created or updated in a Project.""" + + #: The Discount Code import resources of this request. + resources: typing.List["DiscountCodeImport"] + + def __init__(self, *, resources: typing.List["DiscountCodeImport"]): + self.resources = resources + + super().__init__(type=ImportResourceType.DISCOUNT_CODE) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountCodeImportRequest": + from ._schemas.importrequests import DiscountCodeImportRequestSchema + + return DiscountCodeImportRequestSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.importrequests import DiscountCodeImportRequestSchema + + return DiscountCodeImportRequestSchema().dump(self) diff --git a/src/commercetools/importapi/models/importsummaries.py b/src/commercetools/importapi/models/importsummaries.py index 58b2bce6..9f0c5249 100644 --- a/src/commercetools/importapi/models/importsummaries.py +++ b/src/commercetools/importapi/models/importsummaries.py @@ -44,6 +44,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OperationStates(_BaseType): + """The number of resources in each [Processing State](/processing-state#processingstate).""" + #: The number of resources in the `processing` state. processing: int #: The number of resources in the `validationFailed` state. diff --git a/src/commercetools/importapi/models/order_patches.py b/src/commercetools/importapi/models/order_patches.py index bc9d4c37..896453ae 100644 --- a/src/commercetools/importapi/models/order_patches.py +++ b/src/commercetools/importapi/models/order_patches.py @@ -43,7 +43,7 @@ class ReturnShipmentState(enum.Enum): class ReturnItemDraft(_BaseType): - quantity: float + quantity: int line_item_id: typing.Optional[str] custom_line_item_id: typing.Optional[str] comment: typing.Optional[str] @@ -53,7 +53,7 @@ class ReturnItemDraft(_BaseType): def __init__( self, *, - quantity: float, + quantity: int, line_item_id: typing.Optional[str] = None, custom_line_item_id: typing.Optional[str] = None, comment: typing.Optional[str] = None, diff --git a/src/commercetools/importapi/models/orders.py b/src/commercetools/importapi/models/orders.py index 190b5147..7d105c70 100644 --- a/src/commercetools/importapi/models/orders.py +++ b/src/commercetools/importapi/models/orders.py @@ -83,11 +83,11 @@ class ItemState(_BaseType): """The item's state.""" - quantity: float + quantity: int #: Maps to `ItemState.state`. state: "StateKeyReference" - def __init__(self, *, quantity: float, state: "StateKeyReference"): + def __init__(self, *, quantity: int, state: "StateKeyReference"): self.quantity = quantity self.state = state @@ -111,9 +111,9 @@ class ItemShippingTarget(_BaseType): #: Maps to `ItemShippingTarget.addressKey`. address_key: str #: Maps to `ItemShippingTarget.quantity`. - quantity: float + quantity: int - def __init__(self, *, address_key: str, quantity: float): + def __init__(self, *, address_key: str, quantity: int): self.address_key = address_key self.quantity = quantity @@ -271,7 +271,7 @@ class LineItemImportDraft(_BaseType): #: Maps to `LineItem.price`. price: "LineItemPrice" #: Maps to `LineItem.quantity`. - quantity: float + quantity: int state: typing.Optional[typing.List["ItemState"]] #: Maps to `LineItem.supplyChannel`. #: The Reference to the Supply [Channel](/../api/projects/channels#channel) with which the LineItem is associated. @@ -295,7 +295,7 @@ def __init__( name: "LocalizedString", variant: "LineItemProductVariantImportDraft", price: "LineItemPrice", - quantity: float, + quantity: int, state: typing.Optional[typing.List["ItemState"]] = None, supply_channel: typing.Optional["ChannelKeyReference"] = None, distribution_channel: typing.Optional["ChannelKeyReference"] = None, @@ -422,18 +422,18 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ParcelMeasurements(_BaseType): - height_in_millimeter: typing.Optional[float] - length_in_millimeter: typing.Optional[float] - width_in_millimeter: typing.Optional[float] - weight_in_gram: typing.Optional[float] + height_in_millimeter: typing.Optional[int] + length_in_millimeter: typing.Optional[int] + width_in_millimeter: typing.Optional[int] + weight_in_gram: typing.Optional[int] def __init__( self, *, - height_in_millimeter: typing.Optional[float] = None, - length_in_millimeter: typing.Optional[float] = None, - width_in_millimeter: typing.Optional[float] = None, - weight_in_gram: typing.Optional[float] = None + height_in_millimeter: typing.Optional[int] = None, + length_in_millimeter: typing.Optional[int] = None, + width_in_millimeter: typing.Optional[int] = None, + weight_in_gram: typing.Optional[int] = None ): self.height_in_millimeter = height_in_millimeter self.length_in_millimeter = length_in_millimeter @@ -492,9 +492,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class DeliveryItem(_BaseType): id: str - quantity: float + quantity: int - def __init__(self, *, id: str, quantity: float): + def __init__(self, *, id: str, quantity: int): self.id = id self.quantity = quantity @@ -783,7 +783,7 @@ class CustomLineItemDraft(_BaseType): taxed_price: typing.Optional["CustomLineItemTaxedPrice"] total_price: "TypedMoney" slug: str - quantity: float + quantity: int state: typing.Optional[typing.List["ItemState"]] #: References a tax category by key. tax_category: typing.Optional["TaxCategoryKeyReference"] @@ -802,7 +802,7 @@ def __init__( taxed_price: typing.Optional["CustomLineItemTaxedPrice"] = None, total_price: "TypedMoney", slug: str, - quantity: float, + quantity: int, state: typing.Optional[typing.List["ItemState"]] = None, tax_category: typing.Optional["TaxCategoryKeyReference"] = None, tax_rate: typing.Optional["TaxRate"] = None, @@ -1101,9 +1101,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ScoreShippingRateInput(ShippingRateInput): - score: float + score: int - def __init__(self, *, score: float): + def __init__(self, *, score: int): self.score = score super().__init__(type=ShippingRateInputType.SCORE) @@ -1126,7 +1126,7 @@ class OrderImport(_BaseType): """The data representation for an Order to be imported that is persisted as an [Order](/../api/projects/orders#top) in the Project. In commercetools, you can import an Order using the - [Create Order by Import](/../api/projects/orders-import#create-order-by-import) + [Create Order by Import](ctp:import:endpoint:/{projectKey}/orders/import:POST) endpoint method instead of creating it from a Cart. An OrderImport is a snapshot of an order at the time it was imported. diff --git a/src/commercetools/importapi/models/prices.py b/src/commercetools/importapi/models/prices.py index 299b0b13..0f5d4556 100644 --- a/src/commercetools/importapi/models/prices.py +++ b/src/commercetools/importapi/models/prices.py @@ -111,17 +111,20 @@ class PriceImport(ImportResource): channel: typing.Optional["ChannelKeyReference"] #: Sets a discounted price from an external service. discounted: typing.Optional["DiscountedPrice"] - #: Only the [Embedded Price](/../api/projects/products#embedded-price) updates will be published to `staged` and `current` projection. + #: Only the [Embedded Price](/../api/types#price) updates will be published to `staged` and `current` projection. publish: typing.Optional[bool] + #: - Set to `false` to update both the [current and staged projections](/../api/projects/productProjections#current--staged) of the [Product](/../api/projects/products#product) with the new Price data. + #: - Leave empty or set to `true` to only update the staged projection. + staged: typing.Optional[bool] #: The tiered prices for this price. tiers: typing.Optional[typing.List["PriceTier"]] #: The custom fields for this price. custom: typing.Optional["Custom"] - #: The ProductVariant in which this [Embedded Price](/../api/projects/products#embedded-price) is contained. + #: The ProductVariant in which this [Embedded Price](/../api/types#price) is contained. #: The Reference to the [ProductVariant](/../api/projects/products#productvariant) with which the [Price](/../api/types#price) is associated. #: If referenced ProductVariant does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary ProductVariant is created. product_variant: "ProductVariantKeyReference" - #: The Product in which the Product Variant containing this [Embedded Price](/../api/projects/products#embedded-price) is contained. Maps to `ProductVariant.product`. + #: The Product in which the Product Variant containing this [Embedded Price](/../api/types#price) is contained. Maps to `ProductVariant.product`. #: The Reference to the [Product](/../api/projects/products#product) with which the [Price](/../api/types#price) is associated. #: If referenced Product does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary Product is created. product: "ProductKeyReference" @@ -138,6 +141,7 @@ def __init__( channel: typing.Optional["ChannelKeyReference"] = None, discounted: typing.Optional["DiscountedPrice"] = None, publish: typing.Optional[bool] = None, + staged: typing.Optional[bool] = None, tiers: typing.Optional[typing.List["PriceTier"]] = None, custom: typing.Optional["Custom"] = None, product_variant: "ProductVariantKeyReference", @@ -151,6 +155,7 @@ def __init__( self.channel = channel self.discounted = discounted self.publish = publish + self.staged = staged self.tiers = tiers self.custom = custom self.product_variant = product_variant diff --git a/src/commercetools/importapi/models/productdrafts.py b/src/commercetools/importapi/models/productdrafts.py index 55d1f573..ea43ede1 100644 --- a/src/commercetools/importapi/models/productdrafts.py +++ b/src/commercetools/importapi/models/productdrafts.py @@ -106,9 +106,7 @@ class ProductDraftImport(ImportResource): #: The Reference to the [State](/../api/projects/states#state) with which the ProductDraft is associated. #: If referenced State does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary State is created. state: typing.Optional["StateKeyReference"] - #: If `publish` is set to either `true` or `false`, both staged and current projections are set to the same value provided by the import data. - #: If `publish` is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. - #: However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether `publish` is set or not. + #: Determines the published status and current/staged projection of the Product. For more information, see [Managing the published state of Products](/best-practices#managing-the-published-state-of-products). publish: typing.Optional[bool] #: Determines the type of Prices the API uses. See [ProductPriceMode](/../api/projects/products#productpricemode) for more details. If not provided, the existing `Product.priceMode` is not changed. price_mode: typing.Optional["ProductPriceModeEnum"] diff --git a/src/commercetools/importapi/models/products.py b/src/commercetools/importapi/models/products.py index 1b3d5c70..cd3e4da4 100644 --- a/src/commercetools/importapi/models/products.py +++ b/src/commercetools/importapi/models/products.py @@ -112,7 +112,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class WhitespaceTokenizer(SuggestTokenizer): + def __init__(self): + super().__init__(type="whitespace") @classmethod @@ -199,9 +201,7 @@ class ProductImport(ImportResource): #: The Reference to the [State](/../api/projects/states#state) with which the Product is associated. #: If referenced State does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary State is created. state: typing.Optional["StateKeyReference"] - #: If `publish` is set to either `true` or `false`, both staged and current projections are set to the same value provided by the import data. - #: If `publish` is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. - #: However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether `publish` is set or not. + #: Determines the published status and current/staged projection of the Product. For more information, see [Managing the published state of Products](/best-practices#managing-the-published-state-of-products). publish: typing.Optional[bool] #: Determines the type of Prices the API uses. See [ProductPriceMode](/../api/projects/products#productpricemode) for more details. If not provided, the existing `Product.priceMode` is not changed. price_mode: typing.Optional["ProductPriceModeEnum"] diff --git a/src/commercetools/importapi/models/producttypes.py b/src/commercetools/importapi/models/producttypes.py index 4cec486f..07ba33e1 100644 --- a/src/commercetools/importapi/models/producttypes.py +++ b/src/commercetools/importapi/models/producttypes.py @@ -168,7 +168,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeBooleanType(AttributeType): + def __init__(self): + super().__init__(name="boolean") @classmethod @@ -184,7 +186,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeDateTimeType(AttributeType): + def __init__(self): + super().__init__(name="datetime") @classmethod @@ -200,7 +204,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeDateType(AttributeType): + def __init__(self): + super().__init__(name="date") @classmethod @@ -260,7 +266,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeLocalizableTextType(AttributeType): + def __init__(self): + super().__init__(name="ltext") @classmethod @@ -331,7 +339,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeMoneyType(AttributeType): + def __init__(self): + super().__init__(name="money") @classmethod @@ -368,7 +378,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeNumberType(AttributeType): + def __init__(self): + super().__init__(name="number") @classmethod @@ -427,7 +439,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeTextType(AttributeType): + def __init__(self): + super().__init__(name="text") @classmethod @@ -443,7 +457,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeTimeType(AttributeType): + def __init__(self): + super().__init__(name="time") @classmethod diff --git a/src/commercetools/importapi/models/productvariants.py b/src/commercetools/importapi/models/productvariants.py index f27a2b2d..24d85cf8 100644 --- a/src/commercetools/importapi/models/productvariants.py +++ b/src/commercetools/importapi/models/productvariants.py @@ -720,6 +720,9 @@ class ProductVariantImport(ImportResource): #: If `publish` is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. #: However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether `publish` is set or not. publish: typing.Optional[bool] + #: - Set to `false` to update both the [current and staged projections](/../api/projects/productProjections#current--staged) of the [Product](/../api/projects/products#product) with the new Product Variant data. + #: - Leave empty or set to `true` to only update the staged projection. + staged: typing.Optional[bool] #: The [Product](/../api/projects/products#productvariant) to which this Product Variant belongs. Maps to `ProductVariant.product`. #: The Reference to the [Product](/../api/projects/products#product) with which the ProductVariant is associated. #: If referenced Product does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary Product is created. @@ -735,6 +738,7 @@ def __init__( images: typing.Optional[typing.List["Image"]] = None, assets: typing.Optional[typing.List["Asset"]] = None, publish: typing.Optional[bool] = None, + staged: typing.Optional[bool] = None, product: "ProductKeyReference" ): self.sku = sku @@ -743,6 +747,7 @@ def __init__( self.images = images self.assets = assets self.publish = publish + self.staged = staged self.product = product super().__init__(key=key) diff --git a/src/commercetools/importapi/models/types.py b/src/commercetools/importapi/models/types.py index b79e3ecc..8c9010c3 100644 --- a/src/commercetools/importapi/models/types.py +++ b/src/commercetools/importapi/models/types.py @@ -150,6 +150,7 @@ class CustomFieldBooleanType(FieldType): """Field type for Boolean values.""" def __init__(self): + super().__init__(name="Boolean") @classmethod @@ -170,6 +171,7 @@ class CustomFieldDateTimeType(FieldType): """Field type for [DateTime](ctp:import:type:DateTime) values.""" def __init__(self): + super().__init__(name="DateTime") @classmethod @@ -190,6 +192,7 @@ class CustomFieldDateType(FieldType): """Field type for [Date](ctp:import:type:Date) values.""" def __init__(self): + super().__init__(name="Date") @classmethod @@ -310,6 +313,7 @@ class CustomFieldLocalizedStringType(FieldType): """Field type for [LocalizedString](ctp:import:type:LocalizedString) values.""" def __init__(self): + super().__init__(name="LocalizedString") @classmethod @@ -330,6 +334,7 @@ class CustomFieldMoneyType(FieldType): """Field type for [CentPrecisionMoney](ctp:import:type:CentPrecisionMoney) values.""" def __init__(self): + super().__init__(name="Money") @classmethod @@ -348,6 +353,7 @@ class CustomFieldNumberType(FieldType): """Field type for number values.""" def __init__(self): + super().__init__(name="Number") @classmethod @@ -433,6 +439,7 @@ class CustomFieldStringType(FieldType): """Field type for string values.""" def __init__(self): + super().__init__(name="String") @classmethod @@ -451,6 +458,7 @@ class CustomFieldTimeType(FieldType): """Field type for [Time](ctp:import:type:Time) values.""" def __init__(self): + super().__init__(name="Time") @classmethod diff --git a/src/commercetools/ml/__init__.py b/src/commercetools/ml/__init__.py deleted file mode 100644 index e8e6b151..00000000 --- a/src/commercetools/ml/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -from .client import Client diff --git a/src/commercetools/ml/client/by_project_key_request_builder.py b/src/commercetools/ml/client/by_project_key_request_builder.py deleted file mode 100644 index d71589fa..00000000 --- a/src/commercetools/ml/client/by_project_key_request_builder.py +++ /dev/null @@ -1,62 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from .image_search.by_project_key_image_search_request_builder import ( - ByProjectKeyImageSearchRequestBuilder, -) -from .missing_data.by_project_key_missing_data_request_builder import ( - ByProjectKeyMissingDataRequestBuilder, -) -from .recommendations.by_project_key_recommendations_request_builder import ( - ByProjectKeyRecommendationsRequestBuilder, -) -from .similarities.by_project_key_similarities_request_builder import ( - ByProjectKeySimilaritiesRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ..base_client import BaseClient - - -class ByProjectKeyRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def image_search(self) -> ByProjectKeyImageSearchRequestBuilder: - """Search for similar products using an image as search input.""" - return ByProjectKeyImageSearchRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def recommendations(self) -> ByProjectKeyRecommendationsRequestBuilder: - return ByProjectKeyRecommendationsRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def missing_data(self) -> ByProjectKeyMissingDataRequestBuilder: - return ByProjectKeyMissingDataRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def similarities(self) -> ByProjectKeySimilaritiesRequestBuilder: - return ByProjectKeySimilaritiesRequestBuilder( - project_key=self._project_key, - client=self._client, - ) diff --git a/src/commercetools/ml/client/general_categories/by_project_key_recommendations_general_categories_request_builder.py b/src/commercetools/ml/client/general_categories/by_project_key_recommendations_general_categories_request_builder.py deleted file mode 100644 index 9c5b83ba..00000000 --- a/src/commercetools/ml/client/general_categories/by_project_key_recommendations_general_categories_request_builder.py +++ /dev/null @@ -1,61 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ...models.general_category_recommendations import ( - GeneralCategoryRecommendationPagedQueryResponse, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyRecommendationsGeneralCategoriesRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def get( - self, - *, - product_image_url: str = None, - product_name: str, - limit: int = None, - offset: int = None, - confidence_min: float = None, - confidence_max: float = None, - headers: typing.Dict[str, str] = None, - options: typing.Dict[str, typing.Any] = None, - ) -> "GeneralCategoryRecommendationPagedQueryResponse": - """This endpoint takes arbitrary product names or image URLs and generates recommendations from a general set of categories, which cover a broad range of industries. The full list of supported categories can be found [here](https://docs.commercetools.com/category_recommendations_supported_categories.txt). These are independent of the categories that are actually defined in your project. The main purpose of this API is to provide a quick way to test the behavior of the category recommendations engine for different names and images. In contrast to the [project-specific endpoint](https://docs.commercetools.com/http-api-projects-categoryrecommendations#project-specific-category-recommendations), this endpoint does not have [activation criteria](https://docs.commercetools.com/http-api-projects-categoryrecommendations#activating-the-api) and is enabled for all projects.""" - headers = {} if headers is None else headers - response = self._client._get( - endpoint=f"/{self._project_key}/recommendations/general-categories", - params={ - "productImageUrl": product_image_url, - "productName": product_name, - "limit": limit, - "offset": offset, - "confidenceMin": confidence_min, - "confidenceMax": confidence_max, - }, - headers=headers, - options=options, - ) - if response.status_code == 200: - return GeneralCategoryRecommendationPagedQueryResponse.deserialize( - response.json() - ) - warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/ml/client/image_search/by_project_key_image_search_request_builder.py b/src/commercetools/ml/client/image_search/by_project_key_image_search_request_builder.py deleted file mode 100644 index d32de9cf..00000000 --- a/src/commercetools/ml/client/image_search/by_project_key_image_search_request_builder.py +++ /dev/null @@ -1,57 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ...models.image_search import ImageSearchResponse -from ..config.by_project_key_image_search_config_request_builder import ( - ByProjectKeyImageSearchConfigRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyImageSearchRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def config(self) -> ByProjectKeyImageSearchConfigRequestBuilder: - return ByProjectKeyImageSearchConfigRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def post( - self, - body: typing.BinaryIO, - *, - limit: int = None, - offset: int = None, - headers: typing.Dict[str, str] = None, - options: typing.Dict[str, typing.Any] = None, - ) -> "ImageSearchResponse": - """Accepts an image file and returns similar products from product catalogue.""" - headers = {} if headers is None else headers - response = self._client._post( - endpoint=f"/{self._project_key}/image-search", - params={"limit": limit, "offset": offset}, - data=body.read(), - headers={"Content-Type": "multipart/form-data", **headers}, - options=options, - ) - if response.status_code == 200: - return ImageSearchResponse.deserialize(response.json()) - warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/ml/client/images/by_project_key_missing_data_images_request_builder.py b/src/commercetools/ml/client/images/by_project_key_missing_data_images_request_builder.py deleted file mode 100644 index d1c631c9..00000000 --- a/src/commercetools/ml/client/images/by_project_key_missing_data_images_request_builder.py +++ /dev/null @@ -1,55 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ...models.common import TaskToken -from ...models.missing_data import MissingImagesSearchRequest -from ..status.by_project_key_missing_data_images_status_request_builder import ( - ByProjectKeyMissingDataImagesStatusRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyMissingDataImagesRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def status(self) -> ByProjectKeyMissingDataImagesStatusRequestBuilder: - return ByProjectKeyMissingDataImagesStatusRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def post( - self, - body: "MissingImagesSearchRequest", - *, - headers: typing.Dict[str, str] = None, - options: typing.Dict[str, typing.Any] = None, - ) -> "TaskToken": - headers = {} if headers is None else headers - response = self._client._post( - endpoint=f"/{self._project_key}/missing-data/images", - params={}, - json=body.serialize(), - headers={"Content-Type": "application/json", **headers}, - options=options, - ) - if response.status_code == 202: - return TaskToken.deserialize(response.json()) - warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/ml/client/missing_data/by_project_key_missing_data_request_builder.py b/src/commercetools/ml/client/missing_data/by_project_key_missing_data_request_builder.py deleted file mode 100644 index 31fd357e..00000000 --- a/src/commercetools/ml/client/missing_data/by_project_key_missing_data_request_builder.py +++ /dev/null @@ -1,52 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ..attributes.by_project_key_missing_data_attributes_request_builder import ( - ByProjectKeyMissingDataAttributesRequestBuilder, -) -from ..images.by_project_key_missing_data_images_request_builder import ( - ByProjectKeyMissingDataImagesRequestBuilder, -) -from ..prices.by_project_key_missing_data_prices_request_builder import ( - ByProjectKeyMissingDataPricesRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyMissingDataRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def attributes(self) -> ByProjectKeyMissingDataAttributesRequestBuilder: - return ByProjectKeyMissingDataAttributesRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def images(self) -> ByProjectKeyMissingDataImagesRequestBuilder: - return ByProjectKeyMissingDataImagesRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def prices(self) -> ByProjectKeyMissingDataPricesRequestBuilder: - return ByProjectKeyMissingDataPricesRequestBuilder( - project_key=self._project_key, - client=self._client, - ) diff --git a/src/commercetools/ml/client/products/by_project_key_similarities_products_request_builder.py b/src/commercetools/ml/client/products/by_project_key_similarities_products_request_builder.py deleted file mode 100644 index c9cb12f7..00000000 --- a/src/commercetools/ml/client/products/by_project_key_similarities_products_request_builder.py +++ /dev/null @@ -1,55 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ...models.common import TaskToken -from ...models.similar_products import SimilarProductSearchRequest -from ..status.by_project_key_similarities_products_status_request_builder import ( - ByProjectKeySimilaritiesProductsStatusRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeySimilaritiesProductsRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def status(self) -> ByProjectKeySimilaritiesProductsStatusRequestBuilder: - return ByProjectKeySimilaritiesProductsStatusRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def post( - self, - body: "SimilarProductSearchRequest", - *, - headers: typing.Dict[str, str] = None, - options: typing.Dict[str, typing.Any] = None, - ) -> "TaskToken": - headers = {} if headers is None else headers - response = self._client._post( - endpoint=f"/{self._project_key}/similarities/products", - params={}, - json=body.serialize(), - headers={"Content-Type": "application/json", **headers}, - options=options, - ) - if response.status_code == 202: - return TaskToken.deserialize(response.json()) - warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/ml/client/project_categories/__init__.py b/src/commercetools/ml/client/project_categories/__init__.py deleted file mode 100644 index 77902f62..00000000 --- a/src/commercetools/ml/client/project_categories/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen diff --git a/src/commercetools/ml/client/project_categories/by_project_key_recommendations_project_categories_request_builder.py b/src/commercetools/ml/client/project_categories/by_project_key_recommendations_project_categories_request_builder.py deleted file mode 100644 index dfcbfd19..00000000 --- a/src/commercetools/ml/client/project_categories/by_project_key_recommendations_project_categories_request_builder.py +++ /dev/null @@ -1,37 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from .by_project_key_recommendations_project_categories_by_product_id_request_builder import ( - ByProjectKeyRecommendationsProjectCategoriesByProductIdRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyRecommendationsProjectCategoriesRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def with_product_id( - self, product_id: str - ) -> ByProjectKeyRecommendationsProjectCategoriesByProductIdRequestBuilder: - return ByProjectKeyRecommendationsProjectCategoriesByProductIdRequestBuilder( - product_id=product_id, - project_key=self._project_key, - client=self._client, - ) diff --git a/src/commercetools/ml/client/recommendations/__init__.py b/src/commercetools/ml/client/recommendations/__init__.py deleted file mode 100644 index 77902f62..00000000 --- a/src/commercetools/ml/client/recommendations/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen diff --git a/src/commercetools/ml/client/recommendations/by_project_key_recommendations_request_builder.py b/src/commercetools/ml/client/recommendations/by_project_key_recommendations_request_builder.py deleted file mode 100644 index fb20cff9..00000000 --- a/src/commercetools/ml/client/recommendations/by_project_key_recommendations_request_builder.py +++ /dev/null @@ -1,47 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ..general_categories.by_project_key_recommendations_general_categories_request_builder import ( - ByProjectKeyRecommendationsGeneralCategoriesRequestBuilder, -) -from ..project_categories.by_project_key_recommendations_project_categories_request_builder import ( - ByProjectKeyRecommendationsProjectCategoriesRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyRecommendationsRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def project_categories( - self, - ) -> ByProjectKeyRecommendationsProjectCategoriesRequestBuilder: - return ByProjectKeyRecommendationsProjectCategoriesRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - - def general_categories( - self, - ) -> ByProjectKeyRecommendationsGeneralCategoriesRequestBuilder: - return ByProjectKeyRecommendationsGeneralCategoriesRequestBuilder( - project_key=self._project_key, - client=self._client, - ) diff --git a/src/commercetools/ml/client/similarities/__init__.py b/src/commercetools/ml/client/similarities/__init__.py deleted file mode 100644 index 77902f62..00000000 --- a/src/commercetools/ml/client/similarities/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen diff --git a/src/commercetools/ml/client/status/__init__.py b/src/commercetools/ml/client/status/__init__.py deleted file mode 100644 index 77902f62..00000000 --- a/src/commercetools/ml/client/status/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen diff --git a/src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_by_task_id_request_builder.py b/src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_by_task_id_request_builder.py deleted file mode 100644 index 38e609ec..00000000 --- a/src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_by_task_id_request_builder.py +++ /dev/null @@ -1,46 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ...models.missing_data import MissingDataTaskStatus - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyMissingDataAttributesStatusByTaskIdRequestBuilder: - _client: "BaseClient" - _project_key: str - _task_id: str - - def __init__( - self, - project_key: str, - task_id: str, - client: "BaseClient", - ): - self._project_key = project_key - self._task_id = task_id - self._client = client - - def get( - self, - *, - headers: typing.Dict[str, str] = None, - options: typing.Dict[str, typing.Any] = None, - ) -> "MissingDataTaskStatus": - headers = {} if headers is None else headers - response = self._client._get( - endpoint=f"/{self._project_key}/missing-data/attributes/status/{self._task_id}", - params={}, - headers=headers, - options=options, - ) - if response.status_code == 200: - return MissingDataTaskStatus.deserialize(response.json()) - warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_request_builder.py b/src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_request_builder.py deleted file mode 100644 index 0f066291..00000000 --- a/src/commercetools/ml/client/status/by_project_key_missing_data_attributes_status_request_builder.py +++ /dev/null @@ -1,37 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from .by_project_key_missing_data_attributes_status_by_task_id_request_builder import ( - ByProjectKeyMissingDataAttributesStatusByTaskIdRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeyMissingDataAttributesStatusRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def with_task_id( - self, task_id: str - ) -> ByProjectKeyMissingDataAttributesStatusByTaskIdRequestBuilder: - return ByProjectKeyMissingDataAttributesStatusByTaskIdRequestBuilder( - task_id=task_id, - project_key=self._project_key, - client=self._client, - ) diff --git a/src/commercetools/ml/client/status/by_project_key_similarities_products_status_by_task_id_request_builder.py b/src/commercetools/ml/client/status/by_project_key_similarities_products_status_by_task_id_request_builder.py deleted file mode 100644 index dd7f6d13..00000000 --- a/src/commercetools/ml/client/status/by_project_key_similarities_products_status_by_task_id_request_builder.py +++ /dev/null @@ -1,46 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from ...models.similar_products import SimilarProductsTaskStatus - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeySimilaritiesProductsStatusByTaskIdRequestBuilder: - _client: "BaseClient" - _project_key: str - _task_id: str - - def __init__( - self, - project_key: str, - task_id: str, - client: "BaseClient", - ): - self._project_key = project_key - self._task_id = task_id - self._client = client - - def get( - self, - *, - headers: typing.Dict[str, str] = None, - options: typing.Dict[str, typing.Any] = None, - ) -> "SimilarProductsTaskStatus": - headers = {} if headers is None else headers - response = self._client._get( - endpoint=f"/{self._project_key}/similarities/products/status/{self._task_id}", - params={}, - headers=headers, - options=options, - ) - if response.status_code == 200: - return SimilarProductsTaskStatus.deserialize(response.json()) - warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/ml/client/status/by_project_key_similarities_products_status_request_builder.py b/src/commercetools/ml/client/status/by_project_key_similarities_products_status_request_builder.py deleted file mode 100644 index 5a14e04e..00000000 --- a/src/commercetools/ml/client/status/by_project_key_similarities_products_status_request_builder.py +++ /dev/null @@ -1,37 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import typing -import warnings - -from .by_project_key_similarities_products_status_by_task_id_request_builder import ( - ByProjectKeySimilaritiesProductsStatusByTaskIdRequestBuilder, -) - -if typing.TYPE_CHECKING: - from ...base_client import BaseClient - - -class ByProjectKeySimilaritiesProductsStatusRequestBuilder: - _client: "BaseClient" - _project_key: str - - def __init__( - self, - project_key: str, - client: "BaseClient", - ): - self._project_key = project_key - self._client = client - - def with_task_id( - self, task_id: str - ) -> ByProjectKeySimilaritiesProductsStatusByTaskIdRequestBuilder: - return ByProjectKeySimilaritiesProductsStatusByTaskIdRequestBuilder( - task_id=task_id, - project_key=self._project_key, - client=self._client, - ) diff --git a/src/commercetools/ml/models/__init__.py b/src/commercetools/ml/models/__init__.py deleted file mode 100644 index fbf15074..00000000 --- a/src/commercetools/ml/models/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -from .category_recommendations import * # noqa -from .common import * # noqa -from .general_category_recommendations import * # noqa -from .image_search import * # noqa -from .image_search_config import * # noqa -from .missing_data import * # noqa -from .similar_products import * # noqa diff --git a/src/commercetools/ml/models/_abstract.py b/src/commercetools/ml/models/_abstract.py deleted file mode 100644 index 46f436a5..00000000 --- a/src/commercetools/ml/models/_abstract.py +++ /dev/null @@ -1,57 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - - -class _BaseType: - def __eq__(self, other): - if other.__class__ is self.__class__: - return self.__values__() == other.__values__() - else: - return NotImplemented - - def __ne__(self, other): - result = self.__eq__(other) - if result is NotImplemented: - return NotImplemented - else: - return not result - - def __lt__(self, other): - if other.__class__ is self.__class__: - return self.__values__() < other.__values__() - else: - return NotImplemented - - def __le__(self, other): - if other.__class__ is self.__class__: - return self.__values__() <= other.__values__() - else: - return NotImplemented - - def __gt__(self, other): - if other.__class__ is self.__class__: - return self.__values__() > other.__values__() - else: - return NotImplemented - - def __ge__(self, other): - if other.__class__ is self.__class__: - return self.__values__() >= other.__values__() - else: - return NotImplemented - - def __values__(self): - return tuple(self.__dict__.values()) - - def __hash__(self): - return hash((self.__class__,) + self.__values__()) - - def __repr__(self): - return "%s(%s)" % ( - self.__class__.__name__, - ", ".join("%s=%r" % (k, v) for k, v in self.__dict__.items()), - ) diff --git a/src/commercetools/ml/models/_schemas/category_recommendations.py b/src/commercetools/ml/models/_schemas/category_recommendations.py deleted file mode 100644 index 70acf284..00000000 --- a/src/commercetools/ml/models/_schemas/category_recommendations.py +++ /dev/null @@ -1,90 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models - -# Fields - - -# Marshmallow Schemas -class ProjectCategoryRecommendationSchema(helpers.BaseSchema): - category = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.CategoryReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - confidence = marshmallow.fields.Float(allow_none=True, load_default=None) - path = marshmallow.fields.String(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ProjectCategoryRecommendation(**data) - - -class ProjectCategoryRecommendationMetaSchema(helpers.BaseSchema): - product_name = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productName", - ) - product_image_url = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productImageUrl", - ) - general_category_names = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - load_default=None, - data_key="generalCategoryNames", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ProjectCategoryRecommendationMeta(**data) - - -class ProjectCategoryRecommendationPagedQueryResponseSchema(helpers.BaseSchema): - count = marshmallow.fields.Integer(allow_none=True, load_default=None) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - offset = marshmallow.fields.Integer(allow_none=True, load_default=None) - results = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ProjectCategoryRecommendationSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - meta = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ProjectCategoryRecommendationMetaSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ProjectCategoryRecommendationPagedQueryResponse(**data) diff --git a/src/commercetools/ml/models/_schemas/common.py b/src/commercetools/ml/models/_schemas/common.py deleted file mode 100644 index 24a8e258..00000000 --- a/src/commercetools/ml/models/_schemas/common.py +++ /dev/null @@ -1,125 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models -from ..common import ReferenceTypeId - - -# Fields -class LocalizedStringField(marshmallow.fields.Dict): - def _deserialize(self, value, attr, data, **kwargs): - result = super()._deserialize(value, attr, data) - return models.LocalizedString(**result) - - -# Marshmallow Schemas -class MoneySchema(helpers.BaseSchema): - cent_amount = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="centAmount" - ) - currency_code = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="currencyCode" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.Money(**data) - - -class ReferenceSchema(helpers.BaseSchema): - type_id = marshmallow_enum.EnumField( - ReferenceTypeId, - by_value=True, - allow_none=True, - load_default=None, - data_key="typeId", - ) - id = marshmallow.fields.String(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type_id"] - return models.Reference(**data) - - -class CategoryReferenceSchema(ReferenceSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type_id"] - return models.CategoryReference(**data) - - -class ProductReferenceSchema(ReferenceSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type_id"] - return models.ProductReference(**data) - - -class ProductTypeReferenceSchema(ReferenceSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type_id"] - return models.ProductTypeReference(**data) - - -class ProductVariantSchema(helpers.BaseSchema): - product = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ProductReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ProductVariant(**data) - - -class TaskTokenSchema(helpers.BaseSchema): - task_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="taskId" - ) - uri_path = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="uriPath" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.TaskToken(**data) diff --git a/src/commercetools/ml/models/_schemas/general_category_recommendations.py b/src/commercetools/ml/models/_schemas/general_category_recommendations.py deleted file mode 100644 index 6741b17b..00000000 --- a/src/commercetools/ml/models/_schemas/general_category_recommendations.py +++ /dev/null @@ -1,52 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models - -# Fields - - -# Marshmallow Schemas -class GeneralCategoryRecommendationSchema(helpers.BaseSchema): - category_name = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="categoryName" - ) - confidence = marshmallow.fields.Float(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.GeneralCategoryRecommendation(**data) - - -class GeneralCategoryRecommendationPagedQueryResponseSchema(helpers.BaseSchema): - count = marshmallow.fields.Integer(allow_none=True, load_default=None) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - offset = marshmallow.fields.Integer(allow_none=True, load_default=None) - results = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".GeneralCategoryRecommendationSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.GeneralCategoryRecommendationPagedQueryResponse(**data) diff --git a/src/commercetools/ml/models/_schemas/image_search.py b/src/commercetools/ml/models/_schemas/image_search.py deleted file mode 100644 index 82a8a746..00000000 --- a/src/commercetools/ml/models/_schemas/image_search.py +++ /dev/null @@ -1,59 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models - -# Fields - - -# Marshmallow Schemas -class ImageSearchResponseSchema(helpers.BaseSchema): - count = marshmallow.fields.Integer(allow_none=True, load_default=None) - offset = marshmallow.fields.Float(allow_none=True, load_default=None) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - results = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ResultItemSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ImageSearchResponse(**data) - - -class ResultItemSchema(helpers.BaseSchema): - image_url = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="imageUrl" - ) - product_variants = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.ProductVariantSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="productVariants", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ResultItem(**data) diff --git a/src/commercetools/ml/models/_schemas/image_search_config.py b/src/commercetools/ml/models/_schemas/image_search_config.py deleted file mode 100644 index 08971368..00000000 --- a/src/commercetools/ml/models/_schemas/image_search_config.py +++ /dev/null @@ -1,86 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models -from ..image_search_config import ImageSearchConfigStatus - -# Fields - - -# Marshmallow Schemas - - -class ImageSearchConfigUpdateActionSchema(helpers.BaseSchema): - action = marshmallow.fields.String(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["action"] - return models.ImageSearchConfigUpdateAction(**data) - - -class ChangeStatusUpdateActionSchema(ImageSearchConfigUpdateActionSchema): - status = marshmallow_enum.EnumField( - ImageSearchConfigStatus, by_value=True, allow_none=True, load_default=None - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["action"] - return models.ChangeStatusUpdateAction(**data) - - -class ImageSearchConfigRequestSchema(helpers.BaseSchema): - actions = marshmallow.fields.List( - helpers.Discriminator( - allow_none=True, - discriminator_field=("action", "action"), - discriminator_schemas={ - "changeStatus": helpers.absmod( - __name__, ".ChangeStatusUpdateActionSchema" - ) - }, - ), - allow_none=True, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ImageSearchConfigRequest(**data) - - -class ImageSearchConfigResponseSchema(helpers.BaseSchema): - status = marshmallow_enum.EnumField( - ImageSearchConfigStatus, by_value=True, allow_none=True, load_default=None - ) - last_modified_at = marshmallow.fields.DateTime( - allow_none=True, load_default=None, data_key="lastModifiedAt" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ImageSearchConfigResponse(**data) diff --git a/src/commercetools/ml/models/_schemas/missing_data.py b/src/commercetools/ml/models/_schemas/missing_data.py deleted file mode 100644 index 2e098d50..00000000 --- a/src/commercetools/ml/models/_schemas/missing_data.py +++ /dev/null @@ -1,643 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models -from ..common import TaskStatusEnum - -# Fields - - -# Marshmallow Schemas -class AttributeCountSchema(helpers.BaseSchema): - product_type_attributes = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="productTypeAttributes" - ) - variant_attributes = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantAttributes" - ) - missing_attribute_values = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="missingAttributeValues" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.AttributeCount(**data) - - -class AttributeCoverageSchema(helpers.BaseSchema): - names = marshmallow.fields.Float(allow_none=True, load_default=None) - values = marshmallow.fields.Float(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.AttributeCoverage(**data) - - -class MissingAttributesDetailsSchema(helpers.BaseSchema): - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - missing_attribute_names = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="missingAttributeNames" - ) - missing_attribute_values = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="missingAttributeValues" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingAttributesDetails(**data) - - -class MissingAttributesSchema(helpers.BaseSchema): - product = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.ProductReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - product_type = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.ProductTypeReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="productType", - ) - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - missing_attribute_values = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - load_default=None, - data_key="missingAttributeValues", - ) - missing_attribute_names = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="missingAttributeNames", - ) - attribute_count = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".AttributeCountSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="attributeCount", - ) - attribute_coverage = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".AttributeCoverageSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="attributeCoverage", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingAttributes(**data) - - -class MissingAttributesMetaSchema(helpers.BaseSchema): - product_level = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingAttributesDetailsSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="productLevel", - ) - variant_level = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingAttributesDetailsSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="variantLevel", - ) - product_type_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productTypeIds", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingAttributesMeta(**data) - - -class MissingAttributesSearchRequestSchema(helpers.BaseSchema): - limit = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - offset = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - staged = marshmallow.fields.Boolean( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - product_set_limit = marshmallow.fields.Integer( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productSetLimit", - ) - include_variants = marshmallow.fields.Boolean( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="includeVariants", - ) - coverage_min = marshmallow.fields.Float( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="coverageMin", - ) - coverage_max = marshmallow.fields.Float( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="coverageMax", - ) - sort_by = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="sortBy", - ) - show_missing_attribute_names = marshmallow.fields.Boolean( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="showMissingAttributeNames", - ) - product_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productIds", - ) - product_type_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productTypeIds", - ) - attribute_name = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="attributeName", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingAttributesSearchRequest(**data) - - -class MissingAttributesPagedQueryResultSchema(helpers.BaseSchema): - count = marshmallow.fields.Integer(allow_none=True, load_default=None) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - offset = marshmallow.fields.Integer(allow_none=True, load_default=None) - results = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingAttributesSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - meta = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingAttributesMetaSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingAttributesPagedQueryResult(**data) - - -class MissingDataTaskStatusSchema(helpers.BaseSchema): - state = marshmallow_enum.EnumField( - TaskStatusEnum, by_value=True, allow_none=True, load_default=None - ) - expires = marshmallow.fields.DateTime(allow_none=True, load_default=None) - result = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingAttributesPagedQueryResultSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingDataTaskStatus(**data) - - -class MissingImagesSchema(helpers.BaseSchema): - product = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.ProductReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - image_count = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="imageCount" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImages(**data) - - -class MissingImagesCountSchema(helpers.BaseSchema): - missing_images = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="missingImages" - ) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImagesCount(**data) - - -class MissingImagesProductLevelSchema(MissingImagesCountSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImagesProductLevel(**data) - - -class MissingImagesVariantLevelSchema(MissingImagesCountSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImagesVariantLevel(**data) - - -class MissingImagesMetaSchema(helpers.BaseSchema): - product_level = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingImagesProductLevelSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="productLevel", - ) - variant_level = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingImagesVariantLevelSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="variantLevel", - ) - threshold = marshmallow.fields.Integer(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImagesMeta(**data) - - -class MissingImagesSearchRequestSchema(helpers.BaseSchema): - limit = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - offset = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - staged = marshmallow.fields.Boolean( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - product_set_limit = marshmallow.fields.Integer( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productSetLimit", - ) - include_variants = marshmallow.fields.Boolean( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="includeVariants", - ) - auto_threshold = marshmallow.fields.Boolean( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="autoThreshold", - ) - threshold = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - product_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productIds", - ) - product_type_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productTypeIds", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImagesSearchRequest(**data) - - -class MissingImagesPagedQueryResultSchema(helpers.BaseSchema): - count = marshmallow.fields.Integer(allow_none=True, load_default=None) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - offset = marshmallow.fields.Integer(allow_none=True, load_default=None) - results = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingImagesSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - meta = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingImagesMetaSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImagesPagedQueryResult(**data) - - -class MissingImagesTaskStatusSchema(helpers.BaseSchema): - state = marshmallow_enum.EnumField( - TaskStatusEnum, by_value=True, allow_none=True, load_default=None - ) - expires = marshmallow.fields.DateTime(allow_none=True, load_default=None) - result = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingImagesPagedQueryResultSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingImagesTaskStatus(**data) - - -class MissingPricesSchema(helpers.BaseSchema): - product = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.ProductReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPrices(**data) - - -class MissingPricesProductCountSchema(helpers.BaseSchema): - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - missing_prices = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="missingPrices" - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPricesProductCount(**data) - - -class MissingPricesProductLevelSchema(MissingPricesProductCountSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPricesProductLevel(**data) - - -class MissingPricesVariantLevelSchema(MissingPricesProductCountSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPricesVariantLevel(**data) - - -class MissingPricesMetaSchema(helpers.BaseSchema): - product_level = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingPricesProductLevelSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="productLevel", - ) - variant_level = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingPricesVariantLevelSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="variantLevel", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPricesMeta(**data) - - -class MissingPricesSearchRequestSchema(helpers.BaseSchema): - limit = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - offset = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - staged = marshmallow.fields.Boolean( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - product_set_limit = marshmallow.fields.Integer( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productSetLimit", - ) - include_variants = marshmallow.fields.Boolean( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="includeVariants", - ) - currency_code = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="currencyCode", - ) - check_date = marshmallow.fields.Boolean( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="checkDate", - ) - valid_from = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="validFrom", - ) - valid_until = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="validUntil", - ) - product_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productIds", - ) - product_type_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productTypeIds", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPricesSearchRequest(**data) - - -class MissingPricesPagedQueryResultSchema(helpers.BaseSchema): - count = marshmallow.fields.Integer(allow_none=True, load_default=None) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - offset = marshmallow.fields.Integer(allow_none=True, load_default=None) - results = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingPricesSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - meta = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingPricesMetaSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPricesPagedQueryResult(**data) - - -class MissingPricesTaskStatusSchema(helpers.BaseSchema): - state = marshmallow_enum.EnumField( - TaskStatusEnum, by_value=True, allow_none=True, load_default=None - ) - expires = marshmallow.fields.DateTime(allow_none=True, load_default=None) - result = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".MissingPricesPagedQueryResultSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.MissingPricesTaskStatus(**data) diff --git a/src/commercetools/ml/models/_schemas/similar_products.py b/src/commercetools/ml/models/_schemas/similar_products.py deleted file mode 100644 index 9c3f1f42..00000000 --- a/src/commercetools/ml/models/_schemas/similar_products.py +++ /dev/null @@ -1,292 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen -import re -import typing - -import marshmallow -import marshmallow_enum - -from commercetools import helpers - -from ... import models -from ..common import TaskStatusEnum -from .common import LocalizedStringField - -# Fields - - -# Marshmallow Schemas -class ProductSetSelectorSchema(helpers.BaseSchema): - project_key = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="projectKey" - ) - product_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productIds", - ) - product_type_ids = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productTypeIds", - ) - staged = marshmallow.fields.Boolean( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - include_variants = marshmallow.fields.Boolean( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="includeVariants", - ) - product_set_limit = marshmallow.fields.Integer( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="productSetLimit", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.ProductSetSelector(**data) - - -class SimilarityMeasuresSchema(helpers.BaseSchema): - name = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - description = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - attribute = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - variant_count = marshmallow.fields.Integer( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="variantCount", - ) - price = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarityMeasures(**data) - - -class SimilarProductSearchRequestSchema(helpers.BaseSchema): - limit = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - offset = marshmallow.fields.Integer( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - language = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - currency_code = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="currencyCode", - ) - similarity_measures = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".SimilarityMeasuresSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="similarityMeasures", - ) - product_set_selectors = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ProductSetSelectorSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="productSetSelectors", - ) - confidence_min = marshmallow.fields.Float( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="confidenceMin", - ) - confidence_max = marshmallow.fields.Float( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="confidenceMax", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarProductSearchRequest(**data) - - -class SimilarProductSchema(helpers.BaseSchema): - product = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.ProductReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - ) - variant_id = marshmallow.fields.Integer( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="variantId", - ) - meta = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".SimilarProductMetaSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarProduct(**data) - - -class SimilarProductMetaSchema(helpers.BaseSchema): - name = LocalizedStringField( - allow_none=True, - values=marshmallow.fields.String(allow_none=True), - metadata={"omit_empty": True}, - load_default=None, - ) - description = LocalizedStringField( - allow_none=True, - values=marshmallow.fields.String(allow_none=True), - metadata={"omit_empty": True}, - load_default=None, - ) - price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.MoneySchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - ) - variant_count = marshmallow.fields.Integer( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="variantCount", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarProductMeta(**data) - - -class SimilarProductPairSchema(helpers.BaseSchema): - confidence = marshmallow.fields.Float(allow_none=True, load_default=None) - products = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".SimilarProductSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarProductPair(**data) - - -class SimilarProductSearchRequestMetaSchema(helpers.BaseSchema): - similarity_measures = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".SimilarityMeasuresSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="similarityMeasures", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarProductSearchRequestMeta(**data) - - -class SimilarProductsPagedQueryResultSchema(helpers.BaseSchema): - count = marshmallow.fields.Integer(allow_none=True, load_default=None) - total = marshmallow.fields.Integer(allow_none=True, load_default=None) - offset = marshmallow.fields.Integer(allow_none=True, load_default=None) - results = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".SimilarProductPairSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - meta = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".SimilarProductSearchRequestMetaSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarProductsPagedQueryResult(**data) - - -class SimilarProductsTaskStatusSchema(helpers.BaseSchema): - state = marshmallow_enum.EnumField( - TaskStatusEnum, by_value=True, allow_none=True, load_default=None - ) - expires = marshmallow.fields.DateTime( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - result = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".SimilarProductsPagedQueryResultSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - return models.SimilarProductsTaskStatus(**data) diff --git a/src/commercetools/ml/models/category_recommendations.py b/src/commercetools/ml/models/category_recommendations.py deleted file mode 100644 index 22d76cfd..00000000 --- a/src/commercetools/ml/models/category_recommendations.py +++ /dev/null @@ -1,136 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -import datetime -import enum -import typing - -from ._abstract import _BaseType - -if typing.TYPE_CHECKING: - from .common import CategoryReference - -__all__ = [ - "ProjectCategoryRecommendation", - "ProjectCategoryRecommendationMeta", - "ProjectCategoryRecommendationPagedQueryResponse", -] - - -class ProjectCategoryRecommendation(_BaseType): - #: A category that is recommended for a product. - category: "CategoryReference" - #: Probability score for the category recommendation. - confidence: float - #: Breadcrumb path to the recommended category. This only picks up one language, not all available languages for the category. English is prioritized, but if English data is not available, an arbitrary language is selected. Do not use this to identify a category,use the category ID from the category reference instead. - path: str - - def __init__(self, *, category: "CategoryReference", confidence: float, path: str): - self.category = category - self.confidence = confidence - self.path = path - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ProjectCategoryRecommendation": - from ._schemas.category_recommendations import ( - ProjectCategoryRecommendationSchema, - ) - - return ProjectCategoryRecommendationSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.category_recommendations import ( - ProjectCategoryRecommendationSchema, - ) - - return ProjectCategoryRecommendationSchema().dump(self) - - -class ProjectCategoryRecommendationMeta(_BaseType): - #: The product name that was used to generate recommendations. - product_name: typing.Optional[str] - #: The product image that was used to generate recommendations. - product_image_url: typing.Optional[str] - #: Top 5 general categories that were used internally to generate the project-specific categories. These category names are not related to the categories defined in the project, but they provide additional information to understand the project-specific categories in the results section. - general_category_names: typing.List["str"] - - def __init__( - self, - *, - product_name: typing.Optional[str] = None, - product_image_url: typing.Optional[str] = None, - general_category_names: typing.List["str"] - ): - self.product_name = product_name - self.product_image_url = product_image_url - self.general_category_names = general_category_names - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ProjectCategoryRecommendationMeta": - from ._schemas.category_recommendations import ( - ProjectCategoryRecommendationMetaSchema, - ) - - return ProjectCategoryRecommendationMetaSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.category_recommendations import ( - ProjectCategoryRecommendationMetaSchema, - ) - - return ProjectCategoryRecommendationMetaSchema().dump(self) - - -class ProjectCategoryRecommendationPagedQueryResponse(_BaseType): - count: int - total: int - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: int - results: typing.List["ProjectCategoryRecommendation"] - meta: "ProjectCategoryRecommendationMeta" - - def __init__( - self, - *, - count: int, - total: int, - offset: int, - results: typing.List["ProjectCategoryRecommendation"], - meta: "ProjectCategoryRecommendationMeta" - ): - self.count = count - self.total = total - self.offset = offset - self.results = results - self.meta = meta - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ProjectCategoryRecommendationPagedQueryResponse": - from ._schemas.category_recommendations import ( - ProjectCategoryRecommendationPagedQueryResponseSchema, - ) - - return ProjectCategoryRecommendationPagedQueryResponseSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.category_recommendations import ( - ProjectCategoryRecommendationPagedQueryResponseSchema, - ) - - return ProjectCategoryRecommendationPagedQueryResponseSchema().dump(self) diff --git a/src/commercetools/ml/models/common.py b/src/commercetools/ml/models/common.py deleted file mode 100644 index 1db903b3..00000000 --- a/src/commercetools/ml/models/common.py +++ /dev/null @@ -1,217 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -import datetime -import enum -import typing - -from ._abstract import _BaseType - -__all__ = [ - "CategoryReference", - "LocalizedString", - "Money", - "ProductReference", - "ProductTypeReference", - "ProductVariant", - "Reference", - "ReferenceTypeId", - "TaskStatusEnum", - "TaskToken", -] - - -class LocalizedString(typing.Dict[str, str]): - pass - - -class Money(_BaseType): - cent_amount: int - #: The currency code compliant to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). - currency_code: str - - def __init__(self, *, cent_amount: int, currency_code: str): - self.cent_amount = cent_amount - self.currency_code = currency_code - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Money": - from ._schemas.common import MoneySchema - - return MoneySchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.common import MoneySchema - - return MoneySchema().dump(self) - - -class ReferenceTypeId(enum.Enum): - CART = "cart" - CART_DISCOUNT = "cart-discount" - CATEGORY = "category" - CHANNEL = "channel" - CUSTOMER = "customer" - CUSTOMER_GROUP = "customer-group" - DISCOUNT_CODE = "discount-code" - KEY_VALUE_DOCUMENT = "key-value-document" - PAYMENT = "payment" - PRODUCT = "product" - PRODUCT_TYPE = "product-type" - PRODUCT_DISCOUNT = "product-discount" - ORDER = "order" - REVIEW = "review" - SHOPPING_LIST = "shopping-list" - SHIPPING_METHOD = "shipping-method" - STATE = "state" - STORE = "store" - TAX_CATEGORY = "tax-category" - TYPE = "type" - ZONE = "zone" - INVENTORY_ENTRY = "inventory-entry" - ORDER_EDIT = "order-edit" - - -class Reference(_BaseType): - type_id: "ReferenceTypeId" - id: str - - def __init__(self, *, type_id: "ReferenceTypeId", id: str): - self.type_id = type_id - self.id = id - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Reference": - if data["typeId"] == "category": - from ._schemas.common import CategoryReferenceSchema - - return CategoryReferenceSchema().load(data) - if data["typeId"] == "product": - from ._schemas.common import ProductReferenceSchema - - return ProductReferenceSchema().load(data) - if data["typeId"] == "product-type": - from ._schemas.common import ProductTypeReferenceSchema - - return ProductTypeReferenceSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.common import ReferenceSchema - - return ReferenceSchema().dump(self) - - -class CategoryReference(Reference): - def __init__(self, *, id: str): - super().__init__(id=id, type_id=ReferenceTypeId.CATEGORY) - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CategoryReference": - from ._schemas.common import CategoryReferenceSchema - - return CategoryReferenceSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.common import CategoryReferenceSchema - - return CategoryReferenceSchema().dump(self) - - -class ProductReference(Reference): - def __init__(self, *, id: str): - super().__init__(id=id, type_id=ReferenceTypeId.PRODUCT) - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductReference": - from ._schemas.common import ProductReferenceSchema - - return ProductReferenceSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.common import ProductReferenceSchema - - return ProductReferenceSchema().dump(self) - - -class ProductTypeReference(Reference): - def __init__(self, *, id: str): - super().__init__(id=id, type_id=ReferenceTypeId.PRODUCT_TYPE) - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductTypeReference": - from ._schemas.common import ProductTypeReferenceSchema - - return ProductTypeReferenceSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.common import ProductTypeReferenceSchema - - return ProductTypeReferenceSchema().dump(self) - - -class ProductVariant(_BaseType): - """The product variant that contains the image.""" - - #: The product that contains this variant. - product: "ProductReference" - #: The state of the product variant. - staged: bool - #: The id of the product variant. - variant_id: int - - def __init__(self, *, product: "ProductReference", staged: bool, variant_id: int): - self.product = product - self.staged = staged - self.variant_id = variant_id - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductVariant": - from ._schemas.common import ProductVariantSchema - - return ProductVariantSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.common import ProductVariantSchema - - return ProductVariantSchema().dump(self) - - -class TaskStatusEnum(enum.Enum): - PENDING = "PENDING" - SUCCESS = "SUCCESS" - - -class TaskToken(_BaseType): - """Represents a URL path to poll to get the results of an Asynchronous Request.""" - - #: The ID for the task. Used to find the status of the task. - task_id: str - #: The URI path to poll for the status of the task. - uri_path: str - - def __init__(self, *, task_id: str, uri_path: str): - self.task_id = task_id - self.uri_path = uri_path - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "TaskToken": - from ._schemas.common import TaskTokenSchema - - return TaskTokenSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.common import TaskTokenSchema - - return TaskTokenSchema().dump(self) diff --git a/src/commercetools/ml/models/general_category_recommendations.py b/src/commercetools/ml/models/general_category_recommendations.py deleted file mode 100644 index cd8d459c..00000000 --- a/src/commercetools/ml/models/general_category_recommendations.py +++ /dev/null @@ -1,87 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -import datetime -import enum -import typing - -from ._abstract import _BaseType - -__all__ = [ - "GeneralCategoryRecommendation", - "GeneralCategoryRecommendationPagedQueryResponse", -] - - -class GeneralCategoryRecommendation(_BaseType): - #: An English category name that is recommended for a product. - category_name: str - #: Probability score for the category recommendation. - confidence: float - - def __init__(self, *, category_name: str, confidence: float): - self.category_name = category_name - self.confidence = confidence - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "GeneralCategoryRecommendation": - from ._schemas.general_category_recommendations import ( - GeneralCategoryRecommendationSchema, - ) - - return GeneralCategoryRecommendationSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.general_category_recommendations import ( - GeneralCategoryRecommendationSchema, - ) - - return GeneralCategoryRecommendationSchema().dump(self) - - -class GeneralCategoryRecommendationPagedQueryResponse(_BaseType): - count: int - total: int - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: int - results: typing.List["GeneralCategoryRecommendation"] - - def __init__( - self, - *, - count: int, - total: int, - offset: int, - results: typing.List["GeneralCategoryRecommendation"] - ): - self.count = count - self.total = total - self.offset = offset - self.results = results - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "GeneralCategoryRecommendationPagedQueryResponse": - from ._schemas.general_category_recommendations import ( - GeneralCategoryRecommendationPagedQueryResponseSchema, - ) - - return GeneralCategoryRecommendationPagedQueryResponseSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.general_category_recommendations import ( - GeneralCategoryRecommendationPagedQueryResponseSchema, - ) - - return GeneralCategoryRecommendationPagedQueryResponseSchema().dump(self) diff --git a/src/commercetools/ml/models/image_search.py b/src/commercetools/ml/models/image_search.py deleted file mode 100644 index 02a380e4..00000000 --- a/src/commercetools/ml/models/image_search.py +++ /dev/null @@ -1,84 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -import datetime -import enum -import typing - -from ._abstract import _BaseType - -if typing.TYPE_CHECKING: - from .common import ProductVariant - -__all__ = ["ImageSearchResponse", "ResultItem"] - - -class ImageSearchResponse(_BaseType): - """Response format from image search endpoint.""" - - #: The maximum number of results to return from a query. - count: int - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: float - #: The total number of product images that were have been analyzed. - total: int - #: An array of image URLs of images that are similar to the query image. If no matching images are found, results is empty. - results: typing.List["ResultItem"] - - def __init__( - self, - *, - count: int, - offset: float, - total: int, - results: typing.List["ResultItem"] - ): - self.count = count - self.offset = offset - self.total = total - self.results = results - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ImageSearchResponse": - from ._schemas.image_search import ImageSearchResponseSchema - - return ImageSearchResponseSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.image_search import ImageSearchResponseSchema - - return ImageSearchResponseSchema().dump(self) - - -class ResultItem(_BaseType): - """An image URL and the product variants it is contained in. If no matching images are found, ResultItem is not present.""" - - #: The URL of the image. - image_url: str - #: An array of product variants containing the image URL. - product_variants: typing.List["ProductVariant"] - - def __init__( - self, *, image_url: str, product_variants: typing.List["ProductVariant"] - ): - self.image_url = image_url - self.product_variants = product_variants - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResultItem": - from ._schemas.image_search import ResultItemSchema - - return ResultItemSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.image_search import ResultItemSchema - - return ResultItemSchema().dump(self) diff --git a/src/commercetools/ml/models/image_search_config.py b/src/commercetools/ml/models/image_search_config.py deleted file mode 100644 index d705d10e..00000000 --- a/src/commercetools/ml/models/image_search_config.py +++ /dev/null @@ -1,120 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -import datetime -import enum -import typing - -from ._abstract import _BaseType - -__all__ = [ - "ChangeStatusUpdateAction", - "ImageSearchConfigRequest", - "ImageSearchConfigResponse", - "ImageSearchConfigStatus", - "ImageSearchConfigUpdateAction", -] - - -class ImageSearchConfigStatus(enum.Enum): - ON = "on" - OFF = "off" - - -class ImageSearchConfigUpdateAction(_BaseType): - action: str - - def __init__(self, *, action: str): - self.action = action - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ImageSearchConfigUpdateAction": - if data["action"] == "changeStatus": - from ._schemas.image_search_config import ChangeStatusUpdateActionSchema - - return ChangeStatusUpdateActionSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.image_search_config import ImageSearchConfigUpdateActionSchema - - return ImageSearchConfigUpdateActionSchema().dump(self) - - -class ChangeStatusUpdateAction(ImageSearchConfigUpdateAction): - status: "ImageSearchConfigStatus" - - def __init__(self, *, status: "ImageSearchConfigStatus"): - self.status = status - - super().__init__(action="changeStatus") - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ChangeStatusUpdateAction": - from ._schemas.image_search_config import ChangeStatusUpdateActionSchema - - return ChangeStatusUpdateActionSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.image_search_config import ChangeStatusUpdateActionSchema - - return ChangeStatusUpdateActionSchema().dump(self) - - -class ImageSearchConfigRequest(_BaseType): - #: The list of update actions to be performed on the project. - actions: typing.List["ImageSearchConfigUpdateAction"] - - def __init__(self, *, actions: typing.List["ImageSearchConfigUpdateAction"]): - self.actions = actions - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ImageSearchConfigRequest": - from ._schemas.image_search_config import ImageSearchConfigRequestSchema - - return ImageSearchConfigRequestSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.image_search_config import ImageSearchConfigRequestSchema - - return ImageSearchConfigRequestSchema().dump(self) - - -class ImageSearchConfigResponse(_BaseType): - #: The image search activation status. - status: "ImageSearchConfigStatus" - last_modified_at: datetime.datetime - - def __init__( - self, *, status: "ImageSearchConfigStatus", last_modified_at: datetime.datetime - ): - self.status = status - self.last_modified_at = last_modified_at - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ImageSearchConfigResponse": - from ._schemas.image_search_config import ImageSearchConfigResponseSchema - - return ImageSearchConfigResponseSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.image_search_config import ImageSearchConfigResponseSchema - - return ImageSearchConfigResponseSchema().dump(self) diff --git a/src/commercetools/ml/models/missing_data.py b/src/commercetools/ml/models/missing_data.py deleted file mode 100644 index 0348c3f0..00000000 --- a/src/commercetools/ml/models/missing_data.py +++ /dev/null @@ -1,859 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -import datetime -import enum -import typing - -from ._abstract import _BaseType -from .common import TaskStatusEnum - -if typing.TYPE_CHECKING: - from .common import ProductReference, ProductTypeReference, TaskStatusEnum - -__all__ = [ - "AttributeCount", - "AttributeCoverage", - "MissingAttributes", - "MissingAttributesDetails", - "MissingAttributesMeta", - "MissingAttributesPagedQueryResult", - "MissingAttributesSearchRequest", - "MissingDataTaskStatus", - "MissingImages", - "MissingImagesCount", - "MissingImagesMeta", - "MissingImagesPagedQueryResult", - "MissingImagesProductLevel", - "MissingImagesSearchRequest", - "MissingImagesTaskStatus", - "MissingImagesVariantLevel", - "MissingPrices", - "MissingPricesMeta", - "MissingPricesPagedQueryResult", - "MissingPricesProductCount", - "MissingPricesProductLevel", - "MissingPricesSearchRequest", - "MissingPricesTaskStatus", - "MissingPricesVariantLevel", -] - - -class AttributeCount(_BaseType): - #: Number of attributes defined in the product type. - product_type_attributes: int - #: Number of attributes defined in the variant. - variant_attributes: int - #: Number of attributes missing values in the variant. - missing_attribute_values: int - - def __init__( - self, - *, - product_type_attributes: int, - variant_attributes: int, - missing_attribute_values: int - ): - self.product_type_attributes = product_type_attributes - self.variant_attributes = variant_attributes - self.missing_attribute_values = missing_attribute_values - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AttributeCount": - from ._schemas.missing_data import AttributeCountSchema - - return AttributeCountSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import AttributeCountSchema - - return AttributeCountSchema().dump(self) - - -class AttributeCoverage(_BaseType): - #: The percentage of attributes from the product type defined in the product variant. A value of `1.0` indicates a product variant contains all attributes defined in the product type. - names: float - #: Represents the percentage of attributes in the product variant that contain values. - values: float - - def __init__(self, *, names: float, values: float): - self.names = names - self.values = values - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "AttributeCoverage": - from ._schemas.missing_data import AttributeCoverageSchema - - return AttributeCoverageSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import AttributeCoverageSchema - - return AttributeCoverageSchema().dump(self) - - -class MissingAttributesDetails(_BaseType): - #: Number of products scanned. - total: int - #: Number of products missing attribute names. - missing_attribute_names: int - #: Number of products missing attribute values. - missing_attribute_values: int - - def __init__( - self, *, total: int, missing_attribute_names: int, missing_attribute_values: int - ): - self.total = total - self.missing_attribute_names = missing_attribute_names - self.missing_attribute_values = missing_attribute_values - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingAttributesDetails": - from ._schemas.missing_data import MissingAttributesDetailsSchema - - return MissingAttributesDetailsSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingAttributesDetailsSchema - - return MissingAttributesDetailsSchema().dump(self) - - -class MissingAttributes(_BaseType): - product: "ProductReference" - product_type: "ProductTypeReference" - #: ID of a ProductVariant. - variant_id: int - #: The names of the attributes of the product type that the variant is missing, sorted by attribute importance in descending order. - missing_attribute_values: typing.List["str"] - #: The names of the attributes of the product type that the variant is missing, sorted by attribute importance in descending order. - missing_attribute_names: typing.Optional[typing.List["str"]] - attribute_count: typing.Optional["AttributeCount"] - attribute_coverage: typing.Optional["AttributeCoverage"] - - def __init__( - self, - *, - product: "ProductReference", - product_type: "ProductTypeReference", - variant_id: int, - missing_attribute_values: typing.List["str"], - missing_attribute_names: typing.Optional[typing.List["str"]] = None, - attribute_count: typing.Optional["AttributeCount"] = None, - attribute_coverage: typing.Optional["AttributeCoverage"] = None - ): - self.product = product - self.product_type = product_type - self.variant_id = variant_id - self.missing_attribute_values = missing_attribute_values - self.missing_attribute_names = missing_attribute_names - self.attribute_count = attribute_count - self.attribute_coverage = attribute_coverage - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingAttributes": - from ._schemas.missing_data import MissingAttributesSchema - - return MissingAttributesSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingAttributesSchema - - return MissingAttributesSchema().dump(self) - - -class MissingAttributesMeta(_BaseType): - product_level: "MissingAttributesDetails" - variant_level: "MissingAttributesDetails" - #: The IDs of the product types containing the requested `attributeName`. - product_type_ids: typing.Optional[typing.List["str"]] - - def __init__( - self, - *, - product_level: "MissingAttributesDetails", - variant_level: "MissingAttributesDetails", - product_type_ids: typing.Optional[typing.List["str"]] = None - ): - self.product_level = product_level - self.variant_level = variant_level - self.product_type_ids = product_type_ids - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingAttributesMeta": - from ._schemas.missing_data import MissingAttributesMetaSchema - - return MissingAttributesMetaSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingAttributesMetaSchema - - return MissingAttributesMetaSchema().dump(self) - - -class MissingAttributesSearchRequest(_BaseType): - #: Number of [results requested](/../api/general-concepts#limit). - limit: typing.Optional[int] - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: typing.Optional[int] - #: If true, searches data from staged products in addition to published products. - staged: typing.Optional[bool] - #: Maximum number of products to scan. - product_set_limit: typing.Optional[int] - #: If true, searches all product variants. If false, only searches master variants. - include_variants: typing.Optional[bool] - #: Minimum attribute coverage of variants to display, applied to both coverage types. - coverage_min: typing.Optional[float] - #: Maximum attribute coverage of variants to display, applied to both coverage types. - coverage_max: typing.Optional[float] - #: Default value: `coverageAttributeValues` - Allowed values: [`coverageAttributeValues`, `coverageAttributeNames`] - #: `coverageAttributeValues` shows the product variants with the most missing attribute values first and `coverageAttributeNames` the ones with the most missing attribute names. - sort_by: typing.Optional[str] - #: If true, the `missingAttributeNames` will be included in the results. - show_missing_attribute_names: typing.Optional[bool] - #: Filters results by the provided Product IDs. - #: Cannot be applied in combination with any other filter. - product_ids: typing.Optional[typing.List["str"]] - #: Filters results by the provided product type IDs. - #: Cannot be applied in combination with any other filter. - product_type_ids: typing.Optional[typing.List["str"]] - #: Filters results by the provided attribute name. If provided, products are only checked for this attribute. Therefore, only products of product types which define the attribute name are considered. These product type IDs - #: are then listed in `MissingAttributesMeta`. The `attributeCount` and `attributeCoverage` fields are not part of the response when using this filter. Cannot be applied in combination with any other filter. - attribute_name: typing.Optional[str] - - def __init__( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - staged: typing.Optional[bool] = None, - product_set_limit: typing.Optional[int] = None, - include_variants: typing.Optional[bool] = None, - coverage_min: typing.Optional[float] = None, - coverage_max: typing.Optional[float] = None, - sort_by: typing.Optional[str] = None, - show_missing_attribute_names: typing.Optional[bool] = None, - product_ids: typing.Optional[typing.List["str"]] = None, - product_type_ids: typing.Optional[typing.List["str"]] = None, - attribute_name: typing.Optional[str] = None - ): - self.limit = limit - self.offset = offset - self.staged = staged - self.product_set_limit = product_set_limit - self.include_variants = include_variants - self.coverage_min = coverage_min - self.coverage_max = coverage_max - self.sort_by = sort_by - self.show_missing_attribute_names = show_missing_attribute_names - self.product_ids = product_ids - self.product_type_ids = product_type_ids - self.attribute_name = attribute_name - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingAttributesSearchRequest": - from ._schemas.missing_data import MissingAttributesSearchRequestSchema - - return MissingAttributesSearchRequestSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingAttributesSearchRequestSchema - - return MissingAttributesSearchRequestSchema().dump(self) - - -class MissingAttributesPagedQueryResult(_BaseType): - count: int - total: int - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: int - results: typing.List["MissingAttributes"] - meta: "MissingAttributesMeta" - - def __init__( - self, - *, - count: int, - total: int, - offset: int, - results: typing.List["MissingAttributes"], - meta: "MissingAttributesMeta" - ): - self.count = count - self.total = total - self.offset = offset - self.results = results - self.meta = meta - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingAttributesPagedQueryResult": - from ._schemas.missing_data import MissingAttributesPagedQueryResultSchema - - return MissingAttributesPagedQueryResultSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingAttributesPagedQueryResultSchema - - return MissingAttributesPagedQueryResultSchema().dump(self) - - -class MissingDataTaskStatus(_BaseType): - """Represents a URL path to poll to get the results of an Asynchronous Request.""" - - state: "TaskStatusEnum" - #: The expiry date of the result. You cannot access the result after the expiry date. Default: 1 day after the result first becomes available. This is only available when the TaskStatus state is SUCCESS. - expires: datetime.datetime - #: The response to an asynchronous request. The type depends on the request initiated. Only populated when the status is `SUCCESS`. - result: "MissingAttributesPagedQueryResult" - - def __init__( - self, - *, - state: "TaskStatusEnum", - expires: datetime.datetime, - result: "MissingAttributesPagedQueryResult" - ): - self.state = state - self.expires = expires - self.result = result - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingDataTaskStatus": - from ._schemas.missing_data import MissingDataTaskStatusSchema - - return MissingDataTaskStatusSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingDataTaskStatusSchema - - return MissingDataTaskStatusSchema().dump(self) - - -class MissingImages(_BaseType): - product: "ProductReference" - #: ID of the variant - variant_id: int - #: Number of images the variant contains. - image_count: int - - def __init__( - self, *, product: "ProductReference", variant_id: int, image_count: int - ): - self.product = product - self.variant_id = variant_id - self.image_count = image_count - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingImages": - from ._schemas.missing_data import MissingImagesSchema - - return MissingImagesSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesSchema - - return MissingImagesSchema().dump(self) - - -class MissingImagesCount(_BaseType): - missing_images: int - #: Number of products scanned. - total: int - - def __init__(self, *, missing_images: int, total: int): - self.missing_images = missing_images - self.total = total - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingImagesCount": - from ._schemas.missing_data import MissingImagesCountSchema - - return MissingImagesCountSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesCountSchema - - return MissingImagesCountSchema().dump(self) - - -class MissingImagesProductLevel(MissingImagesCount): - def __init__(self, *, missing_images: int, total: int): - super().__init__(missing_images=missing_images, total=total) - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingImagesProductLevel": - from ._schemas.missing_data import MissingImagesProductLevelSchema - - return MissingImagesProductLevelSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesProductLevelSchema - - return MissingImagesProductLevelSchema().dump(self) - - -class MissingImagesVariantLevel(MissingImagesCount): - def __init__(self, *, missing_images: int, total: int): - super().__init__(missing_images=missing_images, total=total) - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingImagesVariantLevel": - from ._schemas.missing_data import MissingImagesVariantLevelSchema - - return MissingImagesVariantLevelSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesVariantLevelSchema - - return MissingImagesVariantLevelSchema().dump(self) - - -class MissingImagesMeta(_BaseType): - product_level: "MissingImagesProductLevel" - variant_level: "MissingImagesVariantLevel" - #: The minimum number of images a product variant must have. Anything below this value is considered a product variant with missing images. - threshold: int - - def __init__( - self, - *, - product_level: "MissingImagesProductLevel", - variant_level: "MissingImagesVariantLevel", - threshold: int - ): - self.product_level = product_level - self.variant_level = variant_level - self.threshold = threshold - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingImagesMeta": - from ._schemas.missing_data import MissingImagesMetaSchema - - return MissingImagesMetaSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesMetaSchema - - return MissingImagesMetaSchema().dump(self) - - -class MissingImagesSearchRequest(_BaseType): - #: Number of [results requested](/../api/general-concepts#limit). - limit: typing.Optional[int] - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: typing.Optional[int] - #: If true, searches data from staged products in addition to published products. - staged: typing.Optional[bool] - #: Maximum number of products to scan. - product_set_limit: typing.Optional[int] - #: If true, searches all product variants. If false, only searches master variants. - include_variants: typing.Optional[bool] - #: If true, uses the median number of images per product variant as a threshold value. - auto_threshold: typing.Optional[bool] - #: The minimum number of images a product variant must have. Anything below this value is considered a product variant with missing images. - threshold: typing.Optional[int] - #: Filters results by the provided Product IDs. Cannot be applied in combination with any other filter. - product_ids: typing.Optional[typing.List["str"]] - #: Filters results by the provided product type IDs. It cannot be applied in combination with any other filter. - product_type_ids: typing.Optional[typing.List["str"]] - - def __init__( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - staged: typing.Optional[bool] = None, - product_set_limit: typing.Optional[int] = None, - include_variants: typing.Optional[bool] = None, - auto_threshold: typing.Optional[bool] = None, - threshold: typing.Optional[int] = None, - product_ids: typing.Optional[typing.List["str"]] = None, - product_type_ids: typing.Optional[typing.List["str"]] = None - ): - self.limit = limit - self.offset = offset - self.staged = staged - self.product_set_limit = product_set_limit - self.include_variants = include_variants - self.auto_threshold = auto_threshold - self.threshold = threshold - self.product_ids = product_ids - self.product_type_ids = product_type_ids - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingImagesSearchRequest": - from ._schemas.missing_data import MissingImagesSearchRequestSchema - - return MissingImagesSearchRequestSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesSearchRequestSchema - - return MissingImagesSearchRequestSchema().dump(self) - - -class MissingImagesPagedQueryResult(_BaseType): - count: int - total: int - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: int - results: typing.List["MissingImages"] - meta: "MissingImagesMeta" - - def __init__( - self, - *, - count: int, - total: int, - offset: int, - results: typing.List["MissingImages"], - meta: "MissingImagesMeta" - ): - self.count = count - self.total = total - self.offset = offset - self.results = results - self.meta = meta - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingImagesPagedQueryResult": - from ._schemas.missing_data import MissingImagesPagedQueryResultSchema - - return MissingImagesPagedQueryResultSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesPagedQueryResultSchema - - return MissingImagesPagedQueryResultSchema().dump(self) - - -class MissingImagesTaskStatus(_BaseType): - """Represents a URL path to poll to get the results of an Asynchronous Request.""" - - state: "TaskStatusEnum" - #: The expiry date of the result. You cannot access the result after the expiry date. Default: 1 day after the result first becomes available. This is only available when the TaskStatus state is SUCCESS. - expires: datetime.datetime - #: The response to an asynchronous request. The type depends on the request initiated. Only populated when the status is `SUCCESS`. - result: "MissingImagesPagedQueryResult" - - def __init__( - self, - *, - state: "TaskStatusEnum", - expires: datetime.datetime, - result: "MissingImagesPagedQueryResult" - ): - self.state = state - self.expires = expires - self.result = result - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingImagesTaskStatus": - from ._schemas.missing_data import MissingImagesTaskStatusSchema - - return MissingImagesTaskStatusSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingImagesTaskStatusSchema - - return MissingImagesTaskStatusSchema().dump(self) - - -class MissingPrices(_BaseType): - product: "ProductReference" - #: Id of the `ProductVariant`. - variant_id: int - - def __init__(self, *, product: "ProductReference", variant_id: int): - self.product = product - self.variant_id = variant_id - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingPrices": - from ._schemas.missing_data import MissingPricesSchema - - return MissingPricesSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesSchema - - return MissingPricesSchema().dump(self) - - -class MissingPricesProductCount(_BaseType): - total: int - missing_prices: int - - def __init__(self, *, total: int, missing_prices: int): - self.total = total - self.missing_prices = missing_prices - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingPricesProductCount": - from ._schemas.missing_data import MissingPricesProductCountSchema - - return MissingPricesProductCountSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesProductCountSchema - - return MissingPricesProductCountSchema().dump(self) - - -class MissingPricesProductLevel(MissingPricesProductCount): - def __init__(self, *, total: int, missing_prices: int): - super().__init__(total=total, missing_prices=missing_prices) - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingPricesProductLevel": - from ._schemas.missing_data import MissingPricesProductLevelSchema - - return MissingPricesProductLevelSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesProductLevelSchema - - return MissingPricesProductLevelSchema().dump(self) - - -class MissingPricesVariantLevel(MissingPricesProductCount): - def __init__(self, *, total: int, missing_prices: int): - super().__init__(total=total, missing_prices=missing_prices) - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingPricesVariantLevel": - from ._schemas.missing_data import MissingPricesVariantLevelSchema - - return MissingPricesVariantLevelSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesVariantLevelSchema - - return MissingPricesVariantLevelSchema().dump(self) - - -class MissingPricesMeta(_BaseType): - product_level: "MissingPricesProductLevel" - variant_level: "MissingPricesVariantLevel" - - def __init__( - self, - *, - product_level: "MissingPricesProductLevel", - variant_level: "MissingPricesVariantLevel" - ): - self.product_level = product_level - self.variant_level = variant_level - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MissingPricesMeta": - from ._schemas.missing_data import MissingPricesMetaSchema - - return MissingPricesMetaSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesMetaSchema - - return MissingPricesMetaSchema().dump(self) - - -class MissingPricesSearchRequest(_BaseType): - #: Number of [results requested](/../api/general-concepts#limit). - limit: typing.Optional[int] - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: typing.Optional[int] - #: If true, searches data from staged products in addition to published products. - staged: typing.Optional[bool] - #: Maximum number of products to scan. - product_set_limit: typing.Optional[int] - #: If true, searches all product variants. If false, only searches master variants. - include_variants: typing.Optional[bool] - #: If used, only checks if a product variant has a price in the provided currency code. - currency_code: typing.Optional[str] - #: If true, checks if there are prices for the specified date range and time. - check_date: typing.Optional[bool] - #: Starting date of the range to check. If no value is given, checks prices valid at the time the search is initiated. - valid_from: typing.Optional[datetime.datetime] - #: Ending date of the range to check. If no value is given, it is equal to `validFrom`. - valid_until: typing.Optional[datetime.datetime] - #: Filters results by the provided Product IDs. Cannot be applied in combination with the `productTypeIds` filter. - product_ids: typing.Optional[typing.List["str"]] - #: Filters results by the provided product type IDs. Cannot be applied in combination with the `productIds` filter. - product_type_ids: typing.Optional[typing.List["str"]] - - def __init__( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - staged: typing.Optional[bool] = None, - product_set_limit: typing.Optional[int] = None, - include_variants: typing.Optional[bool] = None, - currency_code: typing.Optional[str] = None, - check_date: typing.Optional[bool] = None, - valid_from: typing.Optional[datetime.datetime] = None, - valid_until: typing.Optional[datetime.datetime] = None, - product_ids: typing.Optional[typing.List["str"]] = None, - product_type_ids: typing.Optional[typing.List["str"]] = None - ): - self.limit = limit - self.offset = offset - self.staged = staged - self.product_set_limit = product_set_limit - self.include_variants = include_variants - self.currency_code = currency_code - self.check_date = check_date - self.valid_from = valid_from - self.valid_until = valid_until - self.product_ids = product_ids - self.product_type_ids = product_type_ids - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingPricesSearchRequest": - from ._schemas.missing_data import MissingPricesSearchRequestSchema - - return MissingPricesSearchRequestSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesSearchRequestSchema - - return MissingPricesSearchRequestSchema().dump(self) - - -class MissingPricesPagedQueryResult(_BaseType): - count: int - total: int - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: int - results: typing.List["MissingPrices"] - meta: "MissingPricesMeta" - - def __init__( - self, - *, - count: int, - total: int, - offset: int, - results: typing.List["MissingPrices"], - meta: "MissingPricesMeta" - ): - self.count = count - self.total = total - self.offset = offset - self.results = results - self.meta = meta - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingPricesPagedQueryResult": - from ._schemas.missing_data import MissingPricesPagedQueryResultSchema - - return MissingPricesPagedQueryResultSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesPagedQueryResultSchema - - return MissingPricesPagedQueryResultSchema().dump(self) - - -class MissingPricesTaskStatus(_BaseType): - """Represents a URL path to poll to get the results of an Asynchronous Request.""" - - state: "TaskStatusEnum" - #: The expiry date of the result. You cannot access the result after the expiry date. Default: 1 day after the result first becomes available. This is only available when the TaskStatus state is SUCCESS. - expires: datetime.datetime - #: The response to an asynchronous request. The type depends on the request initiated. Only populated when the status is `SUCCESS`. - result: "MissingPricesPagedQueryResult" - - def __init__( - self, - *, - state: "TaskStatusEnum", - expires: datetime.datetime, - result: "MissingPricesPagedQueryResult" - ): - self.state = state - self.expires = expires - self.result = result - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "MissingPricesTaskStatus": - from ._schemas.missing_data import MissingPricesTaskStatusSchema - - return MissingPricesTaskStatusSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.missing_data import MissingPricesTaskStatusSchema - - return MissingPricesTaskStatusSchema().dump(self) diff --git a/src/commercetools/ml/models/similar_products.py b/src/commercetools/ml/models/similar_products.py deleted file mode 100644 index fe1e5e3a..00000000 --- a/src/commercetools/ml/models/similar_products.py +++ /dev/null @@ -1,368 +0,0 @@ -# This file is automatically generated by the rmf-codegen project. -# -# The Python code generator is maintained by Lab Digital. If you want to -# contribute to this project then please do not edit this file directly -# but send a pull request to the Lab Digital fork of rmf-codegen at -# https://github.com/labd/rmf-codegen - -import datetime -import enum -import typing - -from ._abstract import _BaseType -from .common import TaskStatusEnum - -if typing.TYPE_CHECKING: - from .common import LocalizedString, Money, ProductReference, TaskStatusEnum - -__all__ = [ - "ProductSetSelector", - "SimilarProduct", - "SimilarProductMeta", - "SimilarProductPair", - "SimilarProductSearchRequest", - "SimilarProductSearchRequestMeta", - "SimilarProductsPagedQueryResult", - "SimilarProductsTaskStatus", - "SimilarityMeasures", -] - - -class ProductSetSelector(_BaseType): - """A set of ProductData for comparison. If no optional attributes are specified, all `current` ProductData are selected for comparison.""" - - #: The project containing the project set. - project_key: str - #: An array of Product IDs to compare. If unspecified, no Product ID filter is applied. - product_ids: typing.Optional[typing.List["str"]] - #: An array of product type IDs. Only products with product types in this array are compared. If unspecified, no product type filter is applied. - product_type_ids: typing.Optional[typing.List["str"]] - #: Specifies use of staged or current product data. - staged: typing.Optional[bool] - #: Specifies use of product variants. If set to `true`, all product variants are compared, not just the master variant. - include_variants: typing.Optional[bool] - #: Maximum number of products to check (if unspecified, all products are considered). Note that the maximum number of product comparisons between two productSets is 20,000,000. This limit cannot be exceeded. If you need a higher limit, contact https://support.commercetools.com - product_set_limit: typing.Optional[int] - - def __init__( - self, - *, - project_key: str, - product_ids: typing.Optional[typing.List["str"]] = None, - product_type_ids: typing.Optional[typing.List["str"]] = None, - staged: typing.Optional[bool] = None, - include_variants: typing.Optional[bool] = None, - product_set_limit: typing.Optional[int] = None - ): - self.project_key = project_key - self.product_ids = product_ids - self.product_type_ids = product_type_ids - self.staged = staged - self.include_variants = include_variants - self.product_set_limit = product_set_limit - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductSetSelector": - from ._schemas.similar_products import ProductSetSelectorSchema - - return ProductSetSelectorSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import ProductSetSelectorSchema - - return ProductSetSelectorSchema().dump(self) - - -class SimilarityMeasures(_BaseType): - """Specify which ProductData attributes to use for estimating similarity and how to weigh them. An attribute's weight can be any whole positive integer, starting with 0. The larger the integer, the higher its weight.""" - - #: Importance of the `name` attribute in overall similarity. - name: typing.Optional[int] - #: Importance of the `description` attribute in overall similarity. - description: typing.Optional[int] - #: Importance of the `description` attribute in overall similarity. - attribute: typing.Optional[int] - #: Importance of the number of product variants in overall similarity. - variant_count: typing.Optional[int] - #: Importance of the `price` attribute in overall similarity. - price: typing.Optional[int] - - def __init__( - self, - *, - name: typing.Optional[int] = None, - description: typing.Optional[int] = None, - attribute: typing.Optional[int] = None, - variant_count: typing.Optional[int] = None, - price: typing.Optional[int] = None - ): - self.name = name - self.description = description - self.attribute = attribute - self.variant_count = variant_count - self.price = price - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SimilarityMeasures": - from ._schemas.similar_products import SimilarityMeasuresSchema - - return SimilarityMeasuresSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarityMeasuresSchema - - return SimilarityMeasuresSchema().dump(self) - - -class SimilarProductSearchRequest(_BaseType): - #: Number of [results requested](/../api/general-concepts#limit). - limit: typing.Optional[int] - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: typing.Optional[int] - #: language tag used to prioritize language for text comparisons. - language: typing.Optional[str] - #: The three-digit currency code to compare prices in. When a product has multiple prices, all prices for the product are converted to the currency provided by the currency attribute and the median price is calculated for comparison. Currencies are converted using the ECB currency exchange rates at the time the request is made. Of the currency codes, only currencies with currency exchange rates provided by the ECB are supported. - currency_code: typing.Optional[str] - #: `similarityMeasures` defines the attributes taken into account to measure product similarity. - similarity_measures: typing.Optional["SimilarityMeasures"] - #: Array of length 2 of ProductSetSelector - product_set_selectors: typing.Optional[typing.List["ProductSetSelector"]] - confidence_min: typing.Optional[float] - confidence_max: typing.Optional[float] - - def __init__( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - language: typing.Optional[str] = None, - currency_code: typing.Optional[str] = None, - similarity_measures: typing.Optional["SimilarityMeasures"] = None, - product_set_selectors: typing.Optional[ - typing.List["ProductSetSelector"] - ] = None, - confidence_min: typing.Optional[float] = None, - confidence_max: typing.Optional[float] = None - ): - self.limit = limit - self.offset = offset - self.language = language - self.currency_code = currency_code - self.similarity_measures = similarity_measures - self.product_set_selectors = product_set_selectors - self.confidence_min = confidence_min - self.confidence_max = confidence_max - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "SimilarProductSearchRequest": - from ._schemas.similar_products import SimilarProductSearchRequestSchema - - return SimilarProductSearchRequestSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarProductSearchRequestSchema - - return SimilarProductSearchRequestSchema().dump(self) - - -class SimilarProduct(_BaseType): - """One part of a SimilarProductPair. Refers to a specific ProductVariant.""" - - #: Reference to Product - product: typing.Optional["ProductReference"] - #: ID of the ProductVariant that was compared. - variant_id: typing.Optional[int] - #: Supplementary information about the data used for similarity estimation. This information helps you understand the estimated confidence score, but it should not be used to identify a product. - meta: typing.Optional["SimilarProductMeta"] - - def __init__( - self, - *, - product: typing.Optional["ProductReference"] = None, - variant_id: typing.Optional[int] = None, - meta: typing.Optional["SimilarProductMeta"] = None - ): - self.product = product - self.variant_id = variant_id - self.meta = meta - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SimilarProduct": - from ._schemas.similar_products import SimilarProductSchema - - return SimilarProductSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarProductSchema - - return SimilarProductSchema().dump(self) - - -class SimilarProductMeta(_BaseType): - #: Localized product name used for similarity estimation. - name: typing.Optional["LocalizedString"] - #: Localized product description used for similarity estimation. - description: typing.Optional["LocalizedString"] - #: The product price in cents using the currency defined in SimilarProductSearchRequest If multiple prices exist, the median value is taken as a representative amount. - price: typing.Optional["Money"] - #: Total number of variants associated with the product. - variant_count: typing.Optional[int] - - def __init__( - self, - *, - name: typing.Optional["LocalizedString"] = None, - description: typing.Optional["LocalizedString"] = None, - price: typing.Optional["Money"] = None, - variant_count: typing.Optional[int] = None - ): - self.name = name - self.description = description - self.price = price - self.variant_count = variant_count - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SimilarProductMeta": - from ._schemas.similar_products import SimilarProductMetaSchema - - return SimilarProductMetaSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarProductMetaSchema - - return SimilarProductMetaSchema().dump(self) - - -class SimilarProductPair(_BaseType): - """A pair of SimilarProducts""" - - #: The probability of product similarity. - confidence: float - products: typing.List["SimilarProduct"] - - def __init__(self, *, confidence: float, products: typing.List["SimilarProduct"]): - self.confidence = confidence - self.products = products - - super().__init__() - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SimilarProductPair": - from ._schemas.similar_products import SimilarProductPairSchema - - return SimilarProductPairSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarProductPairSchema - - return SimilarProductPairSchema().dump(self) - - -class SimilarProductSearchRequestMeta(_BaseType): - #: The SimilarityMeasures used in this search. - similarity_measures: "SimilarityMeasures" - - def __init__(self, *, similarity_measures: "SimilarityMeasures"): - self.similarity_measures = similarity_measures - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "SimilarProductSearchRequestMeta": - from ._schemas.similar_products import SimilarProductSearchRequestMetaSchema - - return SimilarProductSearchRequestMetaSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarProductSearchRequestMetaSchema - - return SimilarProductSearchRequestMetaSchema().dump(self) - - -class SimilarProductsPagedQueryResult(_BaseType): - count: int - total: int - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: int - results: typing.List["SimilarProductPair"] - meta: "SimilarProductSearchRequestMeta" - - def __init__( - self, - *, - count: int, - total: int, - offset: int, - results: typing.List["SimilarProductPair"], - meta: "SimilarProductSearchRequestMeta" - ): - self.count = count - self.total = total - self.offset = offset - self.results = results - self.meta = meta - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "SimilarProductsPagedQueryResult": - from ._schemas.similar_products import SimilarProductsPagedQueryResultSchema - - return SimilarProductsPagedQueryResultSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarProductsPagedQueryResultSchema - - return SimilarProductsPagedQueryResultSchema().dump(self) - - -class SimilarProductsTaskStatus(_BaseType): - """Represents a URL path to poll to get the results of an Asynchronous Request.""" - - state: "TaskStatusEnum" - #: The expiry date of the result. You cannot access the result after the expiry date. Default: 1 day after the result first becomes available. This is only available when the TaskStatus state is SUCCESS. - expires: typing.Optional[datetime.datetime] - #: The response to an asynchronous request. The type depends on the request initiated. Only populated when the status is `SUCCESS`. - result: "SimilarProductsPagedQueryResult" - - def __init__( - self, - *, - state: "TaskStatusEnum", - expires: typing.Optional[datetime.datetime] = None, - result: "SimilarProductsPagedQueryResult" - ): - self.state = state - self.expires = expires - self.result = result - - super().__init__() - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "SimilarProductsTaskStatus": - from ._schemas.similar_products import SimilarProductsTaskStatusSchema - - return SimilarProductsTaskStatusSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.similar_products import SimilarProductsTaskStatusSchema - - return SimilarProductsTaskStatusSchema().dump(self) diff --git a/src/commercetools/platform/client/__init__.py b/src/commercetools/platform/client/__init__.py index 278aa0a8..bc144be7 100644 --- a/src/commercetools/platform/client/__init__.py +++ b/src/commercetools/platform/client/__init__.py @@ -4,15 +4,16 @@ # contribute to this project then please do not edit this file directly # but send a pull request to the Lab Digital fork of rmf-codegen at # https://github.com/labd/rmf-codegen -from commercetools.client import BaseClient +from commercetools.base_client import BaseClient from .by_project_key_request_builder import ByProjectKeyRequestBuilder class Client(BaseClient): + def __init__(self, *args, **kwargs): kwargs.setdefault("url", "https://api.{region}.commercetools.com") - super().__init__(self, **kwargs) + super().__init__(**kwargs) def with_project_key(self, project_key: str) -> ByProjectKeyRequestBuilder: """The Project endpoint is used to retrieve certain information from a project.""" diff --git a/src/commercetools/platform/client/active_cart/by_project_key_in_store_key_by_store_key_me_active_cart_request_builder.py b/src/commercetools/platform/client/active_cart/by_project_key_in_store_key_by_store_key_me_active_cart_request_builder.py index 6e6d63b5..9c7e484b 100644 --- a/src/commercetools/platform/client/active_cart/by_project_key_in_store_key_by_store_key_me_active_cart_request_builder.py +++ b/src/commercetools/platform/client/active_cart/by_project_key_in_store_key_by_store_key_me_active_cart_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeActiveCartRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/active_cart/by_project_key_me_active_cart_request_builder.py b/src/commercetools/platform/client/active_cart/by_project_key_me_active_cart_request_builder.py index 6992c900..b335463d 100644 --- a/src/commercetools/platform/client/active_cart/by_project_key_me_active_cart_request_builder.py +++ b/src/commercetools/platform/client/active_cart/by_project_key_me_active_cart_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyMeActiveCartRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/api_clients/by_project_key_api_clients_by_id_request_builder.py b/src/commercetools/platform/client/api_clients/by_project_key_api_clients_by_id_request_builder.py index db1e4816..fdea115e 100644 --- a/src/commercetools/platform/client/api_clients/by_project_key_api_clients_by_id_request_builder.py +++ b/src/commercetools/platform/client/api_clients/by_project_key_api_clients_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyApiClientsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/api_clients/by_project_key_api_clients_request_builder.py b/src/commercetools/platform/client/api_clients/by_project_key_api_clients_request_builder.py index 8bc06149..34673090 100644 --- a/src/commercetools/platform/client/api_clients/by_project_key_api_clients_request_builder.py +++ b/src/commercetools/platform/client/api_clients/by_project_key_api_clients_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyApiClientsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/apply/by_project_key_orders_edits_by_id_apply_request_builder.py b/src/commercetools/platform/client/apply/by_project_key_orders_edits_by_id_apply_request_builder.py index cef3e38d..a6be5c98 100644 --- a/src/commercetools/platform/client/apply/by_project_key_orders_edits_by_id_apply_request_builder.py +++ b/src/commercetools/platform/client/apply/by_project_key_orders_edits_by_id_apply_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersEditsByIDApplyRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_by_id_request_builder.py b/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_by_id_request_builder.py index be29e129..f83b9c87 100644 --- a/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_by_id_request_builder.py +++ b/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalFlowsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_request_builder.py b/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_request_builder.py index 9e0f8a34..cfed5bcb 100644 --- a/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_request_builder.py +++ b/src/commercetools/platform/client/approval_flows/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalFlowsRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_by_id_request_builder.py b/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_by_id_request_builder.py index 3bd611bf..2a6d4a91 100644 --- a/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_by_id_request_builder.py +++ b/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_key_by_key_request_builder.py b/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_key_by_key_request_builder.py index 8f0f1aad..a7537249 100644 --- a/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_request_builder.py b/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_request_builder.py index 8a4a876e..17214e95 100644 --- a/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_request_builder.py +++ b/src/commercetools/platform/client/approval_rules/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/as_associate/by_project_key_as_associate_by_associate_id_request_builder.py b/src/commercetools/platform/client/as_associate/by_project_key_as_associate_by_associate_id_request_builder.py index 107e2123..e8c76981 100644 --- a/src/commercetools/platform/client/as_associate/by_project_key_as_associate_by_associate_id_request_builder.py +++ b/src/commercetools/platform/client/as_associate/by_project_key_as_associate_by_associate_id_request_builder.py @@ -19,6 +19,7 @@ class ByProjectKeyAsAssociateByAssociateIdRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/as_associate/by_project_key_as_associate_request_builder.py b/src/commercetools/platform/client/as_associate/by_project_key_as_associate_request_builder.py index f6eea591..802ad605 100644 --- a/src/commercetools/platform/client/as_associate/by_project_key_as_associate_request_builder.py +++ b/src/commercetools/platform/client/as_associate/by_project_key_as_associate_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyAsAssociateRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_by_id_request_builder.py b/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_by_id_request_builder.py index 2a1efa5c..562092f5 100644 --- a/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_by_id_request_builder.py +++ b/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAssociateRolesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_key_by_key_request_builder.py b/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_key_by_key_request_builder.py index cb8abcca..6ec5b5de 100644 --- a/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAssociateRolesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_request_builder.py b/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_request_builder.py index fb93335e..b6f92396 100644 --- a/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_request_builder.py +++ b/src/commercetools/platform/client/associate_roles/by_project_key_associate_roles_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyAssociateRolesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_by_id_request_builder.py b/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_by_id_request_builder.py index bad408c0..4f5ca975 100644 --- a/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_by_id_request_builder.py +++ b/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAttributeGroupsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_key_by_key_request_builder.py b/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_key_by_key_request_builder.py index 0cf92d0a..6fafae21 100644 --- a/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAttributeGroupsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_request_builder.py b/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_request_builder.py index ead53c84..673c0e5a 100644 --- a/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_request_builder.py +++ b/src/commercetools/platform/client/attribute_groups/by_project_key_attribute_groups_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyAttributeGroupsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_by_id_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_by_id_request_builder.py index 8b69a0c8..163efc16 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_by_id_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdBusinessUnitsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_key_by_key_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_key_by_key_request_builder.py index f8870505..b2ec3ce1 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdBusinessUnitsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_request_builder.py index 47092fb1..15111e8a 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_as_associate_by_associate_id_business_units_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyAsAssociateByAssociateIdBusinessUnitsRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_business_units_by_id_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_business_units_by_id_request_builder.py index 555f1e96..8f6828f5 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_business_units_by_id_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_business_units_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyBusinessUnitsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_business_units_key_by_key_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_business_units_key_by_key_request_builder.py index 290305f0..70d60490 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_business_units_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_business_units_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyBusinessUnitsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_business_units_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_business_units_request_builder.py index 13e32ef0..46660485 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_business_units_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_business_units_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyBusinessUnitsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_me_business_units_by_id_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_me_business_units_by_id_request_builder.py index 78729a61..180d0055 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_me_business_units_by_id_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_me_business_units_by_id_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeBusinessUnitsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_me_business_units_key_by_key_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_me_business_units_key_by_key_request_builder.py index 7b5beba9..bbf5616e 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_me_business_units_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_me_business_units_key_by_key_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeBusinessUnitsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/business_units/by_project_key_me_business_units_request_builder.py b/src/commercetools/platform/client/business_units/by_project_key_me_business_units_request_builder.py index 10de424a..b8a5f124 100644 --- a/src/commercetools/platform/client/business_units/by_project_key_me_business_units_request_builder.py +++ b/src/commercetools/platform/client/business_units/by_project_key_me_business_units_request_builder.py @@ -22,6 +22,7 @@ class ByProjectKeyMeBusinessUnitsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/by_project_key_request_builder.py b/src/commercetools/platform/client/by_project_key_request_builder.py index 010e734d..d610ffa8 100644 --- a/src/commercetools/platform/client/by_project_key_request_builder.py +++ b/src/commercetools/platform/client/by_project_key_request_builder.py @@ -81,6 +81,9 @@ from .product_selections.by_project_key_product_selections_request_builder import ( ByProjectKeyProductSelectionsRequestBuilder, ) +from .product_tailoring.by_project_key_product_tailoring_request_builder import ( + ByProjectKeyProductTailoringRequestBuilder, +) from .product_types.by_project_key_product_types_request_builder import ( ByProjectKeyProductTypesRequestBuilder, ) @@ -128,6 +131,7 @@ class ByProjectKeyRequestBuilder: + _client: "BaseClient" _project_key: str @@ -296,6 +300,13 @@ def product_selections(self) -> ByProjectKeyProductSelectionsRequestBuilder: client=self._client, ) + def product_tailoring(self) -> ByProjectKeyProductTailoringRequestBuilder: + """Product tailoring are used to contextualize product data for specific stores.""" + return ByProjectKeyProductTailoringRequestBuilder( + project_key=self._project_key, + client=self._client, + ) + def product_types(self) -> ByProjectKeyProductTypesRequestBuilder: """Product Types are used to describe common characteristics, most importantly common custom attributes, of many concrete products. diff --git a/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_by_id_request_builder.py b/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_by_id_request_builder.py index ce08bd7b..362c8ea2 100644 --- a/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_by_id_request_builder.py +++ b/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCartDiscountsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str @@ -108,6 +109,7 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartDiscount"]: + """Deleting a Cart Discount produces the [CartDiscountDeleted](ctp:api:type:CartDiscountDeletedMessage) Message.""" headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/cart-discounts/{self._id}", diff --git a/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_key_by_key_request_builder.py b/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_key_by_key_request_builder.py index c39ab3c4..02172c47 100644 --- a/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCartDiscountsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str @@ -108,6 +109,7 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartDiscount"]: + """Deleting a Cart Discount produces the [CartDiscountDeleted](ctp:api:type:CartDiscountDeletedMessage) Message.""" headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/cart-discounts/key={self._key}", diff --git a/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_request_builder.py b/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_request_builder.py index c130a713..9cb80334 100644 --- a/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_request_builder.py +++ b/src/commercetools/platform/client/cart_discounts/by_project_key_cart_discounts_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyCartDiscountsRequestBuilder: + _client: "BaseClient" _project_key: str @@ -122,6 +123,7 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartDiscount"]: + """Creating a Cart Discount produces the [CartDiscountCreated](ctp:api:type:CartDiscountCreatedMessage) Message.""" headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/cart-discounts", diff --git a/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_by_id_request_builder.py b/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_by_id_request_builder.py index 5bef25d3..d4ab3102 100644 --- a/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_by_id_request_builder.py +++ b/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartDiscountsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -112,7 +113,11 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartDiscount"]: - """To delete a CartDiscount, specify the `manage_cart_discounts:{projectKey}:{storeKey}` scope for all Stores associated with the CartDiscount.""" + """To delete a CartDiscount, specify the `manage_cart_discounts:{projectKey}:{storeKey}` scope for all Stores associated with the CartDiscount. + + Deleting a Cart Discount produces the [CartDiscountDeleted](ctp:api:type:CartDiscountDeletedMessage) Message. + + """ headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/cart-discounts/{self._id}", diff --git a/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_key_by_key_request_builder.py b/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_key_by_key_request_builder.py index 6d979f4f..8db4349f 100644 --- a/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartDiscountsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -112,7 +113,11 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartDiscount"]: - """To delete a CartDiscount, specify the `manage_cart_discounts:{projectKey}:{storeKey}` scope for all Stores associated with the CartDiscount.""" + """To delete a CartDiscount, specify the `manage_cart_discounts:{projectKey}:{storeKey}` scope for all Stores associated with the CartDiscount. + + Deleting a Cart Discount produces the [CartDiscountDeleted](ctp:api:type:CartDiscountDeletedMessage) Message. + + """ headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/cart-discounts/key={self._key}", diff --git a/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_request_builder.py b/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_request_builder.py index be023819..770ce2e6 100644 --- a/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_request_builder.py +++ b/src/commercetools/platform/client/cart_discounts/by_project_key_in_store_key_by_store_key_cart_discounts_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartDiscountsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -131,7 +132,11 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartDiscount"]: - """When using the endpoint, the Store specified in the path and the Stores specified in the payload's `stores` field are added to the CartDiscount.""" + """When using the endpoint, the Store specified in the path and the Stores specified in the payload's `stores` field are added to the CartDiscount. + + Creating a Cart Discount produces the [CartDiscountCreated](ctp:api:type:CartDiscountCreatedMessage) Message. + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/cart-discounts", diff --git a/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_by_id_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_by_id_request_builder.py index 055cece6..70ca8244 100644 --- a/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_by_id_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_key_by_key_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_key_by_key_request_builder.py index 8d5d49a0..3ebdef17 100644 --- a/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_request_builder.py index a0e1da5a..aa815e7d 100644 --- a/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_request_builder.py @@ -24,6 +24,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str @@ -148,6 +149,13 @@ def post( """Creates a [Cart](ctp:api:type:Cart) in the [BusinessUnit](ctp:api:type:BusinessUnit) referenced by `businessUnitKey`. As such, the `businessUnit` field on [CartDraft](ctp:api:type:CartDraft) is ignored for this request. Creating a Cart can fail with an [InvalidOperation](ctp:api:type:InvalidOperationError) if the referenced [ShippingMethod](ctp:api:type:ShippingMethod) in the [CartDraft](ctp:api:type:CartDraft) has a predicate that does not match the Cart. + Specific Error Codes: + + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) + """ headers = {} if headers is None else headers response = self._client._post( diff --git a/src/commercetools/platform/client/carts/by_project_key_carts_by_id_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_carts_by_id_request_builder.py index 17108395..34ae2a7f 100644 --- a/src/commercetools/platform/client/carts/by_project_key_carts_by_id_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_carts_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCartsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/carts/by_project_key_carts_customer_id_by_customer_id_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_carts_customer_id_by_customer_id_request_builder.py index 753136ac..c02103fe 100644 --- a/src/commercetools/platform/client/carts/by_project_key_carts_customer_id_by_customer_id_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_carts_customer_id_by_customer_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCartsCustomerIdByCustomerIdRequestBuilder: + _client: "BaseClient" _project_key: str _customer_id: str @@ -36,7 +37,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: - """Retrieves the recently modified active Cart of a Customer with [CartOrigin](ctp:api:type:CartOrigin) `Customer`. If no active Cart exists, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + """Retrieves the most recently modified active Cart of a Customer with [CartOrigin](ctp:api:type:CartOrigin) `Customer`. If no active Cart exists, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. To ensure the Cart is up-to-date with current values (such as Prices and Discounts), use the [Recalculate](ctp:api:type:CartRecalculateAction) update action. diff --git a/src/commercetools/platform/client/carts/by_project_key_carts_key_by_key_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_carts_key_by_key_request_builder.py index 195eef5f..b520f936 100644 --- a/src/commercetools/platform/client/carts/by_project_key_carts_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_carts_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCartsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/carts/by_project_key_carts_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_carts_request_builder.py index 7dbd5f22..71b67697 100644 --- a/src/commercetools/platform/client/carts/by_project_key_carts_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_carts_request_builder.py @@ -27,6 +27,7 @@ class ByProjectKeyCartsRequestBuilder: + _client: "BaseClient" _project_key: str @@ -139,9 +140,14 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: - """Creating a Cart fails with an [InvalidOperation](ctp:api:type:InvalidOperationError) error if the - [ShippingMethod](ctp:api:type:ShippingMethod) referenced in the CartDraft - has a `predicate` that does not match the Cart. + """If the referenced [ShippingMethod](ctp:api:type:ShippingMethod) in the [CartDraft](ctp:api:type:CartDraft) has a predicate that does not match, or if the Shipping Method is not active, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned. + + Specific Error Codes: + + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_by_id_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_by_id_request_builder.py index e289b65f..9c9bfbd9 100644 --- a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_by_id_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_customer_id_by_customer_id_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_customer_id_by_customer_id_request_builder.py index b2295c70..7763b7f3 100644 --- a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_customer_id_by_customer_id_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_customer_id_by_customer_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartsCustomerIdByCustomerIdRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -39,7 +40,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: - """Retrieves the recently modified active Cart of a Customer with [CartOrigin](ctp:api:type:CartOrigin) `Customer`. If no active Cart exists, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + """Retrieves the most recently modified active Cart of a Customer with [CartOrigin](ctp:api:type:CartOrigin) `Customer`. If no active Cart exists, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. If the Cart exists in the Project but does not have the `store` field, or the `store` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. diff --git a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_key_by_key_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_key_by_key_request_builder.py index de50e784..4f00c08b 100644 --- a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_request_builder.py index 49bb1465..d47e22dd 100644 --- a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_carts_request_builder.py @@ -27,6 +27,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -93,7 +94,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartPagedQueryResponse"]: - """Queries carts in a specific [Store](ctp:api:type:Store).""" + """Queries Carts in a specific [Store](ctp:api:type:Store).""" params = { "expand": expand, "sort": sort, @@ -155,7 +156,15 @@ def post( ) -> typing.Optional["Cart"]: """Creates a [Cart](ctp:api:type:Cart) in the [Store](ctp:api:type:Store) specified by `storeKey`. When using this endpoint the Cart's `store` field is always set to the [Store](ctp:api:type:Store) specified in the path parameter. - If the referenced [ShippingMethod](ctp:api:type:ShippingMethod) in the [CartDraft](ctp:api:type:CartDraft) has a predicate that does not match, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned. + If the referenced [ShippingMethod](ctp:api:type:ShippingMethod) in the [CartDraft](ctp:api:type:CartDraft) has a predicate that does not match, or if the Shipping Method is not active, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned. + + Specific Error Codes: + + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) + - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_by_id_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_by_id_request_builder.py index 40e3c6ab..83cfd931 100644 --- a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_by_id_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_by_id_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeCartsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -40,6 +41,13 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: + """Returns a Cart for a given `id` in a Store. Returns a `200 OK` status if the Cart exists, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise. + + If the Cart exists in the Project but does not belong to a Store, or the Cart's `store` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + If the Cart exists in the Project but does not have a matching `customerId` or `anonymousId`, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + """ headers = {} if headers is None else headers response = self._client._get( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/me/carts/{self._id}", @@ -62,7 +70,6 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks ifa My Cart exists for a given `id`. Returns a `200 OK` status if the My Cart exists or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/me/carts/{self._id}", @@ -87,7 +94,13 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: - """If the Cart exists in the Project but does not have the `store` field, or the `store` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.""" + """Updates the Cart for a given `id` in a Store. Returns a `200 OK` status if the Cart exists, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise. + + If the Cart exists in the Project but does not belong to a Store, or the Cart's `store` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + If the Cart exists in the Project but does not have a matching `customerId` or `anonymousId`, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/me/carts/{self._id}", @@ -113,6 +126,13 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: + """Deletes the Cart for a given `id` in a Store. Returns a `200 OK` status if the Cart exists, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise. + + If the Cart exists in the Project but does not belong to a Store, or the Cart's `store` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + If the Cart exists in the Project but does not have a matching `customerId` or `anonymousId`, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + """ headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/me/carts/{self._id}", diff --git a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_request_builder.py index 965bf262..5907fb85 100644 --- a/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_in_store_key_by_store_key_me_carts_request_builder.py @@ -19,6 +19,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeCartsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -56,6 +57,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartPagedQueryResponse"]: + """Returns all Carts that match a given Query Predicate and contain either a matching `customerId` or `anonymousId` in a Store.""" params = { "expand": expand, "sort": sort, @@ -90,7 +92,7 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a Cart exists for a given Query Predicate. Returns a `200 OK` status if any Carts match the Query Predicate or a `404 Not Found` otherwise.""" + """Checks if a Cart exists for a Store that matches the given Query Predicate, and contains a matching `customerId` or `anonymousId`. Returns a `200 OK` status if any Carts match these conditions, or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/me/carts", @@ -115,9 +117,17 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: - """The `store` field in the created [Cart](ctp:api:type:Cart) is set to the Store specified by the `storeKey` path parameter. + """Creates a Cart in the specified Store for a given `customerId` or `anonymousId`. + + The `store` field in the created [Cart](ctp:api:type:Cart) is set to the Store specified by the `storeKey` path parameter. + + Specific Error Codes: - Specific Error Codes: [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) + - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/carts/by_project_key_me_carts_by_id_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_me_carts_by_id_request_builder.py index 77372e4e..44d1fd9c 100644 --- a/src/commercetools/platform/client/carts/by_project_key_me_carts_by_id_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_me_carts_by_id_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeCartsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str @@ -37,6 +38,11 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: + """Returns a Cart for a given `id`. Returns a `200 OK` status if the Cart exists, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise. + + If the Cart exists in the Project but does not have a matching `customerId` or `anonymousId`, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + """ headers = {} if headers is None else headers response = self._client._get( endpoint=f"/{self._project_key}/me/carts/{self._id}", @@ -59,7 +65,11 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a Cart exists for a given `id`. Returns a `200 OK` status if the Cart exists or a `404 Not Found` otherwise.""" + """Checks if a Cart exists for a given `id`. Returns a `200 OK` status if the Cart exists, or a `404 Not Found` otherwise. + + If the Cart exists in the Project but does not have a matching `customerId` or `anonymousId`, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + """ headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/me/carts/{self._id}", @@ -84,6 +94,11 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: + """Updates the Cart for a given `id`. Returns a `200 OK` status if the Cart exists, or a `404 Not Found` otherwise. + + If the Cart exists in the Project but does not have a matching `customerId` or `anonymousId`, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/me/carts/{self._id}", @@ -109,6 +124,11 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: + """Deletes the Cart for a given `id`. Returns a `200 OK` status if the Cart exists, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise. + + If the Cart exists in the Project but does not have a matching `customerId` or `anonymousId`, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + """ headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/me/carts/{self._id}", diff --git a/src/commercetools/platform/client/carts/by_project_key_me_carts_key_by_key_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_me_carts_key_by_key_request_builder.py index d76937c2..b7358078 100644 --- a/src/commercetools/platform/client/carts/by_project_key_me_carts_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_me_carts_key_by_key_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeCartsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/carts/by_project_key_me_carts_request_builder.py b/src/commercetools/platform/client/carts/by_project_key_me_carts_request_builder.py index 898108f2..6042113d 100644 --- a/src/commercetools/platform/client/carts/by_project_key_me_carts_request_builder.py +++ b/src/commercetools/platform/client/carts/by_project_key_me_carts_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyMeCartsRequestBuilder: + _client: "BaseClient" _project_key: str @@ -69,6 +70,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["CartPagedQueryResponse"]: + """Returns all Carts that match a given Query Predicate and contain either a matching `customerId` or `anonymousId`.""" params = { "expand": expand, "sort": sort, @@ -103,7 +105,7 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a Cart exists for a given Query Predicate. Returns a `200 OK` status if any Carts match the Query Predicate or a `404 Not Found` otherwise.""" + """Checks if a Cart exists that matches a given Query Predicate and contains either a matching `customerId` or `anonymousId`. Returns a `200 OK` status if the Cart exists, or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/me/carts", @@ -128,6 +130,16 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Cart"]: + """Creates a Cart for a given `customerId` or `anonymousId`. + + Specific Error Codes: + + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/me/carts", diff --git a/src/commercetools/platform/client/categories/by_project_key_categories_by_id_request_builder.py b/src/commercetools/platform/client/categories/by_project_key_categories_by_id_request_builder.py index 61d00443..23682982 100644 --- a/src/commercetools/platform/client/categories/by_project_key_categories_by_id_request_builder.py +++ b/src/commercetools/platform/client/categories/by_project_key_categories_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCategoriesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/categories/by_project_key_categories_key_by_key_request_builder.py b/src/commercetools/platform/client/categories/by_project_key_categories_key_by_key_request_builder.py index de6de146..ab505d02 100644 --- a/src/commercetools/platform/client/categories/by_project_key_categories_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/categories/by_project_key_categories_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCategoriesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/categories/by_project_key_categories_request_builder.py b/src/commercetools/platform/client/categories/by_project_key_categories_request_builder.py index 02a2de61..199f5e07 100644 --- a/src/commercetools/platform/client/categories/by_project_key_categories_request_builder.py +++ b/src/commercetools/platform/client/categories/by_project_key_categories_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyCategoriesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/channels/by_project_key_channels_by_id_request_builder.py b/src/commercetools/platform/client/channels/by_project_key_channels_by_id_request_builder.py index 389d394e..78366b02 100644 --- a/src/commercetools/platform/client/channels/by_project_key_channels_by_id_request_builder.py +++ b/src/commercetools/platform/client/channels/by_project_key_channels_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyChannelsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str @@ -108,6 +109,7 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Channel"]: + """Returns a [ReferenceExists](ctp:api:type:ReferenceExistsError) error if other resources reference the Channel to be deleted.""" headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/channels/{self._id}", diff --git a/src/commercetools/platform/client/channels/by_project_key_channels_request_builder.py b/src/commercetools/platform/client/channels/by_project_key_channels_request_builder.py index 89a5c93c..044ce564 100644 --- a/src/commercetools/platform/client/channels/by_project_key_channels_request_builder.py +++ b/src/commercetools/platform/client/channels/by_project_key_channels_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyChannelsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/confirm/by_project_key_customers_email_confirm_request_builder.py b/src/commercetools/platform/client/confirm/by_project_key_customers_email_confirm_request_builder.py index eaad4cba..3a180f0d 100644 --- a/src/commercetools/platform/client/confirm/by_project_key_customers_email_confirm_request_builder.py +++ b/src/commercetools/platform/client/confirm/by_project_key_customers_email_confirm_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersEmailConfirmRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_customers_email_confirm_request_builder.py b/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_customers_email_confirm_request_builder.py index 2fcaef4f..104684ff 100644 --- a/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_customers_email_confirm_request_builder.py +++ b/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_customers_email_confirm_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersEmailConfirmRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_me_email_confirm_request_builder.py b/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_me_email_confirm_request_builder.py index a538210a..29de7534 100644 --- a/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_me_email_confirm_request_builder.py +++ b/src/commercetools/platform/client/confirm/by_project_key_in_store_key_by_store_key_me_email_confirm_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeEmailConfirmRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/confirm/by_project_key_me_email_confirm_request_builder.py b/src/commercetools/platform/client/confirm/by_project_key_me_email_confirm_request_builder.py index ad5cafdf..26c1258a 100644 --- a/src/commercetools/platform/client/confirm/by_project_key_me_email_confirm_request_builder.py +++ b/src/commercetools/platform/client/confirm/by_project_key_me_email_confirm_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyMeEmailConfirmRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_by_key_request_builder.py b/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_by_key_request_builder.py index da8216d4..a362df46 100644 --- a/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_by_key_request_builder.py +++ b/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomObjectsByContainerByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _container: str diff --git a/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_request_builder.py b/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_request_builder.py index e258cbbb..4e9f3248 100644 --- a/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_request_builder.py +++ b/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_by_container_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomObjectsByContainerRequestBuilder: + _client: "BaseClient" _project_key: str _container: str diff --git a/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_request_builder.py b/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_request_builder.py index d3aa9472..cbec6a7d 100644 --- a/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_request_builder.py +++ b/src/commercetools/platform/client/custom_objects/by_project_key_custom_objects_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyCustomObjectsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_by_id_request_builder.py b/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_by_id_request_builder.py index 27044965..f1c57de2 100644 --- a/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_by_id_request_builder.py +++ b/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomerGroupsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_key_by_key_request_builder.py b/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_key_by_key_request_builder.py index 096755d6..3fddfc69 100644 --- a/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomerGroupsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_request_builder.py b/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_request_builder.py index 1408176f..1821bd9c 100644 --- a/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_request_builder.py +++ b/src/commercetools/platform/client/customer_groups/by_project_key_customer_groups_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyCustomerGroupsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/customers/by_project_key_customers_by_id_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_customers_by_id_request_builder.py index 5eaf074c..6d6aa39c 100644 --- a/src/commercetools/platform/client/customers/by_project_key_customers_by_id_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_customers_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str @@ -83,6 +84,7 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Customer"]: + """Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.""" headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/customers/{self._id}", diff --git a/src/commercetools/platform/client/customers/by_project_key_customers_email_token_by_email_token_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_customers_email_token_by_email_token_request_builder.py index c02160e3..39e722ba 100644 --- a/src/commercetools/platform/client/customers/by_project_key_customers_email_token_by_email_token_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_customers_email_token_by_email_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersEmailTokenByEmailTokenRequestBuilder: + _client: "BaseClient" _project_key: str _email_token: str diff --git a/src/commercetools/platform/client/customers/by_project_key_customers_key_by_key_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_customers_key_by_key_request_builder.py index 82d680cf..1d8529db 100644 --- a/src/commercetools/platform/client/customers/by_project_key_customers_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_customers_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str @@ -83,6 +84,7 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Customer"]: + """Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.""" headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/customers/key={self._key}", diff --git a/src/commercetools/platform/client/customers/by_project_key_customers_password_token_by_password_token_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_customers_password_token_by_password_token_request_builder.py index d39f625c..f62c11bf 100644 --- a/src/commercetools/platform/client/customers/by_project_key_customers_password_token_by_password_token_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_customers_password_token_by_password_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersPasswordTokenByPasswordTokenRequestBuilder: + _client: "BaseClient" _project_key: str _password_token: str diff --git a/src/commercetools/platform/client/customers/by_project_key_customers_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_customers_request_builder.py index 6199c7a5..5e66b450 100644 --- a/src/commercetools/platform/client/customers/by_project_key_customers_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_customers_request_builder.py @@ -19,6 +19,9 @@ from ..email_token.by_project_key_customers_email_token_request_builder import ( ByProjectKeyCustomersEmailTokenRequestBuilder, ) +from ..indexing_status.by_project_key_customers_search_indexing_status_request_builder import ( + ByProjectKeyCustomersSearchIndexingStatusRequestBuilder, +) from ..password.by_project_key_customers_password_request_builder import ( ByProjectKeyCustomersPasswordRequestBuilder, ) @@ -28,6 +31,9 @@ from ..reset.by_project_key_customers_password_reset_request_builder import ( ByProjectKeyCustomersPasswordResetRequestBuilder, ) +from ..search.by_project_key_customers_search_request_builder import ( + ByProjectKeyCustomersSearchRequestBuilder, +) from .by_project_key_customers_by_id_request_builder import ( ByProjectKeyCustomersByIDRequestBuilder, ) @@ -46,6 +52,7 @@ class ByProjectKeyCustomersRequestBuilder: + _client: "BaseClient" _project_key: str @@ -120,6 +127,22 @@ def with_id(self, id: str) -> ByProjectKeyCustomersByIDRequestBuilder: client=self._client, ) + def search(self) -> ByProjectKeyCustomersSearchRequestBuilder: + """This endpoint provides high-performance search queries over Customers.""" + return ByProjectKeyCustomersSearchRequestBuilder( + project_key=self._project_key, + client=self._client, + ) + + def search_indexing_status( + self, + ) -> ByProjectKeyCustomersSearchIndexingStatusRequestBuilder: + """This endpoint provides information on the status of a Customer search for a project""" + return ByProjectKeyCustomersSearchIndexingStatusRequestBuilder( + project_key=self._project_key, + client=self._client, + ) + def get( self, *, @@ -194,7 +217,8 @@ def post( ) -> typing.Optional["CustomerSignInResult"]: """If the `anonymousCart` field is set on the [CustomerDraft](ctp:api:type:CustomerDraft), then the newly created Customer will be assigned to that [Cart](ctp:api:type:Cart). Similarly, if the `anonymousId` field is set, the Customer will be set on all [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [ShoppingLists](ctp:api:type:ShoppingList) and [Payments](ctp:api:type:Payment) with the same `anonymousId`. - Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. + + Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. Simultaneously creating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/customers/by_project_key_in_business_unit_key_by_business_unit_key_me_customers_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_in_business_unit_key_by_business_unit_key_me_customers_request_builder.py index 2c2df83b..b2de8ff7 100644 --- a/src/commercetools/platform/client/customers/by_project_key_in_business_unit_key_by_business_unit_key_me_customers_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_in_business_unit_key_by_business_unit_key_me_customers_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestBuilder: + _client: "BaseClient" _project_key: str _business_unit_key: str diff --git a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_by_id_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_by_id_request_builder.py index f8b2cc4b..ba518d08 100644 --- a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_by_id_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -87,7 +88,11 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Customer"]: - """If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.""" + """If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/customers/{self._id}", diff --git a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_email_token_by_email_token_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_email_token_by_email_token_request_builder.py index ffaeb754..7efe42a3 100644 --- a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_email_token_by_email_token_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_email_token_by_email_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersEmailTokenByEmailTokenRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_key_by_key_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_key_by_key_request_builder.py index bd28797f..79acfcfa 100644 --- a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -87,7 +88,11 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Customer"]: - """If the Customer exists in the Project but the `stores` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.""" + """If the Customer exists in the Project but the `stores` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/customers/key={self._key}", diff --git a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_password_token_by_password_token_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_password_token_by_password_token_request_builder.py index 924d23ad..09b5b547 100644 --- a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_password_token_by_password_token_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_password_token_by_password_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersPasswordTokenByPasswordTokenRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_request_builder.py b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_request_builder.py index 5f4bdba6..6aeb566b 100644 --- a/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_request_builder.py +++ b/src/commercetools/platform/client/customers/by_project_key_in_store_key_by_store_key_customers_request_builder.py @@ -46,6 +46,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -222,7 +223,8 @@ def post( If the `anonymousCart` field is set on the [CustomerDraft](ctp:api:type:CustomerDraft), then the newly created Customer will be assigned to that [Cart](ctp:api:type:Cart). Similarly, if the `anonymousId` field is set, the Customer will be set on all [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [ShoppingLists](ctp:api:type:ShoppingList) and [Payments](ctp:api:type:Payment) with the same `anonymousId`. If a Cart with a `store` field specified, the `store` field must reference the same [Store](ctp:api:type:Store) specified in the `{storeKey}` path parameter. - Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. + + Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. Simultaneously creating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_by_id_request_builder.py b/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_by_id_request_builder.py index d6a7a83a..c0fac822 100644 --- a/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_by_id_request_builder.py +++ b/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyDiscountCodesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str @@ -111,7 +112,11 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["DiscountCode"]: - """Deprecated scope: `manage_orders:{projectKey}`""" + """Deleting a Discount Code produces the [DiscountCodeDeleted](ctp:api:type:DiscountCodeDeletedMessage) Message. + + Deprecated scope: `manage_orders:{projectKey}` + + """ headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/discount-codes/{self._id}", diff --git a/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_key_by_key_request_builder.py b/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_key_by_key_request_builder.py new file mode 100644 index 00000000..c7f8df5b --- /dev/null +++ b/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_key_by_key_request_builder.py @@ -0,0 +1,134 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.discount_code import DiscountCode, DiscountCodeUpdate +from ...models.error import ErrorResponse + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyDiscountCodesKeyByKeyRequestBuilder: + + _client: "BaseClient" + _project_key: str + _key: str + + def __init__( + self, + project_key: str, + key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._key = key + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["DiscountCode"]: + """Deprecated scope: `view_orders:{projectKey}`""" + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/discount-codes/key={self._key}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return DiscountCode.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a DiscountCode exists for a given `key`. Returns a `200 OK` status if the DiscountCode exists or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/discount-codes/key={self._key}", + params={}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "DiscountCodeUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["DiscountCode"]: + """Deprecated scope: `manage_orders:{projectKey}`""" + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/discount-codes/key={self._key}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return DiscountCode.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + data_erasure: bool = None, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["DiscountCode"]: + """Deleting a Discount Code produces the [DiscountCodeDeleted](ctp:api:type:DiscountCodeDeletedMessage) Message. + + Deprecated scope: `manage_orders:{projectKey}` + + """ + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/discount-codes/key={self._key}", + params={"dataErasure": data_erasure, "version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return DiscountCode.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_request_builder.py b/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_request_builder.py index 3727179a..c59510ee 100644 --- a/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_request_builder.py +++ b/src/commercetools/platform/client/discount_codes/by_project_key_discount_codes_request_builder.py @@ -16,12 +16,16 @@ from .by_project_key_discount_codes_by_id_request_builder import ( ByProjectKeyDiscountCodesByIDRequestBuilder, ) +from .by_project_key_discount_codes_key_by_key_request_builder import ( + ByProjectKeyDiscountCodesKeyByKeyRequestBuilder, +) if typing.TYPE_CHECKING: from ...base_client import BaseClient class ByProjectKeyDiscountCodesRequestBuilder: + _client: "BaseClient" _project_key: str @@ -40,6 +44,13 @@ def with_id(self, id: str) -> ByProjectKeyDiscountCodesByIDRequestBuilder: client=self._client, ) + def with_key(self, key: str) -> ByProjectKeyDiscountCodesKeyByKeyRequestBuilder: + return ByProjectKeyDiscountCodesKeyByKeyRequestBuilder( + key=key, + project_key=self._project_key, + client=self._client, + ) + def get( self, *, @@ -113,7 +124,11 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["DiscountCode"]: - """Deprecated scope: `manage_orders:{projectKey}`""" + """Creating a Discount Code produces the [DiscountCodeCreated](ctp:api:type:DiscountCodeCreatedMessage) Message. + + Deprecated scope: `manage_orders:{projectKey}` + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/discount-codes", diff --git a/src/commercetools/platform/client/edits/by_project_key_orders_edits_by_id_request_builder.py b/src/commercetools/platform/client/edits/by_project_key_orders_edits_by_id_request_builder.py index 76894c2d..3e063875 100644 --- a/src/commercetools/platform/client/edits/by_project_key_orders_edits_by_id_request_builder.py +++ b/src/commercetools/platform/client/edits/by_project_key_orders_edits_by_id_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyOrdersEditsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/edits/by_project_key_orders_edits_key_by_key_request_builder.py b/src/commercetools/platform/client/edits/by_project_key_orders_edits_key_by_key_request_builder.py index 04899dd3..3579017e 100644 --- a/src/commercetools/platform/client/edits/by_project_key_orders_edits_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/edits/by_project_key_orders_edits_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersEditsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/edits/by_project_key_orders_edits_request_builder.py b/src/commercetools/platform/client/edits/by_project_key_orders_edits_request_builder.py index 9b075ed4..77970913 100644 --- a/src/commercetools/platform/client/edits/by_project_key_orders_edits_request_builder.py +++ b/src/commercetools/platform/client/edits/by_project_key_orders_edits_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyOrdersEditsRequestBuilder: + _client: "BaseClient" _project_key: str @@ -118,7 +119,11 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["OrderEdit"]: - """You can either create multiple Order Edits for an Order and apply them sequentially to an Order, or create multiple Order Edits parallelly (as alternatives to each other) and apply one of them to the Order.""" + """You can either create multiple Order Edits for an Order and apply them sequentially to an Order, or create multiple Order Edits parallelly (as alternatives to each other) and apply one of them to the Order. + + You can only create an Order Edit if the [InventoryMode](/projects/carts#inventorymode) of the Order and its [LineItems](/projects/carts#lineitem) is `None`. + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/orders/edits", diff --git a/src/commercetools/platform/client/email_token/by_project_key_customers_email_token_request_builder.py b/src/commercetools/platform/client/email_token/by_project_key_customers_email_token_request_builder.py index edf26822..36aa0308 100644 --- a/src/commercetools/platform/client/email_token/by_project_key_customers_email_token_request_builder.py +++ b/src/commercetools/platform/client/email_token/by_project_key_customers_email_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersEmailTokenRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/email_token/by_project_key_in_store_key_by_store_key_customers_email_token_request_builder.py b/src/commercetools/platform/client/email_token/by_project_key_in_store_key_by_store_key_customers_email_token_request_builder.py index 123ce75a..dc188cc6 100644 --- a/src/commercetools/platform/client/email_token/by_project_key_in_store_key_by_store_key_customers_email_token_request_builder.py +++ b/src/commercetools/platform/client/email_token/by_project_key_in_store_key_by_store_key_customers_email_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersEmailTokenRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/extensions/by_project_key_extensions_by_id_request_builder.py b/src/commercetools/platform/client/extensions/by_project_key_extensions_by_id_request_builder.py index e0b8be29..32d0328f 100644 --- a/src/commercetools/platform/client/extensions/by_project_key_extensions_by_id_request_builder.py +++ b/src/commercetools/platform/client/extensions/by_project_key_extensions_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyExtensionsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/extensions/by_project_key_extensions_key_by_key_request_builder.py b/src/commercetools/platform/client/extensions/by_project_key_extensions_key_by_key_request_builder.py index d3904365..84b82582 100644 --- a/src/commercetools/platform/client/extensions/by_project_key_extensions_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/extensions/by_project_key_extensions_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyExtensionsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/extensions/by_project_key_extensions_request_builder.py b/src/commercetools/platform/client/extensions/by_project_key_extensions_request_builder.py index 2cad6812..463000c8 100644 --- a/src/commercetools/platform/client/extensions/by_project_key_extensions_request_builder.py +++ b/src/commercetools/platform/client/extensions/by_project_key_extensions_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyExtensionsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/graphql/by_project_key_graphql_request_builder.py b/src/commercetools/platform/client/graphql/by_project_key_graphql_request_builder.py index 06e2cad4..a46d229f 100644 --- a/src/commercetools/platform/client/graphql/by_project_key_graphql_request_builder.py +++ b/src/commercetools/platform/client/graphql/by_project_key_graphql_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyGraphqlRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/health/by_project_key_subscriptions_by_id_health_request_builder.py b/src/commercetools/platform/client/health/by_project_key_subscriptions_by_id_health_request_builder.py index cb0158d0..a247cc90 100644 --- a/src/commercetools/platform/client/health/by_project_key_subscriptions_by_id_health_request_builder.py +++ b/src/commercetools/platform/client/health/by_project_key_subscriptions_by_id_health_request_builder.py @@ -12,6 +12,7 @@ class ByProjectKeySubscriptionsByIDHealthRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/ml/client/project_categories/by_project_key_recommendations_project_categories_by_product_id_request_builder.py b/src/commercetools/platform/client/images/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_images_request_builder.py similarity index 50% rename from src/commercetools/ml/client/project_categories/by_project_key_recommendations_project_categories_by_product_id_request_builder.py rename to src/commercetools/platform/client/images/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_images_request_builder.py index ba64109b..0bd7f920 100644 --- a/src/commercetools/ml/client/project_categories/by_project_key_recommendations_project_categories_by_product_id_request_builder.py +++ b/src/commercetools/platform/client/images/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_images_request_builder.py @@ -7,56 +7,56 @@ import typing import warnings -from ...models.category_recommendations import ( - ProjectCategoryRecommendationPagedQueryResponse, -) +from ...models.product_tailoring import ProductTailoring if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyRecommendationsProjectCategoriesByProductIdRequestBuilder: +class ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesRequestBuilder: + _client: "BaseClient" _project_key: str + _store_key: str _product_id: str def __init__( self, project_key: str, + store_key: str, product_id: str, client: "BaseClient", ): self._project_key = project_key + self._store_key = store_key self._product_id = product_id self._client = client - def get( + def post( self, + body: typing.BinaryIO, *, - limit: int = None, - offset: int = None, + filename: str = None, + variant: int = None, + sku: str = None, staged: bool = None, - confidence_min: float = None, - confidence_max: float = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, - ) -> "ProjectCategoryRecommendationPagedQueryResponse": - """Response Representation: PagedQueryResult with a results array of ProjectCategoryrecommendation, sorted by confidence scores in descending order and the meta information of ProjectCategoryrecommendationMeta.""" + ) -> "ProductTailoring": + """Upload a JPEG, PNG and GIF file to a [ProductTailoringVariant](ctp:api:type:ProductTailoringVariant). The maximum file size of the image is 10MB. `variant` or `sku` is required to update a specific ProductVariant. Produces the [ProductTailoringImageAdded](/projects/messages#product-tailoring-image-added) Message when the `Small` version of the image has been uploaded to the CDN.""" headers = {} if headers is None else headers - response = self._client._get( - endpoint=f"/{self._project_key}/recommendations/project-categories/{self._product_id}", + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/{self._product_id}/product-tailoring/images", params={ - "limit": limit, - "offset": offset, + "filename": filename, + "variant": variant, + "sku": sku, "staged": staged, - "confidenceMin": confidence_min, - "confidenceMax": confidence_max, }, + data=body.read(), headers=headers, options=options, ) if response.status_code == 200: - return ProjectCategoryRecommendationPagedQueryResponse.deserialize( - response.json() - ) + return ProductTailoring.deserialize(response.json()) warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/images/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_images_request_builder.py b/src/commercetools/platform/client/images/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_images_request_builder.py new file mode 100644 index 00000000..408c4f58 --- /dev/null +++ b/src/commercetools/platform/client/images/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_images_request_builder.py @@ -0,0 +1,62 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.product_tailoring import ProductTailoring + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _product_key: str + + def __init__( + self, + project_key: str, + store_key: str, + product_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._product_key = product_key + self._client = client + + def post( + self, + body: typing.BinaryIO, + *, + filename: str = None, + variant: int = None, + sku: str = None, + staged: bool = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> "ProductTailoring": + """Upload a JPEG, PNG and GIF file to a [ProductTailoringVariant](ctp:api:type:ProductTailoringVariant). The maximum file size of the image is 10MB. `variant` or `sku` is required to update a specific ProductVariant. Produces the [ProductTailoringImageAdded](/projects/messages#product-tailoring-image-added) Message when the `Small` version of the image has been uploaded to the CDN.""" + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/key={self._product_key}/product-tailoring/images", + params={ + "filename": filename, + "variant": variant, + "sku": sku, + "staged": staged, + }, + data=body.read(), + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/images/by_project_key_products_by_id_images_request_builder.py b/src/commercetools/platform/client/images/by_project_key_products_by_id_images_request_builder.py index 5cf71bae..84851cd6 100644 --- a/src/commercetools/platform/client/images/by_project_key_products_by_id_images_request_builder.py +++ b/src/commercetools/platform/client/images/by_project_key_products_by_id_images_request_builder.py @@ -14,6 +14,7 @@ class ByProjectKeyProductsByIDImagesRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/import_/by_project_key_orders_import_request_builder.py b/src/commercetools/platform/client/import_/by_project_key_orders_import_request_builder.py index 38233233..b0e8fcb3 100644 --- a/src/commercetools/platform/client/import_/by_project_key_orders_import_request_builder.py +++ b/src/commercetools/platform/client/import_/by_project_key_orders_import_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersImportRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/in_business_unit/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_request_builder.py b/src/commercetools/platform/client/in_business_unit/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_request_builder.py index d7be9cf5..4ab83d2f 100644 --- a/src/commercetools/platform/client/in_business_unit/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_request_builder.py +++ b/src/commercetools/platform/client/in_business_unit/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_request_builder.py @@ -31,6 +31,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/in_business_unit/by_project_key_in_business_unit_key_by_business_unit_key_request_builder.py b/src/commercetools/platform/client/in_business_unit/by_project_key_in_business_unit_key_by_business_unit_key_request_builder.py index 57de9713..8c6d40a7 100644 --- a/src/commercetools/platform/client/in_business_unit/by_project_key_in_business_unit_key_by_business_unit_key_request_builder.py +++ b/src/commercetools/platform/client/in_business_unit/by_project_key_in_business_unit_key_by_business_unit_key_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyRequestBuilder: + _client: "BaseClient" _project_key: str _business_unit_key: str diff --git a/src/commercetools/platform/client/in_store/by_project_key_in_store_key_by_store_key_request_builder.py b/src/commercetools/platform/client/in_store/by_project_key_in_store_key_by_store_key_request_builder.py index 8a2d6133..d20f76b9 100644 --- a/src/commercetools/platform/client/in_store/by_project_key_in_store_key_by_store_key_request_builder.py +++ b/src/commercetools/platform/client/in_store/by_project_key_in_store_key_by_store_key_request_builder.py @@ -31,18 +31,34 @@ from ..product_selection_assignments.by_project_key_in_store_key_by_store_key_product_selection_assignments_request_builder import ( ByProjectKeyInStoreKeyByStoreKeyProductSelectionAssignmentsRequestBuilder, ) +from ..product_tailoring.by_project_key_in_store_key_by_store_key_product_tailoring_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductTailoringRequestBuilder, +) +from ..products.by_project_key_in_store_key_by_store_key_products_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductsRequestBuilder, +) +from ..quote_requests.by_project_key_in_store_key_by_store_key_quote_requests_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsRequestBuilder, +) +from ..quotes.by_project_key_in_store_key_by_store_key_quotes_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyQuotesRequestBuilder, +) from ..shipping_methods.by_project_key_in_store_key_by_store_key_shipping_methods_request_builder import ( ByProjectKeyInStoreKeyByStoreKeyShippingMethodsRequestBuilder, ) from ..shopping_lists.by_project_key_in_store_key_by_store_key_shopping_lists_request_builder import ( ByProjectKeyInStoreKeyByStoreKeyShoppingListsRequestBuilder, ) +from ..staged_quotes.by_project_key_in_store_key_by_store_key_staged_quotes_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyStagedQuotesRequestBuilder, +) if typing.TYPE_CHECKING: from ...base_client import BaseClient class ByProjectKeyInStoreKeyByStoreKeyRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -146,3 +162,48 @@ def cart_discounts( store_key=self._store_key, client=self._client, ) + + def product_tailoring( + self, + ) -> ByProjectKeyInStoreKeyByStoreKeyProductTailoringRequestBuilder: + """A Product Tailoring holds tailored data of Product in the Store.""" + return ByProjectKeyInStoreKeyByStoreKeyProductTailoringRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def products(self) -> ByProjectKeyInStoreKeyByStoreKeyProductsRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyProductsRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def quote_requests( + self, + ) -> ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsRequestBuilder: + """A request for a Quote holds product variants and can be ordered.""" + return ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def staged_quotes( + self, + ) -> ByProjectKeyInStoreKeyByStoreKeyStagedQuotesRequestBuilder: + """A staged quote holds the negotiation between the [Buyer](/../api/quotes-overview#buyer) and the [Seller](/../api/quotes-overview#seller).""" + return ByProjectKeyInStoreKeyByStoreKeyStagedQuotesRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def quotes(self) -> ByProjectKeyInStoreKeyByStoreKeyQuotesRequestBuilder: + """A quote holds the negotiated offer.""" + return ByProjectKeyInStoreKeyByStoreKeyQuotesRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) diff --git a/src/commercetools/ml/client/images/__init__.py b/src/commercetools/platform/client/indexing_status/__init__.py similarity index 100% rename from src/commercetools/ml/client/images/__init__.py rename to src/commercetools/platform/client/indexing_status/__init__.py diff --git a/src/commercetools/ml/client/status/by_project_key_missing_data_prices_status_by_task_id_request_builder.py b/src/commercetools/platform/client/indexing_status/by_project_key_customers_search_indexing_status_request_builder.py similarity index 61% rename from src/commercetools/ml/client/status/by_project_key_missing_data_prices_status_by_task_id_request_builder.py rename to src/commercetools/platform/client/indexing_status/by_project_key_customers_search_indexing_status_request_builder.py index 25be1df5..622e8452 100644 --- a/src/commercetools/ml/client/status/by_project_key_missing_data_prices_status_by_task_id_request_builder.py +++ b/src/commercetools/platform/client/indexing_status/by_project_key_customers_search_indexing_status_request_builder.py @@ -7,25 +7,24 @@ import typing import warnings -from ...models.missing_data import MissingPricesTaskStatus +from ...models.customer_search import CustomerSearchIndexingStatusResponse +from ...models.error import ErrorResponse if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyMissingDataPricesStatusByTaskIdRequestBuilder: +class ByProjectKeyCustomersSearchIndexingStatusRequestBuilder: + _client: "BaseClient" _project_key: str - _task_id: str def __init__( self, project_key: str, - task_id: str, client: "BaseClient", ): self._project_key = project_key - self._task_id = task_id self._client = client def get( @@ -33,14 +32,19 @@ def get( *, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, - ) -> "MissingPricesTaskStatus": + ) -> typing.Optional["CustomerSearchIndexingStatusResponse"]: headers = {} if headers is None else headers response = self._client._get( - endpoint=f"/{self._project_key}/missing-data/prices/status/{self._task_id}", + endpoint=f"/{self._project_key}/customers/search/indexing-status", params={}, headers=headers, options=options, ) if response.status_code == 200: - return MissingPricesTaskStatus.deserialize(response.json()) + return CustomerSearchIndexingStatusResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/inventory/by_project_key_inventory_by_id_request_builder.py b/src/commercetools/platform/client/inventory/by_project_key_inventory_by_id_request_builder.py index 14dfd65c..70606749 100644 --- a/src/commercetools/platform/client/inventory/by_project_key_inventory_by_id_request_builder.py +++ b/src/commercetools/platform/client/inventory/by_project_key_inventory_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInventoryByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/inventory/by_project_key_inventory_key_by_key_request_builder.py b/src/commercetools/platform/client/inventory/by_project_key_inventory_key_by_key_request_builder.py index f7e515b6..be75eb69 100644 --- a/src/commercetools/platform/client/inventory/by_project_key_inventory_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/inventory/by_project_key_inventory_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInventoryKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/inventory/by_project_key_inventory_request_builder.py b/src/commercetools/platform/client/inventory/by_project_key_inventory_request_builder.py index 2d22c15d..5734ca9f 100644 --- a/src/commercetools/platform/client/inventory/by_project_key_inventory_request_builder.py +++ b/src/commercetools/platform/client/inventory/by_project_key_inventory_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyInventoryRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_login_request_builder.py b/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_login_request_builder.py index e32e4786..963104c2 100644 --- a/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_login_request_builder.py +++ b/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_login_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyLoginRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -38,6 +39,10 @@ def post( ) -> typing.Optional["CustomerSignInResult"]: """Authenticates a Customer associated with a [Store](ctp:api:type:Store). For more information, see [Global versus Store-specific Customers](/../api/customers-overview#global-versus-store-specific-customers). + A Cart returned in the [CustomerSignInResult](ctp:api:type:CustomerSignInResult) has any invalid Line Items removed and is [updated](/api/carts-orders-overview#cart-updates) with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). + + Triggers [Cart merge during sign-in](/../api/customers-overview#cart-merge-during-sign-in). + If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), this method returns an [InvalidCredentials](ctp:api:type:InvalidCredentialsError) error. """ diff --git a/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_me_login_request_builder.py b/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_me_login_request_builder.py index 27dfb7be..5f9b80d7 100644 --- a/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_me_login_request_builder.py +++ b/src/commercetools/platform/client/login/by_project_key_in_store_key_by_store_key_me_login_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeLoginRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -41,7 +42,7 @@ def post( - If the Customer does not have a Cart, the most recently modified anonymous cart becomes the Customer's Cart. - If the Customer already has a Cart, the most recently modified anonymous cart is handled according to [AnonymousCartSignInMode](ctp:api:type:AnonymousCartSignInMode). - If a Cart is returned as part of [CustomerSignInResult](ctp:api:type:CustomerSignInResult), it has been [recalculated](ctp:api:type:MyCartRecalculateAction) with up-to-date prices, taxes, discounts, and invalid line items removed. + A Cart returned in the [CustomerSignInResult](ctp:api:type:CustomerSignInResult) has any invalid Line Items removed and is [updated](/api/carts-orders-overview#cart-updates) with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). If an account with the given credentials is not found, an [InvalidCredentials](ctp:api:type:InvalidCredentialsError) error is returned. diff --git a/src/commercetools/platform/client/login/by_project_key_login_request_builder.py b/src/commercetools/platform/client/login/by_project_key_login_request_builder.py index 3ea5c89f..43042a21 100644 --- a/src/commercetools/platform/client/login/by_project_key_login_request_builder.py +++ b/src/commercetools/platform/client/login/by_project_key_login_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyLoginRequestBuilder: + _client: "BaseClient" _project_key: str @@ -35,7 +36,11 @@ def post( ) -> typing.Optional["CustomerSignInResult"]: """Authenticates a global Customer not associated with a Store. For more information, see [Global versus Store-specific Customers](/../api/customers-overview#global-versus-store-specific-customers). - If the Customer is registered in a Store, use the [Authenticate (sign in) Customer in Store](/../api/projects/customers#authenticate-sign-in-customer-in-store) method. + If the Customer is registered in a Store, use the [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/login:POST) method. + + Triggers [Cart merge during sign-in](/../api/customers-overview#cart-merge-during-sign-in). + + A Cart returned in the [CustomerSignInResult](ctp:api:type:CustomerSignInResult) has any invalid Line Items removed and is [updated](/api/carts-orders-overview#cart-updates) with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). If an account with the given credentials is not found, an [InvalidCredentials](ctp:api:type:InvalidCredentialsError) error is returned. diff --git a/src/commercetools/platform/client/login/by_project_key_me_login_request_builder.py b/src/commercetools/platform/client/login/by_project_key_me_login_request_builder.py index 5db651d0..2cd73174 100644 --- a/src/commercetools/platform/client/login/by_project_key_me_login_request_builder.py +++ b/src/commercetools/platform/client/login/by_project_key_me_login_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyMeLoginRequestBuilder: + _client: "BaseClient" _project_key: str @@ -40,7 +41,7 @@ def post( - If the Customer does not have a Cart yet, the most recently modified anonymous cart becomes the Customer's Cart. - If the Customer already has a Cart, the most recently modified anonymous cart is handled in accordance with [AnonymousCartSignInMode](ctp:api:type:AnonymousCartSignInMode). - A Cart returned as part of the [CustomerSignInResult](ctp:api:type:CustomerSignInResult) is [recalculated](ctp:api:type:MyCartRecalculateAction) with up-to-date prices, taxes, discounts, and invalid line items removed. + A Cart returned in the [CustomerSignInResult](ctp:api:type:CustomerSignInResult) has any invalid Line Items removed and is [updated](/api/carts-orders-overview#cart-updates) with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). If an account with the given credentials is not found, an [InvalidCredentials](ctp:api:type:InvalidCredentialsError) error is returned. diff --git a/src/commercetools/platform/client/matching/by_project_key_product_discounts_matching_request_builder.py b/src/commercetools/platform/client/matching/by_project_key_product_discounts_matching_request_builder.py index 1e6d1e7e..444055f9 100644 --- a/src/commercetools/platform/client/matching/by_project_key_product_discounts_matching_request_builder.py +++ b/src/commercetools/platform/client/matching/by_project_key_product_discounts_matching_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductDiscountsMatchingRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/matching_cart/by_project_key_in_store_key_by_store_key_shipping_methods_matching_cart_request_builder.py b/src/commercetools/platform/client/matching_cart/by_project_key_in_store_key_by_store_key_shipping_methods_matching_cart_request_builder.py index fee6c5ba..79c4999b 100644 --- a/src/commercetools/platform/client/matching_cart/by_project_key_in_store_key_by_store_key_shipping_methods_matching_cart_request_builder.py +++ b/src/commercetools/platform/client/matching_cart/by_project_key_in_store_key_by_store_key_shipping_methods_matching_cart_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyShippingMethodsMatchingCartRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -37,7 +38,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ShippingMethodPagedQueryResponse"]: - """Retrieves all the ShippingMethods that can ship to the shipping address of the given Cart in a given [Store](ctp:api:type:Store). + """Retrieves all the active ShippingMethods that can ship to the shipping address of the given Cart in a given [Store](ctp:api:type:Store). Each ShippingMethod contains exactly one ShippingRate with the flag `isMatching` set to `true`. This ShippingRate is used when the ShippingMethod is [added to the Cart](ctp:api:type:CartSetShippingMethodAction). @@ -65,7 +66,7 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a ShippingMethod that can ship to the shipping address of the given Cart exists in the given [Store](ctp:api:type:Store). Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" + """Checks if an active ShippingMethod that can ship to the shipping address of the given Cart exists in the given [Store](ctp:api:type:Store). Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/in-store/key={self._store_key}/shipping-methods/matching-cart", diff --git a/src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py b/src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py index 1f8f942b..5a5e14b6 100644 --- a/src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py +++ b/src/commercetools/platform/client/matching_cart/by_project_key_shipping_methods_matching_cart_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShippingMethodsMatchingCartRequestBuilder: + _client: "BaseClient" _project_key: str @@ -34,7 +35,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ShippingMethodPagedQueryResponse"]: - """Retrieves all the ShippingMethods that can ship to the shipping address of the given Cart. + """Retrieves all the active ShippingMethods that can ship to the shipping address of the given Cart. Each ShippingMethod contains exactly one ShippingRate with the flag `isMatching` set to `true`. This ShippingRate is used when the ShippingMethod is [added to the Cart](ctp:api:type:CartSetShippingMethodAction). @@ -62,7 +63,7 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a ShippingMethod exists for the given Cart. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" + """Checks if an active ShippingMethod exists for the given Cart. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/shipping-methods/matching-cart", diff --git a/src/commercetools/platform/client/matching_cart_location/by_project_key_shipping_methods_matching_cart_location_request_builder.py b/src/commercetools/platform/client/matching_cart_location/by_project_key_shipping_methods_matching_cart_location_request_builder.py index dd440715..1e9f40cb 100644 --- a/src/commercetools/platform/client/matching_cart_location/by_project_key_shipping_methods_matching_cart_location_request_builder.py +++ b/src/commercetools/platform/client/matching_cart_location/by_project_key_shipping_methods_matching_cart_location_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShippingMethodsMatchingCartLocationRequestBuilder: + _client: "BaseClient" _project_key: str @@ -36,7 +37,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ShippingMethodPagedQueryResponse"]: - """Retrieves all the ShippingMethods that can ship to the given [Location](/projects/zones#location) + """Retrieves all the active ShippingMethods that can ship to the given [Location](ctp:api:type:Location) with a `predicate` that matches the given Cart. Each ShippingMethod contains exactly one ShippingRate with the flag `isMatching` set to `true`. This ShippingRate is used when the ShippingMethod is [added to the Cart](ctp:api:type:CartSetShippingMethodAction). @@ -72,7 +73,7 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a ShippingMethod that can ship to the given [Location](ctp:api:type:Location) exists for the given Cart. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" + """Checks if an active ShippingMethod that can ship to the given [Location](ctp:api:type:Location) exists for the given Cart. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/shipping-methods/matching-cart-location", diff --git a/src/commercetools/platform/client/matching_location/by_project_key_shipping_methods_matching_location_request_builder.py b/src/commercetools/platform/client/matching_location/by_project_key_shipping_methods_matching_location_request_builder.py index 63fa8a63..22517847 100644 --- a/src/commercetools/platform/client/matching_location/by_project_key_shipping_methods_matching_location_request_builder.py +++ b/src/commercetools/platform/client/matching_location/by_project_key_shipping_methods_matching_location_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShippingMethodsMatchingLocationRequestBuilder: + _client: "BaseClient" _project_key: str @@ -37,7 +38,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ShippingMethodPagedQueryResponse"]: - """Retrieves all the ShippingMethods that can ship to the given [Location](/projects/zones#location). + """Retrieves all the active ShippingMethods that can ship to the given [Location](/projects/zones#location). ShippingMethods that have a `predicate` defined are automatically disqualified. If the `currency` parameter is given, then the ShippingMethods must also have a rate defined in the specified currency. Each ShippingMethod contains at least one ShippingRate with the flag `isMatching` set to `true`. @@ -75,7 +76,7 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a ShippingMethod that can ship to the given [Location](ctp:api:type:Location) exists. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" + """Checks if an active ShippingMethod that can ship to the given [Location](ctp:api:type:Location) exists. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/shipping-methods/matching-location", diff --git a/src/commercetools/platform/client/matching_orderedit/by_project_key_shipping_methods_matching_orderedit_request_builder.py b/src/commercetools/platform/client/matching_orderedit/by_project_key_shipping_methods_matching_orderedit_request_builder.py index e34e5f98..14f23864 100644 --- a/src/commercetools/platform/client/matching_orderedit/by_project_key_shipping_methods_matching_orderedit_request_builder.py +++ b/src/commercetools/platform/client/matching_orderedit/by_project_key_shipping_methods_matching_orderedit_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShippingMethodsMatchingOrdereditRequestBuilder: + _client: "BaseClient" _project_key: str @@ -35,7 +36,7 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ShippingMethodPagedQueryResponse"]: - """Retrieves all the ShippingMethods that can ship to the given [Location](/../api/projects/zones#location) for an [OrderEdit](/../api/projects/order-edits). + """Retrieves all the active ShippingMethods that can ship to the given [Location](ctp:api:type:Location) for an [OrderEdit](ctp:api:type:OrderEdit). If the OrderEdit preview cannot be generated, an [EditPreviewFailed](ctp:api:type:EditPreviewFailedError) error is returned. @@ -65,7 +66,7 @@ def head( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional[None]: - """Checks if a ShippingMethod that can ship to the given [Location](ctp:api:type:Location) exists for the given [OrderEdit](ctp:api:type:OrderEdit). Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" + """Checks if an active ShippingMethod that can ship to the given [Location](ctp:api:type:Location) exists for the given [OrderEdit](ctp:api:type:OrderEdit). Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.""" headers = {} if headers is None else headers response = self._client._head( endpoint=f"/{self._project_key}/shipping-methods/matching-orderedit", diff --git a/src/commercetools/platform/client/me/by_project_key_in_business_unit_key_by_business_unit_key_me_request_builder.py b/src/commercetools/platform/client/me/by_project_key_in_business_unit_key_by_business_unit_key_me_request_builder.py index fd568ee6..3fc09441 100644 --- a/src/commercetools/platform/client/me/by_project_key_in_business_unit_key_by_business_unit_key_me_request_builder.py +++ b/src/commercetools/platform/client/me/by_project_key_in_business_unit_key_by_business_unit_key_me_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeRequestBuilder: + _client: "BaseClient" _project_key: str _business_unit_key: str diff --git a/src/commercetools/platform/client/me/by_project_key_in_store_key_by_store_key_me_request_builder.py b/src/commercetools/platform/client/me/by_project_key_in_store_key_by_store_key_me_request_builder.py index e142478a..c2e32f80 100644 --- a/src/commercetools/platform/client/me/by_project_key_in_store_key_by_store_key_me_request_builder.py +++ b/src/commercetools/platform/client/me/by_project_key_in_store_key_by_store_key_me_request_builder.py @@ -40,6 +40,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/me/by_project_key_me_request_builder.py b/src/commercetools/platform/client/me/by_project_key_me_request_builder.py index 3cd0fe60..183a4d00 100644 --- a/src/commercetools/platform/client/me/by_project_key_me_request_builder.py +++ b/src/commercetools/platform/client/me/by_project_key_me_request_builder.py @@ -52,6 +52,7 @@ class ByProjectKeyMeRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/messages/by_project_key_messages_by_id_request_builder.py b/src/commercetools/platform/client/messages/by_project_key_messages_by_id_request_builder.py index 43c9fb88..ae20a8d9 100644 --- a/src/commercetools/platform/client/messages/by_project_key_messages_by_id_request_builder.py +++ b/src/commercetools/platform/client/messages/by_project_key_messages_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyMessagesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/messages/by_project_key_messages_request_builder.py b/src/commercetools/platform/client/messages/by_project_key_messages_request_builder.py index 42abb5f0..c0f23f74 100644 --- a/src/commercetools/platform/client/messages/by_project_key_messages_request_builder.py +++ b/src/commercetools/platform/client/messages/by_project_key_messages_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyMessagesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_by_id_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_by_id_request_builder.py index 296caed1..ab944b29 100644 --- a/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_by_id_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersByIDRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_order_number_by_order_number_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_order_number_by_order_number_request_builder.py index 9bd81b62..df3ee3fd 100644 --- a/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_order_number_by_order_number_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_order_number_by_order_number_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersOrderNumberByOrderNumberRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_request_builder.py index 6f658b0b..30ba5aad 100644 --- a/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_request_builder.py @@ -24,6 +24,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str @@ -149,6 +150,16 @@ def post( The Cart must have a shipping address set before creating an Order. Creating an Order fails with an [InvalidOperation](ctp:api:type:InvalidOperationError) if the Cart does not reference the same BusinessUnit as the `businessUnitKey` path parameter. + Specific Error Codes: + + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [OutOfStock](ctp:api:type:OutOfStockError) + - [PriceChanged](ctp:api:type:PriceChangedError) + - [ShippingMethodDoesNotMatchCart](ctp:api:type:ShippingMethodDoesNotMatchCartError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) + """ headers = {} if headers is None else headers response = self._client._post( diff --git a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_by_id_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_by_id_request_builder.py index 3e787b40..03b2c8da 100644 --- a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_by_id_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeOrdersByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_request_builder.py index 87ad3841..69f87773 100644 --- a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_me_orders_request_builder.py @@ -19,6 +19,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeOrdersRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -121,11 +122,15 @@ def post( Specific Error Codes: + - [AssociateMissingPermission](ctp:api:type:AssociateMissingPermissionError) + - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) - [OutOfStock](ctp:api:type:OutOfStockError) - [PriceChanged](ctp:api:type:PriceChangedError) - - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) - - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) - - [AssociateMissingPermission](ctp:api:type:AssociateMissingPermissionError) + - [ShippingMethodDoesNotMatchCart](ctp:api:type:ShippingMethodDoesNotMatchCartError) """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_by_id_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_by_id_request_builder.py index 6a154341..6e4299ec 100644 --- a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_by_id_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyOrdersByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_order_number_by_order_number_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_order_number_by_order_number_request_builder.py index 5e871902..a728901c 100644 --- a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_order_number_by_order_number_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_order_number_by_order_number_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyOrdersOrderNumberByOrderNumberRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_request_builder.py index 6cfe2a49..c0c3659b 100644 --- a/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_in_store_key_by_store_key_orders_request_builder.py @@ -9,6 +9,9 @@ from ...models.error import ErrorResponse from ...models.order import Order, OrderFromCartDraft, OrderPagedQueryResponse +from ..quotes.by_project_key_in_store_key_by_store_key_orders_quotes_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyOrdersQuotesRequestBuilder, +) from .by_project_key_in_store_key_by_store_key_orders_by_id_request_builder import ( ByProjectKeyInStoreKeyByStoreKeyOrdersByIDRequestBuilder, ) @@ -21,6 +24,7 @@ class ByProjectKeyInStoreKeyByStoreKeyOrdersRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -35,6 +39,13 @@ def __init__( self._store_key = store_key self._client = client + def order_quote(self) -> ByProjectKeyInStoreKeyByStoreKeyOrdersQuotesRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyOrdersQuotesRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + def with_order_number( self, order_number: str ) -> ByProjectKeyInStoreKeyByStoreKeyOrdersOrderNumberByOrderNumberRequestBuilder: @@ -131,6 +142,8 @@ def post( The shipping address is used for tax calculation for a Cart with `Platform` [TaxMode](ctp:api:type:TaxMode). Creating an Order produces the [OrderCreated](ctp:api:type:OrderCreatedMessage) Message. + If a server-side problem occurs, indicated by a 500 Internal Server Error HTTP response, the Order creation may still successfully complete after the error is returned. + If you receive this error, you should verify the status of the Order by querying a unique identifier supplied during the creation request, such as the Order number. Specific Error Codes: @@ -139,6 +152,7 @@ def post( - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) - [ShippingMethodDoesNotMatchCart](ctp:api:type:ShippingMethodDoesNotMatchCartError) - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [InvalidOperation](ctp:api:type:InvalidOperationError) - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) diff --git a/src/commercetools/platform/client/orders/by_project_key_me_orders_by_id_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_me_orders_by_id_request_builder.py index adac4b6d..8bcffafe 100644 --- a/src/commercetools/platform/client/orders/by_project_key_me_orders_by_id_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_me_orders_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyMeOrdersByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/orders/by_project_key_me_orders_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_me_orders_request_builder.py index a67cd05a..d6442d03 100644 --- a/src/commercetools/platform/client/orders/by_project_key_me_orders_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_me_orders_request_builder.py @@ -22,6 +22,7 @@ class ByProjectKeyMeOrdersRequestBuilder: + _client: "BaseClient" _project_key: str @@ -122,12 +123,19 @@ def post( Creating an Order produces the [OrderCreated](ctp:api:type:OrderCreatedMessage) Message. + If a server-side problem occurs, indicated by a 500 Internal Server Error HTTP response, the Order creation may still successfully complete after the error is returned. + If you receive this error, you should verify the status of the Order by querying a unique identifier supplied during the creation request, such as the Order number. + Specific Error Codes: + - [AssociateMissingPermission](ctp:api:type:AssociateMissingPermissionError) + - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) - [OutOfStock](ctp:api:type:OutOfStockError) - [PriceChanged](ctp:api:type:PriceChangedError) - - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) - - [AssociateMissingPermission](ctp:api:type:AssociateMissingPermissionError) + - [ShippingMethodDoesNotMatchCart](ctp:api:type:ShippingMethodDoesNotMatchCartError) + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/orders/by_project_key_orders_by_id_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_orders_by_id_request_builder.py index 70990bfa..403ea67b 100644 --- a/src/commercetools/platform/client/orders/by_project_key_orders_by_id_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_orders_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/orders/by_project_key_orders_order_number_by_order_number_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_orders_order_number_by_order_number_request_builder.py index a2dd85a4..588dd19a 100644 --- a/src/commercetools/platform/client/orders/by_project_key_orders_order_number_by_order_number_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_orders_order_number_by_order_number_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersOrderNumberByOrderNumberRequestBuilder: + _client: "BaseClient" _project_key: str _order_number: str diff --git a/src/commercetools/platform/client/orders/by_project_key_orders_request_builder.py b/src/commercetools/platform/client/orders/by_project_key_orders_request_builder.py index 7193542b..364cbb40 100644 --- a/src/commercetools/platform/client/orders/by_project_key_orders_request_builder.py +++ b/src/commercetools/platform/client/orders/by_project_key_orders_request_builder.py @@ -33,6 +33,7 @@ class ByProjectKeyOrdersRequestBuilder: + _client: "BaseClient" _project_key: str @@ -163,6 +164,9 @@ def post( Creating an Order produces the [OrderCreated](ctp:api:type:OrderCreatedMessage) Message. + If a server-side problem occurs, indicated by a 500 Internal Server Error HTTP response, the Order creation may still successfully complete after the error is returned. + If you receive this error, you should verify the status of the Order by querying a unique identifier supplied during the creation request, such as the Order number. + Specific Error Codes: - [OutOfStock](ctp:api:type:OutOfStockError) @@ -170,6 +174,7 @@ def post( - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) - [ShippingMethodDoesNotMatchCart](ctp:api:type:ShippingMethodDoesNotMatchCartError) - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [InvalidOperation](ctp:api:type:InvalidOperationError) - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) diff --git a/src/commercetools/platform/client/password/by_project_key_customers_password_request_builder.py b/src/commercetools/platform/client/password/by_project_key_customers_password_request_builder.py index b83437d4..44673f7f 100644 --- a/src/commercetools/platform/client/password/by_project_key_customers_password_request_builder.py +++ b/src/commercetools/platform/client/password/by_project_key_customers_password_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersPasswordRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_customers_password_request_builder.py b/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_customers_password_request_builder.py index 3fa77506..e0ad4e41 100644 --- a/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_customers_password_request_builder.py +++ b/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_customers_password_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersPasswordRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_me_password_request_builder.py b/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_me_password_request_builder.py index 42fe7b68..8f2908c5 100644 --- a/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_me_password_request_builder.py +++ b/src/commercetools/platform/client/password/by_project_key_in_store_key_by_store_key_me_password_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMePasswordRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/password/by_project_key_me_password_request_builder.py b/src/commercetools/platform/client/password/by_project_key_me_password_request_builder.py index 6317794e..9fd77a7e 100644 --- a/src/commercetools/platform/client/password/by_project_key_me_password_request_builder.py +++ b/src/commercetools/platform/client/password/by_project_key_me_password_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyMePasswordRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/password_token/by_project_key_customers_password_token_request_builder.py b/src/commercetools/platform/client/password_token/by_project_key_customers_password_token_request_builder.py index dce267db..a8105017 100644 --- a/src/commercetools/platform/client/password_token/by_project_key_customers_password_token_request_builder.py +++ b/src/commercetools/platform/client/password_token/by_project_key_customers_password_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersPasswordTokenRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/password_token/by_project_key_in_store_key_by_store_key_customers_password_token_request_builder.py b/src/commercetools/platform/client/password_token/by_project_key_in_store_key_by_store_key_customers_password_token_request_builder.py index c9e14408..6172fb11 100644 --- a/src/commercetools/platform/client/password_token/by_project_key_in_store_key_by_store_key_customers_password_token_request_builder.py +++ b/src/commercetools/platform/client/password_token/by_project_key_in_store_key_by_store_key_customers_password_token_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersPasswordTokenRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/payments/by_project_key_me_payments_by_id_request_builder.py b/src/commercetools/platform/client/payments/by_project_key_me_payments_by_id_request_builder.py index 1197e2cd..eed331b1 100644 --- a/src/commercetools/platform/client/payments/by_project_key_me_payments_by_id_request_builder.py +++ b/src/commercetools/platform/client/payments/by_project_key_me_payments_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyMePaymentsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/payments/by_project_key_me_payments_request_builder.py b/src/commercetools/platform/client/payments/by_project_key_me_payments_request_builder.py index a60b31d6..d87a02cc 100644 --- a/src/commercetools/platform/client/payments/by_project_key_me_payments_request_builder.py +++ b/src/commercetools/platform/client/payments/by_project_key_me_payments_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyMePaymentsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/payments/by_project_key_payments_by_id_request_builder.py b/src/commercetools/platform/client/payments/by_project_key_payments_by_id_request_builder.py index bf140f84..2eeb50e6 100644 --- a/src/commercetools/platform/client/payments/by_project_key_payments_by_id_request_builder.py +++ b/src/commercetools/platform/client/payments/by_project_key_payments_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyPaymentsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/payments/by_project_key_payments_key_by_key_request_builder.py b/src/commercetools/platform/client/payments/by_project_key_payments_key_by_key_request_builder.py index af26dd92..667fcca9 100644 --- a/src/commercetools/platform/client/payments/by_project_key_payments_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/payments/by_project_key_payments_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyPaymentsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/payments/by_project_key_payments_request_builder.py b/src/commercetools/platform/client/payments/by_project_key_payments_request_builder.py index 3b7baa2d..7ad65424 100644 --- a/src/commercetools/platform/client/payments/by_project_key_payments_request_builder.py +++ b/src/commercetools/platform/client/payments/by_project_key_payments_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyPaymentsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_by_id_request_builder.py b/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_by_id_request_builder.py index a6ff0ff1..912ff026 100644 --- a/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_by_id_request_builder.py +++ b/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductDiscountsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_key_by_key_request_builder.py b/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_key_by_key_request_builder.py index c990bbd8..00a18d45 100644 --- a/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductDiscountsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_request_builder.py b/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_request_builder.py index c022d11b..77477396 100644 --- a/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_request_builder.py +++ b/src/commercetools/platform/client/product_discounts/by_project_key_product_discounts_request_builder.py @@ -28,6 +28,7 @@ class ByProjectKeyProductDiscountsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_by_id_request_builder.py b/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_by_id_request_builder.py index 323841f8..ad1d9334 100644 --- a/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_by_id_request_builder.py +++ b/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -45,11 +46,13 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ProductProjection"]: - """Gets the current or staged representation of a [Product](ctp:api:type:Product) by its ID from the specified [Store](ctp:api:type:Store). - If the Store has defined some languages, countries, distribution or supply Channels, - they are used for projections based on [locale](ctp:api:type:ProductProjectionLocales), [price](ctp:api:type:ProductProjectionPrices) + """Gets the current or staged representation of a [Product](ctp:api:type:Product) by its ID in the specified [Store](ctp:api:type:Store). + If the Store has defined some languages, countries, distribution, supply Channels, and/or Product Selection, + they are used for projections based on [locale](ctp:api:type:ProductProjectionLocales), [price](ctp:api:type:ProductProjectionPrices), and [inventory](ctp:api:type:ProductProjectionInventoryEntries). + If [ProductSelection](ctp:api:type:ProductSelection) is used, it affects the [availability of the Product](/projects/stores#products-available-in-store) in the specified Store. + When used with an API Client that has the `view_published_products:{projectKey}` scope, this endpoint only returns published (current) Product Projections. """ diff --git a/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_key_by_key_request_builder.py b/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_key_by_key_request_builder.py index 737e5241..22b5a47f 100644 --- a/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -45,11 +46,13 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ProductProjection"]: - """Gets the current or staged representation of a [Product](ctp:api:type:Product) by its key from the specified [Store](ctp:api:type:Store). - If the Store has defined some languages, countries, distribution or supply Channels, - they are used for projections based on [locale](ctp:api:type:ProductProjectionLocales), [price](ctp:api:type:ProductProjectionPrices) + """Gets the current or staged representation of a [Product](ctp:api:type:Product) by its key in the specified [Store](ctp:api:type:Store). + If the Store has defined some languages, countries, distribution, supply Channels, and/or Product Selection, + they are used for projections based on [locale](ctp:api:type:ProductProjectionLocales), [price](ctp:api:type:ProductProjectionPrices), and [inventory](ctp:api:type:ProductProjectionInventoryEntries). + If [ProductSelection](ctp:api:type:ProductSelection) is used, it affects the [availability of the Product](/projects/stores#products-available-in-store) in the specified Store. + When used with an API Client that has the `view_published_products:{projectKey}` scope, this endpoint only returns published (current) Product Projections. """ diff --git a/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_request_builder.py b/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_request_builder.py index 9e787d88..0bd7bc50 100644 --- a/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_request_builder.py +++ b/src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_request_builder.py @@ -19,6 +19,7 @@ class ByProjectKeyInStoreKeyByStoreKeyProductProjectionsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/product_projections/by_project_key_product_projections_by_id_request_builder.py b/src/commercetools/platform/client/product_projections/by_project_key_product_projections_by_id_request_builder.py index 1bfbe68f..778aee5e 100644 --- a/src/commercetools/platform/client/product_projections/by_project_key_product_projections_by_id_request_builder.py +++ b/src/commercetools/platform/client/product_projections/by_project_key_product_projections_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductProjectionsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/product_projections/by_project_key_product_projections_key_by_key_request_builder.py b/src/commercetools/platform/client/product_projections/by_project_key_product_projections_key_by_key_request_builder.py index ff0412ef..3ca847fb 100644 --- a/src/commercetools/platform/client/product_projections/by_project_key_product_projections_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/product_projections/by_project_key_product_projections_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductProjectionsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/product_projections/by_project_key_product_projections_request_builder.py b/src/commercetools/platform/client/product_projections/by_project_key_product_projections_request_builder.py index 84a7cac6..1dbbd286 100644 --- a/src/commercetools/platform/client/product_projections/by_project_key_product_projections_request_builder.py +++ b/src/commercetools/platform/client/product_projections/by_project_key_product_projections_request_builder.py @@ -27,6 +27,7 @@ class ByProjectKeyProductProjectionsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/product_selection_assignments/by_project_key_in_store_key_by_store_key_product_selection_assignments_request_builder.py b/src/commercetools/platform/client/product_selection_assignments/by_project_key_in_store_key_by_store_key_product_selection_assignments_request_builder.py index c3bb7211..583fcc69 100644 --- a/src/commercetools/platform/client/product_selection_assignments/by_project_key_in_store_key_by_store_key_product_selection_assignments_request_builder.py +++ b/src/commercetools/platform/client/product_selection_assignments/by_project_key_in_store_key_by_store_key_product_selection_assignments_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyProductSelectionAssignmentsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/product_selections/by_project_key_product_selections_by_id_request_builder.py b/src/commercetools/platform/client/product_selections/by_project_key_product_selections_by_id_request_builder.py index 6223aac6..0d123188 100644 --- a/src/commercetools/platform/client/product_selections/by_project_key_product_selections_by_id_request_builder.py +++ b/src/commercetools/platform/client/product_selections/by_project_key_product_selections_by_id_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyProductSelectionsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str @@ -118,7 +119,7 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ProductSelection"]: - """Deletion will only succeed if the Product Selection is not assigned to any [Store](/../api/projects/stores#store).""" + """Deletion will only succeed if the Product Selection is not assigned to any [Store](ctp:api:type:Store).""" headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/product-selections/{self._id}", diff --git a/src/commercetools/platform/client/product_selections/by_project_key_product_selections_key_by_key_request_builder.py b/src/commercetools/platform/client/product_selections/by_project_key_product_selections_key_by_key_request_builder.py index 84298f51..32778119 100644 --- a/src/commercetools/platform/client/product_selections/by_project_key_product_selections_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/product_selections/by_project_key_product_selections_key_by_key_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyProductSelectionsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str @@ -118,7 +119,7 @@ def delete( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ProductSelection"]: - """Deletion will only succeed if the Product Selection is not assigned to any [Store](/../api/projects/stores#store).""" + """Deletion will only succeed if the Product Selection is not assigned to any [Store](ctp:api:type:Store).""" headers = {} if headers is None else headers response = self._client._delete( endpoint=f"/{self._project_key}/product-selections/key={self._key}", diff --git a/src/commercetools/platform/client/product_selections/by_project_key_product_selections_request_builder.py b/src/commercetools/platform/client/product_selections/by_project_key_product_selections_request_builder.py index 55162743..2faa8a32 100644 --- a/src/commercetools/platform/client/product_selections/by_project_key_product_selections_request_builder.py +++ b/src/commercetools/platform/client/product_selections/by_project_key_product_selections_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyProductSelectionsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/product_selections/by_project_key_products_by_id_product_selections_request_builder.py b/src/commercetools/platform/client/product_selections/by_project_key_products_by_id_product_selections_request_builder.py index f70f6225..2457c681 100644 --- a/src/commercetools/platform/client/product_selections/by_project_key_products_by_id_product_selections_request_builder.py +++ b/src/commercetools/platform/client/product_selections/by_project_key_products_by_id_product_selections_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductsByIDProductSelectionsRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/product_selections/by_project_key_products_key_by_key_product_selections_request_builder.py b/src/commercetools/platform/client/product_selections/by_project_key_products_key_by_key_product_selections_request_builder.py index 72c568f3..c6216393 100644 --- a/src/commercetools/platform/client/product_selections/by_project_key_products_key_by_key_product_selections_request_builder.py +++ b/src/commercetools/platform/client/product_selections/by_project_key_products_key_by_key_product_selections_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductsKeyByKeyProductSelectionsRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/ml/client/missing_data/__init__.py b/src/commercetools/platform/client/product_tailoring/__init__.py similarity index 100% rename from src/commercetools/ml/client/missing_data/__init__.py rename to src/commercetools/platform/client/product_tailoring/__init__.py diff --git a/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_product_tailoring_request_builder.py b/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_product_tailoring_request_builder.py new file mode 100644 index 00000000..1464fa1f --- /dev/null +++ b/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_product_tailoring_request_builder.py @@ -0,0 +1,107 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.product_tailoring import ( + ProductTailoring, + ProductTailoringInStoreDraft, + ProductTailoringPagedQueryResponse, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyProductTailoringRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + + def __init__( + self, + project_key: str, + store_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._client = client + + def get( + self, + *, + limit: int = None, + offset: int = None, + with_total: bool = None, + expand: typing.List["str"] = None, + where: typing.List["str"] = None, + predicate_var: typing.Dict[str, typing.List["str"]] = None, + sort: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoringPagedQueryResponse"]: + """Queries Product Tailoring in a specific [Store](ctp:api:type:Store).""" + params = { + "limit": limit, + "offset": offset, + "withTotal": with_total, + "expand": expand, + "where": where, + "sort": sort, + } + predicate_var and params.update( + {f"var.{k}": v for k, v in predicate_var.items()} + ) + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/product-tailoring", + params=params, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoringPagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "ProductTailoringInStoreDraft", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Creates a [ProductTailoring](ctp:api:type:ProductTailoring) in the [Store](ctp:api:type:Store) specified by `storeKey`. + When using this endpoint the ProductTailoring's `store` field is always set to the [Store](ctp:api:type:Store) specified in the path parameter. + + Generates the [ProductTailoringCreated](ctp:api:type:ProductTailoringCreatedMessage) Message. + + """ + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/product-tailoring", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code in (201, 200): + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_request_builder.py b/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_request_builder.py new file mode 100644 index 00000000..d04ed606 --- /dev/null +++ b/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_request_builder.py @@ -0,0 +1,123 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.cart import ProductTailoringUpdate +from ...models.error import ErrorResponse +from ...models.product_tailoring import ProductTailoring +from ..images.by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_images_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _product_id: str + + def __init__( + self, + project_key: str, + store_key: str, + product_id: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._product_id = product_id + self._client = client + + def images( + self, + ) -> ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringImagesRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + product_id=self._product_id, + client=self._client, + ) + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Gets the current or staged representation of a [Product Tailoring](ctp:api:type:ProductTailoring) by its Product ID in the specified [Store](ctp:api:type:Store).""" + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/{self._product_id}/product-tailoring", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "ProductTailoringUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Updates the current or staged representation of a [Product Tailoring](ctp:api:type:ProductTailoring) by its Product ID in the specified [Store](ctp:api:type:Store).""" + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/{self._product_id}/product-tailoring", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Generates the [ProductTailoringDeleted](ctp:api:type:ProductTailoringDeletedMessage) Message.""" + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/{self._product_id}/product-tailoring", + params={"version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_request_builder.py b/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_request_builder.py new file mode 100644 index 00000000..d336ea5f --- /dev/null +++ b/src/commercetools/platform/client/product_tailoring/by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_request_builder.py @@ -0,0 +1,123 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.cart import ProductTailoringUpdate +from ...models.error import ErrorResponse +from ...models.product_tailoring import ProductTailoring +from ..images.by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_images_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _product_key: str + + def __init__( + self, + project_key: str, + store_key: str, + product_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._product_key = product_key + self._client = client + + def images( + self, + ) -> ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringImagesRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + product_key=self._product_key, + client=self._client, + ) + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Gets the current or staged representation of a [Product Tailoring](ctp:api:type:ProductTailoring) by its Product key in the specified [Store](ctp:api:type:Store).""" + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/key={self._product_key}/product-tailoring", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "ProductTailoringUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Updates the current or staged representation of a [Product Tailoring](ctp:api:type:ProductTailoring) by its Product key in the specified [Store](ctp:api:type:Store).""" + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/key={self._product_key}/product-tailoring", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Generates the [ProductTailoringDeleted](ctp:api:type:ProductTailoringDeletedMessage) Message.""" + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/products/key={self._product_key}/product-tailoring", + params={"version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_by_id_request_builder.py b/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_by_id_request_builder.py new file mode 100644 index 00000000..1b124d9f --- /dev/null +++ b/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_by_id_request_builder.py @@ -0,0 +1,105 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.cart import ProductTailoringUpdate +from ...models.error import ErrorResponse +from ...models.product_tailoring import ProductTailoring + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyProductTailoringByIDRequestBuilder: + + _client: "BaseClient" + _project_key: str + _id: str + + def __init__( + self, + project_key: str, + id: str, + client: "BaseClient", + ): + self._project_key = project_key + self._id = id + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/product-tailoring/{self._id}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "ProductTailoringUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/product-tailoring/{self._id}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Generates the [ProductTailoringDeleted](ctp:api:type:ProductTailoringDeletedMessage) Message.""" + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/product-tailoring/{self._id}", + params={"version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_key_by_key_request_builder.py b/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_key_by_key_request_builder.py new file mode 100644 index 00000000..9a0ff2bb --- /dev/null +++ b/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_key_by_key_request_builder.py @@ -0,0 +1,105 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.cart import ProductTailoringUpdate +from ...models.error import ErrorResponse +from ...models.product_tailoring import ProductTailoring + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyProductTailoringKeyByKeyRequestBuilder: + + _client: "BaseClient" + _project_key: str + _key: str + + def __init__( + self, + project_key: str, + key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._key = key + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/product-tailoring/key={self._key}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "ProductTailoringUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/product-tailoring/key={self._key}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Generates the [ProductTailoringDeleted](ctp:api:type:ProductTailoringDeletedMessage) Message.""" + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/product-tailoring/key={self._key}", + params={"version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_request_builder.py b/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_request_builder.py new file mode 100644 index 00000000..98fdc942 --- /dev/null +++ b/src/commercetools/platform/client/product_tailoring/by_project_key_product_tailoring_request_builder.py @@ -0,0 +1,118 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.product_tailoring import ( + ProductTailoring, + ProductTailoringDraft, + ProductTailoringPagedQueryResponse, +) +from .by_project_key_product_tailoring_by_id_request_builder import ( + ByProjectKeyProductTailoringByIDRequestBuilder, +) +from .by_project_key_product_tailoring_key_by_key_request_builder import ( + ByProjectKeyProductTailoringKeyByKeyRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyProductTailoringRequestBuilder: + + _client: "BaseClient" + _project_key: str + + def __init__( + self, + project_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._client = client + + def with_key(self, key: str) -> ByProjectKeyProductTailoringKeyByKeyRequestBuilder: + return ByProjectKeyProductTailoringKeyByKeyRequestBuilder( + key=key, + project_key=self._project_key, + client=self._client, + ) + + def with_id(self, id: str) -> ByProjectKeyProductTailoringByIDRequestBuilder: + return ByProjectKeyProductTailoringByIDRequestBuilder( + id=id, + project_key=self._project_key, + client=self._client, + ) + + def get( + self, + *, + expand: typing.List["str"] = None, + sort: typing.List["str"] = None, + limit: int = None, + offset: int = None, + with_total: bool = None, + where: typing.List["str"] = None, + predicate_var: typing.Dict[str, typing.List["str"]] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoringPagedQueryResponse"]: + params = { + "expand": expand, + "sort": sort, + "limit": limit, + "offset": offset, + "withTotal": with_total, + "where": where, + } + predicate_var and params.update( + {f"var.{k}": v for k, v in predicate_var.items()} + ) + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/product-tailoring", + params=params, + headers=headers, + options=options, + ) + if response.status_code == 200: + return ProductTailoringPagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "ProductTailoringDraft", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["ProductTailoring"]: + """Generates the [ProductTailoringCreated](ctp:api:type:ProductTailoringCreatedMessage) Message.""" + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/product-tailoring", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code in (201, 200): + return ProductTailoring.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/product_types/by_project_key_product_types_by_id_request_builder.py b/src/commercetools/platform/client/product_types/by_project_key_product_types_by_id_request_builder.py index 7822640b..a62acbd4 100644 --- a/src/commercetools/platform/client/product_types/by_project_key_product_types_by_id_request_builder.py +++ b/src/commercetools/platform/client/product_types/by_project_key_product_types_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductTypesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/product_types/by_project_key_product_types_key_by_key_request_builder.py b/src/commercetools/platform/client/product_types/by_project_key_product_types_key_by_key_request_builder.py index ebf1f18d..eed12f52 100644 --- a/src/commercetools/platform/client/product_types/by_project_key_product_types_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/product_types/by_project_key_product_types_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductTypesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/product_types/by_project_key_product_types_request_builder.py b/src/commercetools/platform/client/product_types/by_project_key_product_types_request_builder.py index bc4e44be..33d44d93 100644 --- a/src/commercetools/platform/client/product_types/by_project_key_product_types_request_builder.py +++ b/src/commercetools/platform/client/product_types/by_project_key_product_types_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyProductTypesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder.py b/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder.py new file mode 100644 index 00000000..b8657de4 --- /dev/null +++ b/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder.py @@ -0,0 +1,45 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ..product_tailoring.by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _product_id: str + + def __init__( + self, + project_key: str, + store_key: str, + product_id: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._product_id = product_id + self._client = client + + def product_tailoring( + self, + ) -> ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + product_id=self._product_id, + client=self._client, + ) diff --git a/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder.py b/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder.py new file mode 100644 index 00000000..f29673d8 --- /dev/null +++ b/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder.py @@ -0,0 +1,45 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ..product_tailoring.by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _product_key: str + + def __init__( + self, + project_key: str, + store_key: str, + product_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._product_key = product_key + self._client = client + + def product_tailoring( + self, + ) -> ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringRequestBuilder( + project_key=self._project_key, + store_key=self._store_key, + product_key=self._product_key, + client=self._client, + ) diff --git a/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_request_builder.py b/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_request_builder.py new file mode 100644 index 00000000..35242be2 --- /dev/null +++ b/src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_request_builder.py @@ -0,0 +1,55 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from .by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder, +) +from .by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyProductsRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + + def __init__( + self, + project_key: str, + store_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._client = client + + def with_product_id( + self, product_id: str + ) -> ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder( + product_id=product_id, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def with_product_key( + self, product_key: str + ) -> ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder( + product_key=product_key, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) diff --git a/src/commercetools/platform/client/products/by_project_key_product_selections_by_id_products_request_builder.py b/src/commercetools/platform/client/products/by_project_key_product_selections_by_id_products_request_builder.py index 45b5ef94..336b3c03 100644 --- a/src/commercetools/platform/client/products/by_project_key_product_selections_by_id_products_request_builder.py +++ b/src/commercetools/platform/client/products/by_project_key_product_selections_by_id_products_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductSelectionsByIDProductsRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/products/by_project_key_product_selections_key_by_key_products_request_builder.py b/src/commercetools/platform/client/products/by_project_key_product_selections_key_by_key_products_request_builder.py index 5e09a518..e558ae27 100644 --- a/src/commercetools/platform/client/products/by_project_key_product_selections_key_by_key_products_request_builder.py +++ b/src/commercetools/platform/client/products/by_project_key_product_selections_key_by_key_products_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductSelectionsKeyByKeyProductsRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/products/by_project_key_products_by_id_request_builder.py b/src/commercetools/platform/client/products/by_project_key_products_by_id_request_builder.py index 2eff1a03..ce639258 100644 --- a/src/commercetools/platform/client/products/by_project_key_products_by_id_request_builder.py +++ b/src/commercetools/platform/client/products/by_project_key_products_by_id_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyProductsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str @@ -58,12 +59,11 @@ def get( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, expand: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Product"]: - """If [Price selection](ctp:api:type:ProductPriceSelection) query parameters are provided, the selected Prices are added to the response.""" + """If [Product price selection query parameters](/../api/pricing-and-discounts-overview#product-price-selection) are provided, the selected Prices are added to the response.""" headers = {} if headers is None else headers response = self._client._get( endpoint=f"/{self._project_key}/products/{self._id}", @@ -72,7 +72,6 @@ def get( "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "expand": expand, }, headers=headers, @@ -118,12 +117,11 @@ def post( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, expand: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Product"]: - """If [Price selection](ctp:api:type:ProductPriceSelection) query parameters are provided, the selected Prices are added to the response. + """If [Product price selection query parameters](/../api/pricing-and-discounts-overview#product-price-selection) are provided, the selected Prices are added to the response. A failed response can return a [DuplicatePriceScope](ctp:api:type:DuplicatePriceScopeError), [DuplicateVariantValues](ctp:api:type:DuplicateVariantValuesError), [DuplicateAttributeValue](ctp:api:type:DuplicateAttributeValueError), or [DuplicateAttributeValues](ctp:api:type:DuplicateAttributeValuesError) error. """ @@ -135,7 +133,6 @@ def post( "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "expand": expand, }, json=body.serialize(), @@ -158,13 +155,12 @@ def delete( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, version: int, expand: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Product"]: - """If [Price selection](ctp:api:type:ProductPriceSelection) query parameters are provided, the selected Prices are added to the response. + """If [Product price selection query parameters](/../api/pricing-and-discounts-overview#product-price-selection) are provided, the selected Prices are added to the response. Produces the [ProductDeleted](/projects/messages#product-deleted) Message. """ headers = {} if headers is None else headers @@ -175,7 +171,6 @@ def delete( "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "version": version, "expand": expand, }, diff --git a/src/commercetools/platform/client/products/by_project_key_products_key_by_key_request_builder.py b/src/commercetools/platform/client/products/by_project_key_products_key_by_key_request_builder.py index 61bee367..91e491f4 100644 --- a/src/commercetools/platform/client/products/by_project_key_products_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/products/by_project_key_products_key_by_key_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeyProductsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str @@ -48,12 +49,11 @@ def get( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, expand: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Product"]: - """If [Price selection](ctp:api:type:ProductPriceSelection) query parameters are provided, the selected Prices are added to the response.""" + """If [Product price selection query parameters]](/../api/pricing-and-discounts-overview#product-price-selection) are provided, the selected Prices are added to the response.""" headers = {} if headers is None else headers response = self._client._get( endpoint=f"/{self._project_key}/products/key={self._key}", @@ -62,7 +62,6 @@ def get( "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "expand": expand, }, headers=headers, @@ -108,7 +107,6 @@ def post( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, expand: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, @@ -122,7 +120,6 @@ def post( "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "expand": expand, }, json=body.serialize(), @@ -145,13 +142,12 @@ def delete( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, version: int, expand: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Product"]: - """If [Price selection](ctp:api:type:ProductPriceSelection) query parameters are provided, the selected Prices are added to the response. + """If [Product price selection query parameters](/../api/pricing-and-discounts-overview#product-price-selection) are provided, the selected Prices are added to the response. Produces the [ProductDeleted](/projects/messages#product-deleted) Message. """ headers = {} if headers is None else headers @@ -162,7 +158,6 @@ def delete( "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "version": version, "expand": expand, }, diff --git a/src/commercetools/platform/client/products/by_project_key_products_request_builder.py b/src/commercetools/platform/client/products/by_project_key_products_request_builder.py index 238313e9..60c51683 100644 --- a/src/commercetools/platform/client/products/by_project_key_products_request_builder.py +++ b/src/commercetools/platform/client/products/by_project_key_products_request_builder.py @@ -9,6 +9,9 @@ from ...models.error import ErrorResponse from ...models.product import Product, ProductDraft, ProductPagedQueryResponse +from ..search.by_project_key_products_search_request_builder import ( + ByProjectKeyProductsSearchRequestBuilder, +) from .by_project_key_products_by_id_request_builder import ( ByProjectKeyProductsByIDRequestBuilder, ) @@ -21,6 +24,7 @@ class ByProjectKeyProductsRequestBuilder: + _client: "BaseClient" _project_key: str @@ -46,6 +50,13 @@ def with_id(self, id: str) -> ByProjectKeyProductsByIDRequestBuilder: client=self._client, ) + def search(self) -> ByProjectKeyProductsSearchRequestBuilder: + """This endpoint provides high-performance search queries over Products. Product Search allows searching through all products with a current projection in your Project.""" + return ByProjectKeyProductsSearchRequestBuilder( + project_key=self._project_key, + client=self._client, + ) + def get( self, *, @@ -54,7 +65,6 @@ def get( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, expand: typing.List["str"] = None, sort: typing.List["str"] = None, limit: int = None, @@ -64,14 +74,13 @@ def get( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["ProductPagedQueryResponse"]: - """If [Price selection](ctp:api:type:ProductPriceSelection) query parameters are provided, the selected Prices are added to the response.""" + """If [Product price selection query parameters](/../api/pricing-and-discounts-overview#product-price-selection) are provided, the selected Prices are added to the response.""" params = { "where": where, "priceCurrency": price_currency, "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "expand": expand, "sort": sort, "limit": limit, @@ -129,13 +138,12 @@ def post( price_country: str = None, price_customer_group: str = None, price_channel: str = None, - locale_projection: typing.List["str"] = None, expand: typing.List["str"] = None, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["Product"]: - """To create a new Product, send a representation that is going to become the initial _staged_ representation of the new Product in the master catalog. - If [Price Selection](ctp:api:type:ProductPriceSelection) query parameters are provided, selected Prices will be added to the response. + """To create a new Product, send a representation that is going to become the initial _staged_ and _current_ representation of the new Product in the catalog. + If [Product price selection query parameters](/../api/pricing-and-discounts-overview#product-price-selection) are provided, selected Prices will be added to the response. Produces the [ProductCreated](/projects/messages#product-created) Message. """ @@ -147,7 +155,6 @@ def post( "priceCountry": price_country, "priceCustomerGroup": price_customer_group, "priceChannel": price_channel, - "localeProjection": locale_projection, "expand": expand, }, json=body.serialize(), diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_by_id_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_by_id_request_builder.py index d63d6ad1..5a1252b8 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_by_id_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyQuoteRequestsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_key_by_key_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_key_by_key_request_builder.py index 5b2dea5b..2317ff4c 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyQuoteRequestsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_request_builder.py index dce84b65..70b7212f 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyQuoteRequestsRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_by_id_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_by_id_request_builder.py new file mode 100644 index 00000000..e479ad35 --- /dev/null +++ b/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_by_id_request_builder.py @@ -0,0 +1,130 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.quote_request import QuoteRequest, QuoteRequestUpdate + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsByIDRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _id: str + + def __init__( + self, + project_key: str, + store_key: str, + id: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._id = id + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequest"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/{self._id}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return QuoteRequest.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a QuoteRequest exists for a given `id`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/{self._id}", + params={}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "QuoteRequestUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequest"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/{self._id}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return QuoteRequest.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + data_erasure: bool = None, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequest"]: + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/{self._id}", + params={"dataErasure": data_erasure, "version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return QuoteRequest.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_key_by_key_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_key_by_key_request_builder.py new file mode 100644 index 00000000..d6601c60 --- /dev/null +++ b/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_key_by_key_request_builder.py @@ -0,0 +1,130 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.quote_request import QuoteRequest, QuoteRequestUpdate + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsKeyByKeyRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _key: str + + def __init__( + self, + project_key: str, + store_key: str, + key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._key = key + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequest"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/key={self._key}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return QuoteRequest.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a QuoteRequest exists for a given `key`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/key={self._key}", + params={}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "QuoteRequestUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequest"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/key={self._key}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return QuoteRequest.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + data_erasure: bool = None, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequest"]: + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests/key={self._key}", + params={"dataErasure": data_erasure, "version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return QuoteRequest.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_request_builder.py new file mode 100644 index 00000000..14de9423 --- /dev/null +++ b/src/commercetools/platform/client/quote_requests/by_project_key_in_store_key_by_store_key_quote_requests_request_builder.py @@ -0,0 +1,150 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.quote_request import ( + QuoteRequest, + QuoteRequestDraft, + QuoteRequestPagedQueryResponse, +) +from .by_project_key_in_store_key_by_store_key_quote_requests_by_id_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsByIDRequestBuilder, +) +from .by_project_key_in_store_key_by_store_key_quote_requests_key_by_key_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsKeyByKeyRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + + def __init__( + self, + project_key: str, + store_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._client = client + + def with_key( + self, key: str + ) -> ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsKeyByKeyRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsKeyByKeyRequestBuilder( + key=key, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def with_id( + self, id: str + ) -> ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsByIDRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyQuoteRequestsByIDRequestBuilder( + id=id, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def get( + self, + *, + expand: typing.List["str"] = None, + sort: typing.List["str"] = None, + limit: int = None, + offset: int = None, + with_total: bool = None, + where: typing.List["str"] = None, + predicate_var: typing.Dict[str, typing.List["str"]] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequestPagedQueryResponse"]: + params = { + "expand": expand, + "sort": sort, + "limit": limit, + "offset": offset, + "withTotal": with_total, + "where": where, + } + predicate_var and params.update( + {f"var.{k}": v for k, v in predicate_var.items()} + ) + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests", + params=params, + headers=headers, + options=options, + ) + if response.status_code == 200: + return QuoteRequestPagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + where: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a QuoteRequest exists for a given Query Predicate. Returns a `200 OK` status if any QuoteRequests match the Query Predicate or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests", + params={"where": where}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "QuoteRequestDraft", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuoteRequest"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quote-requests", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code in (201, 200): + return QuoteRequest.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_by_id_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_by_id_request_builder.py index 17f88da0..5f94f62d 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_by_id_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_by_id_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeQuoteRequestsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_key_by_key_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_key_by_key_request_builder.py index b474d0ac..58b98bd4 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_key_by_key_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeQuoteRequestsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_request_builder.py index 0e2665b3..39982e43 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_me_quote_requests_request_builder.py @@ -22,6 +22,7 @@ class ByProjectKeyMeQuoteRequestsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_by_id_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_by_id_request_builder.py index 5e358f9f..489ea8cd 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_by_id_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyQuoteRequestsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_key_by_key_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_key_by_key_request_builder.py index 655a909f..35cc1996 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyQuoteRequestsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_request_builder.py b/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_request_builder.py index dea09ee5..2e509b32 100644 --- a/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_request_builder.py +++ b/src/commercetools/platform/client/quote_requests/by_project_key_quote_requests_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyQuoteRequestsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_quotes_request_builder.py index 175e6119..198d36b5 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_quotes_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_quotes_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersQuotesRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str @@ -42,6 +43,11 @@ def post( """Creates an Order from a [Quote](ctp:api:type:Cart) in a [BusinessUnit](ctp:api:type:BusinessUnit). Creating an Order fails with an [InvalidOperation](ctp:api:type:InvalidOperationError) if the Quote does not reference the same BusinessUnit as the `businessUnitKey` path parameter. + Specific Error Codes: + + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [OutOfStock](ctp:api:type:OutOfStockError) + """ headers = {} if headers is None else headers response = self._client._post( diff --git a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_by_id_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_by_id_request_builder.py index fefb7c95..a98332f7 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_by_id_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyQuotesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_key_by_key_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_key_by_key_request_builder.py index c5435dd7..097b3fd6 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyQuotesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_request_builder.py index eea5cdb4..c185772b 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyQuotesRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_orders_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_orders_quotes_request_builder.py new file mode 100644 index 00000000..59ca563e --- /dev/null +++ b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_orders_quotes_request_builder.py @@ -0,0 +1,66 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.order import Order, OrderFromQuoteDraft + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyOrdersQuotesRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + + def __init__( + self, + project_key: str, + store_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._client = client + + def post( + self, + body: "OrderFromQuoteDraft", + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Order"]: + """Creating an Order produces the [OrderCreated](ctp:api:type:OrderCreatedMessage) Message. + + Specific Error Codes: + + - [OutOfStock](ctp:api:type:OutOfStockError) + - [PriceChanged](ctp:api:type:PriceChangedError) + - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) + - [InvalidOperation](ctp:api:type:InvalidOperationError) + - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) + + """ + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/orders/quotes", + params={}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code in (201, 200): + return Order.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_by_id_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_by_id_request_builder.py new file mode 100644 index 00000000..6ca73c67 --- /dev/null +++ b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_by_id_request_builder.py @@ -0,0 +1,130 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.quote import Quote, QuoteUpdate + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyQuotesByIDRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _id: str + + def __init__( + self, + project_key: str, + store_key: str, + id: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._id = id + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Quote"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/{self._id}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return Quote.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a Quote exists for a given `id`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/{self._id}", + params={}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "QuoteUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Quote"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/{self._id}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return Quote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + data_erasure: bool = None, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Quote"]: + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/{self._id}", + params={"dataErasure": data_erasure, "version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return Quote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_key_by_key_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_key_by_key_request_builder.py new file mode 100644 index 00000000..63eb2ab3 --- /dev/null +++ b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_key_by_key_request_builder.py @@ -0,0 +1,130 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.quote import Quote, QuoteUpdate + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyQuotesKeyByKeyRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _key: str + + def __init__( + self, + project_key: str, + store_key: str, + key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._key = key + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Quote"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/key={self._key}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return Quote.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a Quote exists for a given `key`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/key={self._key}", + params={}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "QuoteUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Quote"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/key={self._key}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return Quote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + data_erasure: bool = None, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Quote"]: + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes/key={self._key}", + params={"dataErasure": data_erasure, "version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return Quote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_request_builder.py new file mode 100644 index 00000000..1f3ae4e8 --- /dev/null +++ b/src/commercetools/platform/client/quotes/by_project_key_in_store_key_by_store_key_quotes_request_builder.py @@ -0,0 +1,146 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.quote import Quote, QuoteDraft, QuotePagedQueryResponse +from .by_project_key_in_store_key_by_store_key_quotes_by_id_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyQuotesByIDRequestBuilder, +) +from .by_project_key_in_store_key_by_store_key_quotes_key_by_key_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyQuotesKeyByKeyRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyQuotesRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + + def __init__( + self, + project_key: str, + store_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._client = client + + def with_key( + self, key: str + ) -> ByProjectKeyInStoreKeyByStoreKeyQuotesKeyByKeyRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyQuotesKeyByKeyRequestBuilder( + key=key, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def with_id( + self, id: str + ) -> ByProjectKeyInStoreKeyByStoreKeyQuotesByIDRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyQuotesByIDRequestBuilder( + id=id, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def get( + self, + *, + expand: typing.List["str"] = None, + sort: typing.List["str"] = None, + limit: int = None, + offset: int = None, + with_total: bool = None, + where: typing.List["str"] = None, + predicate_var: typing.Dict[str, typing.List["str"]] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["QuotePagedQueryResponse"]: + params = { + "expand": expand, + "sort": sort, + "limit": limit, + "offset": offset, + "withTotal": with_total, + "where": where, + } + predicate_var and params.update( + {f"var.{k}": v for k, v in predicate_var.items()} + ) + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes", + params=params, + headers=headers, + options=options, + ) + if response.status_code == 200: + return QuotePagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + where: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a Quote exists for a given Query Predicate. Returns a `200 OK` status if any Quotes match the Query Predicate or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes", + params={"where": where}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "QuoteDraft", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["Quote"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/quotes", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code in (201, 200): + return Quote.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/quotes/by_project_key_me_orders_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_me_orders_quotes_request_builder.py index 46f9e6e3..d058ad5b 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_me_orders_quotes_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_me_orders_quotes_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeOrdersQuotesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_me_quotes_by_id_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_me_quotes_by_id_request_builder.py index 6dfece96..ee02df71 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_me_quotes_by_id_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_me_quotes_by_id_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeQuotesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_me_quotes_key_by_key_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_me_quotes_key_by_key_request_builder.py index f1e6513a..9eeacf3d 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_me_quotes_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_me_quotes_key_by_key_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeQuotesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_me_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_me_quotes_request_builder.py index d3466b7c..50f7d2c7 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_me_quotes_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_me_quotes_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyMeQuotesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_orders_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_orders_quotes_request_builder.py index 83aa546e..2049d691 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_orders_quotes_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_orders_quotes_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersQuotesRequestBuilder: + _client: "BaseClient" _project_key: str @@ -37,11 +38,11 @@ def post( Specific Error Codes: - - [OutOfStock](ctp:api:type:OutOfStockError) - - [PriceChanged](ctp:api:type:PriceChangedError) + - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) - [InvalidOperation](ctp:api:type:InvalidOperationError) - - [CountryNotConfiguredInStore](ctp:api:type:CountryNotConfiguredInStoreError) + - [OutOfStock](ctp:api:type:OutOfStockError) + - [PriceChanged](ctp:api:type:PriceChangedError) """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/quotes/by_project_key_quotes_by_id_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_quotes_by_id_request_builder.py index 7b0e61a1..02c97fce 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_quotes_by_id_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_quotes_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyQuotesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_quotes_key_by_key_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_quotes_key_by_key_request_builder.py index 406f04d2..a9323312 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_quotes_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_quotes_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyQuotesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/quotes/by_project_key_quotes_request_builder.py b/src/commercetools/platform/client/quotes/by_project_key_quotes_request_builder.py index 8362bc71..b7c271bd 100644 --- a/src/commercetools/platform/client/quotes/by_project_key_quotes_request_builder.py +++ b/src/commercetools/platform/client/quotes/by_project_key_quotes_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyQuotesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/replicate/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_replicate_request_builder.py b/src/commercetools/platform/client/replicate/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_replicate_request_builder.py index bfb23078..ab98537a 100644 --- a/src/commercetools/platform/client/replicate/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_replicate_request_builder.py +++ b/src/commercetools/platform/client/replicate/by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_replicate_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicateRequestBuilder: + _client: "BaseClient" _project_key: str _associate_id: str @@ -47,6 +48,11 @@ def post( If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. + Specific Error Codes: + + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) + """ headers = {} if headers is None else headers response = self._client._post( diff --git a/src/commercetools/platform/client/replicate/by_project_key_carts_replicate_request_builder.py b/src/commercetools/platform/client/replicate/by_project_key_carts_replicate_request_builder.py index 70f1245f..2daf8eed 100644 --- a/src/commercetools/platform/client/replicate/by_project_key_carts_replicate_request_builder.py +++ b/src/commercetools/platform/client/replicate/by_project_key_carts_replicate_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCartsReplicateRequestBuilder: + _client: "BaseClient" _project_key: str @@ -39,6 +40,11 @@ def post( The new Cart does not contain Payments or Deliveries. The [State](ctp:api:type:ItemState) of Line Items and Custom Line Items is reset to `initial`. + Specific Error Codes: + + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) + """ headers = {} if headers is None else headers response = self._client._post( diff --git a/src/commercetools/platform/client/replicate/by_project_key_in_store_key_by_store_key_carts_replicate_request_builder.py b/src/commercetools/platform/client/replicate/by_project_key_in_store_key_by_store_key_carts_replicate_request_builder.py index 80c7fd51..6b3d5b65 100644 --- a/src/commercetools/platform/client/replicate/by_project_key_in_store_key_by_store_key_carts_replicate_request_builder.py +++ b/src/commercetools/platform/client/replicate/by_project_key_in_store_key_by_store_key_carts_replicate_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCartsReplicateRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -42,6 +43,11 @@ def post( The new Cart does not contain payments or deliveries. The [State](ctp:api:type:ItemState) of Line Items and Custom Line Items is reset to `initial`. + Specific Error Codes: + + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) + """ headers = {} if headers is None else headers response = self._client._post( diff --git a/src/commercetools/platform/client/replicate/by_project_key_me_carts_replicate_request_builder.py b/src/commercetools/platform/client/replicate/by_project_key_me_carts_replicate_request_builder.py index 132453e2..0c29aa90 100644 --- a/src/commercetools/platform/client/replicate/by_project_key_me_carts_replicate_request_builder.py +++ b/src/commercetools/platform/client/replicate/by_project_key_me_carts_replicate_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeCartsReplicateRequestBuilder: + _client: "BaseClient" _project_key: str @@ -44,7 +45,12 @@ def post( The new Cart does not contain Payments or Deliveries. The [State](ctp:api:type:ItemState) of Line Items and Custom Line Items is reset to `initial`. - In case the Cart or Order to be replicated does not belong to the authenticaed Customer, the API returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error + If the Cart or Order to be replicated does not belong to the authenticated Customer, the API returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error + + Specific Error Codes: + + - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) + - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) """ headers = {} if headers is None else headers diff --git a/src/commercetools/platform/client/reset/by_project_key_customers_password_reset_request_builder.py b/src/commercetools/platform/client/reset/by_project_key_customers_password_reset_request_builder.py index 84030dcf..d900c266 100644 --- a/src/commercetools/platform/client/reset/by_project_key_customers_password_reset_request_builder.py +++ b/src/commercetools/platform/client/reset/by_project_key_customers_password_reset_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyCustomersPasswordResetRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_customers_password_reset_request_builder.py b/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_customers_password_reset_request_builder.py index 165fd7a0..99c1d327 100644 --- a/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_customers_password_reset_request_builder.py +++ b/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_customers_password_reset_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyCustomersPasswordResetRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_me_password_reset_request_builder.py b/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_me_password_reset_request_builder.py index 8e0a2179..28f0c8ec 100644 --- a/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_me_password_reset_request_builder.py +++ b/src/commercetools/platform/client/reset/by_project_key_in_store_key_by_store_key_me_password_reset_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMePasswordResetRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/reset/by_project_key_me_password_reset_request_builder.py b/src/commercetools/platform/client/reset/by_project_key_me_password_reset_request_builder.py index f87bcffb..0b867d72 100644 --- a/src/commercetools/platform/client/reset/by_project_key_me_password_reset_request_builder.py +++ b/src/commercetools/platform/client/reset/by_project_key_me_password_reset_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyMePasswordResetRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/reviews/by_project_key_reviews_by_id_request_builder.py b/src/commercetools/platform/client/reviews/by_project_key_reviews_by_id_request_builder.py index 176134a1..bbacefaa 100644 --- a/src/commercetools/platform/client/reviews/by_project_key_reviews_by_id_request_builder.py +++ b/src/commercetools/platform/client/reviews/by_project_key_reviews_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyReviewsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/reviews/by_project_key_reviews_key_by_key_request_builder.py b/src/commercetools/platform/client/reviews/by_project_key_reviews_key_by_key_request_builder.py index f8f50d0c..70e36e1a 100644 --- a/src/commercetools/platform/client/reviews/by_project_key_reviews_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/reviews/by_project_key_reviews_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyReviewsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/reviews/by_project_key_reviews_request_builder.py b/src/commercetools/platform/client/reviews/by_project_key_reviews_request_builder.py index 5a16c0c7..4fca9835 100644 --- a/src/commercetools/platform/client/reviews/by_project_key_reviews_request_builder.py +++ b/src/commercetools/platform/client/reviews/by_project_key_reviews_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyReviewsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/ml/client/config/by_project_key_image_search_config_request_builder.py b/src/commercetools/platform/client/search/by_project_key_customers_search_request_builder.py similarity index 54% rename from src/commercetools/ml/client/config/by_project_key_image_search_config_request_builder.py rename to src/commercetools/platform/client/search/by_project_key_customers_search_request_builder.py index 6510cc6d..26d8e037 100644 --- a/src/commercetools/ml/client/config/by_project_key_image_search_config_request_builder.py +++ b/src/commercetools/platform/client/search/by_project_key_customers_search_request_builder.py @@ -7,16 +7,15 @@ import typing import warnings -from ...models.image_search_config import ( - ImageSearchConfigRequest, - ImageSearchConfigResponse, -) +from ...models.customer_search import CustomerPagedSearchResponse, CustomerSearchRequest +from ...models.error import ErrorResponse if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyImageSearchConfigRequestBuilder: +class ByProjectKeyCustomersSearchRequestBuilder: + _client: "BaseClient" _project_key: str @@ -28,40 +27,52 @@ def __init__( self._project_key = project_key self._client = client - def get( + def post( self, + body: "CustomerSearchRequest", *, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, - ) -> "ImageSearchConfigResponse": - """Get the current image search config.""" + ) -> typing.Optional["CustomerPagedSearchResponse"]: headers = {} if headers is None else headers - response = self._client._get( - endpoint=f"/{self._project_key}/image-search/config", + response = self._client._post( + endpoint=f"/{self._project_key}/customers/search", params={}, - headers=headers, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, options=options, ) if response.status_code == 200: - return ImageSearchConfigResponse.deserialize(response.json()) + return CustomerPagedSearchResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None warnings.warn("Unhandled status code %d" % response.status_code) - def post( + def head( self, - body: "ImageSearchConfigRequest", *, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, - ) -> "ImageSearchConfigResponse": - """Endpoint to update the image search config.""" + ) -> typing.Optional[None]: + """Checks whether a search index for the Project's Customers exists. + Returns a `200 OK` status if the index exists or `404 Not Found` otherwise. + + """ headers = {} if headers is None else headers - response = self._client._post( - endpoint=f"/{self._project_key}/image-search/config", + response = self._client._head( + endpoint=f"/{self._project_key}/customers/search", params={}, - json=body.serialize(), - headers={"Content-Type": "application/json", **headers}, + headers=headers, options=options, ) if response.status_code == 200: - return ImageSearchConfigResponse.deserialize(response.json()) + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/search/by_project_key_orders_search_request_builder.py b/src/commercetools/platform/client/search/by_project_key_orders_search_request_builder.py index 88a4560e..b7b15584 100644 --- a/src/commercetools/platform/client/search/by_project_key_orders_search_request_builder.py +++ b/src/commercetools/platform/client/search/by_project_key_orders_search_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyOrdersSearchRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/search/by_project_key_product_projections_search_request_builder.py b/src/commercetools/platform/client/search/by_project_key_product_projections_search_request_builder.py index 43c3c560..79c34ff3 100644 --- a/src/commercetools/platform/client/search/by_project_key_product_projections_search_request_builder.py +++ b/src/commercetools/platform/client/search/by_project_key_product_projections_search_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductProjectionsSearchRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/ml/client/prices/by_project_key_missing_data_prices_request_builder.py b/src/commercetools/platform/client/search/by_project_key_products_search_request_builder.py similarity index 59% rename from src/commercetools/ml/client/prices/by_project_key_missing_data_prices_request_builder.py rename to src/commercetools/platform/client/search/by_project_key_products_search_request_builder.py index acc618c1..c82da6e7 100644 --- a/src/commercetools/ml/client/prices/by_project_key_missing_data_prices_request_builder.py +++ b/src/commercetools/platform/client/search/by_project_key_products_search_request_builder.py @@ -7,17 +7,15 @@ import typing import warnings -from ...models.common import TaskToken -from ...models.missing_data import MissingPricesSearchRequest -from ..status.by_project_key_missing_data_prices_status_request_builder import ( - ByProjectKeyMissingDataPricesStatusRequestBuilder, -) +from ...models.error import ErrorResponse +from ...models.product_search import ProductPagedSearchResponse, ProductSearchRequest if typing.TYPE_CHECKING: from ...base_client import BaseClient -class ByProjectKeyMissingDataPricesRequestBuilder: +class ByProjectKeyProductsSearchRequestBuilder: + _client: "BaseClient" _project_key: str @@ -29,27 +27,26 @@ def __init__( self._project_key = project_key self._client = client - def status(self) -> ByProjectKeyMissingDataPricesStatusRequestBuilder: - return ByProjectKeyMissingDataPricesStatusRequestBuilder( - project_key=self._project_key, - client=self._client, - ) - def post( self, - body: "MissingPricesSearchRequest", + body: "ProductSearchRequest", *, headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, - ) -> "TaskToken": + ) -> typing.Optional["ProductPagedSearchResponse"]: headers = {} if headers is None else headers response = self._client._post( - endpoint=f"/{self._project_key}/missing-data/prices", + endpoint=f"/{self._project_key}/products/search", params={}, json=body.serialize(), headers={"Content-Type": "application/json", **headers}, options=options, ) - if response.status_code == 202: - return TaskToken.deserialize(response.json()) + if response.status_code == 200: + return ProductPagedSearchResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/shipping_methods/by_project_key_in_store_key_by_store_key_shipping_methods_request_builder.py b/src/commercetools/platform/client/shipping_methods/by_project_key_in_store_key_by_store_key_shipping_methods_request_builder.py index e7bfdd90..ed20b414 100644 --- a/src/commercetools/platform/client/shipping_methods/by_project_key_in_store_key_by_store_key_shipping_methods_request_builder.py +++ b/src/commercetools/platform/client/shipping_methods/by_project_key_in_store_key_by_store_key_shipping_methods_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInStoreKeyByStoreKeyShippingMethodsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_by_id_request_builder.py b/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_by_id_request_builder.py index c3faa2ef..5f039fac 100644 --- a/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_by_id_request_builder.py +++ b/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShippingMethodsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_key_by_key_request_builder.py b/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_key_by_key_request_builder.py index 6e92dc19..dfea4393 100644 --- a/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShippingMethodsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_request_builder.py b/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_request_builder.py index 82532aad..e2bbd62c 100644 --- a/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_request_builder.py +++ b/src/commercetools/platform/client/shipping_methods/by_project_key_shipping_methods_request_builder.py @@ -37,6 +37,7 @@ class ByProjectKeyShippingMethodsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_by_id_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_by_id_request_builder.py index 88abcf4d..cd326c9f 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_by_id_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_by_id_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_key_by_key_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_key_by_key_request_builder.py index ee1703f4..ff50d42e 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_key_by_key_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_request_builder.py index 22b562e9..c4eaafac 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_me_shopping_lists_request_builder.py @@ -22,6 +22,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeShoppingListsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_by_id_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_by_id_request_builder.py index 900e7cb6..6aa1fc6f 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_by_id_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyShoppingListsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_key_by_key_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_key_by_key_request_builder.py index 4a6707b8..4c61b8aa 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyInStoreKeyByStoreKeyShoppingListsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_request_builder.py index 5ae971e7..71feb941 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_in_store_key_by_store_key_shopping_lists_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyInStoreKeyByStoreKeyShoppingListsRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_by_id_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_by_id_request_builder.py index 1bd5e37a..bd471f0c 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_by_id_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_by_id_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeShoppingListsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_key_by_key_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_key_by_key_request_builder.py index 36a75716..14c48f63 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_key_by_key_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeShoppingListsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_request_builder.py index d39d058b..33059b8e 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_me_shopping_lists_request_builder.py @@ -22,6 +22,7 @@ class ByProjectKeyMeShoppingListsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_by_id_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_by_id_request_builder.py index 4b919e93..9b764104 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_by_id_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShoppingListsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_key_by_key_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_key_by_key_request_builder.py index 903ac1d6..84ba322a 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyShoppingListsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_request_builder.py b/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_request_builder.py index 6c572161..83e66ac3 100644 --- a/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_request_builder.py +++ b/src/commercetools/platform/client/shopping_lists/by_project_key_shopping_lists_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyShoppingListsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/signup/by_project_key_in_store_key_by_store_key_me_signup_request_builder.py b/src/commercetools/platform/client/signup/by_project_key_in_store_key_by_store_key_me_signup_request_builder.py index 35623424..79a33288 100644 --- a/src/commercetools/platform/client/signup/by_project_key_in_store_key_by_store_key_me_signup_request_builder.py +++ b/src/commercetools/platform/client/signup/by_project_key_in_store_key_by_store_key_me_signup_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyInStoreKeyByStoreKeyMeSignupRequestBuilder: + _client: "BaseClient" _project_key: str _store_key: str @@ -39,6 +40,8 @@ def post( ) -> typing.Optional["CustomerSignInResult"]: """If omitted in the request body, the [Customer](ctp:api:type:Customer) `stores` field is set to the [Store](ctp:api:type:Store) specified in the path parameter. + A Cart returned in the [CustomerSignInResult](ctp:api:type:CustomerSignInResult) has any invalid Line Items removed and is [updated](/api/carts-orders-overview#cart-updates) with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). + Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. """ diff --git a/src/commercetools/platform/client/signup/by_project_key_me_signup_request_builder.py b/src/commercetools/platform/client/signup/by_project_key_me_signup_request_builder.py index ed93084f..c4b7915a 100644 --- a/src/commercetools/platform/client/signup/by_project_key_me_signup_request_builder.py +++ b/src/commercetools/platform/client/signup/by_project_key_me_signup_request_builder.py @@ -16,6 +16,7 @@ class ByProjectKeyMeSignupRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_by_id_request_builder.py b/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_by_id_request_builder.py new file mode 100644 index 00000000..27719a39 --- /dev/null +++ b/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_by_id_request_builder.py @@ -0,0 +1,130 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.staged_quote import StagedQuote, StagedQuoteUpdate + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyStagedQuotesByIDRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _id: str + + def __init__( + self, + project_key: str, + store_key: str, + id: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._id = id + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuote"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/{self._id}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return StagedQuote.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a StagedQuote exists for a given `id`. Returns a `200 OK` status if the StagedQuote exists or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/{self._id}", + params={}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "StagedQuoteUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuote"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/{self._id}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return StagedQuote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + data_erasure: bool = None, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuote"]: + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/{self._id}", + params={"dataErasure": data_erasure, "version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return StagedQuote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_key_by_key_request_builder.py b/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_key_by_key_request_builder.py new file mode 100644 index 00000000..1f35173d --- /dev/null +++ b/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_key_by_key_request_builder.py @@ -0,0 +1,130 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.staged_quote import StagedQuote, StagedQuoteUpdate + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyStagedQuotesKeyByKeyRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + _key: str + + def __init__( + self, + project_key: str, + store_key: str, + key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._key = key + self._client = client + + def get( + self, + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuote"]: + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/key={self._key}", + params={"expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return StagedQuote.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a StagedQuote exists for a given `key`. Returns a `200 OK` status if the StagedQuote exists or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/key={self._key}", + params={}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "StagedQuoteUpdate", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuote"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/key={self._key}", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code == 200: + return StagedQuote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def delete( + self, + *, + data_erasure: bool = None, + version: int, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuote"]: + headers = {} if headers is None else headers + response = self._client._delete( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes/key={self._key}", + params={"dataErasure": data_erasure, "version": version, "expand": expand}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return StagedQuote.deserialize(response.json()) + elif response.status_code in (409, 400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_request_builder.py b/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_request_builder.py new file mode 100644 index 00000000..439ef700 --- /dev/null +++ b/src/commercetools/platform/client/staged_quotes/by_project_key_in_store_key_by_store_key_staged_quotes_request_builder.py @@ -0,0 +1,150 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import typing +import warnings + +from ...models.error import ErrorResponse +from ...models.staged_quote import ( + StagedQuote, + StagedQuoteDraft, + StagedQuotePagedQueryResponse, +) +from .by_project_key_in_store_key_by_store_key_staged_quotes_by_id_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyStagedQuotesByIDRequestBuilder, +) +from .by_project_key_in_store_key_by_store_key_staged_quotes_key_by_key_request_builder import ( + ByProjectKeyInStoreKeyByStoreKeyStagedQuotesKeyByKeyRequestBuilder, +) + +if typing.TYPE_CHECKING: + from ...base_client import BaseClient + + +class ByProjectKeyInStoreKeyByStoreKeyStagedQuotesRequestBuilder: + + _client: "BaseClient" + _project_key: str + _store_key: str + + def __init__( + self, + project_key: str, + store_key: str, + client: "BaseClient", + ): + self._project_key = project_key + self._store_key = store_key + self._client = client + + def with_key( + self, key: str + ) -> ByProjectKeyInStoreKeyByStoreKeyStagedQuotesKeyByKeyRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyStagedQuotesKeyByKeyRequestBuilder( + key=key, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def with_id( + self, id: str + ) -> ByProjectKeyInStoreKeyByStoreKeyStagedQuotesByIDRequestBuilder: + return ByProjectKeyInStoreKeyByStoreKeyStagedQuotesByIDRequestBuilder( + id=id, + project_key=self._project_key, + store_key=self._store_key, + client=self._client, + ) + + def get( + self, + *, + expand: typing.List["str"] = None, + sort: typing.List["str"] = None, + limit: int = None, + offset: int = None, + with_total: bool = None, + where: typing.List["str"] = None, + predicate_var: typing.Dict[str, typing.List["str"]] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuotePagedQueryResponse"]: + params = { + "expand": expand, + "sort": sort, + "limit": limit, + "offset": offset, + "withTotal": with_total, + "where": where, + } + predicate_var and params.update( + {f"var.{k}": v for k, v in predicate_var.items()} + ) + headers = {} if headers is None else headers + response = self._client._get( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes", + params=params, + headers=headers, + options=options, + ) + if response.status_code == 200: + return StagedQuotePagedQueryResponse.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) + + def head( + self, + *, + where: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional[None]: + """Checks if a StagedQuote exists for a given Query Predicate. Returns a `200 OK` status if any StagedQuotes match the Query Predicate or a `404 Not Found` otherwise.""" + headers = {} if headers is None else headers + response = self._client._head( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes", + params={"where": where}, + headers=headers, + options=options, + ) + if response.status_code == 200: + return None + elif response.status_code == 404: + return None + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + warnings.warn("Unhandled status code %d" % response.status_code) + + def post( + self, + body: "StagedQuoteDraft", + *, + expand: typing.List["str"] = None, + headers: typing.Dict[str, str] = None, + options: typing.Dict[str, typing.Any] = None, + ) -> typing.Optional["StagedQuote"]: + headers = {} if headers is None else headers + response = self._client._post( + endpoint=f"/{self._project_key}/in-store/key={self._store_key}/staged-quotes", + params={"expand": expand}, + json=body.serialize(), + headers={"Content-Type": "application/json", **headers}, + options=options, + ) + if response.status_code in (201, 200): + return StagedQuote.deserialize(response.json()) + elif response.status_code in (400, 401, 403, 500, 502, 503): + obj = ErrorResponse.deserialize(response.json()) + raise self._client._create_exception(obj, response) + elif response.status_code == 404: + return None + warnings.warn("Unhandled status code %d" % response.status_code) diff --git a/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_by_id_request_builder.py b/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_by_id_request_builder.py index b07a8048..3eab2e25 100644 --- a/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_by_id_request_builder.py +++ b/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStagedQuotesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_key_by_key_request_builder.py b/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_key_by_key_request_builder.py index ebc3af65..f062b265 100644 --- a/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStagedQuotesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_request_builder.py b/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_request_builder.py index d7bdbf38..9722f080 100644 --- a/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_request_builder.py +++ b/src/commercetools/platform/client/staged_quotes/by_project_key_staged_quotes_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyStagedQuotesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_by_id_request_builder.py b/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_by_id_request_builder.py index 92e4d495..44a175d0 100644 --- a/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_by_id_request_builder.py +++ b/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStandalonePricesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_key_by_key_request_builder.py b/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_key_by_key_request_builder.py index da45ff2f..b0f94523 100644 --- a/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStandalonePricesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_request_builder.py b/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_request_builder.py index 97a2ca20..386f06e9 100644 --- a/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_request_builder.py +++ b/src/commercetools/platform/client/standalone_prices/by_project_key_standalone_prices_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyStandalonePricesRequestBuilder: + _client: "BaseClient" _project_key: str @@ -122,7 +123,12 @@ def post( headers: typing.Dict[str, str] = None, options: typing.Dict[str, typing.Any] = None, ) -> typing.Optional["StandalonePrice"]: - """Produces the [StandalonePriceCreated](ctp:api:type:StandalonePriceCreatedMessage) Message.""" + """Creating a Standalone Price produces the [StandalonePriceCreated](ctp:api:type:StandalonePriceCreatedMessage) Message. + + - If the Standalone Price has the same price scope as an existing Standalone Price, a [DuplicateStandalonePriceScope](ctp:api:type:DuplicateStandalonePriceScopeError) error is returned. + - If the Standalone Price has overlapping validity periods within the same price scope, a [OverlappingStandalonePriceValidity](ctp:api:type:OverlappingStandalonePriceValidityError) error is returned. A Price without validity period does not conflict with a Price defined for a time period. + + """ headers = {} if headers is None else headers response = self._client._post( endpoint=f"/{self._project_key}/standalone-prices", diff --git a/src/commercetools/platform/client/states/by_project_key_states_by_id_request_builder.py b/src/commercetools/platform/client/states/by_project_key_states_by_id_request_builder.py index d13fc54d..293d75d6 100644 --- a/src/commercetools/platform/client/states/by_project_key_states_by_id_request_builder.py +++ b/src/commercetools/platform/client/states/by_project_key_states_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStatesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/states/by_project_key_states_key_by_key_request_builder.py b/src/commercetools/platform/client/states/by_project_key_states_key_by_key_request_builder.py index da6e24fb..429e29f1 100644 --- a/src/commercetools/platform/client/states/by_project_key_states_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/states/by_project_key_states_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStatesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/states/by_project_key_states_request_builder.py b/src/commercetools/platform/client/states/by_project_key_states_request_builder.py index 246fe18e..b7705a08 100644 --- a/src/commercetools/platform/client/states/by_project_key_states_request_builder.py +++ b/src/commercetools/platform/client/states/by_project_key_states_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyStatesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/stores/by_project_key_stores_by_id_request_builder.py b/src/commercetools/platform/client/stores/by_project_key_stores_by_id_request_builder.py index aa5e91db..190c1539 100644 --- a/src/commercetools/platform/client/stores/by_project_key_stores_by_id_request_builder.py +++ b/src/commercetools/platform/client/stores/by_project_key_stores_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStoresByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/stores/by_project_key_stores_key_by_key_request_builder.py b/src/commercetools/platform/client/stores/by_project_key_stores_key_by_key_request_builder.py index 8e690d8f..bf6e93d5 100644 --- a/src/commercetools/platform/client/stores/by_project_key_stores_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/stores/by_project_key_stores_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyStoresKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/stores/by_project_key_stores_request_builder.py b/src/commercetools/platform/client/stores/by_project_key_stores_request_builder.py index 37f5ed39..affe6b3e 100644 --- a/src/commercetools/platform/client/stores/by_project_key_stores_request_builder.py +++ b/src/commercetools/platform/client/stores/by_project_key_stores_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyStoresRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_by_id_request_builder.py b/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_by_id_request_builder.py index 447971cf..5861ad1d 100644 --- a/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_by_id_request_builder.py +++ b/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_by_id_request_builder.py @@ -18,6 +18,7 @@ class ByProjectKeySubscriptionsByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_key_by_key_request_builder.py b/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_key_by_key_request_builder.py index ca1c76fa..9631ecbd 100644 --- a/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeySubscriptionsKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_request_builder.py b/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_request_builder.py index 58ab1db3..56fecbae 100644 --- a/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_request_builder.py +++ b/src/commercetools/platform/client/subscriptions/by_project_key_subscriptions_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeySubscriptionsRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/suggest/by_project_key_product_projections_suggest_request_builder.py b/src/commercetools/platform/client/suggest/by_project_key_product_projections_suggest_request_builder.py index f41553a0..2090c61b 100644 --- a/src/commercetools/platform/client/suggest/by_project_key_product_projections_suggest_request_builder.py +++ b/src/commercetools/platform/client/suggest/by_project_key_product_projections_suggest_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyProductProjectionsSuggestRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_by_id_request_builder.py b/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_by_id_request_builder.py index 35483e6a..1bf42b9a 100644 --- a/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_by_id_request_builder.py +++ b/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyTaxCategoriesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_key_by_key_request_builder.py b/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_key_by_key_request_builder.py index caf92134..3551adc9 100644 --- a/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyTaxCategoriesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_request_builder.py b/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_request_builder.py index 445ab2b5..b474c593 100644 --- a/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_request_builder.py +++ b/src/commercetools/platform/client/tax_categories/by_project_key_tax_categories_request_builder.py @@ -25,6 +25,7 @@ class ByProjectKeyTaxCategoriesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/types/by_project_key_types_by_id_request_builder.py b/src/commercetools/platform/client/types/by_project_key_types_by_id_request_builder.py index 4a18386e..7281338e 100644 --- a/src/commercetools/platform/client/types/by_project_key_types_by_id_request_builder.py +++ b/src/commercetools/platform/client/types/by_project_key_types_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyTypesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/types/by_project_key_types_key_by_key_request_builder.py b/src/commercetools/platform/client/types/by_project_key_types_key_by_key_request_builder.py index d9d12627..6fc3b864 100644 --- a/src/commercetools/platform/client/types/by_project_key_types_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/types/by_project_key_types_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyTypesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/types/by_project_key_types_request_builder.py b/src/commercetools/platform/client/types/by_project_key_types_request_builder.py index 269e181a..9443351c 100644 --- a/src/commercetools/platform/client/types/by_project_key_types_request_builder.py +++ b/src/commercetools/platform/client/types/by_project_key_types_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyTypesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/client/zones/by_project_key_zones_by_id_request_builder.py b/src/commercetools/platform/client/zones/by_project_key_zones_by_id_request_builder.py index 23268ed0..af8ef056 100644 --- a/src/commercetools/platform/client/zones/by_project_key_zones_by_id_request_builder.py +++ b/src/commercetools/platform/client/zones/by_project_key_zones_by_id_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyZonesByIDRequestBuilder: + _client: "BaseClient" _project_key: str _id: str diff --git a/src/commercetools/platform/client/zones/by_project_key_zones_key_by_key_request_builder.py b/src/commercetools/platform/client/zones/by_project_key_zones_key_by_key_request_builder.py index 3d002032..1a62b7d3 100644 --- a/src/commercetools/platform/client/zones/by_project_key_zones_key_by_key_request_builder.py +++ b/src/commercetools/platform/client/zones/by_project_key_zones_key_by_key_request_builder.py @@ -15,6 +15,7 @@ class ByProjectKeyZonesKeyByKeyRequestBuilder: + _client: "BaseClient" _project_key: str _key: str diff --git a/src/commercetools/platform/client/zones/by_project_key_zones_request_builder.py b/src/commercetools/platform/client/zones/by_project_key_zones_request_builder.py index 49baabb0..856e67cb 100644 --- a/src/commercetools/platform/client/zones/by_project_key_zones_request_builder.py +++ b/src/commercetools/platform/client/zones/by_project_key_zones_request_builder.py @@ -21,6 +21,7 @@ class ByProjectKeyZonesRequestBuilder: + _client: "BaseClient" _project_key: str diff --git a/src/commercetools/platform/models/__init__.py b/src/commercetools/platform/models/__init__.py index 2b611df2..a86619e3 100644 --- a/src/commercetools/platform/models/__init__.py +++ b/src/commercetools/platform/models/__init__.py @@ -20,6 +20,7 @@ from .custom_object import * # noqa from .customer import * # noqa from .customer_group import * # noqa +from .customer_search import * # noqa from .discount_code import * # noqa from .error import * # noqa from .extension import * # noqa @@ -32,12 +33,15 @@ from .payment import * # noqa from .product import * # noqa from .product_discount import * # noqa +from .product_search import * # noqa from .product_selection import * # noqa +from .product_tailoring import * # noqa from .product_type import * # noqa from .project import * # noqa from .quote import * # noqa from .quote_request import * # noqa from .review import * # noqa +from .search import * # noqa from .shipping_method import * # noqa from .shopping_list import * # noqa from .staged_quote import * # noqa diff --git a/src/commercetools/platform/models/_schemas/api_client.py b/src/commercetools/platform/models/_schemas/api_client.py index e47988b1..de9091f2 100644 --- a/src/commercetools/platform/models/_schemas/api_client.py +++ b/src/commercetools/platform/models/_schemas/api_client.py @@ -61,6 +61,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApiClient(**data) @@ -91,6 +92,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApiClientDraft(**data) @@ -114,4 +116,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApiClientPagedQueryResponse(**data) diff --git a/src/commercetools/platform/models/_schemas/approval_flow.py b/src/commercetools/platform/models/_schemas/approval_flow.py index 785fc46c..1f1d1808 100644 --- a/src/commercetools/platform/models/_schemas/approval_flow.py +++ b/src/commercetools/platform/models/_schemas/approval_flow.py @@ -15,6 +15,7 @@ from ... import models from ..approval_flow import ApprovalFlowStatus from .common import BaseResourceSchema +from .type import FieldContainerField # Fields @@ -100,12 +101,20 @@ class ApprovalFlowSchema(BaseResourceSchema): load_default=None, data_key="currentTierPendingApprovers", ) + custom = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalFlow(**data) @@ -125,6 +134,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalFlowApproval(**data) @@ -148,6 +158,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalFlowPagedQueryResponse(**data) @@ -170,6 +181,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalFlowRejection(**data) @@ -182,6 +194,12 @@ class ApprovalFlowUpdateSchema(helpers.BaseSchema): discriminator_schemas={ "approve": helpers.absmod(__name__, ".ApprovalFlowApproveActionSchema"), "reject": helpers.absmod(__name__, ".ApprovalFlowRejectActionSchema"), + "setCustomField": helpers.absmod( + __name__, ".ApprovalFlowSetCustomFieldActionSchema" + ), + "setCustomType": helpers.absmod( + __name__, ".ApprovalFlowSetCustomTypeActionSchema" + ), }, ), allow_none=True, @@ -193,6 +211,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalFlowUpdate(**data) @@ -209,6 +228,7 @@ def post_load(self, data, **kwargs): class ApprovalFlowApproveActionSchema(ApprovalFlowUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -230,3 +250,42 @@ class Meta: def post_load(self, data, **kwargs): del data["action"] return models.ApprovalFlowRejectAction(**data) + + +class ApprovalFlowSetCustomFieldActionSchema(ApprovalFlowUpdateActionSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ApprovalFlowSetCustomFieldAction(**data) + + +class ApprovalFlowSetCustomTypeActionSchema(ApprovalFlowUpdateActionSchema): + type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.TypeResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + fields = FieldContainerField( + allow_none=True, + values=marshmallow.fields.Raw(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ApprovalFlowSetCustomTypeAction(**data) diff --git a/src/commercetools/platform/models/_schemas/approval_rule.py b/src/commercetools/platform/models/_schemas/approval_rule.py index 3c3bd391..1361491c 100644 --- a/src/commercetools/platform/models/_schemas/approval_rule.py +++ b/src/commercetools/platform/models/_schemas/approval_rule.py @@ -76,6 +76,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalRule(**data) @@ -110,6 +111,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalRuleDraft(**data) @@ -133,6 +135,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalRulePagedQueryResponse(**data) @@ -171,6 +174,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApprovalRuleUpdate(**data) @@ -302,6 +306,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApproverConjunction(**data) @@ -320,6 +325,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApproverConjunctionDraft(**data) @@ -338,6 +344,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApproverDisjunction(**data) @@ -356,6 +363,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApproverDisjunctionDraft(**data) @@ -373,6 +381,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApproverHierarchy(**data) @@ -390,6 +399,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ApproverHierarchyDraft(**data) @@ -409,6 +419,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.RuleApprover(**data) @@ -428,6 +439,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.RuleApproverDraft(**data) @@ -447,6 +459,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.RuleRequester(**data) @@ -466,4 +479,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.RuleRequesterDraft(**data) diff --git a/src/commercetools/platform/models/_schemas/associate_role.py b/src/commercetools/platform/models/_schemas/associate_role.py index 47259b71..ffd8cb55 100644 --- a/src/commercetools/platform/models/_schemas/associate_role.py +++ b/src/commercetools/platform/models/_schemas/associate_role.py @@ -69,6 +69,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssociateRole(**data) @@ -102,10 +103,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssociateRoleDraft(**data) class AssociateRoleKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -135,6 +138,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssociateRolePagedQueryResponse(**data) @@ -157,6 +161,7 @@ def post_load(self, data, **kwargs): class AssociateRoleResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -205,6 +210,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssociateRoleUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/attribute_group.py b/src/commercetools/platform/models/_schemas/attribute_group.py index fc7d6bf3..fa7106b5 100644 --- a/src/commercetools/platform/models/_schemas/attribute_group.py +++ b/src/commercetools/platform/models/_schemas/attribute_group.py @@ -69,6 +69,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeGroup(**data) @@ -100,6 +101,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeGroupDraft(**data) @@ -123,6 +125,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeGroupPagedQueryResponse(**data) @@ -145,6 +148,7 @@ def post_load(self, data, **kwargs): class AttributeGroupResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -188,6 +192,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeGroupUpdate(**data) @@ -211,6 +216,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeReference(**data) diff --git a/src/commercetools/platform/models/_schemas/business_unit.py b/src/commercetools/platform/models/_schemas/business_unit.py index 96eb8e18..983b4018 100644 --- a/src/commercetools/platform/models/_schemas/business_unit.py +++ b/src/commercetools/platform/models/_schemas/business_unit.py @@ -16,6 +16,7 @@ from ..business_unit import ( AssociateRoleDeprecated, AssociateRoleInheritanceMode, + BusinessUnitApprovalRuleMode, BusinessUnitAssociateMode, BusinessUnitStatus, BusinessUnitStoreMode, @@ -63,6 +64,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Associate(**data) @@ -95,6 +97,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssociateDraft(**data) @@ -117,6 +120,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssociateRoleAssignment(**data) @@ -143,6 +147,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssociateRoleAssignmentDraft(**data) @@ -274,6 +279,13 @@ class BusinessUnitSchema(BaseResourceSchema): load_default=None, data_key="topLevelUnit", ) + approval_rule_mode = marshmallow_enum.EnumField( + BusinessUnitApprovalRuleMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="approvalRuleMode", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -339,6 +351,14 @@ class BusinessUnitDraftSchema(helpers.BaseSchema): metadata={"omit_empty": True}, load_default=None, ) + approval_rule_mode = marshmallow_enum.EnumField( + BusinessUnitApprovalRuleMode, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="approvalRuleMode", + ) addresses = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.BaseAddressSchema"), allow_none=True, @@ -391,6 +411,7 @@ def post_load(self, data, **kwargs): class BusinessUnitKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -425,6 +446,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.BusinessUnitPagedQueryResponse(**data) @@ -450,6 +472,7 @@ def post_load(self, data, **kwargs): class BusinessUnitResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -484,6 +507,9 @@ class BusinessUnitUpdateSchema(helpers.BaseSchema): "changeAddress": helpers.absmod( __name__, ".BusinessUnitChangeAddressActionSchema" ), + "changeApprovalRuleMode": helpers.absmod( + __name__, ".BusinessUnitChangeApprovalRuleModeActionSchema" + ), "changeAssociate": helpers.absmod( __name__, ".BusinessUnitChangeAssociateActionSchema" ), @@ -555,6 +581,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.BusinessUnitUpdate(**data) @@ -571,6 +598,7 @@ def post_load(self, data, **kwargs): class CompanySchema(BusinessUnitSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -581,6 +609,7 @@ def post_load(self, data, **kwargs): class CompanyDraftSchema(BusinessUnitDraftSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -591,6 +620,7 @@ def post_load(self, data, **kwargs): class DivisionSchema(BusinessUnitSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -639,6 +669,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.InheritedAssociate(**data) @@ -664,6 +695,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.InheritedAssociateRoleAssignment(**data) @@ -793,6 +825,24 @@ def post_load(self, data, **kwargs): return models.BusinessUnitChangeAddressAction(**data) +class BusinessUnitChangeApprovalRuleModeActionSchema(BusinessUnitUpdateActionSchema): + approval_rule_mode = marshmallow_enum.EnumField( + BusinessUnitApprovalRuleMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="approvalRuleMode", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.BusinessUnitChangeApprovalRuleModeAction(**data) + + class BusinessUnitChangeAssociateActionSchema(BusinessUnitUpdateActionSchema): associate = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".AssociateDraftSchema"), @@ -1170,7 +1220,6 @@ class BusinessUnitSetStoresActionSchema(BusinessUnitUpdateActionSchema): allow_none=True, many=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) diff --git a/src/commercetools/platform/models/_schemas/cart.py b/src/commercetools/platform/models/_schemas/cart.py index 06575377..9135cee1 100644 --- a/src/commercetools/platform/models/_schemas/cart.py +++ b/src/commercetools/platform/models/_schemas/cart.py @@ -320,6 +320,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Cart(**data) @@ -543,6 +544,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartDraft(**data) @@ -566,6 +568,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartPagedQueryResponse(**data) @@ -588,6 +591,7 @@ def post_load(self, data, **kwargs): class CartResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -813,6 +817,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartUpdate(**data) @@ -943,6 +948,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomLineItem(**data) @@ -1002,6 +1008,7 @@ class CustomLineItemDraftSchema(helpers.BaseSchema): CustomLineItemPriceMode, by_value=True, allow_none=True, + metadata={"omit_empty": True}, load_default=None, data_key="priceMode", ) @@ -1011,6 +1018,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomLineItemDraft(**data) @@ -1086,6 +1094,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomShippingDraft(**data) @@ -1142,6 +1151,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DirectDiscount(**data) @@ -1151,16 +1161,16 @@ class DirectDiscountDraftSchema(helpers.BaseSchema): discriminator_field=("type", "type"), discriminator_schemas={ "absolute": helpers.absmod( - __name__, ".cart_discount.CartDiscountValueAbsoluteSchema" + __name__, ".cart_discount.CartDiscountValueAbsoluteDraftSchema" ), "fixed": helpers.absmod( - __name__, ".cart_discount.CartDiscountValueFixedSchema" + __name__, ".cart_discount.CartDiscountValueFixedDraftSchema" ), "giftLineItem": helpers.absmod( - __name__, ".cart_discount.CartDiscountValueGiftLineItemSchema" + __name__, ".cart_discount.CartDiscountValueGiftLineItemDraftSchema" ), "relative": helpers.absmod( - __name__, ".cart_discount.CartDiscountValueRelativeSchema" + __name__, ".cart_discount.CartDiscountValueRelativeDraftSchema" ), }, load_default=None, @@ -1197,10 +1207,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DirectDiscountDraft(**data) class DirectDiscountReferenceSchema(ReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1227,6 +1239,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountCodeInfo(**data) @@ -1289,6 +1302,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountOnTotalPrice(**data) @@ -1345,6 +1359,9 @@ class DiscountedLineItemPortionSchema(helpers.BaseSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -1396,9 +1413,121 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedLineItemPortion(**data) +class DiscountedLineItemPortionDraftSchema(helpers.BaseSchema): + discount = helpers.Discriminator( + allow_none=True, + discriminator_field=("typeId", "type_id"), + discriminator_schemas={ + "associate-role": helpers.absmod( + __name__, ".associate_role.AssociateRoleReferenceSchema" + ), + "attribute-group": helpers.absmod( + __name__, ".attribute_group.AttributeGroupReferenceSchema" + ), + "business-unit": helpers.absmod( + __name__, ".business_unit.BusinessUnitReferenceSchema" + ), + "cart-discount": helpers.absmod( + __name__, ".cart_discount.CartDiscountReferenceSchema" + ), + "cart": helpers.absmod(__name__, ".CartReferenceSchema"), + "direct-discount": helpers.absmod( + __name__, ".DirectDiscountReferenceSchema" + ), + "category": helpers.absmod(__name__, ".category.CategoryReferenceSchema"), + "channel": helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + "key-value-document": helpers.absmod( + __name__, ".custom_object.CustomObjectReferenceSchema" + ), + "customer-group": helpers.absmod( + __name__, ".customer_group.CustomerGroupReferenceSchema" + ), + "customer-email-token": helpers.absmod( + __name__, ".customer.CustomerEmailTokenReferenceSchema" + ), + "customer-password-token": helpers.absmod( + __name__, ".customer.CustomerPasswordTokenReferenceSchema" + ), + "customer": helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + "discount-code": helpers.absmod( + __name__, ".discount_code.DiscountCodeReferenceSchema" + ), + "inventory-entry": helpers.absmod( + __name__, ".inventory.InventoryEntryReferenceSchema" + ), + "order-edit": helpers.absmod( + __name__, ".order_edit.OrderEditReferenceSchema" + ), + "order": helpers.absmod(__name__, ".order.OrderReferenceSchema"), + "payment": helpers.absmod(__name__, ".payment.PaymentReferenceSchema"), + "product-discount": helpers.absmod( + __name__, ".product_discount.ProductDiscountReferenceSchema" + ), + "product-selection": helpers.absmod( + __name__, ".product_selection.ProductSelectionReferenceSchema" + ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), + "product-type": helpers.absmod( + __name__, ".product_type.ProductTypeReferenceSchema" + ), + "product": helpers.absmod(__name__, ".product.ProductReferenceSchema"), + "quote-request": helpers.absmod( + __name__, ".quote_request.QuoteRequestReferenceSchema" + ), + "quote": helpers.absmod(__name__, ".quote.QuoteReferenceSchema"), + "review": helpers.absmod(__name__, ".review.ReviewReferenceSchema"), + "shipping-method": helpers.absmod( + __name__, ".shipping_method.ShippingMethodReferenceSchema" + ), + "shopping-list": helpers.absmod( + __name__, ".shopping_list.ShoppingListReferenceSchema" + ), + "staged-quote": helpers.absmod( + __name__, ".staged_quote.StagedQuoteReferenceSchema" + ), + "standalone-price": helpers.absmod( + __name__, ".standalone_price.StandalonePriceReferenceSchema" + ), + "state": helpers.absmod(__name__, ".state.StateReferenceSchema"), + "store": helpers.absmod(__name__, ".store.StoreReferenceSchema"), + "tax-category": helpers.absmod( + __name__, ".tax_category.TaxCategoryReferenceSchema" + ), + "type": helpers.absmod(__name__, ".type.TypeReferenceSchema"), + "zone": helpers.absmod(__name__, ".zone.ZoneReferenceSchema"), + }, + load_default=None, + ) + discounted_amount = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "centPrecision": helpers.absmod( + __name__, ".common.CentPrecisionMoneyDraftSchema" + ), + "highPrecision": helpers.absmod( + __name__, ".common.HighPrecisionMoneyDraftSchema" + ), + }, + load_default=None, + data_key="discountedAmount", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.DiscountedLineItemPortionDraft(**data) + + class DiscountedLineItemPriceSchema(helpers.BaseSchema): value = helpers.Discriminator( allow_none=True, @@ -1427,6 +1556,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedLineItemPrice(**data) @@ -1445,6 +1575,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedLineItemPriceForQuantity(**data) @@ -1475,6 +1606,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedTotalPricePortion(**data) @@ -1498,6 +1630,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExternalLineItemTotalPrice(**data) @@ -1522,6 +1655,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExternalTaxAmountDraft(**data) @@ -1555,6 +1689,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExternalTaxRateDraft(**data) @@ -1573,6 +1708,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ItemShippingDetails(**data) @@ -1590,6 +1726,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ItemShippingDetailsDraft(**data) @@ -1610,6 +1747,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ItemShippingTarget(**data) @@ -1784,6 +1922,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LineItem(**data) @@ -1893,6 +2032,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LineItemDraft(**data) @@ -1914,6 +2054,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MethodExternalTaxRateDraft(**data) @@ -1935,6 +2076,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MethodTaxRate(**data) @@ -1956,6 +2098,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MethodTaxedPrice(**data) @@ -2012,6 +2155,9 @@ class ReplicaCartDraftSchema(helpers.BaseSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -2052,6 +2198,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReplicaCartDraft(**data) @@ -2100,6 +2247,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Shipping(**data) @@ -2164,6 +2312,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingDraft(**data) @@ -2247,6 +2396,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingInfo(**data) @@ -2344,6 +2494,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxPortion(**data) @@ -2364,6 +2515,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxPortionDraft(**data) @@ -2382,6 +2534,14 @@ class TaxedItemPriceSchema(helpers.BaseSchema): load_default=None, data_key="totalGross", ) + tax_portions = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".TaxPortionSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="taxPortions", + ) total_tax = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.CentPrecisionMoneySchema"), allow_none=True, @@ -2396,6 +2556,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxedItemPrice(**data) @@ -2436,6 +2597,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxedPrice(**data) @@ -2462,12 +2624,28 @@ class TaxedPriceDraftSchema(helpers.BaseSchema): load_default=None, data_key="taxPortions", ) + total_tax = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "centPrecision": helpers.absmod( + __name__, ".common.CentPrecisionMoneyDraftSchema" + ), + "highPrecision": helpers.absmod( + __name__, ".common.HighPrecisionMoneyDraftSchema" + ), + }, + metadata={"omit_empty": True}, + load_default=None, + data_key="totalTax", + ) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxedPriceDraft(**data) @@ -2715,6 +2893,15 @@ class CartAddLineItemActionSchema(CartUpdateActionSchema): load_default=None, data_key="externalTaxRate", ) + per_method_external_tax_rate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".MethodExternalTaxRateDraftSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="perMethodExternalTaxRate", + ) inventory_mode = marshmallow_enum.EnumField( InventoryMode, by_value=True, @@ -3103,6 +3290,7 @@ def post_load(self, data, **kwargs): class CartFreezeCartActionSchema(CartUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4341,6 +4529,7 @@ def post_load(self, data, **kwargs): class CartUnfreezeCartActionSchema(CartUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4365,3 +4554,124 @@ class Meta: def post_load(self, data, **kwargs): del data["action"] return models.CartUpdateItemShippingAddressAction(**data) + + +class ProductTailoringUpdateSchema(helpers.BaseSchema): + version = marshmallow.fields.Integer(allow_none=True, load_default=None) + actions = marshmallow.fields.List( + helpers.Discriminator( + allow_none=True, + discriminator_field=("action", "action"), + discriminator_schemas={ + "addAsset": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringAddAssetActionSchema" + ), + "addExternalImage": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringAddExternalImageActionSchema", + ), + "addVariant": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringAddVariantActionSchema", + ), + "changeAssetName": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringChangeAssetNameActionSchema", + ), + "changeAssetOrder": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringChangeAssetOrderActionSchema", + ), + "moveImageToPosition": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringMoveImageToPositionActionSchema", + ), + "publish": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringPublishActionSchema" + ), + "removeAsset": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringRemoveAssetActionSchema", + ), + "removeImage": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringRemoveImageActionSchema", + ), + "removeVariant": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringRemoveVariantActionSchema", + ), + "setAssetCustomField": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetAssetCustomFieldActionSchema", + ), + "setAssetCustomType": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetAssetCustomTypeActionSchema", + ), + "setAssetDescription": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetAssetDescriptionActionSchema", + ), + "setAssetKey": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetAssetKeyActionSchema", + ), + "setAssetSources": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetAssetSourcesActionSchema", + ), + "setAssetTags": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetAssetTagsActionSchema", + ), + "setDescription": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetDescriptionActionSchema", + ), + "setImages": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetExternalImagesActionSchema", + ), + "setImageLabel": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetImageLabelActionSchema", + ), + "setMetaAttributes": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetMetaAttributesActionSchema", + ), + "setMetaDescription": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetMetaDescriptionActionSchema", + ), + "setMetaKeywords": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetMetaKeywordsActionSchema", + ), + "setMetaTitle": helpers.absmod( + __name__, + ".product_tailoring.ProductTailoringSetMetaTitleActionSchema", + ), + "setName": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringSetNameActionSchema" + ), + "setSlug": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringSetSlugActionSchema" + ), + "unpublish": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringUnpublishActionSchema" + ), + }, + ), + allow_none=True, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductTailoringUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/cart_discount.py b/src/commercetools/platform/models/_schemas/cart_discount.py index fdaae72d..7ad0512f 100644 --- a/src/commercetools/platform/models/_schemas/cart_discount.py +++ b/src/commercetools/platform/models/_schemas/cart_discount.py @@ -183,6 +183,9 @@ class CartDiscountSchema(BaseResourceSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -236,6 +239,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartDiscount(**data) @@ -354,6 +358,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartDiscountDraft(**data) @@ -377,6 +382,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartDiscountPagedQueryResponse(**data) @@ -399,6 +405,7 @@ def post_load(self, data, **kwargs): class CartDiscountResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -445,6 +452,7 @@ def post_load(self, data, **kwargs): class CartDiscountShippingCostTargetSchema(CartDiscountTargetSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -455,6 +463,7 @@ def post_load(self, data, **kwargs): class CartDiscountTotalPriceTargetSchema(CartDiscountTargetSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -534,6 +543,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartDiscountUpdate(**data) @@ -1085,7 +1095,6 @@ class CartDiscountSetStoresActionSchema(CartDiscountUpdateActionSchema): allow_none=True, many=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) diff --git a/src/commercetools/platform/models/_schemas/category.py b/src/commercetools/platform/models/_schemas/category.py index 999c0643..db9cbeb9 100644 --- a/src/commercetools/platform/models/_schemas/category.py +++ b/src/commercetools/platform/models/_schemas/category.py @@ -127,6 +127,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Category(**data) @@ -211,6 +212,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CategoryDraft(**data) @@ -234,6 +236,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CategoryPagedQueryResponse(**data) @@ -256,6 +259,7 @@ def post_load(self, data, **kwargs): class CategoryResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -345,6 +349,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CategoryUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/channel.py b/src/commercetools/platform/models/_schemas/channel.py index cd519d0e..8562e8ec 100644 --- a/src/commercetools/platform/models/_schemas/channel.py +++ b/src/commercetools/platform/models/_schemas/channel.py @@ -100,6 +100,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Channel(**data) @@ -153,6 +154,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ChannelDraft(**data) @@ -176,6 +178,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ChannelPagedQueryResponse(**data) @@ -198,6 +201,7 @@ def post_load(self, data, **kwargs): class ChannelResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -255,6 +259,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ChannelUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/common.py b/src/commercetools/platform/models/_schemas/common.py index d18733d5..f817b440 100644 --- a/src/commercetools/platform/models/_schemas/common.py +++ b/src/commercetools/platform/models/_schemas/common.py @@ -13,11 +13,12 @@ from commercetools import helpers from ... import models -from ..common import MoneyType, ReferenceTypeId +from ..common import AttributionSource, MoneyType, ReferenceTypeId # Fields class LocalizedStringField(marshmallow.fields.Dict): + def _deserialize(self, value, attr, data, **kwargs): result = super()._deserialize(value, attr, data) return models.LocalizedString(**result) @@ -47,6 +48,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PagedQueryResponse(**data) @@ -65,6 +67,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Update(**data) @@ -76,6 +79,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.UpdateAction(**data) @@ -121,6 +125,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Asset(**data) @@ -133,6 +138,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssetDimensions(**data) @@ -177,6 +183,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssetDraft(**data) @@ -204,9 +211,30 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssetSource(**data) +class AttributionSchema(helpers.BaseSchema): + client_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="clientId", + ) + source = marshmallow_enum.EnumField( + AttributionSource, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.Attribution(**data) + + class BaseAddressSchema(helpers.BaseSchema): id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None @@ -314,6 +342,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.BaseAddress(**data) @@ -331,6 +360,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Address(**data) @@ -348,6 +378,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AddressDraft(**data) @@ -366,6 +397,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.BaseResource(**data) @@ -408,15 +440,26 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ClientLogging(**data) class CreatedBySchema(ClientLoggingSchema): + attributed_to = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".AttributionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="attributedTo", + ) + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CreatedBy(**data) @@ -444,6 +487,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedPrice(**data) @@ -468,6 +512,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedPriceDraft(**data) @@ -514,6 +559,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Image(**data) @@ -526,6 +572,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ImageDimensions(**data) @@ -549,11 +596,21 @@ def post_load(self, data, **kwargs): class LastModifiedBySchema(ClientLoggingSchema): + attributed_to = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".AttributionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="attributedTo", + ) + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LastModifiedBy(**data) @@ -570,6 +627,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Money(**data) @@ -645,6 +703,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Price(**data) @@ -718,6 +777,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PriceDraft(**data) @@ -740,6 +800,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PriceTier(**data) @@ -759,6 +820,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PriceTierDraft(**data) @@ -830,6 +892,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QueryPrice(**data) @@ -948,6 +1011,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ScopedPrice(**data) @@ -969,6 +1033,7 @@ def post_load(self, data, **kwargs): class CentPrecisionMoneySchema(TypedMoneySchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1017,6 +1082,7 @@ def post_load(self, data, **kwargs): class CentPrecisionMoneyDraftSchema(TypedMoneyDraftSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/custom_object.py b/src/commercetools/platform/models/_schemas/custom_object.py index 4db5a55b..c2194deb 100644 --- a/src/commercetools/platform/models/_schemas/custom_object.py +++ b/src/commercetools/platform/models/_schemas/custom_object.py @@ -46,6 +46,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomObject(**data) @@ -62,6 +63,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomObjectDraft(**data) @@ -85,6 +87,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomObjectPagedQueryResponse(**data) diff --git a/src/commercetools/platform/models/_schemas/customer.py b/src/commercetools/platform/models/_schemas/customer.py index 8aea32b9..d49de26b 100644 --- a/src/commercetools/platform/models/_schemas/customer.py +++ b/src/commercetools/platform/models/_schemas/customer.py @@ -161,7 +161,6 @@ class CustomerSchema(BaseResourceSchema): allow_none=True, many=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) authentication_mode = marshmallow_enum.EnumField( @@ -177,6 +176,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Customer(**data) @@ -195,6 +195,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerChangePassword(**data) @@ -212,6 +213,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerCreateEmailToken(**data) @@ -229,6 +231,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerCreatePasswordResetToken(**data) @@ -396,10 +399,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerDraft(**data) class CustomerEmailTokenReferenceSchema(ReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -422,6 +427,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerEmailVerify(**data) @@ -445,10 +451,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerPagedQueryResponse(**data) class CustomerPasswordTokenReferenceSchema(ReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -492,10 +500,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerResetPassword(**data) class CustomerResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -525,6 +535,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerSignInResult(**data) @@ -571,6 +582,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerSignin(**data) @@ -598,6 +610,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerToken(**data) @@ -700,6 +713,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerUpdate(**data) @@ -729,6 +743,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCustomerChangePassword(**data) @@ -742,6 +757,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCustomerEmailVerify(**data) @@ -758,6 +774,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCustomerResetPassword(**data) @@ -784,6 +801,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCustomerSignin(**data) @@ -1333,7 +1351,6 @@ class CustomerSetStoresActionSchema(CustomerUpdateActionSchema): allow_none=True, many=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) diff --git a/src/commercetools/platform/models/_schemas/customer_group.py b/src/commercetools/platform/models/_schemas/customer_group.py index 2d993de3..f91bae0c 100644 --- a/src/commercetools/platform/models/_schemas/customer_group.py +++ b/src/commercetools/platform/models/_schemas/customer_group.py @@ -55,6 +55,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerGroup(**data) @@ -78,6 +79,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerGroupDraft(**data) @@ -101,6 +103,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerGroupPagedQueryResponse(**data) @@ -123,6 +126,7 @@ def post_load(self, data, **kwargs): class CustomerGroupResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -160,6 +164,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomerGroupUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/customer_search.py b/src/commercetools/platform/models/_schemas/customer_search.py new file mode 100644 index 00000000..b32e85f3 --- /dev/null +++ b/src/commercetools/platform/models/_schemas/customer_search.py @@ -0,0 +1,140 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from ..project import CustomerIndexingStatus + +# Fields + + +# Marshmallow Schemas +class CustomerIndexingProgressSchema(helpers.BaseSchema): + indexed = marshmallow.fields.Integer(allow_none=True, load_default=None) + failed = marshmallow.fields.Integer(allow_none=True, load_default=None) + estimated_total = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="estimatedTotal" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomerIndexingProgress(**data) + + +class CustomerPagedSearchResponseSchema(helpers.BaseSchema): + total = marshmallow.fields.Integer(allow_none=True, load_default=None) + limit = marshmallow.fields.Integer(allow_none=True, load_default=None) + offset = marshmallow.fields.Integer(allow_none=True, load_default=None) + results = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".CustomerSearchResultSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomerPagedSearchResponse(**data) + + +class CustomerSearchIndexingStatusResponseSchema(helpers.BaseSchema): + status = marshmallow_enum.EnumField( + CustomerIndexingStatus, by_value=True, allow_none=True, load_default=None + ) + states = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".CustomerIndexingProgressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + started_at = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="startedAt", + ) + last_modified_at = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="lastModifiedAt", + ) + retry_count = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="retryCount", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomerSearchIndexingStatusResponse(**data) + + +class CustomerSearchRequestSchema(helpers.BaseSchema): + query = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchQuerySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + sort = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchSortingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + limit = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + offset = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomerSearchRequest(**data) + + +class CustomerSearchResultSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + relevance = marshmallow.fields.Float(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.CustomerSearchResult(**data) diff --git a/src/commercetools/platform/models/_schemas/discount_code.py b/src/commercetools/platform/models/_schemas/discount_code.py index 3fb7e397..5d15dda0 100644 --- a/src/commercetools/platform/models/_schemas/discount_code.py +++ b/src/commercetools/platform/models/_schemas/discount_code.py @@ -27,6 +27,9 @@ # Marshmallow Schemas class DiscountCodeSchema(BaseResourceSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) last_modified_by = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.LastModifiedBySchema"), allow_none=True, @@ -130,6 +133,9 @@ class DiscountCodeSchema(BaseResourceSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -209,10 +215,14 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountCode(**data) class DiscountCodeDraftSchema(helpers.BaseSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) name = LocalizedStringField( allow_none=True, values=marshmallow.fields.String(allow_none=True), @@ -291,6 +301,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountCodeDraft(**data) @@ -314,6 +325,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountCodePagedQueryResponse(**data) @@ -336,6 +348,7 @@ def post_load(self, data, **kwargs): class DiscountCodeResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -373,6 +386,7 @@ class DiscountCodeUpdateSchema(helpers.BaseSchema): "setDescription": helpers.absmod( __name__, ".DiscountCodeSetDescriptionActionSchema" ), + "setKey": helpers.absmod(__name__, ".DiscountCodeSetKeyActionSchema"), "setMaxApplications": helpers.absmod( __name__, ".DiscountCodeSetMaxApplicationsActionSchema" ), @@ -400,6 +414,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountCodeUpdate(**data) @@ -537,6 +552,20 @@ def post_load(self, data, **kwargs): return models.DiscountCodeSetDescriptionAction(**data) +class DiscountCodeSetKeyActionSchema(DiscountCodeUpdateActionSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.DiscountCodeSetKeyAction(**data) + + class DiscountCodeSetMaxApplicationsActionSchema(DiscountCodeUpdateActionSchema): max_applications = marshmallow.fields.Integer( allow_none=True, diff --git a/src/commercetools/platform/models/_schemas/error.py b/src/commercetools/platform/models/_schemas/error.py index 4f34be5f..46538ff5 100644 --- a/src/commercetools/platform/models/_schemas/error.py +++ b/src/commercetools/platform/models/_schemas/error.py @@ -33,6 +33,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ErrorByExtension(**data) @@ -68,6 +69,7 @@ def post_dump(self, data, original_data, **kwargs): class AnonymousIdAlreadyInUseErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -226,6 +228,7 @@ def post_dump(self, data, original_data, **kwargs): class BadGatewayErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -275,6 +278,7 @@ def post_dump(self, data, original_data, **kwargs): class ContentTooLargeErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -544,6 +548,9 @@ class DuplicateFieldWithConflictingResourceErrorSchema(ErrorObjectSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -834,6 +841,7 @@ def post_dump(self, data, original_data, **kwargs): class EnumValueIsUsedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -855,6 +863,7 @@ def post_dump(self, data, original_data, **kwargs): class EnumValuesMustMatchErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1004,6 +1013,7 @@ class ErrorResponseSchema(helpers.BaseSchema): "LanguageUsedInStores": helpers.absmod( __name__, ".LanguageUsedInStoresErrorSchema" ), + "LockedField": helpers.absmod(__name__, ".LockedFieldErrorSchema"), "MatchingPriceNotFound": helpers.absmod( __name__, ".MatchingPriceNotFoundErrorSchema" ), @@ -1026,7 +1036,6 @@ class ErrorResponseSchema(helpers.BaseSchema): "NoMatchingProductDiscountFound": helpers.absmod( __name__, ".NoMatchingProductDiscountFoundErrorSchema" ), - "NotEnabled": helpers.absmod(__name__, ".NotEnabledErrorSchema"), "ObjectNotFound": helpers.absmod( __name__, ".ObjectNotFoundErrorSchema" ), @@ -1097,6 +1106,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ErrorResponse(**data) @@ -1111,6 +1121,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AuthErrorResponse(**data) @@ -1322,6 +1333,7 @@ def post_dump(self, data, original_data, **kwargs): class ExternalOAuthFailedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1343,6 +1355,7 @@ def post_dump(self, data, original_data, **kwargs): class FeatureRemovedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1364,6 +1377,7 @@ def post_dump(self, data, original_data, **kwargs): class GeneralErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1385,6 +1399,7 @@ def post_dump(self, data, original_data, **kwargs): class InsufficientScopeErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1406,6 +1421,7 @@ def post_dump(self, data, original_data, **kwargs): class InternalConstraintViolatedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1427,6 +1443,7 @@ def post_dump(self, data, original_data, **kwargs): class InvalidCredentialsErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1448,6 +1465,7 @@ def post_dump(self, data, original_data, **kwargs): class InvalidCurrentPasswordErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1502,6 +1520,7 @@ def post_dump(self, data, original_data, **kwargs): class InvalidInputErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1574,6 +1593,7 @@ def post_dump(self, data, original_data, **kwargs): class InvalidOperationErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1595,6 +1615,7 @@ def post_dump(self, data, original_data, **kwargs): class InvalidSubjectErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1616,6 +1637,7 @@ def post_dump(self, data, original_data, **kwargs): class InvalidTokenErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1637,6 +1659,7 @@ def post_dump(self, data, original_data, **kwargs): class LanguageUsedInStoresErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1657,6 +1680,29 @@ def post_dump(self, data, original_data, **kwargs): return field.post_dump(data, original_data) +class LockedFieldErrorSchema(ErrorObjectSchema): + field = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.pre_load + def pre_load(self, data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.pre_load(self, data) + + @marshmallow.post_load(pass_original=True) + def post_load(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + data = field.post_load(data, original_data) + return models.LockedFieldError(**data) + + @marshmallow.post_dump(pass_original=True) + def post_dump(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.post_dump(data, original_data) + + class MatchingPriceNotFoundErrorSchema(ErrorObjectSchema): product_id = marshmallow.fields.String( allow_none=True, load_default=None, data_key="productId" @@ -1707,6 +1753,7 @@ def post_dump(self, data, original_data, **kwargs): class MaxCartDiscountsReachedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1757,6 +1804,7 @@ def post_dump(self, data, original_data, **kwargs): class MaxStoreReferencesReachedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1845,6 +1893,7 @@ def post_dump(self, data, original_data, **kwargs): class MoneyOverflowErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1866,27 +1915,7 @@ def post_dump(self, data, original_data, **kwargs): class NoMatchingProductDiscountFoundErrorSchema(ErrorObjectSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.pre_load - def pre_load(self, data, **kwargs): - field = typing.cast(helpers.RegexField, self.fields["_regex"]) - return field.pre_load(self, data) - - @marshmallow.post_load(pass_original=True) - def post_load(self, data, original_data, **kwargs): - field = typing.cast(helpers.RegexField, self.fields["_regex"]) - data = field.post_load(data, original_data) - return models.NoMatchingProductDiscountFoundError(**data) - @marshmallow.post_dump(pass_original=True) - def post_dump(self, data, original_data, **kwargs): - field = typing.cast(helpers.RegexField, self.fields["_regex"]) - return field.post_dump(data, original_data) - - -class NotEnabledErrorSchema(ErrorObjectSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -1899,7 +1928,7 @@ def pre_load(self, data, **kwargs): def post_load(self, data, original_data, **kwargs): field = typing.cast(helpers.RegexField, self.fields["_regex"]) data = field.post_load(data, original_data) - return models.NotEnabledError(**data) + return models.NoMatchingProductDiscountFoundError(**data) @marshmallow.post_dump(pass_original=True) def post_dump(self, data, original_data, **kwargs): @@ -1908,6 +1937,7 @@ def post_dump(self, data, original_data, **kwargs): class ObjectNotFoundErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1960,6 +1990,7 @@ def post_dump(self, data, original_data, **kwargs): class OverCapacityErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2058,6 +2089,7 @@ def post_dump(self, data, original_data, **kwargs): class PendingOperationErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2213,6 +2245,7 @@ def post_dump(self, data, original_data, **kwargs): class QueryComplexityLimitExceededErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2234,6 +2267,7 @@ def post_dump(self, data, original_data, **kwargs): class QueryTimedOutErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2343,6 +2377,7 @@ def post_dump(self, data, original_data, **kwargs): class ResourceNotFoundErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2364,6 +2399,7 @@ def post_dump(self, data, original_data, **kwargs): class ResourceSizeLimitExceededErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2385,6 +2421,7 @@ def post_dump(self, data, original_data, **kwargs): class SearchDeactivatedErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2406,6 +2443,7 @@ def post_dump(self, data, original_data, **kwargs): class SearchExecutionFailureErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2427,6 +2465,7 @@ def post_dump(self, data, original_data, **kwargs): class SearchFacetPathNotFoundErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2448,6 +2487,7 @@ def post_dump(self, data, original_data, **kwargs): class SearchIndexingInProgressErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2469,6 +2509,7 @@ def post_dump(self, data, original_data, **kwargs): class SemanticErrorErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2490,6 +2531,7 @@ def post_dump(self, data, original_data, **kwargs): class ShippingMethodDoesNotMatchCartErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2540,6 +2582,7 @@ def post_dump(self, data, original_data, **kwargs): class SyntaxErrorErrorSchema(ErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2584,6 +2627,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.VariantValues(**data) @@ -2618,6 +2662,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLAnonymousIdAlreadyInUseErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2776,6 +2821,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLBadGatewayErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2825,6 +2871,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLContentTooLargeErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3094,6 +3141,9 @@ class GraphQLDuplicateFieldWithConflictingResourceErrorSchema(GraphQLErrorObject "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -3384,6 +3434,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLEnumValueIsUsedErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3405,6 +3456,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLEnumValuesMustMatchErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3593,6 +3645,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLExternalOAuthFailedErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3614,6 +3667,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLFeatureRemovedErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3635,6 +3689,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLGeneralErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3656,6 +3711,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInsufficientScopeErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3677,6 +3733,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInternalConstraintViolatedErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3698,6 +3755,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInvalidCredentialsErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3719,6 +3777,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInvalidCurrentPasswordErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3773,6 +3832,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInvalidInputErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3845,6 +3905,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInvalidOperationErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3866,6 +3927,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInvalidSubjectErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3887,6 +3949,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLInvalidTokenErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3908,6 +3971,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLLanguageUsedInStoresErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -3928,6 +3992,29 @@ def post_dump(self, data, original_data, **kwargs): return field.post_dump(data, original_data) +class GraphQLLockedFieldErrorSchema(GraphQLErrorObjectSchema): + field = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.pre_load + def pre_load(self, data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.pre_load(self, data) + + @marshmallow.post_load(pass_original=True) + def post_load(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + data = field.post_load(data, original_data) + return models.GraphQLLockedFieldError(**data) + + @marshmallow.post_dump(pass_original=True) + def post_dump(self, data, original_data, **kwargs): + field = typing.cast(helpers.RegexField, self.fields["_regex"]) + return field.post_dump(data, original_data) + + class GraphQLMatchingPriceNotFoundErrorSchema(GraphQLErrorObjectSchema): product_id = marshmallow.fields.String( allow_none=True, load_default=None, data_key="productId" @@ -3978,6 +4065,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLMaxCartDiscountsReachedErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4028,6 +4116,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLMaxStoreReferencesReachedErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4116,6 +4205,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLMoneyOverflowErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4137,27 +4227,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLNoMatchingProductDiscountFoundErrorSchema(GraphQLErrorObjectSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.pre_load - def pre_load(self, data, **kwargs): - field = typing.cast(helpers.RegexField, self.fields["_regex"]) - return field.pre_load(self, data) - - @marshmallow.post_load(pass_original=True) - def post_load(self, data, original_data, **kwargs): - field = typing.cast(helpers.RegexField, self.fields["_regex"]) - data = field.post_load(data, original_data) - return models.GraphQLNoMatchingProductDiscountFoundError(**data) - @marshmallow.post_dump(pass_original=True) - def post_dump(self, data, original_data, **kwargs): - field = typing.cast(helpers.RegexField, self.fields["_regex"]) - return field.post_dump(data, original_data) - - -class GraphQLNotEnabledErrorSchema(GraphQLErrorObjectSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -4170,7 +4240,7 @@ def pre_load(self, data, **kwargs): def post_load(self, data, original_data, **kwargs): field = typing.cast(helpers.RegexField, self.fields["_regex"]) data = field.post_load(data, original_data) - return models.GraphQLNotEnabledError(**data) + return models.GraphQLNoMatchingProductDiscountFoundError(**data) @marshmallow.post_dump(pass_original=True) def post_dump(self, data, original_data, **kwargs): @@ -4179,6 +4249,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLObjectNotFoundErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4231,6 +4302,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLOverCapacityErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4329,6 +4401,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLPendingOperationErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4486,6 +4559,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLQueryComplexityLimitExceededErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4507,6 +4581,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLQueryTimedOutErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4616,6 +4691,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLResourceNotFoundErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4637,6 +4713,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLResourceSizeLimitExceededErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4658,6 +4735,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLSearchDeactivatedErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4679,6 +4757,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLSearchExecutionFailureErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4700,6 +4779,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLSearchFacetPathNotFoundErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4721,6 +4801,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLSearchIndexingInProgressErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4742,6 +4823,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLSemanticErrorErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4763,6 +4845,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLShippingMethodDoesNotMatchCartErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4813,6 +4896,7 @@ def post_dump(self, data, original_data, **kwargs): class GraphQLSyntaxErrorErrorSchema(GraphQLErrorObjectSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/extension.py b/src/commercetools/platform/models/_schemas/extension.py index 1463cd24..d9241c99 100644 --- a/src/commercetools/platform/models/_schemas/extension.py +++ b/src/commercetools/platform/models/_schemas/extension.py @@ -71,6 +71,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Extension(**data) @@ -139,6 +140,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExtensionDraft(**data) @@ -198,6 +200,9 @@ class ExtensionInputSchema(helpers.BaseSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -235,6 +240,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExtensionInput(**data) @@ -258,6 +264,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExtensionPagedQueryResponse(**data) @@ -283,6 +290,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExtensionTrigger(**data) @@ -314,6 +322,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExtensionUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/graph_ql.py b/src/commercetools/platform/models/_schemas/graph_ql.py index ea624d84..a6e06409 100644 --- a/src/commercetools/platform/models/_schemas/graph_ql.py +++ b/src/commercetools/platform/models/_schemas/graph_ql.py @@ -165,6 +165,9 @@ class GraphQLErrorSchema(helpers.BaseSchema): "LanguageUsedInStores": helpers.absmod( __name__, ".error.GraphQLLanguageUsedInStoresErrorSchema" ), + "LockedField": helpers.absmod( + __name__, ".error.GraphQLLockedFieldErrorSchema" + ), "MatchingPriceNotFound": helpers.absmod( __name__, ".error.GraphQLMatchingPriceNotFoundErrorSchema" ), @@ -189,9 +192,6 @@ class GraphQLErrorSchema(helpers.BaseSchema): "NoMatchingProductDiscountFound": helpers.absmod( __name__, ".error.GraphQLNoMatchingProductDiscountFoundErrorSchema" ), - "NotEnabled": helpers.absmod( - __name__, ".error.GraphQLNotEnabledErrorSchema" - ), "ObjectNotFound": helpers.absmod( __name__, ".error.GraphQLObjectNotFoundErrorSchema" ), @@ -274,6 +274,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.GraphQLError(**data) @@ -286,6 +287,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.GraphQLErrorLocation(**data) @@ -310,6 +312,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.GraphQLRequest(**data) @@ -331,6 +334,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.GraphQLResponse(**data) diff --git a/src/commercetools/platform/models/_schemas/inventory.py b/src/commercetools/platform/models/_schemas/inventory.py index c3961e89..ccfb0b10 100644 --- a/src/commercetools/platform/models/_schemas/inventory.py +++ b/src/commercetools/platform/models/_schemas/inventory.py @@ -81,6 +81,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.InventoryEntry(**data) @@ -125,6 +126,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.InventoryEntryDraft(**data) @@ -147,6 +149,7 @@ def post_load(self, data, **kwargs): class InventoryEntryResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -199,6 +202,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.InventoryEntryUpdate(**data) @@ -234,6 +238,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.InventoryPagedQueryResponse(**data) diff --git a/src/commercetools/platform/models/_schemas/me.py b/src/commercetools/platform/models/_schemas/me.py index a15eb714..a35c444a 100644 --- a/src/commercetools/platform/models/_schemas/me.py +++ b/src/commercetools/platform/models/_schemas/me.py @@ -14,7 +14,7 @@ from ... import models from ..business_unit import BusinessUnitType -from ..cart import InventoryMode, TaxMode +from ..cart import InventoryMode, ShippingMode, TaxMode from ..me import MyQuoteState from ..payment import TransactionType from .common import LocalizedStringField @@ -48,6 +48,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyBusinessUnitAssociateDraft(**data) @@ -68,7 +69,7 @@ class MyBusinessUnitDraftSchema(helpers.BaseSchema): data_key="contactEmail", ) custom = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), + nested=helpers.absmod(__name__, ".type.CustomFieldsDraftSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, @@ -145,6 +146,10 @@ class MyBusinessUnitUpdateSchema(helpers.BaseSchema): "changeAddress": helpers.absmod( __name__, ".business_unit.BusinessUnitChangeAddressActionSchema" ), + "changeApprovalRuleMode": helpers.absmod( + __name__, + ".business_unit.BusinessUnitChangeApprovalRuleModeActionSchema", + ), "changeAssociate": helpers.absmod( __name__, ".business_unit.BusinessUnitChangeAssociateActionSchema" ), @@ -223,6 +228,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyBusinessUnitUpdate(**data) @@ -323,6 +329,14 @@ class MyCartDraftSchema(helpers.BaseSchema): load_default=None, data_key="itemShippingAddresses", ) + shipping_mode = marshmallow_enum.EnumField( + ShippingMode, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingMode", + ) discount_codes = marshmallow.fields.List( marshmallow.fields.String(allow_none=True), allow_none=True, @@ -355,6 +369,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCartDraft(**data) @@ -455,6 +470,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCartUpdate(**data) @@ -471,6 +487,7 @@ def post_load(self, data, **kwargs): class MyCompanyDraftSchema(MyBusinessUnitDraftSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -569,6 +586,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCustomerDraft(**data) @@ -649,6 +667,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyCustomerUpdate(**data) @@ -749,6 +768,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyLineItemDraft(**data) @@ -761,6 +781,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyOrderFromCartDraft(**data) @@ -779,6 +800,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyOrderFromQuoteDraft(**data) @@ -832,6 +854,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyPayment(**data) @@ -871,6 +894,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyPaymentDraft(**data) @@ -894,6 +918,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyPaymentPagedQueryResponse(**data) @@ -936,6 +961,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyPaymentUpdate(**data) @@ -967,6 +993,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyQuoteRequestDraft(**data) @@ -991,6 +1018,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyQuoteRequestUpdate(**data) @@ -1027,6 +1055,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyQuoteUpdate(**data) @@ -1100,6 +1129,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyShoppingListDraft(**data) @@ -1179,6 +1209,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyShoppingListUpdate(**data) @@ -1226,6 +1257,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MyTransactionDraft(**data) @@ -1282,6 +1314,9 @@ class ReplicaMyCartDraftSchema(helpers.BaseSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -1319,6 +1354,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReplicaMyCartDraft(**data) @@ -2906,6 +2942,7 @@ def post_load(self, data, **kwargs): class MyQuoteRequestCancelActionSchema(MyQuoteRequestUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/message.py b/src/commercetools/platform/models/_schemas/message.py index 930c06b4..7320de32 100644 --- a/src/commercetools/platform/models/_schemas/message.py +++ b/src/commercetools/platform/models/_schemas/message.py @@ -17,6 +17,7 @@ from ..approval_rule import ApprovalRuleStatus from ..associate_role import Permission from ..business_unit import ( + BusinessUnitApprovalRuleMode, BusinessUnitAssociateMode, BusinessUnitStatus, BusinessUnitStoreMode, @@ -43,6 +44,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ContainerAndKey(**data) @@ -118,6 +120,9 @@ class MessageSchema(BaseResourceSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -453,6 +458,7 @@ def post_load(self, data, **kwargs): class AssociateRoleDeletedMessageSchema(MessageSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -555,6 +561,12 @@ def post_load(self, data, **kwargs): class BusinessUnitAddressCustomFieldAddedMessageSchema(MessageSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) value = marshmallow.fields.Raw(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -574,6 +586,12 @@ class BusinessUnitAddressCustomFieldChangedMessageSchema(MessageSchema): load_default=None, data_key="oldValue", ) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -586,6 +604,12 @@ def post_load(self, data, **kwargs): class BusinessUnitAddressCustomFieldRemovedMessageSchema(MessageSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -603,6 +627,12 @@ class BusinessUnitAddressCustomTypeRemovedMessageSchema(MessageSchema): load_default=None, data_key="oldTypeId", ) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -627,6 +657,12 @@ class BusinessUnitAddressCustomTypeSetMessageSchema(MessageSchema): load_default=None, data_key="oldTypeId", ) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -654,6 +690,32 @@ def post_load(self, data, **kwargs): return models.BusinessUnitAddressRemovedMessage(**data) +class BusinessUnitApprovalRuleModeChangedMessageSchema(MessageSchema): + approval_rule_mode = marshmallow_enum.EnumField( + BusinessUnitApprovalRuleMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="approvalRuleMode", + ) + old_approval_rule_mode = marshmallow_enum.EnumField( + BusinessUnitApprovalRuleMode, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldApprovalRuleMode", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.BusinessUnitApprovalRuleModeChangedMessage(**data) + + class BusinessUnitAssociateAddedMessageSchema(MessageSchema): associate = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), @@ -942,6 +1004,7 @@ def post_load(self, data, **kwargs): class BusinessUnitDeletedMessageSchema(MessageSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1134,6 +1197,87 @@ def post_load(self, data, **kwargs): return models.BusinessUnitStoresSetMessage(**data) +class CartDiscountCreatedMessageSchema(MessageSchema): + cart_discount = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart_discount.CartDiscountSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="cartDiscount", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.CartDiscountCreatedMessage(**data) + + +class CartDiscountDeletedMessageSchema(MessageSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.CartDiscountDeletedMessage(**data) + + +class CartDiscountStoreAddedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.CartDiscountStoreAddedMessage(**data) + + +class CartDiscountStoreRemovedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.CartDiscountStoreRemovedMessage(**data) + + +class CartDiscountStoresSetMessageSchema(MessageSchema): + stores = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.CartDiscountStoresSetMessage(**data) + + class CategoryCreatedMessageSchema(MessageSchema): category = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".category.CategorySchema"), @@ -1211,6 +1355,12 @@ def post_load(self, data, **kwargs): class CustomerAddressCustomFieldAddedMessageSchema(MessageSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) value = marshmallow.fields.Raw(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -1230,6 +1380,12 @@ class CustomerAddressCustomFieldChangedMessageSchema(MessageSchema): load_default=None, data_key="previousValue", ) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -1242,6 +1398,12 @@ def post_load(self, data, **kwargs): class CustomerAddressCustomFieldRemovedMessageSchema(MessageSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -1259,6 +1421,12 @@ class CustomerAddressCustomTypeRemovedMessageSchema(MessageSchema): load_default=None, data_key="previousTypeId", ) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -1283,6 +1451,12 @@ class CustomerAddressCustomTypeSetMessageSchema(MessageSchema): load_default=None, data_key="previousTypeId", ) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -1447,6 +1621,7 @@ def post_load(self, data, **kwargs): class CustomerDeletedMessageSchema(MessageSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1486,6 +1661,7 @@ def post_load(self, data, **kwargs): class CustomerEmailVerifiedMessageSchema(MessageSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1676,6 +1852,55 @@ def post_load(self, data, **kwargs): return models.CustomerTitleSetMessage(**data) +class DiscountCodeCreatedMessageSchema(MessageSchema): + discount_code = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".discount_code.DiscountCodeSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="discountCode", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.DiscountCodeCreatedMessage(**data) + + +class DiscountCodeDeletedMessageSchema(MessageSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.DiscountCodeDeletedMessage(**data) + + +class DiscountCodeKeySetMessageSchema(MessageSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + old_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldKey", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.DiscountCodeKeySetMessage(**data) + + class InventoryEntryCreatedMessageSchema(MessageSchema): inventory_entry = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".inventory.InventoryEntrySchema"), @@ -1838,6 +2063,9 @@ class MessagePagedQueryResponseSchema(helpers.BaseSchema): "BusinessUnitAddressRemoved": helpers.absmod( __name__, ".BusinessUnitAddressRemovedMessageSchema" ), + "BusinessUnitApprovalRuleModeChanged": helpers.absmod( + __name__, ".BusinessUnitApprovalRuleModeChangedMessageSchema" + ), "BusinessUnitAssociateAdded": helpers.absmod( __name__, ".BusinessUnitAssociateAddedMessageSchema" ), @@ -1916,6 +2144,21 @@ class MessagePagedQueryResponseSchema(helpers.BaseSchema): "BusinessUnitStoresSet": helpers.absmod( __name__, ".BusinessUnitStoresSetMessageSchema" ), + "CartDiscountCreated": helpers.absmod( + __name__, ".CartDiscountCreatedMessageSchema" + ), + "CartDiscountDeleted": helpers.absmod( + __name__, ".CartDiscountDeletedMessageSchema" + ), + "CartDiscountStoreAdded": helpers.absmod( + __name__, ".CartDiscountStoreAddedMessageSchema" + ), + "CartDiscountStoreRemoved": helpers.absmod( + __name__, ".CartDiscountStoreRemovedMessageSchema" + ), + "CartDiscountStoresSet": helpers.absmod( + __name__, ".CartDiscountStoresSetMessageSchema" + ), "CategoryCreated": helpers.absmod( __name__, ".CategoryCreatedMessageSchema" ), @@ -2015,6 +2258,15 @@ class MessagePagedQueryResponseSchema(helpers.BaseSchema): "CustomerTitleSet": helpers.absmod( __name__, ".CustomerTitleSetMessageSchema" ), + "DiscountCodeCreated": helpers.absmod( + __name__, ".DiscountCodeCreatedMessageSchema" + ), + "DiscountCodeDeleted": helpers.absmod( + __name__, ".DiscountCodeDeletedMessageSchema" + ), + "DiscountCodeKeySet": helpers.absmod( + __name__, ".DiscountCodeKeySetMessageSchema" + ), "InventoryEntryCreated": helpers.absmod( __name__, ".InventoryEntryCreatedMessageSchema" ), @@ -2063,6 +2315,21 @@ class MessagePagedQueryResponseSchema(helpers.BaseSchema): "ProductPriceChanged": helpers.absmod( __name__, ".ProductPriceChangedMessageSchema" ), + "ProductPriceCustomFieldAdded": helpers.absmod( + __name__, ".ProductPriceCustomFieldAddedMessageSchema" + ), + "ProductPriceCustomFieldChanged": helpers.absmod( + __name__, ".ProductPriceCustomFieldChangedMessageSchema" + ), + "ProductPriceCustomFieldRemoved": helpers.absmod( + __name__, ".ProductPriceCustomFieldRemovedMessageSchema" + ), + "ProductPriceCustomFieldsRemoved": helpers.absmod( + __name__, ".ProductPriceCustomFieldsRemovedMessageSchema" + ), + "ProductPriceCustomFieldsSet": helpers.absmod( + __name__, ".ProductPriceCustomFieldsSetMessageSchema" + ), "ProductPriceDiscountsSet": helpers.absmod( __name__, ".ProductPriceDiscountsSetMessageSchema" ), @@ -2117,6 +2384,33 @@ class MessagePagedQueryResponseSchema(helpers.BaseSchema): "ProductStateTransition": helpers.absmod( __name__, ".ProductStateTransitionMessageSchema" ), + "ProductTailoringCreated": helpers.absmod( + __name__, ".ProductTailoringCreatedMessageSchema" + ), + "ProductTailoringDeleted": helpers.absmod( + __name__, ".ProductTailoringDeletedMessageSchema" + ), + "ProductTailoringDescriptionSet": helpers.absmod( + __name__, ".ProductTailoringDescriptionSetMessageSchema" + ), + "ProductTailoringImageAdded": helpers.absmod( + __name__, ".ProductTailoringImageAddedMessageSchema" + ), + "ProductTailoringImagesSet": helpers.absmod( + __name__, ".ProductTailoringImagesSetMessageSchema" + ), + "ProductTailoringNameSet": helpers.absmod( + __name__, ".ProductTailoringNameSetMessageSchema" + ), + "ProductTailoringPublished": helpers.absmod( + __name__, ".ProductTailoringPublishedMessageSchema" + ), + "ProductTailoringSlugSet": helpers.absmod( + __name__, ".ProductTailoringSlugSetMessageSchema" + ), + "ProductTailoringUnpublished": helpers.absmod( + __name__, ".ProductTailoringUnpublishedMessageSchema" + ), "ProductUnpublished": helpers.absmod( __name__, ".ProductUnpublishedMessageSchema" ), @@ -2126,6 +2420,12 @@ class MessagePagedQueryResponseSchema(helpers.BaseSchema): "ProductVariantDeleted": helpers.absmod( __name__, ".ProductVariantDeletedMessageSchema" ), + "ProductVariantTailoringAdded": helpers.absmod( + __name__, ".ProductVariantTailoringAddedMessageSchema" + ), + "ProductVariantTailoringRemoved": helpers.absmod( + __name__, ".ProductVariantTailoringRemovedMessageSchema" + ), "QuoteCreated": helpers.absmod(__name__, ".QuoteCreatedMessageSchema"), "QuoteCustomerChanged": helpers.absmod( __name__, ".QuoteCustomerChangedMessageSchema" @@ -2256,6 +2556,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MessagePagedQueryResponse(**data) @@ -2273,6 +2574,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MessagesConfiguration(**data) @@ -2287,10 +2589,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MessagesConfigurationDraft(**data) class OrderMessageSchema(MessageSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2980,7 +3284,7 @@ class OrderLineItemDiscountSetMessageSchema(OrderMessageSchema): data_key="discountedPricePerQuantity", ) total_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.MoneySchema"), + nested=helpers.absmod(__name__, ".common.CentPrecisionMoneySchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, @@ -3204,6 +3508,7 @@ class OrderShipmentStateChangedMessageSchema(OrderMessageSchema): ShipmentState, by_value=True, allow_none=True, + metadata={"omit_empty": True}, load_default=None, data_key="oldShipmentState", ) @@ -3319,6 +3624,7 @@ class OrderStateChangedMessageSchema(OrderMessageSchema): OrderState, by_value=True, allow_none=True, + metadata={"omit_empty": True}, load_default=None, data_key="oldOrderState", ) @@ -3776,15 +4082,16 @@ def post_load(self, data, **kwargs): return models.ProductPriceChangedMessage(**data) -class ProductPriceDiscountsSetMessageSchema(MessageSchema): - updated_prices = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ProductPriceDiscountsSetUpdatedPriceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="updatedPrices", +class ProductPriceCustomFieldAddedMessageSchema(MessageSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -3792,50 +4099,158 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceDiscountsSetMessage(**data) + return models.ProductPriceCustomFieldAddedMessage(**data) -class ProductPriceDiscountsSetUpdatedPriceSchema(helpers.BaseSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - variant_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="variantKey", - ) - sku = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) +class ProductPriceCustomFieldChangedMessageSchema(MessageSchema): price_id = marshmallow.fields.String( allow_none=True, load_default=None, data_key="priceId" ) - discounted = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" ) staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): - return models.ProductPriceDiscountsSetUpdatedPrice(**data) + del data["type"] + return models.ProductPriceCustomFieldChangedMessage(**data) -class ProductPriceExternalDiscountSetMessageSchema(MessageSchema): +class ProductPriceCustomFieldRemovedMessageSchema(MessageSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) variant_id = marshmallow.fields.Integer( allow_none=True, load_default=None, data_key="variantId" ) - variant_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductPriceCustomFieldRemovedMessage(**data) + + +class ProductPriceCustomFieldsRemovedMessageSchema(MessageSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductPriceCustomFieldsRemovedMessage(**data) + + +class ProductPriceCustomFieldsSetMessageSchema(MessageSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + custom_field = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="customField", + ) + old_type_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldTypeId", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductPriceCustomFieldsSetMessage(**data) + + +class ProductPriceDiscountsSetMessageSchema(MessageSchema): + updated_prices = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductPriceDiscountsSetUpdatedPriceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="updatedPrices", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductPriceDiscountsSetMessage(**data) + + +class ProductPriceDiscountsSetUpdatedPriceSchema(helpers.BaseSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + variant_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantKey", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + discounted = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductPriceDiscountsSetUpdatedPrice(**data) + + +class ProductPriceExternalDiscountSetMessageSchema(MessageSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + variant_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, data_key="variantKey", ) sku = marshmallow.fields.String( @@ -4030,6 +4445,7 @@ def post_load(self, data, **kwargs): class ProductSelectionDeletedMessageSchema(MessageSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -4255,24 +4671,78 @@ def post_load(self, data, **kwargs): return models.ProductStateTransitionMessage(**data) -class ProductUnpublishedMessageSchema(MessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.ProductUnpublishedMessage(**data) - - -class ProductVariantAddedMessageSchema(MessageSchema): - variant = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".product.ProductVariantSchema"), +class ProductTailoringCreatedMessageSchema(MessageSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + meta_title = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaTitle", + ) + meta_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaDescription", + ) + meta_keywords = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaKeywords", + ) + variants = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_tailoring.ProductVariantTailoringSchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + published = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -4280,22 +4750,27 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductVariantAddedMessage(**data) + return models.ProductTailoringCreatedMessage(**data) -class ProductVariantDeletedMessageSchema(MessageSchema): - variant = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".product.ProductVariantSchema"), +class ProductTailoringDeletedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None, + data_key="productKey", ) - removed_image_urls = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="removedImageUrls", ) class Meta: @@ -4304,16 +4779,41 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductVariantDeletedMessage(**data) + return models.ProductTailoringDeletedMessage(**data) -class QuoteCreatedMessageSchema(MessageSchema): - quote = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".quote.QuoteSchema"), +class ProductTailoringDescriptionSetMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + old_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="oldDescription", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -4321,22 +4821,36 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteCreatedMessage(**data) + return models.ProductTailoringDescriptionSetMessage(**data) -class QuoteCustomerChangedMessageSchema(MessageSchema): - customer = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), +class ProductTailoringImageAddedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - previous_customer = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + image = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="previousCustomer", ) class Meta: @@ -4345,25 +4859,47 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteCustomerChangedMessage(**data) + return models.ProductTailoringImageAddedMessage(**data) -class QuoteDeletedMessageSchema(MessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.QuoteDeletedMessage(**data) - - -class QuoteRenegotiationRequestedMessageSchema(MessageSchema): - buyer_comment = marshmallow.fields.String( +class ProductTailoringImagesSetMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="buyerComment", + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + old_images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldImages", + ) + images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, ) class Meta: @@ -4372,16 +4908,40 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteRenegotiationRequestedMessage(**data) + return models.ProductTailoringImagesSetMessage(**data) -class QuoteRequestCreatedMessageSchema(MessageSchema): - quote_request = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".quote_request.QuoteRequestSchema"), +class ProductTailoringNameSetMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="quoteRequest", + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + old_name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="oldName", ) class Meta: @@ -4390,22 +4950,27 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteRequestCreatedMessage(**data) + return models.ProductTailoringNameSetMessage(**data) -class QuoteRequestCustomerChangedMessageSchema(MessageSchema): - customer = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), +class ProductTailoringPublishedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - previous_customer = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="previousCustomer", ) class Meta: @@ -4414,33 +4979,40 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteRequestCustomerChangedMessage(**data) - - -class QuoteRequestDeletedMessageSchema(MessageSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.QuoteRequestDeletedMessage(**data) + return models.ProductTailoringPublishedMessage(**data) -class QuoteRequestStateChangedMessageSchema(MessageSchema): - quote_request_state = marshmallow_enum.EnumField( - QuoteRequestState, - by_value=True, +class ProductTailoringSlugSetMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="quoteRequestState", ) - old_quote_request_state = marshmallow_enum.EnumField( - QuoteRequestState, - by_value=True, + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldQuoteRequestState", + ) + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + old_slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="oldSlug", ) class Meta: @@ -4449,25 +5021,28 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteRequestStateChangedMessage(**data) + return models.ProductTailoringSlugSetMessage(**data) -class QuoteRequestStateTransitionMessageSchema(MessageSchema): - state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), +class ProductTailoringUnpublishedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - old_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + product_key = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldState", + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, ) - force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -4475,24 +5050,28 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteRequestStateTransitionMessage(**data) + return models.ProductTailoringUnpublishedMessage(**data) -class QuoteStateChangedMessageSchema(MessageSchema): - quote_state = marshmallow_enum.EnumField( - QuoteState, - by_value=True, - allow_none=True, - load_default=None, - data_key="quoteState", - ) - old_quote_state = marshmallow_enum.EnumField( - QuoteState, - by_value=True, +class ProductUnpublishedMessageSchema(MessageSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductUnpublishedMessage(**data) + + +class ProductVariantAddedMessageSchema(MessageSchema): + variant = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductVariantSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldQuoteState", ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -4500,25 +5079,23 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteStateChangedMessage(**data) + return models.ProductVariantAddedMessage(**data) -class QuoteStateTransitionMessageSchema(MessageSchema): - state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), +class ProductVariantDeletedMessageSchema(MessageSchema): + variant = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductVariantSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, ) - old_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + removed_image_urls = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="oldState", + data_key="removedImageUrls", ) - force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -4526,16 +5103,38 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.QuoteStateTransitionMessage(**data) + return models.ProductVariantDeletedMessage(**data) -class ReturnInfoAddedMessageSchema(OrderMessageSchema): - return_info = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.ReturnInfoSchema"), +class ProductVariantTailoringAddedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + variant = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_tailoring.ProductVariantTailoringSchema" + ), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="returnInfo", ) class Meta: @@ -4544,18 +5143,38 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ReturnInfoAddedMessage(**data) + return models.ProductVariantTailoringAddedMessage(**data) -class ReturnInfoSetMessageSchema(OrderMessageSchema): - return_info = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.ReturnInfoSchema"), +class ProductVariantTailoringRemovedMessageSchema(MessageSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="returnInfo", + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + variant = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_tailoring.ProductVariantTailoringSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, ) class Meta: @@ -4564,12 +5183,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ReturnInfoSetMessage(**data) + return models.ProductVariantTailoringRemovedMessage(**data) -class ReviewCreatedMessageSchema(MessageSchema): - review = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".review.ReviewSchema"), +class QuoteCreatedMessageSchema(MessageSchema): + quote = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".quote.QuoteSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, @@ -4581,108 +5200,1015 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ReviewCreatedMessage(**data) + return models.QuoteCreatedMessage(**data) -class ReviewRatingSetMessageSchema(MessageSchema): - old_rating = marshmallow.fields.Float( - allow_none=True, - metadata={"omit_empty": True}, +class QuoteCustomerChangedMessageSchema(MessageSchema): + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + previous_customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousCustomer", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteCustomerChangedMessage(**data) + + +class QuoteDeletedMessageSchema(MessageSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteDeletedMessage(**data) + + +class QuoteRenegotiationRequestedMessageSchema(MessageSchema): + buyer_comment = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="buyerComment", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteRenegotiationRequestedMessage(**data) + + +class QuoteRequestCreatedMessageSchema(MessageSchema): + quote_request = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".quote_request.QuoteRequestSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="quoteRequest", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteRequestCreatedMessage(**data) + + +class QuoteRequestCustomerChangedMessageSchema(MessageSchema): + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + previous_customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousCustomer", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteRequestCustomerChangedMessage(**data) + + +class QuoteRequestDeletedMessageSchema(MessageSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteRequestDeletedMessage(**data) + + +class QuoteRequestStateChangedMessageSchema(MessageSchema): + quote_request_state = marshmallow_enum.EnumField( + QuoteRequestState, + by_value=True, + allow_none=True, + load_default=None, + data_key="quoteRequestState", + ) + old_quote_request_state = marshmallow_enum.EnumField( + QuoteRequestState, + by_value=True, + allow_none=True, + load_default=None, + data_key="oldQuoteRequestState", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteRequestStateChangedMessage(**data) + + +class QuoteRequestStateTransitionMessageSchema(MessageSchema): + state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + old_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldState", + ) + force = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteRequestStateTransitionMessage(**data) + + +class QuoteStateChangedMessageSchema(MessageSchema): + quote_state = marshmallow_enum.EnumField( + QuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="quoteState", + ) + old_quote_state = marshmallow_enum.EnumField( + QuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="oldQuoteState", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteStateChangedMessage(**data) + + +class QuoteStateTransitionMessageSchema(MessageSchema): + state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + old_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldState", + ) + force = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.QuoteStateTransitionMessage(**data) + + +class ReturnInfoAddedMessageSchema(OrderMessageSchema): + return_info = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.ReturnInfoSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="returnInfo", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ReturnInfoAddedMessage(**data) + + +class ReturnInfoSetMessageSchema(OrderMessageSchema): + return_info = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.ReturnInfoSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="returnInfo", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ReturnInfoSetMessage(**data) + + +class ReviewCreatedMessageSchema(MessageSchema): + review = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".review.ReviewSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ReviewCreatedMessage(**data) + + +class ReviewRatingSetMessageSchema(MessageSchema): + old_rating = marshmallow.fields.Float( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldRating", + ) + new_rating = marshmallow.fields.Float( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="newRating", + ) + included_in_statistics = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="includedInStatistics" + ) + target = helpers.Discriminator( + allow_none=True, + discriminator_field=("typeId", "type_id"), + discriminator_schemas={ + "associate-role": helpers.absmod( + __name__, ".associate_role.AssociateRoleReferenceSchema" + ), + "attribute-group": helpers.absmod( + __name__, ".attribute_group.AttributeGroupReferenceSchema" + ), + "business-unit": helpers.absmod( + __name__, ".business_unit.BusinessUnitReferenceSchema" + ), + "cart-discount": helpers.absmod( + __name__, ".cart_discount.CartDiscountReferenceSchema" + ), + "cart": helpers.absmod(__name__, ".cart.CartReferenceSchema"), + "direct-discount": helpers.absmod( + __name__, ".cart.DirectDiscountReferenceSchema" + ), + "category": helpers.absmod(__name__, ".category.CategoryReferenceSchema"), + "channel": helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + "key-value-document": helpers.absmod( + __name__, ".custom_object.CustomObjectReferenceSchema" + ), + "customer-group": helpers.absmod( + __name__, ".customer_group.CustomerGroupReferenceSchema" + ), + "customer-email-token": helpers.absmod( + __name__, ".customer.CustomerEmailTokenReferenceSchema" + ), + "customer-password-token": helpers.absmod( + __name__, ".customer.CustomerPasswordTokenReferenceSchema" + ), + "customer": helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + "discount-code": helpers.absmod( + __name__, ".discount_code.DiscountCodeReferenceSchema" + ), + "inventory-entry": helpers.absmod( + __name__, ".inventory.InventoryEntryReferenceSchema" + ), + "order-edit": helpers.absmod( + __name__, ".order_edit.OrderEditReferenceSchema" + ), + "order": helpers.absmod(__name__, ".order.OrderReferenceSchema"), + "payment": helpers.absmod(__name__, ".payment.PaymentReferenceSchema"), + "product-discount": helpers.absmod( + __name__, ".product_discount.ProductDiscountReferenceSchema" + ), + "product-selection": helpers.absmod( + __name__, ".product_selection.ProductSelectionReferenceSchema" + ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), + "product-type": helpers.absmod( + __name__, ".product_type.ProductTypeReferenceSchema" + ), + "product": helpers.absmod(__name__, ".product.ProductReferenceSchema"), + "quote-request": helpers.absmod( + __name__, ".quote_request.QuoteRequestReferenceSchema" + ), + "quote": helpers.absmod(__name__, ".quote.QuoteReferenceSchema"), + "review": helpers.absmod(__name__, ".review.ReviewReferenceSchema"), + "shipping-method": helpers.absmod( + __name__, ".shipping_method.ShippingMethodReferenceSchema" + ), + "shopping-list": helpers.absmod( + __name__, ".shopping_list.ShoppingListReferenceSchema" + ), + "staged-quote": helpers.absmod( + __name__, ".staged_quote.StagedQuoteReferenceSchema" + ), + "standalone-price": helpers.absmod( + __name__, ".standalone_price.StandalonePriceReferenceSchema" + ), + "state": helpers.absmod(__name__, ".state.StateReferenceSchema"), + "store": helpers.absmod(__name__, ".store.StoreReferenceSchema"), + "tax-category": helpers.absmod( + __name__, ".tax_category.TaxCategoryReferenceSchema" + ), + "type": helpers.absmod(__name__, ".type.TypeReferenceSchema"), + "zone": helpers.absmod(__name__, ".zone.ZoneReferenceSchema"), + }, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ReviewRatingSetMessage(**data) + + +class ReviewStateTransitionMessageSchema(MessageSchema): + old_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldState", + ) + new_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="newState", + ) + old_included_in_statistics = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="oldIncludedInStatistics" + ) + new_included_in_statistics = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="newIncludedInStatistics" + ) + target = helpers.Discriminator( + allow_none=True, + discriminator_field=("typeId", "type_id"), + discriminator_schemas={ + "associate-role": helpers.absmod( + __name__, ".associate_role.AssociateRoleReferenceSchema" + ), + "attribute-group": helpers.absmod( + __name__, ".attribute_group.AttributeGroupReferenceSchema" + ), + "business-unit": helpers.absmod( + __name__, ".business_unit.BusinessUnitReferenceSchema" + ), + "cart-discount": helpers.absmod( + __name__, ".cart_discount.CartDiscountReferenceSchema" + ), + "cart": helpers.absmod(__name__, ".cart.CartReferenceSchema"), + "direct-discount": helpers.absmod( + __name__, ".cart.DirectDiscountReferenceSchema" + ), + "category": helpers.absmod(__name__, ".category.CategoryReferenceSchema"), + "channel": helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + "key-value-document": helpers.absmod( + __name__, ".custom_object.CustomObjectReferenceSchema" + ), + "customer-group": helpers.absmod( + __name__, ".customer_group.CustomerGroupReferenceSchema" + ), + "customer-email-token": helpers.absmod( + __name__, ".customer.CustomerEmailTokenReferenceSchema" + ), + "customer-password-token": helpers.absmod( + __name__, ".customer.CustomerPasswordTokenReferenceSchema" + ), + "customer": helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + "discount-code": helpers.absmod( + __name__, ".discount_code.DiscountCodeReferenceSchema" + ), + "inventory-entry": helpers.absmod( + __name__, ".inventory.InventoryEntryReferenceSchema" + ), + "order-edit": helpers.absmod( + __name__, ".order_edit.OrderEditReferenceSchema" + ), + "order": helpers.absmod(__name__, ".order.OrderReferenceSchema"), + "payment": helpers.absmod(__name__, ".payment.PaymentReferenceSchema"), + "product-discount": helpers.absmod( + __name__, ".product_discount.ProductDiscountReferenceSchema" + ), + "product-selection": helpers.absmod( + __name__, ".product_selection.ProductSelectionReferenceSchema" + ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), + "product-type": helpers.absmod( + __name__, ".product_type.ProductTypeReferenceSchema" + ), + "product": helpers.absmod(__name__, ".product.ProductReferenceSchema"), + "quote-request": helpers.absmod( + __name__, ".quote_request.QuoteRequestReferenceSchema" + ), + "quote": helpers.absmod(__name__, ".quote.QuoteReferenceSchema"), + "review": helpers.absmod(__name__, ".review.ReviewReferenceSchema"), + "shipping-method": helpers.absmod( + __name__, ".shipping_method.ShippingMethodReferenceSchema" + ), + "shopping-list": helpers.absmod( + __name__, ".shopping_list.ShoppingListReferenceSchema" + ), + "staged-quote": helpers.absmod( + __name__, ".staged_quote.StagedQuoteReferenceSchema" + ), + "standalone-price": helpers.absmod( + __name__, ".standalone_price.StandalonePriceReferenceSchema" + ), + "state": helpers.absmod(__name__, ".state.StateReferenceSchema"), + "store": helpers.absmod(__name__, ".store.StoreReferenceSchema"), + "tax-category": helpers.absmod( + __name__, ".tax_category.TaxCategoryReferenceSchema" + ), + "type": helpers.absmod(__name__, ".type.TypeReferenceSchema"), + "zone": helpers.absmod(__name__, ".zone.ZoneReferenceSchema"), + }, + metadata={"omit_empty": True}, + load_default=None, + ) + force = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ReviewStateTransitionMessage(**data) + + +class StagedQuoteCreatedMessageSchema(MessageSchema): + staged_quote = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".staged_quote.StagedQuoteSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="stagedQuote", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StagedQuoteCreatedMessage(**data) + + +class StagedQuoteDeletedMessageSchema(MessageSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StagedQuoteDeletedMessage(**data) + + +class StagedQuoteSellerCommentSetMessageSchema(MessageSchema): + seller_comment = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="sellerComment" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StagedQuoteSellerCommentSetMessage(**data) + + +class StagedQuoteStateChangedMessageSchema(MessageSchema): + staged_quote_state = marshmallow_enum.EnumField( + StagedQuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="stagedQuoteState", + ) + old_staged_quote_state = marshmallow_enum.EnumField( + StagedQuoteState, + by_value=True, + allow_none=True, + load_default=None, + data_key="oldStagedQuoteState", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StagedQuoteStateChangedMessage(**data) + + +class StagedQuoteStateTransitionMessageSchema(MessageSchema): + state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + old_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldState", + ) + force = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StagedQuoteStateTransitionMessage(**data) + + +class StagedQuoteValidToSetMessageSchema(MessageSchema): + valid_to = marshmallow.fields.DateTime( + allow_none=True, load_default=None, data_key="validTo" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StagedQuoteValidToSetMessage(**data) + + +class StandalonePriceActiveChangedMessageSchema(MessageSchema): + active = marshmallow.fields.Boolean(allow_none=True, load_default=None) + old_active = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="oldActive" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceActiveChangedMessage(**data) + + +class StandalonePriceCreatedMessageSchema(MessageSchema): + standalone_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".standalone_price.StandalonePriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="standalonePrice", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceCreatedMessage(**data) + + +class StandalonePriceDeletedMessageSchema(MessageSchema): + sku = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceDeletedMessage(**data) + + +class StandalonePriceDiscountSetMessageSchema(MessageSchema): + discounted = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceDiscountSetMessage(**data) + + +class StandalonePriceExternalDiscountSetMessageSchema(MessageSchema): + discounted = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceExternalDiscountSetMessage(**data) + + +class StandalonePriceKeySetMessageSchema(MessageSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + old_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldKey", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceKeySetMessage(**data) + + +class StandalonePriceStagedChangesAppliedMessageSchema(MessageSchema): + staged_changes = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".standalone_price.StagedStandalonePriceSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="stagedChanges", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceStagedChangesAppliedMessage(**data) + + +class StandalonePriceStagedChangesRemovedMessageSchema(MessageSchema): + staged_changes = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".standalone_price.StagedStandalonePriceSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="stagedChanges", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceStagedChangesRemovedMessage(**data) + + +class StandalonePriceTierAddedMessageSchema(MessageSchema): + tier = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceTierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceTierAddedMessage(**data) + + +class StandalonePriceTierRemovedMessageSchema(MessageSchema): + removed_tier = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceTierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldRating", + data_key="removedTier", ) - new_rating = marshmallow.fields.Float( + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceTierRemovedMessage(**data) + + +class StandalonePriceTiersSetMessageSchema(MessageSchema): + tiers = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceTierSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + previous_tiers = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceTierSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="previousTiers", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceTiersSetMessage(**data) + + +class StandalonePriceValidFromAndUntilSetMessageSchema(MessageSchema): + valid_from = marshmallow.fields.DateTime( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="newRating", + data_key="validFrom", ) - included_in_statistics = marshmallow.fields.Boolean( - allow_none=True, load_default=None, data_key="includedInStatistics" + previous_valid_from = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="previousValidFrom", ) - target = helpers.Discriminator( + valid_until = marshmallow.fields.DateTime( allow_none=True, - discriminator_field=("typeId", "type_id"), + metadata={"omit_empty": True}, + load_default=None, + data_key="validUntil", + ) + previous_valid_until = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="previousValidUntil", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceValidFromAndUntilSetMessage(**data) + + +class StandalonePriceValidFromSetMessageSchema(MessageSchema): + valid_from = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="validFrom", + ) + previous_valid_from = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="previousValidFrom", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceValidFromSetMessage(**data) + + +class StandalonePriceValidUntilSetMessageSchema(MessageSchema): + valid_until = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="validUntil", + ) + previous_valid_until = marshmallow.fields.DateTime( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="previousValidUntil", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceValidUntilSetMessage(**data) + + +class StandalonePriceValueChangedMessageSchema(MessageSchema): + value = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), discriminator_schemas={ - "associate-role": helpers.absmod( - __name__, ".associate_role.AssociateRoleReferenceSchema" - ), - "attribute-group": helpers.absmod( - __name__, ".attribute_group.AttributeGroupReferenceSchema" - ), - "business-unit": helpers.absmod( - __name__, ".business_unit.BusinessUnitReferenceSchema" - ), - "cart-discount": helpers.absmod( - __name__, ".cart_discount.CartDiscountReferenceSchema" - ), - "cart": helpers.absmod(__name__, ".cart.CartReferenceSchema"), - "direct-discount": helpers.absmod( - __name__, ".cart.DirectDiscountReferenceSchema" - ), - "category": helpers.absmod(__name__, ".category.CategoryReferenceSchema"), - "channel": helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), - "key-value-document": helpers.absmod( - __name__, ".custom_object.CustomObjectReferenceSchema" - ), - "customer-group": helpers.absmod( - __name__, ".customer_group.CustomerGroupReferenceSchema" - ), - "customer-email-token": helpers.absmod( - __name__, ".customer.CustomerEmailTokenReferenceSchema" - ), - "customer-password-token": helpers.absmod( - __name__, ".customer.CustomerPasswordTokenReferenceSchema" - ), - "customer": helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), - "discount-code": helpers.absmod( - __name__, ".discount_code.DiscountCodeReferenceSchema" - ), - "inventory-entry": helpers.absmod( - __name__, ".inventory.InventoryEntryReferenceSchema" - ), - "order-edit": helpers.absmod( - __name__, ".order_edit.OrderEditReferenceSchema" - ), - "order": helpers.absmod(__name__, ".order.OrderReferenceSchema"), - "payment": helpers.absmod(__name__, ".payment.PaymentReferenceSchema"), - "product-discount": helpers.absmod( - __name__, ".product_discount.ProductDiscountReferenceSchema" - ), - "product-selection": helpers.absmod( - __name__, ".product_selection.ProductSelectionReferenceSchema" - ), - "product-type": helpers.absmod( - __name__, ".product_type.ProductTypeReferenceSchema" - ), - "product": helpers.absmod(__name__, ".product.ProductReferenceSchema"), - "quote-request": helpers.absmod( - __name__, ".quote_request.QuoteRequestReferenceSchema" - ), - "quote": helpers.absmod(__name__, ".quote.QuoteReferenceSchema"), - "review": helpers.absmod(__name__, ".review.ReviewReferenceSchema"), - "shipping-method": helpers.absmod( - __name__, ".shipping_method.ShippingMethodReferenceSchema" - ), - "shopping-list": helpers.absmod( - __name__, ".shopping_list.ShoppingListReferenceSchema" + "centPrecision": helpers.absmod( + __name__, ".common.CentPrecisionMoneySchema" ), - "staged-quote": helpers.absmod( - __name__, ".staged_quote.StagedQuoteReferenceSchema" + "highPrecision": helpers.absmod( + __name__, ".common.HighPrecisionMoneySchema" ), - "standalone-price": helpers.absmod( - __name__, ".standalone_price.StandalonePriceReferenceSchema" + }, + load_default=None, + ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + old_value = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "centPrecision": helpers.absmod( + __name__, ".common.CentPrecisionMoneySchema" ), - "state": helpers.absmod(__name__, ".state.StateReferenceSchema"), - "store": helpers.absmod(__name__, ".store.StoreReferenceSchema"), - "tax-category": helpers.absmod( - __name__, ".tax_category.TaxCategoryReferenceSchema" + "highPrecision": helpers.absmod( + __name__, ".common.HighPrecisionMoneySchema" ), - "type": helpers.absmod(__name__, ".type.TypeReferenceSchema"), - "zone": helpers.absmod(__name__, ".zone.ZoneReferenceSchema"), }, metadata={"omit_empty": True}, load_default=None, + data_key="oldValue", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StandalonePriceValueChangedMessage(**data) + + +class StoreCountriesChangedMessageSchema(MessageSchema): + added_countries = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store_country.StoreCountrySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="addedCountries", + ) + removed_countries = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store_country.StoreCountrySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="removedCountries", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StoreCountriesChangedMessage(**data) + + +class StoreCreatedMessageSchema(MessageSchema): + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + languages = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + countries = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store_country.StoreCountrySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + distribution_channels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="distributionChannels", + ) + supply_channels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="supplyChannels", + ) + product_selections = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="productSelections", + ) + custom = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, ) class Meta: @@ -4691,116 +6217,64 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ReviewRatingSetMessage(**data) + return models.StoreCreatedMessage(**data) -class ReviewStateTransitionMessageSchema(MessageSchema): - old_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), +class StoreDeletedMessageSchema(MessageSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StoreDeletedMessage(**data) + + +class StoreDistributionChannelsChangedMessageSchema(MessageSchema): + added_distribution_channels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), allow_none=True, + many=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldState", + data_key="addedDistributionChannels", ) - new_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + removed_distribution_channels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), allow_none=True, + many=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="newState", - ) - old_included_in_statistics = marshmallow.fields.Boolean( - allow_none=True, load_default=None, data_key="oldIncludedInStatistics" + data_key="removedDistributionChannels", ) - new_included_in_statistics = marshmallow.fields.Boolean( - allow_none=True, load_default=None, data_key="newIncludedInStatistics" + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.StoreDistributionChannelsChangedMessage(**data) + + +class StoreLanguagesChangedMessageSchema(MessageSchema): + added_languages = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addedLanguages", ) - target = helpers.Discriminator( + removed_languages = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), allow_none=True, - discriminator_field=("typeId", "type_id"), - discriminator_schemas={ - "associate-role": helpers.absmod( - __name__, ".associate_role.AssociateRoleReferenceSchema" - ), - "attribute-group": helpers.absmod( - __name__, ".attribute_group.AttributeGroupReferenceSchema" - ), - "business-unit": helpers.absmod( - __name__, ".business_unit.BusinessUnitReferenceSchema" - ), - "cart-discount": helpers.absmod( - __name__, ".cart_discount.CartDiscountReferenceSchema" - ), - "cart": helpers.absmod(__name__, ".cart.CartReferenceSchema"), - "direct-discount": helpers.absmod( - __name__, ".cart.DirectDiscountReferenceSchema" - ), - "category": helpers.absmod(__name__, ".category.CategoryReferenceSchema"), - "channel": helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), - "key-value-document": helpers.absmod( - __name__, ".custom_object.CustomObjectReferenceSchema" - ), - "customer-group": helpers.absmod( - __name__, ".customer_group.CustomerGroupReferenceSchema" - ), - "customer-email-token": helpers.absmod( - __name__, ".customer.CustomerEmailTokenReferenceSchema" - ), - "customer-password-token": helpers.absmod( - __name__, ".customer.CustomerPasswordTokenReferenceSchema" - ), - "customer": helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), - "discount-code": helpers.absmod( - __name__, ".discount_code.DiscountCodeReferenceSchema" - ), - "inventory-entry": helpers.absmod( - __name__, ".inventory.InventoryEntryReferenceSchema" - ), - "order-edit": helpers.absmod( - __name__, ".order_edit.OrderEditReferenceSchema" - ), - "order": helpers.absmod(__name__, ".order.OrderReferenceSchema"), - "payment": helpers.absmod(__name__, ".payment.PaymentReferenceSchema"), - "product-discount": helpers.absmod( - __name__, ".product_discount.ProductDiscountReferenceSchema" - ), - "product-selection": helpers.absmod( - __name__, ".product_selection.ProductSelectionReferenceSchema" - ), - "product-type": helpers.absmod( - __name__, ".product_type.ProductTypeReferenceSchema" - ), - "product": helpers.absmod(__name__, ".product.ProductReferenceSchema"), - "quote-request": helpers.absmod( - __name__, ".quote_request.QuoteRequestReferenceSchema" - ), - "quote": helpers.absmod(__name__, ".quote.QuoteReferenceSchema"), - "review": helpers.absmod(__name__, ".review.ReviewReferenceSchema"), - "shipping-method": helpers.absmod( - __name__, ".shipping_method.ShippingMethodReferenceSchema" - ), - "shopping-list": helpers.absmod( - __name__, ".shopping_list.ShoppingListReferenceSchema" - ), - "staged-quote": helpers.absmod( - __name__, ".staged_quote.StagedQuoteReferenceSchema" - ), - "standalone-price": helpers.absmod( - __name__, ".standalone_price.StandalonePriceReferenceSchema" - ), - "state": helpers.absmod(__name__, ".state.StateReferenceSchema"), - "store": helpers.absmod(__name__, ".store.StoreReferenceSchema"), - "tax-category": helpers.absmod( - __name__, ".tax_category.TaxCategoryReferenceSchema" - ), - "type": helpers.absmod(__name__, ".type.TypeReferenceSchema"), - "zone": helpers.absmod(__name__, ".zone.ZoneReferenceSchema"), - }, metadata={"omit_empty": True}, load_default=None, + data_key="removedLanguages", ) - force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -4808,16 +6282,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ReviewStateTransitionMessage(**data) + return models.StoreLanguagesChangedMessage(**data) -class StagedQuoteCreatedMessageSchema(MessageSchema): - staged_quote = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".staged_quote.StagedQuoteSchema"), +class StoreNameSetMessageSchema(MessageSchema): + name = LocalizedStringField( allow_none=True, - unknown=marshmallow.EXCLUDE, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, load_default=None, - data_key="stagedQuote", + ) + name_all_locales = marshmallow.fields.List( + LocalizedStringField( + allow_none=True, values=marshmallow.fields.String(allow_none=True) + ), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="nameAllLocales", ) class Meta: @@ -4826,22 +6308,65 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StagedQuoteCreatedMessage(**data) + return models.StoreNameSetMessage(**data) -class StagedQuoteDeletedMessageSchema(MessageSchema): +class StoreProductSelectionsChangedMessageSchema(MessageSchema): + added_product_selections = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="addedProductSelections", + ) + removed_product_selections = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="removedProductSelections", + ) + updated_product_selections = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="updatedProductSelections", + ) + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StagedQuoteDeletedMessage(**data) + return models.StoreProductSelectionsChangedMessage(**data) -class StagedQuoteSellerCommentSetMessageSchema(MessageSchema): - seller_comment = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="sellerComment" +class StoreSupplyChannelsChangedMessageSchema(MessageSchema): + added_supply_channels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="addedSupplyChannels", + ) + removed_supply_channels = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="removedSupplyChannels", ) class Meta: @@ -4850,64 +6375,60 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StagedQuoteSellerCommentSetMessage(**data) + return models.StoreSupplyChannelsChangedMessage(**data) -class StagedQuoteStateChangedMessageSchema(MessageSchema): - staged_quote_state = marshmallow_enum.EnumField( - StagedQuoteState, - by_value=True, +class UserProvidedIdentifiersSchema(helpers.BaseSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + external_id = marshmallow.fields.String( allow_none=True, + metadata={"omit_empty": True}, load_default=None, - data_key="stagedQuoteState", + data_key="externalId", ) - old_staged_quote_state = marshmallow_enum.EnumField( - StagedQuoteState, - by_value=True, + order_number = marshmallow.fields.String( allow_none=True, + metadata={"omit_empty": True}, load_default=None, - data_key="oldStagedQuoteState", + data_key="orderNumber", ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.StagedQuoteStateChangedMessage(**data) - - -class StagedQuoteStateTransitionMessageSchema(MessageSchema): - state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + customer_number = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="customerNumber", ) - old_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + container_and_key = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ContainerAndKeySchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldState", + data_key="containerAndKey", ) - force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): - del data["type"] - return models.StagedQuoteStateTransitionMessage(**data) + return models.UserProvidedIdentifiers(**data) -class StagedQuoteValidToSetMessageSchema(MessageSchema): - valid_to = marshmallow.fields.DateTime( - allow_none=True, load_default=None, data_key="validTo" - ) + +class MessagePayloadSchema(helpers.BaseSchema): + type = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -4915,13 +6436,21 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StagedQuoteValidToSetMessage(**data) + return models.MessagePayload(**data) -class StandalonePriceActiveChangedMessageSchema(MessageSchema): - active = marshmallow.fields.Boolean(allow_none=True, load_default=None) - old_active = marshmallow.fields.Boolean( - allow_none=True, load_default=None, data_key="oldActive" +class ApprovalFlowApprovedMessagePayloadSchema(MessagePayloadSchema): + associate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + order = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.OrderReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, ) class Meta: @@ -4930,16 +6459,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceActiveChangedMessage(**data) + return models.ApprovalFlowApprovedMessagePayload(**data) -class StandalonePriceCreatedMessageSchema(MessageSchema): - standalone_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".standalone_price.StandalonePriceSchema"), +class ApprovalFlowCompletedMessagePayloadSchema(MessagePayloadSchema): + status = marshmallow_enum.EnumField( + ApprovalFlowStatus, by_value=True, allow_none=True, load_default=None + ) + order = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.OrderReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="standalonePrice", ) class Meta: @@ -4948,11 +6479,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceCreatedMessage(**data) + return models.ApprovalFlowCompletedMessagePayload(**data) -class StandalonePriceDeletedMessageSchema(MessageSchema): - sku = marshmallow.fields.String(allow_none=True, load_default=None) +class ApprovalFlowCreatedMessagePayloadSchema(MessagePayloadSchema): + approval_flow = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".approval_flow.ApprovalFlowSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="approvalFlow", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -4960,16 +6497,27 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceDeletedMessage(**data) + return models.ApprovalFlowCreatedMessagePayload(**data) -class StandalonePriceDiscountSetMessageSchema(MessageSchema): - discounted = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), +class ApprovalFlowRejectedMessagePayloadSchema(MessagePayloadSchema): + associate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + load_default=None, + ) + rejection_reason = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None, + data_key="rejectionReason", + ) + order = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.OrderReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, ) class Meta: @@ -4978,17 +6526,23 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceDiscountSetMessage(**data) + return models.ApprovalFlowRejectedMessagePayload(**data) -class StandalonePriceExternalDiscountSetMessageSchema(MessageSchema): - discounted = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), +class ApprovalRuleApproversSetMessagePayloadSchema(MessagePayloadSchema): + approvers = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".approval_rule.ApproverHierarchySchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) + old_approvers = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".approval_rule.ApproverHierarchySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="oldApprovers", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -4996,18 +6550,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceExternalDiscountSetMessage(**data) + return models.ApprovalRuleApproversSetMessagePayload(**data) -class StandalonePriceKeySetMessageSchema(MessageSchema): - key = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - old_key = marshmallow.fields.String( +class ApprovalRuleCreatedMessagePayloadSchema(MessagePayloadSchema): + approval_rule = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".approval_rule.ApprovalRuleSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldKey", + data_key="approvalRule", ) class Meta: @@ -5016,18 +6568,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceKeySetMessage(**data) + return models.ApprovalRuleCreatedMessagePayload(**data) -class StandalonePriceStagedChangesAppliedMessageSchema(MessageSchema): - staged_changes = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".standalone_price.StagedStandalonePriceSchema" - ), +class ApprovalRuleDescriptionSetMessagePayloadSchema(MessagePayloadSchema): + description = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + old_description = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="stagedChanges", + data_key="oldDescription", ) class Meta: @@ -5036,18 +6588,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceStagedChangesAppliedMessage(**data) + return models.ApprovalRuleDescriptionSetMessagePayload(**data) -class StandalonePriceStagedChangesRemovedMessageSchema(MessageSchema): - staged_changes = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".standalone_price.StagedStandalonePriceSchema" - ), +class ApprovalRuleKeySetMessagePayloadSchema(MessagePayloadSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + old_key = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="stagedChanges", + data_key="oldKey", ) class Meta: @@ -5056,15 +6608,13 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceStagedChangesRemovedMessage(**data) + return models.ApprovalRuleKeySetMessagePayload(**data) -class StandalonePriceTierAddedMessageSchema(MessageSchema): - tier = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceTierSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, +class ApprovalRuleNameSetMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + old_name = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="oldName" ) class Meta: @@ -5073,16 +6623,13 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceTierAddedMessage(**data) + return models.ApprovalRuleNameSetMessagePayload(**data) -class StandalonePriceTierRemovedMessageSchema(MessageSchema): - removed_tier = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceTierSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="removedTier", +class ApprovalRulePredicateSetMessagePayloadSchema(MessagePayloadSchema): + predicate = marshmallow.fields.String(allow_none=True, load_default=None) + old_predicate = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="oldPredicate" ) class Meta: @@ -5091,24 +6638,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceTierRemovedMessage(**data) + return models.ApprovalRulePredicateSetMessagePayload(**data) -class StandalonePriceTiersSetMessageSchema(MessageSchema): - tiers = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceTierSchema"), +class ApprovalRuleRequestersSetMessagePayloadSchema(MessagePayloadSchema): + requesters = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".approval_rule.RuleRequesterSchema"), allow_none=True, many=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - previous_tiers = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceTierSchema"), + old_requesters = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".approval_rule.RuleRequesterSchema"), allow_none=True, many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="previousTiers", + data_key="oldRequesters", ) class Meta: @@ -5117,33 +6664,19 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceTiersSetMessage(**data) + return models.ApprovalRuleRequestersSetMessagePayload(**data) -class StandalonePriceValidFromAndUntilSetMessageSchema(MessageSchema): - valid_from = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="validFrom", - ) - previous_valid_from = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="previousValidFrom", - ) - valid_until = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="validUntil", +class ApprovalRuleStatusSetMessagePayloadSchema(MessagePayloadSchema): + status = marshmallow_enum.EnumField( + ApprovalRuleStatus, by_value=True, allow_none=True, load_default=None ) - previous_valid_until = marshmallow.fields.DateTime( + old_status = marshmallow_enum.EnumField( + ApprovalRuleStatus, + by_value=True, allow_none=True, - metadata={"omit_empty": True}, load_default=None, - data_key="previousValidUntil", + data_key="oldStatus", ) class Meta: @@ -5152,21 +6685,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceValidFromAndUntilSetMessage(**data) + return models.ApprovalRuleStatusSetMessagePayload(**data) -class StandalonePriceValidFromSetMessageSchema(MessageSchema): - valid_from = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="validFrom", - ) - previous_valid_from = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="previousValidFrom", +class AssociateRoleBuyerAssignableChangedMessagePayloadSchema(MessagePayloadSchema): + buyer_assignable = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="buyerAssignable" ) class Meta: @@ -5175,21 +6699,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceValidFromSetMessage(**data) + return models.AssociateRoleBuyerAssignableChangedMessagePayload(**data) -class StandalonePriceValidUntilSetMessageSchema(MessageSchema): - valid_until = marshmallow.fields.DateTime( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="validUntil", - ) - previous_valid_until = marshmallow.fields.DateTime( +class AssociateRoleCreatedMessagePayloadSchema(MessagePayloadSchema): + associate_role = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".associate_role.AssociateRoleSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="previousValidUntil", + data_key="associateRole", ) class Meta: @@ -5198,25 +6717,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceValidUntilSetMessage(**data) + return models.AssociateRoleCreatedMessagePayload(**data) -class StandalonePriceValueChangedMessageSchema(MessageSchema): - value = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.MoneySchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) - old_value = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.MoneySchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="oldValue", - ) +class AssociateRoleDeletedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -5224,28 +6728,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StandalonePriceValueChangedMessage(**data) + return models.AssociateRoleDeletedMessagePayload(**data) -class StoreCountriesChangedMessageSchema(MessageSchema): - added_countries = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store_country.StoreCountrySchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="addedCountries", - ) - removed_countries = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store_country.StoreCountrySchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="removedCountries", - ) +class AssociateRoleNameChangedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -5253,60 +6740,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreCountriesChangedMessage(**data) + return models.AssociateRoleNameChangedMessagePayload(**data) -class StoreCreatedMessageSchema(MessageSchema): - name = LocalizedStringField( - allow_none=True, - values=marshmallow.fields.String(allow_none=True), - metadata={"omit_empty": True}, - load_default=None, - ) - languages = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - ) - countries = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store_country.StoreCountrySchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - ) - distribution_channels = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="distributionChannels", - ) - supply_channels = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="supplyChannels", - ) - product_selections = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="productSelections", - ) - custom = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, +class AssociateRolePermissionAddedMessagePayloadSchema(MessagePayloadSchema): + permission = marshmallow_enum.EnumField( + Permission, by_value=True, allow_none=True, load_default=None ) class Meta: @@ -5315,37 +6754,45 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreCreatedMessage(**data) + return models.AssociateRolePermissionAddedMessagePayload(**data) -class StoreDeletedMessageSchema(MessageSchema): +class AssociateRolePermissionRemovedMessagePayloadSchema(MessagePayloadSchema): + permission = marshmallow_enum.EnumField( + Permission, by_value=True, allow_none=True, load_default=None + ) + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreDeletedMessage(**data) + return models.AssociateRolePermissionRemovedMessagePayload(**data) -class StoreDistributionChannelsChangedMessageSchema(MessageSchema): - added_distribution_channels = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), +class AssociateRolePermissionsSetMessagePayloadSchema(MessagePayloadSchema): + permissions = marshmallow.fields.List( + marshmallow_enum.EnumField(Permission, by_value=True, allow_none=True), allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="addedDistributionChannels", ) - removed_distribution_channels = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.AssociateRolePermissionsSetMessagePayload(**data) + + +class BusinessUnitAddressAddedMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="removedDistributionChannels", ) class Meta: @@ -5354,23 +6801,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreDistributionChannelsChangedMessage(**data) + return models.BusinessUnitAddressAddedMessagePayload(**data) -class StoreLanguagesChangedMessageSchema(MessageSchema): - added_languages = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="addedLanguages", - ) - removed_languages = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), +class BusinessUnitAddressChangedMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="removedLanguages", ) class Meta: @@ -5379,24 +6818,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreLanguagesChangedMessage(**data) + return models.BusinessUnitAddressChangedMessagePayload(**data) -class StoreNameSetMessageSchema(MessageSchema): - name = LocalizedStringField( - allow_none=True, - values=marshmallow.fields.String(allow_none=True), - metadata={"omit_empty": True}, - load_default=None, - ) - name_all_locales = marshmallow.fields.List( - LocalizedStringField( - allow_none=True, values=marshmallow.fields.String(allow_none=True) - ), +class BusinessUnitAddressCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="nameAllLocales", + data_key="addressId", ) class Meta: @@ -5405,36 +6837,23 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreNameSetMessage(**data) + return models.BusinessUnitAddressCustomFieldAddedMessagePayload(**data) -class StoreProductSelectionsChangedMessageSchema(MessageSchema): - added_product_selections = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="addedProductSelections", - ) - removed_product_selections = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), +class BusinessUnitAddressCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + old_value = marshmallow.fields.Raw( allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="removedProductSelections", + data_key="oldValue", ) - updated_product_selections = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.ProductSelectionSettingSchema"), + address_id = marshmallow.fields.String( allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="updatedProductSelections", + data_key="addressId", ) class Meta: @@ -5443,27 +6862,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreProductSelectionsChangedMessage(**data) + return models.BusinessUnitAddressCustomFieldChangedMessagePayload(**data) -class StoreSupplyChannelsChangedMessageSchema(MessageSchema): - added_supply_channels = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="addedSupplyChannels", - ) - removed_supply_channels = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), +class BusinessUnitAddressCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="removedSupplyChannels", + data_key="addressId", ) class Meta: @@ -5472,47 +6880,51 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.StoreSupplyChannelsChangedMessage(**data) + return models.BusinessUnitAddressCustomFieldRemovedMessagePayload(**data) -class UserProvidedIdentifiersSchema(helpers.BaseSchema): - key = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - external_id = marshmallow.fields.String( +class BusinessUnitAddressCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): + old_type_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="externalId", + data_key="oldTypeId", ) - order_number = marshmallow.fields.String( + address_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="orderNumber", + data_key="addressId", ) - customer_number = marshmallow.fields.String( + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.BusinessUnitAddressCustomTypeRemovedMessagePayload(**data) + + +class BusinessUnitAddressCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): + custom_fields = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="customerNumber", - ) - sku = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None + data_key="customFields", ) - slug = LocalizedStringField( + old_type_id = marshmallow.fields.String( allow_none=True, - values=marshmallow.fields.String(allow_none=True), metadata={"omit_empty": True}, load_default=None, + data_key="oldTypeId", ) - container_and_key = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ContainerAndKeySchema"), + address_id = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="containerAndKey", + data_key="addressId", ) class Meta: @@ -5520,11 +6932,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): - return models.UserProvidedIdentifiers(**data) + del data["type"] + return models.BusinessUnitAddressCustomTypeSetMessagePayload(**data) -class MessagePayloadSchema(helpers.BaseSchema): - type = marshmallow.fields.String(allow_none=True, load_default=None) +class BusinessUnitAddressRemovedMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) class Meta: unknown = marshmallow.EXCLUDE @@ -5532,21 +6950,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.MessagePayload(**data) + return models.BusinessUnitAddressRemovedMessagePayload(**data) -class ApprovalFlowApprovedMessagePayloadSchema(MessagePayloadSchema): - associate = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), +class BusinessUnitApprovalRuleModeChangedMessagePayloadSchema(MessagePayloadSchema): + approval_rule_mode = marshmallow_enum.EnumField( + BusinessUnitApprovalRuleMode, + by_value=True, allow_none=True, - unknown=marshmallow.EXCLUDE, load_default=None, + data_key="approvalRuleMode", ) - order = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.OrderReferenceSchema"), + old_approval_rule_mode = marshmallow_enum.EnumField( + BusinessUnitApprovalRuleMode, + by_value=True, allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="oldApprovalRuleMode", ) class Meta: @@ -5555,15 +6976,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalFlowApprovedMessagePayload(**data) + return models.BusinessUnitApprovalRuleModeChangedMessagePayload(**data) -class ApprovalFlowCompletedMessagePayloadSchema(MessagePayloadSchema): - status = marshmallow_enum.EnumField( - ApprovalFlowStatus, by_value=True, allow_none=True, load_default=None - ) - order = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.OrderReferenceSchema"), +class BusinessUnitAssociateAddedMessagePayloadSchema(MessagePayloadSchema): + associate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, @@ -5575,16 +6993,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalFlowCompletedMessagePayload(**data) + return models.BusinessUnitAssociateAddedMessagePayload(**data) -class ApprovalFlowCreatedMessagePayloadSchema(MessagePayloadSchema): - approval_flow = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".approval_flow.ApprovalFlowSchema"), +class BusinessUnitAssociateChangedMessagePayloadSchema(MessagePayloadSchema): + associate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="approvalFlow", ) class Meta: @@ -5593,27 +7010,23 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalFlowCreatedMessagePayload(**data) + return models.BusinessUnitAssociateChangedMessagePayload(**data) -class ApprovalFlowRejectedMessagePayloadSchema(MessagePayloadSchema): - associate = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - rejection_reason = marshmallow.fields.String( +class BusinessUnitAssociateModeChangedMessagePayloadSchema(MessagePayloadSchema): + associate_mode = marshmallow_enum.EnumField( + BusinessUnitAssociateMode, + by_value=True, allow_none=True, - metadata={"omit_empty": True}, load_default=None, - data_key="rejectionReason", + data_key="associateMode", ) - order = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.OrderReferenceSchema"), + old_associate_mode = marshmallow_enum.EnumField( + BusinessUnitAssociateMode, + by_value=True, allow_none=True, - unknown=marshmallow.EXCLUDE, load_default=None, + data_key="oldAssociateMode", ) class Meta: @@ -5622,22 +7035,33 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalFlowRejectedMessagePayload(**data) + return models.BusinessUnitAssociateModeChangedMessagePayload(**data) -class ApprovalRuleApproversSetMessagePayloadSchema(MessagePayloadSchema): - approvers = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".approval_rule.ApproverHierarchySchema"), +class BusinessUnitAssociateRemovedMessagePayloadSchema(MessagePayloadSchema): + associate = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - old_approvers = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".approval_rule.ApproverHierarchySchema"), + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.BusinessUnitAssociateRemovedMessagePayload(**data) + + +class BusinessUnitAssociatesSetMessagePayloadSchema(MessagePayloadSchema): + associates = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), allow_none=True, + many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldApprovers", ) class Meta: @@ -5646,16 +7070,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRuleApproversSetMessagePayload(**data) + return models.BusinessUnitAssociatesSetMessagePayload(**data) -class ApprovalRuleCreatedMessagePayloadSchema(MessagePayloadSchema): - approval_rule = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".approval_rule.ApprovalRuleSchema"), +class BusinessUnitBillingAddressAddedMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="approvalRule", ) class Meta: @@ -5664,18 +7087,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRuleCreatedMessagePayload(**data) + return models.BusinessUnitBillingAddressAddedMessagePayload(**data) -class ApprovalRuleDescriptionSetMessagePayloadSchema(MessagePayloadSchema): - description = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - old_description = marshmallow.fields.String( +class BusinessUnitBillingAddressRemovedMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldDescription", ) class Meta: @@ -5684,18 +7104,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRuleDescriptionSetMessagePayload(**data) + return models.BusinessUnitBillingAddressRemovedMessagePayload(**data) -class ApprovalRuleKeySetMessagePayloadSchema(MessagePayloadSchema): - key = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - old_key = marshmallow.fields.String( +class BusinessUnitContactEmailSetMessagePayloadSchema(MessagePayloadSchema): + contact_email = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="oldKey", + data_key="contactEmail", ) class Meta: @@ -5704,13 +7121,19 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRuleKeySetMessagePayload(**data) + return models.BusinessUnitContactEmailSetMessagePayload(**data) -class ApprovalRuleNameSetMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - old_name = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="oldName" +class BusinessUnitCreatedMessagePayloadSchema(MessagePayloadSchema): + business_unit = helpers.Discriminator( + allow_none=True, + discriminator_field=("unitType", "unit_type"), + discriminator_schemas={ + "Company": helpers.absmod(__name__, ".business_unit.CompanySchema"), + "Division": helpers.absmod(__name__, ".business_unit.DivisionSchema"), + }, + load_default=None, + data_key="businessUnit", ) class Meta: @@ -5719,14 +7142,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRuleNameSetMessagePayload(**data) + return models.BusinessUnitCreatedMessagePayload(**data) -class ApprovalRulePredicateSetMessagePayloadSchema(MessagePayloadSchema): - predicate = marshmallow.fields.String(allow_none=True, load_default=None) - old_predicate = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="oldPredicate" - ) +class BusinessUnitCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -5734,24 +7155,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRulePredicateSetMessagePayload(**data) + return models.BusinessUnitCustomFieldAddedMessagePayload(**data) -class ApprovalRuleRequestersSetMessagePayloadSchema(MessagePayloadSchema): - requesters = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".approval_rule.RuleRequesterSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - old_requesters = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".approval_rule.RuleRequesterSchema"), +class BusinessUnitCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + old_value = marshmallow.fields.Raw( allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="oldRequesters", + data_key="oldValue", ) class Meta: @@ -5760,20 +7174,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRuleRequestersSetMessagePayload(**data) + return models.BusinessUnitCustomFieldChangedMessagePayload(**data) -class ApprovalRuleStatusSetMessagePayloadSchema(MessagePayloadSchema): - status = marshmallow_enum.EnumField( - ApprovalRuleStatus, by_value=True, allow_none=True, load_default=None - ) - old_status = marshmallow_enum.EnumField( - ApprovalRuleStatus, - by_value=True, - allow_none=True, - load_default=None, - data_key="oldStatus", - ) +class BusinessUnitCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -5781,12 +7186,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ApprovalRuleStatusSetMessagePayload(**data) + return models.BusinessUnitCustomFieldRemovedMessagePayload(**data) -class AssociateRoleBuyerAssignableChangedMessagePayloadSchema(MessagePayloadSchema): - buyer_assignable = marshmallow.fields.Boolean( - allow_none=True, load_default=None, data_key="buyerAssignable" +class BusinessUnitCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): + old_type_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldTypeId", ) class Meta: @@ -5795,16 +7203,22 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.AssociateRoleBuyerAssignableChangedMessagePayload(**data) + return models.BusinessUnitCustomTypeRemovedMessagePayload(**data) -class AssociateRoleCreatedMessagePayloadSchema(MessagePayloadSchema): - associate_role = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".associate_role.AssociateRoleSchema"), +class BusinessUnitCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): + custom_fields = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="associateRole", + data_key="customFields", + ) + old_type_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldTypeId", ) class Meta: @@ -5813,21 +7227,35 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.AssociateRoleCreatedMessagePayload(**data) + return models.BusinessUnitCustomTypeSetMessagePayload(**data) + +class BusinessUnitDefaultBillingAddressSetMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) -class AssociateRoleDeletedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.AssociateRoleDeletedMessagePayload(**data) + return models.BusinessUnitDefaultBillingAddressSetMessagePayload(**data) -class AssociateRoleNameChangedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) +class BusinessUnitDefaultShippingAddressSetMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) class Meta: unknown = marshmallow.EXCLUDE @@ -5835,13 +7263,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.AssociateRoleNameChangedMessagePayload(**data) + return models.BusinessUnitDefaultShippingAddressSetMessagePayload(**data) -class AssociateRolePermissionAddedMessagePayloadSchema(MessagePayloadSchema): - permission = marshmallow_enum.EnumField( - Permission, by_value=True, allow_none=True, load_default=None - ) +class BusinessUnitDeletedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -5849,13 +7274,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.AssociateRolePermissionAddedMessagePayload(**data) + return models.BusinessUnitDeletedMessagePayload(**data) -class AssociateRolePermissionRemovedMessagePayloadSchema(MessagePayloadSchema): - permission = marshmallow_enum.EnumField( - Permission, by_value=True, allow_none=True, load_default=None - ) +class BusinessUnitNameChangedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -5863,14 +7286,29 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.AssociateRolePermissionRemovedMessagePayload(**data) + return models.BusinessUnitNameChangedMessagePayload(**data) -class AssociateRolePermissionsSetMessagePayloadSchema(MessagePayloadSchema): - permissions = marshmallow.fields.List( - marshmallow_enum.EnumField(Permission, by_value=True, allow_none=True), +class BusinessUnitParentChangedMessagePayloadSchema(MessagePayloadSchema): + old_parent_unit = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".business_unit.BusinessUnitKeyReferenceSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldParentUnit", + ) + new_parent_unit = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".business_unit.BusinessUnitKeyReferenceSchema" + ), allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="newParentUnit", ) class Meta: @@ -5879,10 +7317,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.AssociateRolePermissionsSetMessagePayload(**data) + return models.BusinessUnitParentChangedMessagePayload(**data) -class BusinessUnitAddressAddedMessagePayloadSchema(MessagePayloadSchema): +class BusinessUnitShippingAddressAddedMessagePayloadSchema(MessagePayloadSchema): address = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, @@ -5896,10 +7334,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAddressAddedMessagePayload(**data) + return models.BusinessUnitShippingAddressAddedMessagePayload(**data) -class BusinessUnitAddressChangedMessagePayloadSchema(MessagePayloadSchema): +class BusinessUnitShippingAddressRemovedMessagePayloadSchema(MessagePayloadSchema): address = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, @@ -5913,12 +7351,13 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAddressChangedMessagePayload(**data) + return models.BusinessUnitShippingAddressRemovedMessagePayload(**data) -class BusinessUnitAddressCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) +class BusinessUnitStatusChangedMessagePayloadSchema(MessagePayloadSchema): + active = marshmallow_enum.EnumField( + BusinessUnitStatus, by_value=True, allow_none=True, load_default=None + ) class Meta: unknown = marshmallow.EXCLUDE @@ -5926,17 +7365,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAddressCustomFieldAddedMessagePayload(**data) + return models.BusinessUnitStatusChangedMessagePayload(**data) -class BusinessUnitAddressCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) - old_value = marshmallow.fields.Raw( +class BusinessUnitStoreAddedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldValue", ) class Meta: @@ -5945,27 +7382,38 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAddressCustomFieldChangedMessagePayload(**data) - - -class BusinessUnitAddressCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.BusinessUnitAddressCustomFieldRemovedMessagePayload(**data) + return models.BusinessUnitStoreAddedMessagePayload(**data) -class BusinessUnitAddressCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): - old_type_id = marshmallow.fields.String( +class BusinessUnitStoreModeChangedMessagePayloadSchema(MessagePayloadSchema): + stores = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, - metadata={"omit_empty": True}, + many=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldTypeId", + ) + store_mode = marshmallow_enum.EnumField( + BusinessUnitStoreMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="storeMode", + ) + old_stores = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="oldStores", + ) + old_store_mode = marshmallow_enum.EnumField( + BusinessUnitStoreMode, + by_value=True, + allow_none=True, + load_default=None, + data_key="oldStoreMode", ) class Meta: @@ -5974,22 +7422,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAddressCustomTypeRemovedMessagePayload(**data) + return models.BusinessUnitStoreModeChangedMessagePayload(**data) -class BusinessUnitAddressCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): - custom_fields = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), +class BusinessUnitStoreRemovedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="customFields", - ) - old_type_id = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="oldTypeId", ) class Meta: @@ -5998,13 +7439,14 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAddressCustomTypeSetMessagePayload(**data) + return models.BusinessUnitStoreRemovedMessagePayload(**data) -class BusinessUnitAddressRemovedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class BusinessUnitStoresSetMessagePayloadSchema(MessagePayloadSchema): + stores = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, + many=True, unknown=marshmallow.EXCLUDE, load_default=None, ) @@ -6015,15 +7457,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAddressRemovedMessagePayload(**data) + return models.BusinessUnitStoresSetMessagePayload(**data) -class BusinessUnitAssociateAddedMessagePayloadSchema(MessagePayloadSchema): - associate = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), +class CartDiscountCreatedMessagePayloadSchema(MessagePayloadSchema): + cart_discount = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart_discount.CartDiscountSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, + data_key="cartDiscount", ) class Meta: @@ -6032,16 +7475,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAssociateAddedMessagePayload(**data) + return models.CartDiscountCreatedMessagePayload(**data) -class BusinessUnitAssociateChangedMessagePayloadSchema(MessagePayloadSchema): - associate = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) +class CartDiscountDeletedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -6049,23 +7486,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAssociateChangedMessagePayload(**data) + return models.CartDiscountDeletedMessagePayload(**data) -class BusinessUnitAssociateModeChangedMessagePayloadSchema(MessagePayloadSchema): - associate_mode = marshmallow_enum.EnumField( - BusinessUnitAssociateMode, - by_value=True, - allow_none=True, - load_default=None, - data_key="associateMode", - ) - old_associate_mode = marshmallow_enum.EnumField( - BusinessUnitAssociateMode, - by_value=True, +class CartDiscountStoreAddedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldAssociateMode", ) class Meta: @@ -6074,12 +7503,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAssociateModeChangedMessagePayload(**data) + return models.CartDiscountStoreAddedMessagePayload(**data) -class BusinessUnitAssociateRemovedMessagePayloadSchema(MessagePayloadSchema): - associate = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), +class CartDiscountStoreRemovedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, @@ -6091,12 +7520,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAssociateRemovedMessagePayload(**data) + return models.CartDiscountStoreRemovedMessagePayload(**data) -class BusinessUnitAssociatesSetMessagePayloadSchema(MessagePayloadSchema): - associates = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".business_unit.AssociateSchema"), +class CartDiscountStoresSetMessagePayloadSchema(MessagePayloadSchema): + stores = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, many=True, unknown=marshmallow.EXCLUDE, @@ -6109,12 +7538,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitAssociatesSetMessagePayload(**data) + return models.CartDiscountStoresSetMessagePayload(**data) -class BusinessUnitBillingAddressAddedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class CategoryCreatedMessagePayloadSchema(MessagePayloadSchema): + category = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".category.CategorySchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, @@ -6126,15 +7555,21 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitBillingAddressAddedMessagePayload(**data) + return models.CategoryCreatedMessagePayload(**data) -class BusinessUnitBillingAddressRemovedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class CategorySlugChangedMessagePayloadSchema(MessagePayloadSchema): + slug = LocalizedStringField( allow_none=True, - unknown=marshmallow.EXCLUDE, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + old_slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, load_default=None, + data_key="oldSlug", ) class Meta: @@ -6143,15 +7578,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitBillingAddressRemovedMessagePayload(**data) + return models.CategorySlugChangedMessagePayload(**data) -class BusinessUnitContactEmailSetMessagePayloadSchema(MessagePayloadSchema): - contact_email = marshmallow.fields.String( +class CustomerAddressAddedMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="contactEmail", ) class Meta: @@ -6160,19 +7595,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitContactEmailSetMessagePayload(**data) + return models.CustomerAddressAddedMessagePayload(**data) -class BusinessUnitCreatedMessagePayloadSchema(MessagePayloadSchema): - business_unit = helpers.Discriminator( +class CustomerAddressChangedMessagePayloadSchema(MessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, - discriminator_field=("unitType", "unit_type"), - discriminator_schemas={ - "Company": helpers.absmod(__name__, ".business_unit.CompanySchema"), - "Division": helpers.absmod(__name__, ".business_unit.DivisionSchema"), - }, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="businessUnit", ) class Meta: @@ -6181,12 +7612,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitCreatedMessagePayload(**data) + return models.CustomerAddressChangedMessagePayload(**data) -class BusinessUnitCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): +class CustomerAddressCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) value = marshmallow.fields.Raw(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -6194,17 +7631,23 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitCustomFieldAddedMessagePayload(**data) + return models.CustomerAddressCustomFieldAddedMessagePayload(**data) -class BusinessUnitCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): +class CustomerAddressCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) value = marshmallow.fields.Raw(allow_none=True, load_default=None) - old_value = marshmallow.fields.Raw( + previous_value = marshmallow.fields.Raw( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="previousValue", + ) + address_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="oldValue", + data_key="addressId", ) class Meta: @@ -6213,11 +7656,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitCustomFieldChangedMessagePayload(**data) + return models.CustomerAddressCustomFieldChangedMessagePayload(**data) -class BusinessUnitCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): +class CustomerAddressCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -6225,15 +7674,21 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitCustomFieldRemovedMessagePayload(**data) + return models.CustomerAddressCustomFieldRemovedMessagePayload(**data) -class BusinessUnitCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): - old_type_id = marshmallow.fields.String( +class CustomerAddressCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): + previous_type_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="oldTypeId", + data_key="previousTypeId", + ) + address_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="addressId", ) class Meta: @@ -6242,10 +7697,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitCustomTypeRemovedMessagePayload(**data) + return models.CustomerAddressCustomTypeRemovedMessagePayload(**data) -class BusinessUnitCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): +class CustomerAddressCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): custom_fields = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, @@ -6253,29 +7708,17 @@ class BusinessUnitCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): load_default=None, data_key="customFields", ) - old_type_id = marshmallow.fields.String( + previous_type_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="oldTypeId", + data_key="previousTypeId", ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.BusinessUnitCustomTypeSetMessagePayload(**data) - - -class BusinessUnitDefaultBillingAddressSetMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), + address_id = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, + data_key="addressId", ) class Meta: @@ -6284,15 +7727,14 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitDefaultBillingAddressSetMessagePayload(**data) + return models.CustomerAddressCustomTypeSetMessagePayload(**data) -class BusinessUnitDefaultShippingAddressSetMessagePayloadSchema(MessagePayloadSchema): +class CustomerAddressRemovedMessagePayloadSchema(MessagePayloadSchema): address = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) @@ -6302,21 +7744,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitDefaultShippingAddressSetMessagePayload(**data) - - -class BusinessUnitDeletedMessagePayloadSchema(MessagePayloadSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.BusinessUnitDeletedMessagePayload(**data) + return models.CustomerAddressRemovedMessagePayload(**data) -class BusinessUnitNameChangedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) +class CustomerCompanyNameSetMessagePayloadSchema(MessagePayloadSchema): + company_name = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="companyName", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -6324,29 +7761,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitNameChangedMessagePayload(**data) + return models.CustomerCompanyNameSetMessagePayload(**data) -class BusinessUnitParentChangedMessagePayloadSchema(MessagePayloadSchema): - old_parent_unit = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".business_unit.BusinessUnitKeyReferenceSchema" - ), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="oldParentUnit", - ) - new_parent_unit = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".business_unit.BusinessUnitKeyReferenceSchema" - ), +class CustomerCreatedMessagePayloadSchema(MessagePayloadSchema): + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="newParentUnit", ) class Meta: @@ -6355,16 +7778,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitParentChangedMessagePayload(**data) + return models.CustomerCreatedMessagePayload(**data) -class BusinessUnitShippingAddressAddedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) +class CustomerCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -6372,15 +7791,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitShippingAddressAddedMessagePayload(**data) + return models.CustomerCustomFieldAddedMessagePayload(**data) -class BusinessUnitShippingAddressRemovedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class CustomerCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + previous_value = marshmallow.fields.Raw( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="previousValue", ) class Meta: @@ -6389,13 +7810,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitShippingAddressRemovedMessagePayload(**data) + return models.CustomerCustomFieldChangedMessagePayload(**data) -class BusinessUnitStatusChangedMessagePayloadSchema(MessagePayloadSchema): - active = marshmallow_enum.EnumField( - BusinessUnitStatus, by_value=True, allow_none=True, load_default=None - ) +class CustomerCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -6403,15 +7822,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitStatusChangedMessagePayload(**data) + return models.CustomerCustomFieldRemovedMessagePayload(**data) -class BusinessUnitStoreAddedMessagePayloadSchema(MessagePayloadSchema): - store = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), +class CustomerCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): + previous_type_id = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="previousTypeId", ) class Meta: @@ -6420,38 +7839,22 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitStoreAddedMessagePayload(**data) + return models.CustomerCustomTypeRemovedMessagePayload(**data) -class BusinessUnitStoreModeChangedMessagePayloadSchema(MessagePayloadSchema): - stores = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) - store_mode = marshmallow_enum.EnumField( - BusinessUnitStoreMode, - by_value=True, - allow_none=True, - load_default=None, - data_key="storeMode", - ) - old_stores = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), +class CustomerCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): + custom_fields = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldStores", + data_key="customFields", ) - old_store_mode = marshmallow_enum.EnumField( - BusinessUnitStoreMode, - by_value=True, + previous_type_id = marshmallow.fields.String( allow_none=True, + metadata={"omit_empty": True}, load_default=None, - data_key="oldStoreMode", + data_key="previousTypeId", ) class Meta: @@ -6460,15 +7863,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitStoreModeChangedMessagePayload(**data) + return models.CustomerCustomTypeSetMessagePayload(**data) -class BusinessUnitStoreRemovedMessagePayloadSchema(MessagePayloadSchema): - store = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), +class CustomerDateOfBirthSetMessagePayloadSchema(MessagePayloadSchema): + date_of_birth = marshmallow.fields.Date( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="dateOfBirth", ) class Meta: @@ -6477,17 +7880,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitStoreRemovedMessagePayload(**data) + return models.CustomerDateOfBirthSetMessagePayload(**data) -class BusinessUnitStoresSetMessagePayloadSchema(MessagePayloadSchema): - stores = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) +class CustomerDeletedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -6495,16 +7891,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.BusinessUnitStoresSetMessagePayload(**data) + return models.CustomerDeletedMessagePayload(**data) -class CategoryCreatedMessagePayloadSchema(MessagePayloadSchema): - category = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".category.CategorySchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) +class CustomerEmailChangedMessagePayloadSchema(MessagePayloadSchema): + email = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -6512,21 +7903,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CategoryCreatedMessagePayload(**data) + return models.CustomerEmailChangedMessagePayload(**data) -class CategorySlugChangedMessagePayloadSchema(MessagePayloadSchema): - slug = LocalizedStringField( - allow_none=True, - values=marshmallow.fields.String(allow_none=True), - load_default=None, +class CustomerEmailTokenCreatedMessagePayloadSchema(MessagePayloadSchema): + customer_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customerId" ) - old_slug = LocalizedStringField( - allow_none=True, - values=marshmallow.fields.String(allow_none=True), - metadata={"omit_empty": True}, - load_default=None, - data_key="oldSlug", + expires_at = marshmallow.fields.DateTime( + allow_none=True, load_default=None, data_key="expiresAt" ) class Meta: @@ -6535,16 +7920,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CategorySlugChangedMessagePayload(**data) + return models.CustomerEmailTokenCreatedMessagePayload(**data) -class CustomerAddressAddedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - ) +class CustomerEmailVerifiedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -6552,15 +7931,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressAddedMessagePayload(**data) + return models.CustomerEmailVerifiedMessagePayload(**data) -class CustomerAddressChangedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class CustomerFirstNameSetMessagePayloadSchema(MessagePayloadSchema): + first_name = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="firstName", ) class Meta: @@ -6569,10 +7948,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressChangedMessagePayload(**data) + return models.CustomerFirstNameSetMessagePayload(**data) -class CustomerAddressCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): +class CustomerGroupCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) value = marshmallow.fields.Raw(allow_none=True, load_default=None) @@ -6582,17 +7961,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressCustomFieldAddedMessagePayload(**data) + return models.CustomerGroupCustomFieldAddedMessagePayload(**data) -class CustomerAddressCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): +class CustomerGroupCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) value = marshmallow.fields.Raw(allow_none=True, load_default=None) - previous_value = marshmallow.fields.Raw( + old_value = marshmallow.fields.Raw( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="previousValue", + data_key="oldValue", ) class Meta: @@ -6601,10 +7980,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressCustomFieldChangedMessagePayload(**data) + return models.CustomerGroupCustomFieldChangedMessagePayload(**data) -class CustomerAddressCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): +class CustomerGroupCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): name = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: @@ -6613,15 +7992,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressCustomFieldRemovedMessagePayload(**data) + return models.CustomerGroupCustomFieldRemovedMessagePayload(**data) -class CustomerAddressCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): - previous_type_id = marshmallow.fields.String( +class CustomerGroupCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): + old_type_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="previousTypeId", + data_key="oldTypeId", ) class Meta: @@ -6630,10 +8009,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressCustomTypeRemovedMessagePayload(**data) + return models.CustomerGroupCustomTypeRemovedMessagePayload(**data) -class CustomerAddressCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): +class CustomerGroupCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): custom_fields = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, @@ -6641,11 +8020,11 @@ class CustomerAddressCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): load_default=None, data_key="customFields", ) - previous_type_id = marshmallow.fields.String( + old_type_id = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="previousTypeId", + data_key="oldTypeId", ) class Meta: @@ -6654,15 +8033,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressCustomTypeSetMessagePayload(**data) + return models.CustomerGroupCustomTypeSetMessagePayload(**data) -class CustomerAddressRemovedMessagePayloadSchema(MessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class CustomerGroupSetMessagePayloadSchema(MessagePayloadSchema): + customer_group = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="customerGroup", ) class Meta: @@ -6671,15 +8052,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerAddressRemovedMessagePayload(**data) + return models.CustomerGroupSetMessagePayload(**data) -class CustomerCompanyNameSetMessagePayloadSchema(MessagePayloadSchema): - company_name = marshmallow.fields.String( +class CustomerLastNameSetMessagePayloadSchema(MessagePayloadSchema): + last_name = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="companyName", + data_key="lastName", ) class Meta: @@ -6688,15 +8069,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerCompanyNameSetMessagePayload(**data) + return models.CustomerLastNameSetMessagePayload(**data) -class CustomerCreatedMessagePayloadSchema(MessagePayloadSchema): - customer = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, +class CustomerPasswordTokenCreatedMessagePayloadSchema(MessagePayloadSchema): + customer_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customerId" + ) + expires_at = marshmallow.fields.DateTime( + allow_none=True, load_default=None, data_key="expiresAt" ) class Meta: @@ -6705,12 +8086,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerCreatedMessagePayload(**data) + return models.CustomerPasswordTokenCreatedMessagePayload(**data) -class CustomerCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) +class CustomerPasswordUpdatedMessagePayloadSchema(MessagePayloadSchema): + reset = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -6718,17 +8098,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerCustomFieldAddedMessagePayload(**data) + return models.CustomerPasswordUpdatedMessagePayload(**data) -class CustomerCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) - previous_value = marshmallow.fields.Raw( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="previousValue", +class CustomerTitleSetMessagePayloadSchema(MessagePayloadSchema): + title = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None ) class Meta: @@ -6737,11 +8112,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerCustomFieldChangedMessagePayload(**data) + return models.CustomerTitleSetMessagePayload(**data) -class CustomerCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) +class DiscountCodeCreatedMessagePayloadSchema(MessagePayloadSchema): + discount_code = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".discount_code.DiscountCodeSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="discountCode", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -6749,16 +8130,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerCustomFieldRemovedMessagePayload(**data) + return models.DiscountCodeCreatedMessagePayload(**data) -class CustomerCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): - previous_type_id = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="previousTypeId", - ) +class DiscountCodeDeletedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -6766,22 +8141,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerCustomTypeRemovedMessagePayload(**data) + return models.DiscountCodeDeletedMessagePayload(**data) -class CustomerCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): - custom_fields = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="customFields", +class DiscountCodeKeySetMessagePayloadSchema(MessagePayloadSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None ) - previous_type_id = marshmallow.fields.String( + old_key = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="previousTypeId", + data_key="oldKey", ) class Meta: @@ -6790,15 +8161,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerCustomTypeSetMessagePayload(**data) + return models.DiscountCodeKeySetMessagePayload(**data) -class CustomerDateOfBirthSetMessagePayloadSchema(MessagePayloadSchema): - date_of_birth = marshmallow.fields.Date( +class InventoryEntryCreatedMessagePayloadSchema(MessagePayloadSchema): + inventory_entry = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".inventory.InventoryEntrySchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="dateOfBirth", + data_key="inventoryEntry", ) class Meta: @@ -6807,21 +8179,50 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerDateOfBirthSetMessagePayload(**data) + return models.InventoryEntryCreatedMessagePayload(**data) -class CustomerDeletedMessagePayloadSchema(MessagePayloadSchema): +class InventoryEntryDeletedMessagePayloadSchema(MessagePayloadSchema): + sku = marshmallow.fields.String(allow_none=True, load_default=None) + supply_channel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="supplyChannel", + ) + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerDeletedMessagePayload(**data) + return models.InventoryEntryDeletedMessagePayload(**data) -class CustomerEmailChangedMessagePayloadSchema(MessagePayloadSchema): - email = marshmallow.fields.String(allow_none=True, load_default=None) +class InventoryEntryQuantitySetMessagePayloadSchema(MessagePayloadSchema): + old_quantity_on_stock = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="oldQuantityOnStock" + ) + new_quantity_on_stock = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="newQuantityOnStock" + ) + old_available_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="oldAvailableQuantity" + ) + new_available_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="newAvailableQuantity" + ) + supply_channel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="supplyChannel", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -6829,16 +8230,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerEmailChangedMessagePayload(**data) + return models.InventoryEntryQuantitySetMessagePayload(**data) -class CustomerEmailTokenCreatedMessagePayloadSchema(MessagePayloadSchema): - customer_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="customerId" - ) - expires_at = marshmallow.fields.DateTime( - allow_none=True, load_default=None, data_key="expiresAt" - ) +class OrderMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -6846,25 +8241,59 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerEmailTokenCreatedMessagePayload(**data) + return models.OrderMessagePayload(**data) -class CustomerEmailVerifiedMessagePayloadSchema(MessagePayloadSchema): +class CustomLineItemStateTransitionMessagePayloadSchema(OrderMessagePayloadSchema): + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + custom_line_item_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="customLineItemKey", + ) + transition_date = marshmallow.fields.DateTime( + allow_none=True, load_default=None, data_key="transitionDate" + ) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + from_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="fromState", + ) + to_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="toState", + ) + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerEmailVerifiedMessagePayload(**data) + return models.CustomLineItemStateTransitionMessagePayload(**data) -class CustomerFirstNameSetMessagePayloadSchema(MessagePayloadSchema): - first_name = marshmallow.fields.String( +class DeliveryAddedMessagePayloadSchema(OrderMessagePayloadSchema): + delivery = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.DeliverySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + shipping_key = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="firstName", + data_key="shippingKey", ) class Meta: @@ -6873,12 +8302,34 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerFirstNameSetMessagePayload(**data) + return models.DeliveryAddedMessagePayload(**data) -class CustomerGroupCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) +class DeliveryAddressSetMessagePayloadSchema(OrderMessagePayloadSchema): + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" + ) + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + old_address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldAddress", + ) + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingKey", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -6886,17 +8337,33 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerGroupCustomFieldAddedMessagePayload(**data) + return models.DeliveryAddressSetMessagePayload(**data) -class CustomerGroupCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) - old_value = marshmallow.fields.Raw( +class DeliveryItemsUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" + ) + items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + old_items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="oldItems", + ) + shipping_key = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="oldValue", + data_key="shippingKey", ) class Meta: @@ -6905,11 +8372,22 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerGroupCustomFieldChangedMessagePayload(**data) + return models.DeliveryItemsUpdatedMessagePayload(**data) -class CustomerGroupCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) +class DeliveryRemovedMessagePayloadSchema(OrderMessagePayloadSchema): + delivery = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.DeliverySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingKey", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -6917,15 +8395,36 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerGroupCustomFieldRemovedMessagePayload(**data) + return models.DeliveryRemovedMessagePayload(**data) -class CustomerGroupCustomTypeRemovedMessagePayloadSchema(MessagePayloadSchema): - old_type_id = marshmallow.fields.String( +class LineItemStateTransitionMessagePayloadSchema(OrderMessagePayloadSchema): + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + line_item_key = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="oldTypeId", + data_key="lineItemKey", + ) + transition_date = marshmallow.fields.DateTime( + allow_none=True, load_default=None, data_key="transitionDate" + ) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + from_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="fromState", + ) + to_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="toState", ) class Meta: @@ -6934,22 +8433,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerGroupCustomTypeRemovedMessagePayload(**data) + return models.LineItemStateTransitionMessagePayload(**data) -class CustomerGroupCustomTypeSetMessagePayloadSchema(MessagePayloadSchema): - custom_fields = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), +class OrderBillingAddressSetMessagePayloadSchema(OrderMessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="customFields", ) - old_type_id = marshmallow.fields.String( + old_address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldTypeId", + data_key="oldAddress", ) class Meta: @@ -6958,17 +8459,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerGroupCustomTypeSetMessagePayload(**data) + return models.OrderBillingAddressSetMessagePayload(**data) -class CustomerGroupSetMessagePayloadSchema(MessagePayloadSchema): - customer_group = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), +class OrderCreatedMessagePayloadSchema(OrderMessagePayloadSchema): + order = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.OrderSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="customerGroup", ) class Meta: @@ -6977,16 +8476,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerGroupSetMessagePayload(**data) + return models.OrderCreatedMessagePayload(**data) -class CustomerLastNameSetMessagePayloadSchema(MessagePayloadSchema): - last_name = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="lastName", - ) +class OrderCustomFieldAddedMessagePayloadSchema(OrderMessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -6994,15 +8489,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerLastNameSetMessagePayload(**data) + return models.OrderCustomFieldAddedMessagePayload(**data) -class CustomerPasswordTokenCreatedMessagePayloadSchema(MessagePayloadSchema): - customer_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="customerId" - ) - expires_at = marshmallow.fields.DateTime( - allow_none=True, load_default=None, data_key="expiresAt" +class OrderCustomFieldChangedMessagePayloadSchema(OrderMessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + previous_value = marshmallow.fields.Raw( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="previousValue", ) class Meta: @@ -7011,11 +8508,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerPasswordTokenCreatedMessagePayload(**data) + return models.OrderCustomFieldChangedMessagePayload(**data) -class CustomerPasswordUpdatedMessagePayloadSchema(MessagePayloadSchema): - reset = marshmallow.fields.Boolean(allow_none=True, load_default=None) +class OrderCustomFieldRemovedMessagePayloadSchema(OrderMessagePayloadSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -7023,12 +8520,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerPasswordUpdatedMessagePayload(**data) + return models.OrderCustomFieldRemovedMessagePayload(**data) -class CustomerTitleSetMessagePayloadSchema(MessagePayloadSchema): - title = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None +class OrderCustomLineItemAddedMessagePayloadSchema(OrderMessagePayloadSchema): + custom_line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.CustomLineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="customLineItem", ) class Meta: @@ -7037,16 +8538,36 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomerTitleSetMessagePayload(**data) + return models.OrderCustomLineItemAddedMessagePayload(**data) -class InventoryEntryCreatedMessagePayloadSchema(MessagePayloadSchema): - inventory_entry = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".inventory.InventoryEntrySchema"), +class OrderCustomLineItemDiscountSetMessagePayloadSchema(OrderMessagePayloadSchema): + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + custom_line_item_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="customLineItemKey", + ) + discounted_price_per_quantity = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".cart.DiscountedLineItemPriceForQuantitySchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="discountedPricePerQuantity", + ) + taxed_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.TaxedItemPriceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="inventoryEntry", + data_key="taxedPrice", ) class Meta: @@ -7055,18 +8576,22 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.InventoryEntryCreatedMessagePayload(**data) + return models.OrderCustomLineItemDiscountSetMessagePayload(**data) -class InventoryEntryDeletedMessagePayloadSchema(MessagePayloadSchema): - sku = marshmallow.fields.String(allow_none=True, load_default=None) - supply_channel = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), +class OrderCustomLineItemQuantityChangedMessagePayloadSchema(OrderMessagePayloadSchema): + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" + ) + custom_line_item_key = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="supplyChannel", + data_key="customLineItemKey", + ) + quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) + old_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="oldQuantity" ) class Meta: @@ -7075,29 +8600,25 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.InventoryEntryDeletedMessagePayload(**data) + return models.OrderCustomLineItemQuantityChangedMessagePayload(**data) -class InventoryEntryQuantitySetMessagePayloadSchema(MessagePayloadSchema): - old_quantity_on_stock = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="oldQuantityOnStock" - ) - new_quantity_on_stock = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="newQuantityOnStock" - ) - old_available_quantity = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="oldAvailableQuantity" +class OrderCustomLineItemRemovedMessagePayloadSchema(OrderMessagePayloadSchema): + custom_line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="customLineItemId" ) - new_available_quantity = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="newAvailableQuantity" + custom_line_item_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="customLineItemKey", ) - supply_channel = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + custom_line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.CustomLineItemSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="supplyChannel", + data_key="customLineItem", ) class Meta: @@ -7106,46 +8627,59 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.InventoryEntryQuantitySetMessagePayload(**data) + return models.OrderCustomLineItemRemovedMessagePayload(**data) -class OrderMessagePayloadSchema(MessagePayloadSchema): +class OrderCustomTypeRemovedMessagePayloadSchema(OrderMessagePayloadSchema): + previous_type_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="previousTypeId", + ) + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderMessagePayload(**data) + return models.OrderCustomTypeRemovedMessagePayload(**data) -class CustomLineItemStateTransitionMessagePayloadSchema(OrderMessagePayloadSchema): - custom_line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="customLineItemId" - ) - custom_line_item_key = marshmallow.fields.String( +class OrderCustomTypeSetMessagePayloadSchema(OrderMessagePayloadSchema): + custom_fields = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="customLineItemKey", - ) - transition_date = marshmallow.fields.DateTime( - allow_none=True, load_default=None, data_key="transitionDate" + data_key="customFields", ) - quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) - from_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + previous_type_id = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="fromState", + data_key="previousTypeId", ) - to_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.OrderCustomTypeSetMessagePayload(**data) + + +class OrderCustomerEmailSetMessagePayloadSchema(OrderMessagePayloadSchema): + email = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + old_email = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="toState", + data_key="oldEmail", ) class Meta: @@ -7154,21 +8688,25 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.CustomLineItemStateTransitionMessagePayload(**data) + return models.OrderCustomerEmailSetMessagePayload(**data) -class DeliveryAddedMessagePayloadSchema(OrderMessagePayloadSchema): - delivery = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.DeliverySchema"), +class OrderCustomerGroupSetMessagePayloadSchema(OrderMessagePayloadSchema): + customer_group = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="customerGroup", ) - shipping_key = marshmallow.fields.String( + old_customer_group = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="shippingKey", + data_key="oldCustomerGroup", ) class Meta: @@ -7177,33 +8715,40 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.DeliveryAddedMessagePayload(**data) + return models.OrderCustomerGroupSetMessagePayload(**data) -class DeliveryAddressSetMessagePayloadSchema(OrderMessagePayloadSchema): - delivery_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="deliveryId" +class OrderCustomerSetMessagePayloadSchema(OrderMessagePayloadSchema): + customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, ) - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), + customer_group = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, + data_key="customerGroup", ) - old_address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), + old_customer = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldAddress", + data_key="oldCustomer", ) - shipping_key = marshmallow.fields.String( + old_customer_group = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="shippingKey", + data_key="oldCustomerGroup", ) class Meta: @@ -7212,33 +8757,33 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.DeliveryAddressSetMessagePayload(**data) + return models.OrderCustomerSetMessagePayload(**data) -class DeliveryItemsUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): - delivery_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="deliveryId" - ) - items = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), +class OrderDeletedMessagePayloadSchema(OrderMessagePayloadSchema): + order = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.OrderSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - old_items = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.OrderDeletedMessagePayload(**data) + + +class OrderDiscountCodeAddedMessagePayloadSchema(OrderMessagePayloadSchema): + discount_code = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".discount_code.DiscountCodeReferenceSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldItems", - ) - shipping_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingKey", + data_key="discountCode", ) class Meta: @@ -7247,21 +8792,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.DeliveryItemsUpdatedMessagePayload(**data) + return models.OrderDiscountCodeAddedMessagePayload(**data) -class DeliveryRemovedMessagePayloadSchema(OrderMessagePayloadSchema): - delivery = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.DeliverySchema"), +class OrderDiscountCodeRemovedMessagePayloadSchema(OrderMessagePayloadSchema): + discount_code = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".discount_code.DiscountCodeReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - ) - shipping_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingKey", + data_key="discountCode", ) class Meta: @@ -7270,36 +8810,27 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.DeliveryRemovedMessagePayload(**data) + return models.OrderDiscountCodeRemovedMessagePayload(**data) -class LineItemStateTransitionMessagePayloadSchema(OrderMessagePayloadSchema): - line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="lineItemId" - ) - line_item_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="lineItemKey", - ) - transition_date = marshmallow.fields.DateTime( - allow_none=True, load_default=None, data_key="transitionDate" - ) - quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) - from_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), +class OrderDiscountCodeStateSetMessagePayloadSchema(OrderMessagePayloadSchema): + discount_code = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".discount_code.DiscountCodeReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="fromState", + data_key="discountCode", ) - to_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + state = marshmallow_enum.EnumField( + DiscountCodeState, by_value=True, allow_none=True, load_default=None + ) + old_state = marshmallow_enum.EnumField( + DiscountCodeState, + by_value=True, allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="toState", + data_key="oldState", ) class Meta: @@ -7308,24 +8839,21 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.LineItemStateTransitionMessagePayload(**data) + return models.OrderDiscountCodeStateSetMessagePayload(**data) -class OrderBillingAddressSetMessagePayloadSchema(OrderMessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class OrderEditAppliedMessagePayloadSchema(OrderMessagePayloadSchema): + edit = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order_edit.OrderEditSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) - old_address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), + result = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order_edit.OrderEditAppliedSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="oldAddress", ) class Meta: @@ -7334,10 +8862,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderBillingAddressSetMessagePayload(**data) + return models.OrderEditAppliedMessagePayload(**data) -class OrderCreatedMessagePayloadSchema(OrderMessagePayloadSchema): +class OrderImportedMessagePayloadSchema(OrderMessagePayloadSchema): order = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".order.OrderSchema"), allow_none=True, @@ -7351,12 +8879,20 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCreatedMessagePayload(**data) + return models.OrderImportedMessagePayload(**data) -class OrderCustomFieldAddedMessagePayloadSchema(OrderMessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) +class OrderLineItemAddedMessagePayloadSchema(OrderMessagePayloadSchema): + line_item = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.LineItemSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="lineItem", + ) + added_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="addedQuantity" + ) class Meta: unknown = marshmallow.EXCLUDE @@ -7364,17 +8900,51 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomFieldAddedMessagePayload(**data) + return models.OrderLineItemAddedMessagePayload(**data) -class OrderCustomFieldChangedMessagePayloadSchema(OrderMessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - value = marshmallow.fields.Raw(allow_none=True, load_default=None) - previous_value = marshmallow.fields.Raw( +class OrderLineItemDiscountSetMessagePayloadSchema(OrderMessagePayloadSchema): + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + line_item_key = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="previousValue", + data_key="lineItemKey", + ) + discounted_price_per_quantity = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".cart.DiscountedLineItemPriceForQuantitySchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="discountedPricePerQuantity", + ) + total_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CentPrecisionMoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="totalPrice", + ) + taxed_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.TaxedItemPriceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="taxedPrice", + ) + taxed_price_portions = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.MethodTaxedPriceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="taxedPricePortions", ) class Meta: @@ -7383,28 +8953,28 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomFieldChangedMessagePayload(**data) - - -class OrderCustomFieldRemovedMessagePayloadSchema(OrderMessagePayloadSchema): - name = marshmallow.fields.String(allow_none=True, load_default=None) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.OrderCustomFieldRemovedMessagePayload(**data) + return models.OrderLineItemDiscountSetMessagePayload(**data) -class OrderCustomLineItemAddedMessagePayloadSchema(OrderMessagePayloadSchema): - custom_line_item = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.CustomLineItemSchema"), +class OrderLineItemDistributionChannelSetMessagePayloadSchema( + OrderMessagePayloadSchema +): + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" + ) + line_item_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="lineItemKey", + ) + distribution_channel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="customLineItem", + data_key="distributionChannel", ) class Meta: @@ -7413,60 +8983,63 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomLineItemAddedMessagePayload(**data) + return models.OrderLineItemDistributionChannelSetMessagePayload(**data) -class OrderCustomLineItemDiscountSetMessagePayloadSchema(OrderMessagePayloadSchema): - custom_line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="customLineItemId" +class OrderLineItemRemovedMessagePayloadSchema(OrderMessagePayloadSchema): + line_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="lineItemId" ) - custom_line_item_key = marshmallow.fields.String( + line_item_key = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="customLineItemKey", + data_key="lineItemKey", ) - discounted_price_per_quantity = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".cart.DiscountedLineItemPriceForQuantitySchema" - ), + removed_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="removedQuantity" + ) + new_quantity = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="newQuantity" + ) + new_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.ItemStateSchema"), allow_none=True, many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="discountedPricePerQuantity", + data_key="newState", ) - taxed_price = helpers.LazyNestedField( + new_total_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CentPrecisionMoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="newTotalPrice", + ) + new_taxed_price = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".cart.TaxedItemPriceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="taxedPrice", - ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.OrderCustomLineItemDiscountSetMessagePayload(**data) - - -class OrderCustomLineItemQuantityChangedMessagePayloadSchema(OrderMessagePayloadSchema): - custom_line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="customLineItemId" + data_key="newTaxedPrice", ) - custom_line_item_key = marshmallow.fields.String( + new_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="customLineItemKey", + data_key="newPrice", ) - quantity = marshmallow.fields.Integer(allow_none=True, load_default=None) - old_quantity = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="oldQuantity" + new_shipping_detail = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.ItemShippingDetailsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="newShippingDetail", ) class Meta: @@ -7475,25 +9048,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomLineItemQuantityChangedMessagePayload(**data) + return models.OrderLineItemRemovedMessagePayload(**data) -class OrderCustomLineItemRemovedMessagePayloadSchema(OrderMessagePayloadSchema): - custom_line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="customLineItemId" - ) - custom_line_item_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="customLineItemKey", - ) - custom_line_item = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.CustomLineItemSchema"), +class OrderPaymentAddedMessagePayloadSchema(MessagePayloadSchema): + payment = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".payment.PaymentReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="customLineItem", ) class Meta: @@ -7502,15 +9065,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomLineItemRemovedMessagePayload(**data) + return models.OrderPaymentAddedMessagePayload(**data) -class OrderCustomTypeRemovedMessagePayloadSchema(OrderMessagePayloadSchema): - previous_type_id = marshmallow.fields.String( +class OrderPaymentStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): + payment_state = marshmallow_enum.EnumField( + PaymentState, + by_value=True, + allow_none=True, + load_default=None, + data_key="paymentState", + ) + old_payment_state = marshmallow_enum.EnumField( + PaymentState, + by_value=True, allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="previousTypeId", + data_key="oldPaymentState", ) class Meta: @@ -7519,22 +9091,21 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomTypeRemovedMessagePayload(**data) + return models.OrderPaymentStateChangedMessagePayload(**data) -class OrderCustomTypeSetMessagePayloadSchema(OrderMessagePayloadSchema): - custom_fields = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), +class OrderPurchaseOrderNumberSetMessagePayloadSchema(OrderMessagePayloadSchema): + purchase_order_number = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="customFields", + data_key="purchaseOrderNumber", ) - previous_type_id = marshmallow.fields.String( + old_purchase_order_number = marshmallow.fields.String( allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="previousTypeId", + data_key="oldPurchaseOrderNumber", ) class Meta: @@ -7543,18 +9114,19 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomTypeSetMessagePayload(**data) + return models.OrderPurchaseOrderNumberSetMessagePayload(**data) -class OrderCustomerEmailSetMessagePayloadSchema(OrderMessagePayloadSchema): - email = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None +class OrderReturnShipmentStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): + return_item_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="returnItemId" ) - old_email = marshmallow.fields.String( + return_shipment_state = marshmallow_enum.EnumField( + ReturnShipmentState, + by_value=True, allow_none=True, - metadata={"omit_empty": True}, load_default=None, - data_key="oldEmail", + data_key="returnShipmentState", ) class Meta: @@ -7563,25 +9135,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomerEmailSetMessagePayload(**data) + return models.OrderReturnShipmentStateChangedMessagePayload(**data) -class OrderCustomerGroupSetMessagePayloadSchema(OrderMessagePayloadSchema): - customer_group = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), +class OrderShipmentStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): + shipment_state = marshmallow_enum.EnumField( + ShipmentState, + by_value=True, allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="customerGroup", + data_key="shipmentState", ) - old_customer_group = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), + old_shipment_state = marshmallow_enum.EnumField( + ShipmentState, + by_value=True, allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldCustomerGroup", + data_key="oldShipmentState", ) class Meta: @@ -7590,40 +9161,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomerGroupSetMessagePayload(**data) + return models.OrderShipmentStateChangedMessagePayload(**data) -class OrderCustomerSetMessagePayloadSchema(OrderMessagePayloadSchema): - customer = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - ) - customer_group = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="customerGroup", - ) - old_customer = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer.CustomerReferenceSchema"), +class OrderShippingAddressSetMessagePayloadSchema(OrderMessagePayloadSchema): + address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldCustomer", ) - old_customer_group = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".customer_group.CustomerGroupReferenceSchema"), + old_address = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AddressSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldCustomerGroup", + data_key="oldAddress", ) class Meta: @@ -7632,33 +9187,25 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderCustomerSetMessagePayload(**data) + return models.OrderShippingAddressSetMessagePayload(**data) -class OrderDeletedMessagePayloadSchema(OrderMessagePayloadSchema): - order = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.OrderSchema"), +class OrderShippingInfoSetMessagePayloadSchema(OrderMessagePayloadSchema): + shipping_info = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.ShippingInfoSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="shippingInfo", ) - - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.OrderDeletedMessagePayload(**data) - - -class OrderDiscountCodeAddedMessagePayloadSchema(OrderMessagePayloadSchema): - discount_code = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".discount_code.DiscountCodeReferenceSchema"), + old_shipping_info = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".cart.ShippingInfoSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="discountCode", + data_key="oldShippingInfo", ) class Meta: @@ -7667,16 +9214,35 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderDiscountCodeAddedMessagePayload(**data) + return models.OrderShippingInfoSetMessagePayload(**data) -class OrderDiscountCodeRemovedMessagePayloadSchema(OrderMessagePayloadSchema): - discount_code = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".discount_code.DiscountCodeReferenceSchema"), +class OrderShippingRateInputSetMessagePayloadSchema(OrderMessagePayloadSchema): + shipping_rate_input = helpers.Discriminator( allow_none=True, - unknown=marshmallow.EXCLUDE, + discriminator_field=("type", "type"), + discriminator_schemas={ + "Classification": helpers.absmod( + __name__, ".cart.ClassificationShippingRateInputSchema" + ), + "Score": helpers.absmod(__name__, ".cart.ScoreShippingRateInputSchema"), + }, + metadata={"omit_empty": True}, load_default=None, - data_key="discountCode", + data_key="shippingRateInput", + ) + old_shipping_rate_input = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "Classification": helpers.absmod( + __name__, ".cart.ClassificationShippingRateInputSchema" + ), + "Score": helpers.absmod(__name__, ".cart.ScoreShippingRateInputSchema"), + }, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldShippingRateInput", ) class Meta: @@ -7685,27 +9251,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderDiscountCodeRemovedMessagePayload(**data) + return models.OrderShippingRateInputSetMessagePayload(**data) -class OrderDiscountCodeStateSetMessagePayloadSchema(OrderMessagePayloadSchema): - discount_code = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".discount_code.DiscountCodeReferenceSchema"), +class OrderStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): + order_state = marshmallow_enum.EnumField( + OrderState, + by_value=True, allow_none=True, - unknown=marshmallow.EXCLUDE, load_default=None, - data_key="discountCode", - ) - state = marshmallow_enum.EnumField( - DiscountCodeState, by_value=True, allow_none=True, load_default=None + data_key="orderState", ) - old_state = marshmallow_enum.EnumField( - DiscountCodeState, + old_order_state = marshmallow_enum.EnumField( + OrderState, by_value=True, allow_none=True, metadata={"omit_empty": True}, load_default=None, - data_key="oldState", + data_key="oldOrderState", ) class Meta: @@ -7714,22 +9277,25 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderDiscountCodeStateSetMessagePayload(**data) + return models.OrderStateChangedMessagePayload(**data) -class OrderEditAppliedMessagePayloadSchema(OrderMessagePayloadSchema): - edit = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order_edit.OrderEditSchema"), +class OrderStateTransitionMessagePayloadSchema(OrderMessagePayloadSchema): + state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - result = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order_edit.OrderEditAppliedSchema"), + old_state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="oldState", ) + force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -7737,14 +9303,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderEditAppliedMessagePayload(**data) + return models.OrderStateTransitionMessagePayload(**data) -class OrderImportedMessagePayloadSchema(OrderMessagePayloadSchema): - order = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.OrderSchema"), +class OrderStoreSetMessagePayloadSchema(OrderMessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, ) @@ -7754,19 +9321,27 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderImportedMessagePayload(**data) + return models.OrderStoreSetMessagePayload(**data) -class OrderLineItemAddedMessagePayloadSchema(OrderMessagePayloadSchema): - line_item = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.LineItemSchema"), +class ParcelAddedToDeliveryMessagePayloadSchema(OrderMessagePayloadSchema): + delivery = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.DeliverySchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="lineItem", ) - added_quantity = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="addedQuantity" + parcel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.ParcelSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingKey", ) class Meta: @@ -7775,51 +9350,36 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderLineItemAddedMessagePayload(**data) + return models.ParcelAddedToDeliveryMessagePayload(**data) -class OrderLineItemDiscountSetMessagePayloadSchema(OrderMessagePayloadSchema): - line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="lineItemId" +class ParcelItemsUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): + parcel_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="parcelId" ) - line_item_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="lineItemKey", + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" ) - discounted_price_per_quantity = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".cart.DiscountedLineItemPriceForQuantitySchema" - ), + items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), allow_none=True, many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="discountedPricePerQuantity", ) - total_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.MoneySchema"), + old_items = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), allow_none=True, + many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="totalPrice", + data_key="oldItems", ) - taxed_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.TaxedItemPriceSchema"), + shipping_key = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="taxedPrice", - ) - taxed_price_portions = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.MethodTaxedPriceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="taxedPricePortions", + data_key="shippingKey", ) class Meta: @@ -7828,28 +9388,28 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderLineItemDiscountSetMessagePayload(**data) + return models.ParcelItemsUpdatedMessagePayload(**data) -class OrderLineItemDistributionChannelSetMessagePayloadSchema( - OrderMessagePayloadSchema -): - line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="lineItemId" +class ParcelMeasurementsUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" ) - line_item_key = marshmallow.fields.String( + parcel_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="parcelId" + ) + measurements = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.ParcelMeasurementsSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="lineItemKey", ) - distribution_channel = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".channel.ChannelReferenceSchema"), + shipping_key = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="distributionChannel", + data_key="shippingKey", ) class Meta: @@ -7858,63 +9418,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderLineItemDistributionChannelSetMessagePayload(**data) + return models.ParcelMeasurementsUpdatedMessagePayload(**data) -class OrderLineItemRemovedMessagePayloadSchema(OrderMessagePayloadSchema): - line_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="lineItemId" - ) - line_item_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="lineItemKey", - ) - removed_quantity = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="removedQuantity" - ) - new_quantity = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="newQuantity" - ) - new_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.ItemStateSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="newState", - ) - new_total_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.CentPrecisionMoneySchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="newTotalPrice", - ) - new_taxed_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.TaxedItemPriceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="newTaxedPrice", +class ParcelRemovedFromDeliveryMessagePayloadSchema(OrderMessagePayloadSchema): + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" ) - new_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceSchema"), + parcel = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.ParcelSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="newPrice", ) - new_shipping_detail = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.ItemShippingDetailsSchema"), + shipping_key = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="newShippingDetail", + data_key="shippingKey", ) class Meta: @@ -7923,15 +9444,29 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderLineItemRemovedMessagePayload(**data) + return models.ParcelRemovedFromDeliveryMessagePayload(**data) -class OrderPaymentAddedMessagePayloadSchema(MessagePayloadSchema): - payment = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".payment.PaymentReferenceSchema"), +class ParcelTrackingDataUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): + delivery_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="deliveryId" + ) + parcel_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="parcelId" + ) + tracking_data = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".order.TrackingDataSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="trackingData", + ) + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, load_default=None, + data_key="shippingKey", ) class Meta: @@ -7940,24 +9475,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderPaymentAddedMessagePayload(**data) + return models.ParcelTrackingDataUpdatedMessagePayload(**data) -class OrderPaymentStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): - payment_state = marshmallow_enum.EnumField( - PaymentState, - by_value=True, - allow_none=True, - load_default=None, - data_key="paymentState", - ) - old_payment_state = marshmallow_enum.EnumField( - PaymentState, - by_value=True, +class PaymentCreatedMessagePayloadSchema(MessagePayloadSchema): + payment = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".payment.PaymentSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldPaymentState", ) class Meta: @@ -7966,21 +9492,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderPaymentStateChangedMessagePayload(**data) + return models.PaymentCreatedMessagePayload(**data) -class OrderPurchaseOrderNumberSetMessagePayloadSchema(OrderMessagePayloadSchema): - purchase_order_number = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="purchaseOrderNumber", - ) - old_purchase_order_number = marshmallow.fields.String( +class PaymentInteractionAddedMessagePayloadSchema(MessagePayloadSchema): + interaction = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldPurchaseOrderNumber", ) class Meta: @@ -7989,19 +9509,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderPurchaseOrderNumberSetMessagePayload(**data) + return models.PaymentInteractionAddedMessagePayload(**data) -class OrderReturnShipmentStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): - return_item_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="returnItemId" +class PaymentStatusInterfaceCodeSetMessagePayloadSchema(MessagePayloadSchema): + payment_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="paymentId" ) - return_shipment_state = marshmallow_enum.EnumField( - ReturnShipmentState, - by_value=True, + interface_code = marshmallow.fields.String( allow_none=True, + metadata={"omit_empty": True}, load_default=None, - data_key="returnShipmentState", + data_key="interfaceCode", ) class Meta: @@ -8010,24 +9529,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderReturnShipmentStateChangedMessagePayload(**data) + return models.PaymentStatusInterfaceCodeSetMessagePayload(**data) -class OrderShipmentStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): - shipment_state = marshmallow_enum.EnumField( - ShipmentState, - by_value=True, - allow_none=True, - load_default=None, - data_key="shipmentState", - ) - old_shipment_state = marshmallow_enum.EnumField( - ShipmentState, - by_value=True, +class PaymentStatusStateTransitionMessagePayloadSchema(MessagePayloadSchema): + state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldShipmentState", ) + force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8035,24 +9547,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderShipmentStateChangedMessagePayload(**data) + return models.PaymentStatusStateTransitionMessagePayload(**data) -class OrderShippingAddressSetMessagePayloadSchema(OrderMessagePayloadSchema): - address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - ) - old_address = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.AddressSchema"), +class PaymentTransactionAddedMessagePayloadSchema(MessagePayloadSchema): + transaction = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".payment.TransactionSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="oldAddress", ) class Meta: @@ -8061,25 +9564,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderShippingAddressSetMessagePayload(**data) + return models.PaymentTransactionAddedMessagePayload(**data) -class OrderShippingInfoSetMessagePayloadSchema(OrderMessagePayloadSchema): - shipping_info = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.ShippingInfoSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingInfo", +class PaymentTransactionStateChangedMessagePayloadSchema(MessagePayloadSchema): + transaction_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="transactionId" ) - old_shipping_info = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.ShippingInfoSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="oldShippingInfo", + state = marshmallow_enum.EnumField( + TransactionState, by_value=True, allow_none=True, load_default=None ) class Meta: @@ -8088,36 +9581,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderShippingInfoSetMessagePayload(**data) + return models.PaymentTransactionStateChangedMessagePayload(**data) -class OrderShippingRateInputSetMessagePayloadSchema(OrderMessagePayloadSchema): - shipping_rate_input = helpers.Discriminator( - allow_none=True, - discriminator_field=("type", "type"), - discriminator_schemas={ - "Classification": helpers.absmod( - __name__, ".cart.ClassificationShippingRateInputSchema" - ), - "Score": helpers.absmod(__name__, ".cart.ScoreShippingRateInputSchema"), - }, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingRateInput", - ) - old_shipping_rate_input = helpers.Discriminator( +class ProductAddedToCategoryMessagePayloadSchema(MessagePayloadSchema): + category = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".category.CategoryReferenceSchema"), allow_none=True, - discriminator_field=("type", "type"), - discriminator_schemas={ - "Classification": helpers.absmod( - __name__, ".cart.ClassificationShippingRateInputSchema" - ), - "Score": helpers.absmod(__name__, ".cart.ScoreShippingRateInputSchema"), - }, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldShippingRateInput", ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8125,23 +9599,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderShippingRateInputSetMessagePayload(**data) + return models.ProductAddedToCategoryMessagePayload(**data) -class OrderStateChangedMessagePayloadSchema(OrderMessagePayloadSchema): - order_state = marshmallow_enum.EnumField( - OrderState, - by_value=True, - allow_none=True, - load_default=None, - data_key="orderState", - ) - old_order_state = marshmallow_enum.EnumField( - OrderState, - by_value=True, +class ProductCreatedMessagePayloadSchema(MessagePayloadSchema): + product_projection = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductProjectionSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldOrderState", + data_key="productProjection", ) class Meta: @@ -8150,25 +9617,24 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderStateChangedMessagePayload(**data) + return models.ProductCreatedMessagePayload(**data) -class OrderStateTransitionMessagePayloadSchema(OrderMessagePayloadSchema): - state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), +class ProductDeletedMessagePayloadSchema(MessagePayloadSchema): + removed_image_urls = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), allow_none=True, - unknown=marshmallow.EXCLUDE, load_default=None, + data_key="removedImageUrls", ) - old_state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), + current_projection = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductProjectionSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="oldState", + data_key="currentProjection", ) - force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8176,17 +9642,20 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderStateTransitionMessagePayload(**data) + return models.ProductDeletedMessagePayload(**data) -class OrderStoreSetMessagePayloadSchema(OrderMessagePayloadSchema): - store = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), +class ProductImageAddedMessagePayloadSchema(MessagePayloadSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + image = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8194,28 +9663,20 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.OrderStoreSetMessagePayload(**data) + return models.ProductImageAddedMessagePayload(**data) -class ParcelAddedToDeliveryMessagePayloadSchema(OrderMessagePayloadSchema): - delivery = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.DeliverySchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, +class ProductPriceAddedMessagePayloadSchema(MessagePayloadSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" ) - parcel = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.ParcelSchema"), + price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - shipping_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingKey", - ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8223,36 +9684,35 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ParcelAddedToDeliveryMessagePayload(**data) + return models.ProductPriceAddedMessagePayload(**data) -class ParcelItemsUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): - parcel_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="parcelId" - ) - delivery_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="deliveryId" +class ProductPriceChangedMessagePayloadSchema(MessagePayloadSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" ) - items = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), + old_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, load_default=None, + data_key="oldPrice", ) - old_items = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.DeliveryItemSchema"), + new_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldItems", + data_key="newPrice", ) - shipping_key = marshmallow.fields.String( + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + old_staged_price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), allow_none=True, + unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, - data_key="shippingKey", + data_key="oldStagedPrice", ) class Meta: @@ -8261,29 +9721,19 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ParcelItemsUpdatedMessagePayload(**data) + return models.ProductPriceChangedMessagePayload(**data) -class ParcelMeasurementsUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): - delivery_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="deliveryId" - ) - parcel_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="parcelId" - ) - measurements = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.ParcelMeasurementsSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, +class ProductPriceCustomFieldAddedMessagePayloadSchema(MessagePayloadSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" ) - shipping_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingKey", + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8291,25 +9741,19 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ParcelMeasurementsUpdatedMessagePayload(**data) + return models.ProductPriceCustomFieldAddedMessagePayload(**data) -class ParcelRemovedFromDeliveryMessagePayloadSchema(OrderMessagePayloadSchema): - delivery_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="deliveryId" - ) - parcel = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.ParcelSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, +class ProductPriceCustomFieldChangedMessagePayloadSchema(MessagePayloadSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" ) - shipping_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingKey", + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8317,30 +9761,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ParcelRemovedFromDeliveryMessagePayload(**data) + return models.ProductPriceCustomFieldChangedMessagePayload(**data) -class ParcelTrackingDataUpdatedMessagePayloadSchema(OrderMessagePayloadSchema): - delivery_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="deliveryId" - ) - parcel_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="parcelId" - ) - tracking_data = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".order.TrackingDataSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, - load_default=None, - data_key="trackingData", +class ProductPriceCustomFieldRemovedMessagePayloadSchema(MessagePayloadSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" ) - shipping_key = marshmallow.fields.String( - allow_none=True, - metadata={"omit_empty": True}, - load_default=None, - data_key="shippingKey", + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + name = marshmallow.fields.String(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8348,16 +9780,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ParcelTrackingDataUpdatedMessagePayload(**data) + return models.ProductPriceCustomFieldRemovedMessagePayload(**data) -class PaymentCreatedMessagePayloadSchema(MessagePayloadSchema): - payment = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".payment.PaymentSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, +class ProductPriceCustomFieldsRemovedMessagePayloadSchema(MessagePayloadSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8365,15 +9798,29 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.PaymentCreatedMessagePayload(**data) + return models.ProductPriceCustomFieldsRemovedMessagePayload(**data) -class PaymentInteractionAddedMessagePayloadSchema(MessagePayloadSchema): - interaction = helpers.LazyNestedField( +class ProductPriceCustomFieldsSetMessagePayloadSchema(MessagePayloadSchema): + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + custom_field = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".type.CustomFieldsSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, + data_key="customField", + ) + old_type_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldTypeId", ) class Meta: @@ -8382,18 +9829,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.PaymentInteractionAddedMessagePayload(**data) + return models.ProductPriceCustomFieldsSetMessagePayload(**data) -class PaymentStatusInterfaceCodeSetMessagePayloadSchema(MessagePayloadSchema): - payment_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="paymentId" - ) - interface_code = marshmallow.fields.String( +class ProductPriceDiscountsSetMessagePayloadSchema(MessagePayloadSchema): + updated_prices = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductPriceDiscountsSetUpdatedPriceSchema"), allow_none=True, - metadata={"omit_empty": True}, + many=True, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="interfaceCode", + data_key="updatedPrices", ) class Meta: @@ -8402,17 +9848,33 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.PaymentStatusInterfaceCodeSetMessagePayload(**data) + return models.ProductPriceDiscountsSetMessagePayload(**data) -class PaymentStatusStateTransitionMessagePayloadSchema(MessagePayloadSchema): - state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), +class ProductPriceExternalDiscountSetMessagePayloadSchema(MessagePayloadSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + variant_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantKey", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + price_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="priceId" + ) + discounted = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, ) - force = marshmallow.fields.Boolean(allow_none=True, load_default=None) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8420,16 +9882,29 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.PaymentStatusStateTransitionMessagePayload(**data) + return models.ProductPriceExternalDiscountSetMessagePayload(**data) -class PaymentTransactionAddedMessagePayloadSchema(MessagePayloadSchema): - transaction = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".payment.TransactionSchema"), +class ProductPriceKeySetMessagePayloadSchema(MessagePayloadSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + price_id = marshmallow.fields.String( allow_none=True, - unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, + data_key="priceId", + ) + old_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldKey", + ) + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8437,15 +9912,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.PaymentTransactionAddedMessagePayload(**data) + return models.ProductPriceKeySetMessagePayload(**data) -class PaymentTransactionStateChangedMessagePayloadSchema(MessagePayloadSchema): - transaction_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="transactionId" - ) - state = marshmallow_enum.EnumField( - TransactionState, by_value=True, allow_none=True, load_default=None +class ProductPriceModeSetMessagePayloadSchema(MessagePayloadSchema): + to = marshmallow_enum.EnumField( + ProductPriceModeEnum, by_value=True, allow_none=True, load_default=None ) class Meta: @@ -8454,12 +9926,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.PaymentTransactionStateChangedMessagePayload(**data) + return models.ProductPriceModeSetMessagePayload(**data) -class ProductAddedToCategoryMessagePayloadSchema(MessagePayloadSchema): - category = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".category.CategoryReferenceSchema"), +class ProductPriceRemovedMessagePayloadSchema(MessagePayloadSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, @@ -8472,17 +9947,21 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductAddedToCategoryMessagePayload(**data) + return models.ProductPriceRemovedMessagePayload(**data) -class ProductCreatedMessagePayloadSchema(MessagePayloadSchema): - product_projection = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".product.ProductProjectionSchema"), +class ProductPricesSetMessagePayloadSchema(MessagePayloadSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + prices = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.PriceSchema"), allow_none=True, + many=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="productProjection", ) + staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8490,23 +9969,25 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductCreatedMessagePayload(**data) + return models.ProductPricesSetMessagePayload(**data) -class ProductDeletedMessagePayloadSchema(MessagePayloadSchema): +class ProductPublishedMessagePayloadSchema(MessagePayloadSchema): removed_image_urls = marshmallow.fields.List( marshmallow.fields.String(allow_none=True), allow_none=True, load_default=None, data_key="removedImageUrls", ) - current_projection = helpers.LazyNestedField( + product_projection = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".product.ProductProjectionSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="currentProjection", + data_key="productProjection", + ) + scope = marshmallow_enum.EnumField( + ProductPublishScope, by_value=True, allow_none=True, load_default=None ) class Meta: @@ -8515,15 +9996,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductDeletedMessagePayload(**data) + return models.ProductPublishedMessagePayload(**data) -class ProductImageAddedMessagePayloadSchema(MessagePayloadSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - image = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.ImageSchema"), +class ProductRemovedFromCategoryMessagePayloadSchema(MessagePayloadSchema): + category = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".category.CategoryReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, @@ -8536,20 +10014,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductImageAddedMessagePayload(**data) + return models.ProductRemovedFromCategoryMessagePayload(**data) -class ProductPriceAddedMessagePayloadSchema(MessagePayloadSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceSchema"), +class ProductRevertedStagedChangesMessagePayloadSchema(MessagePayloadSchema): + removed_image_urls = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), allow_none=True, - unknown=marshmallow.EXCLUDE, load_default=None, + data_key="removedImageUrls", ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8557,35 +10031,16 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceAddedMessagePayload(**data) + return models.ProductRevertedStagedChangesMessagePayload(**data) -class ProductPriceChangedMessagePayloadSchema(MessagePayloadSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - old_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="oldPrice", - ) - new_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceSchema"), - allow_none=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="newPrice", - ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) - old_staged_price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceSchema"), +class ProductSelectionCreatedMessagePayloadSchema(MessagePayloadSchema): + product_selection = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product_selection.ProductSelectionSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, load_default=None, - data_key="oldStagedPrice", + data_key="productSelection", ) class Meta: @@ -8594,18 +10049,10 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceChangedMessagePayload(**data) + return models.ProductSelectionCreatedMessagePayload(**data) -class ProductPriceDiscountsSetMessagePayloadSchema(MessagePayloadSchema): - updated_prices = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".ProductPriceDiscountsSetUpdatedPriceSchema"), - allow_none=True, - many=True, - unknown=marshmallow.EXCLUDE, - load_default=None, - data_key="updatedPrices", - ) +class ProductSelectionDeletedMessagePayloadSchema(MessagePayloadSchema): class Meta: unknown = marshmallow.EXCLUDE @@ -8613,33 +10060,37 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceDiscountsSetMessagePayload(**data) + return models.ProductSelectionDeletedMessagePayload(**data) -class ProductPriceExternalDiscountSetMessagePayloadSchema(MessagePayloadSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - variant_key = marshmallow.fields.String( +class ProductSelectionProductAddedMessagePayloadSchema(MessagePayloadSchema): + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="variantKey", - ) - sku = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None - ) - price_id = marshmallow.fields.String( - allow_none=True, load_default=None, data_key="priceId" ) - discounted = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.DiscountedPriceSchema"), + variant_selection = helpers.Discriminator( allow_none=True, - unknown=marshmallow.EXCLUDE, - metadata={"omit_empty": True}, + discriminator_field=("type", "type"), + discriminator_schemas={ + "exclusion": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionExclusionSchema" + ), + "includeAllExcept": helpers.absmod( + __name__, + ".product_selection.ProductVariantSelectionIncludeAllExceptSchema", + ), + "includeOnly": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionIncludeOnlySchema" + ), + "inclusion": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionInclusionSchema" + ), + }, load_default=None, + data_key="variantSelection", ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8647,29 +10098,25 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceExternalDiscountSetMessagePayload(**data) + return models.ProductSelectionProductAddedMessagePayload(**data) -class ProductPriceKeySetMessagePayloadSchema(MessagePayloadSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - price_id = marshmallow.fields.String( +class ProductSelectionProductExcludedMessagePayloadSchema(MessagePayloadSchema): + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="priceId", ) - old_key = marshmallow.fields.String( + variant_exclusion = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_selection.ProductVariantExclusionSchema" + ), allow_none=True, - metadata={"omit_empty": True}, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="oldKey", - ) - key = marshmallow.fields.String( - allow_none=True, metadata={"omit_empty": True}, load_default=None + data_key="variantExclusion", ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8677,12 +10124,15 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceKeySetMessagePayload(**data) + return models.ProductSelectionProductExcludedMessagePayload(**data) -class ProductPriceModeSetMessagePayloadSchema(MessagePayloadSchema): - to = marshmallow_enum.EnumField( - ProductPriceModeEnum, by_value=True, allow_none=True, load_default=None +class ProductSelectionProductRemovedMessagePayloadSchema(MessagePayloadSchema): + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, ) class Meta: @@ -8691,20 +10141,34 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceModeSetMessagePayload(**data) + return models.ProductSelectionProductRemovedMessagePayload(**data) -class ProductPriceRemovedMessagePayloadSchema(MessagePayloadSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" +class ProductSelectionVariantExclusionChangedMessagePayloadSchema(MessagePayloadSchema): + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, ) - price = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceSchema"), + old_variant_exclusion = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_selection.ProductVariantExclusionSchema" + ), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, + data_key="oldVariantExclusion", + ) + new_variant_exclusion = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_selection.ProductVariantExclusionSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="newVariantExclusion", ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8712,21 +10176,58 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPriceRemovedMessagePayload(**data) + return models.ProductSelectionVariantExclusionChangedMessagePayload(**data) -class ProductPricesSetMessagePayloadSchema(MessagePayloadSchema): - variant_id = marshmallow.fields.Integer( - allow_none=True, load_default=None, data_key="variantId" - ) - prices = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.PriceSchema"), +class ProductSelectionVariantSelectionChangedMessagePayloadSchema(MessagePayloadSchema): + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, - many=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + old_variant_selection = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "exclusion": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionExclusionSchema" + ), + "includeAllExcept": helpers.absmod( + __name__, + ".product_selection.ProductVariantSelectionIncludeAllExceptSchema", + ), + "includeOnly": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionIncludeOnlySchema" + ), + "inclusion": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionInclusionSchema" + ), + }, + load_default=None, + data_key="oldVariantSelection", + ) + new_variant_selection = helpers.Discriminator( + allow_none=True, + discriminator_field=("type", "type"), + discriminator_schemas={ + "exclusion": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionExclusionSchema" + ), + "includeAllExcept": helpers.absmod( + __name__, + ".product_selection.ProductVariantSelectionIncludeAllExceptSchema", + ), + "includeOnly": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionIncludeOnlySchema" + ), + "inclusion": helpers.absmod( + __name__, ".product_selection.ProductVariantSelectionInclusionSchema" + ), + }, + load_default=None, + data_key="newVariantSelection", + ) class Meta: unknown = marshmallow.EXCLUDE @@ -8734,25 +10235,21 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPricesSetMessagePayload(**data) + return models.ProductSelectionVariantSelectionChangedMessagePayload(**data) -class ProductPublishedMessagePayloadSchema(MessagePayloadSchema): - removed_image_urls = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), +class ProductSlugChangedMessagePayloadSchema(MessagePayloadSchema): + slug = LocalizedStringField( allow_none=True, + values=marshmallow.fields.String(allow_none=True), load_default=None, - data_key="removedImageUrls", ) - product_projection = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".product.ProductProjectionSchema"), + old_slug = LocalizedStringField( allow_none=True, - unknown=marshmallow.EXCLUDE, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, load_default=None, - data_key="productProjection", - ) - scope = marshmallow_enum.EnumField( - ProductPublishScope, by_value=True, allow_none=True, load_default=None + data_key="oldSlug", ) class Meta: @@ -8761,17 +10258,17 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductPublishedMessagePayload(**data) + return models.ProductSlugChangedMessagePayload(**data) -class ProductRemovedFromCategoryMessagePayloadSchema(MessagePayloadSchema): - category = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".category.CategoryReferenceSchema"), +class ProductStateTransitionMessagePayloadSchema(MessagePayloadSchema): + state = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) + force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8779,16 +10276,81 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductRemovedFromCategoryMessagePayload(**data) + return models.ProductStateTransitionMessagePayload(**data) -class ProductRevertedStagedChangesMessagePayloadSchema(MessagePayloadSchema): - removed_image_urls = marshmallow.fields.List( - marshmallow.fields.String(allow_none=True), +class ProductTailoringCreatedMessagePayloadSchema(MessagePayloadSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + meta_title = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaTitle", + ) + meta_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaDescription", + ) + meta_keywords = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaKeywords", + ) + variants = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_tailoring.ProductVariantTailoringSchema" + ), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, load_default=None, - data_key="removedImageUrls", ) + published = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -8796,16 +10358,27 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductRevertedStagedChangesMessagePayload(**data) + return models.ProductTailoringCreatedMessagePayload(**data) -class ProductSelectionCreatedMessagePayloadSchema(MessagePayloadSchema): - product_selection = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".product_selection.ProductSelectionSchema"), +class ProductTailoringDeletedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="productSelection", ) class Meta: @@ -8814,46 +10387,40 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductSelectionCreatedMessagePayload(**data) - - -class ProductSelectionDeletedMessagePayloadSchema(MessagePayloadSchema): - class Meta: - unknown = marshmallow.EXCLUDE - - @marshmallow.post_load - def post_load(self, data, **kwargs): - del data["type"] - return models.ProductSelectionDeletedMessagePayload(**data) + return models.ProductTailoringDeletedMessagePayload(**data) -class ProductSelectionProductAddedMessagePayloadSchema(MessagePayloadSchema): +class ProductTailoringDescriptionSetMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) product = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - variant_selection = helpers.Discriminator( + description = LocalizedStringField( allow_none=True, - discriminator_field=("type", "type"), - discriminator_schemas={ - "exclusion": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionExclusionSchema" - ), - "includeAllExcept": helpers.absmod( - __name__, - ".product_selection.ProductVariantSelectionIncludeAllExceptSchema", - ), - "includeOnly": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionIncludeOnlySchema" - ), - "inclusion": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionInclusionSchema" - ), - }, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + old_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, load_default=None, - data_key="variantSelection", + data_key="oldDescription", ) class Meta: @@ -8862,24 +10429,36 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductSelectionProductAddedMessagePayload(**data) + return models.ProductTailoringDescriptionSetMessagePayload(**data) -class ProductSelectionProductExcludedMessagePayloadSchema(MessagePayloadSchema): +class ProductTailoringImageAddedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) product = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - variant_exclusion = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".product_selection.ProductVariantExclusionSchema" - ), + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + image = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, - data_key="variantExclusion", ) class Meta: @@ -8888,16 +10467,48 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductSelectionProductExcludedMessagePayload(**data) + return models.ProductTailoringImageAddedMessagePayload(**data) -class ProductSelectionProductRemovedMessagePayloadSchema(MessagePayloadSchema): +class ProductTailoringImagesSetMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) product = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + old_images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="oldImages", + ) + images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) class Meta: unknown = marshmallow.EXCLUDE @@ -8905,33 +10516,40 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductSelectionProductRemovedMessagePayload(**data) + return models.ProductTailoringImagesSetMessagePayload(**data) -class ProductSelectionVariantExclusionChangedMessagePayloadSchema(MessagePayloadSchema): +class ProductTailoringNameSetMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) product = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - old_variant_exclusion = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".product_selection.ProductVariantExclusionSchema" - ), + name = LocalizedStringField( allow_none=True, - unknown=marshmallow.EXCLUDE, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, load_default=None, - data_key="oldVariantExclusion", ) - new_variant_exclusion = helpers.LazyNestedField( - nested=helpers.absmod( - __name__, ".product_selection.ProductVariantExclusionSchema" - ), + old_name = LocalizedStringField( allow_none=True, - unknown=marshmallow.EXCLUDE, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, load_default=None, - data_key="newVariantExclusion", + data_key="oldName", ) class Meta: @@ -8940,57 +10558,27 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductSelectionVariantExclusionChangedMessagePayload(**data) + return models.ProductTailoringNameSetMessagePayload(**data) -class ProductSelectionVariantSelectionChangedMessagePayloadSchema(MessagePayloadSchema): - product = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), +class ProductTailoringPublishedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - old_variant_selection = helpers.Discriminator( + product_key = marshmallow.fields.String( allow_none=True, - discriminator_field=("type", "type"), - discriminator_schemas={ - "exclusion": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionExclusionSchema" - ), - "includeAllExcept": helpers.absmod( - __name__, - ".product_selection.ProductVariantSelectionIncludeAllExceptSchema", - ), - "includeOnly": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionIncludeOnlySchema" - ), - "inclusion": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionInclusionSchema" - ), - }, + metadata={"omit_empty": True}, load_default=None, - data_key="oldVariantSelection", + data_key="productKey", ) - new_variant_selection = helpers.Discriminator( + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, - discriminator_field=("type", "type"), - discriminator_schemas={ - "exclusion": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionExclusionSchema" - ), - "includeAllExcept": helpers.absmod( - __name__, - ".product_selection.ProductVariantSelectionIncludeAllExceptSchema", - ), - "includeOnly": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionIncludeOnlySchema" - ), - "inclusion": helpers.absmod( - __name__, ".product_selection.ProductVariantSelectionInclusionSchema" - ), - }, + unknown=marshmallow.EXCLUDE, load_default=None, - data_key="newVariantSelection", ) class Meta: @@ -8999,13 +10587,32 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductSelectionVariantSelectionChangedMessagePayload(**data) + return models.ProductTailoringPublishedMessagePayload(**data) -class ProductSlugChangedMessagePayloadSchema(MessagePayloadSchema): +class ProductTailoringSlugSetMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) slug = LocalizedStringField( allow_none=True, values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, load_default=None, ) old_slug = LocalizedStringField( @@ -9022,17 +10629,28 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductSlugChangedMessagePayload(**data) + return models.ProductTailoringSlugSetMessagePayload(**data) -class ProductStateTransitionMessagePayloadSchema(MessagePayloadSchema): - state = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".state.StateReferenceSchema"), +class ProductTailoringUnpublishedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), allow_none=True, unknown=marshmallow.EXCLUDE, load_default=None, ) - force = marshmallow.fields.Boolean(allow_none=True, load_default=None) class Meta: unknown = marshmallow.EXCLUDE @@ -9040,10 +10658,11 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): del data["type"] - return models.ProductStateTransitionMessagePayload(**data) + return models.ProductTailoringUnpublishedMessagePayload(**data) class ProductUnpublishedMessagePayloadSchema(MessagePayloadSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -9095,6 +10714,86 @@ def post_load(self, data, **kwargs): return models.ProductVariantDeletedMessagePayload(**data) +class ProductVariantTailoringAddedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + variant = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_tailoring.ProductVariantTailoringSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductVariantTailoringAddedMessagePayload(**data) + + +class ProductVariantTailoringRemovedMessagePayloadSchema(MessagePayloadSchema): + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="productKey", + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, load_default=None, data_key="variantId" + ) + variant = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".product_tailoring.ProductVariantTailoringSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type"] + return models.ProductVariantTailoringRemovedMessagePayload(**data) + + class QuoteCreatedMessagePayloadSchema(MessagePayloadSchema): quote = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".quote.QuoteSchema"), @@ -9137,6 +10836,7 @@ def post_load(self, data, **kwargs): class QuoteDeletedMessagePayloadSchema(MessagePayloadSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -9206,6 +10906,7 @@ def post_load(self, data, **kwargs): class QuoteRequestDeletedMessagePayloadSchema(MessagePayloadSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -9440,6 +11141,9 @@ class ReviewRatingSetMessagePayloadSchema(MessagePayloadSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -9556,6 +11260,9 @@ class ReviewStateTransitionMessagePayloadSchema(MessagePayloadSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -9635,6 +11342,7 @@ def post_load(self, data, **kwargs): class StagedQuoteDeletedMessagePayloadSchema(MessagePayloadSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -10007,17 +11715,31 @@ def post_load(self, data, **kwargs): class StandalonePriceValueChangedMessagePayloadSchema(MessagePayloadSchema): - value = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.MoneySchema"), + value = helpers.Discriminator( allow_none=True, - unknown=marshmallow.EXCLUDE, + discriminator_field=("type", "type"), + discriminator_schemas={ + "centPrecision": helpers.absmod( + __name__, ".common.CentPrecisionMoneySchema" + ), + "highPrecision": helpers.absmod( + __name__, ".common.HighPrecisionMoneySchema" + ), + }, load_default=None, ) staged = marshmallow.fields.Boolean(allow_none=True, load_default=None) - old_value = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".common.MoneySchema"), + old_value = helpers.Discriminator( allow_none=True, - unknown=marshmallow.EXCLUDE, + discriminator_field=("type", "type"), + discriminator_schemas={ + "centPrecision": helpers.absmod( + __name__, ".common.CentPrecisionMoneySchema" + ), + "highPrecision": helpers.absmod( + __name__, ".common.HighPrecisionMoneySchema" + ), + }, metadata={"omit_empty": True}, load_default=None, data_key="oldValue", @@ -10124,6 +11846,7 @@ def post_load(self, data, **kwargs): class StoreDeletedMessagePayloadSchema(MessagePayloadSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/order.py b/src/commercetools/platform/models/_schemas/order.py index b08e806c..f8565f7b 100644 --- a/src/commercetools/platform/models/_schemas/order.py +++ b/src/commercetools/platform/models/_schemas/order.py @@ -65,6 +65,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Hit(**data) @@ -89,6 +90,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderPagedSearchResponse(**data) @@ -109,6 +111,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchQueryExpressionValue(**data) @@ -129,6 +132,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchAnyValue(**data) @@ -145,6 +149,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchDateRangeValue(**data) @@ -167,6 +172,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchFullTextValue(**data) @@ -183,6 +189,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchLongRangeValue(**data) @@ -199,6 +206,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchNumberRangeValue(**data) @@ -219,6 +227,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchStringValue(**data) @@ -294,6 +303,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomLineItemImportDraft(**data) @@ -339,6 +349,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Delivery(**data) @@ -382,6 +393,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DeliveryDraft(**data) @@ -394,6 +406,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DeliveryItem(**data) @@ -405,7 +418,7 @@ class DiscountedLineItemPriceDraftSchema(helpers.BaseSchema): load_default=None, ) included_discounts = helpers.LazyNestedField( - nested=helpers.absmod(__name__, ".cart.DiscountedLineItemPortionSchema"), + nested=helpers.absmod(__name__, ".cart.DiscountedLineItemPortionDraftSchema"), allow_none=True, many=True, unknown=marshmallow.EXCLUDE, @@ -418,6 +431,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.DiscountedLineItemPriceDraft(**data) @@ -435,6 +449,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ItemState(**data) @@ -527,6 +542,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.LineItemImportDraft(**data) @@ -891,6 +907,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Order(**data) @@ -962,6 +979,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderFromCartDraft(**data) @@ -1022,6 +1040,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderFromQuoteDraft(**data) @@ -1235,6 +1254,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderImportDraft(**data) @@ -1258,6 +1278,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderPagedQueryResponse(**data) @@ -1280,20 +1301,24 @@ def post_load(self, data, **kwargs): class OrderSearchQuerySchema(helpers.BaseSchema): + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchQuery(**data) class OrderSearchCompoundExpressionSchema(OrderSearchQuerySchema): + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchCompoundExpression(**data) @@ -1312,6 +1337,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchAndExpression(**data) @@ -1329,6 +1355,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchFilterExpression(**data) @@ -1347,6 +1374,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchNotExpression(**data) @@ -1365,15 +1393,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchOrExpression(**data) class OrderSearchQueryExpressionSchema(OrderSearchQuerySchema): + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchQueryExpression(**data) @@ -1390,6 +1421,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchDateRangeExpression(**data) @@ -1406,6 +1438,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchExactExpression(**data) @@ -1422,6 +1455,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchExistsExpression(**data) @@ -1439,6 +1473,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchFullTextExpression(**data) @@ -1455,6 +1490,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchLongRangeExpression(**data) @@ -1471,6 +1507,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchNumberRangeExpression(**data) @@ -1487,6 +1524,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchPrefixExpression(**data) @@ -1503,6 +1541,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchWildCardExpression(**data) @@ -1533,6 +1572,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchRequest(**data) @@ -1568,6 +1608,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderSearchSorting(**data) @@ -1727,6 +1768,12 @@ class OrderUpdateSchema(helpers.BaseSchema): "setShippingAddressCustomType": helpers.absmod( __name__, ".OrderSetShippingAddressCustomTypeActionSchema" ), + "setShippingCustomField": helpers.absmod( + __name__, ".OrderSetShippingCustomFieldActionSchema" + ), + "setShippingCustomType": helpers.absmod( + __name__, ".OrderSetShippingCustomTypeActionSchema" + ), "setStore": helpers.absmod(__name__, ".OrderSetStoreActionSchema"), "transitionCustomLineItemState": helpers.absmod( __name__, ".OrderTransitionCustomLineItemStateActionSchema" @@ -1754,6 +1801,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderUpdate(**data) @@ -1813,6 +1861,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Parcel(**data) @@ -1856,6 +1905,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ParcelDraft(**data) @@ -1890,6 +1940,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ParcelMeasurements(**data) @@ -1907,6 +1958,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PaymentInfo(**data) @@ -1947,6 +1999,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantImportDraft(**data) @@ -1985,6 +2038,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReturnInfo(**data) @@ -2014,6 +2068,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReturnInfoDraft(**data) @@ -2132,6 +2187,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReturnItemDraft(**data) @@ -2210,6 +2266,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingInfoImportDraft(**data) @@ -2235,6 +2292,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SyncInfo(**data) @@ -2259,6 +2317,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxedItemPriceDraft(**data) @@ -2293,6 +2352,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TrackingData(**data) @@ -3610,6 +3670,57 @@ def post_load(self, data, **kwargs): return models.OrderSetShippingAddressCustomTypeAction(**data) +class OrderSetShippingCustomFieldActionSchema(OrderUpdateActionSchema): + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingKey", + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.OrderSetShippingCustomFieldAction(**data) + + +class OrderSetShippingCustomTypeActionSchema(OrderUpdateActionSchema): + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingKey", + ) + type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.TypeResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + fields = FieldContainerField( + allow_none=True, + values=marshmallow.fields.Raw(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.OrderSetShippingCustomTypeAction(**data) + + class OrderSetStoreActionSchema(OrderUpdateActionSchema): store = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".store.StoreResourceIdentifierSchema"), diff --git a/src/commercetools/platform/models/_schemas/order_edit.py b/src/commercetools/platform/models/_schemas/order_edit.py index cb886462..7cacb3a7 100644 --- a/src/commercetools/platform/models/_schemas/order_edit.py +++ b/src/commercetools/platform/models/_schemas/order_edit.py @@ -295,6 +295,12 @@ class OrderEditSchema(BaseResourceSchema): "setShippingAddressCustomType": helpers.absmod( __name__, ".StagedOrderSetShippingAddressCustomTypeActionSchema" ), + "setShippingCustomField": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomFieldActionSchema" + ), + "setShippingCustomType": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomTypeActionSchema" + ), "setShippingMethod": helpers.absmod( __name__, ".StagedOrderSetShippingMethodActionSchema" ), @@ -378,6 +384,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderEdit(**data) @@ -394,6 +401,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderEditApply(**data) @@ -649,6 +657,12 @@ class OrderEditDraftSchema(helpers.BaseSchema): "setShippingAddressCustomType": helpers.absmod( __name__, ".StagedOrderSetShippingAddressCustomTypeActionSchema" ), + "setShippingCustomField": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomFieldActionSchema" + ), + "setShippingCustomType": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomTypeActionSchema" + ), "setShippingMethod": helpers.absmod( __name__, ".StagedOrderSetShippingMethodActionSchema" ), @@ -708,6 +722,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderEditDraft(**data) @@ -731,6 +746,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderEditPagedQueryResponse(**data) @@ -753,6 +769,7 @@ def post_load(self, data, **kwargs): class OrderEditResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -803,6 +820,7 @@ def post_load(self, data, **kwargs): class OrderEditNotProcessedSchema(OrderEditResultSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -943,6 +961,9 @@ class OrderEditPreviewFailureSchema(OrderEditResultSchema): "LanguageUsedInStores": helpers.absmod( __name__, ".error.LanguageUsedInStoresErrorSchema" ), + "LockedField": helpers.absmod( + __name__, ".error.LockedFieldErrorSchema" + ), "MatchingPriceNotFound": helpers.absmod( __name__, ".error.MatchingPriceNotFoundErrorSchema" ), @@ -967,7 +988,6 @@ class OrderEditPreviewFailureSchema(OrderEditResultSchema): "NoMatchingProductDiscountFound": helpers.absmod( __name__, ".error.NoMatchingProductDiscountFoundErrorSchema" ), - "NotEnabled": helpers.absmod(__name__, ".error.NotEnabledErrorSchema"), "ObjectNotFound": helpers.absmod( __name__, ".error.ObjectNotFoundErrorSchema" ), @@ -1155,6 +1175,10 @@ class OrderEditPreviewSuccessSchema(OrderEditResultSchema): "BusinessUnitAddressRemoved": helpers.absmod( __name__, ".message.BusinessUnitAddressRemovedMessagePayloadSchema" ), + "BusinessUnitApprovalRuleModeChanged": helpers.absmod( + __name__, + ".message.BusinessUnitApprovalRuleModeChangedMessagePayloadSchema", + ), "BusinessUnitAssociateAdded": helpers.absmod( __name__, ".message.BusinessUnitAssociateAddedMessagePayloadSchema" ), @@ -1247,6 +1271,21 @@ class OrderEditPreviewSuccessSchema(OrderEditResultSchema): "BusinessUnitStoresSet": helpers.absmod( __name__, ".message.BusinessUnitStoresSetMessagePayloadSchema" ), + "CartDiscountCreated": helpers.absmod( + __name__, ".message.CartDiscountCreatedMessagePayloadSchema" + ), + "CartDiscountDeleted": helpers.absmod( + __name__, ".message.CartDiscountDeletedMessagePayloadSchema" + ), + "CartDiscountStoreAdded": helpers.absmod( + __name__, ".message.CartDiscountStoreAddedMessagePayloadSchema" + ), + "CartDiscountStoreRemoved": helpers.absmod( + __name__, ".message.CartDiscountStoreRemovedMessagePayloadSchema" + ), + "CartDiscountStoresSet": helpers.absmod( + __name__, ".message.CartDiscountStoresSetMessagePayloadSchema" + ), "CategoryCreated": helpers.absmod( __name__, ".message.CategoryCreatedMessagePayloadSchema" ), @@ -1356,6 +1395,15 @@ class OrderEditPreviewSuccessSchema(OrderEditResultSchema): "CustomerTitleSet": helpers.absmod( __name__, ".message.CustomerTitleSetMessagePayloadSchema" ), + "DiscountCodeCreated": helpers.absmod( + __name__, ".message.DiscountCodeCreatedMessagePayloadSchema" + ), + "DiscountCodeDeleted": helpers.absmod( + __name__, ".message.DiscountCodeDeletedMessagePayloadSchema" + ), + "DiscountCodeKeySet": helpers.absmod( + __name__, ".message.DiscountCodeKeySetMessagePayloadSchema" + ), "InventoryEntryCreated": helpers.absmod( __name__, ".message.InventoryEntryCreatedMessagePayloadSchema" ), @@ -1407,6 +1455,25 @@ class OrderEditPreviewSuccessSchema(OrderEditResultSchema): "ProductPriceChanged": helpers.absmod( __name__, ".message.ProductPriceChangedMessagePayloadSchema" ), + "ProductPriceCustomFieldAdded": helpers.absmod( + __name__, + ".message.ProductPriceCustomFieldAddedMessagePayloadSchema", + ), + "ProductPriceCustomFieldChanged": helpers.absmod( + __name__, + ".message.ProductPriceCustomFieldChangedMessagePayloadSchema", + ), + "ProductPriceCustomFieldRemoved": helpers.absmod( + __name__, + ".message.ProductPriceCustomFieldRemovedMessagePayloadSchema", + ), + "ProductPriceCustomFieldsRemoved": helpers.absmod( + __name__, + ".message.ProductPriceCustomFieldsRemovedMessagePayloadSchema", + ), + "ProductPriceCustomFieldsSet": helpers.absmod( + __name__, ".message.ProductPriceCustomFieldsSetMessagePayloadSchema" + ), "ProductPriceDiscountsSet": helpers.absmod( __name__, ".message.ProductPriceDiscountsSetMessagePayloadSchema" ), @@ -1468,6 +1535,34 @@ class OrderEditPreviewSuccessSchema(OrderEditResultSchema): "ProductStateTransition": helpers.absmod( __name__, ".message.ProductStateTransitionMessagePayloadSchema" ), + "ProductTailoringCreated": helpers.absmod( + __name__, ".message.ProductTailoringCreatedMessagePayloadSchema" + ), + "ProductTailoringDeleted": helpers.absmod( + __name__, ".message.ProductTailoringDeletedMessagePayloadSchema" + ), + "ProductTailoringDescriptionSet": helpers.absmod( + __name__, + ".message.ProductTailoringDescriptionSetMessagePayloadSchema", + ), + "ProductTailoringImageAdded": helpers.absmod( + __name__, ".message.ProductTailoringImageAddedMessagePayloadSchema" + ), + "ProductTailoringImagesSet": helpers.absmod( + __name__, ".message.ProductTailoringImagesSetMessagePayloadSchema" + ), + "ProductTailoringNameSet": helpers.absmod( + __name__, ".message.ProductTailoringNameSetMessagePayloadSchema" + ), + "ProductTailoringPublished": helpers.absmod( + __name__, ".message.ProductTailoringPublishedMessagePayloadSchema" + ), + "ProductTailoringSlugSet": helpers.absmod( + __name__, ".message.ProductTailoringSlugSetMessagePayloadSchema" + ), + "ProductTailoringUnpublished": helpers.absmod( + __name__, ".message.ProductTailoringUnpublishedMessagePayloadSchema" + ), "ProductUnpublished": helpers.absmod( __name__, ".message.ProductUnpublishedMessagePayloadSchema" ), @@ -1477,6 +1572,14 @@ class OrderEditPreviewSuccessSchema(OrderEditResultSchema): "ProductVariantDeleted": helpers.absmod( __name__, ".message.ProductVariantDeletedMessagePayloadSchema" ), + "ProductVariantTailoringAdded": helpers.absmod( + __name__, + ".message.ProductVariantTailoringAddedMessagePayloadSchema", + ), + "ProductVariantTailoringRemoved": helpers.absmod( + __name__, + ".message.ProductVariantTailoringRemovedMessagePayloadSchema", + ), "QuoteCreated": helpers.absmod( __name__, ".message.QuoteCreatedMessagePayloadSchema" ), @@ -1673,6 +1776,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderEditUpdate(**data) @@ -1718,15 +1822,18 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.OrderExcerpt(**data) class StagedOrderSchema(OrderSchema): + class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StagedOrder(**data) @@ -1968,6 +2075,12 @@ class OrderEditAddStagedActionActionSchema(OrderEditUpdateActionSchema): "setShippingAddressCustomType": helpers.absmod( __name__, ".StagedOrderSetShippingAddressCustomTypeActionSchema" ), + "setShippingCustomField": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomFieldActionSchema" + ), + "setShippingCustomType": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomTypeActionSchema" + ), "setShippingMethod": helpers.absmod( __name__, ".StagedOrderSetShippingMethodActionSchema" ), @@ -2320,6 +2433,12 @@ class OrderEditSetStagedActionsActionSchema(OrderEditUpdateActionSchema): "setShippingAddressCustomType": helpers.absmod( __name__, ".StagedOrderSetShippingAddressCustomTypeActionSchema" ), + "setShippingCustomField": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomFieldActionSchema" + ), + "setShippingCustomType": helpers.absmod( + __name__, ".StagedOrderSetShippingCustomTypeActionSchema" + ), "setShippingMethod": helpers.absmod( __name__, ".StagedOrderSetShippingMethodActionSchema" ), @@ -4599,6 +4718,57 @@ def post_load(self, data, **kwargs): return models.StagedOrderSetShippingAddressCustomTypeAction(**data) +class StagedOrderSetShippingCustomFieldActionSchema(StagedOrderUpdateActionSchema): + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingKey", + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.StagedOrderSetShippingCustomFieldAction(**data) + + +class StagedOrderSetShippingCustomTypeActionSchema(StagedOrderUpdateActionSchema): + shipping_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="shippingKey", + ) + type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.TypeResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + fields = FieldContainerField( + allow_none=True, + values=marshmallow.fields.Raw(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.StagedOrderSetShippingCustomTypeAction(**data) + + class StagedOrderSetShippingMethodActionSchema(StagedOrderUpdateActionSchema): shipping_method = helpers.LazyNestedField( nested=helpers.absmod( diff --git a/src/commercetools/platform/models/_schemas/payment.py b/src/commercetools/platform/models/_schemas/payment.py index 989df091..ba2965ce 100644 --- a/src/commercetools/platform/models/_schemas/payment.py +++ b/src/commercetools/platform/models/_schemas/payment.py @@ -172,6 +172,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Payment(**data) @@ -287,6 +288,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PaymentDraft(**data) @@ -312,6 +314,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PaymentMethodInfo(**data) @@ -335,6 +338,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PaymentPagedQueryResponse(**data) @@ -357,6 +361,7 @@ def post_load(self, data, **kwargs): class PaymentResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -392,6 +397,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PaymentStatus(**data) @@ -421,6 +427,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PaymentStatusDraft(**data) @@ -512,6 +519,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PaymentUpdate(**data) @@ -563,6 +571,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Transaction(**data) @@ -605,6 +614,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TransactionDraft(**data) diff --git a/src/commercetools/platform/models/_schemas/product.py b/src/commercetools/platform/models/_schemas/product.py index beac4b62..13e6dc18 100644 --- a/src/commercetools/platform/models/_schemas/product.py +++ b/src/commercetools/platform/models/_schemas/product.py @@ -27,18 +27,21 @@ # Fields class CategoryOrderHintsField(marshmallow.fields.Dict): + def _deserialize(self, value, attr, data, **kwargs): result = super()._deserialize(value, attr, data) return models.CategoryOrderHints(**result) class ProductVariantChannelAvailabilityMapField(marshmallow.fields.Dict): + def _deserialize(self, value, attr, data, **kwargs): result = super()._deserialize(value, attr, data) return models.ProductVariantChannelAvailabilityMap(**result) class SearchKeywordsField(marshmallow.fields.Dict): + def _deserialize(self, value, attr, data, **kwargs): result = super()._deserialize(value, attr, data) return models.SearchKeywords(**result) @@ -54,6 +57,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Attribute(**data) @@ -85,6 +89,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.FacetRange(**data) @@ -156,6 +161,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.FacetTerm(**data) @@ -248,6 +254,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Product(**data) @@ -274,6 +281,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductCatalogData(**data) @@ -360,6 +368,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductData(**data) @@ -490,6 +499,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductDraft(**data) @@ -513,6 +523,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductPagedQueryResponse(**data) @@ -650,6 +661,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductProjection(**data) @@ -673,6 +685,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductProjectionPagedQueryResponse(**data) @@ -702,6 +715,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductProjectionPagedSearchResponse(**data) @@ -724,6 +738,7 @@ def post_load(self, data, **kwargs): class ProductResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -881,6 +896,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductUpdate(**data) @@ -976,6 +992,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariant(**data) @@ -1008,12 +1025,19 @@ class ProductVariantAvailabilitySchema(helpers.BaseSchema): load_default=None, data_key="availableQuantity", ) + id = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + version = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantAvailability(**data) @@ -1044,6 +1068,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantChannelAvailability(**data) @@ -1092,6 +1117,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantDraft(**data) @@ -1132,6 +1158,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SearchKeyword(**data) @@ -1169,6 +1196,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Suggestion(**data) @@ -1237,6 +1265,7 @@ def post_load(self, data, **kwargs): class WhitespaceTokenizerSchema(SuggestTokenizerSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -1764,6 +1793,7 @@ def post_load(self, data, **kwargs): class ProductRevertStagedChangesActionSchema(ProductUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -2482,6 +2512,7 @@ def post_load(self, data, **kwargs): class ProductUnpublishActionSchema(ProductUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/product_discount.py b/src/commercetools/platform/models/_schemas/product_discount.py index 404fdbcd..73120654 100644 --- a/src/commercetools/platform/models/_schemas/product_discount.py +++ b/src/commercetools/platform/models/_schemas/product_discount.py @@ -130,6 +130,9 @@ class ProductDiscountSchema(BaseResourceSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -181,6 +184,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductDiscount(**data) @@ -240,6 +244,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductDiscountDraft(**data) @@ -263,6 +268,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductDiscountMatchQuery(**data) @@ -286,6 +292,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductDiscountPagedQueryResponse(**data) @@ -308,6 +315,7 @@ def post_load(self, data, **kwargs): class ProductDiscountResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -365,6 +373,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductDiscountUpdate(**data) @@ -441,6 +450,7 @@ def post_load(self, data, **kwargs): class ProductDiscountValueExternalSchema(ProductDiscountValueSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -451,6 +461,7 @@ def post_load(self, data, **kwargs): class ProductDiscountValueExternalDraftSchema(ProductDiscountValueDraftSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/product_search.py b/src/commercetools/platform/models/_schemas/product_search.py new file mode 100644 index 00000000..383f2a27 --- /dev/null +++ b/src/commercetools/platform/models/_schemas/product_search.py @@ -0,0 +1,559 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from ..product_search import ( + ProductSearchFacetCountLevelEnum, + ProductSearchFacetDistinctBucketSortBy, + ProductSearchFacetScopeEnum, +) +from ..search import SearchFieldType, SearchSortOrder +from .error import ErrorResponseSchema + +# Fields + + +# Marshmallow Schemas +class ProductPagedSearchResponseSchema(helpers.BaseSchema): + total = marshmallow.fields.Integer(allow_none=True, load_default=None) + offset = marshmallow.fields.Integer(allow_none=True, load_default=None) + limit = marshmallow.fields.Integer(allow_none=True, load_default=None) + facets = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchFacetResultSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + results = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchResultSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductPagedSearchResponse(**data) + + +class ProductSearchErrorResponseSchema(ErrorResponseSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchErrorResponse(**data) + + +class ProductSearchMatchingVariantEntrySchema(helpers.BaseSchema): + id = marshmallow.fields.Integer(allow_none=True, load_default=None) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchMatchingVariantEntry(**data) + + +class ProductSearchMatchingVariantsSchema(helpers.BaseSchema): + all_matched = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="allMatched" + ) + matched_variants = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchMatchingVariantEntrySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="matchedVariants", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchMatchingVariants(**data) + + +class ProductSearchProjectionParamsSchema(helpers.BaseSchema): + expand = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + price_currency = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="priceCurrency", + ) + price_country = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="priceCountry", + ) + price_customer_group = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="priceCustomerGroup", + ) + price_channel = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="priceChannel", + ) + locale_projection = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="localeProjection", + ) + store_projection = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="storeProjection", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchProjectionParams(**data) + + +class ProductSearchRequestSchema(helpers.BaseSchema): + query = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchQuerySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + sort = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchSortingSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + limit = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + offset = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + mark_matching_variants = marshmallow.fields.Boolean( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="markMatchingVariants", + ) + product_projection_parameters = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchProjectionParamsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="productProjectionParameters", + ) + facets = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchFacetExpressionSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + post_filter = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchQuerySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="postFilter", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchRequest(**data) + + +class ProductSearchResultSchema(helpers.BaseSchema): + id = marshmallow.fields.String(allow_none=True, load_default=None) + product_projection = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductProjectionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="productProjection", + ) + matching_variants = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchMatchingVariantsSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="matchingVariants", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchResult(**data) + + +class ProductSearchFacetCountValueSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + scope = marshmallow_enum.EnumField( + ProductSearchFacetScopeEnum, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + filter = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchQuerySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + level = marshmallow_enum.EnumField( + ProductSearchFacetCountLevelEnum, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetCountValue(**data) + + +class ProductSearchFacetDistinctBucketSortExpressionSchema(helpers.BaseSchema): + by = marshmallow_enum.EnumField( + ProductSearchFacetDistinctBucketSortBy, + by_value=True, + allow_none=True, + load_default=None, + ) + order = marshmallow_enum.EnumField( + SearchSortOrder, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetDistinctBucketSortExpression(**data) + + +class ProductSearchFacetDistinctValueSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + scope = marshmallow_enum.EnumField( + ProductSearchFacetScopeEnum, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + filter = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchQuerySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + level = marshmallow_enum.EnumField( + ProductSearchFacetCountLevelEnum, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + field = marshmallow.fields.String(allow_none=True, load_default=None) + includes = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + sort = helpers.LazyNestedField( + nested=helpers.absmod( + __name__, ".ProductSearchFacetDistinctBucketSortExpressionSchema" + ), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + limit = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + language = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + field_type = marshmallow_enum.EnumField( + SearchFieldType, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="fieldType", + ) + missing = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetDistinctValue(**data) + + +class ProductSearchFacetExpressionSchema(helpers.BaseSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetExpression(**data) + + +class ProductSearchFacetCountExpressionSchema(ProductSearchFacetExpressionSchema): + count = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchFacetCountValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetCountExpression(**data) + + +class ProductSearchFacetDistinctExpressionSchema(ProductSearchFacetExpressionSchema): + distinct = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchFacetDistinctValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetDistinctExpression(**data) + + +class ProductSearchFacetRangesExpressionSchema(ProductSearchFacetExpressionSchema): + ranges = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchFacetRangesValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetRangesExpression(**data) + + +class ProductSearchFacetRangesFacetRangeSchema(helpers.BaseSchema): + from_ = marshmallow.fields.Raw( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="from", + ) + to = marshmallow.fields.Raw( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetRangesFacetRange(**data) + + +class ProductSearchFacetRangesValueSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + scope = marshmallow_enum.EnumField( + ProductSearchFacetScopeEnum, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + filter = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".search.SearchQuerySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + level = marshmallow_enum.EnumField( + ProductSearchFacetCountLevelEnum, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + field = marshmallow.fields.String(allow_none=True, load_default=None) + ranges = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchFacetRangesFacetRangeSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + language = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + field_type = marshmallow_enum.EnumField( + SearchFieldType, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="fieldType", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetRangesValue(**data) + + +class ProductSearchFacetResultSchema(helpers.BaseSchema): + name = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetResult(**data) + + +class ProductSearchFacetResultBucketSchema(ProductSearchFacetResultSchema): + buckets = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductSearchFacetResultBucketEntrySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetResultBucket(**data) + + +class ProductSearchFacetResultBucketEntrySchema(helpers.BaseSchema): + key = marshmallow.fields.String(allow_none=True, load_default=None) + count = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetResultBucketEntry(**data) + + +class ProductSearchFacetResultCountSchema(ProductSearchFacetResultSchema): + value = marshmallow.fields.Integer(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductSearchFacetResultCount(**data) diff --git a/src/commercetools/platform/models/_schemas/product_selection.py b/src/commercetools/platform/models/_schemas/product_selection.py index c7f93eb9..9a97d307 100644 --- a/src/commercetools/platform/models/_schemas/product_selection.py +++ b/src/commercetools/platform/models/_schemas/product_selection.py @@ -73,6 +73,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssignedProductReference(**data) @@ -122,6 +123,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssignedProductSelection(**data) @@ -145,6 +147,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AssignedProductSelectionPagedQueryResponse(**data) @@ -199,6 +202,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelection(**data) @@ -251,6 +255,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelectionAssignment(**data) @@ -290,6 +295,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelectionDraft(**data) @@ -313,6 +319,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelectionPagedQueryResponse(**data) @@ -336,6 +343,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelectionProductPagedQueryResponse(**data) @@ -358,6 +366,7 @@ def post_load(self, data, **kwargs): class ProductSelectionResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -458,6 +467,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelectionUpdate(**data) @@ -483,6 +493,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductVariantExclusion(**data) @@ -579,6 +590,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductsInStorePagedQueryResponse(**data) diff --git a/src/commercetools/platform/models/_schemas/product_tailoring.py b/src/commercetools/platform/models/_schemas/product_tailoring.py new file mode 100644 index 00000000..9904cd5a --- /dev/null +++ b/src/commercetools/platform/models/_schemas/product_tailoring.py @@ -0,0 +1,1180 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from ..common import ReferenceTypeId +from .common import ( + BaseResourceSchema, + LocalizedStringField, + ReferenceSchema, + ResourceIdentifierSchema, +) +from .type import FieldContainerField + +# Fields + + +# Marshmallow Schemas +class ProductTailoringSchema(BaseResourceSchema): + last_modified_by = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.LastModifiedBySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="lastModifiedBy", + ) + created_by = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CreatedBySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="createdBy", + ) + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + published = marshmallow.fields.Boolean(allow_none=True, load_default=None) + current = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductTailoringDataSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + staged = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductTailoringDataSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + has_staged_changes = marshmallow.fields.Boolean( + allow_none=True, load_default=None, data_key="hasStagedChanges" + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductTailoring(**data) + + +class ProductTailoringDataSchema(helpers.BaseSchema): + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + meta_title = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaTitle", + ) + meta_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaDescription", + ) + meta_keywords = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaKeywords", + ) + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + variants = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductVariantTailoringSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductTailoringData(**data) + + +class ProductTailoringDraftSchema(helpers.BaseSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + meta_title = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaTitle", + ) + meta_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaDescription", + ) + meta_keywords = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaKeywords", + ) + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + publish = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + variants = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductVariantTailoringDraftSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductTailoringDraft(**data) + + +class ProductTailoringInStoreDraftSchema(helpers.BaseSchema): + key = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + product = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".product.ProductResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + meta_title = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaTitle", + ) + meta_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaDescription", + ) + meta_keywords = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaKeywords", + ) + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + publish = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + variants = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductVariantTailoringDraftSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductTailoringInStoreDraft(**data) + + +class ProductTailoringPagedQueryResponseSchema(helpers.BaseSchema): + limit = marshmallow.fields.Integer(allow_none=True, load_default=None) + offset = marshmallow.fields.Integer(allow_none=True, load_default=None) + count = marshmallow.fields.Integer(allow_none=True, load_default=None) + total = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + results = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductTailoringSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductTailoringPagedQueryResponse(**data) + + +class ProductTailoringReferenceSchema(ReferenceSchema): + obj = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".ProductTailoringSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type_id"] + return models.ProductTailoringReference(**data) + + +class ProductTailoringResourceIdentifierSchema(ResourceIdentifierSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["type_id"] + return models.ProductTailoringResourceIdentifier(**data) + + +class ProductTailoringUpdateActionSchema(helpers.BaseSchema): + action = marshmallow.fields.String(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringUpdateAction(**data) + + +class ProductVariantTailoringSchema(helpers.BaseSchema): + id = marshmallow.fields.Integer(allow_none=True, load_default=None) + images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + assets = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductVariantTailoring(**data) + + +class ProductVariantTailoringDraftSchema(helpers.BaseSchema): + id = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + assets = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.ProductVariantTailoringDraft(**data) + + +class ProductTailoringAddAssetActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetDraftSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + position = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringAddAssetAction(**data) + + +class ProductTailoringAddExternalImageActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + image = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringAddExternalImageAction(**data) + + +class ProductTailoringAddVariantActionSchema(ProductTailoringUpdateActionSchema): + id = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + assets = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetDraftSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringAddVariantAction(**data) + + +class ProductTailoringChangeAssetNameActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetId", + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringChangeAssetNameAction(**data) + + +class ProductTailoringChangeAssetOrderActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_order = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + load_default=None, + data_key="assetOrder", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringChangeAssetOrderAction(**data) + + +class ProductTailoringMoveImageToPositionActionSchema( + ProductTailoringUpdateActionSchema +): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + image_url = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="imageUrl" + ) + position = marshmallow.fields.Integer(allow_none=True, load_default=None) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringMoveImageToPositionAction(**data) + + +class ProductTailoringPublishActionSchema(ProductTailoringUpdateActionSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringPublishAction(**data) + + +class ProductTailoringRemoveAssetActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetId", + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringRemoveAssetAction(**data) + + +class ProductTailoringRemoveImageActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + image_url = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="imageUrl" + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringRemoveImageAction(**data) + + +class ProductTailoringRemoveVariantActionSchema(ProductTailoringUpdateActionSchema): + id = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringRemoveVariantAction(**data) + + +class ProductTailoringSetAssetCustomFieldActionSchema( + ProductTailoringUpdateActionSchema +): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetId", + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + name = marshmallow.fields.String(allow_none=True, load_default=None) + value = marshmallow.fields.Raw( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetAssetCustomFieldAction(**data) + + +class ProductTailoringSetAssetCustomTypeActionSchema( + ProductTailoringUpdateActionSchema +): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetId", + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + type = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".type.TypeResourceIdentifierSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + fields = FieldContainerField( + allow_none=True, + values=marshmallow.fields.Raw(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetAssetCustomTypeAction(**data) + + +class ProductTailoringSetAssetDescriptionActionSchema( + ProductTailoringUpdateActionSchema +): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetId", + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetAssetDescriptionAction(**data) + + +class ProductTailoringSetAssetKeyActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="assetId" + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetAssetKeyAction(**data) + + +class ProductTailoringSetAssetSourcesActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetId", + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + sources = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.AssetSourceSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetAssetSourcesAction(**data) + + +class ProductTailoringSetAssetTagsActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + asset_id = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetId", + ) + asset_key = marshmallow.fields.String( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="assetKey", + ) + tags = marshmallow.fields.List( + marshmallow.fields.String(allow_none=True), + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetAssetTagsAction(**data) + + +class ProductTailoringSetDescriptionActionSchema(ProductTailoringUpdateActionSchema): + description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetDescriptionAction(**data) + + +class ProductTailoringSetExternalImagesActionSchema(ProductTailoringUpdateActionSchema): + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + images = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.ImageSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetExternalImagesAction(**data) + + +class ProductTailoringSetImageLabelActionSchema(ProductTailoringUpdateActionSchema): + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + variant_id = marshmallow.fields.Integer( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="variantId", + ) + image_url = marshmallow.fields.String( + allow_none=True, load_default=None, data_key="imageUrl" + ) + label = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetImageLabelAction(**data) + + +class ProductTailoringSetMetaAttributesActionSchema(ProductTailoringUpdateActionSchema): + meta_title = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaTitle", + ) + meta_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaDescription", + ) + meta_keywords = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaKeywords", + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetMetaAttributesAction(**data) + + +class ProductTailoringSetMetaDescriptionActionSchema( + ProductTailoringUpdateActionSchema +): + meta_description = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaDescription", + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetMetaDescriptionAction(**data) + + +class ProductTailoringSetMetaKeywordsActionSchema(ProductTailoringUpdateActionSchema): + meta_keywords = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaKeywords", + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetMetaKeywordsAction(**data) + + +class ProductTailoringSetMetaTitleActionSchema(ProductTailoringUpdateActionSchema): + meta_title = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + data_key="metaTitle", + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetMetaTitleAction(**data) + + +class ProductTailoringSetNameActionSchema(ProductTailoringUpdateActionSchema): + name = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetNameAction(**data) + + +class ProductTailoringSetSlugActionSchema(ProductTailoringUpdateActionSchema): + slug = LocalizedStringField( + allow_none=True, + values=marshmallow.fields.String(allow_none=True), + metadata={"omit_empty": True}, + load_default=None, + ) + staged = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringSetSlugAction(**data) + + +class ProductTailoringUnpublishActionSchema(ProductTailoringUpdateActionSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProductTailoringUnpublishAction(**data) diff --git a/src/commercetools/platform/models/_schemas/product_type.py b/src/commercetools/platform/models/_schemas/product_type.py index 05b9f17d..7bc1a972 100644 --- a/src/commercetools/platform/models/_schemas/product_type.py +++ b/src/commercetools/platform/models/_schemas/product_type.py @@ -93,6 +93,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeDefinition(**data) @@ -161,6 +162,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeDefinitionDraft(**data) @@ -177,6 +179,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributeLocalizedEnumValue(**data) @@ -189,6 +192,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.AttributePlainEnumValue(**data) @@ -205,6 +209,7 @@ def post_load(self, data, **kwargs): class AttributeBooleanTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -215,6 +220,7 @@ def post_load(self, data, **kwargs): class AttributeDateTimeTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -225,6 +231,7 @@ def post_load(self, data, **kwargs): class AttributeDateTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -253,6 +260,7 @@ def post_load(self, data, **kwargs): class AttributeLocalizableTextTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -281,6 +289,7 @@ def post_load(self, data, **kwargs): class AttributeMoneyTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -309,6 +318,7 @@ def post_load(self, data, **kwargs): class AttributeNumberTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -369,6 +379,7 @@ def post_load(self, data, **kwargs): class AttributeTextTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -379,6 +390,7 @@ def post_load(self, data, **kwargs): class AttributeTimeTypeSchema(AttributeTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -424,6 +436,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductType(**data) @@ -447,6 +460,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductTypeDraft(**data) @@ -470,6 +484,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductTypePagedQueryResponse(**data) @@ -492,6 +507,7 @@ def post_load(self, data, **kwargs): class ProductTypeResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -580,6 +596,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductTypeUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/project.py b/src/commercetools/platform/models/_schemas/project.py index 92fdee71..4daeaae0 100644 --- a/src/commercetools/platform/models/_schemas/project.py +++ b/src/commercetools/platform/models/_schemas/project.py @@ -15,7 +15,9 @@ from ... import models from ..project import ( BusinessUnitConfigurationStatus, + CustomerSearchStatus, OrderSearchStatus, + ProductSearchIndexingMode, SearchIndexingConfigurationStatus, ) from ..shipping_method import ShippingRateTierType @@ -24,6 +26,8 @@ # Marshmallow Schemas + + class BusinessUnitConfigurationSchema(helpers.BaseSchema): my_business_unit_status_on_creation = marshmallow_enum.EnumField( BusinessUnitConfigurationStatus, @@ -48,6 +52,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.BusinessUnitConfiguration(**data) @@ -70,6 +75,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CartsConfiguration(**data) @@ -84,6 +90,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ExternalOAuth(**data) @@ -173,6 +180,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Project(**data) @@ -198,6 +206,9 @@ class ProjectUpdateSchema(helpers.BaseSchema): "changeCurrencies": helpers.absmod( __name__, ".ProjectChangeCurrenciesActionSchema" ), + "changeCustomerSearchStatus": helpers.absmod( + __name__, ".ProjectChangeCustomerSearchStatusActionSchema" + ), "changeLanguages": helpers.absmod( __name__, ".ProjectChangeLanguagesActionSchema" ), @@ -240,6 +251,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProjectUpdate(**data) @@ -263,6 +275,14 @@ class SearchIndexingConfigurationSchema(helpers.BaseSchema): metadata={"omit_empty": True}, load_default=None, ) + products_search = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchIndexingConfigurationValuesSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + data_key="productsSearch", + ) orders = helpers.LazyNestedField( nested=helpers.absmod(__name__, ".SearchIndexingConfigurationValuesSchema"), allow_none=True, @@ -276,6 +296,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SearchIndexingConfiguration(**data) @@ -307,6 +328,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SearchIndexingConfigurationValues(**data) @@ -343,6 +365,7 @@ def post_load(self, data, **kwargs): class CartScoreTypeSchema(ShippingRateInputTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -353,6 +376,7 @@ def post_load(self, data, **kwargs): class CartValueTypeSchema(ShippingRateInputTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -375,6 +399,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShoppingListsConfiguration(**data) @@ -455,6 +480,20 @@ def post_load(self, data, **kwargs): return models.ProjectChangeCurrenciesAction(**data) +class ProjectChangeCustomerSearchStatusActionSchema(ProjectUpdateActionSchema): + status = marshmallow_enum.EnumField( + CustomerSearchStatus, by_value=True, allow_none=True, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ProjectChangeCustomerSearchStatusAction(**data) + + class ProjectChangeLanguagesActionSchema(ProjectUpdateActionSchema): languages = marshmallow.fields.List( marshmallow.fields.String(allow_none=True), allow_none=True, load_default=None @@ -529,6 +568,13 @@ def post_load(self, data, **kwargs): class ProjectChangeProductSearchIndexingEnabledActionSchema(ProjectUpdateActionSchema): enabled = marshmallow.fields.Boolean(allow_none=True, load_default=None) + mode = marshmallow_enum.EnumField( + ProductSearchIndexingMode, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/quote.py b/src/commercetools/platform/models/_schemas/quote.py index 5ec02feb..83efbeb8 100644 --- a/src/commercetools/platform/models/_schemas/quote.py +++ b/src/commercetools/platform/models/_schemas/quote.py @@ -269,6 +269,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Quote(**data) @@ -314,6 +315,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QuoteDraft(**data) @@ -337,6 +339,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QuotePagedQueryResponse(**data) @@ -359,6 +362,7 @@ def post_load(self, data, **kwargs): class QuoteResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -404,6 +408,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QuoteUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/quote_request.py b/src/commercetools/platform/models/_schemas/quote_request.py index c0573977..251d21c5 100644 --- a/src/commercetools/platform/models/_schemas/quote_request.py +++ b/src/commercetools/platform/models/_schemas/quote_request.py @@ -246,6 +246,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QuoteRequest(**data) @@ -291,6 +292,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QuoteRequestDraft(**data) @@ -314,6 +316,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QuoteRequestPagedQueryResponse(**data) @@ -336,6 +339,7 @@ def post_load(self, data, **kwargs): class QuoteRequestResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -378,6 +382,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.QuoteRequestUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/review.py b/src/commercetools/platform/models/_schemas/review.py index c946bf6d..ade46d2a 100644 --- a/src/commercetools/platform/models/_schemas/review.py +++ b/src/commercetools/platform/models/_schemas/review.py @@ -114,6 +114,9 @@ class ReviewSchema(BaseResourceSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -179,6 +182,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Review(**data) @@ -254,6 +258,9 @@ class ReviewDraftSchema(helpers.BaseSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionResourceIdentifierSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringResourceIdentifierSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeResourceIdentifierSchema" ), @@ -318,6 +325,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReviewDraft(**data) @@ -341,6 +349,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReviewPagedQueryResponse(**data) @@ -364,6 +373,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReviewRatingStatistics(**data) @@ -386,6 +396,7 @@ def post_load(self, data, **kwargs): class ReviewResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -434,6 +445,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ReviewUpdate(**data) @@ -613,6 +625,9 @@ class ReviewSetTargetActionSchema(ReviewUpdateActionSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionResourceIdentifierSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringResourceIdentifierSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeResourceIdentifierSchema" ), diff --git a/src/commercetools/platform/models/_schemas/search.py b/src/commercetools/platform/models/_schemas/search.py new file mode 100644 index 00000000..e47d612d --- /dev/null +++ b/src/commercetools/platform/models/_schemas/search.py @@ -0,0 +1,592 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen +import re +import typing + +import marshmallow +import marshmallow_enum + +from commercetools import helpers + +from ... import models +from ..search import SearchFieldType, SearchMatchType, SearchSortMode, SearchSortOrder + +# Fields + + +# Marshmallow Schemas + + +class SearchMatchingVariantSchema(helpers.BaseSchema): + id = marshmallow.fields.Integer(allow_none=True, load_default=None) + sku = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchMatchingVariant(**data) + + +class SearchQuerySchema(helpers.BaseSchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchQuery(**data) + + +class SearchCompoundExpressionSchema(SearchQuerySchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchCompoundExpression(**data) + + +class SearchAndExpressionSchema(SearchCompoundExpressionSchema): + and_ = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchQuerySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="and", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchAndExpression(**data) + + +class SearchFilterExpressionSchema(SearchCompoundExpressionSchema): + filter = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchQueryExpressionSchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchFilterExpression(**data) + + +class SearchNotExpressionSchema(SearchCompoundExpressionSchema): + not_ = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchQuerySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="not", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchNotExpression(**data) + + +class SearchOrExpressionSchema(SearchCompoundExpressionSchema): + or_ = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchQuerySchema"), + allow_none=True, + many=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="or", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchOrExpression(**data) + + +class SearchQueryExpressionSchema(SearchQuerySchema): + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchQueryExpression(**data) + + +class SearchDateRangeExpressionSchema(SearchQueryExpressionSchema): + range = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchDateRangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchDateRangeExpression(**data) + + +class SearchDateTimeRangeExpressionSchema(SearchQueryExpressionSchema): + range = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchDateTimeRangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchDateTimeRangeExpression(**data) + + +class SearchExactExpressionSchema(SearchQueryExpressionSchema): + exact = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchAnyValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchExactExpression(**data) + + +class SearchExistsExpressionSchema(SearchQueryExpressionSchema): + exists = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchExistsValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchExistsExpression(**data) + + +class SearchFullTextExpressionSchema(SearchQueryExpressionSchema): + full_text = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchFullTextValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="fullText", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchFullTextExpression(**data) + + +class SearchFullTextPrefixExpressionSchema(SearchQueryExpressionSchema): + full_text_prefix = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchFullTextPrefixValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + data_key="fullTextPrefix", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchFullTextPrefixExpression(**data) + + +class SearchLongRangeExpressionSchema(SearchQueryExpressionSchema): + range = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchLongRangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchLongRangeExpression(**data) + + +class SearchNumberRangeExpressionSchema(SearchQueryExpressionSchema): + range = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchNumberRangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchNumberRangeExpression(**data) + + +class SearchPrefixExpressionSchema(SearchQueryExpressionSchema): + prefix = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchAnyValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchPrefixExpression(**data) + + +class SearchQueryExpressionValueSchema(helpers.BaseSchema): + field = marshmallow.fields.String(allow_none=True, load_default=None) + boost = marshmallow.fields.Float( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + field_type = marshmallow_enum.EnumField( + SearchFieldType, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="fieldType", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchQueryExpressionValue(**data) + + +class SearchAnyValueSchema(SearchQueryExpressionValueSchema): + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + language = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + case_insensitive = marshmallow.fields.Boolean( + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="caseInsensitive", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchAnyValue(**data) + + +class SearchDateRangeValueSchema(SearchQueryExpressionValueSchema): + gte = marshmallow.fields.Date( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + gt = marshmallow.fields.Date( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lte = marshmallow.fields.Date( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lt = marshmallow.fields.Date( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchDateRangeValue(**data) + + +class SearchDateTimeRangeValueSchema(SearchQueryExpressionValueSchema): + gte = marshmallow.fields.DateTime( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + gt = marshmallow.fields.DateTime( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lte = marshmallow.fields.DateTime( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lt = marshmallow.fields.DateTime( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchDateTimeRangeValue(**data) + + +class SearchExistsValueSchema(SearchQueryExpressionValueSchema): + language = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchExistsValue(**data) + + +class SearchFullTextPrefixValueSchema(SearchQueryExpressionValueSchema): + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + language = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + must_match = marshmallow_enum.EnumField( + SearchMatchType, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="mustMatch", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchFullTextPrefixValue(**data) + + +class SearchFullTextValueSchema(SearchQueryExpressionValueSchema): + value = marshmallow.fields.Raw(allow_none=True, load_default=None) + language = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + must_match = marshmallow_enum.EnumField( + SearchMatchType, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="mustMatch", + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchFullTextValue(**data) + + +class SearchLongRangeValueSchema(SearchQueryExpressionValueSchema): + gte = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + gt = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lte = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lt = marshmallow.fields.Integer( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchLongRangeValue(**data) + + +class SearchNumberRangeValueSchema(SearchQueryExpressionValueSchema): + gte = marshmallow.fields.Float( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + gt = marshmallow.fields.Float( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lte = marshmallow.fields.Float( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lt = marshmallow.fields.Float( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchNumberRangeValue(**data) + + +class SearchSortingSchema(helpers.BaseSchema): + field = marshmallow.fields.String(allow_none=True, load_default=None) + language = marshmallow.fields.String( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + order = marshmallow_enum.EnumField( + SearchSortOrder, by_value=True, allow_none=True, load_default=None + ) + mode = marshmallow_enum.EnumField( + SearchSortMode, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + ) + field_type = marshmallow_enum.EnumField( + SearchFieldType, + by_value=True, + allow_none=True, + metadata={"omit_empty": True}, + load_default=None, + data_key="fieldType", + ) + filter = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchQueryExpressionSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchSorting(**data) + + +class SearchTimeRangeExpressionSchema(SearchQueryExpressionSchema): + range = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchTimeRangeValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchTimeRangeExpression(**data) + + +class SearchTimeRangeValueSchema(SearchQueryExpressionValueSchema): + gte = marshmallow.fields.Time( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + gt = marshmallow.fields.Time( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lte = marshmallow.fields.Time( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + lt = marshmallow.fields.Time( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchTimeRangeValue(**data) + + +class SearchWildCardExpressionSchema(SearchQueryExpressionSchema): + wildcard = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".SearchAnyValueSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + + return models.SearchWildCardExpression(**data) diff --git a/src/commercetools/platform/models/_schemas/shipping_method.py b/src/commercetools/platform/models/_schemas/shipping_method.py index 8aff4a0c..f9da6693 100644 --- a/src/commercetools/platform/models/_schemas/shipping_method.py +++ b/src/commercetools/platform/models/_schemas/shipping_method.py @@ -38,6 +38,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PriceFunction(**data) @@ -94,6 +95,7 @@ class ShippingMethodSchema(BaseResourceSchema): load_default=None, data_key="zoneRates", ) + active = marshmallow.fields.Boolean(allow_none=True, load_default=None) is_default = marshmallow.fields.Boolean( allow_none=True, load_default=None, data_key="isDefault" ) @@ -113,6 +115,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingMethod(**data) @@ -155,6 +158,9 @@ class ShippingMethodDraftSchema(helpers.BaseSchema): load_default=None, data_key="zoneRates", ) + active = marshmallow.fields.Boolean( + allow_none=True, metadata={"omit_empty": True}, load_default=None + ) is_default = marshmallow.fields.Boolean( allow_none=True, load_default=None, data_key="isDefault" ) @@ -174,6 +180,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingMethodDraft(**data) @@ -201,6 +208,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingMethodPagedQueryResponse(**data) @@ -223,6 +231,7 @@ def post_load(self, data, **kwargs): class ShippingMethodResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -245,6 +254,9 @@ class ShippingMethodUpdateSchema(helpers.BaseSchema): "addZone": helpers.absmod( __name__, ".ShippingMethodAddZoneActionSchema" ), + "changeActive": helpers.absmod( + __name__, ".ShippingMethodChangeActiveActionSchema" + ), "changeIsDefault": helpers.absmod( __name__, ".ShippingMethodChangeIsDefaultActionSchema" ), @@ -290,6 +302,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingMethodUpdate(**data) @@ -306,30 +319,16 @@ def post_load(self, data, **kwargs): class ShippingRateSchema(helpers.BaseSchema): - price = helpers.Discriminator( - allow_none=True, - discriminator_field=("type", "type"), - discriminator_schemas={ - "centPrecision": helpers.absmod( - __name__, ".common.CentPrecisionMoneySchema" - ), - "highPrecision": helpers.absmod( - __name__, ".common.HighPrecisionMoneySchema" - ), - }, - load_default=None, - ) - free_above = helpers.Discriminator( - allow_none=True, - discriminator_field=("type", "type"), - discriminator_schemas={ - "centPrecision": helpers.absmod( - __name__, ".common.CentPrecisionMoneySchema" - ), - "highPrecision": helpers.absmod( - __name__, ".common.HighPrecisionMoneySchema" - ), - }, + price = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CentPrecisionMoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + load_default=None, + ) + free_above = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".common.CentPrecisionMoneySchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, metadata={"omit_empty": True}, load_default=None, data_key="freeAbove", @@ -361,6 +360,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingRate(**data) @@ -401,6 +401,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShippingRateDraft(**data) @@ -522,6 +523,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ZoneRate(**data) @@ -546,6 +548,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ZoneRateDraft(**data) @@ -590,6 +593,18 @@ def post_load(self, data, **kwargs): return models.ShippingMethodAddZoneAction(**data) +class ShippingMethodChangeActiveActionSchema(ShippingMethodUpdateActionSchema): + active = marshmallow.fields.Boolean(allow_none=True, load_default=None) + + class Meta: + unknown = marshmallow.EXCLUDE + + @marshmallow.post_load + def post_load(self, data, **kwargs): + del data["action"] + return models.ShippingMethodChangeActiveAction(**data) + + class ShippingMethodChangeIsDefaultActionSchema(ShippingMethodUpdateActionSchema): is_default = marshmallow.fields.Boolean( allow_none=True, load_default=None, data_key="isDefault" diff --git a/src/commercetools/platform/models/_schemas/shopping_list.py b/src/commercetools/platform/models/_schemas/shopping_list.py index dbeab80d..ab931c82 100644 --- a/src/commercetools/platform/models/_schemas/shopping_list.py +++ b/src/commercetools/platform/models/_schemas/shopping_list.py @@ -118,6 +118,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShoppingList(**data) @@ -199,6 +200,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShoppingListDraft(**data) @@ -265,6 +267,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShoppingListLineItem(**data) @@ -309,6 +312,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShoppingListLineItemDraft(**data) @@ -332,6 +336,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShoppingListPagedQueryResponse(**data) @@ -354,6 +359,7 @@ def post_load(self, data, **kwargs): class ShoppingListResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -450,6 +456,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ShoppingListUpdate(**data) @@ -498,6 +505,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TextLineItem(**data) @@ -538,6 +546,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TextLineItemDraft(**data) diff --git a/src/commercetools/platform/models/_schemas/staged_quote.py b/src/commercetools/platform/models/_schemas/staged_quote.py index 695f1d2f..0a763171 100644 --- a/src/commercetools/platform/models/_schemas/staged_quote.py +++ b/src/commercetools/platform/models/_schemas/staged_quote.py @@ -112,12 +112,20 @@ class StagedQuoteSchema(BaseResourceSchema): load_default=None, data_key="businessUnit", ) + store = helpers.LazyNestedField( + nested=helpers.absmod(__name__, ".store.StoreKeyReferenceSchema"), + allow_none=True, + unknown=marshmallow.EXCLUDE, + metadata={"omit_empty": True}, + load_default=None, + ) class Meta: unknown = marshmallow.EXCLUDE @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StagedQuote(**data) @@ -163,6 +171,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StagedQuoteDraft(**data) @@ -186,6 +195,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StagedQuotePagedQueryResponse(**data) @@ -208,6 +218,7 @@ def post_load(self, data, **kwargs): class StagedQuoteResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -253,6 +264,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StagedQuoteUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/standalone_price.py b/src/commercetools/platform/models/_schemas/standalone_price.py index f872fe9d..464a60e1 100644 --- a/src/commercetools/platform/models/_schemas/standalone_price.py +++ b/src/commercetools/platform/models/_schemas/standalone_price.py @@ -41,6 +41,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StagedPriceDraft(**data) @@ -71,6 +72,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StagedStandalonePrice(**data) @@ -174,6 +176,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StandalonePrice(**data) @@ -258,6 +261,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StandalonePriceDraft(**data) @@ -281,6 +285,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StandalonePricePagedQueryResponse(**data) @@ -303,6 +308,7 @@ def post_load(self, data, **kwargs): class StandalonePriceResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -372,6 +378,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StandalonePriceUpdate(**data) @@ -405,6 +412,7 @@ def post_load(self, data, **kwargs): class StandalonePriceApplyStagedChangesActionSchema(StandalonePriceUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -461,6 +469,7 @@ def post_load(self, data, **kwargs): class StandalonePriceRemoveStagedChangesActionSchema(StandalonePriceUpdateActionSchema): + class Meta: unknown = marshmallow.EXCLUDE diff --git a/src/commercetools/platform/models/_schemas/state.py b/src/commercetools/platform/models/_schemas/state.py index ff01a436..eab916ee 100644 --- a/src/commercetools/platform/models/_schemas/state.py +++ b/src/commercetools/platform/models/_schemas/state.py @@ -83,6 +83,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.State(**data) @@ -126,6 +127,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StateDraft(**data) @@ -149,6 +151,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StatePagedQueryResponse(**data) @@ -171,6 +174,7 @@ def post_load(self, data, **kwargs): class StateResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -215,6 +219,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StateUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/store.py b/src/commercetools/platform/models/_schemas/store.py index 9103c753..f32ad1e1 100644 --- a/src/commercetools/platform/models/_schemas/store.py +++ b/src/commercetools/platform/models/_schemas/store.py @@ -44,6 +44,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelectionSetting(**data) @@ -66,6 +67,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ProductSelectionSettingDraft(**data) @@ -140,6 +142,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Store(**data) @@ -205,10 +208,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StoreDraft(**data) class StoreKeyReferenceSchema(KeyReferenceSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -238,6 +243,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StorePagedQueryResponse(**data) @@ -260,6 +266,7 @@ def post_load(self, data, **kwargs): class StoreResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -334,6 +341,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StoreUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/store_country.py b/src/commercetools/platform/models/_schemas/store_country.py index a66c5f9f..c87cb957 100644 --- a/src/commercetools/platform/models/_schemas/store_country.py +++ b/src/commercetools/platform/models/_schemas/store_country.py @@ -26,4 +26,5 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.StoreCountry(**data) diff --git a/src/commercetools/platform/models/_schemas/subscription.py b/src/commercetools/platform/models/_schemas/subscription.py index f38b868a..8eb62d8a 100644 --- a/src/commercetools/platform/models/_schemas/subscription.py +++ b/src/commercetools/platform/models/_schemas/subscription.py @@ -41,6 +41,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ChangeSubscription(**data) @@ -83,6 +84,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CloudEventsPayload(**data) @@ -171,6 +173,9 @@ class DeliveryPayloadSchema(helpers.BaseSchema): "product-selection": helpers.absmod( __name__, ".product_selection.ProductSelectionReferenceSchema" ), + "product-tailoring": helpers.absmod( + __name__, ".product_tailoring.ProductTailoringReferenceSchema" + ), "product-type": helpers.absmod( __name__, ".product_type.ProductTypeReferenceSchema" ), @@ -381,6 +386,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.MessageSubscription(**data) @@ -395,10 +401,12 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.PayloadNotIncluded(**data) class PlatformFormatSchema(DeliveryFormatSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -604,6 +612,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Subscription(**data) @@ -664,6 +673,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SubscriptionDraft(**data) @@ -687,6 +697,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SubscriptionPagedQueryResponse(**data) @@ -718,6 +729,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SubscriptionUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/tax_category.py b/src/commercetools/platform/models/_schemas/tax_category.py index 2fa88220..2301fb92 100644 --- a/src/commercetools/platform/models/_schemas/tax_category.py +++ b/src/commercetools/platform/models/_schemas/tax_category.py @@ -29,6 +29,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.SubRate(**data) @@ -69,6 +70,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxCategory(**data) @@ -94,6 +96,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxCategoryDraft(**data) @@ -117,6 +120,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxCategoryPagedQueryResponse(**data) @@ -139,6 +143,7 @@ def post_load(self, data, **kwargs): class TaxCategoryResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -182,6 +187,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxCategoryUpdate(**data) @@ -228,6 +234,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxRate(**data) @@ -261,6 +268,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TaxRateDraft(**data) diff --git a/src/commercetools/platform/models/_schemas/type.py b/src/commercetools/platform/models/_schemas/type.py index 584798fd..4dd8d5b3 100644 --- a/src/commercetools/platform/models/_schemas/type.py +++ b/src/commercetools/platform/models/_schemas/type.py @@ -25,6 +25,7 @@ # Fields class FieldContainerField(marshmallow.fields.Dict): + def _deserialize(self, value, attr, data, **kwargs): result = super()._deserialize(value, attr, data) return models.FieldContainer(**result) @@ -40,6 +41,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomFieldEnumValue(**data) @@ -56,6 +58,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomFieldLocalizedEnumValue(**data) @@ -77,6 +80,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomFields(**data) @@ -99,6 +103,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.CustomFieldsDraft(**data) @@ -147,6 +152,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.FieldDefinition(**data) @@ -163,6 +169,7 @@ def post_load(self, data, **kwargs): class CustomFieldBooleanTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -173,6 +180,7 @@ def post_load(self, data, **kwargs): class CustomFieldDateTimeTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -183,6 +191,7 @@ def post_load(self, data, **kwargs): class CustomFieldDateTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -229,6 +238,7 @@ def post_load(self, data, **kwargs): class CustomFieldLocalizedStringTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -239,6 +249,7 @@ def post_load(self, data, **kwargs): class CustomFieldMoneyTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -249,6 +260,7 @@ def post_load(self, data, **kwargs): class CustomFieldNumberTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -312,6 +324,7 @@ def post_load(self, data, **kwargs): class CustomFieldStringTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -322,6 +335,7 @@ def post_load(self, data, **kwargs): class CustomFieldTimeTypeSchema(FieldTypeSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -380,6 +394,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Type(**data) @@ -417,6 +432,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TypeDraft(**data) @@ -440,6 +456,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TypePagedQueryResponse(**data) @@ -462,6 +479,7 @@ def post_load(self, data, **kwargs): class TypeResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -528,6 +546,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.TypeUpdate(**data) diff --git a/src/commercetools/platform/models/_schemas/zone.py b/src/commercetools/platform/models/_schemas/zone.py index 8a520d8e..5cb47c23 100644 --- a/src/commercetools/platform/models/_schemas/zone.py +++ b/src/commercetools/platform/models/_schemas/zone.py @@ -31,6 +31,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Location(**data) @@ -71,6 +72,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.Zone(**data) @@ -96,6 +98,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ZoneDraft(**data) @@ -119,6 +122,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ZonePagedQueryResponse(**data) @@ -141,6 +145,7 @@ def post_load(self, data, **kwargs): class ZoneResourceIdentifierSchema(ResourceIdentifierSchema): + class Meta: unknown = marshmallow.EXCLUDE @@ -177,6 +182,7 @@ class Meta: @marshmallow.post_load def post_load(self, data, **kwargs): + return models.ZoneUpdate(**data) diff --git a/src/commercetools/platform/models/api_client.py b/src/commercetools/platform/models/api_client.py index fc32a771..fb5ee590 100644 --- a/src/commercetools/platform/models/api_client.py +++ b/src/commercetools/platform/models/api_client.py @@ -28,7 +28,7 @@ class ApiClient(_BaseType): last_used_at: typing.Optional[datetime.date] #: If set, the Client will be deleted on (or shortly after) this point in time. delete_at: typing.Optional[datetime.datetime] - #: Date and time (UTC) the APIClient was initially created at. + #: Date and time (UTC) the APIClient was initially created. created_at: typing.Optional[datetime.datetime] #: Expiration time in seconds for each access token obtained by the APIClient. Only present when set with the [APIClientDraft](ctp:api:type:ApiClientDraft). If not present the default value applies. access_token_validity_seconds: typing.Optional[int] diff --git a/src/commercetools/platform/models/approval_flow.py b/src/commercetools/platform/models/approval_flow.py index 773a09c4..5526b3f5 100644 --- a/src/commercetools/platform/models/approval_flow.py +++ b/src/commercetools/platform/models/approval_flow.py @@ -17,6 +17,7 @@ from .business_unit import Associate, BusinessUnitKeyReference from .common import CreatedBy, LastModifiedBy from .order import OrderReference + from .type import CustomFields, FieldContainer, TypeResourceIdentifier __all__ = [ "ApprovalFlow", @@ -25,6 +26,8 @@ "ApprovalFlowPagedQueryResponse", "ApprovalFlowRejectAction", "ApprovalFlowRejection", + "ApprovalFlowSetCustomFieldAction", + "ApprovalFlowSetCustomTypeAction", "ApprovalFlowStatus", "ApprovalFlowUpdate", "ApprovalFlowUpdateAction", @@ -32,9 +35,9 @@ class ApprovalFlow(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the ApprovalFlow. created_by: typing.Optional["CreatedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the ApprovalFlow. last_modified_by: typing.Optional["LastModifiedBy"] #: [Order](ctp:api:type:Order) that needs to be approved. order: "OrderReference" @@ -55,6 +58,8 @@ class ApprovalFlow(BaseResource): pending_approvers: typing.List["RuleApprover"] #: Associate Roles required for approval based on the approver hierarchy tiers defined in `rules` only for the currently active tier(s). current_tier_pending_approvers: typing.List["RuleApprover"] + #: Custom Fields on the Approval Flow. + custom: typing.Optional["CustomFields"] def __init__( self, @@ -73,7 +78,8 @@ def __init__( approvals: typing.List["ApprovalFlowApproval"], eligible_approvers: typing.List["RuleApprover"], pending_approvers: typing.List["RuleApprover"], - current_tier_pending_approvers: typing.List["RuleApprover"] + current_tier_pending_approvers: typing.List["RuleApprover"], + custom: typing.Optional["CustomFields"] = None ): self.created_by = created_by self.last_modified_by = last_modified_by @@ -86,6 +92,7 @@ def __init__( self.eligible_approvers = eligible_approvers self.pending_approvers = pending_approvers self.current_tier_pending_approvers = current_tier_pending_approvers + self.custom = custom super().__init__( id=id, @@ -109,7 +116,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ApprovalFlowApproval(_BaseType): #: Associate who approved the [Approval Flow](ctp:api:type:ApprovalFlow). approver: "Associate" - #: Date and time (UTC) when the [Approval Flow](ctp:api:type:ApprovalFlow) was approved at. + #: Date and time (UTC) the [Approval Flow](ctp:api:type:ApprovalFlow) was approved. approved_at: datetime.datetime def __init__(self, *, approver: "Associate", approved_at: datetime.datetime): @@ -182,7 +189,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ApprovalFlowRejection(_BaseType): #: Associate who rejected the [Approval Flow](ctp:api:type:ApprovalFlow). rejecter: "Associate" - #: Date and time (UTC) when the [Approval Flow](ctp:api:type:ApprovalFlow) was rejected at. + #: Date and time (UTC) the [Approval Flow](ctp:api:type:ApprovalFlow) was rejected. rejected_at: datetime.datetime #: The reason for the rejection of the [Approval Flow](ctp:api:type:ApprovalFlow). reason: typing.Optional[str] @@ -222,7 +229,7 @@ class ApprovalFlowStatus(enum.Enum): class ApprovalFlowUpdate(_BaseType): #: Expected version of the [Approval Flow](ctp:api:type:ApprovalFlow) to which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the [Approval Flow](ctp:api:type:ApprovalFlow). actions: typing.List["ApprovalFlowUpdateAction"] @@ -267,6 +274,14 @@ def deserialize( from ._schemas.approval_flow import ApprovalFlowRejectActionSchema return ApprovalFlowRejectActionSchema().load(data) + if data["action"] == "setCustomField": + from ._schemas.approval_flow import ApprovalFlowSetCustomFieldActionSchema + + return ApprovalFlowSetCustomFieldActionSchema().load(data) + if data["action"] == "setCustomType": + from ._schemas.approval_flow import ApprovalFlowSetCustomTypeActionSchema + + return ApprovalFlowSetCustomTypeActionSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: from ._schemas.approval_flow import ApprovalFlowUpdateActionSchema @@ -282,6 +297,7 @@ class ApprovalFlowApproveAction(ApprovalFlowUpdateAction): """ def __init__(self): + super().__init__(action="approve") @classmethod @@ -327,3 +343,63 @@ def serialize(self) -> typing.Dict[str, typing.Any]: from ._schemas.approval_flow import ApprovalFlowRejectActionSchema return ApprovalFlowRejectActionSchema().dump(self) + + +class ApprovalFlowSetCustomFieldAction(ApprovalFlowUpdateAction): + #: Name of the [Custom Field](ctp:api:type:CustomFields). + name: str + #: If `value` is absent or `null`, this field will be removed if it exists. + #: Removing a field that does not exist returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. + #: If `value` is provided, it is set for the field defined by `name`. + value: typing.Optional[typing.Any] + + def __init__(self, *, name: str, value: typing.Optional[typing.Any] = None): + self.name = name + self.value = value + + super().__init__(action="setCustomField") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ApprovalFlowSetCustomFieldAction": + from ._schemas.approval_flow import ApprovalFlowSetCustomFieldActionSchema + + return ApprovalFlowSetCustomFieldActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.approval_flow import ApprovalFlowSetCustomFieldActionSchema + + return ApprovalFlowSetCustomFieldActionSchema().dump(self) + + +class ApprovalFlowSetCustomTypeAction(ApprovalFlowUpdateAction): + #: Defines the [Type](ctp:api:type:Type) that extends the ApprovalFlow with [Custom Fields](ctp:api:type:CustomFields). + #: If absent, any existing Type and Custom Fields are removed from the ApprovalFlow. + type: typing.Optional["TypeResourceIdentifier"] + #: Sets the [Custom Fields](ctp:api:type:CustomFields) fields for the ApprovalFlow. + fields: typing.Optional["FieldContainer"] + + def __init__( + self, + *, + type: typing.Optional["TypeResourceIdentifier"] = None, + fields: typing.Optional["FieldContainer"] = None + ): + self.type = type + self.fields = fields + + super().__init__(action="setCustomType") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ApprovalFlowSetCustomTypeAction": + from ._schemas.approval_flow import ApprovalFlowSetCustomTypeActionSchema + + return ApprovalFlowSetCustomTypeActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.approval_flow import ApprovalFlowSetCustomTypeActionSchema + + return ApprovalFlowSetCustomTypeActionSchema().dump(self) diff --git a/src/commercetools/platform/models/approval_rule.py b/src/commercetools/platform/models/approval_rule.py index bca7c664..d0592096 100644 --- a/src/commercetools/platform/models/approval_rule.py +++ b/src/commercetools/platform/models/approval_rule.py @@ -48,9 +48,9 @@ class ApprovalRule(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the ApprovalRule. created_by: typing.Optional["CreatedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the ApprovalRule. last_modified_by: typing.Optional["LastModifiedBy"] #: User-defined unique identifier of the Approval Rule. Must be unique within a [Business Unit](ctp:api:type:BusinessUnit). key: typing.Optional[str] @@ -224,7 +224,7 @@ class ApprovalRuleStatus(enum.Enum): class ApprovalRuleUpdate(_BaseType): #: Expected version of the [ApprovalRule](ctp:api:type:ApprovalRule) to which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the [ApprovalRule](ctp:api:type:ApprovalRule). actions: typing.List["ApprovalRuleUpdateAction"] diff --git a/src/commercetools/platform/models/associate_role.py b/src/commercetools/platform/models/associate_role.py index 59220e8d..cf5bd6d9 100644 --- a/src/commercetools/platform/models/associate_role.py +++ b/src/commercetools/platform/models/associate_role.py @@ -48,11 +48,11 @@ class AssociateRole(BaseResource): - #: Present on resources updated after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the AssociateRole. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the AssociateRole. created_by: typing.Optional["CreatedBy"] - #: User-defined unique identifier of the AssociateRole. + #: User-defined unique and immutable identifier of the AssociateRole. key: str #: Whether the AssociateRole can be assigned to an Associate by a [buyer](/../api/associates-overview#buyer). If false, the AssociateRole can only be assigned using the [general endpoint](/../api/associates-overview#through-the-general-endpoints). buyer_assignable: bool @@ -106,7 +106,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AssociateRoleDraft(_BaseType): - #: User-defined unique identifier for the AssociateRole. + #: User-defined unique and immutable identifier for the AssociateRole. key: str #: Name of the AssociateRole. name: typing.Optional[str] @@ -147,9 +147,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AssociateRoleKeyReference(KeyReference): - """[Reference](ctp:api:type:TypeReference) to an [AssociateRole](ctp:api:type:AssociateRole) by its key.""" + """[KeyReference](ctp:api:type:KeyReference) to an [AssociateRole](ctp:api:type:AssociateRole).""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceTypeId.ASSOCIATE_ROLE) @classmethod @@ -216,7 +217,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AssociateRoleReference(Reference): - """[Reference](ctp:api:type:TypeReference) to an [AssociateRole](ctp:api:type:AssociateRole).""" + """[Reference](ctp:api:type:Reference) to an [AssociateRole](ctp:api:type:AssociateRole).""" #: Contains the representation of the expanded AssociateRole. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for AssociateRole. obj: typing.Optional["AssociateRole"] @@ -246,6 +247,7 @@ class AssociateRoleResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.ASSOCIATE_ROLE) @classmethod @@ -264,7 +266,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AssociateRoleUpdate(_BaseType): #: Expected version of the AssociateRole on which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the AssociateRole. actions: typing.List["AssociateRoleUpdateAction"] diff --git a/src/commercetools/platform/models/attribute_group.py b/src/commercetools/platform/models/attribute_group.py index 20561ae9..0d2bedc6 100644 --- a/src/commercetools/platform/models/attribute_group.py +++ b/src/commercetools/platform/models/attribute_group.py @@ -34,9 +34,9 @@ class AttributeGroup(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the AttributeGroup. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the AttributeGroup. created_by: typing.Optional["CreatedBy"] #: Name of the AttributeGroup. name: "LocalizedString" @@ -175,7 +175,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeGroupReference(Reference): - """[Reference](/../api/types#reference) to an [AttributeGroup](ctp:api:type:AttributeGroup).""" + """[Reference](ctp:api:type:Reference) to an [AttributeGroup](ctp:api:type:AttributeGroup).""" #: Contains the representation of the expanded AttributeGroup. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for AttributeGroup. obj: typing.Optional["AttributeGroup"] @@ -200,11 +200,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeGroupResourceIdentifier(ResourceIdentifier): - """[ResourceIdentifier](/../api/types#resourceidentifier) to an [AttributeGroup](ctp:api:type:AttributeGroup). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/../api/errors#invalidjsoninput) error is returned.""" + """[ResourceIdentifier](ctp:api:type:ResourceIdentifier) to an [AttributeGroup](ctp:api:type:AttributeGroup). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/../api/errors#invalidjsoninput) error is returned.""" def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.ATTRIBUTE_GROUP) @classmethod @@ -222,7 +223,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeGroupUpdate(_BaseType): - #: Expected version of the AttributeGroup on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: Expected version of the AttributeGroup on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the AttributeGroup. actions: typing.List["AttributeGroupUpdateAction"] diff --git a/src/commercetools/platform/models/business_unit.py b/src/commercetools/platform/models/business_unit.py index 06518473..f7f92e03 100644 --- a/src/commercetools/platform/models/business_unit.py +++ b/src/commercetools/platform/models/business_unit.py @@ -46,8 +46,10 @@ "BusinessUnitAddBillingAddressIdAction", "BusinessUnitAddShippingAddressIdAction", "BusinessUnitAddStoreAction", + "BusinessUnitApprovalRuleMode", "BusinessUnitAssociateMode", "BusinessUnitChangeAddressAction", + "BusinessUnitChangeApprovalRuleModeAction", "BusinessUnitChangeAssociateAction", "BusinessUnitChangeAssociateModeAction", "BusinessUnitChangeNameAction", @@ -232,11 +234,11 @@ class AssociateRoleInheritanceMode(enum.Enum): class BusinessUnit(BaseResource): """Generic type to model the fields that all types of Business Units have in common.""" - #: Present on resources updated after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the BusinessUnit. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the BusinessUnit. created_by: typing.Optional["CreatedBy"] - #: User-defined unique identifier of the Business Unit. + #: User-defined unique and immutable identifier of the Business Unit. key: str #: Indicates whether the Business Unit can be edited and used in [Orders](/../api/projects/orders). status: "BusinessUnitStatus" @@ -270,12 +272,15 @@ class BusinessUnit(BaseResource): associate_mode: "BusinessUnitAssociateMode" #: Associates that are part of the Business Unit in specific [roles](ctp:api:type:AssociateRole). associates: typing.List["Associate"] - #: Associates that are inherited from a parent Business Unit. This value of this field is [eventually consistent](/../api/general-concepts#eventual-consistency) and is only present when the `associateMode` is set to `ExplicitAndFromParent`. + #: Associates that are inherited from a parent Business Unit. The value of this field is [eventually consistent](/../api/general-concepts#eventual-consistency) and is only present when the `associateMode` is set to `ExplicitAndFromParent`. inherited_associates: typing.Optional[typing.List["InheritedAssociate"]] #: Parent unit of the Business Unit. Only present when the `unitType` is `Division`. parent_unit: typing.Optional["BusinessUnitKeyReference"] #: Top-level unit of the Business Unit. The top-level unit is of `unitType` `Company`. top_level_unit: "BusinessUnitKeyReference" + #: Determines whether the Business Unit can inherit Approval Rules from a parent. + #: Always `Explicit` for [Companies](ctp:api:type:BusinessUnitType) and defaults to `ExplicitAndFromParent` for [Divisions](ctp:api:type:BusinessUnitType). + approval_rule_mode: "BusinessUnitApprovalRuleMode" def __init__( self, @@ -303,7 +308,8 @@ def __init__( associates: typing.List["Associate"], inherited_associates: typing.Optional[typing.List["InheritedAssociate"]] = None, parent_unit: typing.Optional["BusinessUnitKeyReference"] = None, - top_level_unit: "BusinessUnitKeyReference" + top_level_unit: "BusinessUnitKeyReference", + approval_rule_mode: "BusinessUnitApprovalRuleMode" ): self.last_modified_by = last_modified_by self.created_by = created_by @@ -325,6 +331,7 @@ def __init__( self.inherited_associates = inherited_associates self.parent_unit = parent_unit self.top_level_unit = top_level_unit + self.approval_rule_mode = approval_rule_mode super().__init__( id=id, @@ -350,6 +357,13 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return BusinessUnitSchema().dump(self) +class BusinessUnitApprovalRuleMode(enum.Enum): + """Determines whether a Business Unit can inherit [Approval Rules](/projects/approval-rules) from a parent. Only Business Units of type `Division` can use `ExplicitAndFromParent`.""" + + EXPLICIT = "Explicit" + EXPLICIT_AND_FROM_PARENT = "ExplicitAndFromParent" + + class BusinessUnitAssociateMode(enum.Enum): """Determines whether a Business Unit can inherit Associates from a parent.""" @@ -360,7 +374,7 @@ class BusinessUnitAssociateMode(enum.Enum): class BusinessUnitDraft(_BaseType): """Generic draft type to model those fields all Business Units have in common. The additional fields required for creating a [Company](ctp:api:type:Company) or [Division](ctp:api:type:Division) are represented on [CompanyDraft](ctp:api:type:CompanyDraft) and [DivisionDraft](ctp:api:type:DivisionDraft).""" - #: User-defined unique identifier for the Business Unit. + #: User-defined unique and immutable identifier for the Business Unit. key: str #: Indicates whether the Business Unit can be edited and used in [Orders](/../api/projects/orders). status: typing.Optional["BusinessUnitStatus"] @@ -385,6 +399,10 @@ class BusinessUnitDraft(_BaseType): associate_mode: typing.Optional["BusinessUnitAssociateMode"] #: List of members that are part of the Business Unit in specific [roles](ctp:api:type:AssociateRole). associates: typing.Optional[typing.List["AssociateDraft"]] + #: Determines whether the Business Unit can inherit Approval Rules from a parent. + #: For [Companies](ctp:api:type:BusinessUnitType), the value of this field is always `Explicit`. + #: For [Divisions](ctp:api:type:BusinessUnitType), the default value is `ExplicitAndFromParent`. + approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] #: Addresses used by the Business Unit. addresses: typing.Optional[typing.List["BaseAddress"]] #: Indexes of entries in `addresses` to set as shipping addresses. @@ -412,6 +430,7 @@ def __init__( contact_email: typing.Optional[str] = None, associate_mode: typing.Optional["BusinessUnitAssociateMode"] = None, associates: typing.Optional[typing.List["AssociateDraft"]] = None, + approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] = None, addresses: typing.Optional[typing.List["BaseAddress"]] = None, shipping_addresses: typing.Optional[typing.List["int"]] = None, default_shipping_address: typing.Optional[int] = None, @@ -428,6 +447,7 @@ def __init__( self.contact_email = contact_email self.associate_mode = associate_mode self.associates = associates + self.approval_rule_mode = approval_rule_mode self.addresses = addresses self.shipping_addresses = shipping_addresses self.default_shipping_address = default_shipping_address @@ -455,9 +475,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class BusinessUnitKeyReference(KeyReference): - """[Reference](/../api/types#reference) to a [BusinessUnit](ctp:api:type:BusinessUnit) by its key.""" + """[KeyReference](ctp:api:type:KeyReference) to a [BusinessUnit](ctp:api:type:BusinessUnit).""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceTypeId.BUSINESS_UNIT) @classmethod @@ -524,7 +545,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class BusinessUnitReference(Reference): - """[Reference](/../api/types#reference) to a [BusinessUnit](ctp:api:type:BusinessUnit).""" + """[Reference](ctp:api:type:Reference) to a [BusinessUnit](ctp:api:type:BusinessUnit).""" #: Contains the representation of the expanded BusinessUnit. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for BusinessUnit. obj: typing.Optional["BusinessUnit"] @@ -547,11 +568,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class BusinessUnitResourceIdentifier(ResourceIdentifier): - """[ResourceIdentifier](/../api/types#resourceidentifier) to a [BusinessUnit](ctp:api:type:BusinessUnit). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/../api/errors#invalidjsoninput) error is returned.""" + """[ResourceIdentifier](ctp:api:type:ResourceIdentifier) to a [BusinessUnit](ctp:api:type:BusinessUnit). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/../api/errors#invalidjsoninput) error is returned.""" def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.BUSINESS_UNIT) @classmethod @@ -591,7 +613,7 @@ class BusinessUnitType(enum.Enum): class BusinessUnitUpdate(_BaseType): #: Expected version of the BusinessUnit on which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the BusinessUnit. actions: typing.List["BusinessUnitUpdateAction"] @@ -656,6 +678,12 @@ def deserialize( from ._schemas.business_unit import BusinessUnitChangeAddressActionSchema return BusinessUnitChangeAddressActionSchema().load(data) + if data["action"] == "changeApprovalRuleMode": + from ._schemas.business_unit import ( + BusinessUnitChangeApprovalRuleModeActionSchema, + ) + + return BusinessUnitChangeApprovalRuleModeActionSchema().load(data) if data["action"] == "changeAssociate": from ._schemas.business_unit import BusinessUnitChangeAssociateActionSchema @@ -788,8 +816,10 @@ def __init__( associates: typing.List["Associate"], inherited_associates: typing.Optional[typing.List["InheritedAssociate"]] = None, parent_unit: typing.Optional["BusinessUnitKeyReference"] = None, - top_level_unit: "BusinessUnitKeyReference" + top_level_unit: "BusinessUnitKeyReference", + approval_rule_mode: "BusinessUnitApprovalRuleMode" ): + super().__init__( id=id, version=version, @@ -814,6 +844,7 @@ def __init__( inherited_associates=inherited_associates, parent_unit=parent_unit, top_level_unit=top_level_unit, + approval_rule_mode=approval_rule_mode, unit_type=BusinessUnitType.COMPANY, ) @@ -843,6 +874,7 @@ def __init__( contact_email: typing.Optional[str] = None, associate_mode: typing.Optional["BusinessUnitAssociateMode"] = None, associates: typing.Optional[typing.List["AssociateDraft"]] = None, + approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] = None, addresses: typing.Optional[typing.List["BaseAddress"]] = None, shipping_addresses: typing.Optional[typing.List["int"]] = None, default_shipping_address: typing.Optional[int] = None, @@ -850,6 +882,7 @@ def __init__( default_billing_address: typing.Optional[int] = None, custom: typing.Optional["CustomFieldsDraft"] = None ): + super().__init__( key=key, status=status, @@ -859,6 +892,7 @@ def __init__( contact_email=contact_email, associate_mode=associate_mode, associates=associates, + approval_rule_mode=approval_rule_mode, addresses=addresses, shipping_addresses=shipping_addresses, default_shipping_address=default_shipping_address, @@ -911,8 +945,10 @@ def __init__( associates: typing.List["Associate"], inherited_associates: typing.Optional[typing.List["InheritedAssociate"]] = None, parent_unit: "BusinessUnitKeyReference", - top_level_unit: "BusinessUnitKeyReference" + top_level_unit: "BusinessUnitKeyReference", + approval_rule_mode: "BusinessUnitApprovalRuleMode" ): + super().__init__( id=id, version=version, @@ -937,6 +973,7 @@ def __init__( inherited_associates=inherited_associates, parent_unit=parent_unit, top_level_unit=top_level_unit, + approval_rule_mode=approval_rule_mode, unit_type=BusinessUnitType.DIVISION, ) @@ -972,6 +1009,7 @@ def __init__( contact_email: typing.Optional[str] = None, associate_mode: typing.Optional["BusinessUnitAssociateMode"] = None, associates: typing.Optional[typing.List["AssociateDraft"]] = None, + approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] = None, addresses: typing.Optional[typing.List["BaseAddress"]] = None, shipping_addresses: typing.Optional[typing.List["int"]] = None, default_shipping_address: typing.Optional[int] = None, @@ -991,6 +1029,7 @@ def __init__( contact_email=contact_email, associate_mode=associate_mode, associates=associates, + approval_rule_mode=approval_rule_mode, addresses=addresses, shipping_addresses=shipping_addresses, default_shipping_address=default_shipping_address, @@ -1253,6 +1292,41 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return BusinessUnitChangeAddressActionSchema().dump(self) +class BusinessUnitChangeApprovalRuleModeAction(BusinessUnitUpdateAction): + """Updates [Approval Rules](/projects/approval-rules) inheritance behavior between Business Units. + + Only Business Units of type `Division` can be changed to `ExplicitAndFromParent`. + + This update action generates a [BusinessUnitApprovalRuleModeChanged](ctp:api:type:BusinessUnitApprovalRuleModeChangedMessage) Message. + + """ + + #: The new value for `approvalRuleMode`. + approval_rule_mode: "BusinessUnitApprovalRuleMode" + + def __init__(self, *, approval_rule_mode: "BusinessUnitApprovalRuleMode"): + self.approval_rule_mode = approval_rule_mode + + super().__init__(action="changeApprovalRuleMode") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "BusinessUnitChangeApprovalRuleModeAction": + from ._schemas.business_unit import ( + BusinessUnitChangeApprovalRuleModeActionSchema, + ) + + return BusinessUnitChangeApprovalRuleModeActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.business_unit import ( + BusinessUnitChangeApprovalRuleModeActionSchema, + ) + + return BusinessUnitChangeApprovalRuleModeActionSchema().dump(self) + + class BusinessUnitChangeAssociateAction(BusinessUnitUpdateAction): """Updating the [Associate](ctp:api:type:Associate) on a [Business Unit](ctp:api:type:BusinessUnit) generates the [BusinessUnitAssociateChanged](ctp:api:type:BusinessUnitAssociateChangedMessage) Message.""" @@ -1706,7 +1780,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class BusinessUnitSetCustomTypeAction(BusinessUnitUpdateAction): """Adding or updating a Custom Type on a Business Unit generates the [BusinessUnitCustomTypeSet](ctp:api:type:BusinessUnitCustomTypeSetMessage) Message, removing one generates the [BusinessUnitCustomTypeRemoved](ctp:api:type:BusinessUnitCustomTypeRemovedMessage) Message.""" - #: Defines the [Type](ctp:api:type:Type) that extends the BusinessUnit with [Custom Fields](/../api/projects/custom-fields). + #: Defines the [Type](ctp:api:type:Type) that extends the BusinessUnit with [Custom Fields](ctp:api:type:CustomFields). #: If absent, any existing Type and Custom Fields are removed from the BusinessUnit. type: typing.Optional["TypeResourceIdentifier"] #: Sets the [Custom Fields](/../api/projects/custom-fields) for the BusinessUnit. @@ -1857,11 +1931,9 @@ class BusinessUnitSetStoresAction(BusinessUnitUpdateAction): """ #: [Stores](ctp:api:type:Store) to set. Overrides the current list of Stores. - stores: typing.Optional[typing.List["StoreResourceIdentifier"]] + stores: typing.List["StoreResourceIdentifier"] - def __init__( - self, *, stores: typing.Optional[typing.List["StoreResourceIdentifier"]] = None - ): + def __init__(self, *, stores: typing.List["StoreResourceIdentifier"]): self.stores = stores super().__init__(action="setStores") diff --git a/src/commercetools/platform/models/cart.py b/src/commercetools/platform/models/cart.py index db8e56d3..c619de9c 100644 --- a/src/commercetools/platform/models/cart.py +++ b/src/commercetools/platform/models/cart.py @@ -18,6 +18,7 @@ CartDiscountReference, CartDiscountTarget, CartDiscountValue, + CartDiscountValueDraft, ) from .channel import ChannelReference, ChannelResourceIdentifier from .common import ( @@ -32,12 +33,14 @@ Reference, ReferenceTypeId, TypedMoney, + TypedMoneyDraft, ) from .customer_group import CustomerGroupReference, CustomerGroupResourceIdentifier from .discount_code import DiscountCodeReference from .order import Delivery, DeliveryDraft, ItemState, OrderReference, PaymentInfo from .payment import PaymentResourceIdentifier from .product import ProductVariant + from .product_tailoring import ProductTailoringUpdateAction from .product_type import ProductTypeReference from .shipping_method import ( ShippingMethodReference, @@ -153,6 +156,7 @@ "DiscountCodeState", "DiscountOnTotalPrice", "DiscountedLineItemPortion", + "DiscountedLineItemPortionDraft", "DiscountedLineItemPrice", "DiscountedLineItemPriceForQuantity", "DiscountedTotalPricePortion", @@ -171,6 +175,7 @@ "MethodTaxRate", "MethodTaxedPrice", "ProductPublishScope", + "ProductTailoringUpdate", "ReplicaCartDraft", "RoundingMode", "ScoreShippingRateInput", @@ -199,7 +204,7 @@ class Cart(BaseResource): customer_id: typing.Optional[str] #: Email address of the Customer that the Cart belongs to. customer_email: typing.Optional[str] - #: [Reference](ctp:api:type:Reference) to the Customer Group of the Customer that the Cart belongs to. Used for [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: [Reference](ctp:api:type:Reference) to the Customer Group of the Customer that the Cart belongs to. Used for [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). customer_group: typing.Optional["CustomerGroupReference"] #: [Anonymous session](ctp:api:type:AnonymousSession) associated with the Cart. anonymous_id: typing.Optional[str] @@ -218,8 +223,8 @@ class Cart(BaseResource): #: #: Taxes are included if [TaxRate](ctp:api:type:TaxRate) `includedInPrice` is `true` for each price. total_price: "CentPrecisionMoney" - #: - For a Cart with `Platform` [TaxMode](ctp:api:type:TaxMode), it is automatically set when a [shipping address is set](ctp:api:type:CartSetShippingAddressAction). - #: - For a Cart with `External` [TaxMode](ctp:api:type:TaxMode), it is automatically set when `shippingAddress` and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. + #: - For a Cart with `Platform` [TaxMode](ctp:api:type:TaxMode), it is automatically set when a [shipping address is set](ctp:api:type:CartSetShippingAddressAction). For Carts with `Multiple` [ShippingMode](ctp:api:type:ShippingMode), all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (via `shippingDetails`), otherwise `taxedPrice` is not automatically set. + #: - For a Cart with `External` [TaxMode](ctp:api:type:TaxMode), it is automatically set when `shippingAddress` and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts with `Multiple` [ShippingMode](ctp:api:type:ShippingMode), all allocations must have their respective tax rates present in `perMethodTaxRate`, otherwise `taxedPrice` is not automatically set. #: #: If a discount applies on `totalPrice`, this field holds the discounted values. taxed_price: typing.Optional["TaxedPrice"] @@ -270,7 +275,7 @@ class Cart(BaseResource): refused_gifts: typing.List["CartDiscountReference"] #: Payment information related to the Cart. payment_info: typing.Optional["PaymentInfo"] - #: Used for [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: Used for [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). country: typing.Optional[str] #: Languages of the Cart. Can only contain languages supported by the [Project](ctp:api:type:Project). locale: typing.Optional[str] @@ -280,9 +285,9 @@ class Cart(BaseResource): custom: typing.Optional["CustomFields"] #: Number of days after which an active Cart is deleted since its last modification. Configured in [Project settings](ctp:api:type:CartsConfiguration). delete_days_after_last_modification: typing.Optional[int] - #: Present on resources updated after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Cart. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Cart. created_by: typing.Optional["CreatedBy"] def __init__( @@ -400,7 +405,7 @@ class CartDraft(_BaseType): customer_id: typing.Optional[str] #: Email address of the Customer that the Cart belongs to. customer_email: typing.Optional[str] - #: [ResourceIdentifier](ctp:api:type:ResourceIdentifier) to the Customer Group of the Customer that the Cart belongs to. Used for [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: [ResourceIdentifier](ctp:api:type:ResourceIdentifier) to the Customer Group of the Customer that the Cart belongs to. Used for [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). #: #: It is automatically set if the Customer referenced in `customerId` belongs to a Customer Group. #: It can also be set explicitly when no `customerId` is present. @@ -428,6 +433,7 @@ class CartDraft(_BaseType): #: Billing address associated with the Cart. billing_address: typing.Optional["BaseAddress"] #: Shipping address for a Cart with `Single` [ShippingMode](ctp:api:type:ShippingMode). Determines eligible [ShippingMethod](ctp:api:type:ShippingMethod) rates and Tax Rates of Line Items. + #: Must be one of the `itemShippingAddresses` when that field is also provided. shipping_address: typing.Optional["BaseAddress"] #: Shipping Method for a Cart with `Single` [ShippingMode](ctp:api:type:ShippingMode). If the referenced [ShippingMethod](ctp:api:type:ShippingMethod) has a `predicate` that does not match the Cart, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned when [creating a Cart](ctp:api:endpoint:/{projectKey}/carts:POST). shipping_method: typing.Optional["ShippingMethodResourceIdentifier"] @@ -452,7 +458,7 @@ class CartDraft(_BaseType): item_shipping_addresses: typing.Optional[typing.List["BaseAddress"]] #: `code` of the existing [DiscountCodes](ctp:api:type:DiscountCode) to add to the Cart. discount_codes: typing.Optional[typing.List["str"]] - #: Used for [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: Used for [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). #: If used for [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/carts:POST), the provided country must be one of the [Store's](ctp:api:type:Store) `countries`. country: typing.Optional[str] #: Languages of the Cart. Can only contain languages supported by the [Project](ctp:api:type:Project). @@ -634,6 +640,7 @@ class CartResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.CART) @classmethod @@ -661,7 +668,7 @@ class CartState(enum.Enum): class CartUpdate(_BaseType): #: Expected version of the Cart on which the changes apply. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) is returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Cart. actions: typing.List["CartUpdateAction"] @@ -1009,7 +1016,8 @@ class CustomLineItem(_BaseType): money: "TypedMoney" #: Automatically set after the `taxRate` is set. taxed_price: typing.Optional["TaxedItemPrice"] - #: Taxed price of the Shipping Method that is automatically set after `perMethodTaxRate` is set. + #: Total taxed prices based on the quantity of the Custom Line Item assigned to each [Shipping Method](ctp:api:type:ShippingMethod). Only applicable for Carts with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Automatically set after `perMethodTaxRate` is set. taxed_price_portions: typing.List["MethodTaxedPrice"] #: Total price of the Custom Line Item (`money` multiplied by `quantity`). #: If the Custom Line Item is discounted, the total price is `discountedPricePerQuantity` multiplied by `quantity`. @@ -1120,7 +1128,7 @@ class CustomLineItemDraft(_BaseType): #: - If `Standard`, Cart Discounts with a matching [CartDiscountCustomLineItemsTarget](ctp:api:type:CartDiscountCustomLineItemsTarget) #: are applied to the Custom Line Item. #: - If `External`, Cart Discounts are not considered on the Custom Line Item. - price_mode: "CustomLineItemPriceMode" + price_mode: typing.Optional["CustomLineItemPriceMode"] def __init__( self, @@ -1134,7 +1142,7 @@ def __init__( external_tax_rate: typing.Optional["ExternalTaxRateDraft"] = None, custom: typing.Optional["CustomFieldsDraft"] = None, shipping_details: typing.Optional["ItemShippingDetailsDraft"] = None, - price_mode: "CustomLineItemPriceMode" + price_mode: typing.Optional["CustomLineItemPriceMode"] = None ): self.name = name self.key = key @@ -1270,16 +1278,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class DirectDiscountDraft(_BaseType): """Represents a [CartDiscount](ctp:api:type:CartDiscount) that can only be associated with a single Cart or Order. - Direct Discounts are always active and valid, and have the default `Stacking` [StackingMode](ctp:api:type:StackingMode). - They apply in the order in which they are listed in the `directDiscounts` array of [Carts](ctp:api:type:Cart) or [Orders](ctp:api:type:Order), and do not have a sorting order like Cart Discounts. - - If a Direct Discount is present, any matching Cart Discounts in the Project are ignored. - Additionally, a Cart or Order supports either Discount Codes or Direct Discounts at the same time. + For an introduction to Direct Discounts and to understand how they work in Composable Commerce, see the [Direct Discounts overview](/pricing-and-discounts-overview#direct-discounts). """ #: Defines the effect the Discount will have. - value: "CartDiscountValue" + value: "CartDiscountValueDraft" #: Defines what segment of the Cart will be discounted. #: #: If `value` is set to `giftLineItem`, this must not be set. @@ -1288,7 +1292,7 @@ class DirectDiscountDraft(_BaseType): def __init__( self, *, - value: "CartDiscountValue", + value: "CartDiscountValueDraft", target: typing.Optional["CartDiscountTarget"] = None ): self.value = value @@ -1312,6 +1316,7 @@ class DirectDiscountReference(Reference): """[Reference](ctp:api:type:Reference) to a [DirectDiscount](ctp:api:type:DirectDiscount).""" def __init__(self, *, id: str): + super().__init__(id=id, type_id=ReferenceTypeId.DIRECT_DISCOUNT) @classmethod @@ -1409,9 +1414,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class DiscountedLineItemPortion(_BaseType): - #: A [CartDiscountReference](ctp:api:type:CartDiscountReference) or [DirectDiscountReference](ctp:api:type:DirectDiscountReference) for the applicable discount on the Line Item. + #: A [CartDiscountReference](ctp:api:type:CartDiscountReference) or [DirectDiscountReference](ctp:api:type:DirectDiscountReference) of the applicable discount on the Line Item. discount: "Reference" - #: Money value of the discount applicable. + #: Money value of the applicable discount. discounted_amount: "TypedMoney" def __init__(self, *, discount: "Reference", discounted_amount: "TypedMoney"): @@ -1434,6 +1439,32 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return DiscountedLineItemPortionSchema().dump(self) +class DiscountedLineItemPortionDraft(_BaseType): + #: A [CartDiscountReference](ctp:api:type:CartDiscountReference) or [DirectDiscountReference](ctp:api:type:DirectDiscountReference) for the discount applicable on the Line Item. + discount: "Reference" + #: Money value for the discount applicable. + discounted_amount: "TypedMoneyDraft" + + def __init__(self, *, discount: "Reference", discounted_amount: "TypedMoneyDraft"): + self.discount = discount + self.discounted_amount = discounted_amount + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountedLineItemPortionDraft": + from ._schemas.cart import DiscountedLineItemPortionDraftSchema + + return DiscountedLineItemPortionDraftSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.cart import DiscountedLineItemPortionDraftSchema + + return DiscountedLineItemPortionDraftSchema().dump(self) + + class DiscountedLineItemPrice(_BaseType): #: Money value of the discounted Line Item or Custom Line Item. value: "TypedMoney" @@ -1597,7 +1628,8 @@ class ExternalTaxRateDraft(_BaseType): country: str #: State within the specified country. state: typing.Optional[str] - #: For countries (such as the US) where the total tax is a combination of multiple taxes (such as state and local taxes). + #: Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate `amount`. + #: These subrates are used to calculate the `taxPortions` field of a [Cart](ctp:api:type:Cart) or [Order](ctp:api:type:Order) and the `taxedPrice` field of [LineItems](ctp:api:type:LineItem), [CustomLineItems](ctp:api:type:CustomLineItem), and [ShippingInfos](ctp:api:type:ShippingInfo). sub_rates: typing.Optional[typing.List["SubRate"]] def __init__( @@ -1709,7 +1741,7 @@ class ItemShippingTarget(_BaseType): quantity: int #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). #: - #: It connects Line Item quantities with individual shipping addresses. + #: It connects Line Item or Custom Line Item quantities with individual Shipping Methods. shipping_method_key: typing.Optional[str] def __init__( @@ -1778,7 +1810,8 @@ class LineItem(_BaseType): discounted_price_per_quantity: typing.List["DiscountedLineItemPriceForQuantity"] #: Automatically set after `taxRate` is set. taxed_price: typing.Optional["TaxedItemPrice"] - #: Taxed price of the Shipping Method that is automatically set after `perMethodTaxRate` is set. + #: Total taxed prices based on the quantity of Line Item assigned to each [Shipping Method](ctp:api:type:ShippingMethod). Only applicable for Carts with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Automatically set after `perMethodTaxRate` is set. taxed_price_portions: typing.List["MethodTaxedPrice"] #: State of the Line Item in the [Cart](ctp:api:type:Cart) or the [Order](ctp:api:type:Order). state: typing.List["ItemState"] @@ -1790,7 +1823,7 @@ class LineItem(_BaseType): per_method_tax_rate: typing.List["MethodTaxRate"] #: Identifies [Inventory entries](/../api/projects/inventory) that are reserved. The referenced Channel has the `InventorySupply` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). supply_channel: typing.Optional["ChannelReference"] - #: Used to [select](ctp:api:type:LineItemPriceSelection) a Product Price. The referenced Channel has the `ProductDistribution` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). + #: Used to [select](/../api/pricing-and-discounts-overview#line-item-price-selection) a Product Price. The referenced Channel has the `ProductDistribution` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). distribution_channel: typing.Optional["ChannelReference"] #: Indicates how the Price for the Line Item is set. price_mode: "LineItemPriceMode" @@ -1900,7 +1933,7 @@ class LineItemDraft(_BaseType): #: #: Optional for backwards compatibility reasons. added_at: typing.Optional[datetime.datetime] - #: Used to [select](ctp:api:type:LineItemPriceSelection) a Product Price. + #: Used to [select](/../api/pricing-and-discounts-overview#line-item-price-selection) a Product Price. #: The referenced Channel must have the `ProductDistribution` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). #: #: If the Cart is bound to a [Store](ctp:api:type:Store) with `distributionChannels` set, @@ -1913,7 +1946,7 @@ class LineItemDraft(_BaseType): external_price: typing.Optional["Money"] #: Sets the [LineItem](ctp:api:type:LineItem) `price` and `totalPrice` values, and the `priceMode` to `ExternalTotal` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). external_total_price: typing.Optional["ExternalLineItemTotalPrice"] - #: Sets the external Tax Rate for the Line Item, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode). + #: Sets the external Tax Rate for the Line Item, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode) and `Single` [ShippingMode](ctp:api:type:ShippingMode). If the Cart has `Multiple` [ShippingMode](ctp:api:type:ShippingMode), the Tax Rate is accepted but ignored. external_tax_rate: typing.Optional["ExternalTaxRateDraft"] #: Sets the external Tax Rates for individual Shipping Methods, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode) and `Multiple` [ShippingMode](ctp:api:type:ShippingMode). per_method_external_tax_rate: typing.Optional[ @@ -1979,7 +2012,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class LineItemMode(enum.Enum): - """Indicates how a Line Item is added to a Cart.""" + """Indicates how a Line Item was added to a Cart.""" STANDARD = "Standard" GIFT_LINE_ITEM = "GiftLineItem" @@ -2051,9 +2084,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MethodTaxedPrice(_BaseType): - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: User-defined unique identifier of the [Shipping Method](ctp:api:type:ShippingMethod) in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). shipping_method_key: str - #: Taxed price for the Shipping Method. + #: Total taxed price based on the quantity of the Line Item or Custom Line Item assigned to the Shipping Method identified by `shippingMethodKey`. taxed_price: typing.Optional["TaxedItemPrice"] def __init__( @@ -2080,7 +2113,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ReplicaCartDraft(_BaseType): - """Used for [replicating an existing Cart](/../api/projects/carts#replicate-cart) or Order.""" + """Used for [replicating an existing Cart](ctp:api:endpoint:/{projectKey}/carts/replicate:POST) or Order.""" #: [Reference](ctp:api:type:Reference) to a [Cart](ctp:api:type:Cart) or [Order](ctp:api:type:Order) that is replicated. reference: typing.Union["CartReference", "OrderReference"] @@ -2284,7 +2317,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShippingMethodState(enum.Enum): - """Determines whether a [ShippingMethod](ctp:api:type:ShippingMethod) is allowed for a Cart.""" + """Determines whether the selected [ShippingMethod](ctp:api:type:ShippingMethod) is allowed for the Cart. For more information, see [Predicates](/shipping-delivery-overview#predicates).""" DOES_NOT_MATCH_CART = "DoesNotMatchCart" MATCHES_CART = "MatchesCart" @@ -2541,6 +2574,10 @@ class TaxedItemPrice(_BaseType): total_net: "CentPrecisionMoney" #: Total gross amount of the Line Item or Custom Line Item. total_gross: "CentPrecisionMoney" + #: Taxable portions added to the total net price. + #: + #: Calculated from the [TaxRates](ctp:api:type:TaxRate). + tax_portions: typing.List["TaxPortion"] #: Total tax applicable for the Line Item or Custom Line Item. #: Automatically calculated as the difference between the `totalGross` and `totalNet` values. total_tax: typing.Optional["CentPrecisionMoney"] @@ -2550,10 +2587,12 @@ def __init__( *, total_net: "CentPrecisionMoney", total_gross: "CentPrecisionMoney", + tax_portions: typing.List["TaxPortion"], total_tax: typing.Optional["CentPrecisionMoney"] = None ): self.total_net = total_net self.total_gross = total_gross + self.tax_portions = tax_portions self.total_tax = total_tax super().__init__() @@ -2620,17 +2659,21 @@ class TaxedPriceDraft(_BaseType): #: #: Calculated from the [TaxRates](ctp:api:type:TaxRate). tax_portions: typing.List["TaxPortionDraft"] + #: Total tax applicable for the Cart or Order. + total_tax: typing.Optional["TypedMoneyDraft"] def __init__( self, *, total_net: "Money", total_gross: "Money", - tax_portions: typing.List["TaxPortionDraft"] + tax_portions: typing.List["TaxPortionDraft"], + total_tax: typing.Optional["TypedMoneyDraft"] = None ): self.total_net = total_net self.total_gross = total_gross self.tax_portions = tax_portions + self.total_tax = total_tax super().__init__() @@ -2860,7 +2903,7 @@ class CartAddLineItemAction(CartUpdateAction): """If the Cart contains a [LineItem](ctp:api:type:LineItem) for a Product Variant with the same [LineItemMode](ctp:api:type:LineItemMode), [Custom Fields](/../api/projects/custom-fields), supply and distribution channel, then only the quantity of the existing Line Item is increased. If [LineItem](ctp:api:type:LineItem) `shippingDetails` is set, it is merged. All addresses will be present afterwards and, for address keys present in both shipping details, the quantity will be summed up. A new Line Item is added when the `externalPrice` or `externalTotalPrice` is set in this update action. - The [LineItem](ctp:api:type:LineItem) price is set as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + The [LineItem](ctp:api:type:LineItem) price is set as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). If the Tax Rate is not set, a [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) error is returned. @@ -2890,7 +2933,7 @@ class CartAddLineItemAction(CartUpdateAction): #: #: Optional for backwards compatibility reasons. added_at: typing.Optional[datetime.datetime] - #: Used to [select](ctp:api:type:LineItemPriceSelection) a Product Price. + #: Used to [select](/../api/pricing-and-discounts-overview#line-item-price-selection) a Product Price. #: The Channel must have the `ProductDistribution` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). #: If the Cart is bound to a [Store](ctp:api:type:Store) with `distributionChannels` set, the Channel must match one of the Store's distribution channels. distribution_channel: typing.Optional["ChannelResourceIdentifier"] @@ -2901,8 +2944,12 @@ class CartAddLineItemAction(CartUpdateAction): external_price: typing.Optional["Money"] #: Sets the [LineItem](ctp:api:type:LineItem) `price` and `totalPrice` values, and the `priceMode` to `ExternalTotal` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). external_total_price: typing.Optional["ExternalLineItemTotalPrice"] - #: External Tax Rate for the Line Item, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode). + #: Sets the external Tax Rate for the Line Item, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode) and `Single` [ShippingMode](ctp:api:type:ShippingMode). If the Cart has `Multiple` [ShippingMode](ctp:api:type:ShippingMode), the Tax Rate is accepted but ignored. external_tax_rate: typing.Optional["ExternalTaxRateDraft"] + #: Sets the external Tax Rates for individual Shipping Methods, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode) and `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + per_method_external_tax_rate: typing.Optional[ + typing.List["MethodExternalTaxRateDraft"] + ] #: Inventory mode specific to the Line Item only, and valid for the entire `quantity` of the Line Item. #: Set only if the inventory mode should be different from the `inventoryMode` specified on the [Cart](ctp:api:type:Cart). inventory_mode: typing.Optional["InventoryMode"] @@ -2925,6 +2972,9 @@ def __init__( external_price: typing.Optional["Money"] = None, external_total_price: typing.Optional["ExternalLineItemTotalPrice"] = None, external_tax_rate: typing.Optional["ExternalTaxRateDraft"] = None, + per_method_external_tax_rate: typing.Optional[ + typing.List["MethodExternalTaxRateDraft"] + ] = None, inventory_mode: typing.Optional["InventoryMode"] = None, shipping_details: typing.Optional["ItemShippingDetailsDraft"] = None, custom: typing.Optional["CustomFieldsDraft"] = None @@ -2940,6 +2990,7 @@ def __init__( self.external_price = external_price self.external_total_price = external_total_price self.external_tax_rate = external_tax_rate + self.per_method_external_tax_rate = per_method_external_tax_rate self.inventory_mode = inventory_mode self.shipping_details = shipping_details self.custom = custom @@ -3291,7 +3342,7 @@ class CartChangeLineItemQuantityAction(CartUpdateAction): use this update action in combination with the [Set LineItem ShippingDetails](ctp:api:type:CartSetLineItemShippingDetailsAction) update action in a single Cart update command. - The [LineItem](ctp:api:type:LineItem) price is set as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + The [LineItem](ctp:api:type:LineItem) price is set as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). """ @@ -3303,11 +3354,13 @@ class CartChangeLineItemQuantityAction(CartUpdateAction): #: #: If `0`, the Line Item is removed from the Cart. quantity: int - #: Sets the [LineItem](ctp:api:type:LineItem) `price` to the given value when changing the quantity of a Line Item with the `ExternalPrice` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). + #: Required when the Line Item uses `ExternalPrice` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). + #: Sets the [LineItem](ctp:api:type:LineItem) `price` to the given value when changing the quantity of a Line Item. #: - #: The LineItem price is updated as described in LineItem Price selection. + #: The LineItem price is updated as described in Line Item price selection. external_price: typing.Optional["Money"] #: Sets the [LineItem](ctp:api:type:LineItem) `price` and `totalPrice` to the given value when changing the quantity of a Line Item with the `ExternalTotal` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). + #: If `externalTotalPrice` is not given and the `priceMode` is `ExternalTotal`, the external price is unset and the `priceMode` is set to `Platform`. external_total_price: typing.Optional["ExternalLineItemTotalPrice"] def __init__( @@ -3421,11 +3474,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartFreezeCartAction(CartUpdateAction): """Changes the [CartState](ctp:api:type:CartState) from `Active` to `Frozen`. Results in a [Frozen Cart](ctp:api:type:FrozenCarts). - Fails with [InvalidOperation](ctp:api:type:InvalidOperation) error when the Cart is empty. + Fails with [InvalidOperation](ctp:api:type:InvalidOperationError) error when the Cart is empty. """ def __init__(self): + super().__init__(action="freezeCart") @classmethod @@ -3557,7 +3611,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartRemoveLineItemAction(CartUpdateAction): - """The [LineItem](ctp:api:type:LineItem) price is updated as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection).""" + """The [LineItem](ctp:api:type:LineItem) price is updated as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection).""" #: `id` of the [LineItem](ctp:api:type:LineItem) to update. Either `lineItemId` or `lineItemKey` is required. line_item_id: typing.Optional[str] @@ -3655,6 +3709,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartSetAnonymousIdAction(CartUpdateAction): + """If the Cart is already associated with a Customer, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned.""" + #: Value to set. #: If empty, any existing value is removed. anonymous_id: typing.Optional[str] @@ -3788,7 +3844,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartSetCartTotalTaxAction(CartUpdateAction): - """This update action results in the `taxedPrice` field being added to the Cart when the `ExternalAmount` [TaxMode](ctp:api:type:TaxMode) is used.""" + """Can be used if the Cart has the `ExternalAmount` [TaxMode](ctp:api:type:TaxMode). This update action adds the `taxedPrice` field to the Cart and must be used after any price-affecting change occurs within the Cart.""" #: The Cart's total gross price becoming the `totalGross` field (`totalNet` + taxes) on the Cart's `taxedPrice`. external_total_gross: "Money" @@ -4183,10 +4239,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartSetCustomerGroupAction(CartUpdateAction): - """This update action can only be used if a Customer is not assigned to a Cart. - If a Customer is already assigned, the Cart has the same Customer Group as the assigned Customer. + """This update action can only be used if a Customer is not assigned to the Cart. + If a Customer is already assigned, the Cart uses the Customer Group of the assigned Customer. - Setting the Customer Group also updates the [LineItem](ctp:api:type:LineItem) `prices` according to the Customer Group. + To reflect the new Customer Group, this update action can result in [updates to the Cart](/api/carts-orders-overview#cart-updates). When this occurs, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). """ @@ -4482,7 +4538,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartSetLineItemDistributionChannelAction(CartUpdateAction): - """Setting a distribution channel for a [LineItem](ctp:api:type:LineItem) can lead to an updated `price` as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection).""" + """Setting a distribution channel for a [LineItem](ctp:api:type:LineItem) can lead to an updated `price` as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection).""" #: `id` of the [LineItem](ctp:api:type:LineItem) to update. Either `lineItemId` or `lineItemKey` is required. line_item_id: typing.Optional[str] @@ -4670,7 +4726,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartSetLineItemTaxAmountAction(CartUpdateAction): - """Can be used if the Cart has the `ExternalAmount` [TaxMode](ctp:api:type:TaxMode).""" + """Can be used if the Cart has the `ExternalAmount` [TaxMode](ctp:api:type:TaxMode). This update action sets the `taxedPrice` and `taxRate` on a Line Item and must be used after any price-affecting change occurs.""" #: `id` of the [LineItem](ctp:api:type:LineItem) to update. Either `lineItemId` or `lineItemKey` is required. line_item_id: typing.Optional[str] @@ -4819,7 +4875,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartSetShippingAddressAction(CartUpdateAction): """Setting the shipping address also sets the [TaxRate](ctp:api:type:TaxRate) of Line Items and calculates the [TaxedPrice](ctp:api:type:TaxedPrice). - If a matching price cannot be found for the given shipping address during [Line Item Price selection](ctp:api:type:LineItemPriceSelection), + If a matching price cannot be found for the given shipping address during [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection), a [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) error is returned. If you want to allow shipping to states inside a country that are not explicitly covered by a TaxRate, @@ -5135,6 +5191,7 @@ class CartUnfreezeCartAction(CartUpdateAction): """ def __init__(self): + super().__init__(action="unfreezeCart") @classmethod @@ -5176,6 +5233,35 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return CartUpdateItemShippingAddressActionSchema().dump(self) +class ProductTailoringUpdate(_BaseType): + #: Expected version of the ProductTailoring on which the changes apply. + #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) is returned. + version: int + #: Update actions to be performed on the ProductTailoring. + actions: typing.List["ProductTailoringUpdateAction"] + + def __init__( + self, *, version: int, actions: typing.List["ProductTailoringUpdateAction"] + ): + self.version = version + self.actions = actions + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringUpdate": + from ._schemas.cart import ProductTailoringUpdateSchema + + return ProductTailoringUpdateSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.cart import ProductTailoringUpdateSchema + + return ProductTailoringUpdateSchema().dump(self) + + class ProductPublishScope(enum.Enum): """The scope controls which part of the product information is published.""" diff --git a/src/commercetools/platform/models/cart_discount.py b/src/commercetools/platform/models/cart_discount.py index 2414f361..8d63baba 100644 --- a/src/commercetools/platform/models/cart_discount.py +++ b/src/commercetools/platform/models/cart_discount.py @@ -83,9 +83,9 @@ class CartDiscount(BaseResource): - #: Present on resources updated after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the CartDiscount. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the CartDiscount. created_by: typing.Optional["CreatedBy"] #: Name of the CartDiscount. name: "LocalizedString" @@ -352,6 +352,7 @@ class CartDiscountResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.CART_DISCOUNT) @classmethod @@ -463,6 +464,7 @@ class CartDiscountShippingCostTarget(CartDiscountTarget): """Discount is applied to the shipping costs of the [Cart](ctp:api:type:Cart).""" def __init__(self): + super().__init__(type="shipping") @classmethod @@ -483,6 +485,7 @@ class CartDiscountTotalPriceTarget(CartDiscountTarget): """Discount is applied to the total price of the [Cart](ctp:api:type:Cart).""" def __init__(self): + super().__init__(type="totalPrice") @classmethod @@ -500,7 +503,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartDiscountUpdate(_BaseType): - #: Expected version of the CartDiscount on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the CartDiscount on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the CartDiscount. actions: typing.List["CartDiscountUpdateAction"] @@ -798,6 +802,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartDiscountValueGiftLineItem(CartDiscountValue): #: Reference to a Product. + #: + #: A Gift Line Item can be present on a Cart even if the referenced Product is unpublished. product: "ProductReference" #: [ProductVariant](ctp:api:type:ProductVariant) of the Product. variant_id: int @@ -842,6 +848,8 @@ class CartDiscountValueGiftLineItemDraft(CartDiscountValueDraft): """ #: ResourceIdentifier of a Product. + #: + #: A Gift Line Item is added to a Cart even if the referenced Product is unpublished. product: "ProductResourceIdentifier" #: [ProductVariant](ctp:api:type:ProductVariant) of the Product. variant_id: int @@ -1034,7 +1042,11 @@ class StackingMode(enum.Enum): class CartDiscountAddStoreAction(CartDiscountUpdateAction): - """If a referenced Store does not exist, a [ReferencedResourceNotFound](ctp:api:type:ReferencedResourceNotFoundError) error is returned.""" + """If a referenced Store does not exist, a [ReferencedResourceNotFound](ctp:api:type:ReferencedResourceNotFoundError) error is returned. + + This action generates a [CartDiscountStoreAdded](ctp:api:type:CartDiscountStoreAddedMessage) Message. + + """ #: [Store](ctp:api:type:Store) to add. #: @@ -1263,7 +1275,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartDiscountRemoveStoreAction(CartDiscountUpdateAction): - """If a referenced Store does not exist, a [ReferencedResourceNotFound](ctp:api:type:ReferencedResourceNotFoundError) error is returned.""" + """If a referenced Store does not exist, a [ReferencedResourceNotFound](ctp:api:type:ReferencedResourceNotFoundError) error is returned. + + This action generates a [CartDiscountStoreRemoved](ctp:api:type:CartDiscountStoreRemovedMessage) Message. + + """ #: [Store](ctp:api:type:Store) to remove. store: "StoreResourceIdentifier" @@ -1394,7 +1410,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartDiscountSetStoresAction(CartDiscountUpdateAction): - """If a referenced Store does not exist, a [ReferencedResourceNotFound](ctp:api:type:ReferencedResourceNotFoundError) error is returned.""" + """If a referenced Store does not exist, a [ReferencedResourceNotFound](ctp:api:type:ReferencedResourceNotFoundError) error is returned. + + This action generates a [CartDiscountStoresSet](ctp:api:type:CartDiscountStoresSetMessage) Message. + + """ #: [Stores](ctp:api:type:Store) to set. #: Overrides the current list of Stores. @@ -1404,11 +1424,9 @@ class CartDiscountSetStoresAction(CartDiscountUpdateAction): #: #: - If the referenced Stores exceed the [limit](/../api/limits#cart-discounts-stores), a [MaxStoreReferencesReached](ctp:api:type:MaxStoreReferencesReachedError) error is returned. #: - If the referenced Stores exceed the [limit](/../api/limits#cart-discounts) for Cart Discounts that do not require a Discount Code, a [StoreCartDiscountsLimitReached](ctp:api:type:StoreCartDiscountsLimitReachedError) error is returned. - stores: typing.Optional[typing.List["StoreResourceIdentifier"]] + stores: typing.List["StoreResourceIdentifier"] - def __init__( - self, *, stores: typing.Optional[typing.List["StoreResourceIdentifier"]] = None - ): + def __init__(self, *, stores: typing.List["StoreResourceIdentifier"]): self.stores = stores super().__init__(action="setStores") diff --git a/src/commercetools/platform/models/category.py b/src/commercetools/platform/models/category.py index cf66665e..3479e65e 100644 --- a/src/commercetools/platform/models/category.py +++ b/src/commercetools/platform/models/category.py @@ -63,9 +63,9 @@ class Category(BaseResource): - #: Present on resources updated after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Category. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Category. created_by: typing.Optional["CreatedBy"] #: Name of the Category. name: "LocalizedString" @@ -80,9 +80,9 @@ class Category(BaseResource): ancestors: typing.List["CategoryReference"] #: Parent Category of this Category. parent: typing.Optional["CategoryReference"] - #: Decimal value between 0 and 1 used to order Categories that are on the same level in the Category tree. + #: Decimal value between 0 and 1. Frontend applications can use this value for ordering Categories within the same level in the category tree. order_hint: str - #: Additional identifier for external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP). + #: Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP). external_id: typing.Optional[str] #: Name of the Category used by external search engines for improved search engine performance. meta_title: typing.Optional["LocalizedString"] @@ -167,10 +167,10 @@ class CategoryDraft(_BaseType): #: Parent Category of the Category. #: The parent can be set by its `id` or `key`. parent: typing.Optional["CategoryResourceIdentifier"] - #: Decimal value between 0 and 1 used to order Categories that are on the same level in the Category tree. + #: Decimal value between 0 and 1. Frontend applications can use this value for ordering Categories within the same level in the category tree. #: If not set, a random value will be assigned. order_hint: typing.Optional[str] - #: Additional identifier for external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP). + #: Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP). external_id: typing.Optional[str] #: Name of the Category used by external search engines for improved search engine performance. meta_title: typing.Optional["LocalizedString"] @@ -306,6 +306,7 @@ class CategoryResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.CATEGORY) @classmethod @@ -324,7 +325,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CategoryUpdate(_BaseType): #: Expected version of the Category on which the changes should be applied. - #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Category. actions: typing.List["CategoryUpdateAction"] @@ -963,7 +964,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CategorySetExternalIdAction(CategoryUpdateAction): - """This update action sets a new ID that can be used as an additional identifier for external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP).""" + """This update action sets a new ID that can be used as an additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP).""" #: Value to set. If empty, any existing value will be removed. external_id: typing.Optional[str] diff --git a/src/commercetools/platform/models/channel.py b/src/commercetools/platform/models/channel.py index 00599ef4..7804aaf2 100644 --- a/src/commercetools/platform/models/channel.py +++ b/src/commercetools/platform/models/channel.py @@ -55,9 +55,9 @@ class Channel(BaseResource): - #: Present on resources updated after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Channel. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Channel. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the Channel. key: str @@ -255,6 +255,7 @@ class ChannelResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.CHANNEL) @classmethod @@ -282,7 +283,8 @@ class ChannelRoleEnum(enum.Enum): class ChannelUpdate(_BaseType): - #: Expected version of the Channel on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the Channel on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Channel. actions: typing.List["ChannelUpdateAction"] diff --git a/src/commercetools/platform/models/common.py b/src/commercetools/platform/models/common.py index 8f10c11d..61d9eb8a 100644 --- a/src/commercetools/platform/models/common.py +++ b/src/commercetools/platform/models/common.py @@ -25,6 +25,8 @@ "AssetDimensions", "AssetDraft", "AssetSource", + "Attribution", + "AttributionSource", "BaseAddress", "BaseResource", "CentPrecisionMoney", @@ -307,6 +309,39 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return AssetSourceSchema().dump(self) +class Attribution(_BaseType): + """Indicates the source and method that indirectly created or modified the resource. This is present on resources created or updated after 1 April 2024.""" + + #: `id` of the [API Client](ctp:api:type:ApiClient) that created or modified the resource. + client_id: typing.Optional[str] + #: Method used to initiate the creation or modification of the resource. + source: "AttributionSource" + + def __init__( + self, *, client_id: typing.Optional[str] = None, source: "AttributionSource" + ): + self.client_id = client_id + self.source = source + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Attribution": + from ._schemas.common import AttributionSchema + + return AttributionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.common import AttributionSchema + + return AttributionSchema().dump(self) + + +class AttributionSource(enum.Enum): + IMPORT = "Import" + EXPORT = "Export" + + class BaseAddress(_BaseType): """Polymorphic base type that represents a postal address and contact details. Depending on the read or write action, it can be either [Address](ctp:api:type:Address) or [AddressDraft](ctp:api:type:AddressDraft) that @@ -633,11 +668,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ClientLogging(_BaseType): - """These objects represent information about which [API Client](/../api/projects/api-clients) created or modified a resource. For more information, see [Client Logging](/client-logging).""" + """These objects represent information about which [API Client](/../api/projects/api-clients) created or modified a resource. For more information, see [Client Logging](/../api/general-concepts#client-logging).""" #: `id` of the [API Client](ctp:api:type:ApiClient) which created the resource. client_id: typing.Optional[str] - #: [External user ID](/../api/client-logging#external-user-ids) provided by `X-External-User-ID` HTTP Header. + #: [External user ID](/../api/general-concepts#external-user-ids) provided by `X-External-User-ID` HTTP Header. external_user_id: typing.Optional[str] #: Indicates the [Customer](ctp:api:type:Customer) who modified the resource using a token from the [password flow](/authorization#password-flow). customer: typing.Optional["CustomerReference"] @@ -676,7 +711,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CreatedBy(ClientLogging): - """Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked).""" + """IDs and references that created the resource. This is present on resources created after 1 February 2019 except for [events not tracked](/general-concepts#events-tracked).""" + + #: Indicates if the resource was created indirectly. + attributed_to: typing.Optional["Attribution"] def __init__( self, @@ -685,8 +723,11 @@ def __init__( external_user_id: typing.Optional[str] = None, customer: typing.Optional["CustomerReference"] = None, anonymous_id: typing.Optional[str] = None, - associate: typing.Optional["CustomerReference"] = None + associate: typing.Optional["CustomerReference"] = None, + attributed_to: typing.Optional["Attribution"] = None ): + self.attributed_to = attributed_to + super().__init__( client_id=client_id, external_user_id=external_user_id, @@ -892,7 +933,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class LastModifiedBy(ClientLogging): - """Present on resources modified after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked).""" + """IDs and references that last modified the resource. This is present on resources created or updated after 1 February 2019 except for [events not tracked](/general-concepts#events-tracked).""" + + #: Indicates if the resource was modified indirectly. + attributed_to: typing.Optional["Attribution"] def __init__( self, @@ -901,8 +945,11 @@ def __init__( external_user_id: typing.Optional[str] = None, customer: typing.Optional["CustomerReference"] = None, anonymous_id: typing.Optional[str] = None, - associate: typing.Optional["CustomerReference"] = None + associate: typing.Optional["CustomerReference"] = None, + attributed_to: typing.Optional["Attribution"] = None ): + self.attributed_to = attributed_to + super().__init__( client_id=client_id, external_user_id=external_user_id, @@ -928,7 +975,7 @@ class LocalizedString(typing.Dict[str, str]): class Money(_BaseType): - """Draft type that stores amounts only in cent precision for the specified currency.""" + """Draft object to store money in cent amounts for a specific currency.""" #: Amount in the smallest indivisible unit of a currency, such as: #: @@ -985,10 +1032,12 @@ class Price(_BaseType): #: Date and time until this Price is valid. Prices that are no longer valid are not automatically removed, but they can be [removed](ctp:api:type:ProductRemovePriceAction) if necessary. valid_until: typing.Optional[datetime.datetime] #: Is set if a [ProductDiscount](ctp:api:type:ProductDiscount) has been applied. - #: If set, the API uses the DiscountedPrice value for the [Line Item Price selection](ctp:api:type:LineItemPriceSelection). + #: If set, the API uses the DiscountedPrice value for the [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). #: When a [relative discount](ctp:api:type:ProductDiscountValueRelative) has been applied and the fraction part of the DiscountedPrice `value` is 0.5, the `value` is rounded in favor of the customer with [half-down rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_down). discounted: typing.Optional["DiscountedPrice"] #: Present if different Prices for certain [LineItem](ctp:api:type:LineItem) quantities have been specified. + #: + #: If `discounted` is present, the tiered Price is ignored for a Product Variant. tiers: typing.Optional[typing.List["PriceTier"]] #: Custom Fields defined for the Price. custom: typing.Optional["CustomFields"] @@ -1061,6 +1110,8 @@ class PriceDraft(_BaseType): #: * A `predicate` that matches the [ProductVariant](ctp:api:type:ProductVariant) the Price is referenced from. discounted: typing.Optional["DiscountedPriceDraft"] #: Set this field to specify different Prices for certain [LineItem](ctp:api:type:LineItem) quantities. + #: + #: If `discounted` is set, the tiered Price is ignored for a Product Variant. tiers: typing.Optional[typing.List["PriceTierDraft"]] #: Custom Fields for the Price. custom: typing.Optional["CustomFieldsDraft"] @@ -1193,6 +1244,8 @@ class QueryPrice(_BaseType): #: Custom Fields for the Price. custom: typing.Optional["CustomFields"] #: Price tier applied when the minimum quantity for the [LineItem](ctp:api:type:LineItem) of a ProductVariant with the related Price is reached in a Cart. + #: + #: If `discounted` is specified, the tiered Price is ignored for a Product Variant. tiers: typing.Optional[typing.List["PriceTierDraft"]] def __init__( @@ -1330,6 +1383,10 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Reference": from ._schemas.product_selection import ProductSelectionReferenceSchema return ProductSelectionReferenceSchema().load(data) + if data["typeId"] == "product-tailoring": + from ._schemas.product_tailoring import ProductTailoringReferenceSchema + + return ProductTailoringReferenceSchema().load(data) if data["typeId"] == "product-type": from ._schemas.product_type import ProductTypeReferenceSchema @@ -1421,6 +1478,7 @@ class ReferenceTypeId(enum.Enum): PRODUCT_DISCOUNT = "product-discount" PRODUCT_PRICE = "product-price" PRODUCT_SELECTION = "product-selection" + PRODUCT_TAILORING = "product-tailoring" PRODUCT_TYPE = "product-type" QUOTE = "quote" QUOTE_REQUEST = "quote-request" @@ -1530,6 +1588,12 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ResourceIdentifier" ) return ProductSelectionResourceIdentifierSchema().load(data) + if data["typeId"] == "product-tailoring": + from ._schemas.product_tailoring import ( + ProductTailoringResourceIdentifierSchema, + ) + + return ProductTailoringResourceIdentifierSchema().load(data) if data["typeId"] == "product-type": from ._schemas.product_type import ProductTypeResourceIdentifierSchema @@ -1597,7 +1661,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ScopedPrice(_BaseType): """Scoped Price is contained in a [ProductVariant](ctp:api:type:ProductVariant) which is returned in response to a - [Product Projection Search](ctp:api:type:ProductProjectionSearchFilterScopedPrice) request when [Scoped Price Search](ctp:api:type:ScopedPriceSearch) is used. + [Product Projection Search](ctp:api:type:ProductProjectionSearchFilterScopedPrice) request when [Scoped Price Search](/../api/pricing-and-discounts-overview#scoped-price-search) is used. """ @@ -1705,9 +1769,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CentPrecisionMoney(TypedMoney): - """Object that stores cent amounts in a specific currency.""" + """Object that stores money in cent amounts of a specific currency.""" def __init__(self, *, cent_amount: int, currency_code: str, fraction_digits: int): + super().__init__( cent_amount=cent_amount, currency_code=currency_code, @@ -1728,7 +1793,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class HighPrecisionMoney(TypedMoney): - """Money object that stores an amount of a fraction of the smallest indivisible unit of the specified currency.""" + """Object that stores money as a fraction of the smallest indivisible unit of a specific currency.""" #: Amount in 1 / (10 ^ `fractionDigits`) of a currency. precise_amount: int @@ -1815,6 +1880,7 @@ def __init__( currency_code: str, fraction_digits: typing.Optional[int] = None ): + super().__init__( cent_amount=cent_amount, currency_code=currency_code, @@ -1837,7 +1903,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class HighPrecisionMoneyDraft(TypedMoneyDraft): - """Money draft object to store an amount of a fraction of the smallest indivisible unit of the specified currency.""" + """Draft object to store money as a fraction of the smallest indivisible unit for a specific currency.""" #: Amount in 1 / (10 ^ `fractionDigits`) of a currency. precise_amount: int diff --git a/src/commercetools/platform/models/custom_object.py b/src/commercetools/platform/models/custom_object.py index d82e8301..847e3fc5 100644 --- a/src/commercetools/platform/models/custom_object.py +++ b/src/commercetools/platform/models/custom_object.py @@ -24,9 +24,9 @@ class CustomObject(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the CustomObject. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the CustomObject. created_by: typing.Optional["CreatedBy"] #: Namespace to group CustomObjects. container: str diff --git a/src/commercetools/platform/models/customer.py b/src/commercetools/platform/models/customer.py index abc35fd3..09de8ecd 100644 --- a/src/commercetools/platform/models/customer.py +++ b/src/commercetools/platform/models/customer.py @@ -101,11 +101,11 @@ class Customer(BaseResource): #: #: Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence). customer_number: typing.Optional[str] - #: Optional identifier for use in external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP). + #: Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP). external_id: typing.Optional[str] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Customer. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Customer. created_by: typing.Optional["CreatedBy"] #: Email address of the Customer that is [unique](/../api/customers-overview#customer-uniqueness) for an entire Project or to a Store the Customer is assigned to. #: It is the mandatory unique identifier of a Customer. @@ -148,9 +148,9 @@ class Customer(BaseResource): salutation: typing.Optional[str] #: [Stores](ctp:api:type:Store) to which the Customer is assigned to. #: - #: - If no Stores are specified, the Customer is a global customer, and can log in using the [Password Flow for global Customers](/../api/authorization#password-flow-for-global-customers). + #: - If `stores` is empty, the Customer is a global customer, and can log in using the [Password Flow for global Customers](/../api/authorization#password-flow-for-global-customers). #: - If any Stores are specified, the Customer can only log in using the [Password Flow for Customers in a Store](/../api/authorization#password-flow-for-customers-in-a-store) for those specific Stores. - stores: typing.Optional[typing.List["StoreKeyReference"]] + stores: typing.List["StoreKeyReference"] #: Indicates whether the `password` is required for the Customer. authentication_mode: "AuthenticationMode" @@ -185,7 +185,7 @@ def __init__( custom: typing.Optional["CustomFields"] = None, locale: typing.Optional[str] = None, salutation: typing.Optional[str] = None, - stores: typing.Optional[typing.List["StoreKeyReference"]] = None, + stores: typing.List["StoreKeyReference"], authentication_mode: "AuthenticationMode" ): self.key = key @@ -336,7 +336,7 @@ class CustomerDraft(_BaseType): #: #: Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence). customer_number: typing.Optional[str] - #: Optional identifier for use in external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP). + #: Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP). external_id: typing.Optional[str] #: Email address of the Customer that must be [unique](/../api/customers-overview#customer-uniqueness) for an entire Project or to a Store the Customer is assigned to. #: It is the mandatory unique identifier of a Customer. @@ -476,6 +476,7 @@ class CustomerEmailTokenReference(Reference): """[Reference](ctp:api:type:Reference) to a [CustomerToken](ctp:api:type:CustomerToken) for email verification.""" def __init__(self, *, id: str): + super().__init__(id=id, type_id=ReferenceTypeId.CUSTOMER_EMAIL_TOKEN) @classmethod @@ -569,6 +570,7 @@ class CustomerPasswordTokenReference(Reference): """[Reference](ctp:api:type:Reference) to a [CustomerToken](ctp:api:type:CustomerToken) for password reset.""" def __init__(self, *, id: str): + super().__init__(id=id, type_id=ReferenceTypeId.CUSTOMER_PASSWORD_TOKEN) @classmethod @@ -647,6 +649,7 @@ class CustomerResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.CUSTOMER) @classmethod @@ -787,7 +790,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerUpdate(_BaseType): - #: Expected version of the Customer on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: Expected version of the Customer on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Customer. actions: typing.List["CustomerUpdateAction"] @@ -1580,7 +1584,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerSetCustomerGroupAction(CustomerUpdateAction): - """Setting the Customer Group of the Customer produces the [CustomerGroupSet](ctp:api:type:CustomerGroupSetMessage) Message.""" + """Setting the Customer Group of the Customer produces the [CustomerGroupSet](ctp:api:type:CustomerGroupSetMessage) Message. + + To reflect the new Customer Group, this update action can result in [updates](/api/carts-orders-overview#cart-updates) to the most recently modified active Cart. When this occurs, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). + + """ #: Value to set. #: If empty, any existing value is removed. @@ -1701,8 +1709,6 @@ class CustomerSetDefaultShippingAddressAction(CustomerUpdateAction): """Sets the default shipping address from `addresses`. The action adds the `id` of the specified address to the `shippingAddressIds` if not contained already. Either `addressId` or `addressKey` is required. - If the Tax Category of the Cart [ShippingInfo](ctp:api:type:ShippingInfo) is missing the TaxRate matching country and state given in the `shippingAddress` of that Cart, a [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) error is returned. - """ #: `id` of the [Address](ctp:api:type:Address) to become the default shipping address. @@ -1760,6 +1766,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerSetFirstNameAction(CustomerUpdateAction): + """Setting the first name of the Customer produces the [CustomeFirstNameSet](ctp:api:type:CustomerFirstNameSetMessage) Message.""" + #: Value to set. If empty, any existing value is removed. first_name: typing.Optional[str] @@ -1804,7 +1812,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerSetLastNameAction(CustomerUpdateAction): - """Setting the last name of the Customer produces the [CustomerLastNameSetMessage](ctp:api:type:CustomerLastNameSetMessage).""" + """Setting the last name of the Customer produces the [CustomerLastNameSet](ctp:api:type:CustomerLastNameSetMessage) Message.""" #: Value to set. If empty, any existing value is removed. last_name: typing.Optional[str] @@ -1905,11 +1913,9 @@ class CustomerSetStoresAction(CustomerUpdateAction): """ #: ResourceIdentifier of the Stores to set. - stores: typing.Optional[typing.List["StoreResourceIdentifier"]] + stores: typing.List["StoreResourceIdentifier"] - def __init__( - self, *, stores: typing.Optional[typing.List["StoreResourceIdentifier"]] = None - ): + def __init__(self, *, stores: typing.List["StoreResourceIdentifier"]): self.stores = stores super().__init__(action="setStores") @@ -1929,7 +1935,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerSetTitleAction(CustomerUpdateAction): - """Setting the title of the Customer produces the [CustomerTitleSetMessage](ctp:api:type:CustomerTitleSetMessage).""" + """Setting the title of the Customer produces the [CustomerTitleSet](ctp:api:type:CustomerTitleSetMessage) Message.""" #: Value to set. If empty, any existing value is removed. title: typing.Optional[str] diff --git a/src/commercetools/platform/models/customer_group.py b/src/commercetools/platform/models/customer_group.py index dac7cfcf..e1409832 100644 --- a/src/commercetools/platform/models/customer_group.py +++ b/src/commercetools/platform/models/customer_group.py @@ -37,9 +37,9 @@ class CustomerGroup(BaseResource): - #: Present on resources updated after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the CustomerGroup. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the CustomerGroup. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier for the CustomerGroup. key: typing.Optional[str] @@ -200,6 +200,7 @@ class CustomerGroupResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.CUSTOMER_GROUP) @classmethod @@ -218,7 +219,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerGroupUpdate(_BaseType): #: Expected version of the CustomerGroup on which the changes should be applied. - #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the CustomerGroup. actions: typing.List["CustomerGroupUpdateAction"] diff --git a/src/commercetools/platform/models/customer_search.py b/src/commercetools/platform/models/customer_search.py new file mode 100644 index 00000000..6d0c8634 --- /dev/null +++ b/src/commercetools/platform/models/customer_search.py @@ -0,0 +1,197 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType +from .project import CustomerIndexingStatus + +if typing.TYPE_CHECKING: + from .project import CustomerIndexingStatus + from .search import SearchQuery, SearchSorting + +__all__ = [ + "CustomerIndexingProgress", + "CustomerPagedSearchResponse", + "CustomerSearchIndexingStatusResponse", + "CustomerSearchRequest", + "CustomerSearchResult", +] + + +class CustomerIndexingProgress(_BaseType): + #: The number of Customers successfully indexed. + indexed: int + #: The number of Customers that failed to be indexed. + failed: int + #: The estimated total number of Customers to be indexed. + estimated_total: int + + def __init__(self, *, indexed: int, failed: int, estimated_total: int): + self.indexed = indexed + self.failed = failed + self.estimated_total = estimated_total + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CustomerIndexingProgress": + from ._schemas.customer_search import CustomerIndexingProgressSchema + + return CustomerIndexingProgressSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.customer_search import CustomerIndexingProgressSchema + + return CustomerIndexingProgressSchema().dump(self) + + +class CustomerPagedSearchResponse(_BaseType): + #: Total number of results matching the query. + total: int + #: Number of [results requested](/../api/general-concepts#limit). + limit: int + #: Number of [elements skipped](/../api/general-concepts#offset). + offset: int + #: Search result containing the Customers matching the search query. + results: typing.List["CustomerSearchResult"] + + def __init__( + self, + *, + total: int, + limit: int, + offset: int, + results: typing.List["CustomerSearchResult"] + ): + self.total = total + self.limit = limit + self.offset = offset + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CustomerPagedSearchResponse": + from ._schemas.customer_search import CustomerPagedSearchResponseSchema + + return CustomerPagedSearchResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.customer_search import CustomerPagedSearchResponseSchema + + return CustomerPagedSearchResponseSchema().dump(self) + + +class CustomerSearchIndexingStatusResponse(_BaseType): + #: Current status of indexing the Customer Search. + status: "CustomerIndexingStatus" + #: Progress of indexing. Only available when indexing is in progress. + states: typing.Optional["CustomerIndexingProgress"] + #: Date and time (UTC) when the last indexing started. + started_at: typing.Optional[datetime.datetime] + #: Time when the status was last modified. + last_modified_at: typing.Optional[datetime.datetime] + #: Indicates how many times the system tried to start indexing after failed attempts. The counter is set to null after an indexing finished successfully. + retry_count: typing.Optional[int] + + def __init__( + self, + *, + status: "CustomerIndexingStatus", + states: typing.Optional["CustomerIndexingProgress"] = None, + started_at: typing.Optional[datetime.datetime] = None, + last_modified_at: typing.Optional[datetime.datetime] = None, + retry_count: typing.Optional[int] = None + ): + self.status = status + self.states = states + self.started_at = started_at + self.last_modified_at = last_modified_at + self.retry_count = retry_count + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CustomerSearchIndexingStatusResponse": + from ._schemas.customer_search import CustomerSearchIndexingStatusResponseSchema + + return CustomerSearchIndexingStatusResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.customer_search import CustomerSearchIndexingStatusResponseSchema + + return CustomerSearchIndexingStatusResponseSchema().dump(self) + + +class CustomerSearchRequest(_BaseType): + #: The Customer search query. + query: typing.Optional["SearchQuery"] + #: Controls how results to your query are sorted. If not provided, the results are sorted by relevance in descending order. + sort: typing.Optional[typing.List["SearchSorting"]] + #: The maximum number of search results to be returned. + limit: typing.Optional[int] + #: The number of search results to be skipped in the response for pagination. + offset: typing.Optional[int] + + def __init__( + self, + *, + query: typing.Optional["SearchQuery"] = None, + sort: typing.Optional[typing.List["SearchSorting"]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None + ): + self.query = query + self.sort = sort + self.limit = limit + self.offset = offset + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CustomerSearchRequest": + from ._schemas.customer_search import CustomerSearchRequestSchema + + return CustomerSearchRequestSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.customer_search import CustomerSearchRequestSchema + + return CustomerSearchRequestSchema().dump(self) + + +class CustomerSearchResult(_BaseType): + #: `id` of the [Customer](ctp:api:type:Customer) matching the search query. + id: str + #: How closely this customer matches the search query. + relevance: float + + def __init__(self, *, id: str, relevance: float): + self.id = id + self.relevance = relevance + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "CustomerSearchResult": + from ._schemas.customer_search import CustomerSearchResultSchema + + return CustomerSearchResultSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.customer_search import CustomerSearchResultSchema + + return CustomerSearchResultSchema().dump(self) diff --git a/src/commercetools/platform/models/discount_code.py b/src/commercetools/platform/models/discount_code.py index b175f5a4..1df97065 100644 --- a/src/commercetools/platform/models/discount_code.py +++ b/src/commercetools/platform/models/discount_code.py @@ -41,6 +41,7 @@ "DiscountCodeSetCustomFieldAction", "DiscountCodeSetCustomTypeAction", "DiscountCodeSetDescriptionAction", + "DiscountCodeSetKeyAction", "DiscountCodeSetMaxApplicationsAction", "DiscountCodeSetMaxApplicationsPerCustomerAction", "DiscountCodeSetNameAction", @@ -53,9 +54,11 @@ class DiscountCode(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: User-defined unique identifier of the DiscountCode. + key: typing.Optional[str] + #: IDs and references that last modified the DiscountCode. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the DiscountCode. created_by: typing.Optional["CreatedBy"] #: Name of the DiscountCode. name: typing.Optional["LocalizedString"] @@ -97,6 +100,7 @@ def __init__( version: int, created_at: datetime.datetime, last_modified_at: datetime.datetime, + key: typing.Optional[str] = None, last_modified_by: typing.Optional["LastModifiedBy"] = None, created_by: typing.Optional["CreatedBy"] = None, name: typing.Optional["LocalizedString"] = None, @@ -114,6 +118,7 @@ def __init__( valid_until: typing.Optional[datetime.datetime] = None, application_version: typing.Optional[int] = None ): + self.key = key self.last_modified_by = last_modified_by self.created_by = created_by self.name = name @@ -151,6 +156,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class DiscountCodeDraft(_BaseType): + #: User-defined unique identifier for the DiscountCode. + key: typing.Optional[str] #: Name of the DiscountCode. name: typing.Optional["LocalizedString"] #: Description of the DiscountCode. @@ -165,8 +172,12 @@ class DiscountCodeDraft(_BaseType): #: Only active DiscountCodes can be applied to the Cart. is_active: typing.Optional[bool] #: Number of times the DiscountCode can be applied. + #: + #: If not set, the DiscountCode can be applied any number of times. max_applications: typing.Optional[int] #: Number of times the DiscountCode can be applied per Customer. + #: + #: If not set, the DiscountCode can be applied any number of times. max_applications_per_customer: typing.Optional[int] #: Custom Fields for the DiscountCode. custom: typing.Optional["CustomFieldsDraft"] @@ -180,6 +191,7 @@ class DiscountCodeDraft(_BaseType): def __init__( self, *, + key: typing.Optional[str] = None, name: typing.Optional["LocalizedString"] = None, description: typing.Optional["LocalizedString"] = None, code: str, @@ -193,6 +205,7 @@ def __init__( valid_from: typing.Optional[datetime.datetime] = None, valid_until: typing.Optional[datetime.datetime] = None ): + self.key = key self.name = name self.description = description self.code = code @@ -298,6 +311,7 @@ class DiscountCodeResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.DISCOUNT_CODE) @classmethod @@ -316,7 +330,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class DiscountCodeUpdate(_BaseType): #: Expected version of the DiscountCode on which the changes should be applied. - #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the DiscountCode. actions: typing.List["DiscountCodeUpdateAction"] @@ -383,6 +397,10 @@ def deserialize( from ._schemas.discount_code import DiscountCodeSetDescriptionActionSchema return DiscountCodeSetDescriptionActionSchema().load(data) + if data["action"] == "setKey": + from ._schemas.discount_code import DiscountCodeSetKeyActionSchema + + return DiscountCodeSetKeyActionSchema().load(data) if data["action"] == "setMaxApplications": from ._schemas.discount_code import ( DiscountCodeSetMaxApplicationsActionSchema, @@ -597,8 +615,36 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return DiscountCodeSetDescriptionActionSchema().dump(self) +class DiscountCodeSetKeyAction(DiscountCodeUpdateAction): + """This action generates a [DiscountCodeKeySet](ctp:api:type:DiscountCodeKeySetMessage) Message.""" + + #: Unique value to set. + #: If empty, any existing value will be removed. + key: typing.Optional[str] + + def __init__(self, *, key: typing.Optional[str] = None): + self.key = key + + super().__init__(action="setKey") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountCodeSetKeyAction": + from ._schemas.discount_code import DiscountCodeSetKeyActionSchema + + return DiscountCodeSetKeyActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.discount_code import DiscountCodeSetKeyActionSchema + + return DiscountCodeSetKeyActionSchema().dump(self) + + class DiscountCodeSetMaxApplicationsAction(DiscountCodeUpdateAction): - #: Value to set. If empty, any existing value will be removed. + #: Value to set. + #: + #: If empty, any existing value will be removed and the DiscountCode can be applied any number of times. max_applications: typing.Optional[int] def __init__(self, *, max_applications: typing.Optional[int] = None): @@ -621,7 +667,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class DiscountCodeSetMaxApplicationsPerCustomerAction(DiscountCodeUpdateAction): - #: Value to set. If empty, any existing value will be removed. + #: Value to set. + #: + #: If empty, any existing value will be removed and the DiscountCode can be applied any number of times. max_applications_per_customer: typing.Optional[int] def __init__(self, *, max_applications_per_customer: typing.Optional[int] = None): diff --git a/src/commercetools/platform/models/error.py b/src/commercetools/platform/models/error.py index 6cc081e3..cf9e824e 100644 --- a/src/commercetools/platform/models/error.py +++ b/src/commercetools/platform/models/error.py @@ -108,6 +108,7 @@ "GraphQLInvalidSubjectError", "GraphQLInvalidTokenError", "GraphQLLanguageUsedInStoresError", + "GraphQLLockedFieldError", "GraphQLMatchingPriceNotFoundError", "GraphQLMaxCartDiscountsReachedError", "GraphQLMaxResourceLimitExceededError", @@ -116,7 +117,6 @@ "GraphQLMissingTaxRateForCountryError", "GraphQLMoneyOverflowError", "GraphQLNoMatchingProductDiscountFoundError", - "GraphQLNotEnabledError", "GraphQLObjectNotFoundError", "GraphQLOutOfStockError", "GraphQLOverCapacityError", @@ -153,6 +153,7 @@ "InvalidSubjectError", "InvalidTokenError", "LanguageUsedInStoresError", + "LockedFieldError", "MatchingPriceNotFoundError", "MaxCartDiscountsReachedError", "MaxResourceLimitExceededError", @@ -161,7 +162,6 @@ "MissingTaxRateForCountryError", "MoneyOverflowError", "NoMatchingProductDiscountFoundError", - "NotEnabledError", "ObjectNotFoundError", "OutOfStockError", "OverCapacityError", @@ -403,6 +403,10 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ErrorObject": from ._schemas.error import LanguageUsedInStoresErrorSchema return LanguageUsedInStoresErrorSchema().load(data) + if data["code"] == "LockedField": + from ._schemas.error import LockedFieldErrorSchema + + return LockedFieldErrorSchema().load(data) if data["code"] == "MatchingPriceNotFound": from ._schemas.error import MatchingPriceNotFoundErrorSchema @@ -435,10 +439,6 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ErrorObject": from ._schemas.error import NoMatchingProductDiscountFoundErrorSchema return NoMatchingProductDiscountFoundErrorSchema().load(data) - if data["code"] == "NotEnabled": - from ._schemas.error import NotEnabledErrorSchema - - return NotEnabledErrorSchema().load(data) if data["code"] == "ObjectNotFound": from ._schemas.error import ObjectNotFoundErrorSchema @@ -552,6 +552,7 @@ class AnonymousIdAlreadyInUseError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="AnonymousIdAlreadyInUse", **kwargs) @@ -615,7 +616,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeDefinitionAlreadyExistsError(ErrorObject): """Returned when the `name` of the [AttributeDefinition](ctp:api:type:AttributeDefinition) conflicts with an existing Attribute. - The error is returned as a failed response to the [Create ProductType](/../api/projects/productTypes#create-producttype) request or [Change AttributeDefinition Name](ctp:api:type:ProductTypeChangeAttributeNameAction) update action. + The error is returned as a failed response to the [Create ProductType](ctp:api:endpoint:/{projectKey}/product-types:POST) request or [Change AttributeDefinition Name](ctp:api:type:ProductTypeChangeAttributeNameAction) update action. """ @@ -660,7 +661,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeDefinitionTypeConflictError(ErrorObject): """Returned when the `type` is different for an AttributeDefinition using the same `name` in multiple Product Types. - The error is returned as a failed response to the [Create ProductType](/../api/projects/productTypes#create-producttype) request. + The error is returned as a failed response to the [Create ProductType](ctp:api:endpoint:/{projectKey}/product-types:POST) request. """ @@ -739,6 +740,7 @@ class BadGatewayError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="BadGateway", **kwargs) @@ -788,6 +790,7 @@ class ContentTooLargeError(ErrorObject): """Returned when the request results in too much data being returned from the API. Adjust the request query to reduce the size of the data returned.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="ContentTooLarge", **kwargs) @@ -810,12 +813,10 @@ class CountryNotConfiguredInStoreError(ErrorObject): - [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/carts:POST) request and [Set Country](ctp:api:type:CartSetCountryAction) update action on Carts. - [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/me/carts:POST) request and [Set Country](ctp:api:type:MyCartSetCountryAction) update action on My Carts. - - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. - - [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST) requests on Orders. - - [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST) requests on Orders. + - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. - [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) request on Order Import. - - [Set Country](ctp:api:type:StagedOrderSetCountryAction) on Order Edits. + - [Set Country](ctp:api:type:StagedOrderSetCountryAction) update action on Order Edits. """ @@ -856,8 +857,13 @@ class DiscountCodeNonApplicableError(ErrorObject): The error is returned as a failed response to: + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST) requests and [Add DiscountCode](ctp:api:type:CartAddDiscountCodeAction) update action on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) requests and [Add DiscountCode](ctp:api:type:MyCartAddDiscountCodeAction) update action on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) request on Associate Carts. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Add DiscountCode](ctp:api:type:StagedOrderAddDiscountCodeAction) update action on Order Edits. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ @@ -1115,7 +1121,7 @@ class DuplicateStandalonePriceScopeError(ErrorObject): """Returned when the given Price scope conflicts with the Price scope of an existing Standalone Price. Every Standalone Price associated with the same SKU must have a distinct combination of currency, country, Customer Group, Channel, and validity periods (`validFrom` and `validUntil`). - The error is returned as a failed response to the [Create StandalonePrice](/../api/projects/standalone-prices#create-standaloneprice) request. + The error is returned as a failed response to the [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request. """ @@ -1205,7 +1211,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class EditPreviewFailedError(ErrorObject): """Returned when a preview to find an appropriate Shipping Method for an OrderEdit could not be generated. - The error is returned as a failed response to the [Get Shipping Methods for an OrderEdit](/../api/projects/shippingMethods#for-an-orderedit) request. + The error is returned as a failed response to the [Get Shipping Methods for an OrderEdit](ctp:api:endpoint:/{projectKey}/shipping-methods/matching-orderedit:GET) request. """ @@ -1313,6 +1319,7 @@ class EnumValueIsUsedError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="EnumValueIsUsed", **kwargs) @@ -1336,6 +1343,7 @@ class EnumValuesMustMatchError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="EnumValuesMustMatch", **kwargs) @@ -1628,6 +1636,7 @@ class ExternalOAuthFailedError(ErrorObject): """Returned when an [external OAuth Introspection endpoint](/../api/authorization#requesting-an-access-token-using-an-external-oauth-server) does not return a response within the [time limit](/../api/authorization#time-limits), or the response isn't compliant with [RFC 7662](https://www.rfc-editor.org/rfc/rfc7662.html) (for example, an HTTP status code like `500`).""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="ExternalOAuthFailed", **kwargs) @@ -1649,6 +1658,7 @@ class FeatureRemovedError(ErrorObject): """Returned when the requested feature was removed.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="FeatureRemoved", **kwargs) @@ -1665,13 +1675,14 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GeneralError(ErrorObject): - """Returned when a server-side problem occurs. + """Returned when a server-side problem occurs before or after data persistence. In some cases, the requested action may successfully complete after the error is returned. Therefore, it is recommended to verify the status of the requested resource after receiving a 500 error. - If you encounter this error, report it using the [Support Portal](https://support.commercetools.com). + If you encounter this error, report it to the [Composable Commerce support team](https://support.commercetools.com). """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="General", **kwargs) @@ -1688,7 +1699,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InsufficientScopeError(ErrorObject): + def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="insufficient_scope", **kwargs) @@ -1710,6 +1723,7 @@ class InternalConstraintViolatedError(ErrorObject): """Returned when certain API-specific constraints were not met. For example, the specified [Discount Code](ctp:api:type:DiscountCode) was never applied and cannot be updated.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="InternalConstraintViolated", **kwargs) @@ -1732,12 +1746,13 @@ class InvalidCredentialsError(ErrorObject): The error is returned as a failed response to: - - [Authenticate a global Customer (Sign-in)](/../api/projects/customers#authenticate-sign-in-customer) and [Authenticate Customer (Sign-in) in a Store](/../api/projects/customers#authenticate-sign-in-customer-in-store) requests on Customers. - - [Authenticating Customer (Sign-in)](/../api/projects/me-profile#authenticate-sign-in-customer) and [Authenticate Customer (Sign-in) in a Store](/../api/projects/me-profile#authenticate-sign-in-customer-in-store) requests on My Customer Profile. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/login:POST) requests on Customers. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/me/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/login:POST) requests on My Customer Profile. """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="InvalidCredentials", **kwargs) @@ -1760,12 +1775,13 @@ class InvalidCurrentPasswordError(ErrorObject): The error is returned as a failed response to: - - [Change Customer Password](/../api/projects/customers#change-password-of-customer) and [Change Customer Password in a Store](/../api/projects/customers#change-password-of-customer-in-store) requests on Customers. - - [Change Customer Password](/../api/projects/me-profile#change-password-of-customer) and [Change Customer Password in a Store](/../api/projects/me-profile#change-password-of-customer-in-store) requests on My Customer Profile. + - [Change Customer Password](ctp:api:endpoint:/{projectKey}/customers/password:POST) and [Change Customer Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password:POST) requests on Customers. + - [Change Customer Password](ctp:api:endpoint:/{projectKey}/me/password:POST) and [Change Customer Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/password:POST) requests on My Customer Profile. """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="InvalidCurrentPassword", **kwargs) @@ -1824,6 +1840,7 @@ class InvalidInputError(ErrorObject): """Returned when an invalid input has been sent.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="InvalidInput", **kwargs) @@ -1842,7 +1859,17 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InvalidItemShippingDetailsError(ErrorObject): """Returned when Line Item or Custom Line Item quantities set under [ItemShippingDetails](ctp:api:type:ItemShippingDetails) do not match the sum of the quantities in their respective shipping details. - The error is returned as a failed response to the [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests. + When a Cart is frozen, the error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [My Carts](ctp:api:type:MyCartUpdateAction). + + The error is also returned as a failed response to: + + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST) requests and [Add LineItem](ctp:api:type:CartAddLineItemAction), [Add CustomLineItem](ctp:api:type:CartAddCustomLineItemAction), [Set LineItem ShippingDetails](ctp:api:type:CartSetLineItemShippingDetailsAction), [Set CustomLineItem ShippingDetails](ctp:api:type:CartSetCustomLineItemShippingDetailsAction), [Add Shopping List](ctp:api:type:CartAddShoppingListAction), and [Remove LineItem](ctp:api:type:CartRemoveLineItemAction) update actions on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) requests, and [Add LineItem](ctp:api:type:MyCartAddLineItemAction), [Set LineItem ShippingDetails](ctp:api:type:MyCartSetLineItemShippingDetailsAction), and [Remove LineItem](ctp:api:type:MyCartRemoveLineItemAction) update actions on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) request on Associate Carts. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST), and [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction), [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction), [Set LineItem ShippingDetails](ctp:api:type:StagedOrderSetLineItemShippingDetailsAction), [Set CustomLineItem ShippingDetails](ctp:api:type:StagedOrderSetCustomLineItemShippingDetailsAction), [Add Shopping List](ctp:api:type:StagedOrderAddShoppingListAction), and [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update actions on Order Edits. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) and [Create Order from Quote in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/quotes:POST) requests on Associate Orders. """ @@ -1907,6 +1934,7 @@ class InvalidOperationError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="InvalidOperation", **kwargs) @@ -1923,7 +1951,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InvalidSubjectError(ErrorObject): + def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="InvalidSubject", **kwargs) @@ -1940,7 +1970,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InvalidTokenError(ErrorObject): + def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="invalid_token", **kwargs) @@ -1964,6 +1996,7 @@ class LanguageUsedInStoresError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="LanguageUsedInStores", **kwargs) @@ -1981,15 +2014,48 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return LanguageUsedInStoresErrorSchema().dump(self) +class LockedFieldError(ErrorObject): + """Returned when two [Customers](ctp:api:type:Customer) are simultaneously created or updated with the same email address. + + To confirm if the operation was successful, repeat the request. + + """ + + #: Field that is currently locked. + field: str + + def __init__(self, *, message: str, field: str, **kwargs): + self.field = field + kwargs.pop("code", None) + super().__init__(message=message, code="LockedField", **kwargs) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "LockedFieldError": + from ._schemas.error import LockedFieldErrorSchema + + return LockedFieldErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import LockedFieldErrorSchema + + return LockedFieldErrorSchema().dump(self) + + class MatchingPriceNotFoundError(ErrorObject): """Returned when the Product Variant does not have a Price according to the [Product](ctp:api:type:Product) `priceMode` value for a selected currency, country, Customer Group, or Channel. - The error is returned as a failed response to: + The error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [Staged Orders](ctp:api:type:StagedOrderUpdateAction). - - [Add LineItem](ctp:api:type:CartAddLineItemAction), [Add CustomLineItem](ctp:api:type:CartAddCustomLineItemAction), and [Add DiscountCode](ctp:api:type:CartAddDiscountCodeAction) update actions on Carts. - - [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction), [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction), and [Add DiscountCode](ctp:api:type:StagedOrderAddDiscountCodeAction) update actions on Order Edits. + The error is also returned as a failed response to: + + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/login:POST) requests and [Set CustomerGroup](ctp:api:type:CustomerSetCustomerGroupAction) update action on Customers. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/me/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/login:POST) requests on My Customer Profile. + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST), [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST), [Replicate Cart](ctp:api:endpoint:/{projectKey}/carts/replicate:POST), and [Replicate Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts/replicate:POST) requests on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) and [Replicate My Cart](ctp:api:endpoint:/{projectKey}/me/carts/replicate:POST) requests on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) and [Replicate Cart in Business Unit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/replicate:POST) requests on Associate Carts. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ @@ -2052,6 +2118,7 @@ class MaxCartDiscountsReachedError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="MaxCartDiscountsReached", **kwargs) @@ -2109,6 +2176,7 @@ class MaxStoreReferencesReachedError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="MaxStoreReferencesReached", **kwargs) @@ -2130,12 +2198,12 @@ class MissingRoleOnChannelError(ErrorObject): """Returned when one of the following states occur: - [Channel](ctp:api:type:Channel) is added or set on a [Store](ctp:api:type:Store) with missing Channel `roles`. - - [Standalone Price](/../api/projects/standalone-prices#create-standaloneprice) references a Channel that does not contain the `ProductDistribution` role. + - [Standalone Price](ctp:api:type:StandalonePrice) references a Channel that does not contain the `ProductDistribution` role. The error is returned as a failed response to: - [Add Distribution Channel](ctp:api:type:StoreAddDistributionChannelAction), [Set Distribution Channel](ctp:api:type:StoreSetDistributionChannelsAction), [Add Supply Channel](ctp:api:type:StoreAddSupplyChannelAction), and [Set Supply Channel](ctp:api:type:StoreSetSupplyChannelsAction) update actions. - - [Create a Standalone Price](/../api/projects/standalone-prices#create-standaloneprice) request. + - [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request. """ @@ -2175,10 +2243,18 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MissingTaxRateForCountryError(ErrorObject): """Returned when the Tax Category of at least one of the `lineItems`, `customLineItems`, or `shippingInfo` in the [Cart](ctp:api:type:Cart) is missing the [TaxRate](ctp:api:type:TaxRate) matching `country` and `state` given in the `shippingAddress` of that Cart. - The error is returned as a failed response to: + The error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [Staged Orders](ctp:api:type:StagedOrderUpdateAction). + + The error is also returned as a failed response to: - - [Set Default Shipping Address](ctp:api:type:CustomerSetDefaultShippingAddressAction), [Add LineItem](ctp:api:type:CartAddLineItemAction), [Add CustomLineItem](ctp:api:type:CartAddCustomLineItemAction), [Set Shipping Address](ctp:api:type:CartSetShippingAddressAction), [Add LineItem](ctp:api:type:MyCartAddLineItemAction), [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction), and [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction) update actions - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/login:POST) requests and [Set CustomerGroup](ctp:api:type:CustomerSetCustomerGroupAction) update action on Customers. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/me/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/login:POST) on My Customer Profile. + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST), [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST), [Replicate Cart](ctp:api:endpoint:/{projectKey}/carts/replicate:POST), and [Replicate Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts/replicate:POST) requests on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) and [Replicate My Cart](ctp:api:endpoint:/{projectKey}/me/carts/replicate:POST) requests on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) and [Replicate Cart in Business Unit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/replicate:POST) requests on Associate Carts. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) requests on Associate Orders. """ @@ -2225,6 +2301,7 @@ class MoneyOverflowError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="MoneyOverflow", **kwargs) @@ -2243,11 +2320,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class NoMatchingProductDiscountFoundError(ErrorObject): """Returned when a Product Discount could not be found that could be applied to the Price of a Product Variant. - The error is returned as a failed response to the [Get Matching ProductDiscount](/../api/projects/productDiscounts#get-matching-productdiscount) request. + The error is returned as a failed response to the [Get Matching ProductDiscount](ctp:api:endpoint:/{projectKey}/product-discounts/matching:POST) request. """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__( message=message, code="NoMatchingProductDiscountFound", **kwargs @@ -2267,29 +2345,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return NoMatchingProductDiscountFoundErrorSchema().dump(self) -class NotEnabledError(ErrorObject): - """Returned when the [Project-specific category recommendations feature](/../api/projects/categoryRecommendations#project-specific-category-recommendations) is not enabled for the Project.""" - - def __init__(self, *, message: str, **kwargs): - kwargs.pop("code", None) - super().__init__(message=message, code="NotEnabled", **kwargs) - - @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "NotEnabledError": - from ._schemas.error import NotEnabledErrorSchema - - return NotEnabledErrorSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.error import NotEnabledErrorSchema - - return NotEnabledErrorSchema().dump(self) - - class ObjectNotFoundError(ErrorObject): """Returned when the requested resource was not found.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="ObjectNotFound", **kwargs) @@ -2310,8 +2370,9 @@ class OutOfStockError(ErrorObject): The error is returned as a failed response to: - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), and [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) requests on Orders. - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST), and [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) and [Create Order from Quote in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/quotes:POST) requests on Associate Orders. """ @@ -2353,6 +2414,7 @@ class OverCapacityError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="OverCapacity", **kwargs) @@ -2372,7 +2434,7 @@ class OverlappingStandalonePriceValidityError(ErrorObject): """Returned when a given Price validity period conflicts with an existing one. Every Standalone Price associated with the same SKU and with the same combination of currency, country, Customer Group, and Channel, must have non-overlapping validity periods (`validFrom` and `validUntil`). - The error is returned as a failed response to the [Create StandalonePrice](/../api/projects/standalone-prices#create-standaloneprice) request. + The error is returned as a failed response to the [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request. """ @@ -2446,11 +2508,12 @@ class PendingOperationError(ErrorObject): """Returned when a previous conflicting operation is still pending and needs to finish before the request can succeed. The client application should retry the request with exponential backoff up to a point where further delay is unacceptable. - If the error persists, report it using the [Support Portal](https://support.commercetools.com). + If the error persists, report it to the [Composable Commerce support team](https://support.commercetools.com). """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="PendingOperation", **kwargs) @@ -2467,12 +2530,15 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PriceChangedError(ErrorObject): - """Returned when the Price, Tax Rate, or Shipping Rate of some Line Items changed since they were last added to the Cart. + """Returned when the Price or Tax Rate of some Line Items or Shipping Rate of some Shipping Methods changed since they were last added to the Cart. - The error is returned as a failed response to: + When a Cart is frozen, the error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [My Carts](ctp:api:type:MyCartUpdateAction). - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + The error is also returned as a failed response to: + + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ @@ -2614,7 +2680,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class QueryComplexityLimitExceededError(ErrorObject): + def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="QueryComplexityLimitExceeded", **kwargs) @@ -2640,6 +2708,7 @@ class QueryTimedOutError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="QueryTimedOut", **kwargs) @@ -2750,6 +2819,7 @@ class ResourceNotFoundError(ErrorObject): """Returned when the resource addressed by the request URL does not exist.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="ResourceNotFound", **kwargs) @@ -2769,6 +2839,7 @@ class ResourceSizeLimitExceededError(ErrorObject): """Returned when the resource exceeds the maximum allowed size of 16 MB.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="ResourceSizeLimitExceeded", **kwargs) @@ -2794,6 +2865,7 @@ class SearchDeactivatedError(ErrorObject): """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="SearchDeactivated", **kwargs) @@ -2815,6 +2887,7 @@ class SearchExecutionFailureError(ErrorObject): """Returned when a search query could not be completed due to an unexpected failure.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="SearchExecutionFailure", **kwargs) @@ -2836,6 +2909,7 @@ class SearchFacetPathNotFoundError(ErrorObject): """Returned when a search facet path could not be found.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="SearchFacetPathNotFound", **kwargs) @@ -2857,6 +2931,7 @@ class SearchIndexingInProgressError(ErrorObject): """Returned when the indexing of Product information is still in progress for Projects that have indexing activated.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="SearchIndexingInProgress", **kwargs) @@ -2878,6 +2953,7 @@ class SemanticErrorError(ErrorObject): """Returned when a [Discount predicate](/../api/predicates/predicate-operators) or [API Extension predicate](/../api/predicates/query#using-predicates-in-conditional-api-extensions) is not semantically correct.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="SemanticError", **kwargs) @@ -2896,11 +2972,18 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShippingMethodDoesNotMatchCartError(ErrorObject): """Returned when the Cart contains a [ShippingMethod](ctp:api:type:ShippingMethod) that is not allowed for the [Cart](ctp:api:type:Cart). In this case, the [ShippingMethodState](ctp:api:type:ShippingMethodState) value is `DoesNotMatchCart`. - The error is returned as a failed response to the [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) or [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests. + When a Cart is frozen, the error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [My Carts](ctp:api:type:MyCartUpdateAction). + + The error is also returned as a failed response to: + + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__( message=message, code="ShippingMethodDoesNotMatchCart", **kwargs @@ -2960,6 +3043,7 @@ class SyntaxErrorError(ErrorObject): """Returned when a [Discount predicate](/../api/predicates/predicate-operators), [API Extension predicate](/../api/predicates/query#using-predicates-in-conditional-api-extensions), or [search query](/../api/projects/products-search) does not have the correct syntax.""" def __init__(self, *, message: str, **kwargs): + kwargs.pop("code", None) super().__init__(message=message, code="SyntaxError", **kwargs) @@ -3202,6 +3286,10 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "GraphQLErrorObject" from ._schemas.error import GraphQLLanguageUsedInStoresErrorSchema return GraphQLLanguageUsedInStoresErrorSchema().load(data) + if data["code"] == "LockedField": + from ._schemas.error import GraphQLLockedFieldErrorSchema + + return GraphQLLockedFieldErrorSchema().load(data) if data["code"] == "MatchingPriceNotFound": from ._schemas.error import GraphQLMatchingPriceNotFoundErrorSchema @@ -3234,10 +3322,6 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "GraphQLErrorObject" from ._schemas.error import GraphQLNoMatchingProductDiscountFoundErrorSchema return GraphQLNoMatchingProductDiscountFoundErrorSchema().load(data) - if data["code"] == "NotEnabled": - from ._schemas.error import GraphQLNotEnabledErrorSchema - - return GraphQLNotEnabledErrorSchema().load(data) if data["code"] == "ObjectNotFound": from ._schemas.error import GraphQLObjectNotFoundErrorSchema @@ -3357,6 +3441,7 @@ class GraphQLAnonymousIdAlreadyInUseError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="AnonymousIdAlreadyInUse", **kwargs) @@ -3419,7 +3504,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLAttributeDefinitionAlreadyExistsError(GraphQLErrorObject): """Returned when the `name` of the [AttributeDefinition](ctp:api:type:AttributeDefinition) conflicts with an existing Attribute. - The error is returned as a failed response to the [Create ProductType](/../api/projects/productTypes#create-producttype) request or [Change AttributeDefinition Name](ctp:api:type:ProductTypeChangeAttributeNameAction) update action. + The error is returned as a failed response to the [Create ProductType](ctp:api:endpoint:/{projectKey}/product-types:POST) request or [Change AttributeDefinition Name](ctp:api:type:ProductTypeChangeAttributeNameAction) update action. """ @@ -3461,7 +3546,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLAttributeDefinitionTypeConflictError(GraphQLErrorObject): """Returned when the `type` is different for an AttributeDefinition using the same `name` in multiple Product Types. - The error is returned as a failed response to the [Create ProductType](/../api/projects/productTypes#create-producttype) request. + The error is returned as a failed response to the [Create ProductType](ctp:api:endpoint:/{projectKey}/product-types:POST) request. """ @@ -3537,6 +3622,7 @@ class GraphQLBadGatewayError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="BadGateway", **kwargs) @@ -3586,6 +3672,7 @@ class GraphQLContentTooLargeError(GraphQLErrorObject): """Returned when the request results in too much data being returned from the API. Adjust the request query to reduce the size of the data returned.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="ContentTooLarge", **kwargs) @@ -3610,12 +3697,10 @@ class GraphQLCountryNotConfiguredInStoreError(GraphQLErrorObject): - [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/carts:POST) request and [Set Country](ctp:api:type:CartSetCountryAction) update action on Carts. - [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/me/carts:POST) request and [Set Country](ctp:api:type:MyCartSetCountryAction) update action on My Carts. - - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. - - [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST) requests on Orders. - - [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST) requests on Orders. + - [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. - [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) request on Order Import. - - [Set Country](ctp:api:type:StagedOrderSetCountryAction) on Order Edits. + - [Set Country](ctp:api:type:StagedOrderSetCountryAction) update action on Order Edits. """ @@ -3649,8 +3734,13 @@ class GraphQLDiscountCodeNonApplicableError(GraphQLErrorObject): The error is returned as a failed response to: + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST) requests and [Add DiscountCode](ctp:api:type:CartAddDiscountCodeAction) update action on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) requests and [Add DiscountCode](ctp:api:type:MyCartAddDiscountCodeAction) update action on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) request on Associate Carts. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Add DiscountCode](ctp:api:type:StagedOrderAddDiscountCodeAction) update action on Order Edits. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ @@ -3908,7 +3998,7 @@ class GraphQLDuplicateStandalonePriceScopeError(GraphQLErrorObject): """Returned when the given Price scope conflicts with the Price scope of an existing Standalone Price. Every Standalone Price associated with the same SKU must have a distinct combination of currency, country, Customer Group, Channel, and validity periods (`validFrom` and `validUntil`). - The error is returned as a failed response to the [Create StandalonePrice](/../api/projects/standalone-prices#create-standaloneprice) request. + The error is returned as a failed response to the [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request. """ @@ -3995,7 +4085,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLEditPreviewFailedError(GraphQLErrorObject): """Returned when a preview to find an appropriate Shipping Method for an OrderEdit could not be generated. - The error is returned as a failed response to the [Get Shipping Methods for an OrderEdit](/../api/projects/shippingMethods#for-an-orderedit) request. + The error is returned as a failed response to the [Get Shipping Methods for an OrderEdit](ctp:api:endpoint:/{projectKey}/shipping-methods/matching-orderedit:GET) request. """ @@ -4093,6 +4183,7 @@ class GraphQLEnumValueIsUsedError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="EnumValueIsUsed", **kwargs) @@ -4118,6 +4209,7 @@ class GraphQLEnumValuesMustMatchError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="EnumValuesMustMatch", **kwargs) @@ -4289,6 +4381,7 @@ class GraphQLExternalOAuthFailedError(GraphQLErrorObject): """Returned when an [external OAuth Introspection endpoint](/../api/authorization#requesting-an-access-token-using-an-external-oauth-server) does not return a response within the [time limit](/../api/authorization#time-limits), or the response isn't compliant with [RFC 7662](https://www.rfc-editor.org/rfc/rfc7662.html) (for example, an HTTP status code like `500`).""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="ExternalOAuthFailed", **kwargs) @@ -4310,6 +4403,7 @@ class GraphQLFeatureRemovedError(GraphQLErrorObject): """Returned when the requested feature was removed.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="FeatureRemoved", **kwargs) @@ -4328,13 +4422,14 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLGeneralError(GraphQLErrorObject): - """Returned when a server-side problem occurs. + """Returned when a server-side problem occurs before or after data persistence. In some cases, the requested action may successfully complete after the error is returned. Therefore, it is recommended to verify the status of the requested resource after receiving a 500 error. - If you encounter this error, report it using the [Support Portal](https://support.commercetools.com). + If you encounter this error, report it to the [Composable Commerce support team](https://support.commercetools.com). """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="General", **kwargs) @@ -4351,7 +4446,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLInsufficientScopeError(GraphQLErrorObject): + def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="insufficient_scope", **kwargs) @@ -4373,6 +4470,7 @@ class GraphQLInternalConstraintViolatedError(GraphQLErrorObject): """Returned when certain API-specific constraints were not met. For example, the specified [Discount Code](ctp:api:type:DiscountCode) was never applied and cannot be updated.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="InternalConstraintViolated", **kwargs) @@ -4395,12 +4493,13 @@ class GraphQLInvalidCredentialsError(GraphQLErrorObject): The error is returned as a failed response to: - - [Authenticate a global Customer (Sign-in)](/../api/projects/customers#authenticate-sign-in-customer) and [Authenticate Customer (Sign-in) in a Store](/../api/projects/customers#authenticate-sign-in-customer-in-store) requests on Customers. - - [Authenticating Customer (Sign-in)](/../api/projects/me-profile#authenticate-sign-in-customer) and [Authenticate Customer (Sign-in) in a Store](/../api/projects/me-profile#authenticate-sign-in-customer-in-store) requests on My Customer Profile. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/login:POST) requests on Customers. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/me/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/login:POST) requests on My Customer Profile. """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="InvalidCredentials", **kwargs) @@ -4423,12 +4522,13 @@ class GraphQLInvalidCurrentPasswordError(GraphQLErrorObject): The error is returned as a failed response to: - - [Change Customer Password](/../api/projects/customers#change-password-of-customer) and [Change Customer Password in a Store](/../api/projects/customers#change-password-of-customer-in-store) requests on Customers. - - [Change Customer Password](/../api/projects/me-profile#change-password-of-customer) and [Change Customer Password in a Store](/../api/projects/me-profile#change-password-of-customer-in-store) requests on My Customer Profile. + - [Change Customer Password](ctp:api:endpoint:/{projectKey}/customers/password:POST) and [Change Customer Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password:POST) requests on Customers. + - [Change Customer Password](ctp:api:endpoint:/{projectKey}/me/password:POST) and [Change Customer Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/password:POST) requests on My Customer Profile. """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="InvalidCurrentPassword", **kwargs) @@ -4488,6 +4588,7 @@ class GraphQLInvalidInputError(GraphQLErrorObject): """Returned when an invalid input has been sent.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="InvalidInput", **kwargs) @@ -4508,7 +4609,17 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLInvalidItemShippingDetailsError(GraphQLErrorObject): """Returned when Line Item or Custom Line Item quantities set under [ItemShippingDetails](ctp:api:type:ItemShippingDetails) do not match the sum of the quantities in their respective shipping details. - The error is returned as a failed response to the [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests. + When a Cart is frozen, the error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [My Carts](ctp:api:type:MyCartUpdateAction). + + The error is also returned as a failed response to: + + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST) requests and [Add LineItem](ctp:api:type:CartAddLineItemAction), [Add CustomLineItem](ctp:api:type:CartAddCustomLineItemAction), [Set LineItem ShippingDetails](ctp:api:type:CartSetLineItemShippingDetailsAction), [Set CustomLineItem ShippingDetails](ctp:api:type:CartSetCustomLineItemShippingDetailsAction), [Add Shopping List](ctp:api:type:CartAddShoppingListAction), and [Remove LineItem](ctp:api:type:CartRemoveLineItemAction) update actions on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) requests, and [Add LineItem](ctp:api:type:MyCartAddLineItemAction), [Set LineItem ShippingDetails](ctp:api:type:MyCartSetLineItemShippingDetailsAction), and [Remove LineItem](ctp:api:type:MyCartRemoveLineItemAction) update actions on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) request on Associate Carts. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST), and [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction), [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction), [Set LineItem ShippingDetails](ctp:api:type:StagedOrderSetLineItemShippingDetailsAction), [Set CustomLineItem ShippingDetails](ctp:api:type:StagedOrderSetCustomLineItemShippingDetailsAction), [Add Shopping List](ctp:api:type:StagedOrderAddShoppingListAction), and [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update actions on Order Edits. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) and [Create Order from Quote in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/quotes:POST) requests on Associate Orders. """ @@ -4575,6 +4686,7 @@ class GraphQLInvalidOperationError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="InvalidOperation", **kwargs) @@ -4593,7 +4705,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLInvalidSubjectError(GraphQLErrorObject): + def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="InvalidSubject", **kwargs) @@ -4612,7 +4726,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLInvalidTokenError(GraphQLErrorObject): + def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="invalid_token", **kwargs) @@ -4638,6 +4754,7 @@ class GraphQLLanguageUsedInStoresError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="LanguageUsedInStores", **kwargs) @@ -4655,15 +4772,50 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return GraphQLLanguageUsedInStoresErrorSchema().dump(self) +class GraphQLLockedFieldError(GraphQLErrorObject): + """Returned when two [Customers](ctp:api:type:Customer) are simultaneously created or updated with the same email address. + + To confirm if the operation was successful, repeat the request. + + """ + + #: Field that is currently locked. + field: str + + def __init__(self, *, field: str, **kwargs): + self.field = field + kwargs.pop("code", None) + super().__init__(code="LockedField", **kwargs) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "GraphQLLockedFieldError": + from ._schemas.error import GraphQLLockedFieldErrorSchema + + return GraphQLLockedFieldErrorSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.error import GraphQLLockedFieldErrorSchema + + return GraphQLLockedFieldErrorSchema().dump(self) + + class GraphQLMatchingPriceNotFoundError(GraphQLErrorObject): """Returned when the Product Variant does not have a Price according to the [Product](ctp:api:type:Product) `priceMode` value for a selected currency, country, Customer Group, or Channel. - The error is returned as a failed response to: + The error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [Staged Orders](ctp:api:type:StagedOrderUpdateAction). - - [Add LineItem](ctp:api:type:CartAddLineItemAction), [Add CustomLineItem](ctp:api:type:CartAddCustomLineItemAction), and [Add DiscountCode](ctp:api:type:CartAddDiscountCodeAction) update actions on Carts. - - [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction), [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction), and [Add DiscountCode](ctp:api:type:StagedOrderAddDiscountCodeAction) update actions on Order Edits. + The error is also returned as a failed response to: + + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/login:POST) requests and [Set CustomerGroup](ctp:api:type:CustomerSetCustomerGroupAction) update action on Customers. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/me/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/login:POST) requests on My Customer Profile. + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST), [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST), [Replicate Cart](ctp:api:endpoint:/{projectKey}/carts/replicate:POST), and [Replicate Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts/replicate:POST) requests on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) and [Replicate My Cart](ctp:api:endpoint:/{projectKey}/me/carts/replicate:POST) requests on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) and [Replicate Cart in Business Unit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/replicate:POST) requests on Associate Carts. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ @@ -4725,6 +4877,7 @@ class GraphQLMaxCartDiscountsReachedError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="MaxCartDiscountsReached", **kwargs) @@ -4782,6 +4935,7 @@ class GraphQLMaxStoreReferencesReachedError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="MaxStoreReferencesReached", **kwargs) @@ -4803,12 +4957,12 @@ class GraphQLMissingRoleOnChannelError(GraphQLErrorObject): """Returned when one of the following states occur: - [Channel](ctp:api:type:Channel) is added or set on a [Store](ctp:api:type:Store) with missing Channel `roles`. - - [Standalone Price](/../api/projects/standalone-prices#create-standaloneprice) references a Channel that does not contain the `ProductDistribution` role. + - [Standalone Price](ctp:api:type:StandalonePrice) references a Channel that does not contain the `ProductDistribution` role. The error is returned as a failed response to: - [Add Distribution Channel](ctp:api:type:StoreAddDistributionChannelAction), [Set Distribution Channel](ctp:api:type:StoreSetDistributionChannelsAction), [Add Supply Channel](ctp:api:type:StoreAddSupplyChannelAction), and [Set Supply Channel](ctp:api:type:StoreSetSupplyChannelsAction) update actions. - - [Create a Standalone Price](/../api/projects/standalone-prices#create-standaloneprice) request. + - [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request. """ @@ -4847,10 +5001,18 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLMissingTaxRateForCountryError(GraphQLErrorObject): """Returned when the Tax Category of at least one of the `lineItems`, `customLineItems`, or `shippingInfo` in the [Cart](ctp:api:type:Cart) is missing the [TaxRate](ctp:api:type:TaxRate) matching `country` and `state` given in the `shippingAddress` of that Cart. - The error is returned as a failed response to: + The error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [Staged Orders](ctp:api:type:StagedOrderUpdateAction). + + The error is also returned as a failed response to: - - [Set Default Shipping Address](ctp:api:type:CustomerSetDefaultShippingAddressAction), [Add LineItem](ctp:api:type:CartAddLineItemAction), [Add CustomLineItem](ctp:api:type:CartAddCustomLineItemAction), [Set Shipping Address](ctp:api:type:CartSetShippingAddressAction), [Add LineItem](ctp:api:type:MyCartAddLineItemAction), [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction), and [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction) update actions - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/login:POST) requests and [Set CustomerGroup](ctp:api:type:CustomerSetCustomerGroupAction) update action on Customers. + - [Authenticate (sign in) Customer](ctp:api:endpoint:/{projectKey}/me/login:POST) and [Authenticate (sign in) Customer in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/login:POST) on My Customer Profile. + - [Create Cart](ctp:api:endpoint:/{projectKey}/carts:POST), [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts:POST), [Replicate Cart](ctp:api:endpoint:/{projectKey}/carts/replicate:POST), and [Replicate Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts/replicate:POST) requests on Carts. + - [Create Cart](ctp:api:endpoint:/{projectKey}/me/carts:POST) and [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/me/carts:POST) and [Replicate My Cart](ctp:api:endpoint:/{projectKey}/me/carts/replicate:POST) requests on My Carts. + - [Create Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts:POST) and [Replicate Cart in Business Unit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/replicate:POST) requests on Associate Carts. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) requests on Associate Orders. """ @@ -4896,6 +5058,7 @@ class GraphQLMoneyOverflowError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="MoneyOverflow", **kwargs) @@ -4916,11 +5079,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLNoMatchingProductDiscountFoundError(GraphQLErrorObject): """Returned when a Product Discount could not be found that could be applied to the Price of a Product Variant. - The error is returned as a failed response to the [Get Matching ProductDiscount](/../api/projects/productDiscounts#get-matching-productdiscount) request. + The error is returned as a failed response to the [Get Matching ProductDiscount](ctp:api:endpoint:/{projectKey}/product-discounts/matching:POST) request. """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="NoMatchingProductDiscountFound", **kwargs) @@ -4938,31 +5102,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return GraphQLNoMatchingProductDiscountFoundErrorSchema().dump(self) -class GraphQLNotEnabledError(GraphQLErrorObject): - """Returned when the [Project-specific category recommendations feature](/../api/projects/categoryRecommendations#project-specific-category-recommendations) is not enabled for the Project.""" - - def __init__(self, **kwargs): - kwargs.pop("code", None) - super().__init__(code="NotEnabled", **kwargs) - - @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "GraphQLNotEnabledError": - from ._schemas.error import GraphQLNotEnabledErrorSchema - - return GraphQLNotEnabledErrorSchema().load(data) - - def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.error import GraphQLNotEnabledErrorSchema - - return GraphQLNotEnabledErrorSchema().dump(self) - - class GraphQLObjectNotFoundError(GraphQLErrorObject): """Returned when the requested resource was not found.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="ObjectNotFound", **kwargs) @@ -4985,8 +5129,9 @@ class GraphQLOutOfStockError(GraphQLErrorObject): The error is returned as a failed response to: - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), and [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) requests on Orders. - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST), and [Create Order by Import](ctp:api:endpoint:/{projectKey}/orders/import:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) and [Create Order from Quote in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/quotes:POST) requests on Associate Orders. """ @@ -5025,6 +5170,7 @@ class GraphQLOverCapacityError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="OverCapacity", **kwargs) @@ -5046,7 +5192,7 @@ class GraphQLOverlappingStandalonePriceValidityError(GraphQLErrorObject): """Returned when a given Price validity period conflicts with an existing one. Every Standalone Price associated with the same SKU and with the same combination of currency, country, Customer Group, and Channel, must have non-overlapping validity periods (`validFrom` and `validUntil`). - The error is returned as a failed response to the [Create StandalonePrice](/../api/projects/standalone-prices#create-standaloneprice) request. + The error is returned as a failed response to the [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request. """ @@ -5117,11 +5263,12 @@ class GraphQLPendingOperationError(GraphQLErrorObject): """Returned when a previous conflicting operation is still pending and needs to finish before the request can succeed. The client application should retry the request with exponential backoff up to a point where further delay is unacceptable. - If the error persists, report it using the [Support Portal](https://support.commercetools.com). + If the error persists, report it to the [Composable Commerce support team](https://support.commercetools.com). """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="PendingOperation", **kwargs) @@ -5140,12 +5287,15 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLPriceChangedError(GraphQLErrorObject): - """Returned when the Price, Tax Rate, or Shipping Rate of some Line Items changed since they were last added to the Cart. + """Returned when the Price or Tax Rate of some Line Items or Shipping Rate of some Shipping Methods changed since they were last added to the Cart. - The error is returned as a failed response to: + When a Cart is frozen, the error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [My Carts](ctp:api:type:MyCartUpdateAction). - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. - - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + The error is also returned as a failed response to: + + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/orders/quotes:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST), [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST), and [Create Order from Quote](ctp:api:endpoint:/{projectKey}/me/orders/quotes:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ @@ -5280,7 +5430,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLQueryComplexityLimitExceededError(GraphQLErrorObject): + def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="QueryComplexityLimitExceeded", **kwargs) @@ -5306,6 +5458,7 @@ class GraphQLQueryTimedOutError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="QueryTimedOut", **kwargs) @@ -5417,6 +5570,7 @@ class GraphQLResourceNotFoundError(GraphQLErrorObject): """Returned when the resource addressed by the request URL does not exist.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="ResourceNotFound", **kwargs) @@ -5438,6 +5592,7 @@ class GraphQLResourceSizeLimitExceededError(GraphQLErrorObject): """Returned when the resource exceeds the maximum allowed size of 16 MB.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="ResourceSizeLimitExceeded", **kwargs) @@ -5463,6 +5618,7 @@ class GraphQLSearchDeactivatedError(GraphQLErrorObject): """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="SearchDeactivated", **kwargs) @@ -5484,6 +5640,7 @@ class GraphQLSearchExecutionFailureError(GraphQLErrorObject): """Returned when a search query could not be completed due to an unexpected failure.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="SearchExecutionFailure", **kwargs) @@ -5505,6 +5662,7 @@ class GraphQLSearchFacetPathNotFoundError(GraphQLErrorObject): """Returned when a search facet path could not be found.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="SearchFacetPathNotFound", **kwargs) @@ -5526,6 +5684,7 @@ class GraphQLSearchIndexingInProgressError(GraphQLErrorObject): """Returned when the indexing of Product information is still in progress for Projects that have indexing activated.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="SearchIndexingInProgress", **kwargs) @@ -5547,6 +5706,7 @@ class GraphQLSemanticErrorError(GraphQLErrorObject): """Returned when a [Discount predicate](/../api/predicates/predicate-operators) or [API Extension predicate](/../api/predicates/query#using-predicates-in-conditional-api-extensions) is not semantically correct.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="SemanticError", **kwargs) @@ -5567,11 +5727,18 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class GraphQLShippingMethodDoesNotMatchCartError(GraphQLErrorObject): """Returned when the Cart contains a [ShippingMethod](ctp:api:type:ShippingMethod) that is not allowed for the [Cart](ctp:api:type:Cart). In this case, the [ShippingMethodState](ctp:api:type:ShippingMethodState) value is `DoesNotMatchCart`. - The error is returned as a failed response to the [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) or [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests. + When a Cart is frozen, the error can be returned as a failed response to all update actions on [Carts](ctp:api:type:CartUpdateAction) and [My Carts](ctp:api:type:MyCartUpdateAction). + + The error is also returned as a failed response to: + + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/orders:POST) requests on Orders. + - [Create Order from Cart](ctp:api:endpoint:/{projectKey}/me/orders:POST) and [Create Order in Store from Cart](ctp:api:endpoint:/{projectKey}/in-store/me/orders:POST) requests on My Orders. + - [Create Order from Cart in BusinessUnit](ctp:api:endpoint:/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders:POST) request on Associate Orders. """ def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="ShippingMethodDoesNotMatchCart", **kwargs) @@ -5625,6 +5792,7 @@ class GraphQLSyntaxErrorError(GraphQLErrorObject): """Returned when a [Discount predicate](/../api/predicates/predicate-operators), [API Extension predicate](/../api/predicates/query#using-predicates-in-conditional-api-extensions), or [search query](/../api/projects/products-search) does not have the correct syntax.""" def __init__(self, **kwargs): + kwargs.pop("code", None) super().__init__(code="SyntaxError", **kwargs) diff --git a/src/commercetools/platform/models/extension.py b/src/commercetools/platform/models/extension.py index 10e190ab..528ac6b3 100644 --- a/src/commercetools/platform/models/extension.py +++ b/src/commercetools/platform/models/extension.py @@ -40,9 +40,9 @@ class Extension(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Extension. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Extension. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the Extension. key: typing.Optional[str] @@ -174,7 +174,7 @@ class ExtensionDraft(_BaseType): #: The maximum value is 10000 ms (10 seconds) for `payment` Extensions and 2000 ms (2 seconds) for all other Extensions. #: #: This limit can be increased per Project after we review the performance impact. - #: Please contact our support via the [Support Portal](https://support.commercetools.com) and provide the Region, Project key, and use case. + #: Please contact the [Composable Commerce support team](https://support.commercetools.com) and provide the Region, Project key, and use case. timeout_in_ms: typing.Optional[int] def __init__( @@ -324,7 +324,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ExtensionUpdate(_BaseType): - #: Expected version of the Extension on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the Extension on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Extension. actions: typing.List["ExtensionUpdateAction"] @@ -595,7 +596,7 @@ class ExtensionSetTimeoutInMsAction(ExtensionUpdateAction): #: The maximum value is 10000 ms (10 seconds) for `payment` Extensions and 2000 ms (2 seconds) for all other Extensions. #: #: This limit can be increased per Project after we review the performance impact. - #: Please contact our support via the [Support Portal](https://support.commercetools.com/) and provide the Region, Project key, and use case. + #: Please contact the [Composable Commerce support team](https://support.commercetools.com/) and provide the Region, Project key, and use case. timeout_in_ms: typing.Optional[int] def __init__(self, *, timeout_in_ms: typing.Optional[int] = None): diff --git a/src/commercetools/platform/models/inventory.py b/src/commercetools/platform/models/inventory.py index 17401517..deb2fc79 100644 --- a/src/commercetools/platform/models/inventory.py +++ b/src/commercetools/platform/models/inventory.py @@ -43,9 +43,9 @@ class InventoryEntry(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the InventoryEntry. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the InventoryEntry. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the InventoryEntry. key: typing.Optional[str] @@ -192,6 +192,7 @@ class InventoryEntryResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.INVENTORY_ENTRY) @classmethod @@ -209,7 +210,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InventoryEntryUpdate(_BaseType): - #: Expected version of the InventoryEntry on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the InventoryEntry on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the InventoryEntry. actions: typing.List["InventoryEntryUpdateAction"] diff --git a/src/commercetools/platform/models/me.py b/src/commercetools/platform/models/me.py index 440c9f87..44b40bf8 100644 --- a/src/commercetools/platform/models/me.py +++ b/src/commercetools/platform/models/me.py @@ -11,7 +11,7 @@ from ._abstract import _BaseType from .business_unit import BusinessUnitType -from .cart import InventoryMode, TaxMode +from .cart import InventoryMode, ShippingMode, TaxMode from .payment import TransactionType if typing.TYPE_CHECKING: @@ -29,6 +29,7 @@ InventoryMode, ItemShippingDetailsDraft, ItemShippingTarget, + ShippingMode, TaxMode, ) from .channel import ChannelResourceIdentifier @@ -184,7 +185,8 @@ class MyBusinessUnitAssociateDraft(_BaseType): - #: Expected version of the BusinessUnit on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: Expected version of the BusinessUnit on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: [Customer](ctp:api:type:Customer) to create and assign to the Business Unit. customer: "MyCustomerDraft" @@ -228,7 +230,7 @@ class MyBusinessUnitDraft(_BaseType): #: Email address of the Business Unit. contact_email: typing.Optional[str] #: Custom Fields for the Business Unit. - custom: typing.Optional["CustomFields"] + custom: typing.Optional["CustomFieldsDraft"] #: Addresses used by the Business Unit. addresses: typing.Optional[typing.List["BaseAddress"]] #: Indexes of entries in `addresses` to set as shipping addresses. @@ -249,7 +251,7 @@ def __init__( unit_type: "BusinessUnitType", name: str, contact_email: typing.Optional[str] = None, - custom: typing.Optional["CustomFields"] = None, + custom: typing.Optional["CustomFieldsDraft"] = None, addresses: typing.Optional[typing.List["BaseAddress"]] = None, shipping_addresses: typing.Optional[typing.List["int"]] = None, default_shipping_address: typing.Optional[int] = None, @@ -288,7 +290,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyBusinessUnitUpdate(_BaseType): #: Expected version of the BusinessUnit on which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the BusinessUnit. actions: typing.List["BusinessUnitUpdateAction"] @@ -437,9 +439,12 @@ class MyCartDraft(_BaseType): #: #: Eligible Shipping Methods or applicable Tax Rates are determined by the [Cart](ctp:api:type:Cart) `shippingAddress`, and not `itemShippingAddresses`. item_shipping_addresses: typing.Optional[typing.List["BaseAddress"]] + #: - If set to `Single`, only a single Shipping Method can be added to the Cart. + #: - If set to `Multiple`, multiple Shipping Methods can be added to the Cart. + shipping_mode: typing.Optional["ShippingMode"] #: `code` of the existing [DiscountCodes](ctp:api:type:DiscountCode) to add to the Cart. discount_codes: typing.Optional[typing.List["str"]] - #: Used for [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: Used for [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). #: If used for [Create Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/me/carts:POST), the provided country must be one of the [Store's](ctp:api:type:Store) `countries`. country: typing.Optional[str] #: Languages of the Cart. @@ -467,6 +472,7 @@ def __init__( shipping_address: typing.Optional["BaseAddress"] = None, shipping_method: typing.Optional["ShippingMethodResourceIdentifier"] = None, item_shipping_addresses: typing.Optional[typing.List["BaseAddress"]] = None, + shipping_mode: typing.Optional["ShippingMode"] = None, discount_codes: typing.Optional[typing.List["str"]] = None, country: typing.Optional[str] = None, locale: typing.Optional[str] = None, @@ -484,6 +490,7 @@ def __init__( self.shipping_address = shipping_address self.shipping_method = shipping_method self.item_shipping_addresses = item_shipping_addresses + self.shipping_mode = shipping_mode self.discount_codes = discount_codes self.country = country self.locale = locale @@ -506,7 +513,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCartUpdate(_BaseType): #: Expected version of the Cart on which the changes apply. - #: If it does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error is returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Cart. actions: typing.List["MyCartUpdateAction"] @@ -676,13 +683,14 @@ def __init__( key: str, name: str, contact_email: typing.Optional[str] = None, - custom: typing.Optional["CustomFields"] = None, + custom: typing.Optional["CustomFieldsDraft"] = None, addresses: typing.Optional[typing.List["BaseAddress"]] = None, shipping_addresses: typing.Optional[typing.List["int"]] = None, default_shipping_address: typing.Optional[int] = None, billing_addresses: typing.Optional[typing.List["int"]] = None, default_billing_address: typing.Optional[int] = None ): + super().__init__( key=key, name=name, @@ -797,7 +805,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCustomerUpdate(_BaseType): - #: Expected version of the Customer on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: Expected version of the Customer on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Customer. actions: typing.List["MyCustomerUpdateAction"] @@ -938,7 +947,7 @@ def __init__( key: str, name: str, contact_email: typing.Optional[str] = None, - custom: typing.Optional["CustomFields"] = None, + custom: typing.Optional["CustomFieldsDraft"] = None, addresses: typing.Optional[typing.List["BaseAddress"]] = None, shipping_addresses: typing.Optional[typing.List["int"]] = None, default_shipping_address: typing.Optional[int] = None, @@ -995,7 +1004,7 @@ class MyLineItemDraft(_BaseType): #: Used to identify [Inventory entries](/../api/projects/inventory) that must be reserved. #: The Channel must have the `InventorySupply` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). supply_channel: typing.Optional["ChannelResourceIdentifier"] - #: Used to [select](ctp:api:type:LineItemPriceSelection) a Product Price. + #: Used to [select](/../api/pricing-and-discounts-overview#line-item-price-selection) a Product Price. #: The Channel must have the `ProductDistribution` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). #: #: If the Cart is bound to a [Store](ctp:api:type:Store) with `distributionChannels` set, @@ -1244,7 +1253,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyPaymentUpdate(_BaseType): - #: Expected version of the Payment on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: Expected version of the Payment on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Payment. actions: typing.List["MyPaymentUpdateAction"] @@ -1397,7 +1407,7 @@ class MyQuoteState(enum.Enum): class MyQuoteUpdate(_BaseType): #: Expected version of the [Quote](ctp:api:type:Quote) to which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the [Quote](ctp:api:type:Quote). actions: typing.List["MyQuoteUpdateAction"] @@ -1499,7 +1509,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyShoppingListUpdate(_BaseType): - #: Expected version of the ShoppingList on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: Expected version of the ShoppingList on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: List of update actions to be performed on the ShoppingList. actions: typing.List["MyShoppingListUpdateAction"] @@ -2312,8 +2323,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCartAddLineItemAction(MyCartUpdateAction): """If the Cart contains a [LineItem](ctp:api:type:LineItem) for a Product Variant with the same [LineItemMode](ctp:api:type:LineItemMode), [Custom Fields](/../api/projects/custom-fields), supply and distribution channel, then only the quantity of the existing Line Item is increased. If [LineItem](ctp:api:type:LineItem) `shippingDetails` is set, it is merged. All addresses will be present afterwards and, for address keys present in both shipping details, the quantity will be summed up. - A new Line Item is added when the `externalPrice` or `externalTotalPrice` is set in this update action. - The [LineItem](ctp:api:type:LineItem) price is set as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + The [LineItem](ctp:api:type:LineItem) price is set as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). If the Tax Rate is not set, a [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) error is returned. @@ -2344,7 +2354,7 @@ class MyCartAddLineItemAction(MyCartUpdateAction): #: #: Optional for backwards compatibility reasons. added_at: typing.Optional[datetime.datetime] - #: Used to [select](ctp:api:type:LineItemPriceSelection) a Product Price. + #: Used to [select](/../api/pricing-and-discounts-overview#line-item-price-selection) a Product Price. #: The Channel must have the `ProductDistribution` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). #: If the Cart is bound to a [Store](ctp:api:type:Store) with `distributionChannels` set, the Channel must match one of the Store's distribution channels. distribution_channel: typing.Optional["ChannelResourceIdentifier"] @@ -2633,7 +2643,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCartRemoveLineItemAction(MyCartUpdateAction): - """The [LineItem](ctp:api:type:LineItem) price is updated as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection).""" + """The [LineItem](ctp:api:type:LineItem) price is updated as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection).""" #: `id` of the [LineItem](ctp:api:type:LineItem) to update. Either `lineItemId` or `lineItemKey` is required. line_item_id: typing.Optional[str] @@ -2982,7 +2992,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCartSetLineItemDistributionChannelAction(MyCartUpdateAction): - """Setting a distribution channel for a [LineItem](ctp:api:type:LineItem) can lead to an updated `price` as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection).""" + """Setting a distribution channel for a [LineItem](ctp:api:type:LineItem) can lead to an updated `price` as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection).""" #: `id` of the [LineItem](ctp:api:type:LineItem) to update. Either `lineItemId` or `lineItemKey` is required. line_item_id: typing.Optional[str] @@ -3121,7 +3131,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCartSetShippingAddressAction(MyCartUpdateAction): """Setting the shipping address also sets the [TaxRate](ctp:api:type:TaxRate) of Line Items and calculates the [TaxedPrice](ctp:api:type:TaxedPrice). - If a matching price cannot be found for the given shipping address during [Line Item Price selection](ctp:api:type:LineItemPriceSelection), + If a matching price cannot be found for the given shipping address during [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection), a [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) error is returned. If you want to allow shipping to states inside a country that are not explicitly covered by a TaxRate, @@ -3669,7 +3679,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCustomerSetFirstNameAction(MyCustomerUpdateAction): - """Setting the first name of the Customer produces the [CustomerFirstNameSetMessage](ctp:api:type:CustomerFirstNameSetMessage).""" + """Setting the first name of the Customer produces the [CustomerFirstNameSet](ctp:api:type:CustomerFirstNameSetMessage) Message.""" #: Value to set. #: If empty, any existing value is removed. @@ -3695,7 +3705,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class MyCustomerSetLastNameAction(MyCustomerUpdateAction): - """Setting the last name of the Customer produces the [CustomerLastNameSetMessage](ctp:api:type:CustomerLastNameSetMessage).""" + """Setting the last name of the Customer produces the [CustomerLastNameSet](ctp:api:type:CustomerLastNameSetMessage) Message.""" #: Value to set. #: If empty, any existing value is removed. @@ -4052,6 +4062,7 @@ class MyQuoteRequestCancelAction(MyQuoteRequestUpdateAction): """Transitions the `quoteRequestState` of the Quote Request to `Cancelled`. Can only be used when the Quote Request is in state `Submitted`.""" def __init__(self): + super().__init__(action="cancelQuoteRequest") @classmethod diff --git a/src/commercetools/platform/models/message.py b/src/commercetools/platform/models/message.py index 4c01a0e0..54268357 100644 --- a/src/commercetools/platform/models/message.py +++ b/src/commercetools/platform/models/message.py @@ -14,6 +14,7 @@ from .approval_rule import ApprovalRuleStatus from .associate_role import Permission from .business_unit import ( + BusinessUnitApprovalRuleMode, BusinessUnitAssociateMode, BusinessUnitStatus, BusinessUnitStoreMode, @@ -39,6 +40,7 @@ from .business_unit import ( Associate, BusinessUnit, + BusinessUnitApprovalRuleMode, BusinessUnitAssociateMode, BusinessUnitKeyReference, BusinessUnitStatus, @@ -56,6 +58,7 @@ ShippingRateInput, TaxedItemPrice, ) + from .cart_discount import CartDiscount from .category import Category, CategoryReference from .channel import ChannelReference from .common import ( @@ -66,14 +69,14 @@ Image, LastModifiedBy, LocalizedString, - Money, Price, PriceTier, Reference, + TypedMoney, ) from .customer import Customer, CustomerReference from .customer_group import CustomerGroupReference - from .discount_code import DiscountCodeReference + from .discount_code import DiscountCode, DiscountCodeReference from .inventory import InventoryEntry from .order import ( Delivery, @@ -103,6 +106,7 @@ ProductVariantExclusion, ProductVariantSelection, ) + from .product_tailoring import ProductVariantTailoring from .quote import Quote, QuoteState from .quote_request import QuoteRequest, QuoteRequestState from .review import Review @@ -168,6 +172,8 @@ "BusinessUnitAddressCustomTypeSetMessagePayload", "BusinessUnitAddressRemovedMessage", "BusinessUnitAddressRemovedMessagePayload", + "BusinessUnitApprovalRuleModeChangedMessage", + "BusinessUnitApprovalRuleModeChangedMessagePayload", "BusinessUnitAssociateAddedMessage", "BusinessUnitAssociateAddedMessagePayload", "BusinessUnitAssociateChangedMessage", @@ -220,6 +226,16 @@ "BusinessUnitStoreRemovedMessagePayload", "BusinessUnitStoresSetMessage", "BusinessUnitStoresSetMessagePayload", + "CartDiscountCreatedMessage", + "CartDiscountCreatedMessagePayload", + "CartDiscountDeletedMessage", + "CartDiscountDeletedMessagePayload", + "CartDiscountStoreAddedMessage", + "CartDiscountStoreAddedMessagePayload", + "CartDiscountStoreRemovedMessage", + "CartDiscountStoreRemovedMessagePayload", + "CartDiscountStoresSetMessage", + "CartDiscountStoresSetMessagePayload", "CategoryCreatedMessage", "CategoryCreatedMessagePayload", "CategorySlugChangedMessage", @@ -297,6 +313,12 @@ "DeliveryItemsUpdatedMessagePayload", "DeliveryRemovedMessage", "DeliveryRemovedMessagePayload", + "DiscountCodeCreatedMessage", + "DiscountCodeCreatedMessagePayload", + "DiscountCodeDeletedMessage", + "DiscountCodeDeletedMessagePayload", + "DiscountCodeKeySetMessage", + "DiscountCodeKeySetMessagePayload", "InventoryEntryCreatedMessage", "InventoryEntryCreatedMessagePayload", "InventoryEntryDeletedMessage", @@ -416,6 +438,16 @@ "ProductPriceAddedMessagePayload", "ProductPriceChangedMessage", "ProductPriceChangedMessagePayload", + "ProductPriceCustomFieldAddedMessage", + "ProductPriceCustomFieldAddedMessagePayload", + "ProductPriceCustomFieldChangedMessage", + "ProductPriceCustomFieldChangedMessagePayload", + "ProductPriceCustomFieldRemovedMessage", + "ProductPriceCustomFieldRemovedMessagePayload", + "ProductPriceCustomFieldsRemovedMessage", + "ProductPriceCustomFieldsRemovedMessagePayload", + "ProductPriceCustomFieldsSetMessage", + "ProductPriceCustomFieldsSetMessagePayload", "ProductPriceDiscountsSetMessage", "ProductPriceDiscountsSetMessagePayload", "ProductPriceDiscountsSetUpdatedPrice", @@ -453,12 +485,34 @@ "ProductSlugChangedMessagePayload", "ProductStateTransitionMessage", "ProductStateTransitionMessagePayload", + "ProductTailoringCreatedMessage", + "ProductTailoringCreatedMessagePayload", + "ProductTailoringDeletedMessage", + "ProductTailoringDeletedMessagePayload", + "ProductTailoringDescriptionSetMessage", + "ProductTailoringDescriptionSetMessagePayload", + "ProductTailoringImageAddedMessage", + "ProductTailoringImageAddedMessagePayload", + "ProductTailoringImagesSetMessage", + "ProductTailoringImagesSetMessagePayload", + "ProductTailoringNameSetMessage", + "ProductTailoringNameSetMessagePayload", + "ProductTailoringPublishedMessage", + "ProductTailoringPublishedMessagePayload", + "ProductTailoringSlugSetMessage", + "ProductTailoringSlugSetMessagePayload", + "ProductTailoringUnpublishedMessage", + "ProductTailoringUnpublishedMessagePayload", "ProductUnpublishedMessage", "ProductUnpublishedMessagePayload", "ProductVariantAddedMessage", "ProductVariantAddedMessagePayload", "ProductVariantDeletedMessage", "ProductVariantDeletedMessagePayload", + "ProductVariantTailoringAddedMessage", + "ProductVariantTailoringAddedMessagePayload", + "ProductVariantTailoringRemovedMessage", + "ProductVariantTailoringRemovedMessagePayload", "QuoteCreatedMessage", "QuoteCreatedMessagePayload", "QuoteCustomerChangedMessage", @@ -583,9 +637,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class Message(BaseResource): """Base representation of a Message containing common fields to all [Message Types](/../api/projects/messages#message-types).""" - #: Value of `createdBy`. + #: IDs and references that last modified the Message. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the Message. created_by: typing.Optional["CreatedBy"] #: Message number in relation to other Messages for a given resource. The `sequenceNumber` of the next Message for the resource is the successor of the `sequenceNumber` of the current Message. Meaning, the `sequenceNumber` of the next Message equals the `sequenceNumber` of the current Message + 1. #: `sequenceNumber` can be used to ensure that Messages are processed in the correct order for a particular resource. @@ -751,6 +805,12 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Message": from ._schemas.message import BusinessUnitAddressRemovedMessageSchema return BusinessUnitAddressRemovedMessageSchema().load(data) + if data["type"] == "BusinessUnitApprovalRuleModeChanged": + from ._schemas.message import ( + BusinessUnitApprovalRuleModeChangedMessageSchema, + ) + + return BusinessUnitApprovalRuleModeChangedMessageSchema().load(data) if data["type"] == "BusinessUnitAssociateAdded": from ._schemas.message import BusinessUnitAssociateAddedMessageSchema @@ -861,6 +921,26 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Message": from ._schemas.message import BusinessUnitStoresSetMessageSchema return BusinessUnitStoresSetMessageSchema().load(data) + if data["type"] == "CartDiscountCreated": + from ._schemas.message import CartDiscountCreatedMessageSchema + + return CartDiscountCreatedMessageSchema().load(data) + if data["type"] == "CartDiscountDeleted": + from ._schemas.message import CartDiscountDeletedMessageSchema + + return CartDiscountDeletedMessageSchema().load(data) + if data["type"] == "CartDiscountStoreAdded": + from ._schemas.message import CartDiscountStoreAddedMessageSchema + + return CartDiscountStoreAddedMessageSchema().load(data) + if data["type"] == "CartDiscountStoreRemoved": + from ._schemas.message import CartDiscountStoreRemovedMessageSchema + + return CartDiscountStoreRemovedMessageSchema().load(data) + if data["type"] == "CartDiscountStoresSet": + from ._schemas.message import CartDiscountStoresSetMessageSchema + + return CartDiscountStoresSetMessageSchema().load(data) if data["type"] == "CategoryCreated": from ._schemas.message import CategoryCreatedMessageSchema @@ -993,6 +1073,18 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Message": from ._schemas.message import CustomerTitleSetMessageSchema return CustomerTitleSetMessageSchema().load(data) + if data["type"] == "DiscountCodeCreated": + from ._schemas.message import DiscountCodeCreatedMessageSchema + + return DiscountCodeCreatedMessageSchema().load(data) + if data["type"] == "DiscountCodeDeleted": + from ._schemas.message import DiscountCodeDeletedMessageSchema + + return DiscountCodeDeletedMessageSchema().load(data) + if data["type"] == "DiscountCodeKeySet": + from ._schemas.message import DiscountCodeKeySetMessageSchema + + return DiscountCodeKeySetMessageSchema().load(data) if data["type"] == "InventoryEntryCreated": from ._schemas.message import InventoryEntryCreatedMessageSchema @@ -1057,6 +1149,26 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Message": from ._schemas.message import ProductPriceChangedMessageSchema return ProductPriceChangedMessageSchema().load(data) + if data["type"] == "ProductPriceCustomFieldAdded": + from ._schemas.message import ProductPriceCustomFieldAddedMessageSchema + + return ProductPriceCustomFieldAddedMessageSchema().load(data) + if data["type"] == "ProductPriceCustomFieldChanged": + from ._schemas.message import ProductPriceCustomFieldChangedMessageSchema + + return ProductPriceCustomFieldChangedMessageSchema().load(data) + if data["type"] == "ProductPriceCustomFieldRemoved": + from ._schemas.message import ProductPriceCustomFieldRemovedMessageSchema + + return ProductPriceCustomFieldRemovedMessageSchema().load(data) + if data["type"] == "ProductPriceCustomFieldsRemoved": + from ._schemas.message import ProductPriceCustomFieldsRemovedMessageSchema + + return ProductPriceCustomFieldsRemovedMessageSchema().load(data) + if data["type"] == "ProductPriceCustomFieldsSet": + from ._schemas.message import ProductPriceCustomFieldsSetMessageSchema + + return ProductPriceCustomFieldsSetMessageSchema().load(data) if data["type"] == "ProductPriceDiscountsSet": from ._schemas.message import ProductPriceDiscountsSetMessageSchema @@ -1133,6 +1245,42 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Message": from ._schemas.message import ProductStateTransitionMessageSchema return ProductStateTransitionMessageSchema().load(data) + if data["type"] == "ProductTailoringCreated": + from ._schemas.message import ProductTailoringCreatedMessageSchema + + return ProductTailoringCreatedMessageSchema().load(data) + if data["type"] == "ProductTailoringDeleted": + from ._schemas.message import ProductTailoringDeletedMessageSchema + + return ProductTailoringDeletedMessageSchema().load(data) + if data["type"] == "ProductTailoringDescriptionSet": + from ._schemas.message import ProductTailoringDescriptionSetMessageSchema + + return ProductTailoringDescriptionSetMessageSchema().load(data) + if data["type"] == "ProductTailoringImageAdded": + from ._schemas.message import ProductTailoringImageAddedMessageSchema + + return ProductTailoringImageAddedMessageSchema().load(data) + if data["type"] == "ProductTailoringImagesSet": + from ._schemas.message import ProductTailoringImagesSetMessageSchema + + return ProductTailoringImagesSetMessageSchema().load(data) + if data["type"] == "ProductTailoringNameSet": + from ._schemas.message import ProductTailoringNameSetMessageSchema + + return ProductTailoringNameSetMessageSchema().load(data) + if data["type"] == "ProductTailoringPublished": + from ._schemas.message import ProductTailoringPublishedMessageSchema + + return ProductTailoringPublishedMessageSchema().load(data) + if data["type"] == "ProductTailoringSlugSet": + from ._schemas.message import ProductTailoringSlugSetMessageSchema + + return ProductTailoringSlugSetMessageSchema().load(data) + if data["type"] == "ProductTailoringUnpublished": + from ._schemas.message import ProductTailoringUnpublishedMessageSchema + + return ProductTailoringUnpublishedMessageSchema().load(data) if data["type"] == "ProductUnpublished": from ._schemas.message import ProductUnpublishedMessageSchema @@ -1145,6 +1293,14 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Message": from ._schemas.message import ProductVariantDeletedMessageSchema return ProductVariantDeletedMessageSchema().load(data) + if data["type"] == "ProductVariantTailoringAdded": + from ._schemas.message import ProductVariantTailoringAddedMessageSchema + + return ProductVariantTailoringAddedMessageSchema().load(data) + if data["type"] == "ProductVariantTailoringRemoved": + from ._schemas.message import ProductVariantTailoringRemovedMessageSchema + + return ProductVariantTailoringRemovedMessageSchema().load(data) if data["type"] == "QuoteCreated": from ._schemas.message import QuoteCreatedMessageSchema @@ -2066,7 +2222,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AssociateRoleCreatedMessage(Message): - """Generated after a successful [Create AssociateRole](/projects/associate-roles#create-associaterole) request.""" + """Generated after a successful [Create AssociateRole](ctp:api:endpoint:/{projectKey}/associate-roles:POST) request.""" #: The [AssociateRole](ctp:api:type:AssociateRole) that was created. associate_role: "AssociateRole" @@ -2137,6 +2293,7 @@ def __init__( "UserProvidedIdentifiers" ] = None ): + super().__init__( id=id, version=version, @@ -2490,6 +2647,8 @@ class BusinessUnitAddressCustomFieldAddedMessage(Message): name: str #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). value: typing.Any + #: `id` of the [Address](ctp:api:type:Address) to which the Custom Field was added. + address_id: typing.Optional[str] def __init__( self, @@ -2507,10 +2666,12 @@ def __init__( "UserProvidedIdentifiers" ] = None, name: str, - value: typing.Any + value: typing.Any, + address_id: typing.Optional[str] = None ): self.name = name self.value = value + self.address_id = address_id super().__init__( id=id, @@ -2549,6 +2710,8 @@ class BusinessUnitAddressCustomFieldChangedMessage(Message): value: typing.Any #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:BusinessUnitSetAddressCustomFieldAction) update action. old_value: typing.Optional[typing.Any] + #: `id` of the [Address](ctp:api:type:Address) of which the Custom Field was changed. + address_id: typing.Optional[str] def __init__( self, @@ -2567,11 +2730,13 @@ def __init__( ] = None, name: str, value: typing.Any, - old_value: typing.Optional[typing.Any] = None + old_value: typing.Optional[typing.Any] = None, + address_id: typing.Optional[str] = None ): self.name = name self.value = value self.old_value = old_value + self.address_id = address_id super().__init__( id=id, @@ -2606,6 +2771,8 @@ class BusinessUnitAddressCustomFieldRemovedMessage(Message): #: Name of the Custom Field that was removed. name: str + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Field was removed. + address_id: typing.Optional[str] def __init__( self, @@ -2622,9 +2789,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str + name: str, + address_id: typing.Optional[str] = None ): self.name = name + self.address_id = address_id super().__init__( id=id, @@ -2659,6 +2828,8 @@ class BusinessUnitAddressCustomTypeRemovedMessage(Message): #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. old_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Type was removed. + address_id: typing.Optional[str] def __init__( self, @@ -2675,9 +2846,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - old_type_id: typing.Optional[str] = None + old_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None ): self.old_type_id = old_type_id + self.address_id = address_id super().__init__( id=id, @@ -2714,6 +2887,8 @@ class BusinessUnitAddressCustomTypeSetMessage(Message): custom_fields: "CustomFields" #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. old_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) on which the Custom Field was set. + address_id: typing.Optional[str] def __init__( self, @@ -2731,10 +2906,12 @@ def __init__( "UserProvidedIdentifiers" ] = None, custom_fields: "CustomFields", - old_type_id: typing.Optional[str] = None + old_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None ): self.custom_fields = custom_fields self.old_type_id = old_type_id + self.address_id = address_id super().__init__( id=id, @@ -2817,6 +2994,63 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return BusinessUnitAddressRemovedMessageSchema().dump(self) +class BusinessUnitApprovalRuleModeChangedMessage(Message): + """Generated after a successful [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action.""" + + #: [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit after the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. + approval_rule_mode: "BusinessUnitApprovalRuleMode" + #: [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit before the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. + old_approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + approval_rule_mode: "BusinessUnitApprovalRuleMode", + old_approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] = None + ): + self.approval_rule_mode = approval_rule_mode + self.old_approval_rule_mode = old_approval_rule_mode + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="BusinessUnitApprovalRuleModeChanged", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "BusinessUnitApprovalRuleModeChangedMessage": + from ._schemas.message import BusinessUnitApprovalRuleModeChangedMessageSchema + + return BusinessUnitApprovalRuleModeChangedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import BusinessUnitApprovalRuleModeChangedMessageSchema + + return BusinessUnitApprovalRuleModeChangedMessageSchema().dump(self) + + class BusinessUnitAssociateAddedMessage(Message): """Generated after a successful [Add Associate](ctp:api:type:BusinessUnitAddAssociateAction) update action.""" @@ -3246,7 +3480,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class BusinessUnitCreatedMessage(Message): - """Generated after a successful [Create BusinessUnit](/projects/business-units#create-businessunit) request.""" + """Generated after a successful [Create BusinessUnit](ctp:api:endpoint:/{projectKey}/business-units:POST) request.""" #: The [Business Unit](ctp:api:type:BusinessUnit) that was created. business_unit: "BusinessUnit" @@ -3704,6 +3938,7 @@ def __init__( "UserProvidedIdentifiers" ] = None ): + super().__init__( id=id, version=version, @@ -4225,11 +4460,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return BusinessUnitStoresSetMessageSchema().dump(self) -class CategoryCreatedMessage(Message): - """Generated after a successful [Create Category](/../api/projects/categories#create-category) request.""" +class CartDiscountCreatedMessage(Message): + """Generated after a successful [Create CartDiscount](ctp:api:endpoint:/{projectKey}/cart-discounts:POST) request.""" - #: [Category](ctp:api:type:Category) that was created. - category: "Category" + #: The [Cart Discount](ctp:api:type:CartDiscount) that was created. + cart_discount: "CartDiscount" def __init__( self, @@ -4246,9 +4481,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - category: "Category" + cart_discount: "CartDiscount" ): - self.category = category + self.cart_discount = cart_discount super().__init__( id=id, @@ -4261,30 +4496,25 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CategoryCreated", + type="CartDiscountCreated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CategoryCreatedMessage": - from ._schemas.message import CategoryCreatedMessageSchema + ) -> "CartDiscountCreatedMessage": + from ._schemas.message import CartDiscountCreatedMessageSchema - return CategoryCreatedMessageSchema().load(data) + return CartDiscountCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CategoryCreatedMessageSchema - - return CategoryCreatedMessageSchema().dump(self) + from ._schemas.message import CartDiscountCreatedMessageSchema + return CartDiscountCreatedMessageSchema().dump(self) -class CategorySlugChangedMessage(Message): - """Generated after a successful [Change Slug](ctp:api:type:CategoryChangeSlugAction) update action.""" - #: The slug of the [Category](ctp:api:type:Category) after the [Change Slug](ctp:api:type:CategoryChangeSlugAction) update action. - slug: "LocalizedString" - #: The slug of the [Category](ctp:api:type:Category) before the [Change Slug](ctp:api:type:CategoryChangeSlugAction) update action. - old_slug: typing.Optional["LocalizedString"] +class CartDiscountDeletedMessage(Message): + """Generated after a successful [Delete CartDiscount](ctp:api:endpoint:/{projectKey}/cart-discounts/{id}:DELETE) request.""" def __init__( self, @@ -4300,12 +4530,8 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None, - slug: "LocalizedString", - old_slug: typing.Optional["LocalizedString"] = None + ] = None ): - self.slug = slug - self.old_slug = old_slug super().__init__( id=id, @@ -4318,28 +4544,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CategorySlugChanged", + type="CartDiscountDeleted", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CategorySlugChangedMessage": - from ._schemas.message import CategorySlugChangedMessageSchema + ) -> "CartDiscountDeletedMessage": + from ._schemas.message import CartDiscountDeletedMessageSchema - return CategorySlugChangedMessageSchema().load(data) + return CartDiscountDeletedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CategorySlugChangedMessageSchema + from ._schemas.message import CartDiscountDeletedMessageSchema - return CategorySlugChangedMessageSchema().dump(self) + return CartDiscountDeletedMessageSchema().dump(self) -class CustomerAddressAddedMessage(Message): - """Generated after a successful [Add Address](ctp:api:type:CustomerAddAddressAction) update action.""" +class CartDiscountStoreAddedMessage(Message): + """Generated after a successful [Add Store](ctp:api:type:CartDiscountAddStoreAction) update action.""" - #: [Address](ctp:api:type:Address) that was added during the [Add Address](ctp:api:type:CustomerAddAddressAction) update action. - address: "Address" + #: The [Store](ctp:api:type:Store) that was added to the [Cart Discount](ctp:api:type:CartDiscount). + store: "StoreKeyReference" def __init__( self, @@ -4356,9 +4582,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - address: "Address" + store: "StoreKeyReference" ): - self.address = address + self.store = store super().__init__( id=id, @@ -4371,28 +4597,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressAdded", + type="CartDiscountStoreAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressAddedMessage": - from ._schemas.message import CustomerAddressAddedMessageSchema + ) -> "CartDiscountStoreAddedMessage": + from ._schemas.message import CartDiscountStoreAddedMessageSchema - return CustomerAddressAddedMessageSchema().load(data) + return CartDiscountStoreAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressAddedMessageSchema + from ._schemas.message import CartDiscountStoreAddedMessageSchema - return CustomerAddressAddedMessageSchema().dump(self) + return CartDiscountStoreAddedMessageSchema().dump(self) -class CustomerAddressChangedMessage(Message): - """Generated after a successful [Change Address](ctp:api:type:CustomerChangeAddressAction) update action.""" +class CartDiscountStoreRemovedMessage(Message): + """Generated after a successful [Remove Store](ctp:api:type:CartDiscountRemoveStoreAction) update action.""" - #: [Address](ctp:api:type:Address) that was set during the [Change Address](ctp:api:type:CustomerChangeAddressAction) update action. - address: "Address" + #: The [Store](ctp:api:type:Store) that was removed from the [Cart Discount](ctp:api:type:CartDiscount). + store: "StoreKeyReference" def __init__( self, @@ -4409,9 +4635,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - address: "Address" + store: "StoreKeyReference" ): - self.address = address + self.store = store super().__init__( id=id, @@ -4424,33 +4650,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressChanged", + type="CartDiscountStoreRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressChangedMessage": - from ._schemas.message import CustomerAddressChangedMessageSchema + ) -> "CartDiscountStoreRemovedMessage": + from ._schemas.message import CartDiscountStoreRemovedMessageSchema - return CustomerAddressChangedMessageSchema().load(data) + return CartDiscountStoreRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressChangedMessageSchema - - return CustomerAddressChangedMessageSchema().dump(self) + from ._schemas.message import CartDiscountStoreRemovedMessageSchema + return CartDiscountStoreRemovedMessageSchema().dump(self) -class CustomerAddressCustomFieldAddedMessage(Message): - """Generated after adding a Custom Field to an Address of a Customer using the [Set CustomField in Address](ctp:api:type:CustomerSetAddressCustomFieldAction) update action. - If a Custom Field already exists with the same name, a [CustomerAddressCustomFieldChanged](ctp:api:type:CustomerAddressCustomFieldChangedMessage) Message is generated instead. - """ +class CartDiscountStoresSetMessage(Message): + """Generated after a successful [Set Stores](ctp:api:type:CartDiscountSetStoresAction) update action.""" - #: Name of the Custom Field that was added. - name: str - #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). - value: typing.Any + #: [Stores](ctp:api:type:Store) of the [Cart Discount](ctp:api:type:CartDiscount) after the [Set Stores](ctp:api:type:CartDiscountSetStoresAction) update action. + stores: typing.List["StoreKeyReference"] def __init__( self, @@ -4467,11 +4688,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str, - value: typing.Any + stores: typing.List["StoreKeyReference"] ): - self.name = name - self.value = value + self.stores = stores super().__init__( id=id, @@ -4484,33 +4703,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressCustomFieldAdded", + type="CartDiscountStoresSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressCustomFieldAddedMessage": - from ._schemas.message import CustomerAddressCustomFieldAddedMessageSchema + ) -> "CartDiscountStoresSetMessage": + from ._schemas.message import CartDiscountStoresSetMessageSchema - return CustomerAddressCustomFieldAddedMessageSchema().load(data) + return CartDiscountStoresSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressCustomFieldAddedMessageSchema + from ._schemas.message import CartDiscountStoresSetMessageSchema - return CustomerAddressCustomFieldAddedMessageSchema().dump(self) + return CartDiscountStoresSetMessageSchema().dump(self) -class CustomerAddressCustomFieldChangedMessage(Message): - """Generated after changing an existing Custom Field on an Address of a Customer using the [Set CustomField in Address](ctp:api:type:CustomerSetAddressCustomFieldAction) update action.""" +class CategoryCreatedMessage(Message): + """Generated after a successful [Create Category](ctp:api:endpoint:/{projectKey}/categories:POST) request.""" - #: Name of the Custom Field that changed. - name: str - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:CustomerSetAddressCustomFieldAction) update action. - value: typing.Any - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:CustomerSetAddressCustomFieldAction) update action. - #: When there has not been a Custom Field with the `name` on the Customer Address before, a [Customer Address Custom Field Added](ctp:api:type:CustomerAddressCustomFieldAddedMessage) Message is generated instead. - previous_value: typing.Optional[typing.Any] + #: [Category](ctp:api:type:Category) that was created. + category: "Category" def __init__( self, @@ -4527,13 +4741,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str, - value: typing.Any, - previous_value: typing.Optional[typing.Any] = None + category: "Category" ): - self.name = name - self.value = value - self.previous_value = previous_value + self.category = category super().__init__( id=id, @@ -4546,28 +4756,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressCustomFieldChanged", + type="CategoryCreated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressCustomFieldChangedMessage": - from ._schemas.message import CustomerAddressCustomFieldChangedMessageSchema + ) -> "CategoryCreatedMessage": + from ._schemas.message import CategoryCreatedMessageSchema - return CustomerAddressCustomFieldChangedMessageSchema().load(data) + return CategoryCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressCustomFieldChangedMessageSchema + from ._schemas.message import CategoryCreatedMessageSchema - return CustomerAddressCustomFieldChangedMessageSchema().dump(self) + return CategoryCreatedMessageSchema().dump(self) -class CustomerAddressCustomFieldRemovedMessage(Message): - """Generated after removing a Custom Field from an Address of a Customer using the [Set CustomField in Address](ctp:api:type:CustomerSetAddressCustomFieldAction) update action.""" +class CategorySlugChangedMessage(Message): + """Generated after a successful [Change Slug](ctp:api:type:CategoryChangeSlugAction) update action.""" - #: Name of the Custom Field that was removed. - name: str + #: The slug of the [Category](ctp:api:type:Category) after the [Change Slug](ctp:api:type:CategoryChangeSlugAction) update action. + slug: "LocalizedString" + #: The slug of the [Category](ctp:api:type:Category) before the [Change Slug](ctp:api:type:CategoryChangeSlugAction) update action. + old_slug: typing.Optional["LocalizedString"] def __init__( self, @@ -4584,9 +4796,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str + slug: "LocalizedString", + old_slug: typing.Optional["LocalizedString"] = None ): - self.name = name + self.slug = slug + self.old_slug = old_slug super().__init__( id=id, @@ -4599,28 +4813,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressCustomFieldRemoved", + type="CategorySlugChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressCustomFieldRemovedMessage": - from ._schemas.message import CustomerAddressCustomFieldRemovedMessageSchema + ) -> "CategorySlugChangedMessage": + from ._schemas.message import CategorySlugChangedMessageSchema - return CustomerAddressCustomFieldRemovedMessageSchema().load(data) + return CategorySlugChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressCustomFieldRemovedMessageSchema + from ._schemas.message import CategorySlugChangedMessageSchema - return CustomerAddressCustomFieldRemovedMessageSchema().dump(self) + return CategorySlugChangedMessageSchema().dump(self) -class CustomerAddressCustomTypeRemovedMessage(Message): - """Generated after removing a Custom Type from an Address of a Customer using the [Set Custom Type in Address](ctp:api:type:CustomerSetAddressCustomTypeAction) update action.""" +class CustomerAddressAddedMessage(Message): + """Generated after a successful [Add Address](ctp:api:type:CustomerAddAddressAction) update action.""" - #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. - previous_type_id: typing.Optional[str] + #: [Address](ctp:api:type:Address) that was added during the [Add Address](ctp:api:type:CustomerAddAddressAction) update action. + address: "Address" def __init__( self, @@ -4637,9 +4851,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - previous_type_id: typing.Optional[str] = None + address: "Address" ): - self.previous_type_id = previous_type_id + self.address = address super().__init__( id=id, @@ -4652,30 +4866,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressCustomTypeRemoved", + type="CustomerAddressAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressCustomTypeRemovedMessage": - from ._schemas.message import CustomerAddressCustomTypeRemovedMessageSchema + ) -> "CustomerAddressAddedMessage": + from ._schemas.message import CustomerAddressAddedMessageSchema - return CustomerAddressCustomTypeRemovedMessageSchema().load(data) + return CustomerAddressAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressCustomTypeRemovedMessageSchema + from ._schemas.message import CustomerAddressAddedMessageSchema - return CustomerAddressCustomTypeRemovedMessageSchema().dump(self) + return CustomerAddressAddedMessageSchema().dump(self) -class CustomerAddressCustomTypeSetMessage(Message): - """Generated after adding a Custom Type to an Address of a Customer using the [Set Custom Type in Address](ctp:api:type:CustomerSetAddressCustomTypeAction) update action.""" +class CustomerAddressChangedMessage(Message): + """Generated after a successful [Change Address](ctp:api:type:CustomerChangeAddressAction) update action.""" - #: The Custom Fields that have been set. - custom_fields: "CustomFields" - #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. - previous_type_id: typing.Optional[str] + #: [Address](ctp:api:type:Address) that was set during the [Change Address](ctp:api:type:CustomerChangeAddressAction) update action. + address: "Address" def __init__( self, @@ -4692,11 +4904,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_fields: "CustomFields", - previous_type_id: typing.Optional[str] = None + address: "Address" ): - self.custom_fields = custom_fields - self.previous_type_id = previous_type_id + self.address = address super().__init__( id=id, @@ -4709,28 +4919,35 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressCustomTypeSet", + type="CustomerAddressChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressCustomTypeSetMessage": - from ._schemas.message import CustomerAddressCustomTypeSetMessageSchema + ) -> "CustomerAddressChangedMessage": + from ._schemas.message import CustomerAddressChangedMessageSchema - return CustomerAddressCustomTypeSetMessageSchema().load(data) + return CustomerAddressChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressCustomTypeSetMessageSchema + from ._schemas.message import CustomerAddressChangedMessageSchema - return CustomerAddressCustomTypeSetMessageSchema().dump(self) + return CustomerAddressChangedMessageSchema().dump(self) -class CustomerAddressRemovedMessage(Message): - """Generated after a successful [Remove Address](ctp:api:type:CustomerRemoveAddressAction) update action.""" +class CustomerAddressCustomFieldAddedMessage(Message): + """Generated after adding a Custom Field to an Address of a Customer using the [Set CustomField in Address](ctp:api:type:CustomerSetAddressCustomFieldAction) update action. + If a Custom Field already exists with the same name, a [CustomerAddressCustomFieldChanged](ctp:api:type:CustomerAddressCustomFieldChangedMessage) Message is generated instead. - #: [Address](ctp:api:type:Address) that was removed during the [Remove Address](ctp:api:type:CustomerRemoveAddressAction) update action. - address: "Address" + """ + + #: Name of the Custom Field that was added. + name: str + #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). + value: typing.Any + #: `id` of the [Address](ctp:api:type:Address) to which the Custom Field was added. + address_id: typing.Optional[str] def __init__( self, @@ -4747,9 +4964,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - address: "Address" + name: str, + value: typing.Any, + address_id: typing.Optional[str] = None ): - self.address = address + self.name = name + self.value = value + self.address_id = address_id super().__init__( id=id, @@ -4762,28 +4983,35 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerAddressRemoved", + type="CustomerAddressCustomFieldAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerAddressRemovedMessage": - from ._schemas.message import CustomerAddressRemovedMessageSchema + ) -> "CustomerAddressCustomFieldAddedMessage": + from ._schemas.message import CustomerAddressCustomFieldAddedMessageSchema - return CustomerAddressRemovedMessageSchema().load(data) + return CustomerAddressCustomFieldAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerAddressRemovedMessageSchema + from ._schemas.message import CustomerAddressCustomFieldAddedMessageSchema - return CustomerAddressRemovedMessageSchema().dump(self) + return CustomerAddressCustomFieldAddedMessageSchema().dump(self) -class CustomerCompanyNameSetMessage(Message): - """Generated after a successful [Set Company Name](ctp:api:type:CustomerSetCompanyNameAction) update action.""" +class CustomerAddressCustomFieldChangedMessage(Message): + """Generated after changing an existing Custom Field on an Address of a Customer using the [Set CustomField in Address](ctp:api:type:CustomerSetAddressCustomFieldAction) update action.""" - #: The `companyName` that was set during the [Set Company Name](ctp:api:type:CustomerSetCompanyNameAction) update action. - company_name: typing.Optional[str] + #: Name of the Custom Field that changed. + name: str + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:CustomerSetAddressCustomFieldAction) update action. + value: typing.Any + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:CustomerSetAddressCustomFieldAction) update action. + #: When there has not been a Custom Field with the `name` on the Customer Address before, a [Customer Address Custom Field Added](ctp:api:type:CustomerAddressCustomFieldAddedMessage) Message is generated instead. + previous_value: typing.Optional[typing.Any] + #: `id` of the [Address](ctp:api:type:Address) of which the Custom Field was changed. + address_id: typing.Optional[str] def __init__( self, @@ -4800,9 +5028,15 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - company_name: typing.Optional[str] = None + name: str, + value: typing.Any, + previous_value: typing.Optional[typing.Any] = None, + address_id: typing.Optional[str] = None ): - self.company_name = company_name + self.name = name + self.value = value + self.previous_value = previous_value + self.address_id = address_id super().__init__( id=id, @@ -4815,28 +5049,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerCompanyNameSet", + type="CustomerAddressCustomFieldChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerCompanyNameSetMessage": - from ._schemas.message import CustomerCompanyNameSetMessageSchema + ) -> "CustomerAddressCustomFieldChangedMessage": + from ._schemas.message import CustomerAddressCustomFieldChangedMessageSchema - return CustomerCompanyNameSetMessageSchema().load(data) + return CustomerAddressCustomFieldChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerCompanyNameSetMessageSchema + from ._schemas.message import CustomerAddressCustomFieldChangedMessageSchema - return CustomerCompanyNameSetMessageSchema().dump(self) + return CustomerAddressCustomFieldChangedMessageSchema().dump(self) -class CustomerCreatedMessage(Message): - """Generated after a successful [Create Customer](/../api/projects/customers#create-sign-up-customer) request.""" +class CustomerAddressCustomFieldRemovedMessage(Message): + """Generated after removing a Custom Field from an Address of a Customer using the [Set CustomField in Address](ctp:api:type:CustomerSetAddressCustomFieldAction) update action.""" - #: [Customer](ctp:api:type:Customer) that was created. - customer: "Customer" + #: Name of the Custom Field that was removed. + name: str + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Field was removed. + address_id: typing.Optional[str] def __init__( self, @@ -4853,9 +5089,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - customer: "Customer" + name: str, + address_id: typing.Optional[str] = None ): - self.customer = customer + self.name = name + self.address_id = address_id super().__init__( id=id, @@ -4868,33 +5106,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerCreated", + type="CustomerAddressCustomFieldRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerCreatedMessage": - from ._schemas.message import CustomerCreatedMessageSchema + ) -> "CustomerAddressCustomFieldRemovedMessage": + from ._schemas.message import CustomerAddressCustomFieldRemovedMessageSchema - return CustomerCreatedMessageSchema().load(data) + return CustomerAddressCustomFieldRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerCreatedMessageSchema - - return CustomerCreatedMessageSchema().dump(self) + from ._schemas.message import CustomerAddressCustomFieldRemovedMessageSchema + return CustomerAddressCustomFieldRemovedMessageSchema().dump(self) -class CustomerCustomFieldAddedMessage(Message): - """Generated after adding a Custom Field to a Customer using the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action. - If a Custom Field already exists with the same name, a [CustomerCustomFieldChanged](ctp:api:type:CustomerCustomFieldChangedMessage) Message is generated instead. - """ +class CustomerAddressCustomTypeRemovedMessage(Message): + """Generated after removing a Custom Type from an Address of a Customer using the [Set Custom Type in Address](ctp:api:type:CustomerSetAddressCustomTypeAction) update action.""" - #: Name of the Custom Field that was added. - name: str - #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). - value: typing.Any + #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. + previous_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Type was removed. + address_id: typing.Optional[str] def __init__( self, @@ -4911,11 +5146,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str, - value: typing.Any + previous_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None ): - self.name = name - self.value = value + self.previous_type_id = previous_type_id + self.address_id = address_id super().__init__( id=id, @@ -4928,33 +5163,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerCustomFieldAdded", + type="CustomerAddressCustomTypeRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerCustomFieldAddedMessage": - from ._schemas.message import CustomerCustomFieldAddedMessageSchema + ) -> "CustomerAddressCustomTypeRemovedMessage": + from ._schemas.message import CustomerAddressCustomTypeRemovedMessageSchema - return CustomerCustomFieldAddedMessageSchema().load(data) + return CustomerAddressCustomTypeRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerCustomFieldAddedMessageSchema + from ._schemas.message import CustomerAddressCustomTypeRemovedMessageSchema - return CustomerCustomFieldAddedMessageSchema().dump(self) + return CustomerAddressCustomTypeRemovedMessageSchema().dump(self) -class CustomerCustomFieldChangedMessage(Message): - """Generated after changing an existing Custom Field on a Customer using the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action.""" +class CustomerAddressCustomTypeSetMessage(Message): + """Generated after adding a Custom Type to an Address of a Customer using the [Set Custom Type in Address](ctp:api:type:CustomerSetAddressCustomTypeAction) update action.""" - #: Name of the Custom Field that changed. - name: str - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action. - value: typing.Any - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action. - #: When there has not been a Custom Field with the `name` on the Customer before, a [Customer Custom Field Added](ctp:api:type:CustomerCustomFieldAddedMessage) Message is generated instead. - previous_value: typing.Optional[typing.Any] + #: The Custom Fields that have been set. + custom_fields: "CustomFields" + #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. + previous_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) on which the Custom Field was set. + address_id: typing.Optional[str] def __init__( self, @@ -4971,13 +5205,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str, - value: typing.Any, - previous_value: typing.Optional[typing.Any] = None + custom_fields: "CustomFields", + previous_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None ): - self.name = name - self.value = value - self.previous_value = previous_value + self.custom_fields = custom_fields + self.previous_type_id = previous_type_id + self.address_id = address_id super().__init__( id=id, @@ -4990,28 +5224,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerCustomFieldChanged", + type="CustomerAddressCustomTypeSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerCustomFieldChangedMessage": - from ._schemas.message import CustomerCustomFieldChangedMessageSchema + ) -> "CustomerAddressCustomTypeSetMessage": + from ._schemas.message import CustomerAddressCustomTypeSetMessageSchema - return CustomerCustomFieldChangedMessageSchema().load(data) + return CustomerAddressCustomTypeSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerCustomFieldChangedMessageSchema + from ._schemas.message import CustomerAddressCustomTypeSetMessageSchema - return CustomerCustomFieldChangedMessageSchema().dump(self) + return CustomerAddressCustomTypeSetMessageSchema().dump(self) -class CustomerCustomFieldRemovedMessage(Message): - """Generated after removing a Custom Field from a Customer using the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action.""" +class CustomerAddressRemovedMessage(Message): + """Generated after a successful [Remove Address](ctp:api:type:CustomerRemoveAddressAction) update action.""" - #: Name of the Custom Field that was removed. - name: str + #: [Address](ctp:api:type:Address) that was removed during the [Remove Address](ctp:api:type:CustomerRemoveAddressAction) update action. + address: "Address" def __init__( self, @@ -5028,9 +5262,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str + address: "Address" ): - self.name = name + self.address = address super().__init__( id=id, @@ -5043,28 +5277,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerCustomFieldRemoved", + type="CustomerAddressRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerCustomFieldRemovedMessage": - from ._schemas.message import CustomerCustomFieldRemovedMessageSchema + ) -> "CustomerAddressRemovedMessage": + from ._schemas.message import CustomerAddressRemovedMessageSchema - return CustomerCustomFieldRemovedMessageSchema().load(data) + return CustomerAddressRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerCustomFieldRemovedMessageSchema + from ._schemas.message import CustomerAddressRemovedMessageSchema - return CustomerCustomFieldRemovedMessageSchema().dump(self) + return CustomerAddressRemovedMessageSchema().dump(self) -class CustomerCustomTypeRemovedMessage(Message): - """Generated after removing a Custom Type from a Customer using the [Set Custom Type](ctp:api:type:CustomerSetCustomTypeAction) update action with empty parameters.""" +class CustomerCompanyNameSetMessage(Message): + """Generated after a successful [Set Company Name](ctp:api:type:CustomerSetCompanyNameAction) update action.""" - #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. - previous_type_id: typing.Optional[str] + #: The `companyName` that was set during the [Set Company Name](ctp:api:type:CustomerSetCompanyNameAction) update action. + company_name: typing.Optional[str] def __init__( self, @@ -5081,9 +5315,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - previous_type_id: typing.Optional[str] = None + company_name: typing.Optional[str] = None ): - self.previous_type_id = previous_type_id + self.company_name = company_name super().__init__( id=id, @@ -5096,30 +5330,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerCustomTypeRemoved", + type="CustomerCompanyNameSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerCustomTypeRemovedMessage": - from ._schemas.message import CustomerCustomTypeRemovedMessageSchema + ) -> "CustomerCompanyNameSetMessage": + from ._schemas.message import CustomerCompanyNameSetMessageSchema - return CustomerCustomTypeRemovedMessageSchema().load(data) + return CustomerCompanyNameSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerCustomTypeRemovedMessageSchema + from ._schemas.message import CustomerCompanyNameSetMessageSchema - return CustomerCustomTypeRemovedMessageSchema().dump(self) + return CustomerCompanyNameSetMessageSchema().dump(self) -class CustomerCustomTypeSetMessage(Message): - """Generated after adding a Custom Type to a Customer using the [Set Custom Type](ctp:api:type:CustomerSetCustomTypeAction) update action.""" +class CustomerCreatedMessage(Message): + """Generated after a successful [Create Customer](ctp:api:endpoint:/{projectKey}/customers:POST) request.""" - #: The Custom Fields that have been set. - custom_fields: "CustomFields" - #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. - previous_type_id: typing.Optional[str] + #: [Customer](ctp:api:type:Customer) that was created. + customer: "Customer" def __init__( self, @@ -5136,11 +5368,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_fields: "CustomFields", - previous_type_id: typing.Optional[str] = None + customer: "Customer" ): - self.custom_fields = custom_fields - self.previous_type_id = previous_type_id + self.customer = customer super().__init__( id=id, @@ -5153,28 +5383,33 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerCustomTypeSet", + type="CustomerCreated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerCustomTypeSetMessage": - from ._schemas.message import CustomerCustomTypeSetMessageSchema + ) -> "CustomerCreatedMessage": + from ._schemas.message import CustomerCreatedMessageSchema - return CustomerCustomTypeSetMessageSchema().load(data) + return CustomerCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerCustomTypeSetMessageSchema + from ._schemas.message import CustomerCreatedMessageSchema - return CustomerCustomTypeSetMessageSchema().dump(self) + return CustomerCreatedMessageSchema().dump(self) -class CustomerDateOfBirthSetMessage(Message): - """Generated after a successful [Set Date of Birth](ctp:api:type:CustomerSetDateOfBirthAction) update action.""" +class CustomerCustomFieldAddedMessage(Message): + """Generated after adding a Custom Field to a Customer using the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action. + If a Custom Field already exists with the same name, a [CustomerCustomFieldChanged](ctp:api:type:CustomerCustomFieldChangedMessage) Message is generated instead. - #: The `dateOfBirth` that was set during the [Set Date of Birth](ctp:api:type:CustomerSetDateOfBirthAction) update action. - date_of_birth: typing.Optional[datetime.date] + """ + + #: Name of the Custom Field that was added. + name: str + #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). + value: typing.Any def __init__( self, @@ -5191,9 +5426,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - date_of_birth: typing.Optional[datetime.date] = None + name: str, + value: typing.Any ): - self.date_of_birth = date_of_birth + self.name = name + self.value = value super().__init__( id=id, @@ -5206,25 +5443,33 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerDateOfBirthSet", + type="CustomerCustomFieldAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerDateOfBirthSetMessage": - from ._schemas.message import CustomerDateOfBirthSetMessageSchema + ) -> "CustomerCustomFieldAddedMessage": + from ._schemas.message import CustomerCustomFieldAddedMessageSchema - return CustomerDateOfBirthSetMessageSchema().load(data) + return CustomerCustomFieldAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerDateOfBirthSetMessageSchema + from ._schemas.message import CustomerCustomFieldAddedMessageSchema - return CustomerDateOfBirthSetMessageSchema().dump(self) + return CustomerCustomFieldAddedMessageSchema().dump(self) -class CustomerDeletedMessage(Message): - """Generated after a successful [Delete Customer](/../api/projects/customers#delete-customer) request.""" +class CustomerCustomFieldChangedMessage(Message): + """Generated after changing an existing Custom Field on a Customer using the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action.""" + + #: Name of the Custom Field that changed. + name: str + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action. + value: typing.Any + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action. + #: When there has not been a Custom Field with the `name` on the Customer before, a [Customer Custom Field Added](ctp:api:type:CustomerCustomFieldAddedMessage) Message is generated instead. + previous_value: typing.Optional[typing.Any] def __init__( self, @@ -5240,8 +5485,15 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None + ] = None, + name: str, + value: typing.Any, + previous_value: typing.Optional[typing.Any] = None ): + self.name = name + self.value = value + self.previous_value = previous_value + super().__init__( id=id, version=version, @@ -5253,28 +5505,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerDeleted", + type="CustomerCustomFieldChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerDeletedMessage": - from ._schemas.message import CustomerDeletedMessageSchema + ) -> "CustomerCustomFieldChangedMessage": + from ._schemas.message import CustomerCustomFieldChangedMessageSchema - return CustomerDeletedMessageSchema().load(data) + return CustomerCustomFieldChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerDeletedMessageSchema + from ._schemas.message import CustomerCustomFieldChangedMessageSchema - return CustomerDeletedMessageSchema().dump(self) + return CustomerCustomFieldChangedMessageSchema().dump(self) -class CustomerEmailChangedMessage(Message): - """Generated after a successful [Change Email](ctp:api:type:CustomerChangeEmailAction) update action.""" +class CustomerCustomFieldRemovedMessage(Message): + """Generated after removing a Custom Field from a Customer using the [Set CustomField](ctp:api:type:CustomerSetCustomFieldAction) update action.""" - #: The `email` that was set during the [Change Email](ctp:api:type:CustomerChangeEmailAction) update action. - email: str + #: Name of the Custom Field that was removed. + name: str def __init__( self, @@ -5291,9 +5543,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - email: str + name: str ): - self.email = email + self.name = name super().__init__( id=id, @@ -5306,30 +5558,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerEmailChanged", + type="CustomerCustomFieldRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerEmailChangedMessage": - from ._schemas.message import CustomerEmailChangedMessageSchema + ) -> "CustomerCustomFieldRemovedMessage": + from ._schemas.message import CustomerCustomFieldRemovedMessageSchema - return CustomerEmailChangedMessageSchema().load(data) + return CustomerCustomFieldRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerEmailChangedMessageSchema + from ._schemas.message import CustomerCustomFieldRemovedMessageSchema - return CustomerEmailChangedMessageSchema().dump(self) + return CustomerCustomFieldRemovedMessageSchema().dump(self) -class CustomerEmailTokenCreatedMessage(Message): - """Generated after a successful [Create email token for Customer](/../api/projects/customers#create-email-token-for-customer) request. The `resource` property of the Message is a [CustomerEmailTokenReference](ctp:api:type:CustomerEmailTokenReference).""" +class CustomerCustomTypeRemovedMessage(Message): + """Generated after removing a Custom Type from a Customer using the [Set Custom Type](ctp:api:type:CustomerSetCustomTypeAction) update action with empty parameters.""" - #: Unique identifier of the Customer. - customer_id: str - #: Date and time (UTC) the email token expires. - expires_at: datetime.datetime + #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. + previous_type_id: typing.Optional[str] def __init__( self, @@ -5346,11 +5596,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - customer_id: str, - expires_at: datetime.datetime + previous_type_id: typing.Optional[str] = None ): - self.customer_id = customer_id - self.expires_at = expires_at + self.previous_type_id = previous_type_id super().__init__( id=id, @@ -5363,25 +5611,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerEmailTokenCreated", + type="CustomerCustomTypeRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerEmailTokenCreatedMessage": - from ._schemas.message import CustomerEmailTokenCreatedMessageSchema + ) -> "CustomerCustomTypeRemovedMessage": + from ._schemas.message import CustomerCustomTypeRemovedMessageSchema - return CustomerEmailTokenCreatedMessageSchema().load(data) + return CustomerCustomTypeRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerEmailTokenCreatedMessageSchema + from ._schemas.message import CustomerCustomTypeRemovedMessageSchema - return CustomerEmailTokenCreatedMessageSchema().dump(self) + return CustomerCustomTypeRemovedMessageSchema().dump(self) -class CustomerEmailVerifiedMessage(Message): - """Generated after a successful [Verify Customer's Email](/../api/projects/customers#verify-email-of-customer) request.""" +class CustomerCustomTypeSetMessage(Message): + """Generated after adding a Custom Type to a Customer using the [Set Custom Type](ctp:api:type:CustomerSetCustomTypeAction) update action.""" + + #: The Custom Fields that have been set. + custom_fields: "CustomFields" + #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. + previous_type_id: typing.Optional[str] def __init__( self, @@ -5397,8 +5650,13 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None + ] = None, + custom_fields: "CustomFields", + previous_type_id: typing.Optional[str] = None ): + self.custom_fields = custom_fields + self.previous_type_id = previous_type_id + super().__init__( id=id, version=version, @@ -5410,28 +5668,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerEmailVerified", + type="CustomerCustomTypeSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerEmailVerifiedMessage": - from ._schemas.message import CustomerEmailVerifiedMessageSchema + ) -> "CustomerCustomTypeSetMessage": + from ._schemas.message import CustomerCustomTypeSetMessageSchema - return CustomerEmailVerifiedMessageSchema().load(data) + return CustomerCustomTypeSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerEmailVerifiedMessageSchema + from ._schemas.message import CustomerCustomTypeSetMessageSchema - return CustomerEmailVerifiedMessageSchema().dump(self) + return CustomerCustomTypeSetMessageSchema().dump(self) -class CustomerFirstNameSetMessage(Message): - """Generated after a successful [Set First Name](ctp:api:type:CustomerSetFirstNameAction) update action.""" +class CustomerDateOfBirthSetMessage(Message): + """Generated after a successful [Set Date of Birth](ctp:api:type:CustomerSetDateOfBirthAction) update action.""" - #: The `firstName` that was set during the [Set First Name](ctp:api:type:CustomerSetFirstNameAction) update action. - first_name: typing.Optional[str] + #: The `dateOfBirth` that was set during the [Set Date of Birth](ctp:api:type:CustomerSetDateOfBirthAction) update action. + date_of_birth: typing.Optional[datetime.date] def __init__( self, @@ -5448,9 +5706,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - first_name: typing.Optional[str] = None + date_of_birth: typing.Optional[datetime.date] = None ): - self.first_name = first_name + self.date_of_birth = date_of_birth super().__init__( id=id, @@ -5463,33 +5721,25 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerFirstNameSet", + type="CustomerDateOfBirthSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerFirstNameSetMessage": - from ._schemas.message import CustomerFirstNameSetMessageSchema + ) -> "CustomerDateOfBirthSetMessage": + from ._schemas.message import CustomerDateOfBirthSetMessageSchema - return CustomerFirstNameSetMessageSchema().load(data) + return CustomerDateOfBirthSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerFirstNameSetMessageSchema - - return CustomerFirstNameSetMessageSchema().dump(self) - + from ._schemas.message import CustomerDateOfBirthSetMessageSchema -class CustomerGroupCustomFieldAddedMessage(Message): - """Generated after adding a Custom Field to a Customer Group using the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action. - If a Custom Field already exists with the same name, a [CustomerGroupCustomFieldChanged](ctp:api:type:CustomerGroupCustomFieldChangedMessage) Message is generated instead. + return CustomerDateOfBirthSetMessageSchema().dump(self) - """ - #: Name of the Custom Field that was added. - name: str - #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). - value: typing.Any +class CustomerDeletedMessage(Message): + """Generated after a successful [Delete Customer](/../api/projects/customers#delete-customer) request.""" def __init__( self, @@ -5505,12 +5755,8 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None, - name: str, - value: typing.Any + ] = None ): - self.name = name - self.value = value super().__init__( id=id, @@ -5523,32 +5769,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerGroupCustomFieldAdded", + type="CustomerDeleted", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerGroupCustomFieldAddedMessage": - from ._schemas.message import CustomerGroupCustomFieldAddedMessageSchema + ) -> "CustomerDeletedMessage": + from ._schemas.message import CustomerDeletedMessageSchema - return CustomerGroupCustomFieldAddedMessageSchema().load(data) + return CustomerDeletedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerGroupCustomFieldAddedMessageSchema + from ._schemas.message import CustomerDeletedMessageSchema - return CustomerGroupCustomFieldAddedMessageSchema().dump(self) + return CustomerDeletedMessageSchema().dump(self) -class CustomerGroupCustomFieldChangedMessage(Message): - """Generated after changing an existing Custom Field on a Customer Group using the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action.""" +class CustomerEmailChangedMessage(Message): + """Generated after a successful [Change Email](ctp:api:type:CustomerChangeEmailAction) update action.""" - #: Name of the Custom Field that changed. - name: str - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action. - value: typing.Any - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action. - old_value: typing.Optional[typing.Any] + #: The `email` that was set during the [Change Email](ctp:api:type:CustomerChangeEmailAction) update action. + email: str def __init__( self, @@ -5565,13 +5807,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str, - value: typing.Any, - old_value: typing.Optional[typing.Any] = None + email: str ): - self.name = name - self.value = value - self.old_value = old_value + self.email = email super().__init__( id=id, @@ -5584,28 +5822,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerGroupCustomFieldChanged", + type="CustomerEmailChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerGroupCustomFieldChangedMessage": - from ._schemas.message import CustomerGroupCustomFieldChangedMessageSchema + ) -> "CustomerEmailChangedMessage": + from ._schemas.message import CustomerEmailChangedMessageSchema - return CustomerGroupCustomFieldChangedMessageSchema().load(data) + return CustomerEmailChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerGroupCustomFieldChangedMessageSchema + from ._schemas.message import CustomerEmailChangedMessageSchema - return CustomerGroupCustomFieldChangedMessageSchema().dump(self) + return CustomerEmailChangedMessageSchema().dump(self) -class CustomerGroupCustomFieldRemovedMessage(Message): - """Generated after removing a Custom Field from a Customer Group using the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action.""" +class CustomerEmailTokenCreatedMessage(Message): + """Generated after a successful [Create email token for Customer](ctp:api:endpoint:/{projectKey}/customers/email-token:POST) request. The `resource` property of the Message is a [CustomerEmailTokenReference](ctp:api:type:CustomerEmailTokenReference).""" - #: Name of the Custom Field that was removed. - name: str + #: Unique identifier of the Customer. + customer_id: str + #: Date and time (UTC) the email token expires. + expires_at: datetime.datetime def __init__( self, @@ -5622,9 +5862,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str + customer_id: str, + expires_at: datetime.datetime ): - self.name = name + self.customer_id = customer_id + self.expires_at = expires_at super().__init__( id=id, @@ -5637,28 +5879,25 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerGroupCustomFieldRemoved", + type="CustomerEmailTokenCreated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerGroupCustomFieldRemovedMessage": - from ._schemas.message import CustomerGroupCustomFieldRemovedMessageSchema + ) -> "CustomerEmailTokenCreatedMessage": + from ._schemas.message import CustomerEmailTokenCreatedMessageSchema - return CustomerGroupCustomFieldRemovedMessageSchema().load(data) + return CustomerEmailTokenCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerGroupCustomFieldRemovedMessageSchema - - return CustomerGroupCustomFieldRemovedMessageSchema().dump(self) + from ._schemas.message import CustomerEmailTokenCreatedMessageSchema + return CustomerEmailTokenCreatedMessageSchema().dump(self) -class CustomerGroupCustomTypeRemovedMessage(Message): - """Generated after removing a Custom Type from a Customer Group using the [Set Custom Type](ctp:api:type:CustomerGroupSetCustomTypeAction) update action with empty parameters.""" - #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. - old_type_id: typing.Optional[str] +class CustomerEmailVerifiedMessage(Message): + """Generated after a successful [Verify Customer's Email](ctp:api:endpoint:/{projectKey}/customers/email/confirm:POST) request.""" def __init__( self, @@ -5674,10 +5913,8 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None, - old_type_id: typing.Optional[str] = None + ] = None ): - self.old_type_id = old_type_id super().__init__( id=id, @@ -5690,30 +5927,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerGroupCustomTypeRemoved", + type="CustomerEmailVerified", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerGroupCustomTypeRemovedMessage": - from ._schemas.message import CustomerGroupCustomTypeRemovedMessageSchema - - return CustomerGroupCustomTypeRemovedMessageSchema().load(data) + ) -> "CustomerEmailVerifiedMessage": + from ._schemas.message import CustomerEmailVerifiedMessageSchema + + return CustomerEmailVerifiedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerGroupCustomTypeRemovedMessageSchema + from ._schemas.message import CustomerEmailVerifiedMessageSchema - return CustomerGroupCustomTypeRemovedMessageSchema().dump(self) + return CustomerEmailVerifiedMessageSchema().dump(self) -class CustomerGroupCustomTypeSetMessage(Message): - """Generated after adding a Custom Type to a Customer Group using the [Set Custom Type](ctp:api:type:CustomerGroupSetCustomTypeAction) update action.""" +class CustomerFirstNameSetMessage(Message): + """Generated after a successful [Set First Name](ctp:api:type:CustomerSetFirstNameAction) update action.""" - #: The Custom Fields that have been set. - custom_fields: "CustomFields" - #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. - old_type_id: typing.Optional[str] + #: The `firstName` that was set during the [Set First Name](ctp:api:type:CustomerSetFirstNameAction) update action. + first_name: typing.Optional[str] def __init__( self, @@ -5730,11 +5965,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_fields: "CustomFields", - old_type_id: typing.Optional[str] = None + first_name: typing.Optional[str] = None ): - self.custom_fields = custom_fields - self.old_type_id = old_type_id + self.first_name = first_name super().__init__( id=id, @@ -5747,28 +5980,33 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerGroupCustomTypeSet", + type="CustomerFirstNameSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerGroupCustomTypeSetMessage": - from ._schemas.message import CustomerGroupCustomTypeSetMessageSchema + ) -> "CustomerFirstNameSetMessage": + from ._schemas.message import CustomerFirstNameSetMessageSchema - return CustomerGroupCustomTypeSetMessageSchema().load(data) + return CustomerFirstNameSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerGroupCustomTypeSetMessageSchema + from ._schemas.message import CustomerFirstNameSetMessageSchema - return CustomerGroupCustomTypeSetMessageSchema().dump(self) + return CustomerFirstNameSetMessageSchema().dump(self) -class CustomerGroupSetMessage(Message): - """Generated after a successful [Set Customer Group](ctp:api:type:CustomerSetCustomerGroupAction) update action.""" +class CustomerGroupCustomFieldAddedMessage(Message): + """Generated after adding a Custom Field to a Customer Group using the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action. + If a Custom Field already exists with the same name, a [CustomerGroupCustomFieldChanged](ctp:api:type:CustomerGroupCustomFieldChangedMessage) Message is generated instead. - #: [Customer Group](ctp:api:type:CustomerGroup) that was set during the [Set Customer Group](ctp:api:type:CustomerSetCustomerGroupAction) update action. - customer_group: typing.Optional["CustomerGroupReference"] + """ + + #: Name of the Custom Field that was added. + name: str + #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). + value: typing.Any def __init__( self, @@ -5785,9 +6023,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - customer_group: typing.Optional["CustomerGroupReference"] = None + name: str, + value: typing.Any ): - self.customer_group = customer_group + self.name = name + self.value = value super().__init__( id=id, @@ -5800,28 +6040,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerGroupSet", + type="CustomerGroupCustomFieldAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerGroupSetMessage": - from ._schemas.message import CustomerGroupSetMessageSchema + ) -> "CustomerGroupCustomFieldAddedMessage": + from ._schemas.message import CustomerGroupCustomFieldAddedMessageSchema - return CustomerGroupSetMessageSchema().load(data) + return CustomerGroupCustomFieldAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerGroupSetMessageSchema + from ._schemas.message import CustomerGroupCustomFieldAddedMessageSchema - return CustomerGroupSetMessageSchema().dump(self) + return CustomerGroupCustomFieldAddedMessageSchema().dump(self) -class CustomerLastNameSetMessage(Message): - """Generated after a successful [Set Last Name](ctp:api:type:CustomerSetLastNameAction) update action.""" +class CustomerGroupCustomFieldChangedMessage(Message): + """Generated after changing an existing Custom Field on a Customer Group using the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action.""" - #: The `lastName` that was set during the [Set Last Name](ctp:api:type:CustomerSetLastNameAction) update action. - last_name: typing.Optional[str] + #: Name of the Custom Field that changed. + name: str + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action. + value: typing.Any + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action. + old_value: typing.Optional[typing.Any] def __init__( self, @@ -5838,9 +6082,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - last_name: typing.Optional[str] = None + name: str, + value: typing.Any, + old_value: typing.Optional[typing.Any] = None ): - self.last_name = last_name + self.name = name + self.value = value + self.old_value = old_value super().__init__( id=id, @@ -5853,30 +6101,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerLastNameSet", + type="CustomerGroupCustomFieldChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerLastNameSetMessage": - from ._schemas.message import CustomerLastNameSetMessageSchema + ) -> "CustomerGroupCustomFieldChangedMessage": + from ._schemas.message import CustomerGroupCustomFieldChangedMessageSchema - return CustomerLastNameSetMessageSchema().load(data) + return CustomerGroupCustomFieldChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerLastNameSetMessageSchema + from ._schemas.message import CustomerGroupCustomFieldChangedMessageSchema - return CustomerLastNameSetMessageSchema().dump(self) + return CustomerGroupCustomFieldChangedMessageSchema().dump(self) -class CustomerPasswordTokenCreatedMessage(Message): - """Generated after a successful [Create password reset token for Customer](/../api/projects/customers#create-password-reset-token-for-customer) request. The `resource` property of the Message is a [CustomerPasswordTokenReference](ctp:api:type:CustomerPasswordTokenReference).""" +class CustomerGroupCustomFieldRemovedMessage(Message): + """Generated after removing a Custom Field from a Customer Group using the [Set CustomField](ctp:api:type:CustomerGroupSetCustomFieldAction) update action.""" - #: Unique identifier of the Customer. - customer_id: str - #: Date and time (UTC) the password token expires. - expires_at: datetime.datetime + #: Name of the Custom Field that was removed. + name: str def __init__( self, @@ -5893,11 +6139,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - customer_id: str, - expires_at: datetime.datetime + name: str ): - self.customer_id = customer_id - self.expires_at = expires_at + self.name = name super().__init__( id=id, @@ -5910,28 +6154,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerPasswordTokenCreated", + type="CustomerGroupCustomFieldRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerPasswordTokenCreatedMessage": - from ._schemas.message import CustomerPasswordTokenCreatedMessageSchema + ) -> "CustomerGroupCustomFieldRemovedMessage": + from ._schemas.message import CustomerGroupCustomFieldRemovedMessageSchema - return CustomerPasswordTokenCreatedMessageSchema().load(data) + return CustomerGroupCustomFieldRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerPasswordTokenCreatedMessageSchema + from ._schemas.message import CustomerGroupCustomFieldRemovedMessageSchema - return CustomerPasswordTokenCreatedMessageSchema().dump(self) + return CustomerGroupCustomFieldRemovedMessageSchema().dump(self) -class CustomerPasswordUpdatedMessage(Message): - """Generated after a successful [Reset Customer's Password](/../api/projects/customers#reset-password-of-customer), [Reset Customer's Password in a Store](/../api/projects/customers#reset-password-of-customer-in-store), [Change Customer's Password](/../api/projects/customers#change-password-of-customer), or [Change Customer's Password in a Store](/../api/projects/customers#change-password-of-customer-in-store) request. This Message is also produced during equivalent requests to the [My Customer Profile](/../api/projects/me-profile) endpoint.""" +class CustomerGroupCustomTypeRemovedMessage(Message): + """Generated after removing a Custom Type from a Customer Group using the [Set Custom Type](ctp:api:type:CustomerGroupSetCustomTypeAction) update action with empty parameters.""" - #: Whether the Customer's password was updated during the [Reset password](/../api/projects/customers#password-reset-of-customer) or [Change password](/../api/projects/customers#change-password-of-customer) flow. - reset: bool + #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. + old_type_id: typing.Optional[str] def __init__( self, @@ -5948,9 +6192,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - reset: bool + old_type_id: typing.Optional[str] = None ): - self.reset = reset + self.old_type_id = old_type_id super().__init__( id=id, @@ -5963,28 +6207,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerPasswordUpdated", + type="CustomerGroupCustomTypeRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerPasswordUpdatedMessage": - from ._schemas.message import CustomerPasswordUpdatedMessageSchema + ) -> "CustomerGroupCustomTypeRemovedMessage": + from ._schemas.message import CustomerGroupCustomTypeRemovedMessageSchema - return CustomerPasswordUpdatedMessageSchema().load(data) + return CustomerGroupCustomTypeRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerPasswordUpdatedMessageSchema + from ._schemas.message import CustomerGroupCustomTypeRemovedMessageSchema - return CustomerPasswordUpdatedMessageSchema().dump(self) + return CustomerGroupCustomTypeRemovedMessageSchema().dump(self) -class CustomerTitleSetMessage(Message): - """Generated after a successful [Set Title](ctp:api:type:CustomerSetTitleAction) update action.""" +class CustomerGroupCustomTypeSetMessage(Message): + """Generated after adding a Custom Type to a Customer Group using the [Set Custom Type](ctp:api:type:CustomerGroupSetCustomTypeAction) update action.""" - #: The `title` that was set during the [Set Title](ctp:api:type:CustomerSetTitleAction) update action. - title: typing.Optional[str] + #: The Custom Fields that have been set. + custom_fields: "CustomFields" + #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. + old_type_id: typing.Optional[str] def __init__( self, @@ -6001,9 +6247,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - title: typing.Optional[str] = None + custom_fields: "CustomFields", + old_type_id: typing.Optional[str] = None ): - self.title = title + self.custom_fields = custom_fields + self.old_type_id = old_type_id super().__init__( id=id, @@ -6016,28 +6264,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomerTitleSet", + type="CustomerGroupCustomTypeSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomerTitleSetMessage": - from ._schemas.message import CustomerTitleSetMessageSchema + ) -> "CustomerGroupCustomTypeSetMessage": + from ._schemas.message import CustomerGroupCustomTypeSetMessageSchema - return CustomerTitleSetMessageSchema().load(data) + return CustomerGroupCustomTypeSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomerTitleSetMessageSchema + from ._schemas.message import CustomerGroupCustomTypeSetMessageSchema - return CustomerTitleSetMessageSchema().dump(self) + return CustomerGroupCustomTypeSetMessageSchema().dump(self) -class InventoryEntryCreatedMessage(Message): - """Generated after a successful [Create InventoryEntry](/../api/projects/inventory#create-inventoryentry) request.""" +class CustomerGroupSetMessage(Message): + """Generated after a successful [Set Customer Group](ctp:api:type:CustomerSetCustomerGroupAction) update action.""" - #: [InventoryEntry](ctp:api:type:InventoryEntry) that was created. - inventory_entry: "InventoryEntry" + #: [Customer Group](ctp:api:type:CustomerGroup) that was set during the [Set Customer Group](ctp:api:type:CustomerSetCustomerGroupAction) update action. + customer_group: typing.Optional["CustomerGroupReference"] def __init__( self, @@ -6054,9 +6302,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - inventory_entry: "InventoryEntry" + customer_group: typing.Optional["CustomerGroupReference"] = None ): - self.inventory_entry = inventory_entry + self.customer_group = customer_group super().__init__( id=id, @@ -6069,30 +6317,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="InventoryEntryCreated", + type="CustomerGroupSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "InventoryEntryCreatedMessage": - from ._schemas.message import InventoryEntryCreatedMessageSchema + ) -> "CustomerGroupSetMessage": + from ._schemas.message import CustomerGroupSetMessageSchema - return InventoryEntryCreatedMessageSchema().load(data) + return CustomerGroupSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import InventoryEntryCreatedMessageSchema + from ._schemas.message import CustomerGroupSetMessageSchema - return InventoryEntryCreatedMessageSchema().dump(self) + return CustomerGroupSetMessageSchema().dump(self) -class InventoryEntryDeletedMessage(Message): - """Generated after a successful [Delete InventoryEntry](/../api/projects/inventory#delete-inventoryentry) request.""" +class CustomerLastNameSetMessage(Message): + """Generated after a successful [Set Last Name](ctp:api:type:CustomerSetLastNameAction) update action.""" - #: The `sku` of the [InventoryEntry](ctp:api:type:InventoryEntry) that was deleted. - sku: str - #: [Reference](ctp:api:type:Reference) to the [Channel](ctp:api:type:Channel) where the [InventoryEntry](ctp:api:type:InventoryEntry) was deleted. - supply_channel: typing.Optional["ChannelReference"] + #: The `lastName` that was set during the [Set Last Name](ctp:api:type:CustomerSetLastNameAction) update action. + last_name: typing.Optional[str] def __init__( self, @@ -6109,11 +6355,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - sku: str, - supply_channel: typing.Optional["ChannelReference"] = None + last_name: typing.Optional[str] = None ): - self.sku = sku - self.supply_channel = supply_channel + self.last_name = last_name super().__init__( id=id, @@ -6126,39 +6370,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="InventoryEntryDeleted", + type="CustomerLastNameSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "InventoryEntryDeletedMessage": - from ._schemas.message import InventoryEntryDeletedMessageSchema + ) -> "CustomerLastNameSetMessage": + from ._schemas.message import CustomerLastNameSetMessageSchema - return InventoryEntryDeletedMessageSchema().load(data) + return CustomerLastNameSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import InventoryEntryDeletedMessageSchema - - return InventoryEntryDeletedMessageSchema().dump(self) + from ._schemas.message import CustomerLastNameSetMessageSchema + return CustomerLastNameSetMessageSchema().dump(self) -class InventoryEntryQuantitySetMessage(Message): - """Generated after a successful [Add Quantity](ctp:api:type:InventoryEntryAddQuantityAction), [Remove Quantity](ctp:api:type:InventoryEntryRemoveQuantityAction) or [Change Quantity](ctp:api:type:InventoryEntryChangeQuantityAction) update action. - Inventory changes as a result of [Order creation](/../api/projects/orders#create-order) do not trigger this message. - """ +class CustomerPasswordTokenCreatedMessage(Message): + """Generated after a successful [Create password reset token for Customer](ctp:api:endpoint:/{projectKey}/customers/password-token:POST) request. The `resource` property of the Message is a [CustomerPasswordTokenReference](ctp:api:type:CustomerPasswordTokenReference).""" - #: Quantity on stock for the [InventoryEntry](ctp:api:type:InventoryEntry) before the quantity was updated. - old_quantity_on_stock: int - #: Quantity on stock for the [InventoryEntry](ctp:api:type:InventoryEntry) after the quantity was updated. - new_quantity_on_stock: int - #: Available quantity for the [InventoryEntry](ctp:api:type:InventoryEntry) before the quantity was updated. - old_available_quantity: int - #: Available quantity for the [InventoryEntry](ctp:api:type:InventoryEntry) after the quantity was updated. - new_available_quantity: int - #: [Reference](ctp:api:type:Reference) to the [Channel](ctp:api:type:Channel) where the [InventoryEntry](ctp:api:type:InventoryEntry) quantity was set. - supply_channel: typing.Optional["ChannelReference"] + #: Unique identifier of the Customer. + customer_id: str + #: Date and time (UTC) the password token expires. + expires_at: datetime.datetime def __init__( self, @@ -6175,17 +6410,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - old_quantity_on_stock: int, - new_quantity_on_stock: int, - old_available_quantity: int, - new_available_quantity: int, - supply_channel: typing.Optional["ChannelReference"] = None + customer_id: str, + expires_at: datetime.datetime ): - self.old_quantity_on_stock = old_quantity_on_stock - self.new_quantity_on_stock = new_quantity_on_stock - self.old_available_quantity = old_available_quantity - self.new_available_quantity = new_available_quantity - self.supply_channel = supply_channel + self.customer_id = customer_id + self.expires_at = expires_at super().__init__( id=id, @@ -6198,131 +6427,185 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="InventoryEntryQuantitySet", + type="CustomerPasswordTokenCreated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "InventoryEntryQuantitySetMessage": - from ._schemas.message import InventoryEntryQuantitySetMessageSchema + ) -> "CustomerPasswordTokenCreatedMessage": + from ._schemas.message import CustomerPasswordTokenCreatedMessageSchema - return InventoryEntryQuantitySetMessageSchema().load(data) + return CustomerPasswordTokenCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import InventoryEntryQuantitySetMessageSchema + from ._schemas.message import CustomerPasswordTokenCreatedMessageSchema - return InventoryEntryQuantitySetMessageSchema().dump(self) + return CustomerPasswordTokenCreatedMessageSchema().dump(self) -class MessagePagedQueryResponse(_BaseType): - """[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with `results` containing an array of [Message](ctp:api:type:Message).""" +class CustomerPasswordUpdatedMessage(Message): + """Generated after a successful [Reset Customer's Password](ctp:api:endpoint:/{projectKey}/customers/password/reset:POST), [Reset Customer's Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password/reset:POST), [Change Customer's Password](ctp:api:endpoint:/{projectKey}/customers/password:POST), or [Change Customer's Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password:POST) request. This Message is also produced during equivalent requests to the [My Customer Profile](/../api/projects/me-profile) endpoint.""" - #: Number of [results requested](/../api/general-concepts#limit). - limit: int - #: Actual number of results returned. - count: int - #: Total number of results matching the query. - #: This number is an estimation that is not [strongly consistent](/../api/general-concepts#strong-consistency). - #: This field is returned by default. - #: For improved performance, calculating this field can be deactivated by using the query parameter `withTotal=false`. - #: When the results are filtered with a [Query Predicate](/../api/predicates/query), `total` is subject to a [limit](/../api/limits#queries). - total: typing.Optional[int] - #: Number of [elements skipped](/../api/general-concepts#offset). - offset: int - #: [Messages](ctp:api:type:Message) matching the query. - results: typing.List["Message"] + #: Whether the Customer's password was updated during the [Reset password](ctp:api:endpoint:/{projectKey}/customers/password/reset:POST) or [Change password](ctp:api:endpoint:/{projectKey}/customers/password:POST) flow. + reset: bool def __init__( self, *, - limit: int, - count: int, - total: typing.Optional[int] = None, - offset: int, - results: typing.List["Message"] + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + reset: bool ): - self.limit = limit - self.count = count - self.total = total - self.offset = offset - self.results = results + self.reset = reset - super().__init__() + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="CustomerPasswordUpdated", + ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "MessagePagedQueryResponse": - from ._schemas.message import MessagePagedQueryResponseSchema + ) -> "CustomerPasswordUpdatedMessage": + from ._schemas.message import CustomerPasswordUpdatedMessageSchema - return MessagePagedQueryResponseSchema().load(data) + return CustomerPasswordUpdatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import MessagePagedQueryResponseSchema + from ._schemas.message import CustomerPasswordUpdatedMessageSchema - return MessagePagedQueryResponseSchema().dump(self) + return CustomerPasswordUpdatedMessageSchema().dump(self) -class MessagesConfiguration(_BaseType): - """Holds the configuration for the [Messages Query](/../api/projects/messages) feature for the Project.""" +class CustomerTitleSetMessage(Message): + """Generated after a successful [Set Title](ctp:api:type:CustomerSetTitleAction) update action.""" - #: When `true`, the [Messages Query](/../api/projects/messages) feature is active. - enabled: bool - #: Specifies the number of days each Message should be available via the [Messages Query](/../api/projects/messages) API. - #: For Messages older than the specified period, it is not guaranteed that they are still accessible via the API. - #: This field may not be present on Projects created before 8 October 2018. - delete_days_after_creation: typing.Optional[int] + #: The `title` that was set during the [Set Title](ctp:api:type:CustomerSetTitleAction) update action. + title: typing.Optional[str] def __init__( - self, *, enabled: bool, delete_days_after_creation: typing.Optional[int] = None + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + title: typing.Optional[str] = None ): - self.enabled = enabled - self.delete_days_after_creation = delete_days_after_creation + self.title = title - super().__init__() + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="CustomerTitleSet", + ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagesConfiguration": - from ._schemas.message import MessagesConfigurationSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CustomerTitleSetMessage": + from ._schemas.message import CustomerTitleSetMessageSchema - return MessagesConfigurationSchema().load(data) + return CustomerTitleSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import MessagesConfigurationSchema + from ._schemas.message import CustomerTitleSetMessageSchema - return MessagesConfigurationSchema().dump(self) + return CustomerTitleSetMessageSchema().dump(self) -class MessagesConfigurationDraft(_BaseType): - """Defines the configuration for the [Messages Query](/../api/projects/messages) feature for the Project.""" +class DiscountCodeCreatedMessage(Message): + """Generated after a successful [Create DiscountCode](ctp:api:endpoint:/{projectKey}/discount-codes:POST) request.""" - #: Setting to `true` activates the [Messages Query](/../api/projects/messages) feature. - enabled: bool - #: Specifies the number of days each Message should be available via the [Messages Query](/../api/projects/messages) API. For Messages older than the specified period, it is not guaranteed that they are still accessible via the API. - delete_days_after_creation: int + #: The [Discount Code](ctp:api:type:DiscountCode) that was created. + discount_code: "DiscountCode" - def __init__(self, *, enabled: bool, delete_days_after_creation: int): - self.enabled = enabled - self.delete_days_after_creation = delete_days_after_creation + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + discount_code: "DiscountCode" + ): + self.discount_code = discount_code - super().__init__() + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="DiscountCodeCreated", + ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "MessagesConfigurationDraft": - from ._schemas.message import MessagesConfigurationDraftSchema + ) -> "DiscountCodeCreatedMessage": + from ._schemas.message import DiscountCodeCreatedMessageSchema - return MessagesConfigurationDraftSchema().load(data) + return DiscountCodeCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import MessagesConfigurationDraftSchema + from ._schemas.message import DiscountCodeCreatedMessageSchema - return MessagesConfigurationDraftSchema().dump(self) + return DiscountCodeCreatedMessageSchema().dump(self) -class OrderMessage(Message): +class DiscountCodeDeletedMessage(Message): + """Generated after a successful [Delete DiscountCode](ctp:api:endpoint:/{projectKey}/discount-codes/{id}:DELETE) request.""" + def __init__( self, *, @@ -6335,11 +6618,11 @@ def __init__( sequence_number: int, resource: "Reference", resource_version: int, - type: str, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None ): + super().__init__( id=id, version=version, @@ -6350,226 +6633,1467 @@ def __init__( sequence_number=sequence_number, resource=resource, resource_version=resource_version, - type=type, resource_user_provided_identifiers=resource_user_provided_identifiers, + type="DiscountCodeDeleted", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderMessage": - if data["type"] == "CustomLineItemStateTransition": - from ._schemas.message import CustomLineItemStateTransitionMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountCodeDeletedMessage": + from ._schemas.message import DiscountCodeDeletedMessageSchema - return CustomLineItemStateTransitionMessageSchema().load(data) - if data["type"] == "DeliveryAdded": - from ._schemas.message import DeliveryAddedMessageSchema + return DiscountCodeDeletedMessageSchema().load(data) - return DeliveryAddedMessageSchema().load(data) - if data["type"] == "DeliveryAddressSet": - from ._schemas.message import DeliveryAddressSetMessageSchema + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DiscountCodeDeletedMessageSchema - return DeliveryAddressSetMessageSchema().load(data) - if data["type"] == "DeliveryItemsUpdated": - from ._schemas.message import DeliveryItemsUpdatedMessageSchema + return DiscountCodeDeletedMessageSchema().dump(self) - return DeliveryItemsUpdatedMessageSchema().load(data) - if data["type"] == "DeliveryRemoved": - from ._schemas.message import DeliveryRemovedMessageSchema - return DeliveryRemovedMessageSchema().load(data) - if data["type"] == "LineItemStateTransition": - from ._schemas.message import LineItemStateTransitionMessageSchema +class DiscountCodeKeySetMessage(Message): + """Generated after a successful [Set Key](ctp:api:type:DiscountCodeSetKeyAction) update action.""" - return LineItemStateTransitionMessageSchema().load(data) - if data["type"] == "OrderBillingAddressSet": - from ._schemas.message import OrderBillingAddressSetMessageSchema + #: `key` value of the [Discount Code](ctp:api:type:DiscountCode) after the [Set Key](ctp:api:type:DiscountCodeSetKeyAction) update action. + key: typing.Optional[str] + #: `key` value of the [Discount Code](ctp:api:type:DiscountCode) before the [Set Key](ctp:api:type:DiscountCodeSetKeyAction) update action. + old_key: typing.Optional[str] - return OrderBillingAddressSetMessageSchema().load(data) - if data["type"] == "OrderCreated": - from ._schemas.message import OrderCreatedMessageSchema + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + key: typing.Optional[str] = None, + old_key: typing.Optional[str] = None + ): + self.key = key + self.old_key = old_key - return OrderCreatedMessageSchema().load(data) - if data["type"] == "OrderCustomFieldAdded": - from ._schemas.message import OrderCustomFieldAddedMessageSchema + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="DiscountCodeKeySet", + ) - return OrderCustomFieldAddedMessageSchema().load(data) - if data["type"] == "OrderCustomFieldChanged": - from ._schemas.message import OrderCustomFieldChangedMessageSchema + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountCodeKeySetMessage": + from ._schemas.message import DiscountCodeKeySetMessageSchema + + return DiscountCodeKeySetMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DiscountCodeKeySetMessageSchema + + return DiscountCodeKeySetMessageSchema().dump(self) + + +class InventoryEntryCreatedMessage(Message): + """Generated after a successful [Create InventoryEntry](ctp:api:endpoint:/{projectKey}/inventory:POST) request.""" + + #: [InventoryEntry](ctp:api:type:InventoryEntry) that was created. + inventory_entry: "InventoryEntry" + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + inventory_entry: "InventoryEntry" + ): + self.inventory_entry = inventory_entry + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="InventoryEntryCreated", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "InventoryEntryCreatedMessage": + from ._schemas.message import InventoryEntryCreatedMessageSchema + + return InventoryEntryCreatedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import InventoryEntryCreatedMessageSchema + + return InventoryEntryCreatedMessageSchema().dump(self) + + +class InventoryEntryDeletedMessage(Message): + """Generated after a successful [Delete InventoryEntry](/../api/projects/inventory#delete-inventoryentry) request.""" + + #: The `sku` of the [InventoryEntry](ctp:api:type:InventoryEntry) that was deleted. + sku: str + #: [Reference](ctp:api:type:Reference) to the [Channel](ctp:api:type:Channel) where the [InventoryEntry](ctp:api:type:InventoryEntry) was deleted. + supply_channel: typing.Optional["ChannelReference"] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + sku: str, + supply_channel: typing.Optional["ChannelReference"] = None + ): + self.sku = sku + self.supply_channel = supply_channel + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="InventoryEntryDeleted", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "InventoryEntryDeletedMessage": + from ._schemas.message import InventoryEntryDeletedMessageSchema + + return InventoryEntryDeletedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import InventoryEntryDeletedMessageSchema + + return InventoryEntryDeletedMessageSchema().dump(self) + + +class InventoryEntryQuantitySetMessage(Message): + """Generated after a successful [Add Quantity](ctp:api:type:InventoryEntryAddQuantityAction), [Remove Quantity](ctp:api:type:InventoryEntryRemoveQuantityAction) or [Change Quantity](ctp:api:type:InventoryEntryChangeQuantityAction) update action. + Inventory changes as a result of [Order creation](ctp:api:endpoint:/{projectKey}/orders:POST) do not trigger this message. + + """ + + #: Quantity on stock for the [InventoryEntry](ctp:api:type:InventoryEntry) before the quantity was updated. + old_quantity_on_stock: int + #: Quantity on stock for the [InventoryEntry](ctp:api:type:InventoryEntry) after the quantity was updated. + new_quantity_on_stock: int + #: Available quantity for the [InventoryEntry](ctp:api:type:InventoryEntry) before the quantity was updated. + old_available_quantity: int + #: Available quantity for the [InventoryEntry](ctp:api:type:InventoryEntry) after the quantity was updated. + new_available_quantity: int + #: [Reference](ctp:api:type:Reference) to the [Channel](ctp:api:type:Channel) where the [InventoryEntry](ctp:api:type:InventoryEntry) quantity was set. + supply_channel: typing.Optional["ChannelReference"] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + old_quantity_on_stock: int, + new_quantity_on_stock: int, + old_available_quantity: int, + new_available_quantity: int, + supply_channel: typing.Optional["ChannelReference"] = None + ): + self.old_quantity_on_stock = old_quantity_on_stock + self.new_quantity_on_stock = new_quantity_on_stock + self.old_available_quantity = old_available_quantity + self.new_available_quantity = new_available_quantity + self.supply_channel = supply_channel + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="InventoryEntryQuantitySet", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "InventoryEntryQuantitySetMessage": + from ._schemas.message import InventoryEntryQuantitySetMessageSchema + + return InventoryEntryQuantitySetMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import InventoryEntryQuantitySetMessageSchema + + return InventoryEntryQuantitySetMessageSchema().dump(self) + + +class MessagePagedQueryResponse(_BaseType): + """[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with `results` containing an array of [Message](ctp:api:type:Message).""" + + #: Number of [results requested](/../api/general-concepts#limit). + limit: int + #: Actual number of results returned. + count: int + #: Total number of results matching the query. + #: This number is an estimation that is not [strongly consistent](/../api/general-concepts#strong-consistency). + #: This field is returned by default. + #: For improved performance, calculating this field can be deactivated by using the query parameter `withTotal=false`. + #: When the results are filtered with a [Query Predicate](/../api/predicates/query), `total` is subject to a [limit](/../api/limits#queries). + total: typing.Optional[int] + #: Number of [elements skipped](/../api/general-concepts#offset). + offset: int + #: [Messages](ctp:api:type:Message) matching the query. + results: typing.List["Message"] + + def __init__( + self, + *, + limit: int, + count: int, + total: typing.Optional[int] = None, + offset: int, + results: typing.List["Message"] + ): + self.limit = limit + self.count = count + self.total = total + self.offset = offset + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "MessagePagedQueryResponse": + from ._schemas.message import MessagePagedQueryResponseSchema + + return MessagePagedQueryResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import MessagePagedQueryResponseSchema + + return MessagePagedQueryResponseSchema().dump(self) + + +class MessagesConfiguration(_BaseType): + """Holds the configuration for the [Messages Query](/../api/projects/messages) feature for the Project.""" + + #: When `true`, the [Messages Query](/../api/projects/messages) feature is active. + enabled: bool + #: Specifies the number of days each Message should be available via the [Messages Query](/../api/projects/messages) API. + #: For Messages older than the specified period, it is not guaranteed that they are still accessible via the API. + #: This field may not be present on Projects created before 8 October 2018. + delete_days_after_creation: typing.Optional[int] + + def __init__( + self, *, enabled: bool, delete_days_after_creation: typing.Optional[int] = None + ): + self.enabled = enabled + self.delete_days_after_creation = delete_days_after_creation + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagesConfiguration": + from ._schemas.message import MessagesConfigurationSchema + + return MessagesConfigurationSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import MessagesConfigurationSchema + + return MessagesConfigurationSchema().dump(self) + + +class MessagesConfigurationDraft(_BaseType): + """Defines the configuration for the [Messages Query](/../api/projects/messages) feature for the Project.""" + + #: Setting to `true` activates the [Messages Query](/../api/projects/messages) feature. + enabled: bool + #: Specifies the number of days each Message should be available via the [Messages Query](/../api/projects/messages) API. For Messages older than the specified period, it is not guaranteed that they are still accessible via the API. + delete_days_after_creation: int + + def __init__(self, *, enabled: bool, delete_days_after_creation: int): + self.enabled = enabled + self.delete_days_after_creation = delete_days_after_creation + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "MessagesConfigurationDraft": + from ._schemas.message import MessagesConfigurationDraftSchema + + return MessagesConfigurationDraftSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import MessagesConfigurationDraftSchema + + return MessagesConfigurationDraftSchema().dump(self) + + +class OrderMessage(Message): + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + type: str, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None + ): + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + type=type, + resource_user_provided_identifiers=resource_user_provided_identifiers, + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderMessage": + if data["type"] == "CustomLineItemStateTransition": + from ._schemas.message import CustomLineItemStateTransitionMessageSchema + + return CustomLineItemStateTransitionMessageSchema().load(data) + if data["type"] == "DeliveryAdded": + from ._schemas.message import DeliveryAddedMessageSchema + + return DeliveryAddedMessageSchema().load(data) + if data["type"] == "DeliveryAddressSet": + from ._schemas.message import DeliveryAddressSetMessageSchema + + return DeliveryAddressSetMessageSchema().load(data) + if data["type"] == "DeliveryItemsUpdated": + from ._schemas.message import DeliveryItemsUpdatedMessageSchema + + return DeliveryItemsUpdatedMessageSchema().load(data) + if data["type"] == "DeliveryRemoved": + from ._schemas.message import DeliveryRemovedMessageSchema + + return DeliveryRemovedMessageSchema().load(data) + if data["type"] == "LineItemStateTransition": + from ._schemas.message import LineItemStateTransitionMessageSchema + + return LineItemStateTransitionMessageSchema().load(data) + if data["type"] == "OrderBillingAddressSet": + from ._schemas.message import OrderBillingAddressSetMessageSchema + + return OrderBillingAddressSetMessageSchema().load(data) + if data["type"] == "OrderCreated": + from ._schemas.message import OrderCreatedMessageSchema + + return OrderCreatedMessageSchema().load(data) + if data["type"] == "OrderCustomFieldAdded": + from ._schemas.message import OrderCustomFieldAddedMessageSchema + + return OrderCustomFieldAddedMessageSchema().load(data) + if data["type"] == "OrderCustomFieldChanged": + from ._schemas.message import OrderCustomFieldChangedMessageSchema + + return OrderCustomFieldChangedMessageSchema().load(data) + if data["type"] == "OrderCustomFieldRemoved": + from ._schemas.message import OrderCustomFieldRemovedMessageSchema + + return OrderCustomFieldRemovedMessageSchema().load(data) + if data["type"] == "OrderCustomLineItemAdded": + from ._schemas.message import OrderCustomLineItemAddedMessageSchema + + return OrderCustomLineItemAddedMessageSchema().load(data) + if data["type"] == "OrderCustomLineItemDiscountSet": + from ._schemas.message import OrderCustomLineItemDiscountSetMessageSchema + + return OrderCustomLineItemDiscountSetMessageSchema().load(data) + if data["type"] == "OrderCustomLineItemQuantityChanged": + from ._schemas.message import ( + OrderCustomLineItemQuantityChangedMessageSchema, + ) + + return OrderCustomLineItemQuantityChangedMessageSchema().load(data) + if data["type"] == "OrderCustomLineItemRemoved": + from ._schemas.message import OrderCustomLineItemRemovedMessageSchema + + return OrderCustomLineItemRemovedMessageSchema().load(data) + if data["type"] == "OrderCustomTypeRemoved": + from ._schemas.message import OrderCustomTypeRemovedMessageSchema + + return OrderCustomTypeRemovedMessageSchema().load(data) + if data["type"] == "OrderCustomTypeSet": + from ._schemas.message import OrderCustomTypeSetMessageSchema + + return OrderCustomTypeSetMessageSchema().load(data) + if data["type"] == "OrderCustomerEmailSet": + from ._schemas.message import OrderCustomerEmailSetMessageSchema + + return OrderCustomerEmailSetMessageSchema().load(data) + if data["type"] == "OrderCustomerGroupSet": + from ._schemas.message import OrderCustomerGroupSetMessageSchema + + return OrderCustomerGroupSetMessageSchema().load(data) + if data["type"] == "OrderCustomerSet": + from ._schemas.message import OrderCustomerSetMessageSchema + + return OrderCustomerSetMessageSchema().load(data) + if data["type"] == "OrderDeleted": + from ._schemas.message import OrderDeletedMessageSchema + + return OrderDeletedMessageSchema().load(data) + if data["type"] == "OrderDiscountCodeAdded": + from ._schemas.message import OrderDiscountCodeAddedMessageSchema + + return OrderDiscountCodeAddedMessageSchema().load(data) + if data["type"] == "OrderDiscountCodeRemoved": + from ._schemas.message import OrderDiscountCodeRemovedMessageSchema + + return OrderDiscountCodeRemovedMessageSchema().load(data) + if data["type"] == "OrderDiscountCodeStateSet": + from ._schemas.message import OrderDiscountCodeStateSetMessageSchema + + return OrderDiscountCodeStateSetMessageSchema().load(data) + if data["type"] == "OrderEditApplied": + from ._schemas.message import OrderEditAppliedMessageSchema + + return OrderEditAppliedMessageSchema().load(data) + if data["type"] == "OrderImported": + from ._schemas.message import OrderImportedMessageSchema + + return OrderImportedMessageSchema().load(data) + if data["type"] == "OrderLineItemAdded": + from ._schemas.message import OrderLineItemAddedMessageSchema + + return OrderLineItemAddedMessageSchema().load(data) + if data["type"] == "OrderLineItemDiscountSet": + from ._schemas.message import OrderLineItemDiscountSetMessageSchema + + return OrderLineItemDiscountSetMessageSchema().load(data) + if data["type"] == "OrderLineItemDistributionChannelSet": + from ._schemas.message import ( + OrderLineItemDistributionChannelSetMessageSchema, + ) + + return OrderLineItemDistributionChannelSetMessageSchema().load(data) + if data["type"] == "OrderLineItemRemoved": + from ._schemas.message import OrderLineItemRemovedMessageSchema + + return OrderLineItemRemovedMessageSchema().load(data) + if data["type"] == "OrderPaymentStateChanged": + from ._schemas.message import OrderPaymentStateChangedMessageSchema + + return OrderPaymentStateChangedMessageSchema().load(data) + if data["type"] == "OrderPurchaseOrderNumberSet": + from ._schemas.message import OrderPurchaseOrderNumberSetMessageSchema + + return OrderPurchaseOrderNumberSetMessageSchema().load(data) + if data["type"] == "OrderReturnShipmentStateChanged": + from ._schemas.message import OrderReturnShipmentStateChangedMessageSchema + + return OrderReturnShipmentStateChangedMessageSchema().load(data) + if data["type"] == "OrderShipmentStateChanged": + from ._schemas.message import OrderShipmentStateChangedMessageSchema + + return OrderShipmentStateChangedMessageSchema().load(data) + if data["type"] == "OrderShippingAddressSet": + from ._schemas.message import OrderShippingAddressSetMessageSchema + + return OrderShippingAddressSetMessageSchema().load(data) + if data["type"] == "OrderShippingInfoSet": + from ._schemas.message import OrderShippingInfoSetMessageSchema + + return OrderShippingInfoSetMessageSchema().load(data) + if data["type"] == "OrderShippingRateInputSet": + from ._schemas.message import OrderShippingRateInputSetMessageSchema + + return OrderShippingRateInputSetMessageSchema().load(data) + if data["type"] == "OrderStateChanged": + from ._schemas.message import OrderStateChangedMessageSchema + + return OrderStateChangedMessageSchema().load(data) + if data["type"] == "OrderStateTransition": + from ._schemas.message import OrderStateTransitionMessageSchema + + return OrderStateTransitionMessageSchema().load(data) + if data["type"] == "OrderStoreSet": + from ._schemas.message import OrderStoreSetMessageSchema + + return OrderStoreSetMessageSchema().load(data) + if data["type"] == "ParcelAddedToDelivery": + from ._schemas.message import ParcelAddedToDeliveryMessageSchema + + return ParcelAddedToDeliveryMessageSchema().load(data) + if data["type"] == "ParcelItemsUpdated": + from ._schemas.message import ParcelItemsUpdatedMessageSchema + + return ParcelItemsUpdatedMessageSchema().load(data) + if data["type"] == "ParcelMeasurementsUpdated": + from ._schemas.message import ParcelMeasurementsUpdatedMessageSchema + + return ParcelMeasurementsUpdatedMessageSchema().load(data) + if data["type"] == "ParcelRemovedFromDelivery": + from ._schemas.message import ParcelRemovedFromDeliveryMessageSchema + + return ParcelRemovedFromDeliveryMessageSchema().load(data) + if data["type"] == "ParcelTrackingDataUpdated": + from ._schemas.message import ParcelTrackingDataUpdatedMessageSchema + + return ParcelTrackingDataUpdatedMessageSchema().load(data) + if data["type"] == "ReturnInfoAdded": + from ._schemas.message import ReturnInfoAddedMessageSchema + + return ReturnInfoAddedMessageSchema().load(data) + if data["type"] == "ReturnInfoSet": + from ._schemas.message import ReturnInfoSetMessageSchema + + return ReturnInfoSetMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderMessageSchema + + return OrderMessageSchema().dump(self) + + +class CustomLineItemStateTransitionMessage(OrderMessage): + """Generated after a successful [Transition CustomLineItem State](ctp:api:type:OrderTransitionCustomLineItemStateAction) update action.""" + + #: Unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). + custom_line_item_id: str + #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). + custom_line_item_key: typing.Optional[str] + #: Date and time (UTC) the transition of the [Custom Line Item](ctp:api:type:CustomLineItem) [State](ctp:api:type:State) was performed. + transition_date: datetime.datetime + #: Number of [Custom Line Items](ctp:api:type:CustomLineItem) for which the [State](ctp:api:type:State) was transitioned. + quantity: int + #: [State](ctp:api:type:State) the [Custom Line Item](ctp:api:type:CustomLineItem) was transitioned from. + from_state: "StateReference" + #: [State](ctp:api:type:State) the [Custom Line Item](ctp:api:type:CustomLineItem) was transitioned to. + to_state: "StateReference" + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + custom_line_item_id: str, + custom_line_item_key: typing.Optional[str] = None, + transition_date: datetime.datetime, + quantity: int, + from_state: "StateReference", + to_state: "StateReference" + ): + self.custom_line_item_id = custom_line_item_id + self.custom_line_item_key = custom_line_item_key + self.transition_date = transition_date + self.quantity = quantity + self.from_state = from_state + self.to_state = to_state + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="CustomLineItemStateTransition", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CustomLineItemStateTransitionMessage": + from ._schemas.message import CustomLineItemStateTransitionMessageSchema + + return CustomLineItemStateTransitionMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import CustomLineItemStateTransitionMessageSchema + + return CustomLineItemStateTransitionMessageSchema().dump(self) + + +class DeliveryAddedMessage(OrderMessage): + """Generated after a successful [Add Delivery](ctp:api:type:OrderAddDeliveryAction) update action.""" + + #: [Delivery](ctp:api:type:Delivery) that was added to the [Order](ctp:api:type:Order). The [Delivery](ctp:api:type:Delivery) in the Message body does not contain [Parcels](ctp:api:type:Parcel) if those were part of the initial [Add Delivery](ctp:api:type:OrderAddDeliveryAction) update action. In that case, the update action produces an additional [Parcel Added To Delivery](ctp:api:type:ParcelAddedToDeliveryMessage) Message containing information about the [Parcels](ctp:api:type:Parcel). + delivery: "Delivery" + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + delivery: "Delivery", + shipping_key: typing.Optional[str] = None + ): + self.delivery = delivery + self.shipping_key = shipping_key + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="DeliveryAdded", + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeliveryAddedMessage": + from ._schemas.message import DeliveryAddedMessageSchema + + return DeliveryAddedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DeliveryAddedMessageSchema + + return DeliveryAddedMessageSchema().dump(self) + + +class DeliveryAddressSetMessage(OrderMessage): + """Generated after a successful [Set Delivery Address](ctp:api:type:OrderSetDeliveryAddressAction) update action.""" + + #: Unique identifier of the [Parcel](ctp:api:type:Delivery). + delivery_id: str + #: [Address](ctp:api:type:Address) after the [Set Delivery Address](ctp:api:type:OrderSetDeliveryAddressAction) update action. + address: typing.Optional["Address"] + #: [Address](ctp:api:type:Address) before the [Set Delivery Address](ctp:api:type:OrderSetDeliveryAddressAction) update action. + old_address: typing.Optional["Address"] + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + delivery_id: str, + address: typing.Optional["Address"] = None, + old_address: typing.Optional["Address"] = None, + shipping_key: typing.Optional[str] = None + ): + self.delivery_id = delivery_id + self.address = address + self.old_address = old_address + self.shipping_key = shipping_key + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="DeliveryAddressSet", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeliveryAddressSetMessage": + from ._schemas.message import DeliveryAddressSetMessageSchema + + return DeliveryAddressSetMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DeliveryAddressSetMessageSchema + + return DeliveryAddressSetMessageSchema().dump(self) + + +class DeliveryItemsUpdatedMessage(OrderMessage): + """Generated after a successful [Set Delivery Items](ctp:api:type:OrderSetDeliveryItemsAction) update action.""" + + #: Unique identifier of the [Delivery](ctp:api:type:Delivery). + delivery_id: str + #: [Delivery Items](ctp:api:type:DeliveryItem) after the [Set Delivery Items](ctp:api:type:OrderSetDeliveryItemsAction) update action. + items: typing.List["DeliveryItem"] + #: [Delivery Items](ctp:api:type:DeliveryItem) before the [Set Delivery Items](ctp:api:type:OrderSetDeliveryItemsAction) update action. + old_items: typing.List["DeliveryItem"] + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + delivery_id: str, + items: typing.List["DeliveryItem"], + old_items: typing.List["DeliveryItem"], + shipping_key: typing.Optional[str] = None + ): + self.delivery_id = delivery_id + self.items = items + self.old_items = old_items + self.shipping_key = shipping_key + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="DeliveryItemsUpdated", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeliveryItemsUpdatedMessage": + from ._schemas.message import DeliveryItemsUpdatedMessageSchema + + return DeliveryItemsUpdatedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DeliveryItemsUpdatedMessageSchema + + return DeliveryItemsUpdatedMessageSchema().dump(self) + + +class DeliveryRemovedMessage(OrderMessage): + """Generated after a successful [Remove Delivery](ctp:api:type:OrderRemoveDeliveryAction) update action.""" + + #: The [Delivery](ctp:api:type:Delivery) that was removed from the [Order](ctp:api:type:Order). + delivery: "Delivery" + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + delivery: "Delivery", + shipping_key: typing.Optional[str] = None + ): + self.delivery = delivery + self.shipping_key = shipping_key + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="DeliveryRemoved", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DeliveryRemovedMessage": + from ._schemas.message import DeliveryRemovedMessageSchema + + return DeliveryRemovedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DeliveryRemovedMessageSchema + + return DeliveryRemovedMessageSchema().dump(self) + + +class LineItemStateTransitionMessage(OrderMessage): + """Generated after a successful [Transition LineItem State](ctp:api:type:OrderTransitionLineItemStateAction) update action.""" + + #: Unique identifier of the [Line Item](ctp:api:type:LineItem). + line_item_id: str + #: User-defined unique identifier of the LineItem. + line_item_key: typing.Optional[str] + #: Date and time (UTC) the transition of the [Line Item](ctp:api:type:LineItem) [State](ctp:api:type:State) was performed. + transition_date: datetime.datetime + #: Number of [Line Items](ctp:api:type:LineItem) for which the [State](ctp:api:type:State) was transitioned. + quantity: int + #: [State](ctp:api:type:State) the [Line Item](ctp:api:type:LineItem) was transitioned from. + from_state: "StateReference" + #: [State](ctp:api:type:State) the [Line Item](ctp:api:type:LineItem) was transitioned to. + to_state: "StateReference" + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + line_item_id: str, + line_item_key: typing.Optional[str] = None, + transition_date: datetime.datetime, + quantity: int, + from_state: "StateReference", + to_state: "StateReference" + ): + self.line_item_id = line_item_id + self.line_item_key = line_item_key + self.transition_date = transition_date + self.quantity = quantity + self.from_state = from_state + self.to_state = to_state + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="LineItemStateTransition", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "LineItemStateTransitionMessage": + from ._schemas.message import LineItemStateTransitionMessageSchema + + return LineItemStateTransitionMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import LineItemStateTransitionMessageSchema + + return LineItemStateTransitionMessageSchema().dump(self) + + +class OrderBillingAddressSetMessage(OrderMessage): + """Generated after a successful [Set Billing Address](ctp:api:type:OrderSetBillingAddressAction) update action.""" + + #: Billing address on the Order after the [Set Billing Address](ctp:api:type:OrderSetBillingAddressAction) update action. + address: typing.Optional["Address"] + #: Billing address on the Order before the [Set Billing Address](ctp:api:type:OrderSetBillingAddressAction) update action. + old_address: typing.Optional["Address"] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + address: typing.Optional["Address"] = None, + old_address: typing.Optional["Address"] = None + ): + self.address = address + self.old_address = old_address + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderBillingAddressSet", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderBillingAddressSetMessage": + from ._schemas.message import OrderBillingAddressSetMessageSchema + + return OrderBillingAddressSetMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderBillingAddressSetMessageSchema + + return OrderBillingAddressSetMessageSchema().dump(self) + + +class OrderCreatedMessage(OrderMessage): + """Generated after a successful [Create Order](ctp:api:endpoint:/{projectKey}/orders:POST) request.""" + + #: [Order](ctp:api:type:Order) that was created. + order: "Order" + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + order: "Order" + ): + self.order = order + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCreated", + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderCreatedMessage": + from ._schemas.message import OrderCreatedMessageSchema + + return OrderCreatedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderCreatedMessageSchema + + return OrderCreatedMessageSchema().dump(self) + + +class OrderCustomFieldAddedMessage(OrderMessage): + """Generated after adding a Custom Field using the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction).""" + + #: Name of the Custom Field that was added. + name: str + #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). + value: typing.Any + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + name: str, + value: typing.Any + ): + self.name = name + self.value = value + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCustomFieldAdded", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomFieldAddedMessage": + from ._schemas.message import OrderCustomFieldAddedMessageSchema + + return OrderCustomFieldAddedMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderCustomFieldAddedMessageSchema + + return OrderCustomFieldAddedMessageSchema().dump(self) + + +class OrderCustomFieldChangedMessage(OrderMessage): + """Generated when an existing Custom Field has been changed using the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) action.""" + + #: Name of the Custom Field that changed. + name: str + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) update action. + value: typing.Any + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) update action. + #: When there has not been a Custom Field with the `name` on the Order before, an [Order Custom Field Added](ctp:api:type:OrderCustomFieldAddedMessage) Message is generated instead. + previous_value: typing.Optional[typing.Any] - return OrderCustomFieldChangedMessageSchema().load(data) - if data["type"] == "OrderCustomFieldRemoved": - from ._schemas.message import OrderCustomFieldRemovedMessageSchema + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + name: str, + value: typing.Any, + previous_value: typing.Optional[typing.Any] = None + ): + self.name = name + self.value = value + self.previous_value = previous_value - return OrderCustomFieldRemovedMessageSchema().load(data) - if data["type"] == "OrderCustomLineItemAdded": - from ._schemas.message import OrderCustomLineItemAddedMessageSchema + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCustomFieldChanged", + ) - return OrderCustomLineItemAddedMessageSchema().load(data) - if data["type"] == "OrderCustomLineItemDiscountSet": - from ._schemas.message import OrderCustomLineItemDiscountSetMessageSchema + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomFieldChangedMessage": + from ._schemas.message import OrderCustomFieldChangedMessageSchema - return OrderCustomLineItemDiscountSetMessageSchema().load(data) - if data["type"] == "OrderCustomLineItemQuantityChanged": - from ._schemas.message import ( - OrderCustomLineItemQuantityChangedMessageSchema, - ) + return OrderCustomFieldChangedMessageSchema().load(data) - return OrderCustomLineItemQuantityChangedMessageSchema().load(data) - if data["type"] == "OrderCustomLineItemRemoved": - from ._schemas.message import OrderCustomLineItemRemovedMessageSchema + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderCustomFieldChangedMessageSchema - return OrderCustomLineItemRemovedMessageSchema().load(data) - if data["type"] == "OrderCustomTypeRemoved": - from ._schemas.message import OrderCustomTypeRemovedMessageSchema + return OrderCustomFieldChangedMessageSchema().dump(self) - return OrderCustomTypeRemovedMessageSchema().load(data) - if data["type"] == "OrderCustomTypeSet": - from ._schemas.message import OrderCustomTypeSetMessageSchema - return OrderCustomTypeSetMessageSchema().load(data) - if data["type"] == "OrderCustomerEmailSet": - from ._schemas.message import OrderCustomerEmailSetMessageSchema +class OrderCustomFieldRemovedMessage(OrderMessage): + """Generated when a Custom Field has been removed from the Order using the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) action.""" - return OrderCustomerEmailSetMessageSchema().load(data) - if data["type"] == "OrderCustomerGroupSet": - from ._schemas.message import OrderCustomerGroupSetMessageSchema + #: Name of the Custom Field that was removed. + name: str - return OrderCustomerGroupSetMessageSchema().load(data) - if data["type"] == "OrderCustomerSet": - from ._schemas.message import OrderCustomerSetMessageSchema + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + name: str + ): + self.name = name - return OrderCustomerSetMessageSchema().load(data) - if data["type"] == "OrderDeleted": - from ._schemas.message import OrderDeletedMessageSchema + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCustomFieldRemoved", + ) - return OrderDeletedMessageSchema().load(data) - if data["type"] == "OrderDiscountCodeAdded": - from ._schemas.message import OrderDiscountCodeAddedMessageSchema + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomFieldRemovedMessage": + from ._schemas.message import OrderCustomFieldRemovedMessageSchema - return OrderDiscountCodeAddedMessageSchema().load(data) - if data["type"] == "OrderDiscountCodeRemoved": - from ._schemas.message import OrderDiscountCodeRemovedMessageSchema + return OrderCustomFieldRemovedMessageSchema().load(data) - return OrderDiscountCodeRemovedMessageSchema().load(data) - if data["type"] == "OrderDiscountCodeStateSet": - from ._schemas.message import OrderDiscountCodeStateSetMessageSchema + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderCustomFieldRemovedMessageSchema - return OrderDiscountCodeStateSetMessageSchema().load(data) - if data["type"] == "OrderEditApplied": - from ._schemas.message import OrderEditAppliedMessageSchema + return OrderCustomFieldRemovedMessageSchema().dump(self) - return OrderEditAppliedMessageSchema().load(data) - if data["type"] == "OrderImported": - from ._schemas.message import OrderImportedMessageSchema - return OrderImportedMessageSchema().load(data) - if data["type"] == "OrderLineItemAdded": - from ._schemas.message import OrderLineItemAddedMessageSchema +class OrderCustomLineItemAddedMessage(OrderMessage): + """Generated after a successful [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction) update action.""" - return OrderLineItemAddedMessageSchema().load(data) - if data["type"] == "OrderLineItemDiscountSet": - from ._schemas.message import OrderLineItemDiscountSetMessageSchema + #: [Custom Line Item](ctp:api:type:CustomLineItem) that was added to the [Order](ctp:api:type:Order). + custom_line_item: "CustomLineItem" - return OrderLineItemDiscountSetMessageSchema().load(data) - if data["type"] == "OrderLineItemDistributionChannelSet": - from ._schemas.message import ( - OrderLineItemDistributionChannelSetMessageSchema, - ) + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + custom_line_item: "CustomLineItem" + ): + self.custom_line_item = custom_line_item - return OrderLineItemDistributionChannelSetMessageSchema().load(data) - if data["type"] == "OrderLineItemRemoved": - from ._schemas.message import OrderLineItemRemovedMessageSchema + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCustomLineItemAdded", + ) - return OrderLineItemRemovedMessageSchema().load(data) - if data["type"] == "OrderPaymentStateChanged": - from ._schemas.message import OrderPaymentStateChangedMessageSchema + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomLineItemAddedMessage": + from ._schemas.message import OrderCustomLineItemAddedMessageSchema - return OrderPaymentStateChangedMessageSchema().load(data) - if data["type"] == "OrderPurchaseOrderNumberSet": - from ._schemas.message import OrderPurchaseOrderNumberSetMessageSchema + return OrderCustomLineItemAddedMessageSchema().load(data) - return OrderPurchaseOrderNumberSetMessageSchema().load(data) - if data["type"] == "OrderReturnShipmentStateChanged": - from ._schemas.message import OrderReturnShipmentStateChangedMessageSchema + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderCustomLineItemAddedMessageSchema - return OrderReturnShipmentStateChangedMessageSchema().load(data) - if data["type"] == "OrderShipmentStateChanged": - from ._schemas.message import OrderShipmentStateChangedMessageSchema + return OrderCustomLineItemAddedMessageSchema().dump(self) - return OrderShipmentStateChangedMessageSchema().load(data) - if data["type"] == "OrderShippingAddressSet": - from ._schemas.message import OrderShippingAddressSetMessageSchema - return OrderShippingAddressSetMessageSchema().load(data) - if data["type"] == "OrderShippingInfoSet": - from ._schemas.message import OrderShippingInfoSetMessageSchema +class OrderCustomLineItemDiscountSetMessage(OrderMessage): + """Generated after a successful recalculation of a Discount on a [Custom Line Item](ctp:api:type:CustomLineItem).""" - return OrderShippingInfoSetMessageSchema().load(data) - if data["type"] == "OrderShippingRateInputSet": - from ._schemas.message import OrderShippingRateInputSetMessageSchema + #: Unique identifier for the [Custom Line Item](ctp:api:type:CustomLineItem). + custom_line_item_id: str + #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). + custom_line_item_key: typing.Optional[str] + #: Array of [DiscountedLineItemPriceForQuantity](ctp:api:type:DiscountedLineItemPriceForQuantity) after the Discount recalculation. + discounted_price_per_quantity: typing.List["DiscountedLineItemPriceForQuantity"] + #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Custom Line Item](ctp:api:type:CustomLineItem) after the Discount recalculation. + taxed_price: typing.Optional["TaxedItemPrice"] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + custom_line_item_id: str, + custom_line_item_key: typing.Optional[str] = None, + discounted_price_per_quantity: typing.List[ + "DiscountedLineItemPriceForQuantity" + ], + taxed_price: typing.Optional["TaxedItemPrice"] = None + ): + self.custom_line_item_id = custom_line_item_id + self.custom_line_item_key = custom_line_item_key + self.discounted_price_per_quantity = discounted_price_per_quantity + self.taxed_price = taxed_price + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCustomLineItemDiscountSet", + ) - return OrderShippingRateInputSetMessageSchema().load(data) - if data["type"] == "OrderStateChanged": - from ._schemas.message import OrderStateChangedMessageSchema + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomLineItemDiscountSetMessage": + from ._schemas.message import OrderCustomLineItemDiscountSetMessageSchema - return OrderStateChangedMessageSchema().load(data) - if data["type"] == "OrderStateTransition": - from ._schemas.message import OrderStateTransitionMessageSchema + return OrderCustomLineItemDiscountSetMessageSchema().load(data) - return OrderStateTransitionMessageSchema().load(data) - if data["type"] == "OrderStoreSet": - from ._schemas.message import OrderStoreSetMessageSchema + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderCustomLineItemDiscountSetMessageSchema - return OrderStoreSetMessageSchema().load(data) - if data["type"] == "ParcelAddedToDelivery": - from ._schemas.message import ParcelAddedToDeliveryMessageSchema + return OrderCustomLineItemDiscountSetMessageSchema().dump(self) - return ParcelAddedToDeliveryMessageSchema().load(data) - if data["type"] == "ParcelItemsUpdated": - from ._schemas.message import ParcelItemsUpdatedMessageSchema - return ParcelItemsUpdatedMessageSchema().load(data) - if data["type"] == "ParcelMeasurementsUpdated": - from ._schemas.message import ParcelMeasurementsUpdatedMessageSchema +class OrderCustomLineItemQuantityChangedMessage(OrderMessage): + """Generated after a successful [Change CustomLineItem Quantity](ctp:api:type:StagedOrderChangeCustomLineItemQuantityAction) update action.""" - return ParcelMeasurementsUpdatedMessageSchema().load(data) - if data["type"] == "ParcelRemovedFromDelivery": - from ._schemas.message import ParcelRemovedFromDeliveryMessageSchema + #: Unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). + custom_line_item_id: str + #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). + custom_line_item_key: typing.Optional[str] + #: [Custom Line Item](ctp:api:type:CustomLineItem) quantity after the [Change Custom Line Item Quantity](ctp:api:type:StagedOrderChangeCustomLineItemQuantityAction) update action. + quantity: int + #: [Custom Line Item](ctp:api:type:CustomLineItem) quantity before the [Change Custom Line Item Quantity](ctp:api:type:StagedOrderChangeCustomLineItemQuantityAction) update action. + old_quantity: int - return ParcelRemovedFromDeliveryMessageSchema().load(data) - if data["type"] == "ParcelTrackingDataUpdated": - from ._schemas.message import ParcelTrackingDataUpdatedMessageSchema + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + custom_line_item_id: str, + custom_line_item_key: typing.Optional[str] = None, + quantity: int, + old_quantity: int + ): + self.custom_line_item_id = custom_line_item_id + self.custom_line_item_key = custom_line_item_key + self.quantity = quantity + self.old_quantity = old_quantity - return ParcelTrackingDataUpdatedMessageSchema().load(data) - if data["type"] == "ReturnInfoAdded": - from ._schemas.message import ReturnInfoAddedMessageSchema + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCustomLineItemQuantityChanged", + ) - return ReturnInfoAddedMessageSchema().load(data) - if data["type"] == "ReturnInfoSet": - from ._schemas.message import ReturnInfoSetMessageSchema + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomLineItemQuantityChangedMessage": + from ._schemas.message import OrderCustomLineItemQuantityChangedMessageSchema - return ReturnInfoSetMessageSchema().load(data) + return OrderCustomLineItemQuantityChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderMessageSchema + from ._schemas.message import OrderCustomLineItemQuantityChangedMessageSchema - return OrderMessageSchema().dump(self) + return OrderCustomLineItemQuantityChangedMessageSchema().dump(self) -class CustomLineItemStateTransitionMessage(OrderMessage): - """Generated after a successful [Transition CustomLineItem State](ctp:api:type:OrderTransitionCustomLineItemStateAction) update action.""" +class OrderCustomLineItemRemovedMessage(OrderMessage): + """Generated after a successful [Remove CustomLineItem](ctp:api:type:StagedOrderRemoveCustomLineItemAction) update action.""" #: Unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). custom_line_item_id: str #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). custom_line_item_key: typing.Optional[str] - #: Date and time (UTC) when the transition of the [Custom Line Item](ctp:api:type:CustomLineItem) [State](ctp:api:type:State) was performed. - transition_date: datetime.datetime - #: Number of [Custom Line Items](ctp:api:type:CustomLineItem) for which the [State](ctp:api:type:State) was transitioned. - quantity: int - #: [State](ctp:api:type:State) the [Custom Line Item](ctp:api:type:CustomLineItem) was transitioned from. - from_state: "StateReference" - #: [State](ctp:api:type:State) the [Custom Line Item](ctp:api:type:CustomLineItem) was transitioned to. - to_state: "StateReference" + #: [Custom Line Item](ctp:api:type:CustomLineItem) that was removed from the [Order](ctp:api:type:Order). + custom_line_item: "CustomLineItem" def __init__( self, @@ -6588,17 +8112,11 @@ def __init__( ] = None, custom_line_item_id: str, custom_line_item_key: typing.Optional[str] = None, - transition_date: datetime.datetime, - quantity: int, - from_state: "StateReference", - to_state: "StateReference" + custom_line_item: "CustomLineItem" ): self.custom_line_item_id = custom_line_item_id self.custom_line_item_key = custom_line_item_key - self.transition_date = transition_date - self.quantity = quantity - self.from_state = from_state - self.to_state = to_state + self.custom_line_item = custom_line_item super().__init__( id=id, @@ -6611,30 +8129,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="CustomLineItemStateTransition", + type="OrderCustomLineItemRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "CustomLineItemStateTransitionMessage": - from ._schemas.message import CustomLineItemStateTransitionMessageSchema + ) -> "OrderCustomLineItemRemovedMessage": + from ._schemas.message import OrderCustomLineItemRemovedMessageSchema - return CustomLineItemStateTransitionMessageSchema().load(data) + return OrderCustomLineItemRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import CustomLineItemStateTransitionMessageSchema + from ._schemas.message import OrderCustomLineItemRemovedMessageSchema - return CustomLineItemStateTransitionMessageSchema().dump(self) + return OrderCustomLineItemRemovedMessageSchema().dump(self) -class DeliveryAddedMessage(OrderMessage): - """Generated after a successful [Add Delivery](ctp:api:type:OrderAddDeliveryAction) update action.""" +class OrderCustomTypeRemovedMessage(OrderMessage): + """Generated after a successful [Set Custom Type](ctp:api:type:OrderSetCustomTypeAction) with empty parameters.""" - #: [Delivery](ctp:api:type:Delivery) that was added to the [Order](ctp:api:type:Order). The [Delivery](ctp:api:type:Delivery) in the Message body does not contain [Parcels](ctp:api:type:Parcel) if those were part of the initial [Add Delivery](ctp:api:type:OrderAddDeliveryAction) update action. In that case, the update action produces an additional [Parcel Added To Delivery](ctp:api:type:ParcelAddedToDeliveryMessage) Message containing information about the [Parcels](ctp:api:type:Parcel). - delivery: "Delivery" - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. + previous_type_id: typing.Optional[str] def __init__( self, @@ -6651,11 +8167,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery: "Delivery", - shipping_key: typing.Optional[str] = None + previous_type_id: typing.Optional[str] = None ): - self.delivery = delivery - self.shipping_key = shipping_key + self.previous_type_id = previous_type_id super().__init__( id=id, @@ -6668,32 +8182,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="DeliveryAdded", + type="OrderCustomTypeRemoved", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "DeliveryAddedMessage": - from ._schemas.message import DeliveryAddedMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomTypeRemovedMessage": + from ._schemas.message import OrderCustomTypeRemovedMessageSchema - return DeliveryAddedMessageSchema().load(data) + return OrderCustomTypeRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import DeliveryAddedMessageSchema + from ._schemas.message import OrderCustomTypeRemovedMessageSchema - return DeliveryAddedMessageSchema().dump(self) + return OrderCustomTypeRemovedMessageSchema().dump(self) -class DeliveryAddressSetMessage(OrderMessage): - """Generated after a successful [Set Delivery Address](ctp:api:type:OrderSetDeliveryAddressAction) update action.""" +class OrderCustomTypeSetMessage(OrderMessage): + """Generated after a successful [Set Custom Type](ctp:api:type:OrderSetCustomTypeAction).""" - #: Unique identifier of the [Parcel](ctp:api:type:Delivery). - delivery_id: str - #: [Address](ctp:api:type:Address) after the [Set Delivery Address](ctp:api:type:OrderSetDeliveryAddressAction) update action. - address: typing.Optional["Address"] - #: [Address](ctp:api:type:Address) before the [Set Delivery Address](ctp:api:type:OrderSetDeliveryAddressAction) update action. - old_address: typing.Optional["Address"] - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: The Custom Fields that have been set. + custom_fields: "CustomFields" + #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. + previous_type_id: typing.Optional[str] def __init__( self, @@ -6710,15 +8222,68 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery_id: str, - address: typing.Optional["Address"] = None, - old_address: typing.Optional["Address"] = None, - shipping_key: typing.Optional[str] = None + custom_fields: "CustomFields", + previous_type_id: typing.Optional[str] = None ): - self.delivery_id = delivery_id - self.address = address - self.old_address = old_address - self.shipping_key = shipping_key + self.custom_fields = custom_fields + self.previous_type_id = previous_type_id + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="OrderCustomTypeSet", + ) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderCustomTypeSetMessage": + from ._schemas.message import OrderCustomTypeSetMessageSchema + + return OrderCustomTypeSetMessageSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import OrderCustomTypeSetMessageSchema + + return OrderCustomTypeSetMessageSchema().dump(self) + + +class OrderCustomerEmailSetMessage(OrderMessage): + """Generated after a successful [Set Customer Email](ctp:api:type:OrderSetCustomerEmailAction) update action.""" + + #: Email address on the [Order](ctp:api:type:Order) after the [Set Customer Email](ctp:api:type:OrderSetCustomerEmailAction) update action. + email: typing.Optional[str] + #: Email address on the [Order](ctp:api:type:Order) before the [Set Customer Email](ctp:api:type:OrderSetCustomerEmailAction) update action. + old_email: typing.Optional[str] + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + email: typing.Optional[str] = None, + old_email: typing.Optional[str] = None + ): + self.email = email + self.old_email = old_email super().__init__( id=id, @@ -6731,34 +8296,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="DeliveryAddressSet", + type="OrderCustomerEmailSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "DeliveryAddressSetMessage": - from ._schemas.message import DeliveryAddressSetMessageSchema + ) -> "OrderCustomerEmailSetMessage": + from ._schemas.message import OrderCustomerEmailSetMessageSchema - return DeliveryAddressSetMessageSchema().load(data) + return OrderCustomerEmailSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import DeliveryAddressSetMessageSchema + from ._schemas.message import OrderCustomerEmailSetMessageSchema - return DeliveryAddressSetMessageSchema().dump(self) + return OrderCustomerEmailSetMessageSchema().dump(self) -class DeliveryItemsUpdatedMessage(OrderMessage): - """Generated after a successful [Set Delivery Items](ctp:api:type:OrderSetDeliveryItemsAction) update action.""" +class OrderCustomerGroupSetMessage(OrderMessage): + """Generated after a successful [Set Customer Group](ctp:api:type:StagedOrderSetCustomerGroupAction) update action.""" - #: Unique identifier of the [Delivery](ctp:api:type:Delivery). - delivery_id: str - #: [Delivery Items](ctp:api:type:DeliveryItem) after the [Set Delivery Items](ctp:api:type:OrderSetDeliveryItemsAction) update action. - items: typing.List["DeliveryItem"] - #: [Delivery Items](ctp:api:type:DeliveryItem) before the [Set Delivery Items](ctp:api:type:OrderSetDeliveryItemsAction) update action. - old_items: typing.List["DeliveryItem"] - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) after the [Set Customer Group](ctp:api:type:StagedOrderSetCustomerGroupAction) update action. + customer_group: typing.Optional["CustomerGroupReference"] + #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) before the [Set Customer Group](ctp:api:type:StagedOrderSetCustomerGroupAction) update action. + old_customer_group: typing.Optional["CustomerGroupReference"] def __init__( self, @@ -6775,15 +8336,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery_id: str, - items: typing.List["DeliveryItem"], - old_items: typing.List["DeliveryItem"], - shipping_key: typing.Optional[str] = None + customer_group: typing.Optional["CustomerGroupReference"] = None, + old_customer_group: typing.Optional["CustomerGroupReference"] = None ): - self.delivery_id = delivery_id - self.items = items - self.old_items = old_items - self.shipping_key = shipping_key + self.customer_group = customer_group + self.old_customer_group = old_customer_group super().__init__( id=id, @@ -6796,30 +8353,34 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="DeliveryItemsUpdated", + type="OrderCustomerGroupSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "DeliveryItemsUpdatedMessage": - from ._schemas.message import DeliveryItemsUpdatedMessageSchema + ) -> "OrderCustomerGroupSetMessage": + from ._schemas.message import OrderCustomerGroupSetMessageSchema - return DeliveryItemsUpdatedMessageSchema().load(data) + return OrderCustomerGroupSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import DeliveryItemsUpdatedMessageSchema + from ._schemas.message import OrderCustomerGroupSetMessageSchema - return DeliveryItemsUpdatedMessageSchema().dump(self) + return OrderCustomerGroupSetMessageSchema().dump(self) -class DeliveryRemovedMessage(OrderMessage): - """Generated after a successful [Remove Delivery](ctp:api:type:OrderRemoveDeliveryAction) update action.""" +class OrderCustomerSetMessage(OrderMessage): + """Generated after a successful [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action.""" - #: The [Delivery](ctp:api:type:Delivery) that was removed from the [Order](ctp:api:type:Order). - delivery: "Delivery" - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: [Customer](ctp:api:type:Customer) on the [Order](ctp:api:type:Order) after the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. + customer: typing.Optional["CustomerReference"] + #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) after the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. + customer_group: typing.Optional["CustomerGroupReference"] + #: [Customer](ctp:api:type:Customer) on the [Order](ctp:api:type:Order) before the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. + old_customer: typing.Optional["CustomerReference"] + #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) before the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. + old_customer_group: typing.Optional["CustomerGroupReference"] def __init__( self, @@ -6836,11 +8397,15 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery: "Delivery", - shipping_key: typing.Optional[str] = None + customer: typing.Optional["CustomerReference"] = None, + customer_group: typing.Optional["CustomerGroupReference"] = None, + old_customer: typing.Optional["CustomerReference"] = None, + old_customer_group: typing.Optional["CustomerGroupReference"] = None ): - self.delivery = delivery - self.shipping_key = shipping_key + self.customer = customer + self.customer_group = customer_group + self.old_customer = old_customer + self.old_customer_group = old_customer_group super().__init__( id=id, @@ -6853,38 +8418,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="DeliveryRemoved", + type="OrderCustomerSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "DeliveryRemovedMessage": - from ._schemas.message import DeliveryRemovedMessageSchema + ) -> "OrderCustomerSetMessage": + from ._schemas.message import OrderCustomerSetMessageSchema - return DeliveryRemovedMessageSchema().load(data) + return OrderCustomerSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import DeliveryRemovedMessageSchema + from ._schemas.message import OrderCustomerSetMessageSchema - return DeliveryRemovedMessageSchema().dump(self) + return OrderCustomerSetMessageSchema().dump(self) -class LineItemStateTransitionMessage(OrderMessage): - """Generated after a successful [Transition LineItem State](ctp:api:type:OrderTransitionLineItemStateAction) update action.""" +class OrderDeletedMessage(OrderMessage): + """Generated after a successful [Delete Order](/../api/projects/orders#delete-order) request.""" - #: Unique identifier of the [Line Item](ctp:api:type:LineItem). - line_item_id: str - #: User-defined unique identifier of the LineItem. - line_item_key: typing.Optional[str] - #: Date and time (UTC) when the transition of the [Line Item](ctp:api:type:LineItem) [State](ctp:api:type:State) was performed. - transition_date: datetime.datetime - #: Number of [Line Items](ctp:api:type:LineItem) for which the [State](ctp:api:type:State) was transitioned. - quantity: int - #: [State](ctp:api:type:State) the [Line Item](ctp:api:type:LineItem) was transitioned from. - from_state: "StateReference" - #: [State](ctp:api:type:State) the [Line Item](ctp:api:type:LineItem) was transitioned to. - to_state: "StateReference" + #: [Order](ctp:api:type:Order) that has been deleted. + order: "Order" def __init__( self, @@ -6901,19 +8456,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - line_item_id: str, - line_item_key: typing.Optional[str] = None, - transition_date: datetime.datetime, - quantity: int, - from_state: "StateReference", - to_state: "StateReference" + order: "Order" ): - self.line_item_id = line_item_id - self.line_item_key = line_item_key - self.transition_date = transition_date - self.quantity = quantity - self.from_state = from_state - self.to_state = to_state + self.order = order super().__init__( id=id, @@ -6926,30 +8471,26 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="LineItemStateTransition", + type="OrderDeleted", ) @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "LineItemStateTransitionMessage": - from ._schemas.message import LineItemStateTransitionMessageSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderDeletedMessage": + from ._schemas.message import OrderDeletedMessageSchema - return LineItemStateTransitionMessageSchema().load(data) + return OrderDeletedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import LineItemStateTransitionMessageSchema + from ._schemas.message import OrderDeletedMessageSchema - return LineItemStateTransitionMessageSchema().dump(self) + return OrderDeletedMessageSchema().dump(self) -class OrderBillingAddressSetMessage(OrderMessage): - """Generated after a successful [Set Billing Address](ctp:api:type:OrderSetBillingAddressAction) update action.""" +class OrderDiscountCodeAddedMessage(OrderMessage): + """Generated after a successful [Add DiscountCode](ctp:api:type:StagedOrderAddDiscountCodeAction) update action.""" - #: Billing address on the Order after the [Set Billing Address](ctp:api:type:OrderSetBillingAddressAction) update action. - address: typing.Optional["Address"] - #: Billing address on the Order before the [Set Billing Address](ctp:api:type:OrderSetBillingAddressAction) update action. - old_address: typing.Optional["Address"] + #: [DiscountCode](ctp:api:type:DiscountCode) that was added. + discount_code: "DiscountCodeReference" def __init__( self, @@ -6966,11 +8507,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - address: typing.Optional["Address"] = None, - old_address: typing.Optional["Address"] = None + discount_code: "DiscountCodeReference" ): - self.address = address - self.old_address = old_address + self.discount_code = discount_code super().__init__( id=id, @@ -6983,28 +8522,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderBillingAddressSet", + type="OrderDiscountCodeAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderBillingAddressSetMessage": - from ._schemas.message import OrderBillingAddressSetMessageSchema + ) -> "OrderDiscountCodeAddedMessage": + from ._schemas.message import OrderDiscountCodeAddedMessageSchema - return OrderBillingAddressSetMessageSchema().load(data) + return OrderDiscountCodeAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderBillingAddressSetMessageSchema + from ._schemas.message import OrderDiscountCodeAddedMessageSchema - return OrderBillingAddressSetMessageSchema().dump(self) + return OrderDiscountCodeAddedMessageSchema().dump(self) -class OrderCreatedMessage(OrderMessage): - """Generated after a successful [Create Order](/../api/projects/orders#create-order) request.""" +class OrderDiscountCodeRemovedMessage(OrderMessage): + """Generated after a successful [Remove DiscountCode](ctp:api:type:StagedOrderRemoveDiscountCodeAction) update action.""" - #: [Order](ctp:api:type:Order) that was created. - order: "Order" + #: [DiscountCode](ctp:api:type:DiscountCode) that was removed. + discount_code: "DiscountCodeReference" def __init__( self, @@ -7021,9 +8560,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - order: "Order" + discount_code: "DiscountCodeReference" ): - self.order = order + self.discount_code = discount_code super().__init__( id=id, @@ -7036,28 +8575,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCreated", + type="OrderDiscountCodeRemoved", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderCreatedMessage": - from ._schemas.message import OrderCreatedMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderDiscountCodeRemovedMessage": + from ._schemas.message import OrderDiscountCodeRemovedMessageSchema - return OrderCreatedMessageSchema().load(data) + return OrderDiscountCodeRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCreatedMessageSchema + from ._schemas.message import OrderDiscountCodeRemovedMessageSchema - return OrderCreatedMessageSchema().dump(self) + return OrderDiscountCodeRemovedMessageSchema().dump(self) -class OrderCustomFieldAddedMessage(OrderMessage): - """Generated after adding a Custom Field using the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction).""" +class OrderDiscountCodeStateSetMessage(OrderMessage): + """Generated after the [DiscountCodeState](ctp:api:type:DiscountCodeState) changes due to a [recalculation](/../api/projects/carts#recalculate).""" - #: Name of the Custom Field that was added. - name: str - #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). - value: typing.Any + #: [DiscountCode](ctp:api:type:DiscountCode) that changed due to the recalculation. + discount_code: "DiscountCodeReference" + #: [DiscountCodeState](ctp:api:type:DiscountCodeState) after the recalculation. + state: "DiscountCodeState" + #: [DiscountCodeState](ctp:api:type:DiscountCodeState) before the recalculation. + old_state: typing.Optional["DiscountCodeState"] def __init__( self, @@ -7074,11 +8617,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str, - value: typing.Any + discount_code: "DiscountCodeReference", + state: "DiscountCodeState", + old_state: typing.Optional["DiscountCodeState"] = None ): - self.name = name - self.value = value + self.discount_code = discount_code + self.state = state + self.old_state = old_state super().__init__( id=id, @@ -7091,33 +8636,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomFieldAdded", + type="OrderDiscountCodeStateSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomFieldAddedMessage": - from ._schemas.message import OrderCustomFieldAddedMessageSchema + ) -> "OrderDiscountCodeStateSetMessage": + from ._schemas.message import OrderDiscountCodeStateSetMessageSchema - return OrderCustomFieldAddedMessageSchema().load(data) + return OrderDiscountCodeStateSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomFieldAddedMessageSchema + from ._schemas.message import OrderDiscountCodeStateSetMessageSchema - return OrderCustomFieldAddedMessageSchema().dump(self) + return OrderDiscountCodeStateSetMessageSchema().dump(self) -class OrderCustomFieldChangedMessage(OrderMessage): - """Generated when an existing Custom Field has been changed using the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) action.""" +class OrderEditAppliedMessage(OrderMessage): + """Generated after successfully [applying an OrderEdit](ctp:api:endpoint:/{projectKey}/orders/edits/{id}/apply:POST).""" - #: Name of the Custom Field that changed. - name: str - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) update action. - value: typing.Any - #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) update action. - #: When there has not been a Custom Field with the `name` on the Order before, an [Order Custom Field Added](ctp:api:type:OrderCustomFieldAddedMessage) Message is generated instead. - previous_value: typing.Optional[typing.Any] + #: [OrderEdit](ctp:api:type:OrderEdit) that was applied. + edit: "OrderEdit" + #: Information about a successfully applied [OrderEdit](ctp:api:type:OrderEdit). + result: "OrderEditApplied" def __init__( self, @@ -7134,13 +8676,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str, - value: typing.Any, - previous_value: typing.Optional[typing.Any] = None + edit: "OrderEdit", + result: "OrderEditApplied" ): - self.name = name - self.value = value - self.previous_value = previous_value + self.edit = edit + self.result = result super().__init__( id=id, @@ -7153,28 +8693,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomFieldChanged", + type="OrderEditApplied", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomFieldChangedMessage": - from ._schemas.message import OrderCustomFieldChangedMessageSchema + ) -> "OrderEditAppliedMessage": + from ._schemas.message import OrderEditAppliedMessageSchema - return OrderCustomFieldChangedMessageSchema().load(data) + return OrderEditAppliedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomFieldChangedMessageSchema + from ._schemas.message import OrderEditAppliedMessageSchema - return OrderCustomFieldChangedMessageSchema().dump(self) + return OrderEditAppliedMessageSchema().dump(self) -class OrderCustomFieldRemovedMessage(OrderMessage): - """Generated when a Custom Field has been removed from the Order using the [Set CustomField](ctp:api:type:OrderSetCustomFieldAction) action.""" +class OrderImportedMessage(OrderMessage): + """Generated after a successful [Order Import](ctp:api:endpoint:/{projectKey}/orders/import:POST).""" - #: Name of the Custom Field that was removed. - name: str + #: [Order](ctp:api:type:Order) that was imported. + order: "Order" def __init__( self, @@ -7191,9 +8731,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - name: str + order: "Order" ): - self.name = name + self.order = order super().__init__( id=id, @@ -7206,28 +8746,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomFieldRemoved", + type="OrderImported", ) @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomFieldRemovedMessage": - from ._schemas.message import OrderCustomFieldRemovedMessageSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderImportedMessage": + from ._schemas.message import OrderImportedMessageSchema - return OrderCustomFieldRemovedMessageSchema().load(data) + return OrderImportedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomFieldRemovedMessageSchema + from ._schemas.message import OrderImportedMessageSchema - return OrderCustomFieldRemovedMessageSchema().dump(self) + return OrderImportedMessageSchema().dump(self) -class OrderCustomLineItemAddedMessage(OrderMessage): - """Generated after a successful [Add CustomLineItem](ctp:api:type:StagedOrderAddCustomLineItemAction) update action.""" +class OrderLineItemAddedMessage(OrderMessage): + """Generated after a successful [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction) update action.""" - #: [Custom Line Item](ctp:api:type:CustomLineItem) that was added to the [Order](ctp:api:type:Order). - custom_line_item: "CustomLineItem" + #: [Line Item](ctp:api:type:LineItem) that was added to the [Order](ctp:api:type:Order). + line_item: "LineItem" + #: Quantity of [Line Items](ctp:api:type:LineItem) that were added to the [Order](ctp:api:type:Order). + added_quantity: int def __init__( self, @@ -7244,9 +8784,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_line_item: "CustomLineItem" + line_item: "LineItem", + added_quantity: int ): - self.custom_line_item = custom_line_item + self.line_item = line_item + self.added_quantity = added_quantity super().__init__( id=id, @@ -7259,34 +8801,39 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomLineItemAdded", + type="OrderLineItemAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomLineItemAddedMessage": - from ._schemas.message import OrderCustomLineItemAddedMessageSchema + ) -> "OrderLineItemAddedMessage": + from ._schemas.message import OrderLineItemAddedMessageSchema - return OrderCustomLineItemAddedMessageSchema().load(data) + return OrderLineItemAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomLineItemAddedMessageSchema + from ._schemas.message import OrderLineItemAddedMessageSchema - return OrderCustomLineItemAddedMessageSchema().dump(self) + return OrderLineItemAddedMessageSchema().dump(self) -class OrderCustomLineItemDiscountSetMessage(OrderMessage): - """Generated after a successful recalculation of a Discount on a [Custom Line Item](ctp:api:type:CustomLineItem).""" +class OrderLineItemDiscountSetMessage(OrderMessage): + """Generated after a successful recalculation of a Discount on a [Line Item](ctp:api:type:LineItem).""" - #: Unique identifier for the [Custom Line Item](ctp:api:type:CustomLineItem). - custom_line_item_id: str - #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). - custom_line_item_key: typing.Optional[str] + #: Unique identifier for the [Line Item](ctp:api:type:LineItem). + line_item_id: str + #: User-defined unique identifier of the LineItem. + line_item_key: typing.Optional[str] #: Array of [DiscountedLineItemPriceForQuantity](ctp:api:type:DiscountedLineItemPriceForQuantity) after the Discount recalculation. discounted_price_per_quantity: typing.List["DiscountedLineItemPriceForQuantity"] - #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Custom Line Item](ctp:api:type:CustomLineItem) after the Discount recalculation. + #: Total Price of the [Line Item](ctp:api:type:LineItem) after the Discount recalculation. + total_price: "CentPrecisionMoney" + #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Line Item](ctp:api:type:LineItem) after the Discount recalculation. taxed_price: typing.Optional["TaxedItemPrice"] + #: Total taxed prices based on the quantity of Line Item assigned to each [Shipping Method](ctp:api:type:ShippingMethod). Only applicable for Carts with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Automatically set after `perMethodTaxRate` is set. + taxed_price_portions: typing.List["MethodTaxedPrice"] def __init__( self, @@ -7303,17 +8850,21 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_line_item_id: str, - custom_line_item_key: typing.Optional[str] = None, + line_item_id: str, + line_item_key: typing.Optional[str] = None, discounted_price_per_quantity: typing.List[ "DiscountedLineItemPriceForQuantity" ], - taxed_price: typing.Optional["TaxedItemPrice"] = None + total_price: "CentPrecisionMoney", + taxed_price: typing.Optional["TaxedItemPrice"] = None, + taxed_price_portions: typing.List["MethodTaxedPrice"] ): - self.custom_line_item_id = custom_line_item_id - self.custom_line_item_key = custom_line_item_key + self.line_item_id = line_item_id + self.line_item_key = line_item_key self.discounted_price_per_quantity = discounted_price_per_quantity + self.total_price = total_price self.taxed_price = taxed_price + self.taxed_price_portions = taxed_price_portions super().__init__( id=id, @@ -7326,34 +8877,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomLineItemDiscountSet", + type="OrderLineItemDiscountSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomLineItemDiscountSetMessage": - from ._schemas.message import OrderCustomLineItemDiscountSetMessageSchema + ) -> "OrderLineItemDiscountSetMessage": + from ._schemas.message import OrderLineItemDiscountSetMessageSchema - return OrderCustomLineItemDiscountSetMessageSchema().load(data) + return OrderLineItemDiscountSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomLineItemDiscountSetMessageSchema + from ._schemas.message import OrderLineItemDiscountSetMessageSchema - return OrderCustomLineItemDiscountSetMessageSchema().dump(self) + return OrderLineItemDiscountSetMessageSchema().dump(self) -class OrderCustomLineItemQuantityChangedMessage(OrderMessage): - """Generated after a successful [Change CustomLineItem Quantity](ctp:api:type:StagedOrderChangeCustomLineItemQuantityAction) update action.""" +class OrderLineItemDistributionChannelSetMessage(OrderMessage): + """Generated after a successful [Set LineItem DistributionChannel](/../api/projects/order-edits#set-lineitem-distributionchannel) update action.""" - #: Unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). - custom_line_item_id: str - #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). - custom_line_item_key: typing.Optional[str] - #: [Custom Line Item](ctp:api:type:CustomLineItem) quantity after the [Change Custom Line Item Quantity](ctp:api:type:StagedOrderChangeCustomLineItemQuantityAction) update action. - quantity: int - #: [Custom Line Item](ctp:api:type:CustomLineItem) quantity before the [Change Custom Line Item Quantity](ctp:api:type:StagedOrderChangeCustomLineItemQuantityAction) update action. - old_quantity: int + #: Unique identifier of the [Line Item](ctp:api:type:LineItem). + line_item_id: str + #: User-defined unique identifier of the LineItem. + line_item_key: typing.Optional[str] + #: [Distribution Channel](ctp:api:type:Channel) that was set. + distribution_channel: typing.Optional["ChannelReference"] def __init__( self, @@ -7370,15 +8919,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_line_item_id: str, - custom_line_item_key: typing.Optional[str] = None, - quantity: int, - old_quantity: int + line_item_id: str, + line_item_key: typing.Optional[str] = None, + distribution_channel: typing.Optional["ChannelReference"] = None ): - self.custom_line_item_id = custom_line_item_id - self.custom_line_item_key = custom_line_item_key - self.quantity = quantity - self.old_quantity = old_quantity + self.line_item_id = line_item_id + self.line_item_key = line_item_key + self.distribution_channel = distribution_channel super().__init__( id=id, @@ -7391,32 +8938,44 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomLineItemQuantityChanged", + type="OrderLineItemDistributionChannelSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomLineItemQuantityChangedMessage": - from ._schemas.message import OrderCustomLineItemQuantityChangedMessageSchema + ) -> "OrderLineItemDistributionChannelSetMessage": + from ._schemas.message import OrderLineItemDistributionChannelSetMessageSchema - return OrderCustomLineItemQuantityChangedMessageSchema().load(data) + return OrderLineItemDistributionChannelSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomLineItemQuantityChangedMessageSchema + from ._schemas.message import OrderLineItemDistributionChannelSetMessageSchema - return OrderCustomLineItemQuantityChangedMessageSchema().dump(self) + return OrderLineItemDistributionChannelSetMessageSchema().dump(self) -class OrderCustomLineItemRemovedMessage(OrderMessage): - """Generated after a successful [Remove CustomLineItem](ctp:api:type:StagedOrderRemoveCustomLineItemAction) update action.""" +class OrderLineItemRemovedMessage(OrderMessage): + """Generated after a successful [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action.""" - #: Unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). - custom_line_item_id: str - #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). - custom_line_item_key: typing.Optional[str] - #: [Custom Line Item](ctp:api:type:CustomLineItem) that was removed from the [Order](ctp:api:type:Order). - custom_line_item: "CustomLineItem" + #: Unique identifier of the [Line Item](ctp:api:type:LineItem). + line_item_id: str + #: User-defined unique identifier of the LineItem. + line_item_key: typing.Optional[str] + #: Quantity of [Line Items](ctp:api:type:LineItem) that were removed during the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + removed_quantity: int + #: [Line Item](ctp:api:type:LineItem) quantity after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + new_quantity: int + #: [ItemStates](ctp:api:type:ItemState) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + new_state: typing.List["ItemState"] + #: `totalPrice` of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + new_total_price: "CentPrecisionMoney" + #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + new_taxed_price: typing.Optional["TaxedItemPrice"] + #: [Price](ctp:api:type:Price) of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + new_price: typing.Optional["Price"] + #: [Shipping Details](ctp:api:type:ItemShippingDetails) of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + new_shipping_detail: typing.Optional["ItemShippingDetails"] def __init__( self, @@ -7433,13 +8992,25 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_line_item_id: str, - custom_line_item_key: typing.Optional[str] = None, - custom_line_item: "CustomLineItem" + line_item_id: str, + line_item_key: typing.Optional[str] = None, + removed_quantity: int, + new_quantity: int, + new_state: typing.List["ItemState"], + new_total_price: "CentPrecisionMoney", + new_taxed_price: typing.Optional["TaxedItemPrice"] = None, + new_price: typing.Optional["Price"] = None, + new_shipping_detail: typing.Optional["ItemShippingDetails"] = None ): - self.custom_line_item_id = custom_line_item_id - self.custom_line_item_key = custom_line_item_key - self.custom_line_item = custom_line_item + self.line_item_id = line_item_id + self.line_item_key = line_item_key + self.removed_quantity = removed_quantity + self.new_quantity = new_quantity + self.new_state = new_state + self.new_total_price = new_total_price + self.new_taxed_price = new_taxed_price + self.new_price = new_price + self.new_shipping_detail = new_shipping_detail super().__init__( id=id, @@ -7452,28 +9023,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomLineItemRemoved", + type="OrderLineItemRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomLineItemRemovedMessage": - from ._schemas.message import OrderCustomLineItemRemovedMessageSchema + ) -> "OrderLineItemRemovedMessage": + from ._schemas.message import OrderLineItemRemovedMessageSchema - return OrderCustomLineItemRemovedMessageSchema().load(data) + return OrderLineItemRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomLineItemRemovedMessageSchema + from ._schemas.message import OrderLineItemRemovedMessageSchema - return OrderCustomLineItemRemovedMessageSchema().dump(self) + return OrderLineItemRemovedMessageSchema().dump(self) -class OrderCustomTypeRemovedMessage(OrderMessage): - """Generated after a successful [Set Custom Type](ctp:api:type:OrderSetCustomTypeAction) with empty parameters.""" +class OrderPaymentAddedMessage(Message): + """Generated after a successful [Add Payment](ctp:api:type:OrderAddPaymentAction) update action or when a [Payment](ctp:api:type:Payment) is added via [Order Edits](ctp:api:type:StagedOrderAddPaymentAction).""" - #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. - previous_type_id: typing.Optional[str] + #: [Payment](ctp:api:type:Payment) that was added to the [Order](ctp:api:type:Order). + payment: "PaymentReference" def __init__( self, @@ -7490,9 +9061,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - previous_type_id: typing.Optional[str] = None + payment: "PaymentReference" ): - self.previous_type_id = previous_type_id + self.payment = payment super().__init__( id=id, @@ -7505,30 +9076,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomTypeRemoved", + type="OrderPaymentAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomTypeRemovedMessage": - from ._schemas.message import OrderCustomTypeRemovedMessageSchema + ) -> "OrderPaymentAddedMessage": + from ._schemas.message import OrderPaymentAddedMessageSchema - return OrderCustomTypeRemovedMessageSchema().load(data) + return OrderPaymentAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomTypeRemovedMessageSchema + from ._schemas.message import OrderPaymentAddedMessageSchema - return OrderCustomTypeRemovedMessageSchema().dump(self) + return OrderPaymentAddedMessageSchema().dump(self) -class OrderCustomTypeSetMessage(OrderMessage): - """Generated after a successful [Set Custom Type](ctp:api:type:OrderSetCustomTypeAction).""" +class OrderPaymentStateChangedMessage(OrderMessage): + """Generated after a successful [Change PaymentState](ctp:api:type:OrderChangePaymentStateAction) update action.""" - #: The Custom Fields that have been set. - custom_fields: "CustomFields" - #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. - previous_type_id: typing.Optional[str] + #: [PaymentState](ctp:api:type:PaymentState) after the [Change Payment State](ctp:api:type:OrderChangePaymentStateAction) update action. + payment_state: "PaymentState" + #: [PaymentState](ctp:api:type:PaymentState) before the [Change Payment State](ctp:api:type:OrderChangePaymentStateAction) update action. + old_payment_state: typing.Optional["PaymentState"] def __init__( self, @@ -7545,11 +9116,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - custom_fields: "CustomFields", - previous_type_id: typing.Optional[str] = None + payment_state: "PaymentState", + old_payment_state: typing.Optional["PaymentState"] = None ): - self.custom_fields = custom_fields - self.previous_type_id = previous_type_id + self.payment_state = payment_state + self.old_payment_state = old_payment_state super().__init__( id=id, @@ -7562,30 +9133,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomTypeSet", + type="OrderPaymentStateChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomTypeSetMessage": - from ._schemas.message import OrderCustomTypeSetMessageSchema + ) -> "OrderPaymentStateChangedMessage": + from ._schemas.message import OrderPaymentStateChangedMessageSchema - return OrderCustomTypeSetMessageSchema().load(data) + return OrderPaymentStateChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomTypeSetMessageSchema + from ._schemas.message import OrderPaymentStateChangedMessageSchema - return OrderCustomTypeSetMessageSchema().dump(self) + return OrderPaymentStateChangedMessageSchema().dump(self) -class OrderCustomerEmailSetMessage(OrderMessage): - """Generated after a successful [Set Customer Email](ctp:api:type:OrderSetCustomerEmailAction) update action.""" +class OrderPurchaseOrderNumberSetMessage(OrderMessage): + """Generated after a successful [Set Purchase Order Number](ctp:api:type:OrderSetPurchaseOrderNumberAction) update action.""" - #: Email address on the [Order](ctp:api:type:Order) after the [Set Customer Email](ctp:api:type:OrderSetCustomerEmailAction) update action. - email: typing.Optional[str] - #: Email address on the [Order](ctp:api:type:Order) before the [Set Customer Email](ctp:api:type:OrderSetCustomerEmailAction) update action. - old_email: typing.Optional[str] + #: Purchase order number on the [Order](ctp:api:type:Order) after the [Set Purchase Order Number](ctp:api:type:OrderSetPurchaseOrderNumberAction) update action. + purchase_order_number: typing.Optional[str] + #: Purchase order number on the [Order](ctp:api:type:Order) before the [Set Purchase Order Number](ctp:api:type:OrderSetPurchaseOrderNumberAction) update action. + old_purchase_order_number: typing.Optional[str] def __init__( self, @@ -7602,11 +9173,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - email: typing.Optional[str] = None, - old_email: typing.Optional[str] = None + purchase_order_number: typing.Optional[str] = None, + old_purchase_order_number: typing.Optional[str] = None ): - self.email = email - self.old_email = old_email + self.purchase_order_number = purchase_order_number + self.old_purchase_order_number = old_purchase_order_number super().__init__( id=id, @@ -7619,30 +9190,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomerEmailSet", + type="OrderPurchaseOrderNumberSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomerEmailSetMessage": - from ._schemas.message import OrderCustomerEmailSetMessageSchema + ) -> "OrderPurchaseOrderNumberSetMessage": + from ._schemas.message import OrderPurchaseOrderNumberSetMessageSchema - return OrderCustomerEmailSetMessageSchema().load(data) + return OrderPurchaseOrderNumberSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomerEmailSetMessageSchema + from ._schemas.message import OrderPurchaseOrderNumberSetMessageSchema - return OrderCustomerEmailSetMessageSchema().dump(self) + return OrderPurchaseOrderNumberSetMessageSchema().dump(self) -class OrderCustomerGroupSetMessage(OrderMessage): - """Generated after a successful [Set Customer Group](ctp:api:type:StagedOrderSetCustomerGroupAction) update action.""" +class OrderReturnShipmentStateChangedMessage(OrderMessage): + """Generated after a successful [Set ReturnShipmentState](ctp:api:type:OrderSetReturnShipmentStateAction) update action on [Orders](ctp:api:type:Order) and [Order Edits](ctp:api:type:OrderEdit).""" - #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) after the [Set Customer Group](ctp:api:type:StagedOrderSetCustomerGroupAction) update action. - customer_group: typing.Optional["CustomerGroupReference"] - #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) before the [Set Customer Group](ctp:api:type:StagedOrderSetCustomerGroupAction) update action. - old_customer_group: typing.Optional["CustomerGroupReference"] + #: Unique identifier of the [ReturnItem](ctp:api:type:ReturnItem). + return_item_id: str + #: State of the [ReturnItem](ctp:api:type:ReturnItem) after the [Set Return Shipment State](ctp:api:type:OrderSetReturnShipmentStateAction) update action. + return_shipment_state: "ReturnShipmentState" def __init__( self, @@ -7659,11 +9230,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - customer_group: typing.Optional["CustomerGroupReference"] = None, - old_customer_group: typing.Optional["CustomerGroupReference"] = None + return_item_id: str, + return_shipment_state: "ReturnShipmentState" ): - self.customer_group = customer_group - self.old_customer_group = old_customer_group + self.return_item_id = return_item_id + self.return_shipment_state = return_shipment_state super().__init__( id=id, @@ -7676,34 +9247,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomerGroupSet", + type="OrderReturnShipmentStateChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomerGroupSetMessage": - from ._schemas.message import OrderCustomerGroupSetMessageSchema + ) -> "OrderReturnShipmentStateChangedMessage": + from ._schemas.message import OrderReturnShipmentStateChangedMessageSchema - return OrderCustomerGroupSetMessageSchema().load(data) + return OrderReturnShipmentStateChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomerGroupSetMessageSchema + from ._schemas.message import OrderReturnShipmentStateChangedMessageSchema - return OrderCustomerGroupSetMessageSchema().dump(self) + return OrderReturnShipmentStateChangedMessageSchema().dump(self) -class OrderCustomerSetMessage(OrderMessage): - """Generated after a successful [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action.""" +class OrderShipmentStateChangedMessage(OrderMessage): + """Generated after a successful [Change ShipmentState](ctp:api:type:OrderChangeShipmentStateAction) update action.""" - #: [Customer](ctp:api:type:Customer) on the [Order](ctp:api:type:Order) after the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. - customer: typing.Optional["CustomerReference"] - #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) after the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. - customer_group: typing.Optional["CustomerGroupReference"] - #: [Customer](ctp:api:type:Customer) on the [Order](ctp:api:type:Order) before the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. - old_customer: typing.Optional["CustomerReference"] - #: [CustomerGroup](ctp:api:type:CustomerGroup) on the [Order](ctp:api:type:Order) before the [Set Customer ID](ctp:api:type:OrderSetCustomerIdAction) update action. - old_customer_group: typing.Optional["CustomerGroupReference"] + #: [ShipmentState](ctp:api:type:ShipmentState) after the [Change Shipment State](ctp:api:type:OrderChangeShipmentStateAction) update action. + shipment_state: "ShipmentState" + #: [ShipmentState](ctp:api:type:ShipmentState) before the [Change Shipment State](ctp:api:type:OrderChangeShipmentStateAction) update action. + old_shipment_state: typing.Optional["ShipmentState"] def __init__( self, @@ -7720,15 +9287,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - customer: typing.Optional["CustomerReference"] = None, - customer_group: typing.Optional["CustomerGroupReference"] = None, - old_customer: typing.Optional["CustomerReference"] = None, - old_customer_group: typing.Optional["CustomerGroupReference"] = None + shipment_state: "ShipmentState", + old_shipment_state: typing.Optional["ShipmentState"] = None ): - self.customer = customer - self.customer_group = customer_group - self.old_customer = old_customer - self.old_customer_group = old_customer_group + self.shipment_state = shipment_state + self.old_shipment_state = old_shipment_state super().__init__( id=id, @@ -7741,28 +9304,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderCustomerSet", + type="OrderShipmentStateChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderCustomerSetMessage": - from ._schemas.message import OrderCustomerSetMessageSchema + ) -> "OrderShipmentStateChangedMessage": + from ._schemas.message import OrderShipmentStateChangedMessageSchema - return OrderCustomerSetMessageSchema().load(data) + return OrderShipmentStateChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderCustomerSetMessageSchema + from ._schemas.message import OrderShipmentStateChangedMessageSchema - return OrderCustomerSetMessageSchema().dump(self) + return OrderShipmentStateChangedMessageSchema().dump(self) -class OrderDeletedMessage(OrderMessage): - """Generated after a successful [Delete Order](/../api/projects/orders#delete-order) request.""" +class OrderShippingAddressSetMessage(OrderMessage): + """Generated after a successful [Set Shipping Address](ctp:api:type:OrderSetShippingAddressAction) update action.""" - #: [Order](ctp:api:type:Order) that has been deleted. - order: "Order" + #: Shipping address on the Order after the [Set Shipping Address](ctp:api:type:OrderSetShippingAddressAction) update action. + address: typing.Optional["Address"] + #: Shipping address on the Order before the [Set Shipping Address](ctp:api:type:OrderSetShippingAddressAction) update action. + old_address: typing.Optional["Address"] def __init__( self, @@ -7779,9 +9344,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - order: "Order" + address: typing.Optional["Address"] = None, + old_address: typing.Optional["Address"] = None ): - self.order = order + self.address = address + self.old_address = old_address super().__init__( id=id, @@ -7794,26 +9361,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderDeleted", + type="OrderShippingAddressSet", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderDeletedMessage": - from ._schemas.message import OrderDeletedMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderShippingAddressSetMessage": + from ._schemas.message import OrderShippingAddressSetMessageSchema - return OrderDeletedMessageSchema().load(data) + return OrderShippingAddressSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderDeletedMessageSchema + from ._schemas.message import OrderShippingAddressSetMessageSchema - return OrderDeletedMessageSchema().dump(self) + return OrderShippingAddressSetMessageSchema().dump(self) -class OrderDiscountCodeAddedMessage(OrderMessage): - """Generated after a successful [Add DiscountCode](ctp:api:type:StagedOrderAddDiscountCodeAction) update action.""" +class OrderShippingInfoSetMessage(OrderMessage): + """Generated after a successful [Set ShippingMethod](ctp:api:type:StagedOrderSetShippingMethodAction) and [Set Custom ShippingMethod](ctp:api:type:StagedOrderSetCustomShippingMethodAction) update actions.""" - #: [DiscountCode](ctp:api:type:DiscountCode) that was added. - discount_code: "DiscountCodeReference" + #: [ShippingInfo](ctp:api:type:ShippingInfo) after the [Set Shipping Method](ctp:api:type:StagedOrderSetShippingMethodAction) or [Set Custom Shipping Method](ctp:api:type:StagedOrderSetCustomShippingMethodAction) update action. + shipping_info: typing.Optional["ShippingInfo"] + #: [ShippingInfo](ctp:api:type:ShippingInfo) before the [Set Shipping Method](ctp:api:type:StagedOrderSetShippingMethodAction) or [Set Custom Shipping Method](ctp:api:type:StagedOrderSetCustomShippingMethodAction) update action. + old_shipping_info: typing.Optional["ShippingInfo"] def __init__( self, @@ -7830,9 +9401,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - discount_code: "DiscountCodeReference" + shipping_info: typing.Optional["ShippingInfo"] = None, + old_shipping_info: typing.Optional["ShippingInfo"] = None ): - self.discount_code = discount_code + self.shipping_info = shipping_info + self.old_shipping_info = old_shipping_info super().__init__( id=id, @@ -7845,28 +9418,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderDiscountCodeAdded", + type="OrderShippingInfoSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderDiscountCodeAddedMessage": - from ._schemas.message import OrderDiscountCodeAddedMessageSchema + ) -> "OrderShippingInfoSetMessage": + from ._schemas.message import OrderShippingInfoSetMessageSchema - return OrderDiscountCodeAddedMessageSchema().load(data) + return OrderShippingInfoSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderDiscountCodeAddedMessageSchema + from ._schemas.message import OrderShippingInfoSetMessageSchema - return OrderDiscountCodeAddedMessageSchema().dump(self) + return OrderShippingInfoSetMessageSchema().dump(self) -class OrderDiscountCodeRemovedMessage(OrderMessage): - """Generated after a successful [Remove DiscountCode](ctp:api:type:StagedOrderRemoveDiscountCodeAction) update action.""" +class OrderShippingRateInputSetMessage(OrderMessage): + """Generated after a successful [Set ShippingRateInput](ctp:api:type:StagedOrderSetShippingRateInputAction) update action.""" - #: [DiscountCode](ctp:api:type:DiscountCode) that was removed. - discount_code: "DiscountCodeReference" + #: [ShippingRateInput](ctp:api:type:ShippingRateInput) after the [Set ShippingRateInput](ctp:api:type:StagedOrderSetShippingRateInputAction) update action. + shipping_rate_input: typing.Optional["ShippingRateInput"] + #: [ShippingRateInput](ctp:api:type:ShippingRateInput) before the [Set ShippingRateInput](ctp:api:type:StagedOrderSetShippingRateInputAction) update action. + old_shipping_rate_input: typing.Optional["ShippingRateInput"] def __init__( self, @@ -7883,9 +9458,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - discount_code: "DiscountCodeReference" + shipping_rate_input: typing.Optional["ShippingRateInput"] = None, + old_shipping_rate_input: typing.Optional["ShippingRateInput"] = None ): - self.discount_code = discount_code + self.shipping_rate_input = shipping_rate_input + self.old_shipping_rate_input = old_shipping_rate_input super().__init__( id=id, @@ -7898,32 +9475,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderDiscountCodeRemoved", + type="OrderShippingRateInputSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderDiscountCodeRemovedMessage": - from ._schemas.message import OrderDiscountCodeRemovedMessageSchema + ) -> "OrderShippingRateInputSetMessage": + from ._schemas.message import OrderShippingRateInputSetMessageSchema - return OrderDiscountCodeRemovedMessageSchema().load(data) + return OrderShippingRateInputSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderDiscountCodeRemovedMessageSchema + from ._schemas.message import OrderShippingRateInputSetMessageSchema - return OrderDiscountCodeRemovedMessageSchema().dump(self) + return OrderShippingRateInputSetMessageSchema().dump(self) -class OrderDiscountCodeStateSetMessage(OrderMessage): - """Generated after the [DiscountCodeState](ctp:api:type:DiscountCodeState) changes due to a [recalculation](/../api/projects/carts#recalculate).""" +class OrderStateChangedMessage(OrderMessage): + """Generated after a successful [Change OrderState](ctp:api:type:OrderChangeOrderStateAction) update action.""" - #: [DiscountCode](ctp:api:type:DiscountCode) that changed due to the recalculation. - discount_code: "DiscountCodeReference" - #: [DiscountCodeState](ctp:api:type:DiscountCodeState) after the recalculation. - state: "DiscountCodeState" - #: [DiscountCodeState](ctp:api:type:DiscountCodeState) before the recalculation. - old_state: typing.Optional["DiscountCodeState"] + #: [OrderState](ctp:api:type:OrderState) after the [Change Order State](ctp:api:type:OrderChangeOrderStateAction) update action. + order_state: "OrderState" + #: [OrderState](ctp:api:type:OrderState) before the [Change Order State](ctp:api:type:OrderChangeOrderStateAction) update action. + old_order_state: typing.Optional["OrderState"] def __init__( self, @@ -7940,13 +9515,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - discount_code: "DiscountCodeReference", - state: "DiscountCodeState", - old_state: typing.Optional["DiscountCodeState"] = None + order_state: "OrderState", + old_order_state: typing.Optional["OrderState"] = None ): - self.discount_code = discount_code - self.state = state - self.old_state = old_state + self.order_state = order_state + self.old_order_state = old_order_state super().__init__( id=id, @@ -7959,30 +9532,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderDiscountCodeStateSet", + type="OrderStateChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderDiscountCodeStateSetMessage": - from ._schemas.message import OrderDiscountCodeStateSetMessageSchema + ) -> "OrderStateChangedMessage": + from ._schemas.message import OrderStateChangedMessageSchema - return OrderDiscountCodeStateSetMessageSchema().load(data) + return OrderStateChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderDiscountCodeStateSetMessageSchema + from ._schemas.message import OrderStateChangedMessageSchema - return OrderDiscountCodeStateSetMessageSchema().dump(self) + return OrderStateChangedMessageSchema().dump(self) -class OrderEditAppliedMessage(OrderMessage): - """Generated after successfully [applying an OrderEdit](ctp:api:endpoint:/{projectKey}/orders/edits/{id}/apply:POST).""" +class OrderStateTransitionMessage(OrderMessage): + """Generated after a successful [Transition State](ctp:api:type:OrderTransitionStateAction) update action.""" - #: [OrderEdit](ctp:api:type:OrderEdit) that was applied. - edit: "OrderEdit" - #: Information about a successfully applied [OrderEdit](ctp:api:type:OrderEdit). - result: "OrderEditApplied" + #: [OrderState](ctp:api:type:OrderState) after the [Transition State](ctp:api:type:OrderTransitionStateAction) update action. + state: "StateReference" + #: [OrderState](ctp:api:type:OrderState) before the [Transition State](ctp:api:type:OrderTransitionStateAction) update action. + old_state: typing.Optional["StateReference"] + #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Transition State](ctp:api:type:OrderTransitionStateAction) update action. + force: bool def __init__( self, @@ -7999,11 +9574,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - edit: "OrderEdit", - result: "OrderEditApplied" + state: "StateReference", + old_state: typing.Optional["StateReference"] = None, + force: bool ): - self.edit = edit - self.result = result + self.state = state + self.old_state = old_state + self.force = force super().__init__( id=id, @@ -8016,28 +9593,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderEditApplied", + type="OrderStateTransition", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderEditAppliedMessage": - from ._schemas.message import OrderEditAppliedMessageSchema + ) -> "OrderStateTransitionMessage": + from ._schemas.message import OrderStateTransitionMessageSchema - return OrderEditAppliedMessageSchema().load(data) + return OrderStateTransitionMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderEditAppliedMessageSchema + from ._schemas.message import OrderStateTransitionMessageSchema - return OrderEditAppliedMessageSchema().dump(self) + return OrderStateTransitionMessageSchema().dump(self) -class OrderImportedMessage(OrderMessage): - """Generated after a successful [Order Import](ctp:api:endpoint:/{projectKey}/orders/import:POST).""" +class OrderStoreSetMessage(OrderMessage): + """Generated after a successful [Set Store](ctp:api:type:OrderSetStoreAction) update action.""" - #: [Order](ctp:api:type:Order) that was imported. - order: "Order" + #: [Store](ctp:api:type:Store) that was set. + store: typing.Optional["StoreKeyReference"] def __init__( self, @@ -8054,9 +9631,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - order: "Order" + store: typing.Optional["StoreKeyReference"] = None ): - self.order = order + self.store = store super().__init__( id=id, @@ -8069,28 +9646,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderImported", + type="OrderStoreSet", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderImportedMessage": - from ._schemas.message import OrderImportedMessageSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderStoreSetMessage": + from ._schemas.message import OrderStoreSetMessageSchema - return OrderImportedMessageSchema().load(data) + return OrderStoreSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderImportedMessageSchema + from ._schemas.message import OrderStoreSetMessageSchema - return OrderImportedMessageSchema().dump(self) + return OrderStoreSetMessageSchema().dump(self) -class OrderLineItemAddedMessage(OrderMessage): - """Generated after a successful [Add LineItem](ctp:api:type:StagedOrderAddLineItemAction) update action.""" +class ParcelAddedToDeliveryMessage(OrderMessage): + """Generated after a successful [Add Parcel to Delivery](ctp:api:type:OrderAddParcelToDeliveryAction) update action.""" - #: [Line Item](ctp:api:type:LineItem) that was added to the [Order](ctp:api:type:Order). - line_item: "LineItem" - #: Quantity of [Line Items](ctp:api:type:LineItem) that were added to the [Order](ctp:api:type:Order). - added_quantity: int + #: Unique identifier of the [Delivery](ctp:api:type:Delivery). + delivery: "Delivery" + #: [Parcel](ctp:api:type:Parcel) that was added to the [Delivery](ctp:api:type:Delivery). + parcel: "Parcel" + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] def __init__( self, @@ -8107,11 +9686,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - line_item: "LineItem", - added_quantity: int + delivery: "Delivery", + parcel: "Parcel", + shipping_key: typing.Optional[str] = None ): - self.line_item = line_item - self.added_quantity = added_quantity + self.delivery = delivery + self.parcel = parcel + self.shipping_key = shipping_key super().__init__( id=id, @@ -8124,38 +9705,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderLineItemAdded", + type="ParcelAddedToDelivery", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderLineItemAddedMessage": - from ._schemas.message import OrderLineItemAddedMessageSchema + ) -> "ParcelAddedToDeliveryMessage": + from ._schemas.message import ParcelAddedToDeliveryMessageSchema - return OrderLineItemAddedMessageSchema().load(data) + return ParcelAddedToDeliveryMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderLineItemAddedMessageSchema + from ._schemas.message import ParcelAddedToDeliveryMessageSchema - return OrderLineItemAddedMessageSchema().dump(self) + return ParcelAddedToDeliveryMessageSchema().dump(self) -class OrderLineItemDiscountSetMessage(OrderMessage): - """Generated after a successful recalculation of a Discount on a [Line Item](ctp:api:type:LineItem).""" +class ParcelItemsUpdatedMessage(OrderMessage): + """Generated after a successful [Set Parcel Items](ctp:api:type:OrderSetParcelItemsAction) update action.""" - #: Unique identifier for the [Line Item](ctp:api:type:LineItem). - line_item_id: str - #: User-defined unique identifier of the LineItem. - line_item_key: typing.Optional[str] - #: Array of [DiscountedLineItemPriceForQuantity](ctp:api:type:DiscountedLineItemPriceForQuantity) after the Discount recalculation. - discounted_price_per_quantity: typing.List["DiscountedLineItemPriceForQuantity"] - #: Total Price of the [Line Item](ctp:api:type:LineItem) after the Discount recalculation. - total_price: "Money" - #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Line Item](ctp:api:type:LineItem) after the Discount recalculation. - taxed_price: typing.Optional["TaxedItemPrice"] - #: Taxed price of the Shipping Methods in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - taxed_price_portions: typing.List["MethodTaxedPrice"] + #: Unique identifier of the [Parcel](ctp:api:type:Parcel). + parcel_id: str + #: Unique identifier of the [Delivery](ctp:api:type:Delivery). + delivery_id: str + #: [Delivery Items](ctp:api:type:DeliveryItem) after the [Set Parcel Items](ctp:api:type:OrderSetParcelItemsAction) update action. + items: typing.List["DeliveryItem"] + #: [Delivery Items](ctp:api:type:DeliveryItem) before the [Set Parcel Items](ctp:api:type:OrderSetParcelItemsAction) update action. + old_items: typing.List["DeliveryItem"] + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] def __init__( self, @@ -8172,21 +9751,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - line_item_id: str, - line_item_key: typing.Optional[str] = None, - discounted_price_per_quantity: typing.List[ - "DiscountedLineItemPriceForQuantity" - ], - total_price: "Money", - taxed_price: typing.Optional["TaxedItemPrice"] = None, - taxed_price_portions: typing.List["MethodTaxedPrice"] + parcel_id: str, + delivery_id: str, + items: typing.List["DeliveryItem"], + old_items: typing.List["DeliveryItem"], + shipping_key: typing.Optional[str] = None ): - self.line_item_id = line_item_id - self.line_item_key = line_item_key - self.discounted_price_per_quantity = discounted_price_per_quantity - self.total_price = total_price - self.taxed_price = taxed_price - self.taxed_price_portions = taxed_price_portions + self.parcel_id = parcel_id + self.delivery_id = delivery_id + self.items = items + self.old_items = old_items + self.shipping_key = shipping_key super().__init__( id=id, @@ -8199,32 +9774,34 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderLineItemDiscountSet", + type="ParcelItemsUpdated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderLineItemDiscountSetMessage": - from ._schemas.message import OrderLineItemDiscountSetMessageSchema + ) -> "ParcelItemsUpdatedMessage": + from ._schemas.message import ParcelItemsUpdatedMessageSchema - return OrderLineItemDiscountSetMessageSchema().load(data) + return ParcelItemsUpdatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderLineItemDiscountSetMessageSchema + from ._schemas.message import ParcelItemsUpdatedMessageSchema - return OrderLineItemDiscountSetMessageSchema().dump(self) + return ParcelItemsUpdatedMessageSchema().dump(self) -class OrderLineItemDistributionChannelSetMessage(OrderMessage): - """Generated after a successful [Set LineItem DistributionChannel](/../api/projects/order-edits#set-lineitem-distributionchannel) update action.""" +class ParcelMeasurementsUpdatedMessage(OrderMessage): + """Generated after a successful [Set Parcel Measurements](ctp:api:type:OrderSetParcelMeasurementsAction) update action.""" - #: Unique identifier of the [Line Item](ctp:api:type:LineItem). - line_item_id: str - #: User-defined unique identifier of the LineItem. - line_item_key: typing.Optional[str] - #: [Distribution Channel](ctp:api:type:Channel) that was set. - distribution_channel: typing.Optional["ChannelReference"] + #: Unique identifier of the [Delivery](ctp:api:type:Delivery). + delivery_id: str + #: Unique identifier of the [Parcel](ctp:api:type:Parcel). + parcel_id: str + #: The [Parcel Measurements](ctp:api:type:ParcelMeasurements) that were set on the [Parcel](ctp:api:type:Parcel). + measurements: typing.Optional["ParcelMeasurements"] + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] def __init__( self, @@ -8241,13 +9818,15 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - line_item_id: str, - line_item_key: typing.Optional[str] = None, - distribution_channel: typing.Optional["ChannelReference"] = None + delivery_id: str, + parcel_id: str, + measurements: typing.Optional["ParcelMeasurements"] = None, + shipping_key: typing.Optional[str] = None ): - self.line_item_id = line_item_id - self.line_item_key = line_item_key - self.distribution_channel = distribution_channel + self.delivery_id = delivery_id + self.parcel_id = parcel_id + self.measurements = measurements + self.shipping_key = shipping_key super().__init__( id=id, @@ -8260,44 +9839,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderLineItemDistributionChannelSet", + type="ParcelMeasurementsUpdated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderLineItemDistributionChannelSetMessage": - from ._schemas.message import OrderLineItemDistributionChannelSetMessageSchema + ) -> "ParcelMeasurementsUpdatedMessage": + from ._schemas.message import ParcelMeasurementsUpdatedMessageSchema - return OrderLineItemDistributionChannelSetMessageSchema().load(data) + return ParcelMeasurementsUpdatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderLineItemDistributionChannelSetMessageSchema + from ._schemas.message import ParcelMeasurementsUpdatedMessageSchema - return OrderLineItemDistributionChannelSetMessageSchema().dump(self) + return ParcelMeasurementsUpdatedMessageSchema().dump(self) -class OrderLineItemRemovedMessage(OrderMessage): - """Generated after a successful [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action.""" +class ParcelRemovedFromDeliveryMessage(OrderMessage): + """Generated after a successful [Remove Parcel from Delivery](ctp:api:type:OrderRemoveParcelFromDeliveryAction) update action.""" - #: Unique identifier of the [Line Item](ctp:api:type:LineItem). - line_item_id: str - #: User-defined unique identifier of the LineItem. - line_item_key: typing.Optional[str] - #: Quantity of [Line Items](ctp:api:type:LineItem) that were removed during the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. - removed_quantity: int - #: [Line Item](ctp:api:type:LineItem) quantity after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. - new_quantity: int - #: [ItemStates](ctp:api:type:ItemState) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. - new_state: typing.List["ItemState"] - #: `totalPrice` of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. - new_total_price: "CentPrecisionMoney" - #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. - new_taxed_price: typing.Optional["TaxedItemPrice"] - #: [Price](ctp:api:type:Price) of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. - new_price: typing.Optional["Price"] - #: [Shipping Details](ctp:api:type:ItemShippingDetails) of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. - new_shipping_detail: typing.Optional["ItemShippingDetails"] + #: Unique identifier of the [Delivery](ctp:api:type:Delivery). + delivery_id: str + #: [Parcel](ctp:api:type:Parcel) that was removed from the [Delivery](ctp:api:type:Delivery). + parcel: "Parcel" + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] def __init__( self, @@ -8314,25 +9881,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - line_item_id: str, - line_item_key: typing.Optional[str] = None, - removed_quantity: int, - new_quantity: int, - new_state: typing.List["ItemState"], - new_total_price: "CentPrecisionMoney", - new_taxed_price: typing.Optional["TaxedItemPrice"] = None, - new_price: typing.Optional["Price"] = None, - new_shipping_detail: typing.Optional["ItemShippingDetails"] = None + delivery_id: str, + parcel: "Parcel", + shipping_key: typing.Optional[str] = None ): - self.line_item_id = line_item_id - self.line_item_key = line_item_key - self.removed_quantity = removed_quantity - self.new_quantity = new_quantity - self.new_state = new_state - self.new_total_price = new_total_price - self.new_taxed_price = new_taxed_price - self.new_price = new_price - self.new_shipping_detail = new_shipping_detail + self.delivery_id = delivery_id + self.parcel = parcel + self.shipping_key = shipping_key super().__init__( id=id, @@ -8345,28 +9900,34 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderLineItemRemoved", + type="ParcelRemovedFromDelivery", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderLineItemRemovedMessage": - from ._schemas.message import OrderLineItemRemovedMessageSchema + ) -> "ParcelRemovedFromDeliveryMessage": + from ._schemas.message import ParcelRemovedFromDeliveryMessageSchema - return OrderLineItemRemovedMessageSchema().load(data) + return ParcelRemovedFromDeliveryMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderLineItemRemovedMessageSchema + from ._schemas.message import ParcelRemovedFromDeliveryMessageSchema - return OrderLineItemRemovedMessageSchema().dump(self) + return ParcelRemovedFromDeliveryMessageSchema().dump(self) -class OrderPaymentAddedMessage(Message): - """Generated after a successful [Add Payment](ctp:api:type:OrderAddPaymentAction) update action or when a [Payment](ctp:api:type:Payment) is added via [Order Edits](ctp:api:type:StagedOrderAddPaymentAction).""" +class ParcelTrackingDataUpdatedMessage(OrderMessage): + """Generated after a successful [Set Parcel Tracking Data](ctp:api:type:OrderSetParcelTrackingDataAction) update action.""" - #: [Payment](ctp:api:type:Payment) that was added to the [Order](ctp:api:type:Order). - payment: "PaymentReference" + #: Unique identifier of the [Delivery](ctp:api:type:Delivery). + delivery_id: str + #: Unique identifier of the [Parcel](ctp:api:type:Parcel). + parcel_id: str + #: The [Tracking Data](ctp:api:type:TrackingData) that was added to the [Parcel](ctp:api:type:Parcel). + tracking_data: typing.Optional["TrackingData"] + #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + shipping_key: typing.Optional[str] def __init__( self, @@ -8383,9 +9944,15 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - payment: "PaymentReference" + delivery_id: str, + parcel_id: str, + tracking_data: typing.Optional["TrackingData"] = None, + shipping_key: typing.Optional[str] = None ): - self.payment = payment + self.delivery_id = delivery_id + self.parcel_id = parcel_id + self.tracking_data = tracking_data + self.shipping_key = shipping_key super().__init__( id=id, @@ -8398,30 +9965,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderPaymentAdded", + type="ParcelTrackingDataUpdated", ) @classmethod def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "OrderPaymentAddedMessage": - from ._schemas.message import OrderPaymentAddedMessageSchema + cls, data: typing.Dict[str, typing.Any] + ) -> "ParcelTrackingDataUpdatedMessage": + from ._schemas.message import ParcelTrackingDataUpdatedMessageSchema - return OrderPaymentAddedMessageSchema().load(data) + return ParcelTrackingDataUpdatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderPaymentAddedMessageSchema + from ._schemas.message import ParcelTrackingDataUpdatedMessageSchema - return OrderPaymentAddedMessageSchema().dump(self) + return ParcelTrackingDataUpdatedMessageSchema().dump(self) -class OrderPaymentStateChangedMessage(OrderMessage): - """Generated after a successful [Change PaymentState](ctp:api:type:OrderChangePaymentStateAction) update action.""" +class PaymentCreatedMessage(Message): + """Generated after a successful [Create Payment](ctp:api:endpoint:/{projectKey}/payments:POST) request.""" - #: [PaymentState](ctp:api:type:PaymentState) after the [Change Payment State](ctp:api:type:OrderChangePaymentStateAction) update action. - payment_state: "PaymentState" - #: [PaymentState](ctp:api:type:PaymentState) before the [Change Payment State](ctp:api:type:OrderChangePaymentStateAction) update action. - old_payment_state: typing.Optional["PaymentState"] + #: [Payment](ctp:api:type:Payment) that was created. + payment: "Payment" def __init__( self, @@ -8438,11 +10003,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - payment_state: "PaymentState", - old_payment_state: typing.Optional["PaymentState"] = None + payment: "Payment" ): - self.payment_state = payment_state - self.old_payment_state = old_payment_state + self.payment = payment super().__init__( id=id, @@ -8455,30 +10018,26 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderPaymentStateChanged", + type="PaymentCreated", ) @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "OrderPaymentStateChangedMessage": - from ._schemas.message import OrderPaymentStateChangedMessageSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentCreatedMessage": + from ._schemas.message import PaymentCreatedMessageSchema - return OrderPaymentStateChangedMessageSchema().load(data) + return PaymentCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderPaymentStateChangedMessageSchema + from ._schemas.message import PaymentCreatedMessageSchema - return OrderPaymentStateChangedMessageSchema().dump(self) + return PaymentCreatedMessageSchema().dump(self) -class OrderPurchaseOrderNumberSetMessage(OrderMessage): - """Generated after a successful [Set Purchase Order Number](ctp:api:type:OrderSetPurchaseOrderNumberAction) update action.""" +class PaymentInteractionAddedMessage(Message): + """Generated after a successful [Add InterfaceInteraction](ctp:api:type:PaymentAddInterfaceInteractionAction) update action.""" - #: Purchase order number on the [Order](ctp:api:type:Order) after the [Set Purchase Order Number](ctp:api:type:OrderSetPurchaseOrderNumberAction) update action. - purchase_order_number: typing.Optional[str] - #: Purchase order number on the [Order](ctp:api:type:Order) before the [Set Purchase Order Number](ctp:api:type:OrderSetPurchaseOrderNumberAction) update action. - old_purchase_order_number: typing.Optional[str] + #: The interface interaction that was added to the [Payment](ctp:api:type:Payment). + interaction: "CustomFields" def __init__( self, @@ -8495,11 +10054,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - purchase_order_number: typing.Optional[str] = None, - old_purchase_order_number: typing.Optional[str] = None + interaction: "CustomFields" ): - self.purchase_order_number = purchase_order_number - self.old_purchase_order_number = old_purchase_order_number + self.interaction = interaction super().__init__( id=id, @@ -8512,30 +10069,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderPurchaseOrderNumberSet", + type="PaymentInteractionAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderPurchaseOrderNumberSetMessage": - from ._schemas.message import OrderPurchaseOrderNumberSetMessageSchema + ) -> "PaymentInteractionAddedMessage": + from ._schemas.message import PaymentInteractionAddedMessageSchema - return OrderPurchaseOrderNumberSetMessageSchema().load(data) + return PaymentInteractionAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderPurchaseOrderNumberSetMessageSchema + from ._schemas.message import PaymentInteractionAddedMessageSchema - return OrderPurchaseOrderNumberSetMessageSchema().dump(self) + return PaymentInteractionAddedMessageSchema().dump(self) -class OrderReturnShipmentStateChangedMessage(OrderMessage): - """Generated after a successful [Set ReturnShipmentState](ctp:api:type:OrderSetReturnShipmentStateAction) update action.""" +class PaymentStatusInterfaceCodeSetMessage(Message): + """Generated after a successful [Set StatusInterfaceCode](ctp:api:type:PaymentSetStatusInterfaceCodeAction) update action.""" - #: Unique identifier of the [ReturnItem](ctp:api:type:ReturnItem). - return_item_id: str - #: State of the [ReturnItem](ctp:api:type:ReturnItem) after the [Set Return Shipment State](ctp:api:type:OrderSetReturnShipmentStateAction) update action. - return_shipment_state: "ReturnShipmentState" + #: Unique identifier for the [Payment](ctp:api:type:Payment) for which the [Set StatusInterfaceCode](ctp:api:type:PaymentSetStatusInterfaceCodeAction) update action was applied. + payment_id: str + #: The `interfaceCode` that was set during the [Set StatusInterfaceCode](ctp:api:type:PaymentSetStatusInterfaceCodeAction) update action. + interface_code: typing.Optional[str] def __init__( self, @@ -8552,11 +10109,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - return_item_id: str, - return_shipment_state: "ReturnShipmentState" + payment_id: str, + interface_code: typing.Optional[str] = None ): - self.return_item_id = return_item_id - self.return_shipment_state = return_shipment_state + self.payment_id = payment_id + self.interface_code = interface_code super().__init__( id=id, @@ -8569,30 +10126,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderReturnShipmentStateChanged", + type="PaymentStatusInterfaceCodeSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderReturnShipmentStateChangedMessage": - from ._schemas.message import OrderReturnShipmentStateChangedMessageSchema + ) -> "PaymentStatusInterfaceCodeSetMessage": + from ._schemas.message import PaymentStatusInterfaceCodeSetMessageSchema - return OrderReturnShipmentStateChangedMessageSchema().load(data) + return PaymentStatusInterfaceCodeSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderReturnShipmentStateChangedMessageSchema + from ._schemas.message import PaymentStatusInterfaceCodeSetMessageSchema - return OrderReturnShipmentStateChangedMessageSchema().dump(self) + return PaymentStatusInterfaceCodeSetMessageSchema().dump(self) -class OrderShipmentStateChangedMessage(OrderMessage): - """Generated after a successful [Change ShipmentState](ctp:api:type:OrderChangeShipmentStateAction) update action.""" +class PaymentStatusStateTransitionMessage(Message): + """Generated after a successful [Transition State](ctp:api:type:PaymentTransitionStateAction) update action.""" - #: [ShipmentState](ctp:api:type:ShipmentState) after the [Change Shipment State](ctp:api:type:OrderChangeShipmentStateAction) update action. - shipment_state: "ShipmentState" - #: [ShipmentState](ctp:api:type:ShipmentState) before the [Change Shipment State](ctp:api:type:OrderChangeShipmentStateAction) update action. - old_shipment_state: "ShipmentState" + #: [State](ctp:api:type:State) of the [Payment](ctp:api:type:Payment) after the [Transition State](ctp:api:type:PaymentTransitionStateAction) update action. + state: "StateReference" + #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Change Transaction State](ctp:api:type:PaymentChangeTransactionStateAction) update action. + force: bool def __init__( self, @@ -8609,11 +10166,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - shipment_state: "ShipmentState", - old_shipment_state: "ShipmentState" + state: "StateReference", + force: bool ): - self.shipment_state = shipment_state - self.old_shipment_state = old_shipment_state + self.state = state + self.force = force super().__init__( id=id, @@ -8626,30 +10183,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderShipmentStateChanged", + type="PaymentStatusStateTransition", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderShipmentStateChangedMessage": - from ._schemas.message import OrderShipmentStateChangedMessageSchema + ) -> "PaymentStatusStateTransitionMessage": + from ._schemas.message import PaymentStatusStateTransitionMessageSchema - return OrderShipmentStateChangedMessageSchema().load(data) + return PaymentStatusStateTransitionMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderShipmentStateChangedMessageSchema + from ._schemas.message import PaymentStatusStateTransitionMessageSchema - return OrderShipmentStateChangedMessageSchema().dump(self) + return PaymentStatusStateTransitionMessageSchema().dump(self) -class OrderShippingAddressSetMessage(OrderMessage): - """Generated after a successful [Set Shipping Address](ctp:api:type:OrderSetShippingAddressAction) update action.""" +class PaymentTransactionAddedMessage(Message): + """Generated after a successful [Add Transaction](ctp:api:type:PaymentAddTransactionAction) update action.""" - #: Shipping address on the Order after the [Set Shipping Address](ctp:api:type:OrderSetShippingAddressAction) update action. - address: typing.Optional["Address"] - #: Shipping address on the Order before the [Set Shipping Address](ctp:api:type:OrderSetShippingAddressAction) update action. - old_address: typing.Optional["Address"] + #: [Transaction](ctp:api:type:Transaction) that was added to the [Payment](ctp:api:type:Payment). + transaction: "Transaction" def __init__( self, @@ -8666,11 +10221,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - address: typing.Optional["Address"] = None, - old_address: typing.Optional["Address"] = None + transaction: "Transaction" ): - self.address = address - self.old_address = old_address + self.transaction = transaction super().__init__( id=id, @@ -8683,30 +10236,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderShippingAddressSet", + type="PaymentTransactionAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderShippingAddressSetMessage": - from ._schemas.message import OrderShippingAddressSetMessageSchema + ) -> "PaymentTransactionAddedMessage": + from ._schemas.message import PaymentTransactionAddedMessageSchema - return OrderShippingAddressSetMessageSchema().load(data) + return PaymentTransactionAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderShippingAddressSetMessageSchema + from ._schemas.message import PaymentTransactionAddedMessageSchema - return OrderShippingAddressSetMessageSchema().dump(self) + return PaymentTransactionAddedMessageSchema().dump(self) -class OrderShippingInfoSetMessage(OrderMessage): - """Generated after a successful [Set ShippingMethod](ctp:api:type:StagedOrderSetShippingMethodAction) and [Set Custom ShippingMethod](ctp:api:type:StagedOrderSetCustomShippingMethodAction) update actions.""" +class PaymentTransactionStateChangedMessage(Message): + """Generated after a successful [Change TransactionState](ctp:api:type:PaymentChangeTransactionStateAction) update action.""" - #: [ShippingInfo](ctp:api:type:ShippingInfo) after the [Set Shipping Method](ctp:api:type:StagedOrderSetShippingMethodAction) or [Set Custom Shipping Method](ctp:api:type:StagedOrderSetCustomShippingMethodAction) update action. - shipping_info: typing.Optional["ShippingInfo"] - #: [ShippingInfo](ctp:api:type:ShippingInfo) before the [Set Shipping Method](ctp:api:type:StagedOrderSetShippingMethodAction) or [Set Custom Shipping Method](ctp:api:type:StagedOrderSetCustomShippingMethodAction) update action. - old_shipping_info: typing.Optional["ShippingInfo"] + #: Unique identifier for the [Transaction](ctp:api:type:Transaction) for which the [Transaction State](ctp:api:type:TransactionState) changed. + transaction_id: str + #: [Transaction State](ctp:api:type:TransactionState) after the [Change Transaction State](ctp:api:type:PaymentChangeTransactionStateAction) update action. + state: "TransactionState" def __init__( self, @@ -8723,11 +10276,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - shipping_info: typing.Optional["ShippingInfo"] = None, - old_shipping_info: typing.Optional["ShippingInfo"] = None + transaction_id: str, + state: "TransactionState" ): - self.shipping_info = shipping_info - self.old_shipping_info = old_shipping_info + self.transaction_id = transaction_id + self.state = state super().__init__( id=id, @@ -8740,30 +10293,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderShippingInfoSet", + type="PaymentTransactionStateChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderShippingInfoSetMessage": - from ._schemas.message import OrderShippingInfoSetMessageSchema + ) -> "PaymentTransactionStateChangedMessage": + from ._schemas.message import PaymentTransactionStateChangedMessageSchema - return OrderShippingInfoSetMessageSchema().load(data) + return PaymentTransactionStateChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderShippingInfoSetMessageSchema + from ._schemas.message import PaymentTransactionStateChangedMessageSchema - return OrderShippingInfoSetMessageSchema().dump(self) + return PaymentTransactionStateChangedMessageSchema().dump(self) -class OrderShippingRateInputSetMessage(OrderMessage): - """Generated after a successful [Set ShippingRateInput](ctp:api:type:StagedOrderSetShippingRateInputAction) update action.""" +class ProductAddedToCategoryMessage(Message): + """Generated after a successful [Add to Category](ctp:api:type:ProductAddToCategoryAction) update action.""" - #: [ShippingRateInput](ctp:api:type:ShippingRateInput) after the [Set ShippingRateInput](ctp:api:type:StagedOrderSetShippingRateInputAction) update action. - shipping_rate_input: typing.Optional["ShippingRateInput"] - #: [ShippingRateInput](ctp:api:type:ShippingRateInput) before the [Set ShippingRateInput](ctp:api:type:StagedOrderSetShippingRateInputAction) update action. - old_shipping_rate_input: typing.Optional["ShippingRateInput"] + #: [Category](ctp:api:type:Category) the [Product](ctp:api:type:Product) was added to. + category: "CategoryReference" + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -8780,11 +10333,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - shipping_rate_input: typing.Optional["ShippingRateInput"] = None, - old_shipping_rate_input: typing.Optional["ShippingRateInput"] = None + category: "CategoryReference", + staged: bool ): - self.shipping_rate_input = shipping_rate_input - self.old_shipping_rate_input = old_shipping_rate_input + self.category = category + self.staged = staged super().__init__( id=id, @@ -8797,30 +10350,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderShippingRateInputSet", + type="ProductAddedToCategory", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "OrderShippingRateInputSetMessage": - from ._schemas.message import OrderShippingRateInputSetMessageSchema + ) -> "ProductAddedToCategoryMessage": + from ._schemas.message import ProductAddedToCategoryMessageSchema - return OrderShippingRateInputSetMessageSchema().load(data) + return ProductAddedToCategoryMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderShippingRateInputSetMessageSchema + from ._schemas.message import ProductAddedToCategoryMessageSchema - return OrderShippingRateInputSetMessageSchema().dump(self) + return ProductAddedToCategoryMessageSchema().dump(self) -class OrderStateChangedMessage(OrderMessage): - """Generated after a successful [Change OrderState](ctp:api:type:OrderChangeOrderStateAction) update action.""" +class ProductCreatedMessage(Message): + """Generated after a successful [Create Product](ctp:api:endpoint:/{projectKey}/products:POST) request.""" - #: [OrderState](ctp:api:type:OrderState) after the [Change Order State](ctp:api:type:OrderChangeOrderStateAction) update action. - order_state: "OrderState" - #: [OrderState](ctp:api:type:OrderState) before the [Change Order State](ctp:api:type:OrderChangeOrderStateAction) update action. - old_order_state: "OrderState" + #: The staged [Product Projection](ctp:api:type:ProductProjection) of the [Product](ctp:api:type:Product) at the time of creation. + product_projection: "ProductProjection" def __init__( self, @@ -8837,11 +10388,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - order_state: "OrderState", - old_order_state: "OrderState" + product_projection: "ProductProjection" ): - self.order_state = order_state - self.old_order_state = old_order_state + self.product_projection = product_projection super().__init__( id=id, @@ -8854,32 +10403,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderStateChanged", + type="ProductCreated", ) @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "OrderStateChangedMessage": - from ._schemas.message import OrderStateChangedMessageSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductCreatedMessage": + from ._schemas.message import ProductCreatedMessageSchema - return OrderStateChangedMessageSchema().load(data) + return ProductCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderStateChangedMessageSchema - - return OrderStateChangedMessageSchema().dump(self) + from ._schemas.message import ProductCreatedMessageSchema + return ProductCreatedMessageSchema().dump(self) -class OrderStateTransitionMessage(OrderMessage): - """Generated after a successful [Transition State](ctp:api:type:OrderTransitionStateAction) update action.""" - #: [OrderState](ctp:api:type:OrderState) after the [Transition State](ctp:api:type:OrderTransitionStateAction) update action. - state: "StateReference" - #: [OrderState](ctp:api:type:OrderState) before the [Transition State](ctp:api:type:OrderTransitionStateAction) update action. - old_state: typing.Optional["StateReference"] - #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Transition State](ctp:api:type:OrderTransitionStateAction) update action. - force: bool +class ProductDeletedMessage(Message): + """Generated after a successful [Delete Product](/../api/projects/products#delete-product) request.""" + + #: List of image URLs that were removed during the [Delete Product](ctp:api:type:Product) request. + removed_image_urls: typing.List["str"] + #: Current [Product Projection](ctp:api:type:ProductProjection) of the deleted [Product](ctp:api:type:Product). + current_projection: typing.Optional["ProductProjection"] def __init__( self, @@ -8896,13 +10441,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - state: "StateReference", - old_state: typing.Optional["StateReference"] = None, - force: bool + removed_image_urls: typing.List["str"], + current_projection: typing.Optional["ProductProjection"] = None ): - self.state = state - self.old_state = old_state - self.force = force + self.removed_image_urls = removed_image_urls + self.current_projection = current_projection super().__init__( id=id, @@ -8915,28 +10458,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderStateTransition", + type="ProductDeleted", ) @classmethod - def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "OrderStateTransitionMessage": - from ._schemas.message import OrderStateTransitionMessageSchema + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductDeletedMessage": + from ._schemas.message import ProductDeletedMessageSchema - return OrderStateTransitionMessageSchema().load(data) + return ProductDeletedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderStateTransitionMessageSchema + from ._schemas.message import ProductDeletedMessageSchema - return OrderStateTransitionMessageSchema().dump(self) + return ProductDeletedMessageSchema().dump(self) -class OrderStoreSetMessage(OrderMessage): - """Generated after a successful [Set Store](ctp:api:type:OrderSetStoreAction) update action.""" +class ProductImageAddedMessage(Message): + """Generated after a successful [Add External Image](ctp:api:type:ProductAddExternalImageAction) update action or after the successful [upload of an image](/../api/projects/products#upload-product-image).""" - #: [Store](ctp:api:type:Store) that was set. - store: typing.Optional["StoreKeyReference"] + #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) to which the [Image](ctp:api:type:Image) was added. + variant_id: int + #: [Image](ctp:api:type:Image) that was added. + image: "Image" + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -8953,9 +10498,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - store: typing.Optional["StoreKeyReference"] = None + variant_id: int, + image: "Image", + staged: bool ): - self.store = store + self.variant_id = variant_id + self.image = image + self.staged = staged super().__init__( id=id, @@ -8968,30 +10517,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="OrderStoreSet", + type="ProductImageAdded", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderStoreSetMessage": - from ._schemas.message import OrderStoreSetMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductImageAddedMessage": + from ._schemas.message import ProductImageAddedMessageSchema - return OrderStoreSetMessageSchema().load(data) + return ProductImageAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import OrderStoreSetMessageSchema + from ._schemas.message import ProductImageAddedMessageSchema - return OrderStoreSetMessageSchema().dump(self) + return ProductImageAddedMessageSchema().dump(self) -class ParcelAddedToDeliveryMessage(OrderMessage): - """Generated after a successful [Add Parcel to Delivery](ctp:api:type:OrderAddParcelToDeliveryAction) update action.""" +class ProductPriceAddedMessage(Message): + """Generated after a successful [Add Price](ctp:api:type:ProductAddPriceAction) update action.""" - #: Unique identifier of the [Delivery](ctp:api:type:Delivery). - delivery: "Delivery" - #: [Parcel](ctp:api:type:Parcel) that was added to the [Delivery](ctp:api:type:Delivery). - parcel: "Parcel" - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was added. + variant_id: int + #: The Embedded Price that was added to the [ProductVariant](ctp:api:type:ProductVariant). + price: "Price" + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -9008,13 +10559,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery: "Delivery", - parcel: "Parcel", - shipping_key: typing.Optional[str] = None + variant_id: int, + price: "Price", + staged: bool ): - self.delivery = delivery - self.parcel = parcel - self.shipping_key = shipping_key + self.variant_id = variant_id + self.price = price + self.staged = staged super().__init__( id=id, @@ -9027,36 +10578,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ParcelAddedToDelivery", + type="ProductPriceAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ParcelAddedToDeliveryMessage": - from ._schemas.message import ParcelAddedToDeliveryMessageSchema + ) -> "ProductPriceAddedMessage": + from ._schemas.message import ProductPriceAddedMessageSchema - return ParcelAddedToDeliveryMessageSchema().load(data) + return ProductPriceAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ParcelAddedToDeliveryMessageSchema + from ._schemas.message import ProductPriceAddedMessageSchema - return ParcelAddedToDeliveryMessageSchema().dump(self) + return ProductPriceAddedMessageSchema().dump(self) -class ParcelItemsUpdatedMessage(OrderMessage): - """Generated after a successful [Set Parcel Items](ctp:api:type:OrderSetParcelItemsAction) update action.""" +class ProductPriceChangedMessage(Message): + """Generated after a successful [Change Price](ctp:api:type:ProductChangePriceAction) update action.""" - #: Unique identifier of the [Parcel](ctp:api:type:Parcel). - parcel_id: str - #: Unique identifier of the [Delivery](ctp:api:type:Delivery). - delivery_id: str - #: [Delivery Items](ctp:api:type:DeliveryItem) after the [Set Parcel Items](ctp:api:type:OrderSetParcelItemsAction) update action. - items: typing.List["DeliveryItem"] - #: [Delivery Items](ctp:api:type:DeliveryItem) before the [Set Parcel Items](ctp:api:type:OrderSetParcelItemsAction) update action. - old_items: typing.List["DeliveryItem"] - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was changed. + variant_id: int + #: The current Embedded Price before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. + old_price: "Price" + #: The Embedded Price after the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. + new_price: "Price" + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: The staged Embedded Price before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. + old_staged_price: typing.Optional["Price"] def __init__( self, @@ -9073,17 +10624,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - parcel_id: str, - delivery_id: str, - items: typing.List["DeliveryItem"], - old_items: typing.List["DeliveryItem"], - shipping_key: typing.Optional[str] = None + variant_id: int, + old_price: "Price", + new_price: "Price", + staged: bool, + old_staged_price: typing.Optional["Price"] = None ): - self.parcel_id = parcel_id - self.delivery_id = delivery_id - self.items = items - self.old_items = old_items - self.shipping_key = shipping_key + self.variant_id = variant_id + self.old_price = old_price + self.new_price = new_price + self.staged = staged + self.old_staged_price = old_staged_price super().__init__( id=id, @@ -9096,34 +10647,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ParcelItemsUpdated", + type="ProductPriceChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ParcelItemsUpdatedMessage": - from ._schemas.message import ParcelItemsUpdatedMessageSchema + ) -> "ProductPriceChangedMessage": + from ._schemas.message import ProductPriceChangedMessageSchema - return ParcelItemsUpdatedMessageSchema().load(data) + return ProductPriceChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ParcelItemsUpdatedMessageSchema + from ._schemas.message import ProductPriceChangedMessageSchema - return ParcelItemsUpdatedMessageSchema().dump(self) + return ProductPriceChangedMessageSchema().dump(self) -class ParcelMeasurementsUpdatedMessage(OrderMessage): - """Generated after a successful [Set Parcel Measurements](ctp:api:type:OrderSetParcelMeasurementsAction) update action.""" +class ProductPriceCustomFieldAddedMessage(Message): + """Generated after adding a Custom Field to a Price using the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action.""" - #: Unique identifier of the [Delivery](ctp:api:type:Delivery). - delivery_id: str - #: Unique identifier of the [Parcel](ctp:api:type:Parcel). - parcel_id: str - #: The [Parcel Measurements](ctp:api:type:ParcelMeasurements) that were set on the [Parcel](ctp:api:type:Parcel). - measurements: typing.Optional["ParcelMeasurements"] - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: Unique identifier of the [Price](ctp:api:type:Price) to which the Custom Field was added. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Name of the Custom Field that was added. + name: str + #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). + value: typing.Any def __init__( self, @@ -9140,15 +10693,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery_id: str, - parcel_id: str, - measurements: typing.Optional["ParcelMeasurements"] = None, - shipping_key: typing.Optional[str] = None + price_id: str, + variant_id: int, + staged: bool, + name: str, + value: typing.Any ): - self.delivery_id = delivery_id - self.parcel_id = parcel_id - self.measurements = measurements - self.shipping_key = shipping_key + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.name = name + self.value = value super().__init__( id=id, @@ -9161,32 +10716,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ParcelMeasurementsUpdated", + type="ProductPriceCustomFieldAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ParcelMeasurementsUpdatedMessage": - from ._schemas.message import ParcelMeasurementsUpdatedMessageSchema + ) -> "ProductPriceCustomFieldAddedMessage": + from ._schemas.message import ProductPriceCustomFieldAddedMessageSchema - return ParcelMeasurementsUpdatedMessageSchema().load(data) + return ProductPriceCustomFieldAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ParcelMeasurementsUpdatedMessageSchema + from ._schemas.message import ProductPriceCustomFieldAddedMessageSchema - return ParcelMeasurementsUpdatedMessageSchema().dump(self) + return ProductPriceCustomFieldAddedMessageSchema().dump(self) -class ParcelRemovedFromDeliveryMessage(OrderMessage): - """Generated after a successful [Remove Parcel from Delivery](ctp:api:type:OrderRemoveParcelFromDeliveryAction) update action.""" +class ProductPriceCustomFieldChangedMessage(Message): + """Generated after changing an existing Custom Field on a Price using the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action.""" - #: Unique identifier of the [Delivery](ctp:api:type:Delivery). - delivery_id: str - #: [Parcel](ctp:api:type:Parcel) that was removed from the [Delivery](ctp:api:type:Delivery). - parcel: "Parcel" - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: Unique identifier of the [Price](ctp:api:type:Price) of which the Custom Field was changed. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Name of the Custom Field that was changed. + name: str + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action. + value: typing.Any def __init__( self, @@ -9203,13 +10762,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery_id: str, - parcel: "Parcel", - shipping_key: typing.Optional[str] = None + price_id: str, + variant_id: int, + staged: bool, + name: str, + value: typing.Any ): - self.delivery_id = delivery_id - self.parcel = parcel - self.shipping_key = shipping_key + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.name = name + self.value = value super().__init__( id=id, @@ -9222,34 +10785,34 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ParcelRemovedFromDelivery", + type="ProductPriceCustomFieldChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ParcelRemovedFromDeliveryMessage": - from ._schemas.message import ParcelRemovedFromDeliveryMessageSchema + ) -> "ProductPriceCustomFieldChangedMessage": + from ._schemas.message import ProductPriceCustomFieldChangedMessageSchema - return ParcelRemovedFromDeliveryMessageSchema().load(data) + return ProductPriceCustomFieldChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ParcelRemovedFromDeliveryMessageSchema + from ._schemas.message import ProductPriceCustomFieldChangedMessageSchema - return ParcelRemovedFromDeliveryMessageSchema().dump(self) + return ProductPriceCustomFieldChangedMessageSchema().dump(self) -class ParcelTrackingDataUpdatedMessage(OrderMessage): - """Generated after a successful [Set Parcel Tracking Data](ctp:api:type:OrderSetParcelTrackingDataAction) update action.""" +class ProductPriceCustomFieldRemovedMessage(Message): + """Generated after removing a Custom Field from a Price using the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action.""" - #: Unique identifier of the [Delivery](ctp:api:type:Delivery). - delivery_id: str - #: Unique identifier of the [Parcel](ctp:api:type:Parcel). - parcel_id: str - #: The [Tracking Data](ctp:api:type:TrackingData) that was added to the [Parcel](ctp:api:type:Parcel). - tracking_data: typing.Optional["TrackingData"] - #: User-defined unique identifier of the Shipping Method in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). - shipping_key: typing.Optional[str] + #: Unique identifier of the [Price](ctp:api:type:Price) from which the Custom Field was removed. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Name of the Custom Field that was removed. + name: str def __init__( self, @@ -9266,15 +10829,15 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - delivery_id: str, - parcel_id: str, - tracking_data: typing.Optional["TrackingData"] = None, - shipping_key: typing.Optional[str] = None + price_id: str, + variant_id: int, + staged: bool, + name: str ): - self.delivery_id = delivery_id - self.parcel_id = parcel_id - self.tracking_data = tracking_data - self.shipping_key = shipping_key + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.name = name super().__init__( id=id, @@ -9287,28 +10850,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ParcelTrackingDataUpdated", + type="ProductPriceCustomFieldRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ParcelTrackingDataUpdatedMessage": - from ._schemas.message import ParcelTrackingDataUpdatedMessageSchema + ) -> "ProductPriceCustomFieldRemovedMessage": + from ._schemas.message import ProductPriceCustomFieldRemovedMessageSchema - return ParcelTrackingDataUpdatedMessageSchema().load(data) + return ProductPriceCustomFieldRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ParcelTrackingDataUpdatedMessageSchema + from ._schemas.message import ProductPriceCustomFieldRemovedMessageSchema - return ParcelTrackingDataUpdatedMessageSchema().dump(self) + return ProductPriceCustomFieldRemovedMessageSchema().dump(self) -class PaymentCreatedMessage(Message): - """Generated after a successful [Create Payment](/../api/projects/payments#create-payment) request.""" +class ProductPriceCustomFieldsRemovedMessage(Message): + """Generated after removing a Custom Type from a Price using the [Set Price Custom Type](ctp:api:type:ProductSetProductPriceCustomTypeAction) update action.""" - #: [Payment](ctp:api:type:Payment) that was created. - payment: "Payment" + #: Unique identifier of the [Price](ctp:api:type:Price) from which the Custom Type was removed. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -9325,9 +10892,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - payment: "Payment" + price_id: str, + variant_id: int, + staged: bool ): - self.payment = payment + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged super().__init__( id=id, @@ -9340,26 +10911,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="PaymentCreated", + type="ProductPriceCustomFieldsRemoved", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "PaymentCreatedMessage": - from ._schemas.message import PaymentCreatedMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceCustomFieldsRemovedMessage": + from ._schemas.message import ProductPriceCustomFieldsRemovedMessageSchema - return PaymentCreatedMessageSchema().load(data) + return ProductPriceCustomFieldsRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import PaymentCreatedMessageSchema + from ._schemas.message import ProductPriceCustomFieldsRemovedMessageSchema - return PaymentCreatedMessageSchema().dump(self) + return ProductPriceCustomFieldsRemovedMessageSchema().dump(self) -class PaymentInteractionAddedMessage(Message): - """Generated after a successful [Add InterfaceInteraction](ctp:api:type:PaymentAddInterfaceInteractionAction) update action.""" +class ProductPriceCustomFieldsSetMessage(Message): + """Generated after a successful [Set Price Custom Type](ctp:api:type:ProductSetProductPriceCustomTypeAction) update action.""" - #: The interface interaction that was added to the [Payment](ctp:api:type:Payment). - interaction: "CustomFields" + #: Unique identifier of the [Price](ctp:api:type:Price) on which the Custom Type was set. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Custom Fields that were set. + custom_field: "CustomFields" + #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. + old_type_id: typing.Optional[str] def __init__( self, @@ -9376,9 +10957,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - interaction: "CustomFields" + price_id: str, + variant_id: int, + staged: bool, + custom_field: "CustomFields", + old_type_id: typing.Optional[str] = None ): - self.interaction = interaction + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.custom_field = custom_field + self.old_type_id = old_type_id super().__init__( id=id, @@ -9391,30 +10980,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="PaymentInteractionAdded", + type="ProductPriceCustomFieldsSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "PaymentInteractionAddedMessage": - from ._schemas.message import PaymentInteractionAddedMessageSchema + ) -> "ProductPriceCustomFieldsSetMessage": + from ._schemas.message import ProductPriceCustomFieldsSetMessageSchema - return PaymentInteractionAddedMessageSchema().load(data) + return ProductPriceCustomFieldsSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import PaymentInteractionAddedMessageSchema + from ._schemas.message import ProductPriceCustomFieldsSetMessageSchema - return PaymentInteractionAddedMessageSchema().dump(self) + return ProductPriceCustomFieldsSetMessageSchema().dump(self) -class PaymentStatusInterfaceCodeSetMessage(Message): - """Generated after a successful [Set StatusInterfaceCode](ctp:api:type:PaymentSetStatusInterfaceCodeAction) update action.""" +class ProductPriceDiscountsSetMessage(Message): + """Generated after a Price is updated due to a [Product Discount](ctp:api:type:ProductDiscount).""" - #: Unique identifier for the [Payment](ctp:api:type:Payment) for which the [Set StatusInterfaceCode](ctp:api:type:PaymentSetStatusInterfaceCodeAction) update action was applied. - payment_id: str - #: The `interfaceCode` that was set during the [Set StatusInterfaceCode](ctp:api:type:PaymentSetStatusInterfaceCodeAction) update action. - interface_code: typing.Optional[str] + #: Array containing details about the [Embedded Prices](ctp:api:type:Price) that were updated. + updated_prices: typing.List["ProductPriceDiscountsSetUpdatedPrice"] def __init__( self, @@ -9431,11 +11018,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - payment_id: str, - interface_code: typing.Optional[str] = None + updated_prices: typing.List["ProductPriceDiscountsSetUpdatedPrice"] ): - self.payment_id = payment_id - self.interface_code = interface_code + self.updated_prices = updated_prices super().__init__( id=id, @@ -9448,30 +11033,87 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="PaymentStatusInterfaceCodeSet", + type="ProductPriceDiscountsSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "PaymentStatusInterfaceCodeSetMessage": - from ._schemas.message import PaymentStatusInterfaceCodeSetMessageSchema + ) -> "ProductPriceDiscountsSetMessage": + from ._schemas.message import ProductPriceDiscountsSetMessageSchema - return PaymentStatusInterfaceCodeSetMessageSchema().load(data) + return ProductPriceDiscountsSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import PaymentStatusInterfaceCodeSetMessageSchema + from ._schemas.message import ProductPriceDiscountsSetMessageSchema - return PaymentStatusInterfaceCodeSetMessageSchema().dump(self) + return ProductPriceDiscountsSetMessageSchema().dump(self) -class PaymentStatusStateTransitionMessage(Message): - """Generated after a successful [Transition State](ctp:api:type:PaymentTransitionStateAction) update action.""" +class ProductPriceDiscountsSetUpdatedPrice(_BaseType): + """Details about an [Embedded Price](ctp:api:type:Price) that was updated due to a Discount. Specific to [Product Price Discounts Set](ctp:api:type:ProductPriceDiscountsSetMessage) Message.""" - #: [State](ctp:api:type:State) of the [Payment](ctp:api:type:Payment) after the [Transition State](ctp:api:type:PaymentTransitionStateAction) update action. - state: "StateReference" - #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Change Transaction State](ctp:api:type:PaymentChangeTransactionStateAction) update action. - force: bool + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Discount was set. + variant_id: int + #: Key of the [ProductVariant](ctp:api:type:ProductVariant) for which Discount was set. + variant_key: typing.Optional[str] + #: SKU of the [ProductVariant](ctp:api:type:ProductVariant) for which Discount was set. + sku: typing.Optional[str] + #: Unique identifier of the [Price](ctp:api:type:Price). + price_id: str + #: Discounted Price for the [ProductVariant](ctp:api:type:ProductVariant) for which Discount was set. + discounted: typing.Optional["DiscountedPrice"] + #: Whether the update was only applied to the staged [ProductProjection](ctp:api:type:ProductProjection). + staged: bool + + def __init__( + self, + *, + variant_id: int, + variant_key: typing.Optional[str] = None, + sku: typing.Optional[str] = None, + price_id: str, + discounted: typing.Optional["DiscountedPrice"] = None, + staged: bool + ): + self.variant_id = variant_id + self.variant_key = variant_key + self.sku = sku + self.price_id = price_id + self.discounted = discounted + self.staged = staged + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceDiscountsSetUpdatedPrice": + from ._schemas.message import ProductPriceDiscountsSetUpdatedPriceSchema + + return ProductPriceDiscountsSetUpdatedPriceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceDiscountsSetUpdatedPriceSchema + + return ProductPriceDiscountsSetUpdatedPriceSchema().dump(self) + + +class ProductPriceExternalDiscountSetMessage(Message): + """Generated after a successful [Set Discounted Price](ctp:api:type:ProductSetDiscountedPriceAction) update action.""" + + #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) for which the Discount was set. + variant_id: int + #: Key of the [Product Variant](ctp:api:type:ProductVariant) for which the Discount was set. + variant_key: typing.Optional[str] + #: SKU of the [Product Variant](ctp:api:type:ProductVariant) for which Discount was set. + sku: typing.Optional[str] + #: Unique identifier of the [Price](ctp:api:type:Price). + price_id: str + #: Discounted Price for the [Product Variant](ctp:api:type:ProductVariant) for which Discount was set. + discounted: typing.Optional["DiscountedPrice"] + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -9488,11 +11130,19 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - state: "StateReference", - force: bool + variant_id: int, + variant_key: typing.Optional[str] = None, + sku: typing.Optional[str] = None, + price_id: str, + discounted: typing.Optional["DiscountedPrice"] = None, + staged: bool ): - self.state = state - self.force = force + self.variant_id = variant_id + self.variant_key = variant_key + self.sku = sku + self.price_id = price_id + self.discounted = discounted + self.staged = staged super().__init__( id=id, @@ -9505,28 +11155,35 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="PaymentStatusStateTransition", + type="ProductPriceExternalDiscountSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "PaymentStatusStateTransitionMessage": - from ._schemas.message import PaymentStatusStateTransitionMessageSchema + ) -> "ProductPriceExternalDiscountSetMessage": + from ._schemas.message import ProductPriceExternalDiscountSetMessageSchema - return PaymentStatusStateTransitionMessageSchema().load(data) + return ProductPriceExternalDiscountSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import PaymentStatusStateTransitionMessageSchema + from ._schemas.message import ProductPriceExternalDiscountSetMessageSchema - return PaymentStatusStateTransitionMessageSchema().dump(self) + return ProductPriceExternalDiscountSetMessageSchema().dump(self) -class PaymentTransactionAddedMessage(Message): - """Generated after a successful [Add Transaction](ctp:api:type:PaymentAddTransactionAction) update action.""" +class ProductPriceKeySetMessage(Message): + """Generated after a successful [Set Price Key](ctp:api:type:ProductSetPriceKeyAction) update action.""" - #: [Transaction](ctp:api:type:Transaction) that was added to the [Payment](ctp:api:type:Payment). - transaction: "Transaction" + variant_id: int + #: Unique identifier of the [Price](ctp:api:type:Price). + price_id: typing.Optional[str] + #: `key` value of the [Price](ctp:api:type:Price) before the [Set Price Key](ctp:api:type:ProductSetPriceKeyAction) update action. + old_key: typing.Optional[str] + #: `key` value of the [Price](ctp:api:type:Price) after the [Set Price Key](ctp:api:type:ProductSetPriceKeyAction) update action. + key: typing.Optional[str] + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -9543,9 +11200,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - transaction: "Transaction" + variant_id: int, + price_id: typing.Optional[str] = None, + old_key: typing.Optional[str] = None, + key: typing.Optional[str] = None, + staged: bool ): - self.transaction = transaction + self.variant_id = variant_id + self.price_id = price_id + self.old_key = old_key + self.key = key + self.staged = staged super().__init__( id=id, @@ -9558,30 +11223,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="PaymentTransactionAdded", + type="ProductPriceKeySet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "PaymentTransactionAddedMessage": - from ._schemas.message import PaymentTransactionAddedMessageSchema + ) -> "ProductPriceKeySetMessage": + from ._schemas.message import ProductPriceKeySetMessageSchema - return PaymentTransactionAddedMessageSchema().load(data) + return ProductPriceKeySetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import PaymentTransactionAddedMessageSchema + from ._schemas.message import ProductPriceKeySetMessageSchema - return PaymentTransactionAddedMessageSchema().dump(self) + return ProductPriceKeySetMessageSchema().dump(self) -class PaymentTransactionStateChangedMessage(Message): - """Generated after a successful [Change TransactionState](ctp:api:type:PaymentChangeTransactionStateAction) update action.""" +class ProductPriceModeSetMessage(Message): + """Generated after a successful [Set PriceMode](ctp:api:type:ProductSetPriceModeAction) update action.""" - #: Unique identifier for the [Transaction](ctp:api:type:Transaction) for which the [Transaction State](ctp:api:type:TransactionState) changed. - transaction_id: str - #: [Transaction State](ctp:api:type:TransactionState) after the [Change Transaction State](ctp:api:type:PaymentChangeTransactionStateAction) update action. - state: "TransactionState" + #: The [PriceMode](ctp:api:type:ProductPriceModeEnum) that was set. + to: "ProductPriceModeEnum" def __init__( self, @@ -9598,11 +11261,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - transaction_id: str, - state: "TransactionState" + to: "ProductPriceModeEnum" ): - self.transaction_id = transaction_id - self.state = state + self.to = to super().__init__( id=id, @@ -9615,28 +11276,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="PaymentTransactionStateChanged", + type="ProductPriceModeSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "PaymentTransactionStateChangedMessage": - from ._schemas.message import PaymentTransactionStateChangedMessageSchema + ) -> "ProductPriceModeSetMessage": + from ._schemas.message import ProductPriceModeSetMessageSchema - return PaymentTransactionStateChangedMessageSchema().load(data) + return ProductPriceModeSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import PaymentTransactionStateChangedMessageSchema + from ._schemas.message import ProductPriceModeSetMessageSchema - return PaymentTransactionStateChangedMessageSchema().dump(self) + return ProductPriceModeSetMessageSchema().dump(self) -class ProductAddedToCategoryMessage(Message): - """Generated after a successful [Add to Category](ctp:api:type:ProductAddToCategoryAction) update action.""" +class ProductPriceRemovedMessage(Message): + """Generated after a successful [Remove Price](ctp:api:type:ProductRemovePriceAction) update action.""" - #: [Category](ctp:api:type:Category) the [Product](ctp:api:type:Product) was added to. - category: "CategoryReference" + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was removed. + variant_id: int + #: The Embedded Price that was removed from the [ProductVariant](ctp:api:type:ProductVariant). + price: "Price" #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). staged: bool @@ -9655,10 +11318,12 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - category: "CategoryReference", + variant_id: int, + price: "Price", staged: bool ): - self.category = category + self.variant_id = variant_id + self.price = price self.staged = staged super().__init__( @@ -9672,28 +11337,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductAddedToCategory", + type="ProductPriceRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductAddedToCategoryMessage": - from ._schemas.message import ProductAddedToCategoryMessageSchema + ) -> "ProductPriceRemovedMessage": + from ._schemas.message import ProductPriceRemovedMessageSchema - return ProductAddedToCategoryMessageSchema().load(data) + return ProductPriceRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductAddedToCategoryMessageSchema + from ._schemas.message import ProductPriceRemovedMessageSchema - return ProductAddedToCategoryMessageSchema().dump(self) + return ProductPriceRemovedMessageSchema().dump(self) -class ProductCreatedMessage(Message): - """Generated after a successful [Create Product](/../api/projects/products#create-product) request.""" +class ProductPricesSetMessage(Message): + """Generated after a successful [Set Prices](ctp:api:type:ProductSetPricesAction) update action.""" - #: The staged [Product Projection](ctp:api:type:ProductProjection) of the [Product](ctp:api:type:Product) at the time of creation. - product_projection: "ProductProjection" + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was set. + variant_id: int + #: The [Embedded Prices](ctp:api:type:Price) that were set on the [ProductVariant](ctp:api:type:ProductVariant). + prices: typing.List["Price"] + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -9710,9 +11379,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - product_projection: "ProductProjection" + variant_id: int, + prices: typing.List["Price"], + staged: bool ): - self.product_projection = product_projection + self.variant_id = variant_id + self.prices = prices + self.staged = staged super().__init__( id=id, @@ -9725,28 +11398,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductCreated", + type="ProductPricesSet", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductCreatedMessage": - from ._schemas.message import ProductCreatedMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPricesSetMessage": + from ._schemas.message import ProductPricesSetMessageSchema - return ProductCreatedMessageSchema().load(data) + return ProductPricesSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductCreatedMessageSchema + from ._schemas.message import ProductPricesSetMessageSchema - return ProductCreatedMessageSchema().dump(self) + return ProductPricesSetMessageSchema().dump(self) -class ProductDeletedMessage(Message): - """Generated after a successful [Delete Product](/../api/projects/products#delete-product) request.""" +class ProductPublishedMessage(Message): + """Generated after a successful [Publish](ctp:api:type:ProductPublishAction) update action.""" - #: List of image URLs that were removed during the [Delete Product](ctp:api:type:Product) request. + #: List of image URLs which were removed during the [Publish](ctp:api:type:ProductPublishAction) update action. removed_image_urls: typing.List["str"] - #: Current [Product Projection](ctp:api:type:ProductProjection) of the deleted [Product](ctp:api:type:Product). - current_projection: typing.Optional["ProductProjection"] + #: Current [Product Projection](ctp:api:type:ProductProjection) of the [Product](ctp:api:type:Product) at the time of creation. + product_projection: "ProductProjection" + #: [Publishing Scope](ctp:api:type:ProductPublishScope) that was used during the [Publish](ctp:api:type:ProductPublishAction) update action. + scope: "ProductPublishScope" def __init__( self, @@ -9764,10 +11441,12 @@ def __init__( "UserProvidedIdentifiers" ] = None, removed_image_urls: typing.List["str"], - current_projection: typing.Optional["ProductProjection"] = None + product_projection: "ProductProjection", + scope: "ProductPublishScope" ): self.removed_image_urls = removed_image_urls - self.current_projection = current_projection + self.product_projection = product_projection + self.scope = scope super().__init__( id=id, @@ -9780,28 +11459,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductDeleted", + type="ProductPublished", ) @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductDeletedMessage": - from ._schemas.message import ProductDeletedMessageSchema + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPublishedMessage": + from ._schemas.message import ProductPublishedMessageSchema - return ProductDeletedMessageSchema().load(data) + return ProductPublishedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductDeletedMessageSchema + from ._schemas.message import ProductPublishedMessageSchema - return ProductDeletedMessageSchema().dump(self) + return ProductPublishedMessageSchema().dump(self) -class ProductImageAddedMessage(Message): - """Generated after a successful [Add External Image](ctp:api:type:ProductAddExternalImageAction) update action or after the successful [upload of an image](/../api/projects/products#upload-product-image).""" +class ProductRemovedFromCategoryMessage(Message): + """Generated after a successful [Remove from Category](ctp:api:type:ProductRemoveFromCategoryAction) update action.""" - #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) to which the [Image](ctp:api:type:Image) was added. - variant_id: int - #: [Image](ctp:api:type:Image) that was added. - image: "Image" + #: [Category](ctp:api:type:Category) the [Product](ctp:api:type:Product) was removed from. + category: "CategoryReference" #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). staged: bool @@ -9820,12 +11499,10 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant_id: int, - image: "Image", + category: "CategoryReference", staged: bool ): - self.variant_id = variant_id - self.image = image + self.category = category self.staged = staged super().__init__( @@ -9839,32 +11516,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductImageAdded", + type="ProductRemovedFromCategory", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductImageAddedMessage": - from ._schemas.message import ProductImageAddedMessageSchema + ) -> "ProductRemovedFromCategoryMessage": + from ._schemas.message import ProductRemovedFromCategoryMessageSchema - return ProductImageAddedMessageSchema().load(data) + return ProductRemovedFromCategoryMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductImageAddedMessageSchema + from ._schemas.message import ProductRemovedFromCategoryMessageSchema - return ProductImageAddedMessageSchema().dump(self) + return ProductRemovedFromCategoryMessageSchema().dump(self) -class ProductPriceAddedMessage(Message): - """Generated after a successful [Add Price](ctp:api:type:ProductAddPriceAction) update action.""" +class ProductRevertedStagedChangesMessage(Message): + """Generated after a successful [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action.""" - #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was added. - variant_id: int - #: The [Embedded Price](/projects/products#embedded-price) that was added to the [ProductVariant](ctp:api:type:ProductVariant). - price: "Price" - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: List of image URLs that were removed during the [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action. + removed_image_urls: typing.List["str"] def __init__( self, @@ -9881,13 +11554,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant_id: int, - price: "Price", - staged: bool + removed_image_urls: typing.List["str"] ): - self.variant_id = variant_id - self.price = price - self.staged = staged + self.removed_image_urls = removed_image_urls super().__init__( id=id, @@ -9900,36 +11569,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPriceAdded", + type="ProductRevertedStagedChanges", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceAddedMessage": - from ._schemas.message import ProductPriceAddedMessageSchema + ) -> "ProductRevertedStagedChangesMessage": + from ._schemas.message import ProductRevertedStagedChangesMessageSchema - return ProductPriceAddedMessageSchema().load(data) + return ProductRevertedStagedChangesMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceAddedMessageSchema + from ._schemas.message import ProductRevertedStagedChangesMessageSchema - return ProductPriceAddedMessageSchema().dump(self) + return ProductRevertedStagedChangesMessageSchema().dump(self) -class ProductPriceChangedMessage(Message): - """Generated after a successful [Change Price](ctp:api:type:ProductChangePriceAction) update action.""" +class ProductSelectionCreatedMessage(Message): + """Generated after a successful [Create Product Selection](ctp:api:endpoint:/{projectKey}/product-selections:POST) request.""" - #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was changed. - variant_id: int - #: The current [Embedded Price](/projects/products#embedded-price) before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. - old_price: "Price" - #: The [Embedded Price](/projects/products#embedded-price) after the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. - new_price: "Price" - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool - #: The staged [Embedded Price](/projects/products#embedded-price) before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. - old_staged_price: typing.Optional["Price"] + #: [Product Selection](ctp:api:type:ProductSelection) that was created. + product_selection: "ProductSelection" def __init__( self, @@ -9946,17 +11607,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant_id: int, - old_price: "Price", - new_price: "Price", - staged: bool, - old_staged_price: typing.Optional["Price"] = None + product_selection: "ProductSelection" ): - self.variant_id = variant_id - self.old_price = old_price - self.new_price = new_price - self.staged = staged - self.old_staged_price = old_staged_price + self.product_selection = product_selection super().__init__( id=id, @@ -9969,28 +11622,25 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPriceChanged", + type="ProductSelectionCreated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceChangedMessage": - from ._schemas.message import ProductPriceChangedMessageSchema + ) -> "ProductSelectionCreatedMessage": + from ._schemas.message import ProductSelectionCreatedMessageSchema - return ProductPriceChangedMessageSchema().load(data) + return ProductSelectionCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceChangedMessageSchema - - return ProductPriceChangedMessageSchema().dump(self) + from ._schemas.message import ProductSelectionCreatedMessageSchema + return ProductSelectionCreatedMessageSchema().dump(self) -class ProductPriceDiscountsSetMessage(Message): - """Generated after a Price is updated due to a [Product Discount](ctp:api:type:ProductDiscount).""" - #: Array containing details about the [Embedded Prices](ctp:api:type:Price) that were updated. - updated_prices: typing.List["ProductPriceDiscountsSetUpdatedPrice"] +class ProductSelectionDeletedMessage(Message): + """Generated after a successful [Delete Product Selection](/../api/projects/product-selections#delete-productselection) request.""" def __init__( self, @@ -10006,10 +11656,8 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None, - updated_prices: typing.List["ProductPriceDiscountsSetUpdatedPrice"] + ] = None ): - self.updated_prices = updated_prices super().__init__( id=id, @@ -10022,87 +11670,87 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPriceDiscountsSet", + type="ProductSelectionDeleted", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceDiscountsSetMessage": - from ._schemas.message import ProductPriceDiscountsSetMessageSchema + ) -> "ProductSelectionDeletedMessage": + from ._schemas.message import ProductSelectionDeletedMessageSchema - return ProductPriceDiscountsSetMessageSchema().load(data) + return ProductSelectionDeletedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceDiscountsSetMessageSchema + from ._schemas.message import ProductSelectionDeletedMessageSchema - return ProductPriceDiscountsSetMessageSchema().dump(self) + return ProductSelectionDeletedMessageSchema().dump(self) -class ProductPriceDiscountsSetUpdatedPrice(_BaseType): - """Details about a [Embedded Price](/projects/products#embedded-price) that was updated due to a Discount. Specific to [Product Price Discounts Set](ctp:api:type:ProductPriceDiscountsSetMessage) Message.""" +class ProductSelectionProductAddedMessage(Message): + """Generated after a successful [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action.""" - #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Discount was set. - variant_id: int - #: Key of the [ProductVariant](ctp:api:type:ProductVariant) for which Discount was set. - variant_key: typing.Optional[str] - #: SKU of the [ProductVariant](ctp:api:type:ProductVariant) for which Discount was set. - sku: typing.Optional[str] - #: Unique identifier of the [Price](ctp:api:type:Price). - price_id: str - #: Discounted Price for the [ProductVariant](ctp:api:type:ProductVariant) for which Discount was set. - discounted: typing.Optional["DiscountedPrice"] - #: Whether the update was only applied to the staged [ProductProjection](ctp:api:type:ProductProjection). - staged: bool + #: [Product](ctp:api:type:Product) that was added to the [Product Selection](ctp:api:type:ProductSelection). + product: "ProductReference" + #: Product Variant Selection after the [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action. + variant_selection: "ProductVariantSelection" def __init__( self, *, - variant_id: int, - variant_key: typing.Optional[str] = None, - sku: typing.Optional[str] = None, - price_id: str, - discounted: typing.Optional["DiscountedPrice"] = None, - staged: bool + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + sequence_number: int, + resource: "Reference", + resource_version: int, + resource_user_provided_identifiers: typing.Optional[ + "UserProvidedIdentifiers" + ] = None, + product: "ProductReference", + variant_selection: "ProductVariantSelection" ): - self.variant_id = variant_id - self.variant_key = variant_key - self.sku = sku - self.price_id = price_id - self.discounted = discounted - self.staged = staged + self.product = product + self.variant_selection = variant_selection - super().__init__() + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + last_modified_by=last_modified_by, + created_by=created_by, + sequence_number=sequence_number, + resource=resource, + resource_version=resource_version, + resource_user_provided_identifiers=resource_user_provided_identifiers, + type="ProductSelectionProductAdded", + ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceDiscountsSetUpdatedPrice": - from ._schemas.message import ProductPriceDiscountsSetUpdatedPriceSchema + ) -> "ProductSelectionProductAddedMessage": + from ._schemas.message import ProductSelectionProductAddedMessageSchema - return ProductPriceDiscountsSetUpdatedPriceSchema().load(data) + return ProductSelectionProductAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceDiscountsSetUpdatedPriceSchema + from ._schemas.message import ProductSelectionProductAddedMessageSchema - return ProductPriceDiscountsSetUpdatedPriceSchema().dump(self) + return ProductSelectionProductAddedMessageSchema().dump(self) -class ProductPriceExternalDiscountSetMessage(Message): - """Generated after a successful [Set Discounted Price](ctp:api:type:ProductSetDiscountedPriceAction) update action.""" +class ProductSelectionProductExcludedMessage(Message): + """Generated after a successful [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action.""" - #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) for which the Discount was set. - variant_id: int - #: Key of the [Product Variant](ctp:api:type:ProductVariant) for which the Discount was set. - variant_key: typing.Optional[str] - #: SKU of the [Product Variant](ctp:api:type:ProductVariant) for which Discount was set. - sku: typing.Optional[str] - #: Unique identifier of the [Price](ctp:api:type:Price). - price_id: str - #: Discounted Price for the [Product Variant](ctp:api:type:ProductVariant) for which Discount was set. - discounted: typing.Optional["DiscountedPrice"] - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: [Product](ctp:api:type:Product) that was excluded from the [Product Selection](ctp:api:type:ProductSelection). + product: "ProductReference" + #: Product Variant Exclusion after the [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action. + variant_exclusion: "ProductVariantExclusion" def __init__( self, @@ -10119,19 +11767,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant_id: int, - variant_key: typing.Optional[str] = None, - sku: typing.Optional[str] = None, - price_id: str, - discounted: typing.Optional["DiscountedPrice"] = None, - staged: bool + product: "ProductReference", + variant_exclusion: "ProductVariantExclusion" ): - self.variant_id = variant_id - self.variant_key = variant_key - self.sku = sku - self.price_id = price_id - self.discounted = discounted - self.staged = staged + self.product = product + self.variant_exclusion = variant_exclusion super().__init__( id=id, @@ -10144,35 +11784,28 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPriceExternalDiscountSet", + type="ProductSelectionProductExcluded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceExternalDiscountSetMessage": - from ._schemas.message import ProductPriceExternalDiscountSetMessageSchema + ) -> "ProductSelectionProductExcludedMessage": + from ._schemas.message import ProductSelectionProductExcludedMessageSchema - return ProductPriceExternalDiscountSetMessageSchema().load(data) + return ProductSelectionProductExcludedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceExternalDiscountSetMessageSchema + from ._schemas.message import ProductSelectionProductExcludedMessageSchema - return ProductPriceExternalDiscountSetMessageSchema().dump(self) + return ProductSelectionProductExcludedMessageSchema().dump(self) -class ProductPriceKeySetMessage(Message): - """Generated after a successful [Set Price Key](ctp:api:type:ProductSetPriceKeyAction) update action.""" +class ProductSelectionProductRemovedMessage(Message): + """Generated after a successful [Remove Product](ctp:api:type:ProductSelectionRemoveProductAction) update action.""" - variant_id: int - #: Unique identifier of the [Price](ctp:api:type:Price). - price_id: typing.Optional[str] - #: `key` value of the [Price](ctp:api:type:Price) before the [Set Price Key](ctp:api:type:ProductSetPriceKeyAction) update action. - old_key: typing.Optional[str] - #: `key` value of the [Price](ctp:api:type:Price) after the [Set Price Key](ctp:api:type:ProductSetPriceKeyAction) update action. - key: typing.Optional[str] - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: [Product](ctp:api:type:Product) that was removed from the Product Selection. + product: "ProductReference" def __init__( self, @@ -10189,17 +11822,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant_id: int, - price_id: typing.Optional[str] = None, - old_key: typing.Optional[str] = None, - key: typing.Optional[str] = None, - staged: bool + product: "ProductReference" ): - self.variant_id = variant_id - self.price_id = price_id - self.old_key = old_key - self.key = key - self.staged = staged + self.product = product super().__init__( id=id, @@ -10212,28 +11837,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPriceKeySet", + type="ProductSelectionProductRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceKeySetMessage": - from ._schemas.message import ProductPriceKeySetMessageSchema + ) -> "ProductSelectionProductRemovedMessage": + from ._schemas.message import ProductSelectionProductRemovedMessageSchema - return ProductPriceKeySetMessageSchema().load(data) + return ProductSelectionProductRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceKeySetMessageSchema + from ._schemas.message import ProductSelectionProductRemovedMessageSchema - return ProductPriceKeySetMessageSchema().dump(self) + return ProductSelectionProductRemovedMessageSchema().dump(self) -class ProductPriceModeSetMessage(Message): - """Generated after a successful [Set PriceMode](ctp:api:type:ProductSetPriceModeAction) update action.""" +class ProductSelectionVariantExclusionChangedMessage(Message): + """Generated after a successful [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action.""" - #: The [PriceMode](ctp:api:type:ProductPriceModeEnum) that was set. - to: "ProductPriceModeEnum" + #: [Product](ctp:api:type:Product) for which the Product Variant Exclusion changed. + product: "ProductReference" + #: Product Variant Exclusion before the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. + old_variant_exclusion: "ProductVariantExclusion" + #: Product Variant Exclusion after the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. + new_variant_exclusion: "ProductVariantExclusion" def __init__( self, @@ -10250,9 +11879,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - to: "ProductPriceModeEnum" + product: "ProductReference", + old_variant_exclusion: "ProductVariantExclusion", + new_variant_exclusion: "ProductVariantExclusion" ): - self.to = to + self.product = product + self.old_variant_exclusion = old_variant_exclusion + self.new_variant_exclusion = new_variant_exclusion super().__init__( id=id, @@ -10265,32 +11898,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPriceModeSet", + type="ProductSelectionVariantExclusionChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceModeSetMessage": - from ._schemas.message import ProductPriceModeSetMessageSchema + ) -> "ProductSelectionVariantExclusionChangedMessage": + from ._schemas.message import ( + ProductSelectionVariantExclusionChangedMessageSchema, + ) - return ProductPriceModeSetMessageSchema().load(data) + return ProductSelectionVariantExclusionChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceModeSetMessageSchema + from ._schemas.message import ( + ProductSelectionVariantExclusionChangedMessageSchema, + ) - return ProductPriceModeSetMessageSchema().dump(self) + return ProductSelectionVariantExclusionChangedMessageSchema().dump(self) -class ProductPriceRemovedMessage(Message): - """Generated after a successful [Remove Price](ctp:api:type:ProductRemovePriceAction) update action.""" +class ProductSelectionVariantSelectionChangedMessage(Message): + """Generated after a successful [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action.""" - #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was removed. - variant_id: int - #: The [Embedded Price](/projects/products#embedded-price) that was removed from the [ProductVariant](ctp:api:type:ProductVariant). - price: "Price" - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: [Product](ctp:api:type:Product) for which the Product Variant Selection changed. + product: "ProductReference" + #: Product Variant Selection before the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. + old_variant_selection: "ProductVariantSelection" + #: Product Variant Selection after the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. + new_variant_selection: "ProductVariantSelection" def __init__( self, @@ -10307,13 +11944,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant_id: int, - price: "Price", - staged: bool + product: "ProductReference", + old_variant_selection: "ProductVariantSelection", + new_variant_selection: "ProductVariantSelection" ): - self.variant_id = variant_id - self.price = price - self.staged = staged + self.product = product + self.old_variant_selection = old_variant_selection + self.new_variant_selection = new_variant_selection super().__init__( id=id, @@ -10326,32 +11963,34 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPriceRemoved", + type="ProductSelectionVariantSelectionChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceRemovedMessage": - from ._schemas.message import ProductPriceRemovedMessageSchema + ) -> "ProductSelectionVariantSelectionChangedMessage": + from ._schemas.message import ( + ProductSelectionVariantSelectionChangedMessageSchema, + ) - return ProductPriceRemovedMessageSchema().load(data) + return ProductSelectionVariantSelectionChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceRemovedMessageSchema + from ._schemas.message import ( + ProductSelectionVariantSelectionChangedMessageSchema, + ) - return ProductPriceRemovedMessageSchema().dump(self) + return ProductSelectionVariantSelectionChangedMessageSchema().dump(self) -class ProductPricesSetMessage(Message): - """Generated after a successful [Set Prices](ctp:api:type:ProductSetPricesAction) update action.""" +class ProductSlugChangedMessage(Message): + """Generated after a successful [Change Slug](ctp:api:type:ProductChangeSlugAction) update action.""" - #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was set. - variant_id: int - #: The [Embedded Prices](ctp:api:type:Price) that were set on the [ProductVariant](ctp:api:type:ProductVariant). - prices: typing.List["Price"] - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: The slug of the [Product](ctp:api:type:Product) after the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. + slug: "LocalizedString" + #: The slug of the [Product](ctp:api:type:Product) before the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. + old_slug: typing.Optional["LocalizedString"] def __init__( self, @@ -10368,13 +12007,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant_id: int, - prices: typing.List["Price"], - staged: bool + slug: "LocalizedString", + old_slug: typing.Optional["LocalizedString"] = None ): - self.variant_id = variant_id - self.prices = prices - self.staged = staged + self.slug = slug + self.old_slug = old_slug super().__init__( id=id, @@ -10387,32 +12024,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPricesSet", + type="ProductSlugChanged", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPricesSetMessage": - from ._schemas.message import ProductPricesSetMessageSchema + ) -> "ProductSlugChangedMessage": + from ._schemas.message import ProductSlugChangedMessageSchema - return ProductPricesSetMessageSchema().load(data) + return ProductSlugChangedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPricesSetMessageSchema + from ._schemas.message import ProductSlugChangedMessageSchema - return ProductPricesSetMessageSchema().dump(self) + return ProductSlugChangedMessageSchema().dump(self) -class ProductPublishedMessage(Message): - """Generated after a successful [Publish](ctp:api:type:ProductPublishAction) update action.""" +class ProductStateTransitionMessage(Message): + """Generated after a successful [Transition State](ctp:api:type:ProductTransitionStateAction) update action.""" - #: List of image URLs which were removed during the [Publish](ctp:api:type:ProductPublishAction) update action. - removed_image_urls: typing.List["str"] - #: Current [Product Projection](ctp:api:type:ProductProjection) of the [Product](ctp:api:type:Product) at the time of creation. - product_projection: "ProductProjection" - #: [Publishing Scope](ctp:api:type:ProductPublishScope) that was used during the [Publish](ctp:api:type:ProductPublishAction) update action. - scope: "ProductPublishScope" + #: Product [State](ctp:api:type:State) after the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. + state: "StateReference" + #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. + force: bool def __init__( self, @@ -10429,13 +12064,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - removed_image_urls: typing.List["str"], - product_projection: "ProductProjection", - scope: "ProductPublishScope" + state: "StateReference", + force: bool ): - self.removed_image_urls = removed_image_urls - self.product_projection = product_projection - self.scope = scope + self.state = state + self.force = force super().__init__( id=id, @@ -10448,30 +12081,53 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductPublished", + type="ProductStateTransition", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPublishedMessage": - from ._schemas.message import ProductPublishedMessageSchema + ) -> "ProductStateTransitionMessage": + from ._schemas.message import ProductStateTransitionMessageSchema - return ProductPublishedMessageSchema().load(data) + return ProductStateTransitionMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPublishedMessageSchema + from ._schemas.message import ProductStateTransitionMessageSchema - return ProductPublishedMessageSchema().dump(self) + return ProductStateTransitionMessageSchema().dump(self) -class ProductRemovedFromCategoryMessage(Message): - """Generated after a successful [Remove from Category](ctp:api:type:ProductRemoveFromCategoryAction) update action.""" +class ProductTailoringCreatedMessage(Message): + """Generated after a successful [Create Product Tailoring](/../api/projects/product-tailoring#create-producttailoring) or + [Create Product Tailoring in Store](/../api/projects/product-tailoring#create-producttailoring-in-store) request. - #: [Category](ctp:api:type:Category) the [Product](ctp:api:type:Product) was removed from. - category: "CategoryReference" - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + """ + + #: User-defined unique identifier of the Product Tailoring. + key: typing.Optional[str] + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" + #: The description of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + description: typing.Optional["LocalizedString"] + #: The name of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + name: typing.Optional["LocalizedString"] + #: The slug of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + slug: typing.Optional["LocalizedString"] + #: The metaTitle of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + meta_title: typing.Optional["LocalizedString"] + #: The metaDescription of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + meta_description: typing.Optional["LocalizedString"] + #: The metaKeywords of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + meta_keywords: typing.Optional["LocalizedString"] + #: The variants of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + variants: typing.Optional[typing.List["ProductVariantTailoring"]] + #: `true` if the ProductTailoring is published. + published: bool def __init__( self, @@ -10488,11 +12144,31 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - category: "CategoryReference", - staged: bool + key: typing.Optional[str] = None, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + description: typing.Optional["LocalizedString"] = None, + name: typing.Optional["LocalizedString"] = None, + slug: typing.Optional["LocalizedString"] = None, + meta_title: typing.Optional["LocalizedString"] = None, + meta_description: typing.Optional["LocalizedString"] = None, + meta_keywords: typing.Optional["LocalizedString"] = None, + variants: typing.Optional[typing.List["ProductVariantTailoring"]] = None, + published: bool ): - self.category = category - self.staged = staged + self.key = key + self.store = store + self.product_key = product_key + self.product = product + self.description = description + self.name = name + self.slug = slug + self.meta_title = meta_title + self.meta_description = meta_description + self.meta_keywords = meta_keywords + self.variants = variants + self.published = published super().__init__( id=id, @@ -10505,28 +12181,35 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductRemovedFromCategory", + type="ProductTailoringCreated", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductRemovedFromCategoryMessage": - from ._schemas.message import ProductRemovedFromCategoryMessageSchema + ) -> "ProductTailoringCreatedMessage": + from ._schemas.message import ProductTailoringCreatedMessageSchema - return ProductRemovedFromCategoryMessageSchema().load(data) + return ProductTailoringCreatedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductRemovedFromCategoryMessageSchema + from ._schemas.message import ProductTailoringCreatedMessageSchema - return ProductRemovedFromCategoryMessageSchema().dump(self) + return ProductTailoringCreatedMessageSchema().dump(self) -class ProductRevertedStagedChangesMessage(Message): - """Generated after a successful [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action.""" +class ProductTailoringDeletedMessage(Message): + """Generated after a successful [Delete Product Tailoring](/../api/projects/product-tailoring#delete-producttailoring) or + [Delete ProductTailoring assigned to Product in Store](/../api/projects/product-tailoring#delete-producttailoring-assigned-to-product-in-store) request. - #: List of image URLs that were removed during the [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action. - removed_image_urls: typing.List["str"] + """ + + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" def __init__( self, @@ -10543,9 +12226,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - removed_image_urls: typing.List["str"] + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference" ): - self.removed_image_urls = removed_image_urls + self.store = store + self.product_key = product_key + self.product = product super().__init__( id=id, @@ -10558,28 +12245,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductRevertedStagedChanges", + type="ProductTailoringDeleted", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductRevertedStagedChangesMessage": - from ._schemas.message import ProductRevertedStagedChangesMessageSchema + ) -> "ProductTailoringDeletedMessage": + from ._schemas.message import ProductTailoringDeletedMessageSchema - return ProductRevertedStagedChangesMessageSchema().load(data) + return ProductTailoringDeletedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductRevertedStagedChangesMessageSchema + from ._schemas.message import ProductTailoringDeletedMessageSchema - return ProductRevertedStagedChangesMessageSchema().dump(self) + return ProductTailoringDeletedMessageSchema().dump(self) -class ProductSelectionCreatedMessage(Message): - """Generated after a successful [Create Product Selection](/../api/projects/product-selections#create-productselection) request.""" +class ProductTailoringDescriptionSetMessage(Message): + """Generated after a successful Product Tailoring [Set Description](ctp:api:type:ProductTailoringSetDescriptionAction) update action.""" - #: [Product Selection](ctp:api:type:ProductSelection) that was created. - product_selection: "ProductSelection" + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" + #: The description of the [Product Tailoring](ctp:api:type:ProductTailoring) after the [Set Description](ctp:api:type:ProductTailoringSetDescriptionAction) update action. + description: typing.Optional["LocalizedString"] + #: The description of the [ProductTailoring](ctp:api:type:ProductTailoring) before the [Set Description](ctp:api:type:ProductTailoringSetDescriptionAction) update action. + old_description: typing.Optional["LocalizedString"] def __init__( self, @@ -10596,9 +12291,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - product_selection: "ProductSelection" + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + description: typing.Optional["LocalizedString"] = None, + old_description: typing.Optional["LocalizedString"] = None ): - self.product_selection = product_selection + self.store = store + self.product_key = product_key + self.product = product + self.description = description + self.old_description = old_description super().__init__( id=id, @@ -10611,25 +12314,39 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSelectionCreated", + type="ProductTailoringDescriptionSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionCreatedMessage": - from ._schemas.message import ProductSelectionCreatedMessageSchema + ) -> "ProductTailoringDescriptionSetMessage": + from ._schemas.message import ProductTailoringDescriptionSetMessageSchema - return ProductSelectionCreatedMessageSchema().load(data) + return ProductTailoringDescriptionSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionCreatedMessageSchema + from ._schemas.message import ProductTailoringDescriptionSetMessageSchema - return ProductSelectionCreatedMessageSchema().dump(self) + return ProductTailoringDescriptionSetMessageSchema().dump(self) -class ProductSelectionDeletedMessage(Message): - """Generated after a successful [Delete Product Selection](/../api/projects/product-selections#delete-productselection) request.""" +class ProductTailoringImageAddedMessage(Message): + """Generated after a successful [Add External Image](ctp:api:type:ProductTailoringAddExternalImageAction) update action + or after a successful [Upload Product Tailoring image](/projects/product-tailoring#upload-product-tailoring-image) request. + + """ + + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the tailored Product. + product: "ProductReference" + #: `id` of the tailored [ProductVariant](ctp:api:type:ProductVariant). + variant_id: int + #: [Image](ctp:api:type:Image) that was added. + image: "Image" def __init__( self, @@ -10645,8 +12362,19 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None + ] = None, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + variant_id: int, + image: "Image" ): + self.store = store + self.product_key = product_key + self.product = product + self.variant_id = variant_id + self.image = image + super().__init__( id=id, version=version, @@ -10658,30 +12386,38 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSelectionDeleted", + type="ProductTailoringImageAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionDeletedMessage": - from ._schemas.message import ProductSelectionDeletedMessageSchema + ) -> "ProductTailoringImageAddedMessage": + from ._schemas.message import ProductTailoringImageAddedMessageSchema - return ProductSelectionDeletedMessageSchema().load(data) + return ProductTailoringImageAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionDeletedMessageSchema + from ._schemas.message import ProductTailoringImageAddedMessageSchema - return ProductSelectionDeletedMessageSchema().dump(self) + return ProductTailoringImageAddedMessageSchema().dump(self) -class ProductSelectionProductAddedMessage(Message): - """Generated after a successful [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action.""" +class ProductTailoringImagesSetMessage(Message): + """Generated after a successful [Set Images](ctp:api:type:ProductTailoringSetExternalImagesAction) update action.""" - #: [Product](ctp:api:type:Product) that was added to the [Product Selection](ctp:api:type:ProductSelection). + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" - #: Product Variant Selection after the [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action. - variant_selection: "ProductVariantSelection" + #: `id` of the tailored Product Variant. + variant_id: int + #: [Images](ctp:api:type:Image) on the tailored [Product Variant](ctp:api:type:ProductVariantTailoring) before the [Set Images](ctp:api:type:ProductTailoringSetExternalImagesAction) update action. + old_images: typing.Optional[typing.List["Image"]] + #: [Images](ctp:api:type:Image) on the tailored [Product Variant](ctp:api:type:ProductVariantTailoring) after the [Set Images](ctp:api:type:ProductTailoringSetExternalImagesAction) update action. + images: typing.Optional[typing.List["Image"]] def __init__( self, @@ -10698,11 +12434,19 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, product: "ProductReference", - variant_selection: "ProductVariantSelection" + variant_id: int, + old_images: typing.Optional[typing.List["Image"]] = None, + images: typing.Optional[typing.List["Image"]] = None ): + self.store = store + self.product_key = product_key self.product = product - self.variant_selection = variant_selection + self.variant_id = variant_id + self.old_images = old_images + self.images = images super().__init__( id=id, @@ -10715,30 +12459,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSelectionProductAdded", + type="ProductTailoringImagesSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionProductAddedMessage": - from ._schemas.message import ProductSelectionProductAddedMessageSchema + ) -> "ProductTailoringImagesSetMessage": + from ._schemas.message import ProductTailoringImagesSetMessageSchema - return ProductSelectionProductAddedMessageSchema().load(data) + return ProductTailoringImagesSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionProductAddedMessageSchema + from ._schemas.message import ProductTailoringImagesSetMessageSchema - return ProductSelectionProductAddedMessageSchema().dump(self) + return ProductTailoringImagesSetMessageSchema().dump(self) -class ProductSelectionProductExcludedMessage(Message): - """Generated after a successful [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action.""" +class ProductTailoringNameSetMessage(Message): + """Generated after a successful Product Tailoring [Set Name](ctp:api:type:ProductTailoringSetNameAction) update action.""" - #: [Product](ctp:api:type:Product) that was excluded from the [Product Selection](ctp:api:type:ProductSelection). + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" - #: Product Variant Exclusion after the [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action. - variant_exclusion: "ProductVariantExclusion" + #: The name of the [Product Tailoring](ctp:api:type:ProductTailoring) after the [Set Name](ctp:api:type:ProductTailoringSetNameAction) update action. + name: typing.Optional["LocalizedString"] + #: The name of the [ProductTailoring](ctp:api:type:ProductTailoring) before the [Set Name](ctp:api:type:ProductTailoringSetNameAction) update action. + old_name: typing.Optional["LocalizedString"] def __init__( self, @@ -10755,11 +12505,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, product: "ProductReference", - variant_exclusion: "ProductVariantExclusion" + name: typing.Optional["LocalizedString"] = None, + old_name: typing.Optional["LocalizedString"] = None ): + self.store = store + self.product_key = product_key self.product = product - self.variant_exclusion = variant_exclusion + self.name = name + self.old_name = old_name super().__init__( id=id, @@ -10772,27 +12528,31 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSelectionProductExcluded", + type="ProductTailoringNameSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionProductExcludedMessage": - from ._schemas.message import ProductSelectionProductExcludedMessageSchema + ) -> "ProductTailoringNameSetMessage": + from ._schemas.message import ProductTailoringNameSetMessageSchema - return ProductSelectionProductExcludedMessageSchema().load(data) + return ProductTailoringNameSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionProductExcludedMessageSchema + from ._schemas.message import ProductTailoringNameSetMessageSchema - return ProductSelectionProductExcludedMessageSchema().dump(self) + return ProductTailoringNameSetMessageSchema().dump(self) -class ProductSelectionProductRemovedMessage(Message): - """Generated after a successful [Remove Product](ctp:api:type:ProductSelectionRemoveProductAction) update action.""" +class ProductTailoringPublishedMessage(Message): + """Generated after a successful [Product Tailoring Publish](ctp:api:type:ProductTailoringPublishAction) update action.""" - #: [Product](ctp:api:type:Product) that was removed from the Product Selection. + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" def __init__( @@ -10810,8 +12570,12 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, product: "ProductReference" ): + self.store = store + self.product_key = product_key self.product = product super().__init__( @@ -10825,32 +12589,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSelectionProductRemoved", + type="ProductTailoringPublished", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionProductRemovedMessage": - from ._schemas.message import ProductSelectionProductRemovedMessageSchema + ) -> "ProductTailoringPublishedMessage": + from ._schemas.message import ProductTailoringPublishedMessageSchema - return ProductSelectionProductRemovedMessageSchema().load(data) + return ProductTailoringPublishedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionProductRemovedMessageSchema + from ._schemas.message import ProductTailoringPublishedMessageSchema - return ProductSelectionProductRemovedMessageSchema().dump(self) + return ProductTailoringPublishedMessageSchema().dump(self) -class ProductSelectionVariantExclusionChangedMessage(Message): - """Generated after a successful [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action.""" +class ProductTailoringSlugSetMessage(Message): + """Generated after a successful Product Tailoring [Set Slug](ctp:api:type:ProductTailoringSetSlugAction) update action.""" - #: [Product](ctp:api:type:Product) for which the Product Variant Exclusion changed. + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" - #: Product Variant Exclusion before the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. - old_variant_exclusion: "ProductVariantExclusion" - #: Product Variant Exclusion after the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. - new_variant_exclusion: "ProductVariantExclusion" + #: The slug of the [Product Tailoring](ctp:api:type:ProductTailoring) after the [Set Slug](ctp:api:type:ProductTailoringSetSlugAction) update action. + slug: typing.Optional["LocalizedString"] + #: The slug of the [ProductTailoring](ctp:api:type:ProductTailoring) before the [Set Slug](ctp:api:type:ProductTailoringSetSlugAction) update action. + old_slug: typing.Optional["LocalizedString"] def __init__( self, @@ -10867,13 +12635,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, product: "ProductReference", - old_variant_exclusion: "ProductVariantExclusion", - new_variant_exclusion: "ProductVariantExclusion" + slug: typing.Optional["LocalizedString"] = None, + old_slug: typing.Optional["LocalizedString"] = None ): + self.store = store + self.product_key = product_key self.product = product - self.old_variant_exclusion = old_variant_exclusion - self.new_variant_exclusion = new_variant_exclusion + self.slug = slug + self.old_slug = old_slug super().__init__( id=id, @@ -10886,36 +12658,32 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSelectionVariantExclusionChanged", + type="ProductTailoringSlugSet", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionVariantExclusionChangedMessage": - from ._schemas.message import ( - ProductSelectionVariantExclusionChangedMessageSchema, - ) + ) -> "ProductTailoringSlugSetMessage": + from ._schemas.message import ProductTailoringSlugSetMessageSchema - return ProductSelectionVariantExclusionChangedMessageSchema().load(data) + return ProductTailoringSlugSetMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ( - ProductSelectionVariantExclusionChangedMessageSchema, - ) + from ._schemas.message import ProductTailoringSlugSetMessageSchema - return ProductSelectionVariantExclusionChangedMessageSchema().dump(self) + return ProductTailoringSlugSetMessageSchema().dump(self) -class ProductSelectionVariantSelectionChangedMessage(Message): - """Generated after a successful [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action.""" +class ProductTailoringUnpublishedMessage(Message): + """Generated after a successful [Product Tailoring Unpublish](ctp:api:type:ProductTailoringUnpublishAction) update action.""" - #: [Product](ctp:api:type:Product) for which the Product Variant Selection changed. + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" - #: Product Variant Selection before the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. - old_variant_selection: "ProductVariantSelection" - #: Product Variant Selection after the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. - new_variant_selection: "ProductVariantSelection" def __init__( self, @@ -10932,13 +12700,13 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - product: "ProductReference", - old_variant_selection: "ProductVariantSelection", - new_variant_selection: "ProductVariantSelection" + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference" ): + self.store = store + self.product_key = product_key self.product = product - self.old_variant_selection = old_variant_selection - self.new_variant_selection = new_variant_selection super().__init__( id=id, @@ -10951,34 +12719,25 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSelectionVariantSelectionChanged", + type="ProductTailoringUnpublished", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionVariantSelectionChangedMessage": - from ._schemas.message import ( - ProductSelectionVariantSelectionChangedMessageSchema, - ) + ) -> "ProductTailoringUnpublishedMessage": + from ._schemas.message import ProductTailoringUnpublishedMessageSchema - return ProductSelectionVariantSelectionChangedMessageSchema().load(data) + return ProductTailoringUnpublishedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ( - ProductSelectionVariantSelectionChangedMessageSchema, - ) - - return ProductSelectionVariantSelectionChangedMessageSchema().dump(self) + from ._schemas.message import ProductTailoringUnpublishedMessageSchema + return ProductTailoringUnpublishedMessageSchema().dump(self) -class ProductSlugChangedMessage(Message): - """Generated after a successful [Change Slug](ctp:api:type:ProductChangeSlugAction) update action.""" - #: The slug of the [Product](ctp:api:type:Product) after the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. - slug: "LocalizedString" - #: The slug of the [Product](ctp:api:type:Product) before the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. - old_slug: typing.Optional["LocalizedString"] +class ProductUnpublishedMessage(Message): + """Generated after a successful [Unpublish Product](ctp:api:type:ProductUnpublishAction) update action.""" def __init__( self, @@ -10994,12 +12753,8 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None, - slug: "LocalizedString", - old_slug: typing.Optional["LocalizedString"] = None + ] = None ): - self.slug = slug - self.old_slug = old_slug super().__init__( id=id, @@ -11012,30 +12767,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductSlugChanged", + type="ProductUnpublished", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSlugChangedMessage": - from ._schemas.message import ProductSlugChangedMessageSchema + ) -> "ProductUnpublishedMessage": + from ._schemas.message import ProductUnpublishedMessageSchema - return ProductSlugChangedMessageSchema().load(data) + return ProductUnpublishedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSlugChangedMessageSchema + from ._schemas.message import ProductUnpublishedMessageSchema - return ProductSlugChangedMessageSchema().dump(self) + return ProductUnpublishedMessageSchema().dump(self) -class ProductStateTransitionMessage(Message): - """Generated after a successful [Transition State](ctp:api:type:ProductTransitionStateAction) update action.""" +class ProductVariantAddedMessage(Message): + """Generated after a successful [Add ProductVariant](ctp:api:type:ProductAddVariantAction) update action.""" - #: Product [State](ctp:api:type:State) after the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. - state: "StateReference" - #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. - force: bool + #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) that was added. + variant: "ProductVariant" + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool def __init__( self, @@ -11052,11 +12807,11 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - state: "StateReference", - force: bool + variant: "ProductVariant", + staged: bool ): - self.state = state - self.force = force + self.variant = variant + self.staged = staged super().__init__( id=id, @@ -11069,25 +12824,30 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductStateTransition", + type="ProductVariantAdded", ) @classmethod def deserialize( - cls, data: typing.Dict[str, typing.Any] - ) -> "ProductStateTransitionMessage": - from ._schemas.message import ProductStateTransitionMessageSchema + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantAddedMessage": + from ._schemas.message import ProductVariantAddedMessageSchema - return ProductStateTransitionMessageSchema().load(data) + return ProductVariantAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductStateTransitionMessageSchema + from ._schemas.message import ProductVariantAddedMessageSchema - return ProductStateTransitionMessageSchema().dump(self) + return ProductVariantAddedMessageSchema().dump(self) -class ProductUnpublishedMessage(Message): - """Generated after a successful [Unpublish Product](ctp:api:type:ProductUnpublishAction) update action.""" +class ProductVariantDeletedMessage(Message): + """Generated after a successful [Remove ProductVariant](ctp:api:type:ProductRemoveVariantAction) update action.""" + + #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) that was added. + variant: typing.Optional["ProductVariant"] + #: List of image URLs that were removed with the [Remove Product Variant](ctp:api:type:ProductRemoveVariantAction) update action. + removed_image_urls: typing.List["str"] def __init__( self, @@ -11103,8 +12863,13 @@ def __init__( resource_version: int, resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" - ] = None + ] = None, + variant: typing.Optional["ProductVariant"] = None, + removed_image_urls: typing.List["str"] ): + self.variant = variant + self.removed_image_urls = removed_image_urls + super().__init__( id=id, version=version, @@ -11116,30 +12881,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductUnpublished", + type="ProductVariantDeleted", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductUnpublishedMessage": - from ._schemas.message import ProductUnpublishedMessageSchema + ) -> "ProductVariantDeletedMessage": + from ._schemas.message import ProductVariantDeletedMessageSchema - return ProductUnpublishedMessageSchema().load(data) + return ProductVariantDeletedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductUnpublishedMessageSchema + from ._schemas.message import ProductVariantDeletedMessageSchema - return ProductUnpublishedMessageSchema().dump(self) + return ProductVariantDeletedMessageSchema().dump(self) -class ProductVariantAddedMessage(Message): - """Generated after a successful [Add ProductVariant](ctp:api:type:ProductAddVariantAction) update action.""" +class ProductVariantTailoringAddedMessage(Message): + """Generated after a successful [Add ProductVariant Tailoring](ctp:api:type:ProductTailoringAddVariantAction) update action.""" - #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) that was added. - variant: "ProductVariant" - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the tailored Product. + product: "ProductReference" + #: `id` of the [ProductVariant](ctp:api:type:ProductVariant) added to the Tailoring. + variant_id: int + #: The [ProductVariantTailoring](ctp:api:type:ProductVariantTailoring) that was added to the ProductTailoring. + variant: "ProductVariantTailoring" def __init__( self, @@ -11156,11 +12927,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant: "ProductVariant", - staged: bool + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + variant_id: int, + variant: "ProductVariantTailoring" ): + self.store = store + self.product_key = product_key + self.product = product + self.variant_id = variant_id self.variant = variant - self.staged = staged super().__init__( id=id, @@ -11173,30 +12950,36 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductVariantAdded", + type="ProductVariantTailoringAdded", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductVariantAddedMessage": - from ._schemas.message import ProductVariantAddedMessageSchema + ) -> "ProductVariantTailoringAddedMessage": + from ._schemas.message import ProductVariantTailoringAddedMessageSchema - return ProductVariantAddedMessageSchema().load(data) + return ProductVariantTailoringAddedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductVariantAddedMessageSchema + from ._schemas.message import ProductVariantTailoringAddedMessageSchema - return ProductVariantAddedMessageSchema().dump(self) + return ProductVariantTailoringAddedMessageSchema().dump(self) -class ProductVariantDeletedMessage(Message): - """Generated after a successful [Remove ProductVariant](ctp:api:type:ProductRemoveVariantAction) update action.""" +class ProductVariantTailoringRemovedMessage(Message): + """Generated after a successful [Remove ProductVariant Tailoring](ctp:api:type:ProductTailoringRemoveVariantAction) update action.""" - #: Unique identifier of the [Product Variant](ctp:api:type:ProductVariant) that was added. - variant: typing.Optional["ProductVariant"] - #: List of image URLs that were removed with the [Remove Product Variant](ctp:api:type:ProductRemoveVariantAction) update action. - removed_image_urls: typing.List["str"] + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" + #: `id` of the [ProductVariant](ctp:api:type:ProductVariant) removed from the Tailoring. + variant_id: int + #: The [ProductVariantTailoring](ctp:api:type:ProductVariantTailoring) that was removed from the ProductTailoring. + variant: "ProductVariantTailoring" def __init__( self, @@ -11213,11 +12996,17 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - variant: typing.Optional["ProductVariant"] = None, - removed_image_urls: typing.List["str"] + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + variant_id: int, + variant: "ProductVariantTailoring" ): + self.store = store + self.product_key = product_key + self.product = product + self.variant_id = variant_id self.variant = variant - self.removed_image_urls = removed_image_urls super().__init__( id=id, @@ -11230,25 +13019,25 @@ def __init__( resource=resource, resource_version=resource_version, resource_user_provided_identifiers=resource_user_provided_identifiers, - type="ProductVariantDeleted", + type="ProductVariantTailoringRemoved", ) @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductVariantDeletedMessage": - from ._schemas.message import ProductVariantDeletedMessageSchema + ) -> "ProductVariantTailoringRemovedMessage": + from ._schemas.message import ProductVariantTailoringRemovedMessageSchema - return ProductVariantDeletedMessageSchema().load(data) + return ProductVariantTailoringRemovedMessageSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductVariantDeletedMessageSchema + from ._schemas.message import ProductVariantTailoringRemovedMessageSchema - return ProductVariantDeletedMessageSchema().dump(self) + return ProductVariantTailoringRemovedMessageSchema().dump(self) class QuoteCreatedMessage(Message): - """Generated after a successful [Create Quote](/../api/projects/quotes#create-quote) request.""" + """Generated after a successful [Create Quote](ctp:api:endpoint:/{projectKey}/quotes:POST) request.""" #: [Quote](/../api/projects/quotes) that was created. quote: "Quote" @@ -11374,6 +13163,7 @@ def __init__( "UserProvidedIdentifiers" ] = None ): + super().__init__( id=id, version=version, @@ -11454,7 +13244,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class QuoteRequestCreatedMessage(Message): - """Generated after a successful [Create QuoteRequest](/../api/projects/quote-requests#create-quoterequest) request.""" + """Generated after a successful [Create QuoteRequest](ctp:api:endpoint:/{projectKey}/quote-requests:POST) request.""" #: [Quote Request](/../api/projects/quote-requests) that was created. quote_request: "QuoteRequest" @@ -11582,6 +13372,7 @@ def __init__( "UserProvidedIdentifiers" ] = None ): + super().__init__( id=id, version=version, @@ -11951,7 +13742,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ReviewCreatedMessage(Message): - """Generated after a successful [Create Review](/../api/projects/reviews#create-review) request.""" + """Generated after a successful [Create Review](ctp:api:endpoint:/{projectKey}/reviews:POST) request.""" #: [Review](ctp:api:type:Review) that was created. review: "Review" @@ -12140,7 +13931,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StagedQuoteCreatedMessage(Message): - """Generated after a successful [Create StagedQuote](/../api/projects/staged-quotes#create-stagedquote) request.""" + """Generated after a successful [Create StagedQuote](ctp:api:endpoint:/{projectKey}/staged-quotes:POST) request.""" #: [Staged Quote](/../api/projects/staged-quotes) that was created. staged_quote: "StagedQuote" @@ -12211,6 +14002,7 @@ def __init__( "UserProvidedIdentifiers" ] = None ): + super().__init__( id=id, version=version, @@ -12521,7 +14313,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePriceCreatedMessage(Message): - """Generated after a successful [Create StandalonePrice](/../api/projects/standalone-prices#create-standaloneprice) request.""" + """Generated after a successful [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request.""" #: [Standalone Price](ctp:api:type:StandalonePrice) that was created. standalone_price: "StandalonePrice" @@ -13241,12 +15033,12 @@ class StandalonePriceValueChangedMessage(Message): """Generated after a successful [Change Value](ctp:api:type:StandalonePriceChangeValueAction) update action.""" #: The new value of the updated [StandalonePrice](ctp:api:type:StandalonePrice). - value: "Money" + value: "TypedMoney" #: Whether the new value was applied to the current or the staged representation of the StandalonePrice. Staged changes are stored on the [StagedStandalonePrice](ctp:api:type:StagedStandalonePrice). staged: bool #: The old value of the updated [StandalonePrice](ctp:api:type:StandalonePrice). #: Present on Messages created after 3 February 2023. Optional for backwards compatibility. - old_value: typing.Optional["Money"] + old_value: typing.Optional["TypedMoney"] def __init__( self, @@ -13263,9 +15055,9 @@ def __init__( resource_user_provided_identifiers: typing.Optional[ "UserProvidedIdentifiers" ] = None, - value: "Money", + value: "TypedMoney", staged: bool, - old_value: typing.Optional["Money"] = None + old_value: typing.Optional["TypedMoney"] = None ): self.value = value self.staged = staged @@ -13361,7 +15153,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreCreatedMessage(Message): - """Generated after a successful [Create Store](/../api/projects/stores#create-store) request.""" + """Generated after a successful [Create Store](ctp:api:endpoint:/{projectKey}/stores:POST) request.""" #: The `name` of the [Store](ctp:api:type:Store) that was created. name: typing.Optional["LocalizedString"] @@ -13436,7 +15228,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreDeletedMessage(Message): - """Generated after a successful [Delete Store](/../api/projects/quote-requests#delete-quoterequest) request.""" + """Generated after a successful [Delete Store](/../api/projects/stores#delete-store) request.""" def __init__( self, @@ -13454,6 +15246,7 @@ def __init__( "UserProvidedIdentifiers" ] = None ): + super().__init__( id=id, version=version, @@ -13983,6 +15776,12 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagePayload": from ._schemas.message import BusinessUnitAddressRemovedMessagePayloadSchema return BusinessUnitAddressRemovedMessagePayloadSchema().load(data) + if data["type"] == "BusinessUnitApprovalRuleModeChanged": + from ._schemas.message import ( + BusinessUnitApprovalRuleModeChangedMessagePayloadSchema, + ) + + return BusinessUnitApprovalRuleModeChangedMessagePayloadSchema().load(data) if data["type"] == "BusinessUnitAssociateAdded": from ._schemas.message import BusinessUnitAssociateAddedMessagePayloadSchema @@ -14119,6 +15918,26 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagePayload": from ._schemas.message import BusinessUnitStoresSetMessagePayloadSchema return BusinessUnitStoresSetMessagePayloadSchema().load(data) + if data["type"] == "CartDiscountCreated": + from ._schemas.message import CartDiscountCreatedMessagePayloadSchema + + return CartDiscountCreatedMessagePayloadSchema().load(data) + if data["type"] == "CartDiscountDeleted": + from ._schemas.message import CartDiscountDeletedMessagePayloadSchema + + return CartDiscountDeletedMessagePayloadSchema().load(data) + if data["type"] == "CartDiscountStoreAdded": + from ._schemas.message import CartDiscountStoreAddedMessagePayloadSchema + + return CartDiscountStoreAddedMessagePayloadSchema().load(data) + if data["type"] == "CartDiscountStoreRemoved": + from ._schemas.message import CartDiscountStoreRemovedMessagePayloadSchema + + return CartDiscountStoreRemovedMessagePayloadSchema().load(data) + if data["type"] == "CartDiscountStoresSet": + from ._schemas.message import CartDiscountStoresSetMessagePayloadSchema + + return CartDiscountStoresSetMessagePayloadSchema().load(data) if data["type"] == "CategoryCreated": from ._schemas.message import CategoryCreatedMessagePayloadSchema @@ -14271,6 +16090,18 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagePayload": from ._schemas.message import CustomerTitleSetMessagePayloadSchema return CustomerTitleSetMessagePayloadSchema().load(data) + if data["type"] == "DiscountCodeCreated": + from ._schemas.message import DiscountCodeCreatedMessagePayloadSchema + + return DiscountCodeCreatedMessagePayloadSchema().load(data) + if data["type"] == "DiscountCodeDeleted": + from ._schemas.message import DiscountCodeDeletedMessagePayloadSchema + + return DiscountCodeDeletedMessagePayloadSchema().load(data) + if data["type"] == "DiscountCodeKeySet": + from ._schemas.message import DiscountCodeKeySetMessagePayloadSchema + + return DiscountCodeKeySetMessagePayloadSchema().load(data) if data["type"] == "InventoryEntryCreated": from ._schemas.message import InventoryEntryCreatedMessagePayloadSchema @@ -14341,6 +16172,36 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagePayload": from ._schemas.message import ProductPriceChangedMessagePayloadSchema return ProductPriceChangedMessagePayloadSchema().load(data) + if data["type"] == "ProductPriceCustomFieldAdded": + from ._schemas.message import ( + ProductPriceCustomFieldAddedMessagePayloadSchema, + ) + + return ProductPriceCustomFieldAddedMessagePayloadSchema().load(data) + if data["type"] == "ProductPriceCustomFieldChanged": + from ._schemas.message import ( + ProductPriceCustomFieldChangedMessagePayloadSchema, + ) + + return ProductPriceCustomFieldChangedMessagePayloadSchema().load(data) + if data["type"] == "ProductPriceCustomFieldRemoved": + from ._schemas.message import ( + ProductPriceCustomFieldRemovedMessagePayloadSchema, + ) + + return ProductPriceCustomFieldRemovedMessagePayloadSchema().load(data) + if data["type"] == "ProductPriceCustomFieldsRemoved": + from ._schemas.message import ( + ProductPriceCustomFieldsRemovedMessagePayloadSchema, + ) + + return ProductPriceCustomFieldsRemovedMessagePayloadSchema().load(data) + if data["type"] == "ProductPriceCustomFieldsSet": + from ._schemas.message import ( + ProductPriceCustomFieldsSetMessagePayloadSchema, + ) + + return ProductPriceCustomFieldsSetMessagePayloadSchema().load(data) if data["type"] == "ProductPriceDiscountsSet": from ._schemas.message import ProductPriceDiscountsSetMessagePayloadSchema @@ -14431,6 +16292,46 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagePayload": from ._schemas.message import ProductStateTransitionMessagePayloadSchema return ProductStateTransitionMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringCreated": + from ._schemas.message import ProductTailoringCreatedMessagePayloadSchema + + return ProductTailoringCreatedMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringDeleted": + from ._schemas.message import ProductTailoringDeletedMessagePayloadSchema + + return ProductTailoringDeletedMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringDescriptionSet": + from ._schemas.message import ( + ProductTailoringDescriptionSetMessagePayloadSchema, + ) + + return ProductTailoringDescriptionSetMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringImageAdded": + from ._schemas.message import ProductTailoringImageAddedMessagePayloadSchema + + return ProductTailoringImageAddedMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringImagesSet": + from ._schemas.message import ProductTailoringImagesSetMessagePayloadSchema + + return ProductTailoringImagesSetMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringNameSet": + from ._schemas.message import ProductTailoringNameSetMessagePayloadSchema + + return ProductTailoringNameSetMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringPublished": + from ._schemas.message import ProductTailoringPublishedMessagePayloadSchema + + return ProductTailoringPublishedMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringSlugSet": + from ._schemas.message import ProductTailoringSlugSetMessagePayloadSchema + + return ProductTailoringSlugSetMessagePayloadSchema().load(data) + if data["type"] == "ProductTailoringUnpublished": + from ._schemas.message import ( + ProductTailoringUnpublishedMessagePayloadSchema, + ) + + return ProductTailoringUnpublishedMessagePayloadSchema().load(data) if data["type"] == "ProductUnpublished": from ._schemas.message import ProductUnpublishedMessagePayloadSchema @@ -14443,6 +16344,18 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "MessagePayload": from ._schemas.message import ProductVariantDeletedMessagePayloadSchema return ProductVariantDeletedMessagePayloadSchema().load(data) + if data["type"] == "ProductVariantTailoringAdded": + from ._schemas.message import ( + ProductVariantTailoringAddedMessagePayloadSchema, + ) + + return ProductVariantTailoringAddedMessagePayloadSchema().load(data) + if data["type"] == "ProductVariantTailoringRemoved": + from ._schemas.message import ( + ProductVariantTailoringRemovedMessagePayloadSchema, + ) + + return ProductVariantTailoringRemovedMessagePayloadSchema().load(data) if data["type"] == "QuoteCreated": from ._schemas.message import QuoteCreatedMessagePayloadSchema @@ -15039,7 +16952,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AssociateRoleCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create AssociateRole](/projects/associate-roles#create-associaterole) request.""" + """Generated after a successful [Create AssociateRole](ctp:api:endpoint:/{projectKey}/associate-roles:POST) request.""" #: The [AssociateRole](ctp:api:type:AssociateRole) that was created. associate_role: "AssociateRole" @@ -15067,6 +16980,7 @@ class AssociateRoleDeletedMessagePayload(MessagePayload): """Generated after a successful [Delete AssociateRole](/projects/associate-roles#delete-associaterole) request.""" def __init__(self): + super().__init__(type="AssociateRoleDeleted") @classmethod @@ -15240,10 +17154,15 @@ class BusinessUnitAddressCustomFieldAddedMessagePayload(MessagePayload): name: str #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). value: typing.Any + #: `id` of the [Address](ctp:api:type:Address) to which the Custom Field was added. + address_id: typing.Optional[str] - def __init__(self, *, name: str, value: typing.Any): + def __init__( + self, *, name: str, value: typing.Any, address_id: typing.Optional[str] = None + ): self.name = name self.value = value + self.address_id = address_id super().__init__(type="BusinessUnitAddressCustomFieldAdded") @@ -15274,17 +17193,21 @@ class BusinessUnitAddressCustomFieldChangedMessagePayload(MessagePayload): value: typing.Any #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:BusinessUnitSetAddressCustomFieldAction) update action. old_value: typing.Optional[typing.Any] + #: `id` of the [Address](ctp:api:type:Address) of which the Custom Field was changed. + address_id: typing.Optional[str] def __init__( self, *, name: str, value: typing.Any, - old_value: typing.Optional[typing.Any] = None + old_value: typing.Optional[typing.Any] = None, + address_id: typing.Optional[str] = None ): self.name = name self.value = value self.old_value = old_value + self.address_id = address_id super().__init__(type="BusinessUnitAddressCustomFieldChanged") @@ -15311,9 +17234,12 @@ class BusinessUnitAddressCustomFieldRemovedMessagePayload(MessagePayload): #: Name of the Custom Field that was removed. name: str + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Field was removed. + address_id: typing.Optional[str] - def __init__(self, *, name: str): + def __init__(self, *, name: str, address_id: typing.Optional[str] = None): self.name = name + self.address_id = address_id super().__init__(type="BusinessUnitAddressCustomFieldRemoved") @@ -15340,9 +17266,17 @@ class BusinessUnitAddressCustomTypeRemovedMessagePayload(MessagePayload): #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. old_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Type was removed. + address_id: typing.Optional[str] - def __init__(self, *, old_type_id: typing.Optional[str] = None): + def __init__( + self, + *, + old_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None + ): self.old_type_id = old_type_id + self.address_id = address_id super().__init__(type="BusinessUnitAddressCustomTypeRemoved") @@ -15371,12 +17305,19 @@ class BusinessUnitAddressCustomTypeSetMessagePayload(MessagePayload): custom_fields: "CustomFields" #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. old_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) on which the Custom Field was set. + address_id: typing.Optional[str] def __init__( - self, *, custom_fields: "CustomFields", old_type_id: typing.Optional[str] = None + self, + *, + custom_fields: "CustomFields", + old_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None ): self.custom_fields = custom_fields self.old_type_id = old_type_id + self.address_id = address_id super().__init__(type="BusinessUnitAddressCustomTypeSet") @@ -15423,6 +17364,43 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return BusinessUnitAddressRemovedMessagePayloadSchema().dump(self) +class BusinessUnitApprovalRuleModeChangedMessagePayload(MessagePayload): + """Generated after a successful [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action.""" + + #: [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit after the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. + approval_rule_mode: "BusinessUnitApprovalRuleMode" + #: [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit before the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. + old_approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] + + def __init__( + self, + *, + approval_rule_mode: "BusinessUnitApprovalRuleMode", + old_approval_rule_mode: typing.Optional["BusinessUnitApprovalRuleMode"] = None + ): + self.approval_rule_mode = approval_rule_mode + self.old_approval_rule_mode = old_approval_rule_mode + + super().__init__(type="BusinessUnitApprovalRuleModeChanged") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "BusinessUnitApprovalRuleModeChangedMessagePayload": + from ._schemas.message import ( + BusinessUnitApprovalRuleModeChangedMessagePayloadSchema, + ) + + return BusinessUnitApprovalRuleModeChangedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ( + BusinessUnitApprovalRuleModeChangedMessagePayloadSchema, + ) + + return BusinessUnitApprovalRuleModeChangedMessagePayloadSchema().dump(self) + + class BusinessUnitAssociateAddedMessagePayload(MessagePayload): """Generated after a successful [Add Associate](ctp:api:type:BusinessUnitAddAssociateAction) update action.""" @@ -15644,7 +17622,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class BusinessUnitCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create BusinessUnit](/projects/business-units#create-businessunit) request.""" + """Generated after a successful [Create BusinessUnit](ctp:api:endpoint:/{projectKey}/business-units:POST) request.""" #: The [Business Unit](ctp:api:type:BusinessUnit) that was created. business_unit: "BusinessUnit" @@ -15875,6 +17853,7 @@ class BusinessUnitDeletedMessagePayload(MessagePayload): """Generated after a successful [Delete BusinessUnit](/projects/business-units#delete-businessunit) request.""" def __init__(self): + super().__init__(type="BusinessUnitDeleted") @classmethod @@ -16082,74 +18061,195 @@ def __init__( self.old_stores = old_stores self.old_store_mode = old_store_mode - super().__init__(type="BusinessUnitStoreModeChanged") + super().__init__(type="BusinessUnitStoreModeChanged") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "BusinessUnitStoreModeChangedMessagePayload": + from ._schemas.message import BusinessUnitStoreModeChangedMessagePayloadSchema + + return BusinessUnitStoreModeChangedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import BusinessUnitStoreModeChangedMessagePayloadSchema + + return BusinessUnitStoreModeChangedMessagePayloadSchema().dump(self) + + +class BusinessUnitStoreRemovedMessagePayload(MessagePayload): + """Generated after a successful [Remove Store](ctp:api:type:BusinessUnitRemoveStoreAction) update action.""" + + #: The [Store](ctp:api:type:Store) that was removed from the [Business Unit](ctp:api:type:BusinessUnit). + store: "StoreKeyReference" + + def __init__(self, *, store: "StoreKeyReference"): + self.store = store + + super().__init__(type="BusinessUnitStoreRemoved") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "BusinessUnitStoreRemovedMessagePayload": + from ._schemas.message import BusinessUnitStoreRemovedMessagePayloadSchema + + return BusinessUnitStoreRemovedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import BusinessUnitStoreRemovedMessagePayloadSchema + + return BusinessUnitStoreRemovedMessagePayloadSchema().dump(self) + + +class BusinessUnitStoresSetMessagePayload(MessagePayload): + """Generated after a successful [Set Stores](ctp:api:type:BusinessUnitSetStoresAction) update action.""" + + #: [Stores](ctp:api:type:Store) of the [Business Unit](ctp:api:type:BusinessUnit) after the [Set Stores](ctp:api:type:BusinessUnitSetStoresAction) update action. + stores: typing.List["StoreKeyReference"] + + def __init__(self, *, stores: typing.List["StoreKeyReference"]): + self.stores = stores + + super().__init__(type="BusinessUnitStoresSet") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "BusinessUnitStoresSetMessagePayload": + from ._schemas.message import BusinessUnitStoresSetMessagePayloadSchema + + return BusinessUnitStoresSetMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import BusinessUnitStoresSetMessagePayloadSchema + + return BusinessUnitStoresSetMessagePayloadSchema().dump(self) + + +class CartDiscountCreatedMessagePayload(MessagePayload): + """Generated after a successful [Create CartDiscount](ctp:api:endpoint:/{projectKey}/cart-discounts:POST) request.""" + + #: The [Cart Discount](ctp:api:type:CartDiscount) that was created. + cart_discount: "CartDiscount" + + def __init__(self, *, cart_discount: "CartDiscount"): + self.cart_discount = cart_discount + + super().__init__(type="CartDiscountCreated") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CartDiscountCreatedMessagePayload": + from ._schemas.message import CartDiscountCreatedMessagePayloadSchema + + return CartDiscountCreatedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import CartDiscountCreatedMessagePayloadSchema + + return CartDiscountCreatedMessagePayloadSchema().dump(self) + + +class CartDiscountDeletedMessagePayload(MessagePayload): + """Generated after a successful [Delete CartDiscount](ctp:api:endpoint:/{projectKey}/cart-discounts/{id}:DELETE) request.""" + + def __init__(self): + + super().__init__(type="CartDiscountDeleted") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "CartDiscountDeletedMessagePayload": + from ._schemas.message import CartDiscountDeletedMessagePayloadSchema + + return CartDiscountDeletedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import CartDiscountDeletedMessagePayloadSchema + + return CartDiscountDeletedMessagePayloadSchema().dump(self) + + +class CartDiscountStoreAddedMessagePayload(MessagePayload): + """Generated after a successful [Add Store](ctp:api:type:CartDiscountAddStoreAction) update action.""" + + #: The [Store](ctp:api:type:Store) that was added to the [Cart Discount](ctp:api:type:CartDiscount). + store: "StoreKeyReference" + + def __init__(self, *, store: "StoreKeyReference"): + self.store = store + + super().__init__(type="CartDiscountStoreAdded") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "BusinessUnitStoreModeChangedMessagePayload": - from ._schemas.message import BusinessUnitStoreModeChangedMessagePayloadSchema + ) -> "CartDiscountStoreAddedMessagePayload": + from ._schemas.message import CartDiscountStoreAddedMessagePayloadSchema - return BusinessUnitStoreModeChangedMessagePayloadSchema().load(data) + return CartDiscountStoreAddedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import BusinessUnitStoreModeChangedMessagePayloadSchema + from ._schemas.message import CartDiscountStoreAddedMessagePayloadSchema - return BusinessUnitStoreModeChangedMessagePayloadSchema().dump(self) + return CartDiscountStoreAddedMessagePayloadSchema().dump(self) -class BusinessUnitStoreRemovedMessagePayload(MessagePayload): - """Generated after a successful [Remove Store](ctp:api:type:BusinessUnitRemoveStoreAction) update action.""" +class CartDiscountStoreRemovedMessagePayload(MessagePayload): + """Generated after a successful [Remove Store](ctp:api:type:CartDiscountRemoveStoreAction) update action.""" - #: The [Store](ctp:api:type:Store) that was removed from the [Business Unit](ctp:api:type:BusinessUnit). + #: The [Store](ctp:api:type:Store) that was removed from the [Cart Discount](ctp:api:type:CartDiscount). store: "StoreKeyReference" def __init__(self, *, store: "StoreKeyReference"): self.store = store - super().__init__(type="BusinessUnitStoreRemoved") + super().__init__(type="CartDiscountStoreRemoved") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "BusinessUnitStoreRemovedMessagePayload": - from ._schemas.message import BusinessUnitStoreRemovedMessagePayloadSchema + ) -> "CartDiscountStoreRemovedMessagePayload": + from ._schemas.message import CartDiscountStoreRemovedMessagePayloadSchema - return BusinessUnitStoreRemovedMessagePayloadSchema().load(data) + return CartDiscountStoreRemovedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import BusinessUnitStoreRemovedMessagePayloadSchema + from ._schemas.message import CartDiscountStoreRemovedMessagePayloadSchema - return BusinessUnitStoreRemovedMessagePayloadSchema().dump(self) + return CartDiscountStoreRemovedMessagePayloadSchema().dump(self) -class BusinessUnitStoresSetMessagePayload(MessagePayload): - """Generated after a successful [Set Stores](ctp:api:type:BusinessUnitSetStoresAction) update action.""" +class CartDiscountStoresSetMessagePayload(MessagePayload): + """Generated after a successful [Set Stores](ctp:api:type:CartDiscountSetStoresAction) update action.""" - #: [Stores](ctp:api:type:Store) of the [Business Unit](ctp:api:type:BusinessUnit) after the [Set Stores](ctp:api:type:BusinessUnitSetStoresAction) update action. + #: [Stores](ctp:api:type:Store) of the [Cart Discount](ctp:api:type:CartDiscount) after the [Set Stores](ctp:api:type:CartDiscountSetStoresAction) update action. stores: typing.List["StoreKeyReference"] def __init__(self, *, stores: typing.List["StoreKeyReference"]): self.stores = stores - super().__init__(type="BusinessUnitStoresSet") + super().__init__(type="CartDiscountStoresSet") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "BusinessUnitStoresSetMessagePayload": - from ._schemas.message import BusinessUnitStoresSetMessagePayloadSchema + ) -> "CartDiscountStoresSetMessagePayload": + from ._schemas.message import CartDiscountStoresSetMessagePayloadSchema - return BusinessUnitStoresSetMessagePayloadSchema().load(data) + return CartDiscountStoresSetMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import BusinessUnitStoresSetMessagePayloadSchema + from ._schemas.message import CartDiscountStoresSetMessagePayloadSchema - return BusinessUnitStoresSetMessagePayloadSchema().dump(self) + return CartDiscountStoresSetMessagePayloadSchema().dump(self) class CategoryCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Category](/../api/projects/categories#create-category) request.""" + """Generated after a successful [Create Category](ctp:api:endpoint:/{projectKey}/categories:POST) request.""" #: [Category](ctp:api:type:Category) that was created. category: "Category" @@ -16266,10 +18366,15 @@ class CustomerAddressCustomFieldAddedMessagePayload(MessagePayload): name: str #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). value: typing.Any + #: `id` of the [Address](ctp:api:type:Address) to which the Custom Field was added. + address_id: typing.Optional[str] - def __init__(self, *, name: str, value: typing.Any): + def __init__( + self, *, name: str, value: typing.Any, address_id: typing.Optional[str] = None + ): self.name = name self.value = value + self.address_id = address_id super().__init__(type="CustomerAddressCustomFieldAdded") @@ -16301,17 +18406,21 @@ class CustomerAddressCustomFieldChangedMessagePayload(MessagePayload): #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) before the [Set CustomField](ctp:api:type:CustomerSetAddressCustomFieldAction) update action. #: When there has not been a Custom Field with the `name` on the Customer Address before, a [Customer Address Custom Field Added](ctp:api:type:CustomerAddressCustomFieldAddedMessage) Message is generated instead. previous_value: typing.Optional[typing.Any] + #: `id` of the [Address](ctp:api:type:Address) of which the Custom Field was changed. + address_id: typing.Optional[str] def __init__( self, *, name: str, value: typing.Any, - previous_value: typing.Optional[typing.Any] = None + previous_value: typing.Optional[typing.Any] = None, + address_id: typing.Optional[str] = None ): self.name = name self.value = value self.previous_value = previous_value + self.address_id = address_id super().__init__(type="CustomerAddressCustomFieldChanged") @@ -16338,9 +18447,12 @@ class CustomerAddressCustomFieldRemovedMessagePayload(MessagePayload): #: Name of the Custom Field that was removed. name: str + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Field was removed. + address_id: typing.Optional[str] - def __init__(self, *, name: str): + def __init__(self, *, name: str, address_id: typing.Optional[str] = None): self.name = name + self.address_id = address_id super().__init__(type="CustomerAddressCustomFieldRemoved") @@ -16367,9 +18479,17 @@ class CustomerAddressCustomTypeRemovedMessagePayload(MessagePayload): #: `id` of the [Custom Type](ctp:api:type:Type) that was removed. Absent if there was no previous Custom Type present. previous_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) from which the Custom Type was removed. + address_id: typing.Optional[str] - def __init__(self, *, previous_type_id: typing.Optional[str] = None): + def __init__( + self, + *, + previous_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None + ): self.previous_type_id = previous_type_id + self.address_id = address_id super().__init__(type="CustomerAddressCustomTypeRemoved") @@ -16398,15 +18518,19 @@ class CustomerAddressCustomTypeSetMessagePayload(MessagePayload): custom_fields: "CustomFields" #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. previous_type_id: typing.Optional[str] + #: `id` of the [Address](ctp:api:type:Address) on which the Custom Field was set. + address_id: typing.Optional[str] def __init__( self, *, custom_fields: "CustomFields", - previous_type_id: typing.Optional[str] = None + previous_type_id: typing.Optional[str] = None, + address_id: typing.Optional[str] = None ): self.custom_fields = custom_fields self.previous_type_id = previous_type_id + self.address_id = address_id super().__init__(type="CustomerAddressCustomTypeSet") @@ -16475,7 +18599,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Customer](/../api/projects/customers#create-sign-up-customer) request.""" + """Generated after a successful [Create Customer](ctp:api:endpoint:/{projectKey}/customers:POST) request.""" #: [Customer](ctp:api:type:Customer) that was created. customer: "Customer" @@ -16680,6 +18804,7 @@ class CustomerDeletedMessagePayload(MessagePayload): """Generated after a successful [Delete Customer](/../api/projects/customers#delete-customer) request.""" def __init__(self): + super().__init__(type="CustomerDeleted") @classmethod @@ -16722,7 +18847,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerEmailTokenCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create email token for Customer](/../api/projects/customers#create-email-token-for-customer) request. The `resource` property of the Message is a [CustomerEmailTokenReference](ctp:api:type:CustomerEmailTokenReference).""" + """Generated after a successful [Create email token for Customer](ctp:api:endpoint:/{projectKey}/customers/email-token:POST) request. The `resource` property of the Message is a [CustomerEmailTokenReference](ctp:api:type:CustomerEmailTokenReference).""" #: Unique identifier of the Customer. customer_id: str @@ -16750,9 +18875,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerEmailVerifiedMessagePayload(MessagePayload): - """Generated after a successful [Verify Customer's Email](/../api/projects/customers#verify-email-of-customer) request.""" + """Generated after a successful [Verify Customer's Email](ctp:api:endpoint:/{projectKey}/customers/email/confirm:POST) request.""" def __init__(self): + super().__init__(type="CustomerEmailVerified") @classmethod @@ -17003,7 +19129,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerPasswordTokenCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create password reset token for Customer](/../api/projects/customers#create-password-reset-token-for-customer) request. The `resource` property of the Message is a [CustomerPasswordTokenReference](ctp:api:type:CustomerPasswordTokenReference).""" + """Generated after a successful [Create password reset token for Customer](ctp:api:endpoint:/{projectKey}/customers/password-token:POST) request. The `resource` property of the Message is a [CustomerPasswordTokenReference](ctp:api:type:CustomerPasswordTokenReference).""" #: Unique identifier of the Customer. customer_id: str @@ -17031,9 +19157,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomerPasswordUpdatedMessagePayload(MessagePayload): - """Generated after a successful [Reset Customer's Password](/../api/projects/customers#reset-password-of-customer), [Reset Customer's Password in a Store](/../api/projects/customers#reset-password-of-customer-in-store), [Change Customer's Password](/../api/projects/customers#change-password-of-customer), or [Change Customer's Password in a Store](/../api/projects/customers#change-password-of-customer-in-store) request. This Message is also produced during equivalent requests to the [My Customer Profile](/../api/projects/me-profile) endpoint.""" + """Generated after a successful [Reset Customer's Password](ctp:api:endpoint:/{projectKey}/customers/password/reset:POST), [Reset Customer's Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password/reset:POST), [Change Customer's Password](ctp:api:endpoint:/{projectKey}/customers/password:POST), or [Change Customer's Password in a Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/customers/password:POST) request. This Message is also produced during equivalent requests to the [My Customer Profile](/../api/projects/me-profile) endpoint.""" - #: Whether the Customer's password was updated during the [Reset password](/../api/projects/customers#password-reset-of-customer) or [Change password](/../api/projects/customers#change-password-of-customer) flow. + #: Whether the Customer's password was updated during the [Reset password](ctp:api:endpoint:/{projectKey}/customers/password/reset:POST) or [Change password](ctp:api:endpoint:/{projectKey}/customers/password:POST) flow. reset: bool def __init__(self, *, reset: bool): @@ -17080,8 +19206,84 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return CustomerTitleSetMessagePayloadSchema().dump(self) +class DiscountCodeCreatedMessagePayload(MessagePayload): + """Generated after a successful [Create DiscountCode](ctp:api:endpoint:/{projectKey}/discount-codes:POST) request.""" + + #: The [Discount Code](ctp:api:type:DiscountCode) that was created. + discount_code: "DiscountCode" + + def __init__(self, *, discount_code: "DiscountCode"): + self.discount_code = discount_code + + super().__init__(type="DiscountCodeCreated") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountCodeCreatedMessagePayload": + from ._schemas.message import DiscountCodeCreatedMessagePayloadSchema + + return DiscountCodeCreatedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DiscountCodeCreatedMessagePayloadSchema + + return DiscountCodeCreatedMessagePayloadSchema().dump(self) + + +class DiscountCodeDeletedMessagePayload(MessagePayload): + """Generated after a successful [Delete DiscountCode](ctp:api:endpoint:/{projectKey}/discount-codes/{id}:DELETE) request.""" + + def __init__(self): + + super().__init__(type="DiscountCodeDeleted") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountCodeDeletedMessagePayload": + from ._schemas.message import DiscountCodeDeletedMessagePayloadSchema + + return DiscountCodeDeletedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DiscountCodeDeletedMessagePayloadSchema + + return DiscountCodeDeletedMessagePayloadSchema().dump(self) + + +class DiscountCodeKeySetMessagePayload(MessagePayload): + """Generated after a successful [Set Key](ctp:api:type:DiscountCodeSetKeyAction) update action.""" + + #: `key` value of the [Discount Code](ctp:api:type:DiscountCode) after the [Set Key](ctp:api:type:DiscountCodeSetKeyAction) update action. + key: typing.Optional[str] + #: `key` value of the [Discount Code](ctp:api:type:DiscountCode) before the [Set Key](ctp:api:type:DiscountCodeSetKeyAction) update action. + old_key: typing.Optional[str] + + def __init__( + self, *, key: typing.Optional[str] = None, old_key: typing.Optional[str] = None + ): + self.key = key + self.old_key = old_key + + super().__init__(type="DiscountCodeKeySet") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "DiscountCodeKeySetMessagePayload": + from ._schemas.message import DiscountCodeKeySetMessagePayloadSchema + + return DiscountCodeKeySetMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import DiscountCodeKeySetMessagePayloadSchema + + return DiscountCodeKeySetMessagePayloadSchema().dump(self) + + class InventoryEntryCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create InventoryEntry](/../api/projects/inventory#create-inventoryentry) request.""" + """Generated after a successful [Create InventoryEntry](ctp:api:endpoint:/{projectKey}/inventory:POST) request.""" #: [InventoryEntry](ctp:api:type:InventoryEntry) that was created. inventory_entry: "InventoryEntry" @@ -17137,7 +19339,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class InventoryEntryQuantitySetMessagePayload(MessagePayload): """Generated after a successful [Add Quantity](ctp:api:type:InventoryEntryAddQuantityAction), [Remove Quantity](ctp:api:type:InventoryEntryRemoveQuantityAction) or [Change Quantity](ctp:api:type:InventoryEntryChangeQuantityAction) update action. - Inventory changes as a result of [Order creation](/../api/projects/orders#create-order) do not trigger this message. + Inventory changes as a result of [Order creation](ctp:api:endpoint:/{projectKey}/orders:POST) do not trigger this message. """ @@ -17184,7 +19386,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderMessagePayload(MessagePayload): + def __init__(self, *, type: str): + super().__init__(type=type) @classmethod @@ -17403,7 +19607,7 @@ class CustomLineItemStateTransitionMessagePayload(OrderMessagePayload): custom_line_item_id: str #: User-defined unique identifier of the [Custom Line Item](ctp:api:type:CustomLineItem). custom_line_item_key: typing.Optional[str] - #: Date and time (UTC) when the transition of the [Custom Line Item](ctp:api:type:CustomLineItem) [State](ctp:api:type:State) was performed. + #: Date and time (UTC) the transition of the [Custom Line Item](ctp:api:type:CustomLineItem) [State](ctp:api:type:State) was performed. transition_date: datetime.datetime #: Number of [Custom Line Items](ctp:api:type:CustomLineItem) for which the [State](ctp:api:type:State) was transitioned. quantity: int @@ -17594,7 +19798,7 @@ class LineItemStateTransitionMessagePayload(OrderMessagePayload): line_item_id: str #: User-defined unique identifier of the LineItem. line_item_key: typing.Optional[str] - #: Date and time (UTC) when the transition of the [Line Item](ctp:api:type:LineItem) [State](ctp:api:type:State) was performed. + #: Date and time (UTC) the transition of the [Line Item](ctp:api:type:LineItem) [State](ctp:api:type:State) was performed. transition_date: datetime.datetime #: Number of [Line Items](ctp:api:type:LineItem) for which the [State](ctp:api:type:State) was transitioned. quantity: int @@ -17670,7 +19874,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderCreatedMessagePayload(OrderMessagePayload): - """Generated after a successful [Create Order](/../api/projects/orders#create-order) request.""" + """Generated after a successful [Create Order](ctp:api:endpoint:/{projectKey}/orders:POST) request.""" #: [Order](ctp:api:type:Order) that was created. order: "Order" @@ -18303,10 +20507,11 @@ class OrderLineItemDiscountSetMessagePayload(OrderMessagePayload): #: Array of [DiscountedLineItemPriceForQuantity](ctp:api:type:DiscountedLineItemPriceForQuantity) after the Discount recalculation. discounted_price_per_quantity: typing.List["DiscountedLineItemPriceForQuantity"] #: Total Price of the [Line Item](ctp:api:type:LineItem) after the Discount recalculation. - total_price: "Money" + total_price: "CentPrecisionMoney" #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Line Item](ctp:api:type:LineItem) after the Discount recalculation. taxed_price: typing.Optional["TaxedItemPrice"] - #: Taxed price of the Shipping Methods in a Cart with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Total taxed prices based on the quantity of Line Item assigned to each [Shipping Method](ctp:api:type:ShippingMethod). Only applicable for Carts with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Automatically set after `perMethodTaxRate` is set. taxed_price_portions: typing.List["MethodTaxedPrice"] def __init__( @@ -18317,7 +20522,7 @@ def __init__( discounted_price_per_quantity: typing.List[ "DiscountedLineItemPriceForQuantity" ], - total_price: "Money", + total_price: "CentPrecisionMoney", taxed_price: typing.Optional["TaxedItemPrice"] = None, taxed_price_portions: typing.List["MethodTaxedPrice"] ): @@ -18392,19 +20597,19 @@ class OrderLineItemRemovedMessagePayload(OrderMessagePayload): line_item_id: str #: User-defined unique identifier of the LineItem. line_item_key: typing.Optional[str] - #: Quantity of [Line Items](ctp:api:type:LineItem) that were removed during the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + #: Quantity of [Line Items](ctp:api:type:LineItem) that were removed during the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. removed_quantity: int - #: [Line Item](ctp:api:type:LineItem) quantity after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + #: [Line Item](ctp:api:type:LineItem) quantity after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. new_quantity: int - #: [ItemStates](ctp:api:type:ItemState) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + #: [ItemStates](ctp:api:type:ItemState) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. new_state: typing.List["ItemState"] - #: `totalPrice` of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + #: `totalPrice` of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. new_total_price: "CentPrecisionMoney" - #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + #: [TaxedItemPrice](ctp:api:type:TaxedItemPrice) of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. new_taxed_price: typing.Optional["TaxedItemPrice"] - #: [Price](ctp:api:type:Price) of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + #: [Price](ctp:api:type:Price) of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. new_price: typing.Optional["Price"] - #: [Shipping Details](ctp:api:type:ItemShippingDetails) of the [Order](ctp:api:type:Order) after the [Remove Line Item](ctp:api:type:StagedOrderRemoveLineItemAction) update action. + #: [Shipping Details](ctp:api:type:ItemShippingDetails) of the [Order](ctp:api:type:Order) after the [Remove LineItem](ctp:api:type:StagedOrderRemoveLineItemAction) update action. new_shipping_detail: typing.Optional["ItemShippingDetails"] def __init__( @@ -18538,7 +20743,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderReturnShipmentStateChangedMessagePayload(OrderMessagePayload): - """Generated after a successful [Set ReturnShipmentState](ctp:api:type:OrderSetReturnShipmentStateAction) update action.""" + """Generated after a successful [Set ReturnShipmentState](ctp:api:type:OrderSetReturnShipmentStateAction) update action on [Orders](ctp:api:type:Order) and [Order Edits](ctp:api:type:OrderEdit).""" #: Unique identifier of the [ReturnItem](ctp:api:type:ReturnItem). return_item_id: str @@ -18577,10 +20782,13 @@ class OrderShipmentStateChangedMessagePayload(OrderMessagePayload): #: [ShipmentState](ctp:api:type:ShipmentState) after the [Change Shipment State](ctp:api:type:OrderChangeShipmentStateAction) update action. shipment_state: "ShipmentState" #: [ShipmentState](ctp:api:type:ShipmentState) before the [Change Shipment State](ctp:api:type:OrderChangeShipmentStateAction) update action. - old_shipment_state: "ShipmentState" + old_shipment_state: typing.Optional["ShipmentState"] def __init__( - self, *, shipment_state: "ShipmentState", old_shipment_state: "ShipmentState" + self, + *, + shipment_state: "ShipmentState", + old_shipment_state: typing.Optional["ShipmentState"] = None ): self.shipment_state = shipment_state self.old_shipment_state = old_shipment_state @@ -18706,9 +20914,14 @@ class OrderStateChangedMessagePayload(OrderMessagePayload): #: [OrderState](ctp:api:type:OrderState) after the [Change Order State](ctp:api:type:OrderChangeOrderStateAction) update action. order_state: "OrderState" #: [OrderState](ctp:api:type:OrderState) before the [Change Order State](ctp:api:type:OrderChangeOrderStateAction) update action. - old_order_state: "OrderState" + old_order_state: typing.Optional["OrderState"] - def __init__(self, *, order_state: "OrderState", old_order_state: "OrderState"): + def __init__( + self, + *, + order_state: "OrderState", + old_order_state: typing.Optional["OrderState"] = None + ): self.order_state = order_state self.old_order_state = old_order_state @@ -18992,7 +21205,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PaymentCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Payment](/../api/projects/payments#create-payment) request.""" + """Generated after a successful [Create Payment](ctp:api:endpoint:/{projectKey}/payments:POST) request.""" #: [Payment](ctp:api:type:Payment) that was created. payment: "Payment" @@ -19179,7 +21392,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Product](/../api/projects/products#create-product) request.""" + """Generated after a successful [Create Product](ctp:api:endpoint:/{projectKey}/products:POST) request.""" #: The staged [Product Projection](ctp:api:type:ProductProjection) of the [Product](ctp:api:type:Product) at the time of creation. product_projection: "ProductProjection" @@ -19272,7 +21485,7 @@ class ProductPriceAddedMessagePayload(MessagePayload): #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was added. variant_id: int - #: The [Embedded Price](/projects/products#embedded-price) that was added to the [ProductVariant](ctp:api:type:ProductVariant). + #: The Embedded Price that was added to the [ProductVariant](ctp:api:type:ProductVariant). price: "Price" #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). staged: bool @@ -19303,13 +21516,13 @@ class ProductPriceChangedMessagePayload(MessagePayload): #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was changed. variant_id: int - #: The current [Embedded Price](/projects/products#embedded-price) before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. + #: The current Embedded Price before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. old_price: "Price" - #: The [Embedded Price](/projects/products#embedded-price) after the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. + #: The Embedded Price after the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. new_price: "Price" #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). staged: bool - #: The staged [Embedded Price](/projects/products#embedded-price) before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. + #: The staged Embedded Price before the [Change Embedded Price](ctp:api:type:ProductChangePriceAction) update action. old_staged_price: typing.Optional["Price"] def __init__( @@ -19332,15 +21545,219 @@ def __init__( @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceChangedMessagePayload": - from ._schemas.message import ProductPriceChangedMessagePayloadSchema + ) -> "ProductPriceChangedMessagePayload": + from ._schemas.message import ProductPriceChangedMessagePayloadSchema + + return ProductPriceChangedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceChangedMessagePayloadSchema + + return ProductPriceChangedMessagePayloadSchema().dump(self) + + +class ProductPriceCustomFieldAddedMessagePayload(MessagePayload): + """Generated after adding a Custom Field to a Price using the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action.""" + + #: Unique identifier of the [Price](ctp:api:type:Price) to which the Custom Field was added. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Name of the Custom Field that was added. + name: str + #: The added [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType). + value: typing.Any + + def __init__( + self, + *, + price_id: str, + variant_id: int, + staged: bool, + name: str, + value: typing.Any + ): + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.name = name + self.value = value + + super().__init__(type="ProductPriceCustomFieldAdded") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceCustomFieldAddedMessagePayload": + from ._schemas.message import ProductPriceCustomFieldAddedMessagePayloadSchema + + return ProductPriceCustomFieldAddedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceCustomFieldAddedMessagePayloadSchema + + return ProductPriceCustomFieldAddedMessagePayloadSchema().dump(self) + + +class ProductPriceCustomFieldChangedMessagePayload(MessagePayload): + """Generated after changing an existing Custom Field on a Price using the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action.""" + + #: Unique identifier of the [Price](ctp:api:type:Price) of which the Custom Field was changed. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Name of the Custom Field that was changed. + name: str + #: [CustomFieldValue](ctp:api:type:CustomFieldValue) based on the [FieldType](ctp:api:type:FieldType) after the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action. + value: typing.Any + + def __init__( + self, + *, + price_id: str, + variant_id: int, + staged: bool, + name: str, + value: typing.Any + ): + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.name = name + self.value = value + + super().__init__(type="ProductPriceCustomFieldChanged") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceCustomFieldChangedMessagePayload": + from ._schemas.message import ProductPriceCustomFieldChangedMessagePayloadSchema + + return ProductPriceCustomFieldChangedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceCustomFieldChangedMessagePayloadSchema + + return ProductPriceCustomFieldChangedMessagePayloadSchema().dump(self) + + +class ProductPriceCustomFieldRemovedMessagePayload(MessagePayload): + """Generated after removing a Custom Field from a Price using the [Set Price CustomField](ctp:api:type:ProductSetProductPriceCustomFieldAction) update action.""" + + #: Unique identifier of the [Price](ctp:api:type:Price) from which the Custom Field was removed. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Name of the Custom Field that was removed. + name: str + + def __init__(self, *, price_id: str, variant_id: int, staged: bool, name: str): + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.name = name + + super().__init__(type="ProductPriceCustomFieldRemoved") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceCustomFieldRemovedMessagePayload": + from ._schemas.message import ProductPriceCustomFieldRemovedMessagePayloadSchema + + return ProductPriceCustomFieldRemovedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceCustomFieldRemovedMessagePayloadSchema + + return ProductPriceCustomFieldRemovedMessagePayloadSchema().dump(self) + + +class ProductPriceCustomFieldsRemovedMessagePayload(MessagePayload): + """Generated after removing a Custom Type from a Price using the [Set Price Custom Type](ctp:api:type:ProductSetProductPriceCustomTypeAction) update action.""" + + #: Unique identifier of the [Price](ctp:api:type:Price) from which the Custom Type was removed. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + + def __init__(self, *, price_id: str, variant_id: int, staged: bool): + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + + super().__init__(type="ProductPriceCustomFieldsRemoved") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceCustomFieldsRemovedMessagePayload": + from ._schemas.message import ( + ProductPriceCustomFieldsRemovedMessagePayloadSchema, + ) + + return ProductPriceCustomFieldsRemovedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ( + ProductPriceCustomFieldsRemovedMessagePayloadSchema, + ) + + return ProductPriceCustomFieldsRemovedMessagePayloadSchema().dump(self) + + +class ProductPriceCustomFieldsSetMessagePayload(MessagePayload): + """Generated after a successful [Set Price Custom Type](ctp:api:type:ProductSetProductPriceCustomTypeAction) update action.""" + + #: Unique identifier of the [Price](ctp:api:type:Price) on which the Custom Type was set. + price_id: str + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) to which the Price belongs. + variant_id: int + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + #: Custom Fields that were set. + custom_field: "CustomFields" + #: `id` of the previous [Custom Type](ctp:api:type:Type). Absent if there was no previous Custom Type present. + old_type_id: typing.Optional[str] + + def __init__( + self, + *, + price_id: str, + variant_id: int, + staged: bool, + custom_field: "CustomFields", + old_type_id: typing.Optional[str] = None + ): + self.price_id = price_id + self.variant_id = variant_id + self.staged = staged + self.custom_field = custom_field + self.old_type_id = old_type_id + + super().__init__(type="ProductPriceCustomFieldsSet") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceCustomFieldsSetMessagePayload": + from ._schemas.message import ProductPriceCustomFieldsSetMessagePayloadSchema - return ProductPriceChangedMessagePayloadSchema().load(data) + return ProductPriceCustomFieldsSetMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceChangedMessagePayloadSchema + from ._schemas.message import ProductPriceCustomFieldsSetMessagePayloadSchema - return ProductPriceChangedMessagePayloadSchema().dump(self) + return ProductPriceCustomFieldsSetMessagePayloadSchema().dump(self) class ProductPriceDiscountsSetMessagePayload(MessagePayload): @@ -19445,492 +21862,916 @@ def __init__( key: typing.Optional[str] = None, staged: bool ): - self.variant_id = variant_id - self.price_id = price_id - self.old_key = old_key - self.key = key - self.staged = staged + self.variant_id = variant_id + self.price_id = price_id + self.old_key = old_key + self.key = key + self.staged = staged + + super().__init__(type="ProductPriceKeySet") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceKeySetMessagePayload": + from ._schemas.message import ProductPriceKeySetMessagePayloadSchema + + return ProductPriceKeySetMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceKeySetMessagePayloadSchema + + return ProductPriceKeySetMessagePayloadSchema().dump(self) + + +class ProductPriceModeSetMessagePayload(MessagePayload): + """Generated after a successful [Set PriceMode](ctp:api:type:ProductSetPriceModeAction) update action.""" + + #: The [PriceMode](ctp:api:type:ProductPriceModeEnum) that was set. + to: "ProductPriceModeEnum" + + def __init__(self, *, to: "ProductPriceModeEnum"): + self.to = to + + super().__init__(type="ProductPriceModeSet") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceModeSetMessagePayload": + from ._schemas.message import ProductPriceModeSetMessagePayloadSchema + + return ProductPriceModeSetMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceModeSetMessagePayloadSchema + + return ProductPriceModeSetMessagePayloadSchema().dump(self) + + +class ProductPriceRemovedMessagePayload(MessagePayload): + """Generated after a successful [Remove Price](ctp:api:type:ProductRemovePriceAction) update action.""" + + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was removed. + variant_id: int + #: The Embedded Price that was removed from the [ProductVariant](ctp:api:type:ProductVariant). + price: "Price" + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + + def __init__(self, *, variant_id: int, price: "Price", staged: bool): + self.variant_id = variant_id + self.price = price + self.staged = staged + + super().__init__(type="ProductPriceRemoved") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPriceRemovedMessagePayload": + from ._schemas.message import ProductPriceRemovedMessagePayloadSchema + + return ProductPriceRemovedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPriceRemovedMessagePayloadSchema + + return ProductPriceRemovedMessagePayloadSchema().dump(self) + + +class ProductPricesSetMessagePayload(MessagePayload): + """Generated after a successful [Set Prices](ctp:api:type:ProductSetPricesAction) update action.""" + + #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was set. + variant_id: int + #: The [Embedded Prices](ctp:api:type:Price) that were set on the [ProductVariant](ctp:api:type:ProductVariant). + prices: typing.List["Price"] + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + + def __init__(self, *, variant_id: int, prices: typing.List["Price"], staged: bool): + self.variant_id = variant_id + self.prices = prices + self.staged = staged + + super().__init__(type="ProductPricesSet") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPricesSetMessagePayload": + from ._schemas.message import ProductPricesSetMessagePayloadSchema + + return ProductPricesSetMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPricesSetMessagePayloadSchema + + return ProductPricesSetMessagePayloadSchema().dump(self) + + +class ProductPublishedMessagePayload(MessagePayload): + """Generated after a successful [Publish](ctp:api:type:ProductPublishAction) update action.""" + + #: List of image URLs which were removed during the [Publish](ctp:api:type:ProductPublishAction) update action. + removed_image_urls: typing.List["str"] + #: Current [Product Projection](ctp:api:type:ProductProjection) of the [Product](ctp:api:type:Product) at the time of creation. + product_projection: "ProductProjection" + #: [Publishing Scope](ctp:api:type:ProductPublishScope) that was used during the [Publish](ctp:api:type:ProductPublishAction) update action. + scope: "ProductPublishScope" + + def __init__( + self, + *, + removed_image_urls: typing.List["str"], + product_projection: "ProductProjection", + scope: "ProductPublishScope" + ): + self.removed_image_urls = removed_image_urls + self.product_projection = product_projection + self.scope = scope + + super().__init__(type="ProductPublished") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPublishedMessagePayload": + from ._schemas.message import ProductPublishedMessagePayloadSchema + + return ProductPublishedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductPublishedMessagePayloadSchema + + return ProductPublishedMessagePayloadSchema().dump(self) + + +class ProductRemovedFromCategoryMessagePayload(MessagePayload): + """Generated after a successful [Remove from Category](ctp:api:type:ProductRemoveFromCategoryAction) update action.""" + + #: [Category](ctp:api:type:Category) the [Product](ctp:api:type:Product) was removed from. + category: "CategoryReference" + #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). + staged: bool + + def __init__(self, *, category: "CategoryReference", staged: bool): + self.category = category + self.staged = staged + + super().__init__(type="ProductRemovedFromCategory") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductRemovedFromCategoryMessagePayload": + from ._schemas.message import ProductRemovedFromCategoryMessagePayloadSchema + + return ProductRemovedFromCategoryMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductRemovedFromCategoryMessagePayloadSchema + + return ProductRemovedFromCategoryMessagePayloadSchema().dump(self) + + +class ProductRevertedStagedChangesMessagePayload(MessagePayload): + """Generated after a successful [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action.""" + + #: List of image URLs that were removed during the [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action. + removed_image_urls: typing.List["str"] + + def __init__(self, *, removed_image_urls: typing.List["str"]): + self.removed_image_urls = removed_image_urls + + super().__init__(type="ProductRevertedStagedChanges") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductRevertedStagedChangesMessagePayload": + from ._schemas.message import ProductRevertedStagedChangesMessagePayloadSchema + + return ProductRevertedStagedChangesMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductRevertedStagedChangesMessagePayloadSchema + + return ProductRevertedStagedChangesMessagePayloadSchema().dump(self) + + +class ProductSelectionCreatedMessagePayload(MessagePayload): + """Generated after a successful [Create Product Selection](ctp:api:endpoint:/{projectKey}/product-selections:POST) request.""" + + #: [Product Selection](ctp:api:type:ProductSelection) that was created. + product_selection: "ProductSelection" + + def __init__(self, *, product_selection: "ProductSelection"): + self.product_selection = product_selection + + super().__init__(type="ProductSelectionCreated") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSelectionCreatedMessagePayload": + from ._schemas.message import ProductSelectionCreatedMessagePayloadSchema + + return ProductSelectionCreatedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductSelectionCreatedMessagePayloadSchema + + return ProductSelectionCreatedMessagePayloadSchema().dump(self) + + +class ProductSelectionDeletedMessagePayload(MessagePayload): + """Generated after a successful [Delete Product Selection](/../api/projects/product-selections#delete-productselection) request.""" + + def __init__(self): + + super().__init__(type="ProductSelectionDeleted") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSelectionDeletedMessagePayload": + from ._schemas.message import ProductSelectionDeletedMessagePayloadSchema + + return ProductSelectionDeletedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductSelectionDeletedMessagePayloadSchema + + return ProductSelectionDeletedMessagePayloadSchema().dump(self) + + +class ProductSelectionProductAddedMessagePayload(MessagePayload): + """Generated after a successful [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action.""" + + #: [Product](ctp:api:type:Product) that was added to the [Product Selection](ctp:api:type:ProductSelection). + product: "ProductReference" + #: Product Variant Selection after the [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action. + variant_selection: "ProductVariantSelection" + + def __init__( + self, + *, + product: "ProductReference", + variant_selection: "ProductVariantSelection" + ): + self.product = product + self.variant_selection = variant_selection - super().__init__(type="ProductPriceKeySet") + super().__init__(type="ProductSelectionProductAdded") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceKeySetMessagePayload": - from ._schemas.message import ProductPriceKeySetMessagePayloadSchema + ) -> "ProductSelectionProductAddedMessagePayload": + from ._schemas.message import ProductSelectionProductAddedMessagePayloadSchema - return ProductPriceKeySetMessagePayloadSchema().load(data) + return ProductSelectionProductAddedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceKeySetMessagePayloadSchema + from ._schemas.message import ProductSelectionProductAddedMessagePayloadSchema - return ProductPriceKeySetMessagePayloadSchema().dump(self) + return ProductSelectionProductAddedMessagePayloadSchema().dump(self) -class ProductPriceModeSetMessagePayload(MessagePayload): - """Generated after a successful [Set PriceMode](ctp:api:type:ProductSetPriceModeAction) update action.""" +class ProductSelectionProductExcludedMessagePayload(MessagePayload): + """Generated after a successful [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action.""" - #: The [PriceMode](ctp:api:type:ProductPriceModeEnum) that was set. - to: "ProductPriceModeEnum" + #: [Product](ctp:api:type:Product) that was excluded from the [Product Selection](ctp:api:type:ProductSelection). + product: "ProductReference" + #: Product Variant Exclusion after the [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action. + variant_exclusion: "ProductVariantExclusion" - def __init__(self, *, to: "ProductPriceModeEnum"): - self.to = to + def __init__( + self, + *, + product: "ProductReference", + variant_exclusion: "ProductVariantExclusion" + ): + self.product = product + self.variant_exclusion = variant_exclusion - super().__init__(type="ProductPriceModeSet") + super().__init__(type="ProductSelectionProductExcluded") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceModeSetMessagePayload": - from ._schemas.message import ProductPriceModeSetMessagePayloadSchema + ) -> "ProductSelectionProductExcludedMessagePayload": + from ._schemas.message import ( + ProductSelectionProductExcludedMessagePayloadSchema, + ) - return ProductPriceModeSetMessagePayloadSchema().load(data) + return ProductSelectionProductExcludedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceModeSetMessagePayloadSchema + from ._schemas.message import ( + ProductSelectionProductExcludedMessagePayloadSchema, + ) - return ProductPriceModeSetMessagePayloadSchema().dump(self) + return ProductSelectionProductExcludedMessagePayloadSchema().dump(self) -class ProductPriceRemovedMessagePayload(MessagePayload): - """Generated after a successful [Remove Price](ctp:api:type:ProductRemovePriceAction) update action.""" +class ProductSelectionProductRemovedMessagePayload(MessagePayload): + """Generated after a successful [Remove Product](ctp:api:type:ProductSelectionRemoveProductAction) update action.""" - #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was removed. - variant_id: int - #: The [Embedded Price](/projects/products#embedded-price) that was removed from the [ProductVariant](ctp:api:type:ProductVariant). - price: "Price" - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: [Product](ctp:api:type:Product) that was removed from the Product Selection. + product: "ProductReference" - def __init__(self, *, variant_id: int, price: "Price", staged: bool): - self.variant_id = variant_id - self.price = price - self.staged = staged + def __init__(self, *, product: "ProductReference"): + self.product = product - super().__init__(type="ProductPriceRemoved") + super().__init__(type="ProductSelectionProductRemoved") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPriceRemovedMessagePayload": - from ._schemas.message import ProductPriceRemovedMessagePayloadSchema + ) -> "ProductSelectionProductRemovedMessagePayload": + from ._schemas.message import ProductSelectionProductRemovedMessagePayloadSchema - return ProductPriceRemovedMessagePayloadSchema().load(data) + return ProductSelectionProductRemovedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPriceRemovedMessagePayloadSchema + from ._schemas.message import ProductSelectionProductRemovedMessagePayloadSchema - return ProductPriceRemovedMessagePayloadSchema().dump(self) + return ProductSelectionProductRemovedMessagePayloadSchema().dump(self) -class ProductPricesSetMessagePayload(MessagePayload): - """Generated after a successful [Set Prices](ctp:api:type:ProductSetPricesAction) update action.""" +class ProductSelectionVariantExclusionChangedMessagePayload(MessagePayload): + """Generated after a successful [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action.""" - #: Unique identifier of the [ProductVariant](ctp:api:type:ProductVariant) for which the Price was set. - variant_id: int - #: The [Embedded Prices](ctp:api:type:Price) that were set on the [ProductVariant](ctp:api:type:ProductVariant). - prices: typing.List["Price"] - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: [Product](ctp:api:type:Product) for which the Product Variant Exclusion changed. + product: "ProductReference" + #: Product Variant Exclusion before the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. + old_variant_exclusion: "ProductVariantExclusion" + #: Product Variant Exclusion after the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. + new_variant_exclusion: "ProductVariantExclusion" - def __init__(self, *, variant_id: int, prices: typing.List["Price"], staged: bool): - self.variant_id = variant_id - self.prices = prices - self.staged = staged + def __init__( + self, + *, + product: "ProductReference", + old_variant_exclusion: "ProductVariantExclusion", + new_variant_exclusion: "ProductVariantExclusion" + ): + self.product = product + self.old_variant_exclusion = old_variant_exclusion + self.new_variant_exclusion = new_variant_exclusion - super().__init__(type="ProductPricesSet") + super().__init__(type="ProductSelectionVariantExclusionChanged") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPricesSetMessagePayload": - from ._schemas.message import ProductPricesSetMessagePayloadSchema + ) -> "ProductSelectionVariantExclusionChangedMessagePayload": + from ._schemas.message import ( + ProductSelectionVariantExclusionChangedMessagePayloadSchema, + ) - return ProductPricesSetMessagePayloadSchema().load(data) + return ProductSelectionVariantExclusionChangedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPricesSetMessagePayloadSchema + from ._schemas.message import ( + ProductSelectionVariantExclusionChangedMessagePayloadSchema, + ) - return ProductPricesSetMessagePayloadSchema().dump(self) + return ProductSelectionVariantExclusionChangedMessagePayloadSchema().dump(self) -class ProductPublishedMessagePayload(MessagePayload): - """Generated after a successful [Publish](ctp:api:type:ProductPublishAction) update action.""" +class ProductSelectionVariantSelectionChangedMessagePayload(MessagePayload): + """Generated after a successful [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action.""" - #: List of image URLs which were removed during the [Publish](ctp:api:type:ProductPublishAction) update action. - removed_image_urls: typing.List["str"] - #: Current [Product Projection](ctp:api:type:ProductProjection) of the [Product](ctp:api:type:Product) at the time of creation. - product_projection: "ProductProjection" - #: [Publishing Scope](ctp:api:type:ProductPublishScope) that was used during the [Publish](ctp:api:type:ProductPublishAction) update action. - scope: "ProductPublishScope" + #: [Product](ctp:api:type:Product) for which the Product Variant Selection changed. + product: "ProductReference" + #: Product Variant Selection before the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. + old_variant_selection: "ProductVariantSelection" + #: Product Variant Selection after the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. + new_variant_selection: "ProductVariantSelection" def __init__( self, *, - removed_image_urls: typing.List["str"], - product_projection: "ProductProjection", - scope: "ProductPublishScope" + product: "ProductReference", + old_variant_selection: "ProductVariantSelection", + new_variant_selection: "ProductVariantSelection" ): - self.removed_image_urls = removed_image_urls - self.product_projection = product_projection - self.scope = scope + self.product = product + self.old_variant_selection = old_variant_selection + self.new_variant_selection = new_variant_selection - super().__init__(type="ProductPublished") + super().__init__(type="ProductSelectionVariantSelectionChanged") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductPublishedMessagePayload": - from ._schemas.message import ProductPublishedMessagePayloadSchema + ) -> "ProductSelectionVariantSelectionChangedMessagePayload": + from ._schemas.message import ( + ProductSelectionVariantSelectionChangedMessagePayloadSchema, + ) - return ProductPublishedMessagePayloadSchema().load(data) + return ProductSelectionVariantSelectionChangedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductPublishedMessagePayloadSchema + from ._schemas.message import ( + ProductSelectionVariantSelectionChangedMessagePayloadSchema, + ) - return ProductPublishedMessagePayloadSchema().dump(self) + return ProductSelectionVariantSelectionChangedMessagePayloadSchema().dump(self) -class ProductRemovedFromCategoryMessagePayload(MessagePayload): - """Generated after a successful [Remove from Category](ctp:api:type:ProductRemoveFromCategoryAction) update action.""" +class ProductSlugChangedMessagePayload(MessagePayload): + """Generated after a successful [Change Slug](ctp:api:type:ProductChangeSlugAction) update action.""" - #: [Category](ctp:api:type:Category) the [Product](ctp:api:type:Product) was removed from. - category: "CategoryReference" - #: Whether the update was only applied to the staged [Product Projection](ctp:api:type:ProductProjection). - staged: bool + #: The slug of the [Product](ctp:api:type:Product) after the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. + slug: "LocalizedString" + #: The slug of the [Product](ctp:api:type:Product) before the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. + old_slug: typing.Optional["LocalizedString"] - def __init__(self, *, category: "CategoryReference", staged: bool): - self.category = category - self.staged = staged + def __init__( + self, + *, + slug: "LocalizedString", + old_slug: typing.Optional["LocalizedString"] = None + ): + self.slug = slug + self.old_slug = old_slug - super().__init__(type="ProductRemovedFromCategory") + super().__init__(type="ProductSlugChanged") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductRemovedFromCategoryMessagePayload": - from ._schemas.message import ProductRemovedFromCategoryMessagePayloadSchema + ) -> "ProductSlugChangedMessagePayload": + from ._schemas.message import ProductSlugChangedMessagePayloadSchema - return ProductRemovedFromCategoryMessagePayloadSchema().load(data) + return ProductSlugChangedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductRemovedFromCategoryMessagePayloadSchema + from ._schemas.message import ProductSlugChangedMessagePayloadSchema - return ProductRemovedFromCategoryMessagePayloadSchema().dump(self) + return ProductSlugChangedMessagePayloadSchema().dump(self) -class ProductRevertedStagedChangesMessagePayload(MessagePayload): - """Generated after a successful [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action.""" +class ProductStateTransitionMessagePayload(MessagePayload): + """Generated after a successful [Transition State](ctp:api:type:ProductTransitionStateAction) update action.""" - #: List of image URLs that were removed during the [Revert Staged Changes](ctp:api:type:ProductRevertStagedChangesAction) update action. - removed_image_urls: typing.List["str"] + #: Product [State](ctp:api:type:State) after the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. + state: "StateReference" + #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. + force: bool - def __init__(self, *, removed_image_urls: typing.List["str"]): - self.removed_image_urls = removed_image_urls + def __init__(self, *, state: "StateReference", force: bool): + self.state = state + self.force = force - super().__init__(type="ProductRevertedStagedChanges") + super().__init__(type="ProductStateTransition") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductRevertedStagedChangesMessagePayload": - from ._schemas.message import ProductRevertedStagedChangesMessagePayloadSchema + ) -> "ProductStateTransitionMessagePayload": + from ._schemas.message import ProductStateTransitionMessagePayloadSchema - return ProductRevertedStagedChangesMessagePayloadSchema().load(data) + return ProductStateTransitionMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductRevertedStagedChangesMessagePayloadSchema + from ._schemas.message import ProductStateTransitionMessagePayloadSchema - return ProductRevertedStagedChangesMessagePayloadSchema().dump(self) + return ProductStateTransitionMessagePayloadSchema().dump(self) -class ProductSelectionCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Product Selection](/../api/projects/product-selections#create-productselection) request.""" +class ProductTailoringCreatedMessagePayload(MessagePayload): + """Generated after a successful [Create Product Tailoring](/../api/projects/product-tailoring#create-producttailoring) or + [Create Product Tailoring in Store](/../api/projects/product-tailoring#create-producttailoring-in-store) request. - #: [Product Selection](ctp:api:type:ProductSelection) that was created. - product_selection: "ProductSelection" + """ - def __init__(self, *, product_selection: "ProductSelection"): - self.product_selection = product_selection + #: User-defined unique identifier of the Product Tailoring. + key: typing.Optional[str] + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" + #: The description of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + description: typing.Optional["LocalizedString"] + #: The name of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + name: typing.Optional["LocalizedString"] + #: The slug of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + slug: typing.Optional["LocalizedString"] + #: The metaTitle of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + meta_title: typing.Optional["LocalizedString"] + #: The metaDescription of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + meta_description: typing.Optional["LocalizedString"] + #: The metaKeywords of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + meta_keywords: typing.Optional["LocalizedString"] + #: The variants of the [Product Tailoring](ctp:api:type:ProductTailoring) at the time of creation. + variants: typing.Optional[typing.List["ProductVariantTailoring"]] + #: `true` if the ProductTailoring is published. + published: bool + + def __init__( + self, + *, + key: typing.Optional[str] = None, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + description: typing.Optional["LocalizedString"] = None, + name: typing.Optional["LocalizedString"] = None, + slug: typing.Optional["LocalizedString"] = None, + meta_title: typing.Optional["LocalizedString"] = None, + meta_description: typing.Optional["LocalizedString"] = None, + meta_keywords: typing.Optional["LocalizedString"] = None, + variants: typing.Optional[typing.List["ProductVariantTailoring"]] = None, + published: bool + ): + self.key = key + self.store = store + self.product_key = product_key + self.product = product + self.description = description + self.name = name + self.slug = slug + self.meta_title = meta_title + self.meta_description = meta_description + self.meta_keywords = meta_keywords + self.variants = variants + self.published = published - super().__init__(type="ProductSelectionCreated") + super().__init__(type="ProductTailoringCreated") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionCreatedMessagePayload": - from ._schemas.message import ProductSelectionCreatedMessagePayloadSchema + ) -> "ProductTailoringCreatedMessagePayload": + from ._schemas.message import ProductTailoringCreatedMessagePayloadSchema - return ProductSelectionCreatedMessagePayloadSchema().load(data) + return ProductTailoringCreatedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionCreatedMessagePayloadSchema + from ._schemas.message import ProductTailoringCreatedMessagePayloadSchema - return ProductSelectionCreatedMessagePayloadSchema().dump(self) + return ProductTailoringCreatedMessagePayloadSchema().dump(self) -class ProductSelectionDeletedMessagePayload(MessagePayload): - """Generated after a successful [Delete Product Selection](/../api/projects/product-selections#delete-productselection) request.""" +class ProductTailoringDeletedMessagePayload(MessagePayload): + """Generated after a successful [Delete Product Tailoring](/../api/projects/product-tailoring#delete-producttailoring) or + [Delete ProductTailoring assigned to Product in Store](/../api/projects/product-tailoring#delete-producttailoring-assigned-to-product-in-store) request. - def __init__(self): - super().__init__(type="ProductSelectionDeleted") + """ + + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" + + def __init__( + self, + *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference" + ): + self.store = store + self.product_key = product_key + self.product = product + + super().__init__(type="ProductTailoringDeleted") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionDeletedMessagePayload": - from ._schemas.message import ProductSelectionDeletedMessagePayloadSchema + ) -> "ProductTailoringDeletedMessagePayload": + from ._schemas.message import ProductTailoringDeletedMessagePayloadSchema - return ProductSelectionDeletedMessagePayloadSchema().load(data) + return ProductTailoringDeletedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionDeletedMessagePayloadSchema + from ._schemas.message import ProductTailoringDeletedMessagePayloadSchema - return ProductSelectionDeletedMessagePayloadSchema().dump(self) + return ProductTailoringDeletedMessagePayloadSchema().dump(self) -class ProductSelectionProductAddedMessagePayload(MessagePayload): - """Generated after a successful [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action.""" +class ProductTailoringDescriptionSetMessagePayload(MessagePayload): + """Generated after a successful Product Tailoring [Set Description](ctp:api:type:ProductTailoringSetDescriptionAction) update action.""" - #: [Product](ctp:api:type:Product) that was added to the [Product Selection](ctp:api:type:ProductSelection). + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" - #: Product Variant Selection after the [Add Product](ctp:api:type:ProductSelectionAddProductAction) update action. - variant_selection: "ProductVariantSelection" + #: The description of the [Product Tailoring](ctp:api:type:ProductTailoring) after the [Set Description](ctp:api:type:ProductTailoringSetDescriptionAction) update action. + description: typing.Optional["LocalizedString"] + #: The description of the [ProductTailoring](ctp:api:type:ProductTailoring) before the [Set Description](ctp:api:type:ProductTailoringSetDescriptionAction) update action. + old_description: typing.Optional["LocalizedString"] def __init__( self, *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, product: "ProductReference", - variant_selection: "ProductVariantSelection" + description: typing.Optional["LocalizedString"] = None, + old_description: typing.Optional["LocalizedString"] = None ): + self.store = store + self.product_key = product_key self.product = product - self.variant_selection = variant_selection + self.description = description + self.old_description = old_description - super().__init__(type="ProductSelectionProductAdded") + super().__init__(type="ProductTailoringDescriptionSet") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionProductAddedMessagePayload": - from ._schemas.message import ProductSelectionProductAddedMessagePayloadSchema + ) -> "ProductTailoringDescriptionSetMessagePayload": + from ._schemas.message import ProductTailoringDescriptionSetMessagePayloadSchema - return ProductSelectionProductAddedMessagePayloadSchema().load(data) + return ProductTailoringDescriptionSetMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionProductAddedMessagePayloadSchema + from ._schemas.message import ProductTailoringDescriptionSetMessagePayloadSchema - return ProductSelectionProductAddedMessagePayloadSchema().dump(self) + return ProductTailoringDescriptionSetMessagePayloadSchema().dump(self) -class ProductSelectionProductExcludedMessagePayload(MessagePayload): - """Generated after a successful [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action.""" +class ProductTailoringImageAddedMessagePayload(MessagePayload): + """Generated after a successful [Add External Image](ctp:api:type:ProductTailoringAddExternalImageAction) update action + or after a successful [Upload Product Tailoring image](/projects/product-tailoring#upload-product-tailoring-image) request. - #: [Product](ctp:api:type:Product) that was excluded from the [Product Selection](ctp:api:type:ProductSelection). + """ + + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the tailored Product. product: "ProductReference" - #: Product Variant Exclusion after the [Exclude Product](ctp:api:type:ProductSelectionExcludeProductAction) update action. - variant_exclusion: "ProductVariantExclusion" + #: `id` of the tailored [ProductVariant](ctp:api:type:ProductVariant). + variant_id: int + #: [Image](ctp:api:type:Image) that was added. + image: "Image" def __init__( self, *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, product: "ProductReference", - variant_exclusion: "ProductVariantExclusion" + variant_id: int, + image: "Image" ): + self.store = store + self.product_key = product_key self.product = product - self.variant_exclusion = variant_exclusion + self.variant_id = variant_id + self.image = image - super().__init__(type="ProductSelectionProductExcluded") + super().__init__(type="ProductTailoringImageAdded") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionProductExcludedMessagePayload": - from ._schemas.message import ( - ProductSelectionProductExcludedMessagePayloadSchema, - ) + ) -> "ProductTailoringImageAddedMessagePayload": + from ._schemas.message import ProductTailoringImageAddedMessagePayloadSchema - return ProductSelectionProductExcludedMessagePayloadSchema().load(data) + return ProductTailoringImageAddedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ( - ProductSelectionProductExcludedMessagePayloadSchema, - ) + from ._schemas.message import ProductTailoringImageAddedMessagePayloadSchema - return ProductSelectionProductExcludedMessagePayloadSchema().dump(self) + return ProductTailoringImageAddedMessagePayloadSchema().dump(self) -class ProductSelectionProductRemovedMessagePayload(MessagePayload): - """Generated after a successful [Remove Product](ctp:api:type:ProductSelectionRemoveProductAction) update action.""" +class ProductTailoringImagesSetMessagePayload(MessagePayload): + """Generated after a successful [Set Images](ctp:api:type:ProductTailoringSetExternalImagesAction) update action.""" - #: [Product](ctp:api:type:Product) that was removed from the Product Selection. + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" + #: `id` of the tailored Product Variant. + variant_id: int + #: [Images](ctp:api:type:Image) on the tailored [Product Variant](ctp:api:type:ProductVariantTailoring) before the [Set Images](ctp:api:type:ProductTailoringSetExternalImagesAction) update action. + old_images: typing.Optional[typing.List["Image"]] + #: [Images](ctp:api:type:Image) on the tailored [Product Variant](ctp:api:type:ProductVariantTailoring) after the [Set Images](ctp:api:type:ProductTailoringSetExternalImagesAction) update action. + images: typing.Optional[typing.List["Image"]] - def __init__(self, *, product: "ProductReference"): + def __init__( + self, + *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + variant_id: int, + old_images: typing.Optional[typing.List["Image"]] = None, + images: typing.Optional[typing.List["Image"]] = None + ): + self.store = store + self.product_key = product_key self.product = product + self.variant_id = variant_id + self.old_images = old_images + self.images = images - super().__init__(type="ProductSelectionProductRemoved") + super().__init__(type="ProductTailoringImagesSet") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionProductRemovedMessagePayload": - from ._schemas.message import ProductSelectionProductRemovedMessagePayloadSchema + ) -> "ProductTailoringImagesSetMessagePayload": + from ._schemas.message import ProductTailoringImagesSetMessagePayloadSchema - return ProductSelectionProductRemovedMessagePayloadSchema().load(data) + return ProductTailoringImagesSetMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSelectionProductRemovedMessagePayloadSchema + from ._schemas.message import ProductTailoringImagesSetMessagePayloadSchema - return ProductSelectionProductRemovedMessagePayloadSchema().dump(self) + return ProductTailoringImagesSetMessagePayloadSchema().dump(self) -class ProductSelectionVariantExclusionChangedMessagePayload(MessagePayload): - """Generated after a successful [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action.""" +class ProductTailoringNameSetMessagePayload(MessagePayload): + """Generated after a successful Product Tailoring [Set Name](ctp:api:type:ProductTailoringSetNameAction) update action.""" - #: [Product](ctp:api:type:Product) for which the Product Variant Exclusion changed. + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" - #: Product Variant Exclusion before the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. - old_variant_exclusion: "ProductVariantExclusion" - #: Product Variant Exclusion after the [Set Variant Exclusion](ctp:api:type:ProductSelectionSetVariantExclusionAction) update action. - new_variant_exclusion: "ProductVariantExclusion" + #: The name of the [Product Tailoring](ctp:api:type:ProductTailoring) after the [Set Name](ctp:api:type:ProductTailoringSetNameAction) update action. + name: typing.Optional["LocalizedString"] + #: The name of the [ProductTailoring](ctp:api:type:ProductTailoring) before the [Set Name](ctp:api:type:ProductTailoringSetNameAction) update action. + old_name: typing.Optional["LocalizedString"] def __init__( self, *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, product: "ProductReference", - old_variant_exclusion: "ProductVariantExclusion", - new_variant_exclusion: "ProductVariantExclusion" + name: typing.Optional["LocalizedString"] = None, + old_name: typing.Optional["LocalizedString"] = None ): + self.store = store + self.product_key = product_key self.product = product - self.old_variant_exclusion = old_variant_exclusion - self.new_variant_exclusion = new_variant_exclusion + self.name = name + self.old_name = old_name - super().__init__(type="ProductSelectionVariantExclusionChanged") + super().__init__(type="ProductTailoringNameSet") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionVariantExclusionChangedMessagePayload": - from ._schemas.message import ( - ProductSelectionVariantExclusionChangedMessagePayloadSchema, - ) + ) -> "ProductTailoringNameSetMessagePayload": + from ._schemas.message import ProductTailoringNameSetMessagePayloadSchema - return ProductSelectionVariantExclusionChangedMessagePayloadSchema().load(data) + return ProductTailoringNameSetMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ( - ProductSelectionVariantExclusionChangedMessagePayloadSchema, - ) + from ._schemas.message import ProductTailoringNameSetMessagePayloadSchema - return ProductSelectionVariantExclusionChangedMessagePayloadSchema().dump(self) + return ProductTailoringNameSetMessagePayloadSchema().dump(self) -class ProductSelectionVariantSelectionChangedMessagePayload(MessagePayload): - """Generated after a successful [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action.""" +class ProductTailoringPublishedMessagePayload(MessagePayload): + """Generated after a successful [Product Tailoring Publish](ctp:api:type:ProductTailoringPublishAction) update action.""" - #: [Product](ctp:api:type:Product) for which the Product Variant Selection changed. + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. product: "ProductReference" - #: Product Variant Selection before the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. - old_variant_selection: "ProductVariantSelection" - #: Product Variant Selection after the [Set Variant Selection](ctp:api:type:ProductSelectionSetVariantSelectionAction) update action. - new_variant_selection: "ProductVariantSelection" def __init__( self, *, - product: "ProductReference", - old_variant_selection: "ProductVariantSelection", - new_variant_selection: "ProductVariantSelection" + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference" ): + self.store = store + self.product_key = product_key self.product = product - self.old_variant_selection = old_variant_selection - self.new_variant_selection = new_variant_selection - super().__init__(type="ProductSelectionVariantSelectionChanged") + super().__init__(type="ProductTailoringPublished") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSelectionVariantSelectionChangedMessagePayload": - from ._schemas.message import ( - ProductSelectionVariantSelectionChangedMessagePayloadSchema, - ) + ) -> "ProductTailoringPublishedMessagePayload": + from ._schemas.message import ProductTailoringPublishedMessagePayloadSchema - return ProductSelectionVariantSelectionChangedMessagePayloadSchema().load(data) + return ProductTailoringPublishedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ( - ProductSelectionVariantSelectionChangedMessagePayloadSchema, - ) + from ._schemas.message import ProductTailoringPublishedMessagePayloadSchema - return ProductSelectionVariantSelectionChangedMessagePayloadSchema().dump(self) + return ProductTailoringPublishedMessagePayloadSchema().dump(self) -class ProductSlugChangedMessagePayload(MessagePayload): - """Generated after a successful [Change Slug](ctp:api:type:ProductChangeSlugAction) update action.""" +class ProductTailoringSlugSetMessagePayload(MessagePayload): + """Generated after a successful Product Tailoring [Set Slug](ctp:api:type:ProductTailoringSetSlugAction) update action.""" - #: The slug of the [Product](ctp:api:type:Product) after the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. - slug: "LocalizedString" - #: The slug of the [Product](ctp:api:type:Product) before the [Change Slug](ctp:api:type:ProductChangeSlugAction) update action. + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" + #: The slug of the [Product Tailoring](ctp:api:type:ProductTailoring) after the [Set Slug](ctp:api:type:ProductTailoringSetSlugAction) update action. + slug: typing.Optional["LocalizedString"] + #: The slug of the [ProductTailoring](ctp:api:type:ProductTailoring) before the [Set Slug](ctp:api:type:ProductTailoringSetSlugAction) update action. old_slug: typing.Optional["LocalizedString"] def __init__( self, *, - slug: "LocalizedString", + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + slug: typing.Optional["LocalizedString"] = None, old_slug: typing.Optional["LocalizedString"] = None ): + self.store = store + self.product_key = product_key + self.product = product self.slug = slug self.old_slug = old_slug - super().__init__(type="ProductSlugChanged") + super().__init__(type="ProductTailoringSlugSet") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductSlugChangedMessagePayload": - from ._schemas.message import ProductSlugChangedMessagePayloadSchema + ) -> "ProductTailoringSlugSetMessagePayload": + from ._schemas.message import ProductTailoringSlugSetMessagePayloadSchema - return ProductSlugChangedMessagePayloadSchema().load(data) + return ProductTailoringSlugSetMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductSlugChangedMessagePayloadSchema + from ._schemas.message import ProductTailoringSlugSetMessagePayloadSchema - return ProductSlugChangedMessagePayloadSchema().dump(self) + return ProductTailoringSlugSetMessagePayloadSchema().dump(self) -class ProductStateTransitionMessagePayload(MessagePayload): - """Generated after a successful [Transition State](ctp:api:type:ProductTransitionStateAction) update action.""" +class ProductTailoringUnpublishedMessagePayload(MessagePayload): + """Generated after a successful [Product Tailoring Unpublish](ctp:api:type:ProductTailoringUnpublishAction) update action.""" - #: Product [State](ctp:api:type:State) after the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. - state: "StateReference" - #: Whether [State](ctp:api:type:State) transition validations were turned off during the [Transition State](ctp:api:type:ProductTransitionStateAction) update action. - force: bool + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: User-defined unique identifier of the Product this Product Tailoring belongs to. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" - def __init__(self, *, state: "StateReference", force: bool): - self.state = state - self.force = force + def __init__( + self, + *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference" + ): + self.store = store + self.product_key = product_key + self.product = product - super().__init__(type="ProductStateTransition") + super().__init__(type="ProductTailoringUnpublished") @classmethod def deserialize( cls, data: typing.Dict[str, typing.Any] - ) -> "ProductStateTransitionMessagePayload": - from ._schemas.message import ProductStateTransitionMessagePayloadSchema + ) -> "ProductTailoringUnpublishedMessagePayload": + from ._schemas.message import ProductTailoringUnpublishedMessagePayloadSchema - return ProductStateTransitionMessagePayloadSchema().load(data) + return ProductTailoringUnpublishedMessagePayloadSchema().load(data) def serialize(self) -> typing.Dict[str, typing.Any]: - from ._schemas.message import ProductStateTransitionMessagePayloadSchema + from ._schemas.message import ProductTailoringUnpublishedMessagePayloadSchema - return ProductStateTransitionMessagePayloadSchema().dump(self) + return ProductTailoringUnpublishedMessagePayloadSchema().dump(self) class ProductUnpublishedMessagePayload(MessagePayload): """Generated after a successful [Unpublish Product](ctp:api:type:ProductUnpublishAction) update action.""" def __init__(self): + super().__init__(type="ProductUnpublished") @classmethod @@ -20008,8 +22849,98 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return ProductVariantDeletedMessagePayloadSchema().dump(self) +class ProductVariantTailoringAddedMessagePayload(MessagePayload): + """Generated after a successful [Add ProductVariant Tailoring](ctp:api:type:ProductTailoringAddVariantAction) update action.""" + + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the tailored Product. + product: "ProductReference" + #: `id` of the [ProductVariant](ctp:api:type:ProductVariant) added to the Tailoring. + variant_id: int + #: The [ProductVariantTailoring](ctp:api:type:ProductVariantTailoring) that was added to the ProductTailoring. + variant: "ProductVariantTailoring" + + def __init__( + self, + *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + variant_id: int, + variant: "ProductVariantTailoring" + ): + self.store = store + self.product_key = product_key + self.product = product + self.variant_id = variant_id + self.variant = variant + + super().__init__(type="ProductVariantTailoringAdded") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantTailoringAddedMessagePayload": + from ._schemas.message import ProductVariantTailoringAddedMessagePayloadSchema + + return ProductVariantTailoringAddedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductVariantTailoringAddedMessagePayloadSchema + + return ProductVariantTailoringAddedMessagePayloadSchema().dump(self) + + +class ProductVariantTailoringRemovedMessagePayload(MessagePayload): + """Generated after a successful [Remove ProductVariant Tailoring](ctp:api:type:ProductTailoringRemoveVariantAction) update action.""" + + #: The Store to which the Product Tailoring belongs. + store: "StoreKeyReference" + #: `key` of the tailored Product. + product_key: typing.Optional[str] + #: Reference to the Product the Product Tailoring belongs to. + product: "ProductReference" + #: `id` of the [ProductVariant](ctp:api:type:ProductVariant) removed from the Tailoring. + variant_id: int + #: The [ProductVariantTailoring](ctp:api:type:ProductVariantTailoring) that was removed from the ProductTailoring. + variant: "ProductVariantTailoring" + + def __init__( + self, + *, + store: "StoreKeyReference", + product_key: typing.Optional[str] = None, + product: "ProductReference", + variant_id: int, + variant: "ProductVariantTailoring" + ): + self.store = store + self.product_key = product_key + self.product = product + self.variant_id = variant_id + self.variant = variant + + super().__init__(type="ProductVariantTailoringRemoved") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantTailoringRemovedMessagePayload": + from ._schemas.message import ProductVariantTailoringRemovedMessagePayloadSchema + + return ProductVariantTailoringRemovedMessagePayloadSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.message import ProductVariantTailoringRemovedMessagePayloadSchema + + return ProductVariantTailoringRemovedMessagePayloadSchema().dump(self) + + class QuoteCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Quote](/../api/projects/quotes#create-quote) request.""" + """Generated after a successful [Create Quote](ctp:api:endpoint:/{projectKey}/quotes:POST) request.""" #: [Quote](/../api/projects/quotes) that was created. quote: "Quote" @@ -20067,6 +22998,7 @@ class QuoteDeletedMessagePayload(MessagePayload): """Generated after a successful [Delete Quote](/../api/projects/quotes#delete-quote) request.""" def __init__(self): + super().__init__(type="QuoteDeleted") @classmethod @@ -20109,7 +23041,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class QuoteRequestCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create QuoteRequest](/../api/projects/quote-requests#create-quoterequest) request.""" + """Generated after a successful [Create QuoteRequest](ctp:api:endpoint:/{projectKey}/quote-requests:POST) request.""" #: [Quote Request](/../api/projects/quote-requests) that was created. quote_request: "QuoteRequest" @@ -20167,6 +23099,7 @@ class QuoteRequestDeletedMessagePayload(MessagePayload): """Generated after a successful [Delete QuoteRequest](/../api/projects/quote-requests#delete-quoterequest) request.""" def __init__(self): + super().__init__(type="QuoteRequestDeleted") @classmethod @@ -20371,7 +23304,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ReviewCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Review](/../api/projects/reviews#create-review) request.""" + """Generated after a successful [Create Review](ctp:api:endpoint:/{projectKey}/reviews:POST) request.""" #: [Review](ctp:api:type:Review) that was created. review: "Review" @@ -20486,7 +23419,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShoppingListStoreSetMessagePayload(MessagePayload): - #: [Reference](/../api/types#reference) to a [Store](ctp:api:type:Store) by its key. + #: [KeyReference](ctp:api:type:KeyReference) to a [Store](ctp:api:type:Store). store: "StoreKeyReference" def __init__(self, *, store: "StoreKeyReference"): @@ -20509,7 +23442,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StagedQuoteCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create StagedQuote](/../api/projects/staged-quotes#create-stagedquote) request.""" + """Generated after a successful [Create StagedQuote](ctp:api:endpoint:/{projectKey}/staged-quotes:POST) request.""" #: [Staged Quote](/../api/projects/staged-quotes) that was created. staged_quote: "StagedQuote" @@ -20537,6 +23470,7 @@ class StagedQuoteDeletedMessagePayload(MessagePayload): """Generated after a successful [Delete StagedQuote](/../api/projects/staged-quotes#delete-stagedquote) request.""" def __init__(self): + super().__init__(type="StagedQuoteDeleted") @classmethod @@ -20702,7 +23636,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePriceCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create StandalonePrice](/../api/projects/standalone-prices#create-standaloneprice) request.""" + """Generated after a successful [Create StandalonePrice](ctp:api:endpoint:/{projectKey}/standalone-prices:POST) request.""" #: [Standalone Price](ctp:api:type:StandalonePrice) that was created. standalone_price: "StandalonePrice" @@ -21091,19 +24025,19 @@ class StandalonePriceValueChangedMessagePayload(MessagePayload): """Generated after a successful [Change Value](ctp:api:type:StandalonePriceChangeValueAction) update action.""" #: The new value of the updated [StandalonePrice](ctp:api:type:StandalonePrice). - value: "Money" + value: "TypedMoney" #: Whether the new value was applied to the current or the staged representation of the StandalonePrice. Staged changes are stored on the [StagedStandalonePrice](ctp:api:type:StagedStandalonePrice). staged: bool #: The old value of the updated [StandalonePrice](ctp:api:type:StandalonePrice). #: Present on Messages created after 3 February 2023. Optional for backwards compatibility. - old_value: typing.Optional["Money"] + old_value: typing.Optional["TypedMoney"] def __init__( self, *, - value: "Money", + value: "TypedMoney", staged: bool, - old_value: typing.Optional["Money"] = None + old_value: typing.Optional["TypedMoney"] = None ): self.value = value self.staged = staged @@ -21163,7 +24097,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreCreatedMessagePayload(MessagePayload): - """Generated after a successful [Create Store](/../api/projects/stores#create-store) request.""" + """Generated after a successful [Create Store](ctp:api:endpoint:/{projectKey}/stores:POST) request.""" #: The `name` of the [Store](ctp:api:type:Store) that was created. name: typing.Optional["LocalizedString"] @@ -21216,9 +24150,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreDeletedMessagePayload(MessagePayload): - """Generated after a successful [Delete Store](/../api/projects/quote-requests#delete-quoterequest) request.""" + """Generated after a successful [Delete Store](/../api/projects/stores#delete-store) request.""" def __init__(self): + super().__init__(type="StoreDeleted") @classmethod diff --git a/src/commercetools/platform/models/order.py b/src/commercetools/platform/models/order.py index d4e7b62a..f8de4f86 100644 --- a/src/commercetools/platform/models/order.py +++ b/src/commercetools/platform/models/order.py @@ -32,7 +32,7 @@ CustomLineItemPriceMode, DirectDiscount, DiscountCodeInfo, - DiscountedLineItemPortion, + DiscountedLineItemPortionDraft, DiscountOnTotalPrice, InventoryMode, ItemShippingDetailsDraft, @@ -174,6 +174,8 @@ "OrderSetShippingAddressAction", "OrderSetShippingAddressCustomFieldAction", "OrderSetShippingAddressCustomTypeAction", + "OrderSetShippingCustomFieldAction", + "OrderSetShippingCustomTypeAction", "OrderSetStoreAction", "OrderState", "OrderTransitionCustomLineItemStateAction", @@ -612,6 +614,18 @@ def deserialize( ) return StagedOrderSetShippingAddressCustomTypeActionSchema().load(data) + if data["action"] == "setShippingCustomField": + from ._schemas.order_edit import ( + StagedOrderSetShippingCustomFieldActionSchema, + ) + + return StagedOrderSetShippingCustomFieldActionSchema().load(data) + if data["action"] == "setShippingCustomType": + from ._schemas.order_edit import ( + StagedOrderSetShippingCustomTypeActionSchema, + ) + + return StagedOrderSetShippingCustomTypeActionSchema().load(data) if data["action"] == "setShippingMethod": from ._schemas.order_edit import StagedOrderSetShippingMethodActionSchema @@ -1177,13 +1191,13 @@ class DiscountedLineItemPriceDraft(_BaseType): #: Discounted money value. value: "Money" #: Discounts to be applied. - included_discounts: typing.List["DiscountedLineItemPortion"] + included_discounts: typing.List["DiscountedLineItemPortionDraft"] def __init__( self, *, value: "Money", - included_discounts: typing.List["DiscountedLineItemPortion"] + included_discounts: typing.List["DiscountedLineItemPortionDraft"] ): self.value = value self.included_discounts = included_discounts @@ -1247,7 +1261,7 @@ class LineItemImportDraft(_BaseType): price: "PriceDraft" #: The tax rate used to calculate the `taxedPrice` of the Order. tax_rate: typing.Optional["TaxRate"] - #: The Channel used to [select a Price](ctp:api:type:LineItemPriceSelection). + #: The Channel used to [select a Price](/../api/pricing-and-discounts-overview#line-item-price-selection). #: This Channel must have the `ProductDistribution` role. distribution_channel: typing.Optional["ChannelResourceIdentifier"] #: The Channel used to supply Line Items. @@ -1321,7 +1335,7 @@ class Order(BaseResource): #: Email address of the Customer that the Order belongs to. customer_email: typing.Optional[str] #: [Reference](ctp:api:type:Reference) to the Customer Group of the Customer that the Order belongs to. - #: Used for [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: Used for [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). customer_group: typing.Optional["CustomerGroupReference"] #: [Anonymous session](ctp:api:type:AnonymousSession) associated with the Order. anonymous_id: typing.Optional[str] @@ -1392,7 +1406,7 @@ class Order(BaseResource): refused_gifts: typing.List["CartDiscountReference"] #: Payment information related to the Order. payment_info: typing.Optional["PaymentInfo"] - #: Used for [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: Used for [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). country: typing.Optional[str] #: Languages of the Order. #: Can only contain languages supported by the [Project](ctp:api:type:Project). @@ -1425,9 +1439,9 @@ class Order(BaseResource): #: User-defined date and time (UTC) of the Order. #: Present only on an Order created using [Order Import](ctp:api:endpoint:/{projectKey}/orders/import:POST). completed_at: typing.Optional[datetime.datetime] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Order. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Order. created_by: typing.Optional["CreatedBy"] def __init__( @@ -2252,7 +2266,7 @@ class OrderState(enum.Enum): class OrderUpdate(_BaseType): #: Expected version of the Order on which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Order. actions: typing.List["OrderUpdateAction"] @@ -2495,6 +2509,14 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "OrderUpdateAction": from ._schemas.order import OrderSetShippingAddressCustomTypeActionSchema return OrderSetShippingAddressCustomTypeActionSchema().load(data) + if data["action"] == "setShippingCustomField": + from ._schemas.order import OrderSetShippingCustomFieldActionSchema + + return OrderSetShippingCustomFieldActionSchema().load(data) + if data["action"] == "setShippingCustomType": + from ._schemas.order import OrderSetShippingCustomTypeActionSchema + + return OrderSetShippingCustomTypeActionSchema().load(data) if data["action"] == "setStore": from ._schemas.order import OrderSetStoreActionSchema @@ -3033,7 +3055,7 @@ class ReturnShipmentState(enum.Enum): class ShipmentState(enum.Enum): - """Indicates the shipment status of the Parcel.""" + """Indicates the shipment status of the Order.""" SHIPPED = "Shipped" DELIVERED = "Delivered" @@ -3141,9 +3163,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class TaxedItemPriceDraft(_BaseType): - #: Draft type that stores amounts only in cent precision for the specified currency. + #: Draft object to store money in cent amounts for a specific currency. total_net: "Money" - #: Draft type that stores amounts only in cent precision for the specified currency. + #: Draft object to store money in cent amounts for a specific currency. total_gross: "Money" def __init__(self, *, total_net: "Money", total_gross: "Money"): @@ -3605,7 +3627,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderRemoveItemShippingAddressAction(OrderUpdateAction): - """An address can only be removed if it is not referenced in any [ItemShippingTarget](ctp:api:type:ItemShippingTarget) of the Cart.""" + """An address can only be removed if it is not referenced in any [ItemShippingTarget](ctp:api:type:ItemShippingTarget) of the Cart. + In such case, change the Line Item shipping address to a different `addressKey` first using the [Set LineItemShippingDetails](ctp:api:type:OrderSetLineItemShippingDetailsAction) update action, before you remove the obsolete address. + + """ #: `key` of the Address to remove from `itemShippingAddresses`. address_key: str @@ -5032,6 +5057,85 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return OrderSetShippingAddressCustomTypeActionSchema().dump(self) +class OrderSetShippingCustomFieldAction(OrderUpdateAction): + #: The `shippingKey` of the [Shipping](ctp:api:type:Shipping) to customize. Used to specify which Shipping Method to customize + #: on a Order with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Leave this empty to customize the one and only ShippingMethod on a `Single` ShippingMode Order. + shipping_key: typing.Optional[str] + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: If `value` is absent or `null`, this field will be removed if it exists. + #: Trying to remove a field that does not exist will fail with an [InvalidOperation](ctp:api:type:InvalidOperationError) error. + #: If `value` is provided, it is set for the field defined by `name`. + value: typing.Optional[typing.Any] + + def __init__( + self, + *, + shipping_key: typing.Optional[str] = None, + name: str, + value: typing.Optional[typing.Any] = None + ): + self.shipping_key = shipping_key + self.name = name + self.value = value + + super().__init__(action="setShippingCustomField") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderSetShippingCustomFieldAction": + from ._schemas.order import OrderSetShippingCustomFieldActionSchema + + return OrderSetShippingCustomFieldActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.order import OrderSetShippingCustomFieldActionSchema + + return OrderSetShippingCustomFieldActionSchema().dump(self) + + +class OrderSetShippingCustomTypeAction(OrderUpdateAction): + """This action sets, overwrites, or removes any existing Custom Type and Custom Fields for the Order's `shippingMethod` or `shipping`.""" + + #: The `shippingKey` of the [Shipping](ctp:api:type:Shipping) to customize. Used to specify which Shipping Method to customize + #: on a Order with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Leave this empty to customize the one and only ShippingMethod on a `Single` ShippingMode Order. + shipping_key: typing.Optional[str] + #: Defines the [Type](ctp:api:type:Type) that extends the specified ShippingMethod with [Custom Fields](/../api/projects/custom-fields). + #: If absent, any existing Type and Custom Fields are removed from the ShippingMethod. + type: typing.Optional["TypeResourceIdentifier"] + #: Sets the [Custom Fields](/../api/projects/custom-fields) fields for the `shippingMethod`. + fields: typing.Optional["FieldContainer"] + + def __init__( + self, + *, + shipping_key: typing.Optional[str] = None, + type: typing.Optional["TypeResourceIdentifier"] = None, + fields: typing.Optional["FieldContainer"] = None + ): + self.shipping_key = shipping_key + self.type = type + self.fields = fields + + super().__init__(action="setShippingCustomType") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "OrderSetShippingCustomTypeAction": + from ._schemas.order import OrderSetShippingCustomTypeActionSchema + + return OrderSetShippingCustomTypeActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.order import OrderSetShippingCustomTypeActionSchema + + return OrderSetShippingCustomTypeActionSchema().dump(self) + + class OrderSetStoreAction(OrderUpdateAction): """Sets the [Store](ctp:api:type:Store) the Order is assigned to. It should be used to migrate Orders to a new Store. diff --git a/src/commercetools/platform/models/order_edit.py b/src/commercetools/platform/models/order_edit.py index 63e77dd9..a228561f 100644 --- a/src/commercetools/platform/models/order_edit.py +++ b/src/commercetools/platform/models/order_edit.py @@ -207,6 +207,8 @@ "StagedOrderSetShippingAddressAndShippingMethodAction", "StagedOrderSetShippingAddressCustomFieldAction", "StagedOrderSetShippingAddressCustomTypeAction", + "StagedOrderSetShippingCustomFieldAction", + "StagedOrderSetShippingCustomTypeAction", "StagedOrderSetShippingMethodAction", "StagedOrderSetShippingMethodTaxAmountAction", "StagedOrderSetShippingMethodTaxRateAction", @@ -234,9 +236,9 @@ class OrderEdit(BaseResource): comment: typing.Optional[str] #: Custom Fields of the Order Edit. custom: typing.Optional["CustomFields"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the OrderEdit. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the OrderEdit. created_by: typing.Optional["CreatedBy"] def __init__( @@ -284,7 +286,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderEditApply(_BaseType): - """If the `editVersion` and/or `resourceVersion` do not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned.""" + """If the `editVersion` and/or `resourceVersion` do not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned.""" #: Current `version` of the OrderEdit to be applied. edit_version: int @@ -436,6 +438,7 @@ class OrderEditResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.ORDER_EDIT) @classmethod @@ -524,6 +527,7 @@ class OrderEditNotProcessed(OrderEditResult): """Indicates that the edit has not been applied or processed in any way.""" def __init__(self): + super().__init__(type="NotProcessed") @classmethod @@ -595,7 +599,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderEditUpdate(_BaseType): #: Expected version of the Order Edit on which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Order Edit. actions: typing.List["OrderEditUpdateAction"] @@ -704,6 +708,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StagedOrder(Order): + def __init__( self, *, @@ -759,6 +764,7 @@ def __init__( last_modified_by: typing.Optional["LastModifiedBy"] = None, created_by: typing.Optional["CreatedBy"] = None ): + super().__init__( id=id, version=version, @@ -826,7 +832,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderEditAddStagedActionAction(OrderEditUpdateAction): - """If the [edit was applied](ctp:api:endpoint:/{projectKey}/orders/edits/{id}/apply:POST), this cannot be updated.""" + """The `stagedActions` field cannot be updated if the Order Edit `result` is [OrderEdit Applied](/projects/order-edits#orderedit-applied).""" #: Order update action to append to the `stagedActions` array. staged_action: "StagedOrderUpdateAction" @@ -957,7 +963,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class OrderEditSetStagedActionsAction(OrderEditUpdateAction): - """If the [edit is applied](ctp:api:endpoint:/{projectKey}/orders/edits/{id}/apply:POST), `stagedActions` cannot be updated.""" + """The `stagedActions` field cannot be updated if the Order Edit `result` is [OrderEdit Applied](/projects/order-edits#orderedit-applied).""" #: Value to replace the `stagedActions` of the Order Edit. staged_actions: typing.List["StagedOrderUpdateAction"] @@ -1177,7 +1183,7 @@ class StagedOrderAddLineItemAction(StagedOrderUpdateAction): """If the Cart contains a [LineItem](ctp:api:type:LineItem) for a Product Variant with the same [LineItemMode](ctp:api:type:LineItemMode), [Custom Fields](/../api/projects/custom-fields), supply and distribution channel, then only the quantity of the existing Line Item is increased. If [LineItem](ctp:api:type:LineItem) `shippingDetails` is set, it is merged. All addresses will be present afterwards and, for address keys present in both shipping details, the quantity will be summed up. A new Line Item is added when the `externalPrice` or `externalTotalPrice` is set in this update action. - The [LineItem](ctp:api:type:LineItem) price is set as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + The [LineItem](ctp:api:type:LineItem) price is set as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). If the Tax Rate is not set, a [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) error is returned. @@ -1207,7 +1213,7 @@ class StagedOrderAddLineItemAction(StagedOrderUpdateAction): #: #: Optional for backwards compatibility reasons. added_at: typing.Optional[datetime.datetime] - #: Used to [select](/../api/carts-orders-overview#line-item-price-selection) a Product Price. + #: Used to [select](/../api/pricing-and-discounts-overview#line-item-price-selection) a Product Price. #: The Channel must have the `ProductDistribution` [ChannelRoleEnum](ctp:api:type:ChannelRoleEnum). #: If the Cart is bound to a [Store](ctp:api:type:Store) with `distributionChannels` set, the Channel must match one of the Store's distribution channels. distribution_channel: typing.Optional["ChannelResourceIdentifier"] @@ -1218,7 +1224,7 @@ class StagedOrderAddLineItemAction(StagedOrderUpdateAction): external_price: typing.Optional["Money"] #: Sets the [LineItem](ctp:api:type:LineItem) `price` and `totalPrice` values, and the `priceMode` to `ExternalTotal` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). external_total_price: typing.Optional["ExternalLineItemTotalPrice"] - #: External Tax Rate for the Line Item, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode). + #: Sets the external Tax Rate for the Line Item, if the Cart has the `External` [TaxMode](ctp:api:type:TaxMode). If the Cart has `Multiple` [ShippingMode](ctp:api:type:ShippingMode), the Tax Rate is accepted but ignored. external_tax_rate: typing.Optional["ExternalTaxRateDraft"] #: Inventory mode specific to the Line Item only, and valid for the entire `quantity` of the Line Item. #: Set only if the inventory mode should be different from the `inventoryMode` specified on the [Cart](ctp:api:type:Cart). @@ -1532,7 +1538,7 @@ class StagedOrderChangeLineItemQuantityAction(StagedOrderUpdateAction): To change the Line Item quantity and shipping details together, use this update action in combination with the [Set LineItem ShippingDetails](ctp:api:type:StagedOrderSetLineItemShippingDetailsAction) update action in a single Order update command. - The [LineItem](ctp:api:type:LineItem) price is updated as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + The [LineItem](ctp:api:type:LineItem) price is updated as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). """ @@ -1543,11 +1549,13 @@ class StagedOrderChangeLineItemQuantityAction(StagedOrderUpdateAction): #: New value to set. #: If `0`, the LineItem is removed from the Order. quantity: int - #: Sets the [LineItem](ctp:api:type:LineItem) `price` to the given value when changing the quantity of a Line Item with the `ExternalPrice` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). + #: Required when the Line Item uses `ExternalPrice` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). + #: Sets the [LineItem](ctp:api:type:LineItem) `price` to the given value when changing the quantity of a Line Item. #: - #: The [LineItem](ctp:api:type:LineItem) price is updated as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: The [LineItem](ctp:api:type:LineItem) price is updated as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). external_price: typing.Optional["Money"] #: Sets the [LineItem](ctp:api:type:LineItem) `price` and `totalPrice` to the given value when changing the quantity of a Line Item with the `ExternalTotal` [LineItemPriceMode](ctp:api:type:LineItemPriceMode). + #: If `externalTotalPrice` is not given and the `priceMode` is `ExternalTotal`, the external price is unset and the `priceMode` is set to `Platform`. external_total_price: typing.Optional["ExternalLineItemTotalPrice"] def __init__( @@ -1945,7 +1953,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StagedOrderRemoveLineItemAction(StagedOrderUpdateAction): - """The [LineItem](ctp:api:type:LineItem) price is updated as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection).""" + """The [LineItem](ctp:api:type:LineItem) price is updated as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection).""" #: `id` of the [LineItem](ctp:api:type:LineItem) to update. Either `lineItemId` or `lineItemKey` is required. line_item_id: typing.Optional[str] @@ -2536,9 +2544,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StagedOrderSetCustomerGroupAction(StagedOrderUpdateAction): - """This update action can only be used if a Customer is not assigned to a Cart. If a Customer is already assigned, the Cart has the same Customer Group as the assigned Customer. + """This update action can only be used if a Customer is not assigned to a Cart. + If a Customer is already assigned, the Cart uses the Customer Group of the assigned Customer. - Setting the Customer Group also updates the [LineItem](ctp:api:type:LineItem) `prices` according to the Customer Group. + To reflect the new Customer Group, this update action can result in [updates to the Cart](/../carts-orders-overview#cart-updates). When this occurs, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError). """ @@ -3059,7 +3068,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StagedOrderSetLineItemDistributionChannelAction(StagedOrderUpdateAction): - """Setting a distribution channel for a [LineItem](ctp:api:type:LineItem) can lead to an updated `price` as described in [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + """Setting a distribution channel for a [LineItem](ctp:api:type:LineItem) can lead to an updated `price` as described in [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). Produces the [OrderLineItemDistributionChannelSet](ctp:api:type:OrderLineItemDistributionChannelSetMessage) Message. @@ -3184,7 +3193,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StagedOrderSetLineItemTaxAmountAction(StagedOrderUpdateAction): - """Can be used if the Cart has the `ExternalAmount` [TaxMode](ctp:api:type:TaxMode).""" + """Can be used if the Cart has the `ExternalAmount` [TaxMode](ctp:api:type:TaxMode). This update action sets the `taxedPrice` and `taxRate` on a Line Item and must be used after any price-affecting change occurs.""" #: `id` of the [LineItem](ctp:api:type:LineItem) to update. Either `lineItemId` or `lineItemKey` is required. line_item_id: typing.Optional[str] @@ -4011,6 +4020,85 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return StagedOrderSetShippingAddressCustomTypeActionSchema().dump(self) +class StagedOrderSetShippingCustomFieldAction(StagedOrderUpdateAction): + #: The `shippingKey` of the [Shipping](ctp:api:type:Shipping) to customize. Used to specify which Shipping Method to customize + #: on a Order with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Leave this empty to customize the one and only ShippingMethod on a `Single` ShippingMode Order. + shipping_key: typing.Optional[str] + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: If `value` is absent or `null`, this field will be removed if it exists. + #: Trying to remove a field that does not exist will fail with an [InvalidOperation](ctp:api:type:InvalidOperationError) error. + #: If `value` is provided, it is set for the field defined by `name`. + value: typing.Optional[typing.Any] + + def __init__( + self, + *, + shipping_key: typing.Optional[str] = None, + name: str, + value: typing.Optional[typing.Any] = None + ): + self.shipping_key = shipping_key + self.name = name + self.value = value + + super().__init__(action="setShippingCustomField") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "StagedOrderSetShippingCustomFieldAction": + from ._schemas.order_edit import StagedOrderSetShippingCustomFieldActionSchema + + return StagedOrderSetShippingCustomFieldActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.order_edit import StagedOrderSetShippingCustomFieldActionSchema + + return StagedOrderSetShippingCustomFieldActionSchema().dump(self) + + +class StagedOrderSetShippingCustomTypeAction(StagedOrderUpdateAction): + """This action sets, overwrites, or removes any existing Custom Type and Custom Fields for the Order's `shippingMethod` or `shipping`.""" + + #: The `shippingKey` of the [Shipping](ctp:api:type:Shipping) to customize. Used to specify which Shipping Method to customize + #: on a Order with `Multiple` [ShippingMode](ctp:api:type:ShippingMode). + #: Leave this empty to customize the one and only ShippingMethod on a `Single` ShippingMode Order. + shipping_key: typing.Optional[str] + #: Defines the [Type](ctp:api:type:Type) that extends the specified ShippingMethod with [Custom Fields](/../api/projects/custom-fields). + #: If absent, any existing Type and Custom Fields are removed from the ShippingMethod. + type: typing.Optional["TypeResourceIdentifier"] + #: Sets the [Custom Fields](/../api/projects/custom-fields) fields for the `shippingMethod`. + fields: typing.Optional["FieldContainer"] + + def __init__( + self, + *, + shipping_key: typing.Optional[str] = None, + type: typing.Optional["TypeResourceIdentifier"] = None, + fields: typing.Optional["FieldContainer"] = None + ): + self.shipping_key = shipping_key + self.type = type + self.fields = fields + + super().__init__(action="setShippingCustomType") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "StagedOrderSetShippingCustomTypeAction": + from ._schemas.order_edit import StagedOrderSetShippingCustomTypeActionSchema + + return StagedOrderSetShippingCustomTypeActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.order_edit import StagedOrderSetShippingCustomTypeActionSchema + + return StagedOrderSetShippingCustomTypeActionSchema().dump(self) + + class StagedOrderSetShippingMethodAction(StagedOrderUpdateAction): """To set the Cart's Shipping Method, the Cart must have the `Single` [ShippingMode](ctp:api:type:ShippingMode) and a `shippingAddress`.""" diff --git a/src/commercetools/platform/models/payment.py b/src/commercetools/platform/models/payment.py index 2e6d77cd..2048bb24 100644 --- a/src/commercetools/platform/models/payment.py +++ b/src/commercetools/platform/models/payment.py @@ -74,15 +74,15 @@ class Payment(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Payment. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Payment. created_by: typing.Optional["CreatedBy"] #: Reference to a [Customer](ctp:api:type:Customer) associated with the Payment. customer: typing.Optional["CustomerReference"] #: [Anonymous session](ctp:api:type:AnonymousSession) associated with the Payment. anonymous_id: typing.Optional[str] - #: Additional identifier for external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP). + #: Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP). external_id: typing.Optional[str] #: Identifier used by the payment service that processes the Payment (for example, a PSP). #: The combination of `interfaceId` and the `paymentInterface` field on [PaymentMethodInfo](ctp:api:type:PaymentMethodInfo) must be unique. @@ -178,7 +178,7 @@ class PaymentDraft(_BaseType): customer: typing.Optional["CustomerResourceIdentifier"] #: [Anonymous session](ctp:api:type:AnonymousSession) associated with the Payment. anonymous_id: typing.Optional[str] - #: Additional identifier for external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP). + #: Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP). external_id: typing.Optional[str] #: Identifier used by the payment service that processes the Payment (for example, a PSP). #: The combination of `interfaceId` and the `paymentInterface` field on [PaymentMethodInfo](ctp:api:type:PaymentMethodInfo) must be unique. @@ -372,6 +372,7 @@ class PaymentResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.PAYMENT) @classmethod @@ -455,7 +456,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PaymentUpdate(_BaseType): - #: Expected version of the Payment on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: Expected version of the Payment on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Payment. actions: typing.List["PaymentUpdateAction"] @@ -872,7 +874,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PaymentSetAmountPaidAction(PaymentUpdateAction): - #: Draft type that stores amounts only in cent precision for the specified currency. + #: Draft object to store money in cent amounts for a specific currency. amount: typing.Optional["Money"] def __init__(self, *, amount: typing.Optional["Money"] = None): @@ -895,7 +897,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PaymentSetAmountRefundedAction(PaymentUpdateAction): - #: Draft type that stores amounts only in cent precision for the specified currency. + #: Draft object to store money in cent amounts for a specific currency. amount: typing.Optional["Money"] def __init__(self, *, amount: typing.Optional["Money"] = None): @@ -918,8 +920,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PaymentSetAnonymousIdAction(PaymentUpdateAction): - #: Value to set. - #: If empty, any existing value will be removed. + """If the Payment is already associated with a Customer, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned.""" + + #: Value to set. If empty, any existing value will be removed. anonymous_id: typing.Optional[str] def __init__(self, *, anonymous_id: typing.Optional[str] = None): @@ -942,7 +945,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class PaymentSetAuthorizationAction(PaymentUpdateAction): - #: Draft type that stores amounts only in cent precision for the specified currency. + #: Draft object to store money in cent amounts for a specific currency. amount: typing.Optional["Money"] until: typing.Optional[datetime.datetime] diff --git a/src/commercetools/platform/models/product.py b/src/commercetools/platform/models/product.py index 57b46656..42bf8556 100644 --- a/src/commercetools/platform/models/product.py +++ b/src/commercetools/platform/models/product.py @@ -311,9 +311,9 @@ class Product(BaseResource): """ - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Product. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Product. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the Product. #: @@ -496,6 +496,8 @@ class ProductDraft(_BaseType): #: It must match the pattern `[a-zA-Z0-9_\\-]{2,256}`. slug: "LocalizedString" #: User-defined unique identifier for the Product. + #: + #: To update a Product using the [Import API](/../import-export/product), the Product `key` must match the pattern `^[A-Za-z0-9_-]{2,256}$`. key: typing.Optional[str] #: Description of the Product. description: typing.Optional["LocalizedString"] @@ -627,7 +629,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductPriceModeEnum(enum.Enum): - """This mode determines the type of Prices used for [Product Price Selection](ctp:api:type:ProductPriceSelection) and for [LineItem Price selection](ctp:api:type:LineItemPriceSelection).""" + """This mode determines the type of Prices used for [price selection](/../api/pricing-and-discounts-overview#price-selection) by Line Items and Products. + For more information about the difference between the Prices, see [Pricing](/../api/pricing-and-discounts-overview). + + """ EMBEDDED = "Embedded" STANDALONE = "Standalone" @@ -861,6 +866,7 @@ class ProductResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.PRODUCT) @classmethod @@ -878,7 +884,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductUpdate(_BaseType): - #: Expected version of the Product on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: Expected version of the Product on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Product. actions: typing.List["ProductUpdateAction"] @@ -1126,7 +1133,7 @@ class ProductVariant(_BaseType): prices: typing.Optional[typing.List["Price"]] #: Attributes of the Product Variant. attributes: typing.Optional[typing.List["Attribute"]] - #: Only available when [Price selection](#price-selection) is used. + #: Only available when [price selection](/../api/pricing-and-discounts-overview#price-selection) is used. #: Cannot be used in a [Query Predicate](ctp:api:type:QueryPredicate). price: typing.Optional["Price"] #: Images of the Product Variant. @@ -1141,11 +1148,11 @@ class ProductVariant(_BaseType): #: Only available in response to a [Product Projection Search](ctp:api:type:ProductProjectionSearch) request. is_matching_variant: typing.Optional[bool] #: Only available in response to a [Product Projection Search](ctp:api:type:ProductProjectionSearch) request - #: with [price selection](ctp:api:type:ProductPriceSelection). + #: with [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). #: Can be used to sort, [filter](ctp:api:type:ProductProjectionSearchFilterScopedPrice), and facet. scoped_price: typing.Optional["ScopedPrice"] #: Only available in response to a [Product Projection Search](ctp:api:type:ProductProjectionSearchFilterScopedPrice) request - #: with [price selection](ctp:api:type:ProductPriceSelection). + #: with [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). scoped_price_discounted: typing.Optional[bool] def __init__( @@ -1202,6 +1209,10 @@ class ProductVariantAvailability(_BaseType): restockable_in_days: typing.Optional[int] #: Number of items of the Product Variant that are in stock. available_quantity: typing.Optional[int] + #: Unique identifier of the [InventoryEntry](ctp:api:type:InventoryEntry). + id: typing.Optional[str] + #: Current version of the [InventoryEntry](ctp:api:type:InventoryEntry). + version: typing.Optional[int] def __init__( self, @@ -1209,12 +1220,16 @@ def __init__( channels: typing.Optional["ProductVariantChannelAvailabilityMap"] = None, is_on_stock: typing.Optional[bool] = None, restockable_in_days: typing.Optional[int] = None, - available_quantity: typing.Optional[int] = None + available_quantity: typing.Optional[int] = None, + id: typing.Optional[str] = None, + version: typing.Optional[int] = None ): self.channels = channels self.is_on_stock = is_on_stock self.restockable_in_days = restockable_in_days self.available_quantity = available_quantity + self.id = id + self.version = version super().__init__() @@ -1504,6 +1519,7 @@ class WhitespaceTokenizer(SuggestTokenizer): """Creates tokens by splitting the `text` field in [SearchKeyword](ctp:api:type:SearchKeyword) by whitespaces.""" def __init__(self): + super().__init__(type="whitespace") @classmethod @@ -2262,6 +2278,7 @@ class ProductRevertStagedChangesAction(ProductUpdateAction): """Reverts the staged version of a Product to the current version. Produces the [ProductRevertedStagedChanges](ctp:api:type:ProductRevertedStagedChangesMessage) Message.""" def __init__(self): + super().__init__(action="revertStagedChanges") @classmethod @@ -2861,6 +2878,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductSetKeyAction(ProductUpdateAction): #: Value to set. If empty, any existing value will be removed. + #: + #: To update a Product using the [Import API](/../import-export/product), the Product `key` must match the pattern `^[A-Za-z0-9_-]{2,256}$`. key: typing.Optional[str] def __init__(self, *, key: typing.Optional[str] = None): @@ -2974,11 +2993,11 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductSetPriceKeyAction(ProductUpdateAction): - """Sets the key of an [Embedded Price](/projects/products#embedded-price). Produces the [ProductPriceKeySet](ctp:api:type:ProductPriceKeySetMessage) Message.""" + """Sets the key of an [Embedded Price](ctp:api:type:Price). Produces the [ProductPriceKeySet](ctp:api:type:ProductPriceKeySetMessage) Message.""" #: The `id` of the [Price](ctp:api:type:Price) to set the key. price_id: str - #: If `true`, only the staged [Embedded Price](/projects/products#embedded-price) is updated. If `false`, both the current and staged Embedded Price are updated. + #: If `true`, only the staged [Embedded Price](ctp:api:type:Price) is updated. If `false`, both the current and staged Embedded Price are updated. staged: typing.Optional[bool] #: Value to set. If empty, any existing value will be removed. key: typing.Optional[str] @@ -3327,13 +3346,17 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductUnpublishAction(ProductUpdateAction): - """Removes the current [projection](/../api/projects/productProjections#current--staged) of the Product. The staged projection is unaffected. To retrieve unpublished Products, the `staged` parameter must be set to `false` when [querying](/projects/productProjections#query-productprojections)/[searching](/projects/products-search#product-projection-search) Product Projections. Produces the [ProductUnpublished](ctp:api:type:ProductUnpublishedMessage) Message. + """Removes the current [projection](/../api/projects/productProjections#current--staged) of the Product. The staged projection is unaffected. To retrieve unpublished Products, the `staged` parameter must be set to `false` when [querying](ctp:api:endpoint:/{projectKey}/product-projections:GET)/[searching](/projects/products-search#product-projection-search) Product Projections. Produces the [ProductUnpublished](ctp:api:type:ProductUnpublishedMessage) Message. + + When a Product is unpublished, any associated Line Items already present in a Cart remain unaffected and can still be ordered. To prevent this, do the following: - Unpublished Products cannot be added to a Cart. However, if a Cart contains Line Items for Products that were added before the Product was unpublished, the Cart is unaffected and can still be used to create an Order. To prevent this, in addition to unpublishing the Product you should remove the Prices from the Product using [Remove Price](ctp:api:type:ProductRemovePriceAction) for Embedded Prices or [Delete StandalonePrice](/projects/standalone-prices#delete-standaloneprice) for Standalone Prices. + - If the Product uses Embedded Prices, [remove the Embedded Prices](ctp:api:type:ProductRemovePriceAction) from the unpublished Product. + - If the Product uses Standalone Prices, [inactivate](ctp:api:type:StandalonePriceChangeActiveAction) or [delete](/projects/standalone-prices#delete-standaloneprice) the Standalone Prices. """ def __init__(self): + super().__init__(action="unpublish") @classmethod diff --git a/src/commercetools/platform/models/product_discount.py b/src/commercetools/platform/models/product_discount.py index d99b3c8e..566b0241 100644 --- a/src/commercetools/platform/models/product_discount.py +++ b/src/commercetools/platform/models/product_discount.py @@ -55,9 +55,9 @@ class ProductDiscount(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the ProductDiscount. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the ProductDiscount. created_by: typing.Optional["CreatedBy"] #: Name of the ProductDiscount. name: "LocalizedString" @@ -310,6 +310,7 @@ class ProductDiscountResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.PRODUCT_DISCOUNT) @classmethod @@ -327,7 +328,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductDiscountUpdate(_BaseType): - #: Expected version of the ProductDiscount on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the ProductDiscount on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the ProductDiscount. actions: typing.List["ProductDiscountUpdateAction"] @@ -553,6 +555,7 @@ class ProductDiscountValueExternal(ProductDiscountValue): """ def __init__(self): + super().__init__(type="external") @classmethod @@ -576,6 +579,7 @@ class ProductDiscountValueExternalDraft(ProductDiscountValueDraft): """ def __init__(self): + super().__init__(type="external") @classmethod diff --git a/src/commercetools/platform/models/product_search.py b/src/commercetools/platform/models/product_search.py new file mode 100644 index 00000000..f7c8a191 --- /dev/null +++ b/src/commercetools/platform/models/product_search.py @@ -0,0 +1,747 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType +from .error import ErrorResponse +from .search import SearchFieldType, SearchSortOrder + +if typing.TYPE_CHECKING: + from .error import ErrorObject + from .product import ProductProjection + from .search import SearchFieldType, SearchQuery, SearchSorting, SearchSortOrder + +__all__ = [ + "ProductPagedSearchResponse", + "ProductSearchErrorResponse", + "ProductSearchFacetCountExpression", + "ProductSearchFacetCountLevelEnum", + "ProductSearchFacetCountValue", + "ProductSearchFacetDistinctBucketSortBy", + "ProductSearchFacetDistinctBucketSortExpression", + "ProductSearchFacetDistinctExpression", + "ProductSearchFacetDistinctValue", + "ProductSearchFacetExpression", + "ProductSearchFacetRangesExpression", + "ProductSearchFacetRangesFacetRange", + "ProductSearchFacetRangesValue", + "ProductSearchFacetResult", + "ProductSearchFacetResultBucket", + "ProductSearchFacetResultBucketEntry", + "ProductSearchFacetResultCount", + "ProductSearchFacetScope", + "ProductSearchFacetScopeEnum", + "ProductSearchMatchingVariantEntry", + "ProductSearchMatchingVariants", + "ProductSearchProjectionParams", + "ProductSearchRequest", + "ProductSearchResult", +] + + +class ProductPagedSearchResponse(_BaseType): + #: Total number of results matching the query. + total: int + #: Number of [elements skipped](/../api/general-concepts#offset). + offset: int + #: Number of [results requested](/../api/general-concepts#limit). + limit: int + #: Results for [facets](/../api/projects/product-search#facets) when requested. + facets: typing.List["ProductSearchFacetResult"] + #: Search result containing the Products matching the search query. + results: typing.List["ProductSearchResult"] + + def __init__( + self, + *, + total: int, + offset: int, + limit: int, + facets: typing.List["ProductSearchFacetResult"], + results: typing.List["ProductSearchResult"] + ): + self.total = total + self.offset = offset + self.limit = limit + self.facets = facets + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductPagedSearchResponse": + from ._schemas.product_search import ProductPagedSearchResponseSchema + + return ProductPagedSearchResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductPagedSearchResponseSchema + + return ProductPagedSearchResponseSchema().dump(self) + + +class ProductSearchErrorResponse(ErrorResponse): + + def __init__( + self, + *, + status_code: int, + message: str, + errors: typing.Optional[typing.List["ErrorObject"]] = None + ): + + super().__init__(status_code=status_code, message=message, errors=errors) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchErrorResponse": + from ._schemas.product_search import ProductSearchErrorResponseSchema + + return ProductSearchErrorResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchErrorResponseSchema + + return ProductSearchErrorResponseSchema().dump(self) + + +class ProductSearchMatchingVariantEntry(_BaseType): + #: Unique identifier of the variant. + id: int + #: SKU of the matching variant. + sku: typing.Optional[str] + + def __init__(self, *, id: int, sku: typing.Optional[str] = None): + self.id = id + self.sku = sku + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchMatchingVariantEntry": + from ._schemas.product_search import ProductSearchMatchingVariantEntrySchema + + return ProductSearchMatchingVariantEntrySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchMatchingVariantEntrySchema + + return ProductSearchMatchingVariantEntrySchema().dump(self) + + +class ProductSearchMatchingVariants(_BaseType): + #: Whether the search criteria definitely matches all Variants of the returned Product, like for Product-level fields. Is always `false` for search expressions on Variant-level fields. + all_matched: bool + #: The variants matching the search criteria or empty if all matched. + matched_variants: typing.List["ProductSearchMatchingVariantEntry"] + + def __init__( + self, + *, + all_matched: bool, + matched_variants: typing.List["ProductSearchMatchingVariantEntry"] + ): + self.all_matched = all_matched + self.matched_variants = matched_variants + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchMatchingVariants": + from ._schemas.product_search import ProductSearchMatchingVariantsSchema + + return ProductSearchMatchingVariantsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchMatchingVariantsSchema + + return ProductSearchMatchingVariantsSchema().dump(self) + + +class ProductSearchProjectionParams(_BaseType): + #: Expands a `value` of type [Reference](ctp:api:type:Reference) in a [ProductProjection](ctp:api:type:ProductProjection). + #: In case the referenced object does not exist, the API returns the non-expanded reference. + expand: typing.Optional[typing.List["str"]] + #: Set to `true` to retrieve the [staged](ctp:api:type:CurrentStaged) Product Projection + staged: typing.Optional[bool] + #: The currency used for [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). + price_currency: typing.Optional[str] + #: The country used for [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). Can only be used **in conjunction with** the `priceCurrency` parameter. + price_country: typing.Optional[str] + #: `id` of an existing [CustomerGroup](ctp:api:type:CustomerGroup) used for [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). Can only be used **in conjunction with** the `priceCurrency` parameter. + price_customer_group: typing.Optional[str] + #: `id` of an existing [Channel](ctp:api:type:Channel) used for [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). Can only be used **in conjunction with** the `priceCurrency` parameter. + price_channel: typing.Optional[str] + #: Used for [locale-based projection](ctp:api:type:ProductProjectionLocales). + locale_projection: typing.Optional[typing.List["str"]] + #: `key` of an existing [Store](ctp:api:type:Store). + #: If the Store has defined some languages, countries, distribution or supply Channels, + #: they are used for projections based on [locale](ctp:api:type:ProductProjectionLocales), [price](ctp:api:type:ProductProjectionPrices), + #: and [inventory](ctp:api:type:ProductProjectionInventoryEntries). + #: If the Store has defined [Product Selections](ctp:api:type:ProductSelection) or [Product Tailoring](ctp:api:type:ProductTailoring), they have no effect on the results of this query. + store_projection: typing.Optional[str] + + def __init__( + self, + *, + expand: typing.Optional[typing.List["str"]] = None, + staged: typing.Optional[bool] = None, + price_currency: typing.Optional[str] = None, + price_country: typing.Optional[str] = None, + price_customer_group: typing.Optional[str] = None, + price_channel: typing.Optional[str] = None, + locale_projection: typing.Optional[typing.List["str"]] = None, + store_projection: typing.Optional[str] = None + ): + self.expand = expand + self.staged = staged + self.price_currency = price_currency + self.price_country = price_country + self.price_customer_group = price_customer_group + self.price_channel = price_channel + self.locale_projection = locale_projection + self.store_projection = store_projection + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchProjectionParams": + from ._schemas.product_search import ProductSearchProjectionParamsSchema + + return ProductSearchProjectionParamsSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchProjectionParamsSchema + + return ProductSearchProjectionParamsSchema().dump(self) + + +class ProductSearchRequest(_BaseType): + #: The search query against [searchable Product fields](/../api/projects/product-search#searchable-product-fields). + query: typing.Optional["SearchQuery"] + #: Controls how results to your query are sorted. If not provided, the results are sorted by relevance in descending order. + sort: typing.Optional[typing.List["SearchSorting"]] + #: The maximum number of search results to be returned. + limit: typing.Optional[int] + #: The number of search results to be skipped in the response for pagination. + offset: typing.Optional[int] + #: The search can return Products where not all Product Variants match the search criteria. If `true`, the response will include a field called `matchingVariants` that contains the `sku` of Product Variants that match the search query. If the query does not specify any variant-level criteria, `matchingVariants` will be null signifying that all Product Variants are a match. + mark_matching_variants: typing.Optional[bool] + #: Set this field to `{}` to get the [ProductProjection](ctp:api:type:ProductProjection) included in the [ProductSearchResult](ctp:api:type:ProductSearchResult). + #: Include query parameters for controlling [Reference Expansion](/../api/general-concepts#reference-expansion) or [projections](/../api/projects/productProjections#projection-dimensions) according to your needs. + #: If not set, the result does not include the Product Projection. + product_projection_parameters: typing.Optional["ProductSearchProjectionParams"] + #: Set this field to request [facets](/../api/projects/product-search#facets). + facets: typing.Optional[typing.List["ProductSearchFacetExpression"]] + #: Specify an additional filter on the result of the `query` after the API calculated `facets`. + #: This feature assists you in implementing faceted search. + post_filter: typing.Optional["SearchQuery"] + + def __init__( + self, + *, + query: typing.Optional["SearchQuery"] = None, + sort: typing.Optional[typing.List["SearchSorting"]] = None, + limit: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + mark_matching_variants: typing.Optional[bool] = None, + product_projection_parameters: typing.Optional[ + "ProductSearchProjectionParams" + ] = None, + facets: typing.Optional[typing.List["ProductSearchFacetExpression"]] = None, + post_filter: typing.Optional["SearchQuery"] = None + ): + self.query = query + self.sort = sort + self.limit = limit + self.offset = offset + self.mark_matching_variants = mark_matching_variants + self.product_projection_parameters = product_projection_parameters + self.facets = facets + self.post_filter = post_filter + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductSearchRequest": + from ._schemas.product_search import ProductSearchRequestSchema + + return ProductSearchRequestSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchRequestSchema + + return ProductSearchRequestSchema().dump(self) + + +class ProductSearchResult(_BaseType): + #: Unique identifier of the Product. + id: str + #: Contains Product Projection data for Products matching the `projection` field in the Search Products request. + product_projection: typing.Optional["ProductProjection"] + #: Describes the variants that matched the search criteria. + matching_variants: typing.Optional["ProductSearchMatchingVariants"] + + def __init__( + self, + *, + id: str, + product_projection: typing.Optional["ProductProjection"] = None, + matching_variants: typing.Optional["ProductSearchMatchingVariants"] = None + ): + self.id = id + self.product_projection = product_projection + self.matching_variants = matching_variants + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductSearchResult": + from ._schemas.product_search import ProductSearchResultSchema + + return ProductSearchResultSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchResultSchema + + return ProductSearchResultSchema().dump(self) + + +class ProductSearchFacetCountLevelEnum(enum.Enum): + PRODUCTS = "products" + VARIANTS = "variants" + + +class ProductSearchFacetCountValue(_BaseType): + #: Name of the count facet to appear in the [ProductSearchFacetResultCount](ctp:api:type:ProductSearchFacetResultCount). + name: str + #: Whether the facet must consider only the Products resulting from the search (`query`) or all the Products (`all`). + scope: typing.Optional["ProductSearchFacetScopeEnum"] + #: Additional filtering expression to apply to the search result before calculating the facet. + filter: typing.Optional["SearchQuery"] + #: Specify whether to count Products (`products`) or Product Variants (`variants`). + level: typing.Optional["ProductSearchFacetCountLevelEnum"] + + def __init__( + self, + *, + name: str, + scope: typing.Optional["ProductSearchFacetScopeEnum"] = None, + filter: typing.Optional["SearchQuery"] = None, + level: typing.Optional["ProductSearchFacetCountLevelEnum"] = None + ): + self.name = name + self.scope = scope + self.filter = filter + self.level = level + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetCountValue": + from ._schemas.product_search import ProductSearchFacetCountValueSchema + + return ProductSearchFacetCountValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetCountValueSchema + + return ProductSearchFacetCountValueSchema().dump(self) + + +class ProductSearchFacetDistinctBucketSortBy(enum.Enum): + COUNT = "count" + KEY = "key" + + +class ProductSearchFacetDistinctBucketSortExpression(_BaseType): + #: Defines whether to sort by bucket count or key. + by: "ProductSearchFacetDistinctBucketSortBy" + #: Defines the sorting order. + order: "SearchSortOrder" + + def __init__( + self, *, by: "ProductSearchFacetDistinctBucketSortBy", order: "SearchSortOrder" + ): + self.by = by + self.order = order + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetDistinctBucketSortExpression": + from ._schemas.product_search import ( + ProductSearchFacetDistinctBucketSortExpressionSchema, + ) + + return ProductSearchFacetDistinctBucketSortExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ( + ProductSearchFacetDistinctBucketSortExpressionSchema, + ) + + return ProductSearchFacetDistinctBucketSortExpressionSchema().dump(self) + + +class ProductSearchFacetDistinctValue(_BaseType): + #: Name of the distinct facet to appear in the [ProductSearchFacetResultBucket](ctp:api:type:ProductSearchFacetResultBucket). + name: str + #: Whether the facet must consider only the Products resulting from the search (`query`) or all the Products (`all`). + scope: typing.Optional["ProductSearchFacetScopeEnum"] + #: Additional filtering expression to apply to the search result before calculating the facet. + filter: typing.Optional["SearchQuery"] + #: Specify whether to count Products (`products`) or Product Variants (`variants`). + level: typing.Optional["ProductSearchFacetCountLevelEnum"] + #: The [searchable Product field](/api/projects/product-search#searchable-product-fields) to facet on. + field: str + #: Specify which bucket keys the facets results should include. + includes: typing.Optional[typing.List["str"]] + #: Define how the buckets are sorted. + sort: typing.Optional["ProductSearchFacetDistinctBucketSortExpression"] + #: Maximum number of buckets to return. + limit: typing.Optional[int] + #: String value specifying linguistic and regional preferences using the [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag), as described in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). The format combines language, script, and region using hyphen-separated subtags. For example: `en`, `en-US`, `zh-Hans-SG`. + language: typing.Optional[str] + #: If the `field` is not standard, this must be the Attribute type. + field_type: typing.Optional["SearchFieldType"] + #: Default value to use if the specified field is not present on some Products. + missing: typing.Optional[str] + + def __init__( + self, + *, + name: str, + scope: typing.Optional["ProductSearchFacetScopeEnum"] = None, + filter: typing.Optional["SearchQuery"] = None, + level: typing.Optional["ProductSearchFacetCountLevelEnum"] = None, + field: str, + includes: typing.Optional[typing.List["str"]] = None, + sort: typing.Optional["ProductSearchFacetDistinctBucketSortExpression"] = None, + limit: typing.Optional[int] = None, + language: typing.Optional[str] = None, + field_type: typing.Optional["SearchFieldType"] = None, + missing: typing.Optional[str] = None + ): + self.name = name + self.scope = scope + self.filter = filter + self.level = level + self.field = field + self.includes = includes + self.sort = sort + self.limit = limit + self.language = language + self.field_type = field_type + self.missing = missing + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetDistinctValue": + from ._schemas.product_search import ProductSearchFacetDistinctValueSchema + + return ProductSearchFacetDistinctValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetDistinctValueSchema + + return ProductSearchFacetDistinctValueSchema().dump(self) + + +class ProductSearchFacetExpression(typing.Dict[str, typing.Any]): + pass + + +class ProductSearchFacetCountExpression(ProductSearchFacetExpression): + #: Definition of the count facet. + count: "ProductSearchFacetCountValue" + + def __init__(self, *, count: "ProductSearchFacetCountValue"): + self.count = count + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetCountExpression": + from ._schemas.product_search import ProductSearchFacetCountExpressionSchema + + return ProductSearchFacetCountExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetCountExpressionSchema + + return ProductSearchFacetCountExpressionSchema().dump(self) + + +class ProductSearchFacetDistinctExpression(ProductSearchFacetExpression): + #: Definition of the distinct facet. + distinct: "ProductSearchFacetDistinctValue" + + def __init__(self, *, distinct: "ProductSearchFacetDistinctValue"): + self.distinct = distinct + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetDistinctExpression": + from ._schemas.product_search import ProductSearchFacetDistinctExpressionSchema + + return ProductSearchFacetDistinctExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetDistinctExpressionSchema + + return ProductSearchFacetDistinctExpressionSchema().dump(self) + + +class ProductSearchFacetRangesExpression(ProductSearchFacetExpression): + #: Definition of the ranges facet. + ranges: "ProductSearchFacetRangesValue" + + def __init__(self, *, ranges: "ProductSearchFacetRangesValue"): + self.ranges = ranges + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetRangesExpression": + from ._schemas.product_search import ProductSearchFacetRangesExpressionSchema + + return ProductSearchFacetRangesExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetRangesExpressionSchema + + return ProductSearchFacetRangesExpressionSchema().dump(self) + + +class ProductSearchFacetRangesFacetRange(_BaseType): + """Values for `from` and `to` must be a number or [DateTime](ctp:api:type:DateTime).""" + + #: Starting value of the bucket (inclusive). + from_: typing.Optional[typing.Any] + #: Ending value of the bucket (non-inclusive). + to: typing.Optional[typing.Any] + #: Key to assign the bucket. + key: typing.Optional[str] + + def __init__( + self, + *, + from_: typing.Optional[typing.Any] = None, + to: typing.Optional[typing.Any] = None, + key: typing.Optional[str] = None + ): + self.from_ = from_ + self.to = to + self.key = key + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetRangesFacetRange": + from ._schemas.product_search import ProductSearchFacetRangesFacetRangeSchema + + return ProductSearchFacetRangesFacetRangeSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetRangesFacetRangeSchema + + return ProductSearchFacetRangesFacetRangeSchema().dump(self) + + +class ProductSearchFacetRangesValue(_BaseType): + #: Name of the ranges facet to appear in the [ProductSearchFacetResultBucket](ctp:api:type:ProductSearchFacetResultBucket). + name: str + #: Whether the facet must consider only the Products resulting from the search (`query`) or all the Products (`all`). + scope: typing.Optional["ProductSearchFacetScopeEnum"] + #: Additional filtering expression to apply to the search result before calculating the facet. + filter: typing.Optional["SearchQuery"] + #: Specify whether to count Products (`products`) or Product Variants (`variants`). + level: typing.Optional["ProductSearchFacetCountLevelEnum"] + #: The [searchable Product field](/api/projects/product-search#searchable-product-fields) to facet on. + field: str + #: Define ranges for the facet. + ranges: typing.List["ProductSearchFacetRangesFacetRange"] + #: String value specifying linguistic and regional preferences using the [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag), as described in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). The format combines language, script, and region using hyphen-separated subtags. For example: `en`, `en-US`, `zh-Hans-SG`. + language: typing.Optional[str] + #: If the `field` is not standard, this must be the Attribute type. + field_type: typing.Optional["SearchFieldType"] + + def __init__( + self, + *, + name: str, + scope: typing.Optional["ProductSearchFacetScopeEnum"] = None, + filter: typing.Optional["SearchQuery"] = None, + level: typing.Optional["ProductSearchFacetCountLevelEnum"] = None, + field: str, + ranges: typing.List["ProductSearchFacetRangesFacetRange"], + language: typing.Optional[str] = None, + field_type: typing.Optional["SearchFieldType"] = None + ): + self.name = name + self.scope = scope + self.filter = filter + self.level = level + self.field = field + self.ranges = ranges + self.language = language + self.field_type = field_type + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetRangesValue": + from ._schemas.product_search import ProductSearchFacetRangesValueSchema + + return ProductSearchFacetRangesValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetRangesValueSchema + + return ProductSearchFacetRangesValueSchema().dump(self) + + +class ProductSearchFacetResult(_BaseType): + #: Name of the facet. + name: str + + def __init__(self, *, name: str): + self.name = name + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetResult": + from ._schemas.product_search import ProductSearchFacetResultSchema + + return ProductSearchFacetResultSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetResultSchema + + return ProductSearchFacetResultSchema().dump(self) + + +class ProductSearchFacetResultBucket(ProductSearchFacetResult): + """Result of a [distinct facet](/../api/projects/product-search#distinct-facets) or a [ranges facet](/../api/projects/product-search#ranges-facets).""" + + #: Contains results of the facet. + buckets: typing.List["ProductSearchFacetResultBucketEntry"] + + def __init__( + self, *, name: str, buckets: typing.List["ProductSearchFacetResultBucketEntry"] + ): + self.buckets = buckets + + super().__init__(name=name) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetResultBucket": + from ._schemas.product_search import ProductSearchFacetResultBucketSchema + + return ProductSearchFacetResultBucketSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetResultBucketSchema + + return ProductSearchFacetResultBucketSchema().dump(self) + + +class ProductSearchFacetResultBucketEntry(_BaseType): + #: Key of the bucket. + key: str + #: Number of values in the bucket. + count: int + + def __init__(self, *, key: str, count: int): + self.key = key + self.count = count + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetResultBucketEntry": + from ._schemas.product_search import ProductSearchFacetResultBucketEntrySchema + + return ProductSearchFacetResultBucketEntrySchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetResultBucketEntrySchema + + return ProductSearchFacetResultBucketEntrySchema().dump(self) + + +class ProductSearchFacetResultCount(ProductSearchFacetResult): + """Result of a [count facet](/../api/projects/product-search#count-facets).""" + + #: Number of Products (or Product Variants) matching the query. + value: int + + def __init__(self, *, name: str, value: int): + self.value = value + + super().__init__(name=name) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductSearchFacetResultCount": + from ._schemas.product_search import ProductSearchFacetResultCountSchema + + return ProductSearchFacetResultCountSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_search import ProductSearchFacetResultCountSchema + + return ProductSearchFacetResultCountSchema().dump(self) + + +class ProductSearchFacetScope(enum.Enum): + ALL = "all" + QUERY = "query" + + +class ProductSearchFacetScopeEnum(enum.Enum): + ALL = "all" + QUERY = "query" diff --git a/src/commercetools/platform/models/product_selection.py b/src/commercetools/platform/models/product_selection.py index b416fdd3..6c8bcd84 100644 --- a/src/commercetools/platform/models/product_selection.py +++ b/src/commercetools/platform/models/product_selection.py @@ -198,9 +198,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductSelection(BaseResource): - #: Present on resources updated after 1/02/2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: Present on resources updated after 1/02/2019 except for [events not tracked](/../api/general-concepts#events-tracked). last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1/02/2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: Present on resources created after 1/02/2019 except for [events not tracked](/../api/general-concepts#events-tracked). created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the ProductSelection. key: typing.Optional[str] @@ -494,6 +494,7 @@ class ProductSelectionResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.PRODUCT_SELECTION) @classmethod diff --git a/src/commercetools/platform/models/product_tailoring.py b/src/commercetools/platform/models/product_tailoring.py new file mode 100644 index 00000000..97fa6a91 --- /dev/null +++ b/src/commercetools/platform/models/product_tailoring.py @@ -0,0 +1,1809 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType +from .common import BaseResource, Reference, ReferenceTypeId, ResourceIdentifier + +if typing.TYPE_CHECKING: + from .common import ( + Asset, + AssetDraft, + AssetSource, + CreatedBy, + Image, + LastModifiedBy, + LocalizedString, + ReferenceTypeId, + ) + from .product import ProductReference, ProductResourceIdentifier + from .store import StoreKeyReference, StoreResourceIdentifier + from .type import FieldContainer, TypeResourceIdentifier + +__all__ = [ + "ProductTailoring", + "ProductTailoringAddAssetAction", + "ProductTailoringAddExternalImageAction", + "ProductTailoringAddVariantAction", + "ProductTailoringChangeAssetNameAction", + "ProductTailoringChangeAssetOrderAction", + "ProductTailoringData", + "ProductTailoringDraft", + "ProductTailoringInStoreDraft", + "ProductTailoringMoveImageToPositionAction", + "ProductTailoringPagedQueryResponse", + "ProductTailoringPublishAction", + "ProductTailoringReference", + "ProductTailoringRemoveAssetAction", + "ProductTailoringRemoveImageAction", + "ProductTailoringRemoveVariantAction", + "ProductTailoringResourceIdentifier", + "ProductTailoringSetAssetCustomFieldAction", + "ProductTailoringSetAssetCustomTypeAction", + "ProductTailoringSetAssetDescriptionAction", + "ProductTailoringSetAssetKeyAction", + "ProductTailoringSetAssetSourcesAction", + "ProductTailoringSetAssetTagsAction", + "ProductTailoringSetDescriptionAction", + "ProductTailoringSetExternalImagesAction", + "ProductTailoringSetImageLabelAction", + "ProductTailoringSetMetaAttributesAction", + "ProductTailoringSetMetaDescriptionAction", + "ProductTailoringSetMetaKeywordsAction", + "ProductTailoringSetMetaTitleAction", + "ProductTailoringSetNameAction", + "ProductTailoringSetSlugAction", + "ProductTailoringUnpublishAction", + "ProductTailoringUpdateAction", + "ProductVariantTailoring", + "ProductVariantTailoringDraft", +] + + +class ProductTailoring(BaseResource): + """A single ProductTailoring representation contains the _current_ and the _staged_ representation of its product data tailored per Store.""" + + #: IDs and references that last modified the ProductTailoring. + last_modified_by: typing.Optional["LastModifiedBy"] + #: IDs and references that created the ProductTailoring. + created_by: typing.Optional["CreatedBy"] + #: User-defined unique identifier of the ProductTailoring. + key: typing.Optional[str] + #: The Store to which the ProductTailoring belongs. + store: "StoreKeyReference" + #: Reference to the Product the ProductTailoring belongs to. + product: "ProductReference" + #: `true` if the ProductTailoring is published. + published: bool + #: Current (published) data of the ProductTailoring. + current: "ProductTailoringData" + #: Staged (unpublished) data of the ProductTailoring. + staged: "ProductTailoringData" + #: `true` if the `staged` data is different from the `current` data. + has_staged_changes: bool + + def __init__( + self, + *, + id: str, + version: int, + created_at: datetime.datetime, + last_modified_at: datetime.datetime, + last_modified_by: typing.Optional["LastModifiedBy"] = None, + created_by: typing.Optional["CreatedBy"] = None, + key: typing.Optional[str] = None, + store: "StoreKeyReference", + product: "ProductReference", + published: bool, + current: "ProductTailoringData", + staged: "ProductTailoringData", + has_staged_changes: bool + ): + self.last_modified_by = last_modified_by + self.created_by = created_by + self.key = key + self.store = store + self.product = product + self.published = published + self.current = current + self.staged = staged + self.has_staged_changes = has_staged_changes + + super().__init__( + id=id, + version=version, + created_at=created_at, + last_modified_at=last_modified_at, + ) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductTailoring": + from ._schemas.product_tailoring import ProductTailoringSchema + + return ProductTailoringSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringSchema + + return ProductTailoringSchema().dump(self) + + +class ProductTailoringData(_BaseType): + """Contains all the tailored data of a Product.""" + + #: Tailored name of the Product. + name: typing.Optional["LocalizedString"] + #: Tailored description of the Product. + description: typing.Optional["LocalizedString"] + #: Tailored title of the Product used by external search engines for improved search engine performance. + meta_title: typing.Optional["LocalizedString"] + #: Tailored description of the Product used by external search engines for improved search engine performance. + meta_description: typing.Optional["LocalizedString"] + #: Tailored keywords related to the Product used by external search engines for improved search engine performance. + meta_keywords: typing.Optional["LocalizedString"] + #: User-defined identifier used in a deep-link URL for the ProductTailoring. + #: Matches the pattern `[a-zA-Z0-9_\\-]{2,256}`. + slug: typing.Optional["LocalizedString"] + #: Tailored Variants of the Product. + variants: typing.Optional[typing.List["ProductVariantTailoring"]] + + def __init__( + self, + *, + name: typing.Optional["LocalizedString"] = None, + description: typing.Optional["LocalizedString"] = None, + meta_title: typing.Optional["LocalizedString"] = None, + meta_description: typing.Optional["LocalizedString"] = None, + meta_keywords: typing.Optional["LocalizedString"] = None, + slug: typing.Optional["LocalizedString"] = None, + variants: typing.Optional[typing.List["ProductVariantTailoring"]] = None + ): + self.name = name + self.description = description + self.meta_title = meta_title + self.meta_description = meta_description + self.meta_keywords = meta_keywords + self.slug = slug + self.variants = variants + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductTailoringData": + from ._schemas.product_tailoring import ProductTailoringDataSchema + + return ProductTailoringDataSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringDataSchema + + return ProductTailoringDataSchema().dump(self) + + +class ProductTailoringDraft(_BaseType): + """Contains all the tailored data of a Product.""" + + #: User-defined unique identifier of the ProductTailoring. + key: typing.Optional[str] + #: The Store to which the ProductTailoring belongs. + store: "StoreResourceIdentifier" + #: ResourceIdentifier of the Product the ProductTailoring belongs to. + product: "ProductResourceIdentifier" + #: Tailored name of the Product. + name: typing.Optional["LocalizedString"] + #: Tailored description of the Product. + description: typing.Optional["LocalizedString"] + #: Tailored title of the Product used by external search engines for improved search engine performance. + meta_title: typing.Optional["LocalizedString"] + #: Tailored description of the Product used by external search engines for improved search engine performance. + meta_description: typing.Optional["LocalizedString"] + #: Tailored keywords related to the Product used by external search engines for improved search engine performance. + meta_keywords: typing.Optional["LocalizedString"] + #: User-defined identifier used in a deep-link URL for the ProductTailoring. + #: Matches the pattern `[a-zA-Z0-9_\\-]{2,256}`. + slug: typing.Optional["LocalizedString"] + #: If `true`, the ProductTailoring is published immediately. + publish: typing.Optional[bool] + #: Tailored Variants of the Product. + variants: typing.Optional[typing.List["ProductVariantTailoringDraft"]] + + def __init__( + self, + *, + key: typing.Optional[str] = None, + store: "StoreResourceIdentifier", + product: "ProductResourceIdentifier", + name: typing.Optional["LocalizedString"] = None, + description: typing.Optional["LocalizedString"] = None, + meta_title: typing.Optional["LocalizedString"] = None, + meta_description: typing.Optional["LocalizedString"] = None, + meta_keywords: typing.Optional["LocalizedString"] = None, + slug: typing.Optional["LocalizedString"] = None, + publish: typing.Optional[bool] = None, + variants: typing.Optional[typing.List["ProductVariantTailoringDraft"]] = None + ): + self.key = key + self.store = store + self.product = product + self.name = name + self.description = description + self.meta_title = meta_title + self.meta_description = meta_description + self.meta_keywords = meta_keywords + self.slug = slug + self.publish = publish + self.variants = variants + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProductTailoringDraft": + from ._schemas.product_tailoring import ProductTailoringDraftSchema + + return ProductTailoringDraftSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringDraftSchema + + return ProductTailoringDraftSchema().dump(self) + + +class ProductTailoringInStoreDraft(_BaseType): + """Contains all the tailored data of a Product for a specific Store.""" + + #: User-defined unique identifier of the ProductTailoring. + key: typing.Optional[str] + #: ResourceIdentifier of the Product the ProductTailoring belongs to. + product: "ProductResourceIdentifier" + #: Tailored name of the Product. + name: typing.Optional["LocalizedString"] + #: Tailored description of the Product. + description: typing.Optional["LocalizedString"] + #: Tailored title of the Product used by external search engines for improved search engine performance. + meta_title: typing.Optional["LocalizedString"] + #: Tailored description of the Product used by external search engines for improved search engine performance. + meta_description: typing.Optional["LocalizedString"] + #: Tailored keywords related to the Product used by external search engines for improved search engine performance. + meta_keywords: typing.Optional["LocalizedString"] + #: User-defined identifier used in a deep-link URL for the ProductTailoring. + #: Matches the pattern `[a-zA-Z0-9_\\-]{2,256}`. + slug: typing.Optional["LocalizedString"] + #: If `true`, the ProductTailoring is published immediately. + publish: typing.Optional[bool] + #: Tailored Variants of the Product. + variants: typing.Optional[typing.List["ProductVariantTailoringDraft"]] + + def __init__( + self, + *, + key: typing.Optional[str] = None, + product: "ProductResourceIdentifier", + name: typing.Optional["LocalizedString"] = None, + description: typing.Optional["LocalizedString"] = None, + meta_title: typing.Optional["LocalizedString"] = None, + meta_description: typing.Optional["LocalizedString"] = None, + meta_keywords: typing.Optional["LocalizedString"] = None, + slug: typing.Optional["LocalizedString"] = None, + publish: typing.Optional[bool] = None, + variants: typing.Optional[typing.List["ProductVariantTailoringDraft"]] = None + ): + self.key = key + self.product = product + self.name = name + self.description = description + self.meta_title = meta_title + self.meta_description = meta_description + self.meta_keywords = meta_keywords + self.slug = slug + self.publish = publish + self.variants = variants + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringInStoreDraft": + from ._schemas.product_tailoring import ProductTailoringInStoreDraftSchema + + return ProductTailoringInStoreDraftSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringInStoreDraftSchema + + return ProductTailoringInStoreDraftSchema().dump(self) + + +class ProductTailoringPagedQueryResponse(_BaseType): + """[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [ProductTailoring](ctp:api:type:ProductTailoring).""" + + #: Number of [results requested](/../api/general-concepts#limit). + limit: int + #: Number of [elements skipped](/../api/general-concepts#offset). + offset: int + #: Actual number of results returned. + count: int + #: Total number of results matching the query. + #: This number is an estimation that is not [strongly consistent](/../api/general-concepts#strong-consistency). + #: This field is returned by default. + #: For improved performance, calculating this field can be deactivated by using the query parameter `withTotal=false`. + #: When the results are filtered with a [Query Predicate](/../api/predicates/query), `total` is subject to a [limit](/../api/limits#queries). + total: typing.Optional[int] + #: [ProductTailoring](ctp:api:type:ProductTailoring) list matching the query. + results: typing.List["ProductTailoring"] + + def __init__( + self, + *, + limit: int, + offset: int, + count: int, + total: typing.Optional[int] = None, + results: typing.List["ProductTailoring"] + ): + self.limit = limit + self.offset = offset + self.count = count + self.total = total + self.results = results + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringPagedQueryResponse": + from ._schemas.product_tailoring import ProductTailoringPagedQueryResponseSchema + + return ProductTailoringPagedQueryResponseSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringPagedQueryResponseSchema + + return ProductTailoringPagedQueryResponseSchema().dump(self) + + +class ProductTailoringReference(Reference): + """[Reference](ctp:api:type:Reference) to a [ProductTailoring](ctp:api:type:ProductTailoring).""" + + #: Contains the representation of the expanded ProductTailoring. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for ProductTailoring. + obj: typing.Optional["ProductTailoring"] + + def __init__(self, *, id: str, obj: typing.Optional["ProductTailoring"] = None): + self.obj = obj + + super().__init__(id=id, type_id=ReferenceTypeId.PRODUCT_TAILORING) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringReference": + from ._schemas.product_tailoring import ProductTailoringReferenceSchema + + return ProductTailoringReferenceSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringReferenceSchema + + return ProductTailoringReferenceSchema().dump(self) + + +class ProductTailoringResourceIdentifier(ResourceIdentifier): + """[ResourceIdentifier](ctp:api:type:ResourceIdentifier) to a [ProductTailoring](ctp:api:type:ProductTailoring).""" + + def __init__( + self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None + ): + + super().__init__(id=id, key=key, type_id=ReferenceTypeId.PRODUCT_TAILORING) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringResourceIdentifier": + from ._schemas.product_tailoring import ProductTailoringResourceIdentifierSchema + + return ProductTailoringResourceIdentifierSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringResourceIdentifierSchema + + return ProductTailoringResourceIdentifierSchema().dump(self) + + +class ProductTailoringUpdateAction(_BaseType): + action: str + + def __init__(self, *, action: str): + self.action = action + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringUpdateAction": + if data["action"] == "addAsset": + from ._schemas.product_tailoring import ProductTailoringAddAssetActionSchema + + return ProductTailoringAddAssetActionSchema().load(data) + if data["action"] == "addExternalImage": + from ._schemas.product_tailoring import ( + ProductTailoringAddExternalImageActionSchema, + ) + + return ProductTailoringAddExternalImageActionSchema().load(data) + if data["action"] == "addVariant": + from ._schemas.product_tailoring import ( + ProductTailoringAddVariantActionSchema, + ) + + return ProductTailoringAddVariantActionSchema().load(data) + if data["action"] == "changeAssetName": + from ._schemas.product_tailoring import ( + ProductTailoringChangeAssetNameActionSchema, + ) + + return ProductTailoringChangeAssetNameActionSchema().load(data) + if data["action"] == "changeAssetOrder": + from ._schemas.product_tailoring import ( + ProductTailoringChangeAssetOrderActionSchema, + ) + + return ProductTailoringChangeAssetOrderActionSchema().load(data) + if data["action"] == "moveImageToPosition": + from ._schemas.product_tailoring import ( + ProductTailoringMoveImageToPositionActionSchema, + ) + + return ProductTailoringMoveImageToPositionActionSchema().load(data) + if data["action"] == "publish": + from ._schemas.product_tailoring import ProductTailoringPublishActionSchema + + return ProductTailoringPublishActionSchema().load(data) + if data["action"] == "removeAsset": + from ._schemas.product_tailoring import ( + ProductTailoringRemoveAssetActionSchema, + ) + + return ProductTailoringRemoveAssetActionSchema().load(data) + if data["action"] == "removeImage": + from ._schemas.product_tailoring import ( + ProductTailoringRemoveImageActionSchema, + ) + + return ProductTailoringRemoveImageActionSchema().load(data) + if data["action"] == "removeVariant": + from ._schemas.product_tailoring import ( + ProductTailoringRemoveVariantActionSchema, + ) + + return ProductTailoringRemoveVariantActionSchema().load(data) + if data["action"] == "setAssetCustomField": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetCustomFieldActionSchema, + ) + + return ProductTailoringSetAssetCustomFieldActionSchema().load(data) + if data["action"] == "setAssetCustomType": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetCustomTypeActionSchema, + ) + + return ProductTailoringSetAssetCustomTypeActionSchema().load(data) + if data["action"] == "setAssetDescription": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetDescriptionActionSchema, + ) + + return ProductTailoringSetAssetDescriptionActionSchema().load(data) + if data["action"] == "setAssetKey": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetKeyActionSchema, + ) + + return ProductTailoringSetAssetKeyActionSchema().load(data) + if data["action"] == "setAssetSources": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetSourcesActionSchema, + ) + + return ProductTailoringSetAssetSourcesActionSchema().load(data) + if data["action"] == "setAssetTags": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetTagsActionSchema, + ) + + return ProductTailoringSetAssetTagsActionSchema().load(data) + if data["action"] == "setDescription": + from ._schemas.product_tailoring import ( + ProductTailoringSetDescriptionActionSchema, + ) + + return ProductTailoringSetDescriptionActionSchema().load(data) + if data["action"] == "setImages": + from ._schemas.product_tailoring import ( + ProductTailoringSetExternalImagesActionSchema, + ) + + return ProductTailoringSetExternalImagesActionSchema().load(data) + if data["action"] == "setImageLabel": + from ._schemas.product_tailoring import ( + ProductTailoringSetImageLabelActionSchema, + ) + + return ProductTailoringSetImageLabelActionSchema().load(data) + if data["action"] == "setMetaAttributes": + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaAttributesActionSchema, + ) + + return ProductTailoringSetMetaAttributesActionSchema().load(data) + if data["action"] == "setMetaDescription": + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaDescriptionActionSchema, + ) + + return ProductTailoringSetMetaDescriptionActionSchema().load(data) + if data["action"] == "setMetaKeywords": + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaKeywordsActionSchema, + ) + + return ProductTailoringSetMetaKeywordsActionSchema().load(data) + if data["action"] == "setMetaTitle": + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaTitleActionSchema, + ) + + return ProductTailoringSetMetaTitleActionSchema().load(data) + if data["action"] == "setName": + from ._schemas.product_tailoring import ProductTailoringSetNameActionSchema + + return ProductTailoringSetNameActionSchema().load(data) + if data["action"] == "setSlug": + from ._schemas.product_tailoring import ProductTailoringSetSlugActionSchema + + return ProductTailoringSetSlugActionSchema().load(data) + if data["action"] == "unpublish": + from ._schemas.product_tailoring import ( + ProductTailoringUnpublishActionSchema, + ) + + return ProductTailoringUnpublishActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringUpdateActionSchema + + return ProductTailoringUpdateActionSchema().dump(self) + + +class ProductVariantTailoring(_BaseType): + """The tailoring of a [ProductVariant](ctp:api:type:ProductVariant).""" + + #: The `id` of the tailored [ProductVariant](ctp:api:type:ProductVariant). + id: int + #: Images of the tailored Product Variant. + #: If present, these images will override the images of the corresponding [ProductVariant](ctp:api:type:ProductVariant) in total. + images: typing.Optional[typing.List["Image"]] + #: Media assets of the tailored Product Variant. + #: If present, these assets will override the assets of the corresponding [ProductVariant](ctp:api:type:ProductVariant) in total. + assets: typing.Optional[typing.List["Asset"]] + + def __init__( + self, + *, + id: int, + images: typing.Optional[typing.List["Image"]] = None, + assets: typing.Optional[typing.List["Asset"]] = None + ): + self.id = id + self.images = images + self.assets = assets + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantTailoring": + from ._schemas.product_tailoring import ProductVariantTailoringSchema + + return ProductVariantTailoringSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductVariantTailoringSchema + + return ProductVariantTailoringSchema().dump(self) + + +class ProductVariantTailoringDraft(_BaseType): + """Either `id` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists.""" + + #: The `id` of the [ProductVariant](ctp:api:type:ProductVariant) to be tailored. + id: typing.Optional[int] + #: The `sku` of the [ProductVariant](ctp:api:type:ProductVariant) to be tailored. + sku: typing.Optional[str] + #: Images of the tailored Product Variant. + images: typing.Optional[typing.List["Image"]] + #: Media assets of the tailored Product Variant. + assets: typing.Optional[typing.List["Asset"]] + + def __init__( + self, + *, + id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + images: typing.Optional[typing.List["Image"]] = None, + assets: typing.Optional[typing.List["Asset"]] = None + ): + self.id = id + self.sku = sku + self.images = images + self.assets = assets + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductVariantTailoringDraft": + from ._schemas.product_tailoring import ProductVariantTailoringDraftSchema + + return ProductVariantTailoringDraftSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductVariantTailoringDraftSchema + + return ProductVariantTailoringDraftSchema().dump(self) + + +class ProductTailoringAddAssetAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists.""" + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged `assets` are updated. If `false`, both the current and staged `assets` are updated. + staged: typing.Optional[bool] + #: Value to append. + asset: "AssetDraft" + #: Position in `assets` where the Asset should be put. When specified, the value must be between `0` and the total number of Assets minus `1`. + position: typing.Optional[int] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset: "AssetDraft", + position: typing.Optional[int] = None + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset = asset + self.position = position + + super().__init__(action="addAsset") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringAddAssetAction": + from ._schemas.product_tailoring import ProductTailoringAddAssetActionSchema + + return ProductTailoringAddAssetActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringAddAssetActionSchema + + return ProductTailoringAddAssetActionSchema().dump(self) + + +class ProductTailoringAddExternalImageAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. Produces the [ProductTailoringImageAdded](/projects/messages#product-tailoring-image-added) Message.""" + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: Value to add to `images`. + image: "Image" + #: If `true`, only the staged `images` is updated. If `false`, both the current and staged `images` is updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + image: "Image", + staged: typing.Optional[bool] = None + ): + self.variant_id = variant_id + self.sku = sku + self.image = image + self.staged = staged + + super().__init__(action="addExternalImage") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringAddExternalImageAction": + from ._schemas.product_tailoring import ( + ProductTailoringAddExternalImageActionSchema, + ) + + return ProductTailoringAddExternalImageActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringAddExternalImageActionSchema, + ) + + return ProductTailoringAddExternalImageActionSchema().dump(self) + + +class ProductTailoringAddVariantAction(ProductTailoringUpdateAction): + """Either `id` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + Produces the [ProductVariantTailoringAdded](ctp:api:type:ProductVariantTailoringAddedMessage) Message. + + """ + + #: The `id` of the tailored ProductVariant to update. + id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: Images for the Product Variant Tailoring. + images: typing.Optional[typing.List["Image"]] + #: Media assets for the Product Variant Tailoring. + assets: typing.Optional[typing.List["AssetDraft"]] + #: If `true` the new Product Variant Tailoring is only staged. If `false` the new Product Variant Tailoring is both current and staged. + staged: typing.Optional[bool] + + def __init__( + self, + *, + id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + images: typing.Optional[typing.List["Image"]] = None, + assets: typing.Optional[typing.List["AssetDraft"]] = None, + staged: typing.Optional[bool] = None + ): + self.id = id + self.sku = sku + self.images = images + self.assets = assets + self.staged = staged + + super().__init__(action="addVariant") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringAddVariantAction": + from ._schemas.product_tailoring import ProductTailoringAddVariantActionSchema + + return ProductTailoringAddVariantActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringAddVariantActionSchema + + return ProductTailoringAddVariantActionSchema().dump(self) + + +class ProductTailoringChangeAssetNameAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + The Asset to update must be specified using either `assetId` or `assetKey`. + + """ + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is updated. If `false`, both the current and staged Asset is updated. + staged: typing.Optional[bool] + #: The `id` of the Asset to update. + asset_id: typing.Optional[str] + #: The `key` of the Asset to update. + asset_key: typing.Optional[str] + #: New value to set. Must not be empty. + name: "LocalizedString" + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: typing.Optional[str] = None, + asset_key: typing.Optional[str] = None, + name: "LocalizedString" + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + self.name = name + + super().__init__(action="changeAssetName") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringChangeAssetNameAction": + from ._schemas.product_tailoring import ( + ProductTailoringChangeAssetNameActionSchema, + ) + + return ProductTailoringChangeAssetNameActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringChangeAssetNameActionSchema, + ) + + return ProductTailoringChangeAssetNameActionSchema().dump(self) + + +class ProductTailoringChangeAssetOrderAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists.""" + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged `assets` is updated. If `false`, both the current and staged `assets` are updated. + staged: typing.Optional[bool] + #: All existing Asset `id`s of the ProductTailoringVariant in the desired new order. + asset_order: typing.List["str"] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_order: typing.List["str"] + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_order = asset_order + + super().__init__(action="changeAssetOrder") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringChangeAssetOrderAction": + from ._schemas.product_tailoring import ( + ProductTailoringChangeAssetOrderActionSchema, + ) + + return ProductTailoringChangeAssetOrderActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringChangeAssetOrderActionSchema, + ) + + return ProductTailoringChangeAssetOrderActionSchema().dump(self) + + +class ProductTailoringMoveImageToPositionAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists.""" + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: The URL of the image to update. + image_url: str + #: Position in `images` where the image should be moved. Must be between `0` and the total number of images minus `1`. + position: int + #: If `true`, only the staged `images` is updated. If `false`, both the current and staged `images` is updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + image_url: str, + position: int, + staged: typing.Optional[bool] = None + ): + self.variant_id = variant_id + self.sku = sku + self.image_url = image_url + self.position = position + self.staged = staged + + super().__init__(action="moveImageToPosition") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringMoveImageToPositionAction": + from ._schemas.product_tailoring import ( + ProductTailoringMoveImageToPositionActionSchema, + ) + + return ProductTailoringMoveImageToPositionActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringMoveImageToPositionActionSchema, + ) + + return ProductTailoringMoveImageToPositionActionSchema().dump(self) + + +class ProductTailoringPublishAction(ProductTailoringUpdateAction): + """Publishes the `staged` data of the ProductTailoring to `current`. Sets `hasStagedChanges` to `false`. + Generates the [ProductTailoringPublished](ctp:api:type:ProductTailoringPublishedMessage) Message. + + """ + + def __init__(self): + + super().__init__(action="publish") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringPublishAction": + from ._schemas.product_tailoring import ProductTailoringPublishActionSchema + + return ProductTailoringPublishActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringPublishActionSchema + + return ProductTailoringPublishActionSchema().dump(self) + + +class ProductTailoringRemoveAssetAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + The Asset to remove must be specified using either `assetId` or `assetKey`. + + """ + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is removed. If `false`, both the current and staged Asset is removed. + staged: typing.Optional[bool] + #: The `id` of the Asset to remove. + asset_id: typing.Optional[str] + #: The `key` of the Asset to remove. + asset_key: typing.Optional[str] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: typing.Optional[str] = None, + asset_key: typing.Optional[str] = None + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + + super().__init__(action="removeAsset") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringRemoveAssetAction": + from ._schemas.product_tailoring import ProductTailoringRemoveAssetActionSchema + + return ProductTailoringRemoveAssetActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringRemoveAssetActionSchema + + return ProductTailoringRemoveAssetActionSchema().dump(self) + + +class ProductTailoringRemoveImageAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists.""" + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: The URL of the image to remove. + image_url: str + #: If `true`, only the staged image is removed. If `false`, both the current and staged image is removed. + staged: typing.Optional[bool] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + image_url: str, + staged: typing.Optional[bool] = None + ): + self.variant_id = variant_id + self.sku = sku + self.image_url = image_url + self.staged = staged + + super().__init__(action="removeImage") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringRemoveImageAction": + from ._schemas.product_tailoring import ProductTailoringRemoveImageActionSchema + + return ProductTailoringRemoveImageActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringRemoveImageActionSchema + + return ProductTailoringRemoveImageActionSchema().dump(self) + + +class ProductTailoringRemoveVariantAction(ProductTailoringUpdateAction): + """Either `id` or `sku` is required. + Produces the [ProductVariantTailoringDeleted](ctp:api:type:ProductVariantTailoringRemovedMessage) Message. + + """ + + #: The `id` of the ProductVariant to remove from the Tailoring. + id: typing.Optional[int] + #: The `sku` of the ProductVariant to remove from the Tailoring. + sku: typing.Optional[str] + #: If `true`, only the staged Product Variant Tailoring is removed. If `false`, both the current and staged Product Variant Tailoring is removed. + staged: typing.Optional[bool] + + def __init__( + self, + *, + id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None + ): + self.id = id + self.sku = sku + self.staged = staged + + super().__init__(action="removeVariant") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringRemoveVariantAction": + from ._schemas.product_tailoring import ( + ProductTailoringRemoveVariantActionSchema, + ) + + return ProductTailoringRemoveVariantActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringRemoveVariantActionSchema, + ) + + return ProductTailoringRemoveVariantActionSchema().dump(self) + + +class ProductTailoringSetAssetCustomFieldAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + The [Asset](ctp:api:type:Asset) to update must be specified using either `assetId` or `assetKey`. + + """ + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is updated. If `false`, both the current and staged Asset is updated. + staged: typing.Optional[bool] + #: The `id` of the Asset to update. + asset_id: typing.Optional[str] + #: The `key` of the Asset to update. + asset_key: typing.Optional[str] + #: Name of the [Custom Field](/../api/projects/custom-fields). + name: str + #: If `value` is absent or `null`, this field will be removed if it exists. + #: Removing a field that does not exist returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. + #: If `value` is provided, it is set for the field defined by `name`. + value: typing.Optional[typing.Any] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: typing.Optional[str] = None, + asset_key: typing.Optional[str] = None, + name: str, + value: typing.Optional[typing.Any] = None + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + self.name = name + self.value = value + + super().__init__(action="setAssetCustomField") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetAssetCustomFieldAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetCustomFieldActionSchema, + ) + + return ProductTailoringSetAssetCustomFieldActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetCustomFieldActionSchema, + ) + + return ProductTailoringSetAssetCustomFieldActionSchema().dump(self) + + +class ProductTailoringSetAssetCustomTypeAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + The [Asset](ctp:api:type:Asset) to update must be specified using either `assetId` or `assetKey`. + + """ + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is updated. If `false`, both the current and staged Asset is updated. + staged: typing.Optional[bool] + #: The `id` of the Asset to update. + asset_id: typing.Optional[str] + #: The `key` of the Asset to update. + asset_key: typing.Optional[str] + #: Defines the [Type](ctp:api:type:Type) that extends the Asset with [Custom Fields](/../api/projects/custom-fields). + #: If absent, any existing Type and Custom Fields are removed from the Asset. + type: typing.Optional["TypeResourceIdentifier"] + #: Sets the [Custom Fields](/../api/projects/custom-fields) fields for the Asset. + fields: typing.Optional["FieldContainer"] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: typing.Optional[str] = None, + asset_key: typing.Optional[str] = None, + type: typing.Optional["TypeResourceIdentifier"] = None, + fields: typing.Optional["FieldContainer"] = None + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + self.type = type + self.fields = fields + + super().__init__(action="setAssetCustomType") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetAssetCustomTypeAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetCustomTypeActionSchema, + ) + + return ProductTailoringSetAssetCustomTypeActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetCustomTypeActionSchema, + ) + + return ProductTailoringSetAssetCustomTypeActionSchema().dump(self) + + +class ProductTailoringSetAssetDescriptionAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + The [Asset](ctp:api:type:Asset) to update must be specified using either `assetId` or `assetKey`. + + """ + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is updated. If `false`, both the current and staged Asset is updated. + staged: typing.Optional[bool] + #: The `id` of the Asset to update. + asset_id: typing.Optional[str] + #: The `key` of the Asset to update. + asset_key: typing.Optional[str] + #: Value to set. If empty, any existing value will be removed. + description: typing.Optional["LocalizedString"] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: typing.Optional[str] = None, + asset_key: typing.Optional[str] = None, + description: typing.Optional["LocalizedString"] = None + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + self.description = description + + super().__init__(action="setAssetDescription") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetAssetDescriptionAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetDescriptionActionSchema, + ) + + return ProductTailoringSetAssetDescriptionActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetDescriptionActionSchema, + ) + + return ProductTailoringSetAssetDescriptionActionSchema().dump(self) + + +class ProductTailoringSetAssetKeyAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists.""" + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is updated. If `false`, both the current and staged Asset is updated. + staged: typing.Optional[bool] + #: The `id` of the Asset to update. + asset_id: str + #: Value to set. If empty, any existing value will be removed. + asset_key: typing.Optional[str] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: str, + asset_key: typing.Optional[str] = None + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + + super().__init__(action="setAssetKey") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetAssetKeyAction": + from ._schemas.product_tailoring import ProductTailoringSetAssetKeyActionSchema + + return ProductTailoringSetAssetKeyActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringSetAssetKeyActionSchema + + return ProductTailoringSetAssetKeyActionSchema().dump(self) + + +class ProductTailoringSetAssetSourcesAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + The [Asset](ctp:api:type:Asset) to update must be specified using either `assetId` or `assetKey`. + + """ + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is updated. If `false` both the current and staged Asset is updated. + staged: typing.Optional[bool] + #: The `id` of the Asset to update. + asset_id: typing.Optional[str] + #: The `key` of the Asset to update. + asset_key: typing.Optional[str] + #: Value to set. + sources: typing.List["AssetSource"] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: typing.Optional[str] = None, + asset_key: typing.Optional[str] = None, + sources: typing.List["AssetSource"] + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + self.sources = sources + + super().__init__(action="setAssetSources") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetAssetSourcesAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetSourcesActionSchema, + ) + + return ProductTailoringSetAssetSourcesActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetAssetSourcesActionSchema, + ) + + return ProductTailoringSetAssetSourcesActionSchema().dump(self) + + +class ProductTailoringSetAssetTagsAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. + The Asset to update must be specified using either `assetId` or `assetKey`. + + """ + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: If `true`, only the staged Asset is updated. If `false`, both the current and staged Asset is updated. + staged: typing.Optional[bool] + #: The `id` of the Asset to update. + asset_id: typing.Optional[str] + #: The `key` of the Asset to update. + asset_key: typing.Optional[str] + #: Keywords for categorizing and organizing Assets. + tags: typing.Optional[typing.List["str"]] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + staged: typing.Optional[bool] = None, + asset_id: typing.Optional[str] = None, + asset_key: typing.Optional[str] = None, + tags: typing.Optional[typing.List["str"]] = None + ): + self.variant_id = variant_id + self.sku = sku + self.staged = staged + self.asset_id = asset_id + self.asset_key = asset_key + self.tags = tags + + super().__init__(action="setAssetTags") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetAssetTagsAction": + from ._schemas.product_tailoring import ProductTailoringSetAssetTagsActionSchema + + return ProductTailoringSetAssetTagsActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringSetAssetTagsActionSchema + + return ProductTailoringSetAssetTagsActionSchema().dump(self) + + +class ProductTailoringSetDescriptionAction(ProductTailoringUpdateAction): + """Generates the [ProductTailoringDescriptionSet](ctp:api:type:ProductTailoringDescriptionSetMessage) Message.""" + + #: Value to set. If empty, any existing value will be removed. + description: typing.Optional["LocalizedString"] + #: If `true`, only the staged `description` is updated. If `false`, both the current and staged `description` are updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + description: typing.Optional["LocalizedString"] = None, + staged: typing.Optional[bool] = None + ): + self.description = description + self.staged = staged + + super().__init__(action="setDescription") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetDescriptionAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetDescriptionActionSchema, + ) + + return ProductTailoringSetDescriptionActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetDescriptionActionSchema, + ) + + return ProductTailoringSetDescriptionActionSchema().dump(self) + + +class ProductTailoringSetExternalImagesAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists. Produces the [ProductTailoringImagesSet](/projects/messages#product-tailoring-images-set) Message.""" + + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: Value to set to `images`. + images: typing.List["Image"] + #: If `true`, only the staged `images` is updated. If `false`, both the current and staged `images` is updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + variant_id: typing.Optional[int] = None, + sku: typing.Optional[str] = None, + images: typing.List["Image"], + staged: typing.Optional[bool] = None + ): + self.variant_id = variant_id + self.sku = sku + self.images = images + self.staged = staged + + super().__init__(action="setImages") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetExternalImagesAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetExternalImagesActionSchema, + ) + + return ProductTailoringSetExternalImagesActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetExternalImagesActionSchema, + ) + + return ProductTailoringSetExternalImagesActionSchema().dump(self) + + +class ProductTailoringSetImageLabelAction(ProductTailoringUpdateAction): + """Either `variantId` or `sku` is required to reference a [ProductVariant](ctp:api:type:ProductVariant) that exists.""" + + #: The `sku` of the tailored ProductVariant to update. + sku: typing.Optional[str] + #: The `id` of the tailored ProductVariant to update. + variant_id: typing.Optional[int] + #: The URL of the image to set the label. + image_url: str + #: Value to set. If empty, any existing value will be removed. + label: typing.Optional[str] + #: If `true`, only the staged image is updated. If `false`, both the current and staged image is updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + sku: typing.Optional[str] = None, + variant_id: typing.Optional[int] = None, + image_url: str, + label: typing.Optional[str] = None, + staged: typing.Optional[bool] = None + ): + self.sku = sku + self.variant_id = variant_id + self.image_url = image_url + self.label = label + self.staged = staged + + super().__init__(action="setImageLabel") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetImageLabelAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetImageLabelActionSchema, + ) + + return ProductTailoringSetImageLabelActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetImageLabelActionSchema, + ) + + return ProductTailoringSetImageLabelActionSchema().dump(self) + + +class ProductTailoringSetMetaAttributesAction(ProductTailoringUpdateAction): + """Updates all meta attributes at the same time.""" + + #: Value to set. If empty, any existing value will be removed. + meta_title: typing.Optional["LocalizedString"] + #: Value to set. If empty, any existing value will be removed. + meta_description: typing.Optional["LocalizedString"] + #: Value to set. If empty, any existing value will be removed. + meta_keywords: typing.Optional["LocalizedString"] + #: If `true`, only the staged attributes are updated. If `false`, both the current and staged attributes are updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + meta_title: typing.Optional["LocalizedString"] = None, + meta_description: typing.Optional["LocalizedString"] = None, + meta_keywords: typing.Optional["LocalizedString"] = None, + staged: typing.Optional[bool] = None + ): + self.meta_title = meta_title + self.meta_description = meta_description + self.meta_keywords = meta_keywords + self.staged = staged + + super().__init__(action="setMetaAttributes") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetMetaAttributesAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaAttributesActionSchema, + ) + + return ProductTailoringSetMetaAttributesActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaAttributesActionSchema, + ) + + return ProductTailoringSetMetaAttributesActionSchema().dump(self) + + +class ProductTailoringSetMetaDescriptionAction(ProductTailoringUpdateAction): + #: Value to set. If empty, any existing value will be removed. + meta_description: typing.Optional["LocalizedString"] + #: If `true`, only the staged `metaDescription` is updated. If `false`, both the current and staged `metaDescription` are updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + meta_description: typing.Optional["LocalizedString"] = None, + staged: typing.Optional[bool] = None + ): + self.meta_description = meta_description + self.staged = staged + + super().__init__(action="setMetaDescription") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetMetaDescriptionAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaDescriptionActionSchema, + ) + + return ProductTailoringSetMetaDescriptionActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaDescriptionActionSchema, + ) + + return ProductTailoringSetMetaDescriptionActionSchema().dump(self) + + +class ProductTailoringSetMetaKeywordsAction(ProductTailoringUpdateAction): + #: Value to set. If empty, any existing value will be removed. + meta_keywords: typing.Optional["LocalizedString"] + #: If `true`, only the staged `metaKeywords` is updated. If `false`, both the current and staged `metaKeywords` are updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + meta_keywords: typing.Optional["LocalizedString"] = None, + staged: typing.Optional[bool] = None + ): + self.meta_keywords = meta_keywords + self.staged = staged + + super().__init__(action="setMetaKeywords") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetMetaKeywordsAction": + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaKeywordsActionSchema, + ) + + return ProductTailoringSetMetaKeywordsActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ( + ProductTailoringSetMetaKeywordsActionSchema, + ) + + return ProductTailoringSetMetaKeywordsActionSchema().dump(self) + + +class ProductTailoringSetMetaTitleAction(ProductTailoringUpdateAction): + #: Value to set. If empty, any existing value will be removed. + meta_title: typing.Optional["LocalizedString"] + #: If `true`, only the staged `metaTitle` is updated. If `false`, both the current and staged `metaTitle` are updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + meta_title: typing.Optional["LocalizedString"] = None, + staged: typing.Optional[bool] = None + ): + self.meta_title = meta_title + self.staged = staged + + super().__init__(action="setMetaTitle") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetMetaTitleAction": + from ._schemas.product_tailoring import ProductTailoringSetMetaTitleActionSchema + + return ProductTailoringSetMetaTitleActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringSetMetaTitleActionSchema + + return ProductTailoringSetMetaTitleActionSchema().dump(self) + + +class ProductTailoringSetNameAction(ProductTailoringUpdateAction): + """Generates the [ProductTailoringNameSet](ctp:api:type:ProductTailoringNameSetMessage) Message.""" + + #: Value to set. If empty, any existing value will be removed. + name: typing.Optional["LocalizedString"] + #: If `true`, only the staged `name` is updated. If `false`, both the current and staged `name` are updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + name: typing.Optional["LocalizedString"] = None, + staged: typing.Optional[bool] = None + ): + self.name = name + self.staged = staged + + super().__init__(action="setName") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetNameAction": + from ._schemas.product_tailoring import ProductTailoringSetNameActionSchema + + return ProductTailoringSetNameActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringSetNameActionSchema + + return ProductTailoringSetNameActionSchema().dump(self) + + +class ProductTailoringSetSlugAction(ProductTailoringUpdateAction): + """Generates the [ProductTailoringSlugSet](ctp:api:type:ProductTailoringSlugSetMessage) Message.""" + + #: Value to set. If empty, any existing value will be removed. + slug: typing.Optional["LocalizedString"] + #: If `true`, only the staged `slug` is updated. If `false`, both the current and staged `slug` are updated. + staged: typing.Optional[bool] + + def __init__( + self, + *, + slug: typing.Optional["LocalizedString"] = None, + staged: typing.Optional[bool] = None + ): + self.slug = slug + self.staged = staged + + super().__init__(action="setSlug") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringSetSlugAction": + from ._schemas.product_tailoring import ProductTailoringSetSlugActionSchema + + return ProductTailoringSetSlugActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringSetSlugActionSchema + + return ProductTailoringSetSlugActionSchema().dump(self) + + +class ProductTailoringUnpublishAction(ProductTailoringUpdateAction): + """Unpublishes the `current` data of the ProductTailoring. Sets the `published` field to `false`. + Generates the [ProductTailoringUnpublished](ctp:api:type:ProductTailoringUnpublishedMessage) Message. + + """ + + def __init__(self): + + super().__init__(action="unpublish") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProductTailoringUnpublishAction": + from ._schemas.product_tailoring import ProductTailoringUnpublishActionSchema + + return ProductTailoringUnpublishActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.product_tailoring import ProductTailoringUnpublishActionSchema + + return ProductTailoringUnpublishActionSchema().dump(self) diff --git a/src/commercetools/platform/models/product_type.py b/src/commercetools/platform/models/product_type.py index c8798c37..93f4cd78 100644 --- a/src/commercetools/platform/models/product_type.py +++ b/src/commercetools/platform/models/product_type.py @@ -103,7 +103,7 @@ class AttributeDefinition(_BaseType): #: #: Which exact features are available with this flag depends on the specific [AttributeType](ctp:api:type:AttributeType). #: The maximum size of a searchable field is **restricted** by the [Field content size limit](/../api/limits#field-content-size). - #: This constraint is enforced at both [Product creation](/../api/projects/products#create-product) and [Product update](/../api/projects/products#update-product). + #: This constraint is enforced at both [Product creation](ctp:api:endpoint:/{projectKey}/products:POST) and [Product update](/../api/projects/products#update-product). #: If the length of the input exceeds the maximum size, an [InvalidField](ctp:api:type:InvalidFieldError) error is returned. is_searchable: bool @@ -267,7 +267,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeReferenceTypeId(enum.Enum): """Name of the resource type that the value should reference. Supported resource type identifiers:""" + ASSOCIATE_ROLE = "associate-role" + BUSINESS_UNIT = "business-unit" CART = "cart" + CART_DISCOUNT = "cart-discount" CATEGORY = "category" CHANNEL = "channel" CUSTOMER = "customer" @@ -356,6 +359,7 @@ class AttributeBooleanType(AttributeType): """Attribute type for Boolean values. Valid values for the Attribute are `true` and `false` (JSON Boolean).""" def __init__(self): + super().__init__(name="boolean") @classmethod @@ -371,7 +375,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeDateTimeType(AttributeType): + def __init__(self): + super().__init__(name="datetime") @classmethod @@ -387,7 +393,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeDateType(AttributeType): + def __init__(self): + super().__init__(name="date") @classmethod @@ -429,6 +437,7 @@ class AttributeLocalizableTextType(AttributeType): """Attribute type for [LocalizedString](ctp:api:type:LocalizedString) values.""" def __init__(self): + super().__init__(name="ltext") @classmethod @@ -471,7 +480,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeMoneyType(AttributeType): + def __init__(self): + super().__init__(name="money") @classmethod @@ -510,7 +521,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeNumberType(AttributeType): + def __init__(self): + super().__init__(name="number") @classmethod @@ -575,6 +588,7 @@ class AttributeTextType(AttributeType): """Attribute type for plain text values.""" def __init__(self): + super().__init__(name="text") @classmethod @@ -590,7 +604,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class AttributeTimeType(AttributeType): + def __init__(self): + super().__init__(name="time") @classmethod @@ -606,9 +622,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductType(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the ProductType. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the ProductType. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the ProductType. key: typing.Optional[str] @@ -774,6 +790,7 @@ class ProductTypeResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.PRODUCT_TYPE) @classmethod @@ -791,7 +808,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProductTypeUpdate(_BaseType): - #: Expected version of the ProductType on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the ProductType on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the ProductType. actions: typing.List["ProductTypeUpdateAction"] diff --git a/src/commercetools/platform/models/project.py b/src/commercetools/platform/models/project.py index c025ccf1..49a08499 100644 --- a/src/commercetools/platform/models/project.py +++ b/src/commercetools/platform/models/project.py @@ -29,14 +29,19 @@ "CartScoreType", "CartValueType", "CartsConfiguration", + "CustomerIndexingStatus", + "CustomerSearchStatus", "ExternalOAuth", "OrderSearchStatus", + "ProductSearchIndexingMode", + "ProductSearchStatus", "Project", "ProjectChangeBusinessUnitStatusOnCreationAction", "ProjectChangeCartsConfigurationAction", "ProjectChangeCountriesAction", "ProjectChangeCountryTaxRateFallbackEnabledAction", "ProjectChangeCurrenciesAction", + "ProjectChangeCustomerSearchStatusAction", "ProjectChangeLanguagesAction", "ProjectChangeMessagesConfigurationAction", "ProjectChangeMessagesEnabledAction", @@ -57,6 +62,15 @@ ] +class CustomerIndexingStatus(enum.Enum): + """The current indexing status of Customer Search.""" + + SCHEDULED = "Scheduled" + INDEXING = "Indexing" + READY = "Ready" + FAILED = "Failed" + + class BusinessUnitConfiguration(_BaseType): #: Status of Business Units created using the [My Business Unit endpoint](ctp:api:endpoint:/{projectKey}/me/business-units:POST). my_business_unit_status_on_creation: "BusinessUnitConfigurationStatus" @@ -133,6 +147,16 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return CartsConfigurationSchema().dump(self) +class CustomerSearchStatus(enum.Enum): + """Specifies the status of the [Customer Search](/../api/projects/customer-search) index. + You can change the status using the [Change Customer Search Status](ctp:api:type:ProjectChangeCustomerSearchStatusAction) update action. + + """ + + ACTIVATED = "Activated" + DEACTIVATED = "Deactivated" + + class ExternalOAuth(_BaseType): """Represents a RFC 7662 compliant [OAuth 2.0 Token Introspection](https://datatracker.ietf.org/doc/html/rfc7662) endpoint. For more information, see [Requesting an access token using an external OAuth 2.0 server](/../api/authorization#requesting-an-access-token-using-an-external-oauth-server). @@ -170,6 +194,18 @@ class OrderSearchStatus(enum.Enum): DEACTIVATED = "Deactivated" +class ProductSearchIndexingMode(enum.Enum): + PRODUCT_PROJECTIONS_SEARCH = "ProductProjectionsSearch" + PRODUCTS_SEARCH = "ProductsSearch" + + +class ProductSearchStatus(enum.Enum): + """Specifies the status of the [Product Search](/../api/projects/product-search) index.""" + + ACTIVATED = "Activated" + DEACTIVATED = "Deactivated" + + class Project(_BaseType): #: Current version of the Project. version: int @@ -252,7 +288,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ProjectUpdate(_BaseType): - #: Expected version of the Project on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the Project on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Project. actions: typing.List["ProjectUpdateAction"] @@ -309,6 +346,10 @@ def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "ProjectUpdateAction from ._schemas.project import ProjectChangeCurrenciesActionSchema return ProjectChangeCurrenciesActionSchema().load(data) + if data["action"] == "changeCustomerSearchStatus": + from ._schemas.project import ProjectChangeCustomerSearchStatusActionSchema + + return ProjectChangeCustomerSearchStatusActionSchema().load(data) if data["action"] == "changeLanguages": from ._schemas.project import ProjectChangeLanguagesActionSchema @@ -369,6 +410,8 @@ class SearchIndexingConfiguration(_BaseType): #: Configuration for the [Product Projection Search](/../api/projects/products-search) and [Product Suggestions](/../api/projects/products-suggestions) endpoints. products: typing.Optional["SearchIndexingConfigurationValues"] + #: Configuration for the [Product Search](/../api/projects/product-search) feature. + products_search: typing.Optional["SearchIndexingConfigurationValues"] #: Configuration for the [Order Search](/../api/projects/order-search) feature. orders: typing.Optional["SearchIndexingConfigurationValues"] @@ -376,9 +419,11 @@ def __init__( self, *, products: typing.Optional["SearchIndexingConfigurationValues"] = None, + products_search: typing.Optional["SearchIndexingConfigurationValues"] = None, orders: typing.Optional["SearchIndexingConfigurationValues"] = None ): self.products = products + self.products_search = products_search self.orders = orders super().__init__() @@ -410,7 +455,7 @@ class SearchIndexingConfigurationValues(_BaseType): status: typing.Optional["SearchIndexingConfigurationStatus"] #: Date and time (UTC) the Project was last updated. Only present on Projects last modified after 1 February 2019. last_modified_at: typing.Optional[datetime.datetime] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the SearchIndexingConfigurationValues. last_modified_by: typing.Optional["LastModifiedBy"] def __init__( @@ -470,7 +515,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartClassificationType(ShippingRateInputType): - """Used when the ShippingRate maps to an abstract Cart categorization expressed by strings (for example, `Light`, `Medium`, or `Heavy`). + """The [ShippingRate](ctp:api:type:ShippingRate) maps to an abstract Cart categorization expressed by strings (for example, `Light`, `Medium`, or `Heavy`). Only keys defined in the `values` array can be used to create a tier or to set a value of the `shippingRateInput` on the [Cart](ctp:api:type:Cart). Keys must be unique. @@ -499,9 +544,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartScoreType(ShippingRateInputType): - """Used when the ShippingRate maps to an abstract Cart categorization expressed by integers (such as shipping scores or weight ranges).""" + """The [ShippingRate](ctp:api:type:ShippingRate) maps to an abstract [Cart](ctp:api:type:Cart) categorization expressed by integers (such as shipping scores or weight ranges).""" def __init__(self): + super().__init__(type=ShippingRateTierType.CART_SCORE) @classmethod @@ -517,13 +563,14 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartValueType(ShippingRateInputType): - """Used when the ShippingRate maps to the sum of [LineItem](ctp:api:type:LineItem) Prices. - The value of the Cart is used to select a tier. + """The [ShippingRate](ctp:api:type:ShippingRate) maps to the value of the Cart and is used to select a tier. + The value of the [Cart](ctp:api:type:Cart) is the sum of all Line Item totals and Custom Line Item totals (via the `totalPrice` field) after any Product Discounts and Cart Discounts have been applied. If chosen, it is not possible to set a value for the `shippingRateInput` on the [Cart](ctp:api:type:Cart). """ def __init__(self): + super().__init__(type=ShippingRateTierType.CART_VALUE) @classmethod @@ -687,6 +734,29 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return ProjectChangeCurrenciesActionSchema().dump(self) +class ProjectChangeCustomerSearchStatusAction(ProjectUpdateAction): + #: Activates or deactivates the [Customer Search](/../api/projects/customer-search) feature. Activation will trigger building a search index for the Customers in the Project. + status: "CustomerSearchStatus" + + def __init__(self, *, status: "CustomerSearchStatus"): + self.status = status + + super().__init__(action="changeCustomerSearchStatus") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ProjectChangeCustomerSearchStatusAction": + from ._schemas.project import ProjectChangeCustomerSearchStatusActionSchema + + return ProjectChangeCustomerSearchStatusActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.project import ProjectChangeCustomerSearchStatusActionSchema + + return ProjectChangeCustomerSearchStatusActionSchema().dump(self) + + class ProjectChangeLanguagesAction(ProjectUpdateAction): """Removing a language used by a [Store](ctp:api:type:Store) returns a [LanguageUsedInStores](ctp:api:type:LanguageUsedInStoresError) error.""" @@ -807,9 +877,17 @@ class ProjectChangeProductSearchIndexingEnabledAction(ProjectUpdateAction): #: - If `false`, the indexing of [Product](ctp:api:type:Product) information will stop and the [Product Projection Search](/../api/projects/products-search) as well as the [Product Suggestions](/../api/projects/products-suggestions) endpoint will not be available anymore for this Project. The Project's [SearchIndexingConfiguration](ctp:api:type:SearchIndexingConfiguration) `status` for `products` will be changed to `"Deactivated"`. #: - If `true`, the indexing of [Product](ctp:api:type:Product) information will start and the [Product Projection Search](/../api/projects/products-search) as well as the [Product Suggestions](/../api/projects/products-suggestions) endpoint will become available soon after for this Project. Proportional to the amount of information being indexed, the Project's [SearchIndexingConfiguration](ctp:api:type:SearchIndexingConfiguration) `status` for `products` will be shown as `"Indexing"` during this time. As soon as the indexing has finished, the configuration status will be changed to `"Activated"` making the aforementioned endpoints fully available for this Project. enabled: bool + #: Controls whether the action should apply to [Product Projection Search](/../api/projects/products-search) or to [Product Search](/../api/projects/product-search). + mode: typing.Optional["ProductSearchIndexingMode"] - def __init__(self, *, enabled: bool): + def __init__( + self, + *, + enabled: bool, + mode: typing.Optional["ProductSearchIndexingMode"] = None + ): self.enabled = enabled + self.mode = mode super().__init__(action="changeProductSearchIndexingEnabled") diff --git a/src/commercetools/platform/models/quote.py b/src/commercetools/platform/models/quote.py index e4f2d47e..0024e738 100644 --- a/src/commercetools/platform/models/quote.py +++ b/src/commercetools/platform/models/quote.py @@ -63,9 +63,9 @@ class Quote(BaseResource): #: User-defined unique identifier of the Quote. key: typing.Optional[str] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the Quote. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the Quote. created_by: typing.Optional["CreatedBy"] #: Quote Request related to the Quote. quote_request: "QuoteRequestReference" @@ -357,6 +357,7 @@ class QuoteResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.QUOTE) @classmethod @@ -386,7 +387,7 @@ class QuoteState(enum.Enum): class QuoteUpdate(_BaseType): #: Expected version of the [Quote](ctp:api:type:Quote) to which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the [Quote](ctp:api:type:Quote). actions: typing.List["QuoteUpdateAction"] diff --git a/src/commercetools/platform/models/quote_request.py b/src/commercetools/platform/models/quote_request.py index 710c85b9..1eb4df4b 100644 --- a/src/commercetools/platform/models/quote_request.py +++ b/src/commercetools/platform/models/quote_request.py @@ -62,9 +62,9 @@ class QuoteRequest(BaseResource): #: User-defined unique identifier of the QuoteRequest. key: typing.Optional[str] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the QuoteRequest. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the QuoteRequest. created_by: typing.Optional["CreatedBy"] #: Indicates the current state of the Quote Request in the negotiation process. quote_request_state: "QuoteRequestState" @@ -347,6 +347,7 @@ class QuoteRequestResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.QUOTE_REQUEST) @classmethod @@ -375,7 +376,7 @@ class QuoteRequestState(enum.Enum): class QuoteRequestUpdate(_BaseType): #: Expected version of the [QuoteRequest](ctp:api:type:QuoteRequest) to which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the [QuoteRequest](ctp:api:type:QuoteRequest). actions: typing.List["QuoteRequestUpdateAction"] diff --git a/src/commercetools/platform/models/review.py b/src/commercetools/platform/models/review.py index 1298a7bc..4bcc8da7 100644 --- a/src/commercetools/platform/models/review.py +++ b/src/commercetools/platform/models/review.py @@ -49,9 +49,9 @@ class Review(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the Review. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the Review. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the Review. key: typing.Optional[str] @@ -334,6 +334,7 @@ class ReviewResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.REVIEW) @classmethod diff --git a/src/commercetools/platform/models/search.py b/src/commercetools/platform/models/search.py new file mode 100644 index 00000000..d101ea83 --- /dev/null +++ b/src/commercetools/platform/models/search.py @@ -0,0 +1,857 @@ +# This file is automatically generated by the rmf-codegen project. +# +# The Python code generator is maintained by Lab Digital. If you want to +# contribute to this project then please do not edit this file directly +# but send a pull request to the Lab Digital fork of rmf-codegen at +# https://github.com/labd/rmf-codegen + +import datetime +import enum +import typing + +from ._abstract import _BaseType + +__all__ = [ + "SearchAndExpression", + "SearchAnyValue", + "SearchCompoundExpression", + "SearchDateRangeExpression", + "SearchDateRangeValue", + "SearchDateTimeRangeExpression", + "SearchDateTimeRangeValue", + "SearchExactExpression", + "SearchExistsExpression", + "SearchExistsValue", + "SearchFieldType", + "SearchFilterExpression", + "SearchFullTextExpression", + "SearchFullTextPrefixExpression", + "SearchFullTextPrefixValue", + "SearchFullTextValue", + "SearchLongRangeExpression", + "SearchLongRangeValue", + "SearchMatchType", + "SearchMatchingVariant", + "SearchNotExpression", + "SearchNumberRangeExpression", + "SearchNumberRangeValue", + "SearchOrExpression", + "SearchPrefixExpression", + "SearchQuery", + "SearchQueryExpression", + "SearchQueryExpressionValue", + "SearchSortMode", + "SearchSortOrder", + "SearchSorting", + "SearchTimeRangeExpression", + "SearchTimeRangeValue", + "SearchWildCardExpression", +] + + +class SearchFieldType(enum.Enum): + """Possible values for the `fieldType` property on [query expressions](/../api/search-query-language#query-expressions) indicating the data type of the `field`.""" + + BOOLEAN = "boolean" + TEXT = "text" + LTEXT = "ltext" + ENUM = "enum" + LENUM = "lenum" + NUMBER = "number" + MONEY = "money" + DATE = "date" + DATETIME = "datetime" + TIME = "time" + REFERENCE = "reference" + SET_BOOLEAN = "set_boolean" + SET_TEXT = "set_text" + SET_LTEXT = "set_ltext" + SET_ENUM = "set_enum" + SET_LENUM = "set_lenum" + SET_NUMBER = "set_number" + SET_MONEY = "set_money" + SET_DATE = "set_date" + SET_DATETIME = "set_datetime" + SET_TIME = "set_time" + SET_REFERENCE = "set_reference" + + +class SearchMatchType(enum.Enum): + ANY = "any" + ALL = "all" + + +class SearchMatchingVariant(_BaseType): + #: Unique identifier of the variant. + id: int + #: SKU of the matching variant. + sku: typing.Optional[str] + + def __init__(self, *, id: int, sku: typing.Optional[str] = None): + self.id = id + self.sku = sku + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchMatchingVariant": + from ._schemas.search import SearchMatchingVariantSchema + + return SearchMatchingVariantSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchMatchingVariantSchema + + return SearchMatchingVariantSchema().dump(self) + + +class SearchQuery(typing.Dict[str, typing.Any]): + pass + + +class SearchCompoundExpression(typing.Dict[str, typing.Any]): + pass + + +class SearchAndExpression(SearchCompoundExpression): + and_: typing.List["SearchQuery"] + + def __init__(self, *, and_: typing.List["SearchQuery"]): + self.and_ = and_ + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchAndExpression": + from ._schemas.search import SearchAndExpressionSchema + + return SearchAndExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchAndExpressionSchema + + return SearchAndExpressionSchema().dump(self) + + +class SearchFilterExpression(SearchCompoundExpression): + filter: typing.List["SearchQueryExpression"] + + def __init__(self, *, filter: typing.List["SearchQueryExpression"]): + self.filter = filter + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchFilterExpression": + from ._schemas.search import SearchFilterExpressionSchema + + return SearchFilterExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchFilterExpressionSchema + + return SearchFilterExpressionSchema().dump(self) + + +class SearchNotExpression(SearchCompoundExpression): + not_: typing.List["SearchQuery"] + + def __init__(self, *, not_: typing.List["SearchQuery"]): + self.not_ = not_ + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchNotExpression": + from ._schemas.search import SearchNotExpressionSchema + + return SearchNotExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchNotExpressionSchema + + return SearchNotExpressionSchema().dump(self) + + +class SearchOrExpression(SearchCompoundExpression): + or_: typing.List["SearchQuery"] + + def __init__(self, *, or_: typing.List["SearchQuery"]): + self.or_ = or_ + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchOrExpression": + from ._schemas.search import SearchOrExpressionSchema + + return SearchOrExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchOrExpressionSchema + + return SearchOrExpressionSchema().dump(self) + + +class SearchQueryExpression(typing.Dict[str, typing.Any]): + pass + + +class SearchDateRangeExpression(SearchQueryExpression): + range: "SearchDateRangeValue" + + def __init__(self, *, range: "SearchDateRangeValue"): + self.range = range + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchDateRangeExpression": + from ._schemas.search import SearchDateRangeExpressionSchema + + return SearchDateRangeExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchDateRangeExpressionSchema + + return SearchDateRangeExpressionSchema().dump(self) + + +class SearchDateTimeRangeExpression(SearchQueryExpression): + range: "SearchDateTimeRangeValue" + + def __init__(self, *, range: "SearchDateTimeRangeValue"): + self.range = range + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchDateTimeRangeExpression": + from ._schemas.search import SearchDateTimeRangeExpressionSchema + + return SearchDateTimeRangeExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchDateTimeRangeExpressionSchema + + return SearchDateTimeRangeExpressionSchema().dump(self) + + +class SearchExactExpression(SearchQueryExpression): + exact: "SearchAnyValue" + + def __init__(self, *, exact: "SearchAnyValue"): + self.exact = exact + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchExactExpression": + from ._schemas.search import SearchExactExpressionSchema + + return SearchExactExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchExactExpressionSchema + + return SearchExactExpressionSchema().dump(self) + + +class SearchExistsExpression(SearchQueryExpression): + exists: "SearchExistsValue" + + def __init__(self, *, exists: "SearchExistsValue"): + self.exists = exists + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchExistsExpression": + from ._schemas.search import SearchExistsExpressionSchema + + return SearchExistsExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchExistsExpressionSchema + + return SearchExistsExpressionSchema().dump(self) + + +class SearchFullTextExpression(SearchQueryExpression): + full_text: "SearchFullTextValue" + + def __init__(self, *, full_text: "SearchFullTextValue"): + self.full_text = full_text + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchFullTextExpression": + from ._schemas.search import SearchFullTextExpressionSchema + + return SearchFullTextExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchFullTextExpressionSchema + + return SearchFullTextExpressionSchema().dump(self) + + +class SearchFullTextPrefixExpression(SearchQueryExpression): + full_text_prefix: "SearchFullTextPrefixValue" + + def __init__(self, *, full_text_prefix: "SearchFullTextPrefixValue"): + self.full_text_prefix = full_text_prefix + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchFullTextPrefixExpression": + from ._schemas.search import SearchFullTextPrefixExpressionSchema + + return SearchFullTextPrefixExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchFullTextPrefixExpressionSchema + + return SearchFullTextPrefixExpressionSchema().dump(self) + + +class SearchLongRangeExpression(SearchQueryExpression): + range: "SearchLongRangeValue" + + def __init__(self, *, range: "SearchLongRangeValue"): + self.range = range + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchLongRangeExpression": + from ._schemas.search import SearchLongRangeExpressionSchema + + return SearchLongRangeExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchLongRangeExpressionSchema + + return SearchLongRangeExpressionSchema().dump(self) + + +class SearchNumberRangeExpression(SearchQueryExpression): + range: "SearchNumberRangeValue" + + def __init__(self, *, range: "SearchNumberRangeValue"): + self.range = range + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchNumberRangeExpression": + from ._schemas.search import SearchNumberRangeExpressionSchema + + return SearchNumberRangeExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchNumberRangeExpressionSchema + + return SearchNumberRangeExpressionSchema().dump(self) + + +class SearchPrefixExpression(SearchQueryExpression): + prefix: "SearchAnyValue" + + def __init__(self, *, prefix: "SearchAnyValue"): + self.prefix = prefix + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchPrefixExpression": + from ._schemas.search import SearchPrefixExpressionSchema + + return SearchPrefixExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchPrefixExpressionSchema + + return SearchPrefixExpressionSchema().dump(self) + + +class SearchQueryExpressionValue(_BaseType): + field: str + boost: typing.Optional[float] + #: Possible values for the `fieldType` property on [query expressions](/../api/search-query-language#query-expressions) indicating the data type of the `field`. + field_type: typing.Optional["SearchFieldType"] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None + ): + self.field = field + self.boost = boost + self.field_type = field_type + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchQueryExpressionValue": + from ._schemas.search import SearchQueryExpressionValueSchema + + return SearchQueryExpressionValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchQueryExpressionValueSchema + + return SearchQueryExpressionValueSchema().dump(self) + + +class SearchAnyValue(SearchQueryExpressionValue): + value: typing.Any + #: String value specifying linguistic and regional preferences using the [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag), as described in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). The format combines language, script, and region using hyphen-separated subtags. For example: `en`, `en-US`, `zh-Hans-SG`. + language: typing.Optional[str] + case_insensitive: typing.Optional[bool] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + value: typing.Any, + language: typing.Optional[str] = None, + case_insensitive: typing.Optional[bool] = None + ): + self.value = value + self.language = language + self.case_insensitive = case_insensitive + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchAnyValue": + from ._schemas.search import SearchAnyValueSchema + + return SearchAnyValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchAnyValueSchema + + return SearchAnyValueSchema().dump(self) + + +class SearchDateRangeValue(SearchQueryExpressionValue): + gte: typing.Optional[datetime.date] + gt: typing.Optional[datetime.date] + lte: typing.Optional[datetime.date] + lt: typing.Optional[datetime.date] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + gte: typing.Optional[datetime.date] = None, + gt: typing.Optional[datetime.date] = None, + lte: typing.Optional[datetime.date] = None, + lt: typing.Optional[datetime.date] = None + ): + self.gte = gte + self.gt = gt + self.lte = lte + self.lt = lt + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchDateRangeValue": + from ._schemas.search import SearchDateRangeValueSchema + + return SearchDateRangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchDateRangeValueSchema + + return SearchDateRangeValueSchema().dump(self) + + +class SearchDateTimeRangeValue(SearchQueryExpressionValue): + gte: typing.Optional[datetime.datetime] + gt: typing.Optional[datetime.datetime] + lte: typing.Optional[datetime.datetime] + lt: typing.Optional[datetime.datetime] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + gte: typing.Optional[datetime.datetime] = None, + gt: typing.Optional[datetime.datetime] = None, + lte: typing.Optional[datetime.datetime] = None, + lt: typing.Optional[datetime.datetime] = None + ): + self.gte = gte + self.gt = gt + self.lte = lte + self.lt = lt + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchDateTimeRangeValue": + from ._schemas.search import SearchDateTimeRangeValueSchema + + return SearchDateTimeRangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchDateTimeRangeValueSchema + + return SearchDateTimeRangeValueSchema().dump(self) + + +class SearchExistsValue(SearchQueryExpressionValue): + #: String value specifying linguistic and regional preferences using the [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag), as described in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). The format combines language, script, and region using hyphen-separated subtags. For example: `en`, `en-US`, `zh-Hans-SG`. + language: typing.Optional[str] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + language: typing.Optional[str] = None + ): + self.language = language + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchExistsValue": + from ._schemas.search import SearchExistsValueSchema + + return SearchExistsValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchExistsValueSchema + + return SearchExistsValueSchema().dump(self) + + +class SearchFullTextPrefixValue(SearchQueryExpressionValue): + value: typing.Any + #: String value specifying linguistic and regional preferences using the [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag), as described in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). The format combines language, script, and region using hyphen-separated subtags. For example: `en`, `en-US`, `zh-Hans-SG`. + language: typing.Optional[str] + must_match: typing.Optional["SearchMatchType"] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + value: typing.Any, + language: typing.Optional[str] = None, + must_match: typing.Optional["SearchMatchType"] = None + ): + self.value = value + self.language = language + self.must_match = must_match + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchFullTextPrefixValue": + from ._schemas.search import SearchFullTextPrefixValueSchema + + return SearchFullTextPrefixValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchFullTextPrefixValueSchema + + return SearchFullTextPrefixValueSchema().dump(self) + + +class SearchFullTextValue(SearchQueryExpressionValue): + value: typing.Any + #: String value specifying linguistic and regional preferences using the [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag), as described in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). The format combines language, script, and region using hyphen-separated subtags. For example: `en`, `en-US`, `zh-Hans-SG`. + language: typing.Optional[str] + must_match: typing.Optional["SearchMatchType"] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + value: typing.Any, + language: typing.Optional[str] = None, + must_match: typing.Optional["SearchMatchType"] = None + ): + self.value = value + self.language = language + self.must_match = must_match + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchFullTextValue": + from ._schemas.search import SearchFullTextValueSchema + + return SearchFullTextValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchFullTextValueSchema + + return SearchFullTextValueSchema().dump(self) + + +class SearchLongRangeValue(SearchQueryExpressionValue): + gte: typing.Optional[int] + gt: typing.Optional[int] + lte: typing.Optional[int] + lt: typing.Optional[int] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + gte: typing.Optional[int] = None, + gt: typing.Optional[int] = None, + lte: typing.Optional[int] = None, + lt: typing.Optional[int] = None + ): + self.gte = gte + self.gt = gt + self.lte = lte + self.lt = lt + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchLongRangeValue": + from ._schemas.search import SearchLongRangeValueSchema + + return SearchLongRangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchLongRangeValueSchema + + return SearchLongRangeValueSchema().dump(self) + + +class SearchNumberRangeValue(SearchQueryExpressionValue): + gte: typing.Optional[float] + gt: typing.Optional[float] + lte: typing.Optional[float] + lt: typing.Optional[float] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + gte: typing.Optional[float] = None, + gt: typing.Optional[float] = None, + lte: typing.Optional[float] = None, + lt: typing.Optional[float] = None + ): + self.gte = gte + self.gt = gt + self.lte = lte + self.lt = lt + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchNumberRangeValue": + from ._schemas.search import SearchNumberRangeValueSchema + + return SearchNumberRangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchNumberRangeValueSchema + + return SearchNumberRangeValueSchema().dump(self) + + +class SearchSortMode(enum.Enum): + """For set-type fields, only a single value of the set is taken into account for sorting. + The sort mode determines whether the minimum or maximum value, or a calculated statistical value should be used as sorting value. + + """ + + MIN = "min" + MAX = "max" + AVG = "avg" + SUM = "sum" + + +class SearchSortOrder(enum.Enum): + ASC = "asc" + DESC = "desc" + + +class SearchSorting(_BaseType): + """Sorting parameters provided with a Search request. + Sorting allows you to control how results to your query are sorted. + If no sorting is specified, the results are sorted by relevance in descending (`desc`) order. + + """ + + #: Use any searchable field of the resource as sort criterion. + field: str + #: String value specifying linguistic and regional preferences using the [IETF language tag format](https://en.wikipedia.org/wiki/IETF_language_tag), as described in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). The format combines language, script, and region using hyphen-separated subtags. For example: `en`, `en-US`, `zh-Hans-SG`. + language: typing.Optional[str] + #: Specify the order in which the search results should be sorted. + #: Can be `asc` for ascending, or `desc` for descending order. + order: "SearchSortOrder" + #: Specify the sort mode to be applied for a set-type `field`. + mode: typing.Optional["SearchSortMode"] + #: Provide the data type of the given `field`. + field_type: typing.Optional["SearchFieldType"] + #: Allows you to apply a [sort filter](/../api/search-query-language#sort-filter). + filter: typing.Optional["SearchQueryExpression"] + + def __init__( + self, + *, + field: str, + language: typing.Optional[str] = None, + order: "SearchSortOrder", + mode: typing.Optional["SearchSortMode"] = None, + field_type: typing.Optional["SearchFieldType"] = None, + filter: typing.Optional["SearchQueryExpression"] = None + ): + self.field = field + self.language = language + self.order = order + self.mode = mode + self.field_type = field_type + self.filter = filter + + super().__init__() + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchSorting": + from ._schemas.search import SearchSortingSchema + + return SearchSortingSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchSortingSchema + + return SearchSortingSchema().dump(self) + + +class SearchTimeRangeExpression(SearchQueryExpression): + range: "SearchTimeRangeValue" + + def __init__(self, *, range: "SearchTimeRangeValue"): + self.range = range + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchTimeRangeExpression": + from ._schemas.search import SearchTimeRangeExpressionSchema + + return SearchTimeRangeExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchTimeRangeExpressionSchema + + return SearchTimeRangeExpressionSchema().dump(self) + + +class SearchTimeRangeValue(SearchQueryExpressionValue): + gte: typing.Optional[datetime.time] + gt: typing.Optional[datetime.time] + lte: typing.Optional[datetime.time] + lt: typing.Optional[datetime.time] + + def __init__( + self, + *, + field: str, + boost: typing.Optional[float] = None, + field_type: typing.Optional["SearchFieldType"] = None, + gte: typing.Optional[datetime.time] = None, + gt: typing.Optional[datetime.time] = None, + lte: typing.Optional[datetime.time] = None, + lt: typing.Optional[datetime.time] = None + ): + self.gte = gte + self.gt = gt + self.lte = lte + self.lt = lt + + super().__init__(field=field, boost=boost, field_type=field_type) + + @classmethod + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "SearchTimeRangeValue": + from ._schemas.search import SearchTimeRangeValueSchema + + return SearchTimeRangeValueSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchTimeRangeValueSchema + + return SearchTimeRangeValueSchema().dump(self) + + +class SearchWildCardExpression(SearchQueryExpression): + wildcard: "SearchAnyValue" + + def __init__(self, *, wildcard: "SearchAnyValue"): + self.wildcard = wildcard + + super().__init__() + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "SearchWildCardExpression": + from ._schemas.search import SearchWildCardExpressionSchema + + return SearchWildCardExpressionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.search import SearchWildCardExpressionSchema + + return SearchWildCardExpressionSchema().dump(self) diff --git a/src/commercetools/platform/models/shipping_method.py b/src/commercetools/platform/models/shipping_method.py index 94bc4380..d4398233 100644 --- a/src/commercetools/platform/models/shipping_method.py +++ b/src/commercetools/platform/models/shipping_method.py @@ -14,12 +14,12 @@ if typing.TYPE_CHECKING: from .common import ( + CentPrecisionMoney, CreatedBy, LastModifiedBy, LocalizedString, Money, ReferenceTypeId, - TypedMoney, ) from .tax_category import TaxCategoryReference, TaxCategoryResourceIdentifier from .type import ( @@ -38,6 +38,7 @@ "ShippingMethod", "ShippingMethodAddShippingRateAction", "ShippingMethodAddZoneAction", + "ShippingMethodChangeActiveAction", "ShippingMethodChangeIsDefaultAction", "ShippingMethodChangeNameAction", "ShippingMethodChangeTaxCategoryAction", @@ -92,9 +93,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShippingMethod(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the ShippingMethod. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the ShippingMethod. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the ShippingMethod. key: typing.Optional[str] @@ -110,7 +111,11 @@ class ShippingMethod(BaseResource): tax_category: "TaxCategoryReference" #: Defines [ShippingRates](ctp:api:type:ShippingRate) (prices) for specific Zones. zone_rates: typing.List["ZoneRate"] - #: If `true` this ShippingMethod is the [Project](ctp:api:type:Project)'s default ShippingMethod. + #: Indicates if the ShippingMethod is active. + #: + #: If `true`, the ShippingMethod can be used during the creation or update of a Cart or Order. + active: bool + #: If `true`, this ShippingMethod is the [Project](ctp:api:type:Project)'s default ShippingMethod. is_default: bool #: Valid [Cart predicate](/projects/predicates#cart-predicates) to select a ShippingMethod for a Cart. predicate: typing.Optional[str] @@ -133,6 +138,7 @@ def __init__( localized_description: typing.Optional["LocalizedString"] = None, tax_category: "TaxCategoryReference", zone_rates: typing.List["ZoneRate"], + active: bool, is_default: bool, predicate: typing.Optional[str] = None, custom: typing.Optional["CustomFields"] = None @@ -146,6 +152,7 @@ def __init__( self.localized_description = localized_description self.tax_category = tax_category self.zone_rates = zone_rates + self.active = active self.is_default = is_default self.predicate = predicate self.custom = custom @@ -184,7 +191,9 @@ class ShippingMethodDraft(_BaseType): tax_category: "TaxCategoryResourceIdentifier" #: Defines [ShippingRates](ctp:api:type:ShippingRate) (prices) for specific zones. zone_rates: typing.List["ZoneRateDraft"] - #: If `true` the ShippingMethod will be the [Project](ctp:api:type:Project)'s default ShippingMethod. + #: If set to `true`, the ShippingMethod can be used during the creation or update of a Cart or Order. + active: typing.Optional[bool] + #: If set to `true`, the ShippingMethod will be the [Project](ctp:api:type:Project)'s default ShippingMethod. is_default: bool #: Valid [Cart predicate](/projects/predicates#cart-predicates) to select a ShippingMethod for a Cart. predicate: typing.Optional[str] @@ -201,6 +210,7 @@ def __init__( localized_description: typing.Optional["LocalizedString"] = None, tax_category: "TaxCategoryResourceIdentifier", zone_rates: typing.List["ZoneRateDraft"], + active: typing.Optional[bool] = None, is_default: bool, predicate: typing.Optional[str] = None, custom: typing.Optional["CustomFieldsDraft"] = None @@ -212,6 +222,7 @@ def __init__( self.localized_description = localized_description self.tax_category = tax_category self.zone_rates = zone_rates + self.active = active self.is_default = is_default self.predicate = predicate self.custom = custom @@ -310,6 +321,7 @@ class ShippingMethodResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.SHIPPING_METHOD) @classmethod @@ -374,6 +386,10 @@ def deserialize( from ._schemas.shipping_method import ShippingMethodAddZoneActionSchema return ShippingMethodAddZoneActionSchema().load(data) + if data["action"] == "changeActive": + from ._schemas.shipping_method import ShippingMethodChangeActiveActionSchema + + return ShippingMethodChangeActiveActionSchema().load(data) if data["action"] == "changeIsDefault": from ._schemas.shipping_method import ( ShippingMethodChangeIsDefaultActionSchema, @@ -447,9 +463,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShippingRate(_BaseType): #: Currency amount of the ShippingRate. - price: "TypedMoney" - #: Shipping is free if the sum of the (Custom) Line Item Prices reaches the specified value. - free_above: typing.Optional["TypedMoney"] + price: "CentPrecisionMoney" + #: [Free shipping](/../api/shipping-delivery-overview#free-shipping) is applied if the sum of the (Custom) Line Item Prices reaches the specified value. + free_above: typing.Optional["CentPrecisionMoney"] #: `true` if the ShippingRate matches given [Cart](ctp:api:type:Cart) or [Location](ctp:api:type:Location). #: Only appears in response to requests for [Get ShippingMethods for a Cart](ctp:api:endpoint:/{projectKey}/shipping-methods/matching-cart:GET) or #: [Get ShippingMethods for a Location](ctp:api:endpoint:/{projectKey}/shipping-methods/matching-location:GET). @@ -460,8 +476,8 @@ class ShippingRate(_BaseType): def __init__( self, *, - price: "TypedMoney", - free_above: typing.Optional["TypedMoney"] = None, + price: "CentPrecisionMoney", + free_above: typing.Optional["CentPrecisionMoney"] = None, is_matching: typing.Optional[bool] = None, tiers: typing.List["ShippingRatePriceTier"] ): @@ -487,7 +503,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShippingRateDraft(_BaseType): #: Money value of the ShippingRate. price: "Money" - #: Shipping is free if the sum of the (Custom) Line Item Prices reaches the specified value. + #: [Free shipping](/../api/shipping-delivery-overview#free-shipping) is applied if the sum of the (Custom) Line Item Prices reaches the specified value. free_above: typing.Optional["Money"] #: Price tiers for the ShippingRate. tiers: typing.Optional[typing.List["ShippingRatePriceTier"]] @@ -547,7 +563,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartClassificationTier(ShippingRatePriceTier): - """Used when the ShippingRate maps to an abstract Cart categorization expressed by strings (for example, `Light`, `Medium`, or `Heavy`).""" + """The [ShippingRate](ctp:api:type:ShippingRate) maps to an abstract Cart categorization expressed by strings (for example, `Light`, `Medium`, or `Heavy`).""" #: `key` selected from the `values` of the [CartClassificationType](/projects/project#cartclassificationtype) configured in the Project. value: str @@ -580,12 +596,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartScoreTier(ShippingRatePriceTier): - """Used when the ShippingRate maps to an abstract Cart categorization expressed by integers (such as shipping scores or weight ranges). + """The [ShippingRate](ctp:api:type:ShippingRate) maps to an abstract Cart categorization expressed by integers (such as shipping scores or weight ranges). Either `price` or `priceFunction` is required. """ - #: Abstract value for categorizing a Cart. The range starts at `0`. The default price covers `0`, tiers start at `1`. See [Using Tiered Shipping Rates](/../tutorials/shipping-rate) for details and examples. + #: Abstract value for categorizing a Cart. The range starts at `0`. The default price covers `0`, tiers start at `1`. See [Tiered shipping rates](/../api/shipping-delivery-overview#tiered-shipping-rates) for details and examples. score: int #: Defines a fixed price for the `score`. price: typing.Optional["Money"] @@ -622,8 +638,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CartValueTier(ShippingRatePriceTier): - """Used when the ShippingRate maps to the sum of [LineItem](ctp:api:type:LineItem) Prices. - The value of the Cart is used to select a tier. + """ + The [ShippingRate](ctp:api:type:ShippingRate) maps to the value of the Cart and is used to select a tier. + The value of the [Cart](ctp:api:type:Cart) is the sum of all Line Item totals and Custom Line Item totals (via the `totalPrice` field) after any Product Discounts and Cart Discounts have been applied. If chosen, it is not possible to set a value for the `shippingRateInput` on the [Cart](ctp:api:type:Cart). Tiers contain the `centAmount` (a value of `100` in the currency `USD` corresponds to `$ 1.00`), and start at `1`.' @@ -775,6 +792,31 @@ def serialize(self) -> typing.Dict[str, typing.Any]: return ShippingMethodAddZoneActionSchema().dump(self) +class ShippingMethodChangeActiveAction(ShippingMethodUpdateAction): + #: Value to set. + #: + #: If set to `false`, the ShippingMethod cannot be used during the creation or update of a Cart or Order. + active: bool + + def __init__(self, *, active: bool): + self.active = active + + super().__init__(action="changeActive") + + @classmethod + def deserialize( + cls, data: typing.Dict[str, typing.Any] + ) -> "ShippingMethodChangeActiveAction": + from ._schemas.shipping_method import ShippingMethodChangeActiveActionSchema + + return ShippingMethodChangeActiveActionSchema().load(data) + + def serialize(self) -> typing.Dict[str, typing.Any]: + from ._schemas.shipping_method import ShippingMethodChangeActiveActionSchema + + return ShippingMethodChangeActiveActionSchema().dump(self) + + class ShippingMethodChangeIsDefaultAction(ShippingMethodUpdateAction): #: Value to set. Only one ShippingMethod can be default in a [Project](ctp:api:type:Project). is_default: bool diff --git a/src/commercetools/platform/models/shopping_list.py b/src/commercetools/platform/models/shopping_list.py index 12642c92..6c8ad5d6 100644 --- a/src/commercetools/platform/models/shopping_list.py +++ b/src/commercetools/platform/models/shopping_list.py @@ -89,9 +89,9 @@ class ShoppingList(BaseResource): store: typing.Optional["StoreKeyReference"] #: Custom Fields defined for the ShoppingList. custom: typing.Optional["CustomFields"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the ShoppingList. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the ShoppingList. created_by: typing.Optional["CreatedBy"] def __init__( @@ -427,6 +427,7 @@ class ShoppingListResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.SHOPPING_LIST) @classmethod @@ -444,7 +445,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShoppingListUpdate(_BaseType): - #: Expected version of the ShoppingList on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: Expected version of the ShoppingList on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: List of update actions to be performed on the ShoppingList. actions: typing.List["ShoppingListUpdateAction"] @@ -1071,6 +1073,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ShoppingListSetAnonymousIdAction(ShoppingListUpdateAction): + """If the Shopping List is already associated with a Customer, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned.""" + #: Value to set. If empty, any existing value will be removed. anonymous_id: typing.Optional[str] diff --git a/src/commercetools/platform/models/staged_quote.py b/src/commercetools/platform/models/staged_quote.py index 4a5bde87..1daa3d25 100644 --- a/src/commercetools/platform/models/staged_quote.py +++ b/src/commercetools/platform/models/staged_quote.py @@ -19,6 +19,7 @@ from .customer import CustomerReference from .quote_request import QuoteRequestReference, QuoteRequestResourceIdentifier from .state import StateReference, StateResourceIdentifier + from .store import StoreKeyReference from .type import ( CustomFields, CustomFieldsDraft, @@ -47,9 +48,9 @@ class StagedQuote(BaseResource): #: User-specific unique identifier of the staged quote. key: typing.Optional[str] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the StagedQuote. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the StagedQuote. created_by: typing.Optional["CreatedBy"] #: Predefined states tracking the status of the Staged Quote. staged_quote_state: "StagedQuoteState" @@ -73,6 +74,8 @@ class StagedQuote(BaseResource): purchase_order_number: typing.Optional[str] #: The [BusinessUnit](ctp:api:type:BusinessUnit) for the Staged Quote. business_unit: typing.Optional["BusinessUnitKeyReference"] + #: The Store to which the [Buyer](/../api/quotes-overview#buyer) belongs. + store: typing.Optional["StoreKeyReference"] def __init__( self, @@ -93,7 +96,8 @@ def __init__( custom: typing.Optional["CustomFields"] = None, state: typing.Optional["StateReference"] = None, purchase_order_number: typing.Optional[str] = None, - business_unit: typing.Optional["BusinessUnitKeyReference"] = None + business_unit: typing.Optional["BusinessUnitKeyReference"] = None, + store: typing.Optional["StoreKeyReference"] = None ): self.key = key self.last_modified_by = last_modified_by @@ -108,6 +112,7 @@ def __init__( self.state = state self.purchase_order_number = purchase_order_number self.business_unit = business_unit + self.store = store super().__init__( id=id, @@ -256,6 +261,7 @@ class StagedQuoteResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.STAGED_QUOTE) @classmethod @@ -282,7 +288,7 @@ class StagedQuoteState(enum.Enum): class StagedQuoteUpdate(_BaseType): #: Expected version of the [StagedQuote](ctp:api:type:StagedQuote) to which the changes should be applied. - #: If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the [StagedQuote](ctp:api:type:StagedQuote). actions: typing.List["StagedQuoteUpdateAction"] diff --git a/src/commercetools/platform/models/standalone_price.py b/src/commercetools/platform/models/standalone_price.py index 6e0831ed..41046781 100644 --- a/src/commercetools/platform/models/standalone_price.py +++ b/src/commercetools/platform/models/standalone_price.py @@ -118,9 +118,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePrice(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that last modified the StandalonePrice. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/client-logging#events-tracked). + #: IDs and references that created the StandalonePrice. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the StandalonePrice. key: typing.Optional[str] @@ -139,16 +139,18 @@ class StandalonePrice(BaseResource): #: Date until the Price is valid. Standalone Prices that are no longer valid are not automatically deleted, but they can be [deleted](/../api/projects/standalone-prices#delete-standaloneprice) if necessary. valid_until: typing.Optional[datetime.datetime] #: Price tiers if any are defined. + #: + #: If `discounted` is present, the tiered Price is ignored for a Product Variant. tiers: typing.Optional[typing.List["PriceTier"]] - #: Set if a matching [ProductDiscount](ctp:api:type:ProductDiscount) exists. If set, the API uses the `discounted` value for the [LineItem Price selection](ctp:api:type:LineItemPriceSelection). + #: Set if a matching [ProductDiscount](ctp:api:type:ProductDiscount) exists. If set, the API uses the `discounted` value for the [Line Item price selection](/../api/pricing-and-discounts-overview#line-item-price-selection). #: When a [relative discount](/../api/projects/productDiscounts#productdiscountvaluerelative) is applied and the fraction part of the `discounted` price is 0.5, the discounted price is rounded in favor of the customer with the [half down rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_down). discounted: typing.Optional["DiscountedPrice"] #: Custom Fields for the StandalonePrice. custom: typing.Optional["CustomFields"] #: Staged changes of the StandalonePrice. Only present if the StandalonePrice has some changes staged. staged: typing.Optional["StagedStandalonePrice"] - #: If set to `true`, the StandalonePrice is considered during [price selection](ctp:api:type:ProductPriceSelection). - #: If set to `false`, the StandalonePrice is not considered during [price selection](ctp:api:type:ProductPriceSelection). + #: If set to `true`, the StandalonePrice is considered during [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). + #: If set to `false`, the StandalonePrice is not considered during [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection) and any associated Line Items in a Cart cannot be ordered. active: bool def __init__( @@ -210,11 +212,6 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePriceDraft(_BaseType): - """Standalone Prices are defined with a scope consisting of `currency` and optionally `country`, `customerGroup`, and `channel` and/or a validity period (`validFrom` and/or `validTo`). For more information see [price selection](/../api/projects/products#price-selection). - - Creating a Standalone Price for an SKU which has a Standalone Price with exactly the same price scope, or with overlapping validity periods within the same price scope returns the [DuplicateStandalonePriceScope](ctp:api:type:DuplicateStandalonePriceScopeError) and [OverlappingStandalonePriceValidity](ctp:api:type:OverlappingStandalonePriceValidityError) errors, respectively. A Price without validity period does not conflict with a Price defined for a time period. - """ - #: User-defined unique identifier for the StandalonePrice. key: typing.Optional[str] #: Specifies to which [ProductVariant](ctp:api:type:ProductVariant) the API associates this Price. @@ -233,6 +230,8 @@ class StandalonePriceDraft(_BaseType): #: Sets the date until the Price is valid. Must be at least 1 ms later than `validFrom`. Standalone Prices that are no longer valid are not automatically deleted, but they can be [deleted](/../api/projects/standalone-prices#delete-standaloneprice) if necessary. valid_until: typing.Optional[datetime.datetime] #: Sets price tiers. + #: + #: If `discounted` is set, the tiered Price is ignored for a Product Variant. tiers: typing.Optional[typing.List["PriceTierDraft"]] #: Sets a discounted price for this Price that is different from the base price with `value`. discounted: typing.Optional["DiscountedPriceDraft"] @@ -240,7 +239,7 @@ class StandalonePriceDraft(_BaseType): custom: typing.Optional["CustomFieldsDraft"] #: Staged changes for the StandalonePrice. staged: typing.Optional["StagedPriceDraft"] - #: Set to `false`, if the StandalonePrice should not be considered during [price selection](ctp:api:type:ProductPriceSelection). + #: Set to `false`, if the StandalonePrice should not be considered during [Product price selection](/../api/pricing-and-discounts-overview#product-price-selection). active: typing.Optional[bool] def __init__( @@ -289,6 +288,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePricePagedQueryResponse(_BaseType): + """[PagedQueryResult](/general-concepts#pagedqueryresult) with `results` containing an array of [StandalonePrice](ctp:api:type:StandalonePrice).""" + #: Number of requested results. limit: int #: Offset supplied by the client or server default. It is the number of elements skipped, not a page number. @@ -336,7 +337,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePriceReference(Reference): - """[Reference](/../api/types#reference) to a [StandalonePrice](ctp:api:type:StandalonePrice).""" + """[Reference](ctp:api:type:Reference) to a [StandalonePrice](ctp:api:type:StandalonePrice).""" #: Contains the representation of the expanded StandalonePrice. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for StandalonePrice. obj: typing.Optional["StandalonePrice"] @@ -361,11 +362,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePriceResourceIdentifier(ResourceIdentifier): - """[ResourceIdentifier](/../api/types#resourceidentifier) to a [StandalonePrice](ctp:api:type:StandalonePrice).""" + """[ResourceIdentifier](ctp:api:type:ResourceIdentifier) to a [StandalonePrice](ctp:api:type:StandalonePrice).""" def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.STANDALONE_PRICE) @classmethod @@ -383,7 +385,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePriceUpdate(_BaseType): - #: Expected version of the StandalonePrice on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the StandalonePrice on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the StandalonePrice. actions: typing.List["StandalonePriceUpdateAction"] @@ -542,6 +545,7 @@ class StandalonePriceApplyStagedChangesAction(StandalonePriceUpdateAction): """Applies all staged changes to the StandalonePrice by overwriting all current values with the values in the [StagedStandalonePrice](ctp:api:type:StagedStandalonePrice). After successfully applied, the [StagedStandalonePrice](ctp:api:type:StagedStandalonePrice) will be removed from the StandalonePrice. An `applyStagedChanges` update action on a StandalonePrice that does not contain any staged changes will return a `400 Bad Request` error. Applying staged changes successfully will produce the [StandalonePriceStagedChangesApplied](ctp:api:type:StandalonePriceStagedChangesAppliedMessage) Message.""" def __init__(self): + super().__init__(action="applyStagedChanges") @classmethod @@ -563,7 +567,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StandalonePriceChangeActiveAction(StandalonePriceUpdateAction): - """Updating the value of a [StandalonePrice](ctp:api:type:StandalonePrice) produces the [StandalonePriceActiveChangedMessage](ctp:api:type:StandalonePriceActiveChangedMessage).""" + """Updating the value of a [StandalonePrice](ctp:api:type:StandalonePrice) produces the [StandalonePriceActiveChanged](ctp:api:type:StandalonePriceActiveChangedMessage) Message.""" #: New value to set for the `active` field of the [StandalonePrice](ctp:api:type:StandalonePrice). active: bool @@ -651,6 +655,7 @@ class StandalonePriceRemoveStagedChangesAction(StandalonePriceUpdateAction): """ def __init__(self): + super().__init__(action="removeStagedChanges") @classmethod diff --git a/src/commercetools/platform/models/state.py b/src/commercetools/platform/models/state.py index 6b5a3497..f80dd913 100644 --- a/src/commercetools/platform/models/state.py +++ b/src/commercetools/platform/models/state.py @@ -38,9 +38,9 @@ class State(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the State. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the State. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the State. key: str @@ -240,6 +240,7 @@ class StateResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.STATE) @classmethod @@ -277,7 +278,8 @@ class StateTypeEnum(enum.Enum): class StateUpdate(_BaseType): - #: Expected version of the State on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the State on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the State. actions: typing.List["StateUpdateAction"] diff --git a/src/commercetools/platform/models/store.py b/src/commercetools/platform/models/store.py index 09f181e6..f6854d19 100644 --- a/src/commercetools/platform/models/store.py +++ b/src/commercetools/platform/models/store.py @@ -122,9 +122,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class Store(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Store. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Store. created_by: typing.Optional["CreatedBy"] #: User-defined unique and immutable identifier for the Store. key: str @@ -262,9 +262,10 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreKeyReference(KeyReference): - """[Reference](/../api/types#reference) to a [Store](ctp:api:type:Store) by its key.""" + """[KeyReference](ctp:api:type:KeyReference) to a [Store](ctp:api:type:Store).""" def __init__(self, *, key: str): + super().__init__(key=key, type_id=ReferenceTypeId.STORE) @classmethod @@ -329,7 +330,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreReference(Reference): - """[Reference](/../api/types#reference) to a [Store](ctp:api:type:Store).""" + """[Reference](ctp:api:type:Reference) to a [Store](ctp:api:type:Store).""" #: Contains the representation of the expanded Store. Only present in responses to requests with [Reference Expansion](/../api/general-concepts#reference-expansion) for Stores. obj: typing.Optional["Store"] @@ -352,11 +353,12 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreResourceIdentifier(ResourceIdentifier): - """[ResourceIdentifier](/../api/types#resourceidentifier) to a [Store](ctp:api:type:Store). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/../api/errors#invalidjsoninput) error is returned.""" + """[ResourceIdentifier](ctp:api:type:ResourceIdentifier) to a [Store](ctp:api:type:Store). Either `id` or `key` is required. If both are set, an [InvalidJsonInput](/../api/errors#invalidjsoninput) error is returned.""" def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.STORE) @classmethod @@ -374,7 +376,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class StoreUpdate(_BaseType): - #: Expected version of the Store on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the Store on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Store. actions: typing.List["StoreUpdateAction"] diff --git a/src/commercetools/platform/models/subscription.py b/src/commercetools/platform/models/subscription.py index 7622a52f..4aa2d8ae 100644 --- a/src/commercetools/platform/models/subscription.py +++ b/src/commercetools/platform/models/subscription.py @@ -94,6 +94,7 @@ class ChangeSubscriptionResourceTypeId(enum.Enum): APPROVAL_FLOW = "approval-flow" APPROVAL_RULE = "approval-rule" ASSOCIATE_ROLE = "associate-role" + ATTRIBUTE_GROUP = "attribute-group" BUSINESS_UNIT = "business-unit" CART = "cart" CART_DISCOUNT = "cart-discount" @@ -112,8 +113,8 @@ class ChangeSubscriptionResourceTypeId(enum.Enum): PAYMENT = "payment" PRODUCT = "product" PRODUCT_DISCOUNT = "product-discount" - PRODUCT_PRICE = "product-price" PRODUCT_SELECTION = "product-selection" + PRODUCT_TAILORING = "product-tailoring" PRODUCT_TYPE = "product-type" QUOTE = "quote" QUOTE_REQUEST = "quote-request" @@ -696,6 +697,7 @@ class PlatformFormat(DeliveryFormat): """The PlatformFormat uses constructs that are similar to the ones used in the REST API, for example, on the [Messages Query HTTP API](/../api/projects/messages).""" def __init__(self): + super().__init__(type="Platform") @classmethod @@ -760,7 +762,7 @@ class ResourceDeletedDeliveryPayload(DeliveryPayload): version: int #: Date and time (UTC) the resource was last deleted. modified_at: datetime.datetime - #: `true` if the `dataErasure` [parameter](/../api/general-concepts#data-erasure-of-personal-data) on the `DELETE` request was set to `true`. + #: `true` if the `dataErasure` [parameter](/../api/gdpr#data-erasure-of-personal-data) on the `DELETE` request was set to `true`. data_erasure: typing.Optional[bool] def __init__( @@ -947,9 +949,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class Subscription(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Subscription. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Subscription. created_by: typing.Optional["CreatedBy"] #: Change notifications subscribed to. changes: typing.List["ChangeSubscription"] @@ -1052,12 +1054,13 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class SubscriptionHealthStatus(enum.Enum): - """The health status of the Subscription that indicates whether messages are being delivered to the Destination.""" + """The health status of the Subscription that indicates whether messages are being delivered.""" HEALTHY = "Healthy" CONFIGURATION_ERROR = "ConfigurationError" CONFIGURATION_ERROR_DELIVERY_STOPPED = "ConfigurationErrorDeliveryStopped" TEMPORARY_ERROR = "TemporaryError" + MANUALLY_SUSPENDED = "ManuallySuspended" class SubscriptionPagedQueryResponse(_BaseType): @@ -1110,7 +1113,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class SubscriptionUpdate(_BaseType): - #: Expected version of the Subscription on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) will be returned. + #: Expected version of the Subscription on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Subscription. actions: typing.List["SubscriptionUpdateAction"] diff --git a/src/commercetools/platform/models/tax_category.py b/src/commercetools/platform/models/tax_category.py index 68cad47a..678fa255 100644 --- a/src/commercetools/platform/models/tax_category.py +++ b/src/commercetools/platform/models/tax_category.py @@ -61,9 +61,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class TaxCategory(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the TaxCategory. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the TaxCategory. created_by: typing.Optional["CreatedBy"] #: Name of the TaxCategory. name: str @@ -229,6 +229,7 @@ class TaxCategoryResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.TAX_CATEGORY) @classmethod @@ -246,7 +247,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class TaxCategoryUpdate(_BaseType): - #: Expected version of the TaxCategory on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the TaxCategory on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the TaxCategory. actions: typing.List["TaxCategoryUpdateAction"] @@ -323,7 +325,7 @@ class TaxRate(_BaseType): key: typing.Optional[str] #: Name of the TaxRate. name: str - #: Tax rate. If subrates are used, the amount must be the sum of all subrates. + #: Tax rate. If subrates are used, the amount is the sum of all rates in `subRates`. amount: float #: If `true`, tax is included in [Embedded Prices](ctp:api:type:Price) or [Standalone Prices](ctp:api:type:StandalonePrice), and the `taxedPrice` is present on [LineItems](ctp:api:type:LineItem). In this case, the `totalNet` price on [TaxedPrice](ctp:api:type:TaxedPrice) includes the TaxRate. included_in_price: bool @@ -331,7 +333,8 @@ class TaxRate(_BaseType): country: str #: State within the country, such as Texas in the United States. state: typing.Optional[str] - #: Used to calculate the [taxPortions](/../api/projects/carts#taxedprice) field in a Cart or Order. It is useful if the total tax of a country (such as the US) is a combination of multiple taxes (such as state and local taxes). + #: Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate `amount`. + #: These subrates are used to calculate the `taxPortions` field of a [Cart](ctp:api:type:Cart) or [Order](ctp:api:type:Order) and the `taxedPrice` field of [LineItems](ctp:api:type:LineItem), [CustomLineItems](ctp:api:type:CustomLineItem), and [ShippingInfos](ctp:api:type:ShippingInfo). sub_rates: typing.Optional[typing.List["SubRate"]] def __init__( @@ -382,7 +385,8 @@ class TaxRateDraft(_BaseType): country: str #: State within the country, such as Texas in the United States. state: typing.Optional[str] - #: Used to calculate the [taxPortions](/../api/projects/carts#taxedprice) field in a Cart or Order. It is useful if the total tax of a country (such as the US) is a combination of multiple taxes (such as state and local taxes). + #: Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate `amount`. + #: These subrates are used to calculate the `taxPortions` field of a [Cart](ctp:api:type:Cart) or [Order](ctp:api:type:Order) and the `taxedPrice` field of [LineItems](ctp:api:type:LineItem), [CustomLineItems](ctp:api:type:CustomLineItem), and [ShippingInfos](ctp:api:type:ShippingInfo). sub_rates: typing.Optional[typing.List["SubRate"]] #: User-defined unique identifier of the TaxRate. key: typing.Optional[str] diff --git a/src/commercetools/platform/models/type.py b/src/commercetools/platform/models/type.py index 03e2765f..6e4d011d 100644 --- a/src/commercetools/platform/models/type.py +++ b/src/commercetools/platform/models/type.py @@ -120,6 +120,7 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class CustomFieldReferenceValue(enum.Enum): """Defines which resource type a [CustomFieldReferenceType](ctp:api:type:CustomFieldReferenceType) can reference.""" + APPROVAL_FLOW = "approval-flow" ASSOCIATE_ROLE = "associate-role" BUSINESS_UNIT = "business-unit" CART = "cart" @@ -315,6 +316,7 @@ class CustomFieldBooleanType(FieldType): """Field type for Boolean values.""" def __init__(self): + super().__init__(name="Boolean") @classmethod @@ -335,6 +337,7 @@ class CustomFieldDateTimeType(FieldType): """Field type for [DateTime](ctp:api:type:DateTime) values.""" def __init__(self): + super().__init__(name="DateTime") @classmethod @@ -355,6 +358,7 @@ class CustomFieldDateType(FieldType): """Field type for [Date](ctp:api:type:Date) values.""" def __init__(self): + super().__init__(name="Date") @classmethod @@ -421,6 +425,7 @@ class CustomFieldLocalizedStringType(FieldType): """Field type for [LocalizedString](ctp:api:type:LocalizedString) values.""" def __init__(self): + super().__init__(name="LocalizedString") @classmethod @@ -441,6 +446,7 @@ class CustomFieldMoneyType(FieldType): """Field type for [CentPrecisionMoney](ctp:api:type:CentPrecisionMoney) values.""" def __init__(self): + super().__init__(name="Money") @classmethod @@ -459,6 +465,7 @@ class CustomFieldNumberType(FieldType): """Field type for number values.""" def __init__(self): + super().__init__(name="Number") @classmethod @@ -525,6 +532,7 @@ class CustomFieldStringType(FieldType): """Field type for string values.""" def __init__(self): + super().__init__(name="String") @classmethod @@ -543,6 +551,7 @@ class CustomFieldTimeType(FieldType): """Field type for [Time](ctp:api:type:Time) values.""" def __init__(self): + super().__init__(name="Time") @classmethod @@ -562,6 +571,7 @@ class ResourceTypeId(enum.Enum): ADDRESS = "address" ASSET = "asset" + APPROVAL_FLOW = "approval-flow" ASSOCIATE_ROLE = "associate-role" BUSINESS_UNIT = "business-unit" CART_DISCOUNT = "cart-discount" @@ -594,9 +604,9 @@ class ResourceTypeId(enum.Enum): class Type(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Type. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Type. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the Type. key: str @@ -771,6 +781,7 @@ class TypeResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.TYPE) @classmethod @@ -796,7 +807,7 @@ class TypeTextInputHint(enum.Enum): class TypeUpdate(_BaseType): #: Expected version of the type on which the changes should be applied. - #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Type. actions: typing.List["TypeUpdateAction"] @@ -1151,7 +1162,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class TypeChangeLabelAction(TypeUpdateAction): #: Name of the [Field Definition](ctp:api:type:FieldDefinition) to update. field_name: str - #: JSON object where the keys are of type [Locale](ctp:api:type:Locale), and the values are the strings used for the corresponding language. + #: New value to set. + #: Must not be empty. label: "LocalizedString" def __init__(self, *, field_name: str, label: "LocalizedString"): diff --git a/src/commercetools/platform/models/zone.py b/src/commercetools/platform/models/zone.py index 09ac6838..90febf81 100644 --- a/src/commercetools/platform/models/zone.py +++ b/src/commercetools/platform/models/zone.py @@ -59,9 +59,9 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class Zone(BaseResource): - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that last modified the Zone. last_modified_by: typing.Optional["LastModifiedBy"] - #: Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked). + #: IDs and references that created the Zone. created_by: typing.Optional["CreatedBy"] #: User-defined unique identifier of the Zone. key: typing.Optional[str] @@ -227,6 +227,7 @@ class ZoneResourceIdentifier(ResourceIdentifier): def __init__( self, *, id: typing.Optional[str] = None, key: typing.Optional[str] = None ): + super().__init__(id=id, key=key, type_id=ReferenceTypeId.ZONE) @classmethod @@ -244,7 +245,8 @@ def serialize(self) -> typing.Dict[str, typing.Any]: class ZoneUpdate(_BaseType): - #: Expected version of the Zone on which the changes should be applied. If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error is returned. + #: Expected version of the Zone on which the changes should be applied. + #: If the expected version does not match the actual version, a [ConcurrentModification](ctp:api:type:ConcurrentModificationError) error will be returned. version: int #: Update actions to be performed on the Zone. actions: typing.List["ZoneUpdateAction"] diff --git a/src/commercetools/protocols.py b/src/commercetools/protocols.py index 4819a589..dfb9b1ec 100644 --- a/src/commercetools/protocols.py +++ b/src/commercetools/protocols.py @@ -8,8 +8,6 @@ class Model(Protocol): @classmethod - def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Model": - ... + def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Model": ... - def serialize(self) -> typing.Dict[str, typing.Any]: - ... + def serialize(self) -> typing.Dict[str, typing.Any]: ... diff --git a/src/commercetools/services/__init__.py b/src/commercetools/services/__init__.py deleted file mode 100644 index a42f56c3..00000000 --- a/src/commercetools/services/__init__.py +++ /dev/null @@ -1,296 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -if typing.TYPE_CHECKING: - from commercetools.client import Client - - from .api_clients import ApiClientService - from .cart_discounts import CartDiscountService - from .carts import CartService - from .categories import CategoryService - from .channels import ChannelService - from .custom_objects import CustomObjectService - from .customer_groups import CustomerGroupService - from .customers import CustomerService - from .discount_codes import DiscountCodeService - from .extensions import ExtensionService - from .graphqls import GraphqlService - from .in_stores import In_StoreService - from .inventory import InventoryEntryService - from .login import LoginService - from .me import MeService - from .messages import MessageService - from .orders import OrderService - from .payments import PaymentService - from .product_discounts import ProductDiscountService - from .product_projections import ProductProjectionService - from .product_types import ProductTypeService - from .products import ProductService - from .project import ProjectService - from .reviews import ReviewService - from .shipping_methods import ShippingMethodService - from .shopping_lists import ShoppingListService - from .states import StateService - from .stores import StoreService - from .subscriptions import SubscriptionService - from .tax_categories import TaxCategoryService - from .types import TypeService - from .zones import ZoneService - - -class ServicesMixin: - @property - def categories(self: "Client") -> "CategoryService": - if "categories" not in self.__dict__: - from .categories import CategoryService - - self.__dict__["categories"] = CategoryService(self) - return self.__dict__["categories"] - - @property - def carts(self: "Client") -> "CartService": - if "carts" not in self.__dict__: - from .carts import CartService - - self.__dict__["carts"] = CartService(self) - return self.__dict__["carts"] - - @property - def cart_discounts(self: "Client") -> "CartDiscountService": - if "cart_discounts" not in self.__dict__: - from .cart_discounts import CartDiscountService - - self.__dict__["cart_discounts"] = CartDiscountService(self) - return self.__dict__["cart_discounts"] - - @property - def channels(self: "Client") -> "ChannelService": - if "channels" not in self.__dict__: - from .channels import ChannelService - - self.__dict__["channels"] = ChannelService(self) - return self.__dict__["channels"] - - @property - def customers(self: "Client") -> "CustomerService": - if "customers" not in self.__dict__: - from .customers import CustomerService - - self.__dict__["customers"] = CustomerService(self) - return self.__dict__["customers"] - - @property - def customer_groups(self: "Client") -> "CustomerGroupService": - if "customer_groups" not in self.__dict__: - from .customer_groups import CustomerGroupService - - self.__dict__["customer_groups"] = CustomerGroupService(self) - return self.__dict__["customer_groups"] - - @property - def custom_objects(self: "Client") -> "CustomObjectService": - if "custom_objects" not in self.__dict__: - from .custom_objects import CustomObjectService - - self.__dict__["custom_objects"] = CustomObjectService(self) - return self.__dict__["custom_objects"] - - @property - def discount_codes(self: "Client") -> "DiscountCodeService": - if "discount_codes" not in self.__dict__: - from .discount_codes import DiscountCodeService - - self.__dict__["discount_codes"] = DiscountCodeService(self) - return self.__dict__["discount_codes"] - - @property - def graphqls(self: "Client") -> "GraphqlService": - if "graphqls" not in self.__dict__: - from .graphqls import GraphqlService - - self.__dict__["graphqls"] = GraphqlService(self) - return self.__dict__["graphqls"] - - @property - def inventory(self: "Client") -> "InventoryEntryService": - if "inventory" not in self.__dict__: - from .inventory import InventoryEntryService - - self.__dict__["inventory"] = InventoryEntryService(self) - return self.__dict__["inventory"] - - @property - def login(self: "Client") -> "LoginService": - if "login" not in self.__dict__: - from .login import LoginService - - self.__dict__["login"] = LoginService(self) - return self.__dict__["login"] - - @property - def messages(self: "Client") -> "MessageService": - if "messages" not in self.__dict__: - from .messages import MessageService - - self.__dict__["messages"] = MessageService(self) - return self.__dict__["messages"] - - @property - def orders(self: "Client") -> "OrderService": - if "orders" not in self.__dict__: - from .orders import OrderService - - self.__dict__["orders"] = OrderService(self) - return self.__dict__["orders"] - - @property - def payments(self: "Client") -> "PaymentService": - if "payments" not in self.__dict__: - from .payments import PaymentService - - self.__dict__["payments"] = PaymentService(self) - return self.__dict__["payments"] - - @property - def products(self: "Client") -> "ProductService": - if "products" not in self.__dict__: - from .products import ProductService - - self.__dict__["products"] = ProductService(self) - return self.__dict__["products"] - - @property - def product_discounts(self: "Client") -> "ProductDiscountService": - if "product_discounts" not in self.__dict__: - from .product_discounts import ProductDiscountService - - self.__dict__["product_discounts"] = ProductDiscountService(self) - return self.__dict__["product_discounts"] - - @property - def product_projections(self: "Client") -> "ProductProjectionService": - if "product_projections" not in self.__dict__: - from .product_projections import ProductProjectionService - - self.__dict__["product_projections"] = ProductProjectionService(self) - return self.__dict__["product_projections"] - - @property - def product_types(self: "Client") -> "ProductTypeService": - if "product_types" not in self.__dict__: - from .product_types import ProductTypeService - - self.__dict__["product_types"] = ProductTypeService(self) - return self.__dict__["product_types"] - - @property - def reviews(self: "Client") -> "ReviewService": - if "reviews" not in self.__dict__: - from .reviews import ReviewService - - self.__dict__["reviews"] = ReviewService(self) - return self.__dict__["reviews"] - - @property - def shipping_methods(self: "Client") -> "ShippingMethodService": - if "shipping_methods" not in self.__dict__: - from .shipping_methods import ShippingMethodService - - self.__dict__["shipping_methods"] = ShippingMethodService(self) - return self.__dict__["shipping_methods"] - - @property - def shopping_lists(self: "Client") -> "ShoppingListService": - if "shopping_lists" not in self.__dict__: - from .shopping_lists import ShoppingListService - - self.__dict__["shopping_lists"] = ShoppingListService(self) - return self.__dict__["shopping_lists"] - - @property - def states(self: "Client") -> "StateService": - if "states" not in self.__dict__: - from .states import StateService - - self.__dict__["states"] = StateService(self) - return self.__dict__["states"] - - @property - def subscriptions(self: "Client") -> "SubscriptionService": - if "subscriptions" not in self.__dict__: - from .subscriptions import SubscriptionService - - self.__dict__["subscriptions"] = SubscriptionService(self) - return self.__dict__["subscriptions"] - - @property - def tax_categories(self: "Client") -> "TaxCategoryService": - if "tax_categories" not in self.__dict__: - from .tax_categories import TaxCategoryService - - self.__dict__["tax_categories"] = TaxCategoryService(self) - return self.__dict__["tax_categories"] - - @property - def types(self: "Client") -> "TypeService": - if "types" not in self.__dict__: - from .types import TypeService - - self.__dict__["types"] = TypeService(self) - return self.__dict__["types"] - - @property - def zones(self: "Client") -> "ZoneService": - if "zones" not in self.__dict__: - from .zones import ZoneService - - self.__dict__["zones"] = ZoneService(self) - return self.__dict__["zones"] - - @property - def me(self: "Client") -> "MeService": - if "me" not in self.__dict__: - from .me import MeService - - self.__dict__["me"] = MeService(self) - return self.__dict__["me"] - - @property - def extensions(self: "Client") -> "ExtensionService": - if "extensions" not in self.__dict__: - from .extensions import ExtensionService - - self.__dict__["extensions"] = ExtensionService(self) - return self.__dict__["extensions"] - - @property - def api_clients(self: "Client") -> "ApiClientService": - if "api_clients" not in self.__dict__: - from .api_clients import ApiClientService - - self.__dict__["api_clients"] = ApiClientService(self) - return self.__dict__["api_clients"] - - @property - def stores(self: "Client") -> "StoreService": - if "stores" not in self.__dict__: - from .stores import StoreService - - self.__dict__["stores"] = StoreService(self) - return self.__dict__["stores"] - - @property - def in_stores(self: "Client") -> "In_StoreService": - if "in_stores" not in self.__dict__: - from .in_stores import In_StoreService - - self.__dict__["in_stores"] = In_StoreService(self) - return self.__dict__["in_stores"] - - @property - def project(self: "Client") -> "ProjectService": - if "project" not in self.__dict__: - from .project import ProjectService - - self.__dict__["project"] = ProjectService(self) - return self.__dict__["project"] diff --git a/src/commercetools/services/abstract.py b/src/commercetools/services/abstract.py deleted file mode 100644 index f7257517..00000000 --- a/src/commercetools/services/abstract.py +++ /dev/null @@ -1,17 +0,0 @@ -import typing - -from marshmallow.base import SchemaABC - -if typing.TYPE_CHECKING: - from commercetools.client import Client - - -class AbstractService: - def __init__(self, client: "Client") -> None: - self._client = client - self._schemas: typing.Dict[str, SchemaABC] = {} - - def _serialize_params(self, params, schema) -> typing.Dict[str, str]: - if schema not in self._schemas: - self._schemas[schema] = schema() - return self._schemas[schema].dump(params) diff --git a/src/commercetools/services/api_clients.py b/src/commercetools/services/api_clients.py deleted file mode 100644 index 55558476..00000000 --- a/src/commercetools/services/api_clients.py +++ /dev/null @@ -1,91 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.api_client import ( - ApiClient, - ApiClientDraft, - ApiClientPagedQueryResponse, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ApiClientQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class ApiClientService(abstract.AbstractService): - """Manage your API Clients via an API. - - Useful for Infrastructure-as-Code tooling, and regularly rotating API secrets. - """ - - def get_by_id(self, id) -> ApiClient: - """Get ApiClient by ID""" - params: typing.Dict[str, str] = {} - return self._client._get( - endpoint=f"api-clients/{id}", params=params, response_class=ApiClient - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ApiClientPagedQueryResponse: - """Manage your API Clients via an API. Useful for Infrastructure-as-Code - tooling, and regularly rotating API secrets. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ApiClientQuerySchema, - ) - return self._client._get( - endpoint="api-clients", - params=params, - response_class=ApiClientPagedQueryResponse, - ) - - def create( - self, draft: ApiClientDraft, *, expand: OptionalListStr = None - ) -> ApiClient: - """Manage your API Clients via an API. Useful for Infrastructure-as-Code - tooling, and regularly rotating API secrets. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="api-clients", - params=params, - data_object=draft, - response_class=ApiClient, - ) - - def delete_by_id(self, id, *, force_delete: bool = False) -> ApiClient: - """Delete ApiClient by ID""" - params: typing.Dict[str, str] = {} - return self._client._delete( - endpoint=f"api-clients/{id}", - params=params, - response_class=ApiClient, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/cart_discounts.py b/src/commercetools/services/cart_discounts.py deleted file mode 100644 index f1a52754..00000000 --- a/src/commercetools/services/cart_discounts.py +++ /dev/null @@ -1,170 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.cart_discount import ( - CartDiscount, - CartDiscountDraft, - CartDiscountPagedQueryResponse, - CartDiscountUpdate, - CartDiscountUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _CartDiscountQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _CartDiscountUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _CartDiscountDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class CartDiscountService(abstract.AbstractService): - """Cart discounts are used to change the prices of different elements within a - cart.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> CartDiscount: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"cart-discounts/{id}", params=params, response_class=CartDiscount - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> CartDiscount: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"cart-discounts/key={key}", - params=params, - response_class=CartDiscount, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CartDiscountPagedQueryResponse: - """Cart discounts are used to change the prices of different elements within - a cart. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _CartDiscountQuerySchema, - ) - return self._client._get( - endpoint="cart-discounts", - params=params, - response_class=CartDiscountPagedQueryResponse, - ) - - def create( - self, draft: CartDiscountDraft, *, expand: OptionalListStr = None - ) -> CartDiscount: - """Cart discounts are used to change the prices of different elements within - a cart. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="cart-discounts", - params=params, - data_object=draft, - response_class=CartDiscount, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[CartDiscountUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> CartDiscount: - params = self._serialize_params({"expand": expand}, _CartDiscountUpdateSchema) - update_action = CartDiscountUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"cart-discounts/{id}", - params=params, - data_object=update_action, - response_class=CartDiscount, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[CartDiscountUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> CartDiscount: - params = self._serialize_params({"expand": expand}, _CartDiscountUpdateSchema) - update_action = CartDiscountUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"cart-discounts/key={key}", - params=params, - data_object=update_action, - response_class=CartDiscount, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> CartDiscount: - params = self._serialize_params( - {"version": version, "expand": expand}, _CartDiscountDeleteSchema - ) - return self._client._delete( - endpoint=f"cart-discounts/{id}", - params=params, - response_class=CartDiscount, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> CartDiscount: - params = self._serialize_params( - {"version": version, "expand": expand}, _CartDiscountDeleteSchema - ) - return self._client._delete( - endpoint=f"cart-discounts/key={key}", - params=params, - response_class=CartDiscount, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/carts.py b/src/commercetools/services/carts.py deleted file mode 100644 index ab07afd3..00000000 --- a/src/commercetools/services/carts.py +++ /dev/null @@ -1,159 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from marshmallow import fields - -from commercetools.helpers import OptionalList, RemoveEmptyValuesMixin -from commercetools.platform.models.cart import ( - Cart, - CartDraft, - CartPagedQueryResponse, - CartUpdate, - CartUpdateAction, - ReplicaCartDraft, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _CartQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - customer_id = OptionalList(fields.String(), data_key="customerId", required=False) - - -class _CartUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _CartDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.DataErasureSchema -): - pass - - -class CartService(abstract.AbstractService): - """A shopping cart holds product variants and can be ordered.""" - - def get_by_customer_id( - self, customer_id: str, *, expand: OptionalListStr = None - ) -> Cart: - """Retrieves the active cart of the customer that has been modified most - recently. - - It does not consider carts with CartOrigin Merchant. If no active cart - exists, a 404 Not Found error is returned. The cart may not contain up- - to-date prices, discounts etc. If you want to ensure they're up-to-date, - send an Update request with the Recalculate update action instead. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"carts/customer-id={customer_id}", - params=params, - response_class=Cart, - ) - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Cart: - """The cart may not contain up-to-date prices, discounts etc. - - If you want to ensure they're up-to-date, send an Update request with the - Recalculate update action instead. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"carts/{id}", params=params, response_class=Cart - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - customer_id: str = None, - ) -> CartPagedQueryResponse: - """A shopping cart holds product variants and can be ordered.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - "customer_id": customer_id, - }, - _CartQuerySchema, - ) - return self._client._get( - endpoint="carts", params=params, response_class=CartPagedQueryResponse - ) - - def create(self, draft: CartDraft, *, expand: OptionalListStr = None) -> Cart: - """Creating a cart can fail with an InvalidOperation if the referenced - shipping method in the - - CartDraft has a predicate which does not match the cart. A shopping - cart holds product variants and can be ordered. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="carts", params=params, data_object=draft, response_class=Cart - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[CartUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Cart: - params = self._serialize_params({"expand": expand}, _CartUpdateSchema) - update_action = CartUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"carts/{id}", - params=params, - data_object=update_action, - response_class=Cart, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Cart: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _CartDeleteSchema, - ) - return self._client._delete( - endpoint=f"carts/{id}", - params=params, - response_class=Cart, - force_delete=force_delete, - ) - - def replicate(self, draft: ReplicaCartDraft) -> Cart: - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="carts/replicate", - params=params, - data_object=draft, - response_class=Cart, - ) diff --git a/src/commercetools/services/categories.py b/src/commercetools/services/categories.py deleted file mode 100644 index cfb83ea1..00000000 --- a/src/commercetools/services/categories.py +++ /dev/null @@ -1,166 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.category import ( - Category, - CategoryDraft, - CategoryPagedQueryResponse, - CategoryUpdate, - CategoryUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _CategoryQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _CategoryUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _CategoryDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class CategoryService(abstract.AbstractService): - """Categories are used to organize products in a hierarchical structure.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Category: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"categories/{id}", params=params, response_class=Category - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Category: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"categories/key={key}", params=params, response_class=Category - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CategoryPagedQueryResponse: - """Categories are used to organize products in a hierarchical structure.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _CategoryQuerySchema, - ) - return self._client._get( - endpoint="categories", - params=params, - response_class=CategoryPagedQueryResponse, - ) - - def create( - self, draft: CategoryDraft, *, expand: OptionalListStr = None - ) -> Category: - """Creating a category produces the CategoryCreated message. - - Categories are used to organize products in a hierarchical structure. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="categories", - params=params, - data_object=draft, - response_class=Category, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[CategoryUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Category: - params = self._serialize_params({"expand": expand}, _CategoryUpdateSchema) - update_action = CategoryUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"categories/{id}", - params=params, - data_object=update_action, - response_class=Category, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[CategoryUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Category: - params = self._serialize_params({"expand": expand}, _CategoryUpdateSchema) - update_action = CategoryUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"categories/key={key}", - params=params, - data_object=update_action, - response_class=Category, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Category: - params = self._serialize_params( - {"version": version, "expand": expand}, _CategoryDeleteSchema - ) - return self._client._delete( - endpoint=f"categories/{id}", - params=params, - response_class=Category, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Category: - params = self._serialize_params( - {"version": version, "expand": expand}, _CategoryDeleteSchema - ) - return self._client._delete( - endpoint=f"categories/key={key}", - params=params, - response_class=Category, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/channels.py b/src/commercetools/services/channels.py deleted file mode 100644 index 694e1bbf..00000000 --- a/src/commercetools/services/channels.py +++ /dev/null @@ -1,123 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.channel import ( - Channel, - ChannelDraft, - ChannelPagedQueryResponse, - ChannelUpdate, - ChannelUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ChannelQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ChannelUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ChannelDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class ChannelService(abstract.AbstractService): - """Channels represent a source or destination of different entities. - - They can be used to model warehouses or stores. - """ - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Channel: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"channels/{id}", params=params, response_class=Channel - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ChannelPagedQueryResponse: - """Channels represent a source or destination of different entities. They - can be used to model warehouses or stores. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ChannelQuerySchema, - ) - return self._client._get( - endpoint="channels", params=params, response_class=ChannelPagedQueryResponse - ) - - def create(self, draft: ChannelDraft, *, expand: OptionalListStr = None) -> Channel: - """Channels represent a source or destination of different entities. They - can be used to model warehouses or stores. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="channels", - params=params, - data_object=draft, - response_class=Channel, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ChannelUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Channel: - params = self._serialize_params({"expand": expand}, _ChannelUpdateSchema) - update_action = ChannelUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"channels/{id}", - params=params, - data_object=update_action, - response_class=Channel, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Channel: - params = self._serialize_params( - {"version": version, "expand": expand}, _ChannelDeleteSchema - ) - return self._client._delete( - endpoint=f"channels/{id}", - params=params, - response_class=Channel, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/custom_objects.py b/src/commercetools/services/custom_objects.py deleted file mode 100644 index 4ba207f5..00000000 --- a/src/commercetools/services/custom_objects.py +++ /dev/null @@ -1,175 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from marshmallow import fields - -from commercetools.helpers import OptionalList, RemoveEmptyValuesMixin -from commercetools.platform.models.custom_object import ( - CustomObject, - CustomObjectDraft, - CustomObjectPagedQueryResponse, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _CustomObjectQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _CustomObjectDeleteSchema( - traits.DataErasureSchema, traits.VersionedSchema, traits.ExpandableSchema -): - version = OptionalList(fields.String(), required=False) - - -class CustomObjectService(abstract.AbstractService): - """Store custom JSON values.""" - - def get_by_container_and_key( - self, container, key, *, expand: OptionalListStr = None - ) -> CustomObject: - """Get CustomObject by container and key""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"custom-objects/{container}/{key}", - params=params, - response_class=CustomObject, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CustomObjectPagedQueryResponse: - """The query endpoint allows to retrieve custom objects in a specific - container or all custom objects. - - For performance reasons, it is highly advisable to query only for custom - objects in a container by using the container field in the where - predicate. Store custom JSON values. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _CustomObjectQuerySchema, - ) - return self._client._get( - endpoint="custom-objects", - params=params, - response_class=CustomObjectPagedQueryResponse, - ) - - def query_by_container( - self, - container: str, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CustomObjectPagedQueryResponse: - """Store custom JSON values.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _CustomObjectQuerySchema, - ) - return self._client._get( - endpoint=f"custom-objects/{container}", - params=params, - response_class=CustomObjectPagedQueryResponse, - ) - - def create_or_update( - self, draft: CustomObjectDraft, *, expand: OptionalListStr = None - ) -> CustomObject: - """Creates a new custom object or updates an existing custom object. - - If an object with the given container/key exists, the object will be - replaced with the new value and the version is incremented. If the - request contains a version and an object with the given container/key - exists then the version must match the version of the existing object. - Concurrent updates for the same custom object still can result in a - Conflict (409) even if the version is not provided. Fields with null - values will not be saved. Store custom JSON values. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="custom-objects", - params=params, - data_object=draft, - response_class=CustomObject, - ) - - def create( - self, draft: CustomObjectDraft, *, expand: OptionalListStr = None - ) -> CustomObject: - """Creates a new custom object or updates an existing custom object. - - If an object with the given container/key exists, the object will be - replaced with the new value and the version is incremented. If the - request contains a version and an object with the given container/key - exists then the version must match the version of the existing object. - Concurrent updates for the same custom object still can result in a - Conflict (409) even if the version is not provided. Fields with null - values will not be saved. Store custom JSON values. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="custom-objects", - params=params, - data_object=draft, - response_class=CustomObject, - ) - - def delete_by_container_and_key( - self, - container, - key, - *, - data_erasure: bool = None, - version: str = None, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> CustomObject: - """Delete CustomObject by container and key""" - params = self._serialize_params( - {"data_erasure": data_erasure, "version": version, "expand": expand}, - _CustomObjectDeleteSchema, - ) - return self._client._delete( - endpoint=f"custom-objects/{container}/{key}", - params=params, - response_class=CustomObject, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/customer_groups.py b/src/commercetools/services/customer_groups.py deleted file mode 100644 index ee353e64..00000000 --- a/src/commercetools/services/customer_groups.py +++ /dev/null @@ -1,169 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.customer_group import ( - CustomerGroup, - CustomerGroupDraft, - CustomerGroupPagedQueryResponse, - CustomerGroupUpdate, - CustomerGroupUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _CustomerGroupQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _CustomerGroupUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _CustomerGroupDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class CustomerGroupService(abstract.AbstractService): - """customer-groups are used to evaluate products and channels.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> CustomerGroup: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"customer-groups/{id}", - params=params, - response_class=CustomerGroup, - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> CustomerGroup: - """Gets a customer group by Key.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"customer-groups/key={key}", - params=params, - response_class=CustomerGroup, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CustomerGroupPagedQueryResponse: - """customer-groups are used to evaluate products and channels.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _CustomerGroupQuerySchema, - ) - return self._client._get( - endpoint="customer-groups", - params=params, - response_class=CustomerGroupPagedQueryResponse, - ) - - def create( - self, draft: CustomerGroupDraft, *, expand: OptionalListStr = None - ) -> CustomerGroup: - """customer-groups are used to evaluate products and channels.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="customer-groups", - params=params, - data_object=draft, - response_class=CustomerGroup, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[CustomerGroupUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> CustomerGroup: - params = self._serialize_params({"expand": expand}, _CustomerGroupUpdateSchema) - update_action = CustomerGroupUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"customer-groups/{id}", - params=params, - data_object=update_action, - response_class=CustomerGroup, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[CustomerGroupUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> CustomerGroup: - """Updates a customer group by Key.""" - params = self._serialize_params({"expand": expand}, _CustomerGroupUpdateSchema) - update_action = CustomerGroupUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"customer-groups/key={key}", - params=params, - data_object=update_action, - response_class=CustomerGroup, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> CustomerGroup: - params = self._serialize_params( - {"version": version, "expand": expand}, _CustomerGroupDeleteSchema - ) - return self._client._delete( - endpoint=f"customer-groups/{id}", - params=params, - response_class=CustomerGroup, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> CustomerGroup: - params = self._serialize_params( - {"version": version, "expand": expand}, _CustomerGroupDeleteSchema - ) - return self._client._delete( - endpoint=f"customer-groups/key={key}", - params=params, - response_class=CustomerGroup, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/customers.py b/src/commercetools/services/customers.py deleted file mode 100644 index 62327f20..00000000 --- a/src/commercetools/services/customers.py +++ /dev/null @@ -1,274 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.customer import ( - Customer, - CustomerChangePassword, - CustomerCreateEmailToken, - CustomerCreatePasswordResetToken, - CustomerDraft, - CustomerEmailVerify, - CustomerPagedQueryResponse, - CustomerResetPassword, - CustomerSignInResult, - CustomerToken, - CustomerUpdate, - CustomerUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _CustomerQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _CustomerUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _CustomerDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.DataErasureSchema -): - pass - - -class CustomerService(abstract.AbstractService): - """A customer is a person purchasing products. - - customers, Orders, Comments and Reviews can be associated to a customer. - """ - - def get_by_email_token( - self, email_token: str, *, expand: OptionalListStr = None - ) -> Customer: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"customers/email-token={email_token}", - params=params, - response_class=Customer, - ) - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Customer: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"customers/{id}", params=params, response_class=Customer - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Customer: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"customers/key={key}", params=params, response_class=Customer - ) - - def get_by_password_token( - self, password_token: str, *, expand: OptionalListStr = None - ) -> Customer: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"customers/password-token={password_token}", - params=params, - response_class=Customer, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CustomerPagedQueryResponse: - """A customer is a person purchasing products. customers, Orders, Comments - and Reviews can be associated to a customer. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _CustomerQuerySchema, - ) - return self._client._get( - endpoint="customers", - params=params, - response_class=CustomerPagedQueryResponse, - ) - - def create( - self, draft: CustomerDraft, *, expand: OptionalListStr = None - ) -> CustomerSignInResult: - """Creates a customer. - - If an anonymous cart is passed in, then the cart is assigned to the - created customer and the version number of the Cart will increase. If the - ID of an anonymous session is given, all carts and orders will be - assigned to the created customer. A customer is a person purchasing - products. customers, Orders, Comments and Reviews can be associated to a - customer. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="customers", - params=params, - data_object=draft, - response_class=CustomerSignInResult, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[CustomerUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Customer: - params = self._serialize_params({"expand": expand}, _CustomerUpdateSchema) - update_action = CustomerUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"customers/{id}", - params=params, - data_object=update_action, - response_class=Customer, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[CustomerUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Customer: - params = self._serialize_params({"expand": expand}, _CustomerUpdateSchema) - update_action = CustomerUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"customers/key={key}", - params=params, - data_object=update_action, - response_class=Customer, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Customer: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _CustomerDeleteSchema, - ) - return self._client._delete( - endpoint=f"customers/{id}", - params=params, - response_class=Customer, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Customer: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _CustomerDeleteSchema, - ) - return self._client._delete( - endpoint=f"customers/key={key}", - params=params, - response_class=Customer, - force_delete=force_delete, - ) - - def email_confirm(self, action: CustomerEmailVerify) -> Customer: - """Verifies customer's email using a token.""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="customers/email/confirm", - params=params, - data_object=action, - response_class=Customer, - ) - - def email_token(self, action: CustomerCreateEmailToken) -> CustomerToken: - """Create a Token for verifying the Customer's Email - - To verify a customer's email, an email token can be created. This should - be embedded in a link and sent to the customer via email. When the - customer clicks on the link, the "verify customer's email" endpoint - should be called, which sets customer's isVerifiedEmail field to true. - """ - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="customers/email-token", - params=params, - data_object=action, - response_class=CustomerToken, - ) - - def password(self, action: CustomerChangePassword) -> Customer: - """Change a customers password""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="customers/password", - params=params, - data_object=action, - response_class=Customer, - ) - - def password_reset(self, action: CustomerResetPassword) -> Customer: - """Set a new password using a token.""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="customers/password/reset", - params=params, - data_object=action, - response_class=Customer, - ) - - def password_token(self, action: CustomerCreatePasswordResetToken) -> CustomerToken: - """The token value is used to reset the password of the customer with the - given email. - - The token is valid only for 10 minutes. The following workflow can be - used to reset the customer's password: * Create a password reset token - and send it embedded in a link to the customer. * When the customer - clicks on the link, the customer is retrieved with the token. * The - customer enters a new password and the "reset customer's password" - endpoint is called. - """ - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="customers/password-token", - params=params, - data_object=action, - response_class=CustomerToken, - ) diff --git a/src/commercetools/services/discount_codes.py b/src/commercetools/services/discount_codes.py deleted file mode 100644 index 5eb868cd..00000000 --- a/src/commercetools/services/discount_codes.py +++ /dev/null @@ -1,129 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.discount_code import ( - DiscountCode, - DiscountCodeDraft, - DiscountCodePagedQueryResponse, - DiscountCodeUpdate, - DiscountCodeUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _DiscountCodeQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _DiscountCodeUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _DiscountCodeDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.DataErasureSchema -): - pass - - -class DiscountCodeService(abstract.AbstractService): - """Discount codes can be added to a discount-code to enable certain discount- - code discounts.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> DiscountCode: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"discount-codes/{id}", params=params, response_class=DiscountCode - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> DiscountCodePagedQueryResponse: - """Discount codes can be added to a discount-code to enable certain - discount-code discounts. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _DiscountCodeQuerySchema, - ) - return self._client._get( - endpoint="discount-codes", - params=params, - response_class=DiscountCodePagedQueryResponse, - ) - - def create( - self, draft: DiscountCodeDraft, *, expand: OptionalListStr = None - ) -> DiscountCode: - """Discount codes can be added to a discount-code to enable certain - discount-code discounts. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="discount-codes", - params=params, - data_object=draft, - response_class=DiscountCode, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[DiscountCodeUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> DiscountCode: - params = self._serialize_params({"expand": expand}, _DiscountCodeUpdateSchema) - update_action = DiscountCodeUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"discount-codes/{id}", - params=params, - data_object=update_action, - response_class=DiscountCode, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> DiscountCode: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _DiscountCodeDeleteSchema, - ) - return self._client._delete( - endpoint=f"discount-codes/{id}", - params=params, - response_class=DiscountCode, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/extensions.py b/src/commercetools/services/extensions.py deleted file mode 100644 index 0b35b4b7..00000000 --- a/src/commercetools/services/extensions.py +++ /dev/null @@ -1,168 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.extension import ( - Extension, - ExtensionDraft, - ExtensionPagedQueryResponse, - ExtensionUpdate, - ExtensionUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ExtensionQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ExtensionUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ExtensionDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class ExtensionService(abstract.AbstractService): - """Extend the behavior of an API with your business logic""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Extension: - """Retrieves the representation of an extension by its id.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"extensions/{id}", params=params, response_class=Extension - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Extension: - """Retrieves the representation of an extension by its key.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"extensions/key={key}", params=params, response_class=Extension - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ExtensionPagedQueryResponse: - """Extend the behavior of an API with your business logic""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ExtensionQuerySchema, - ) - return self._client._get( - endpoint="extensions", - params=params, - response_class=ExtensionPagedQueryResponse, - ) - - def create( - self, draft: ExtensionDraft, *, expand: OptionalListStr = None - ) -> Extension: - """Currently, a maximum of 25 extensions can be created per project. - - Extend the behavior of an API with your business logic - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="extensions", - params=params, - data_object=draft, - response_class=Extension, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ExtensionUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Extension: - params = self._serialize_params({"expand": expand}, _ExtensionUpdateSchema) - update_action = ExtensionUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"extensions/{id}", - params=params, - data_object=update_action, - response_class=Extension, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ExtensionUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Extension: - params = self._serialize_params({"expand": expand}, _ExtensionUpdateSchema) - update_action = ExtensionUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"extensions/key={key}", - params=params, - data_object=update_action, - response_class=Extension, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Extension: - params = self._serialize_params( - {"version": version, "expand": expand}, _ExtensionDeleteSchema - ) - return self._client._delete( - endpoint=f"extensions/{id}", - params=params, - response_class=Extension, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Extension: - params = self._serialize_params( - {"version": version, "expand": expand}, _ExtensionDeleteSchema - ) - return self._client._delete( - endpoint=f"extensions/key={key}", - params=params, - response_class=Extension, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/graphqls.py b/src/commercetools/services/graphqls.py deleted file mode 100644 index f6d18a3a..00000000 --- a/src/commercetools/services/graphqls.py +++ /dev/null @@ -1,25 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.graph_ql import GraphQLResponse -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class GraphqlService(abstract.AbstractService): - """The commercetoolsâ„¢ platform provides a GraphQL API""" - - def create(self) -> GraphQLResponse: - """Execute a GraphQL query - - The commercetoolsâ„¢ platform provides a GraphQL API - """ - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="graphql", - params=params, - data_object=None, - response_class=GraphQLResponse, - ) diff --git a/src/commercetools/services/in_stores.py b/src/commercetools/services/in_stores.py deleted file mode 100644 index c4e290ee..00000000 --- a/src/commercetools/services/in_stores.py +++ /dev/null @@ -1,677 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from marshmallow import fields - -from commercetools.helpers import OptionalList, RemoveEmptyValuesMixin -from commercetools.platform.models.cart import ( - Cart, - CartDraft, - CartPagedQueryResponse, - CartUpdate, - CartUpdateAction, -) -from commercetools.platform.models.customer import ( - Customer, - CustomerChangePassword, - CustomerCreateEmailToken, - CustomerCreatePasswordResetToken, - CustomerDraft, - CustomerEmailVerify, - CustomerPagedQueryResponse, - CustomerResetPassword, - CustomerSignin, - CustomerSignInResult, - CustomerToken, - CustomerUpdate, - CustomerUpdateAction, -) -from commercetools.platform.models.order import ( - Order, - OrderFromCartDraft, - OrderPagedQueryResponse, - OrderUpdate, - OrderUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _In_StoreQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _In_StoreUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _In_StoreDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.DataErasureSchema -): - pass - - -class In_StoreService(abstract.AbstractService): - def cart_get_by_customer_id( - self, store_key, customer_id: str, *, expand: OptionalListStr = None - ) -> Cart: - """Retrieves the active cart of the customer that has been modified most - recently in a specific Store. - - The {storeKey} path parameter maps to a Store's key. If the cart exists - in the commercetools project but does not have the store field, or the - store field references a different store, this method returns a - ResourceNotFound error. The cart may not contain up-to-date prices, - discounts etc. If you want to ensure they're up-to-date, send an Update - request with the Recalculate update action instead. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/carts/customer-id={customer_id}", - params=params, - response_class=Cart, - ) - - def cart_get_by_id( - self, store_key, id: str, *, expand: OptionalListStr = None - ) -> Cart: - """Returns a cart by its ID from a specific Store. - - The {storeKey} path parameter maps to a Store's key. If the cart exists - in the commercetools project but does not have the store field, or the - store field references a different store, this method returns a - ResourceNotFound error. The cart may not contain up-to-date prices, - discounts etc. If you want to ensure they're up-to-date, send an Update - request with the Recalculate update action instead. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/carts/{id}", - params=params, - response_class=Cart, - ) - - def customer_get_by_email_token( - self, store_key, email_token: str, *, expand: OptionalListStr = None - ) -> Customer: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/customers/email-token={email_token}", - params=params, - response_class=Customer, - ) - - def customer_get_by_id( - self, store_key, id: str, *, expand: OptionalListStr = None - ) -> Customer: - """Returns a customer by its ID from a specific Store. - - The {storeKey} path parameter maps to a Store's key. It also considers - customers that do not have the stores field. If the customer exists in - the commercetools project but the stores field references different - stores, this method returns a ResourceNotFound error. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/customers/{id}", - params=params, - response_class=Customer, - ) - - def customer_get_by_key( - self, store_key, key: str, *, expand: OptionalListStr = None - ) -> Customer: - """Returns a customer by its Key from a specific Store. - - The {storeKey} path parameter maps to a Store's key. It also considers - customers that do not have the stores field. If the customer exists in - the commercetools project but the stores field references different - stores, this method returns a ResourceNotFound error. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/customers/key={key}", - params=params, - response_class=Customer, - ) - - def customer_get_by_password_token( - self, store_key, password_token: str, *, expand: OptionalListStr = None - ) -> Customer: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/customers/password-token={password_token}", - params=params, - response_class=Customer, - ) - - def order_get_by_id( - self, store_key, id: str, *, expand: OptionalListStr = None - ) -> Order: - """Returns an order by its ID from a specific Store. - - The {storeKey} path parameter maps to a Store's key. If the order exists - in the commercetools project but does not have the store field, or the - store field references a different store, this method returns a - ResourceNotFound error. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/orders/{id}", - params=params, - response_class=Order, - ) - - def order_get_by_order_number( - self, store_key, order_number: str, *, expand: OptionalListStr = None - ) -> Order: - """Returns an order by its order number from a specific Store. - - The {storeKey} path parameter maps to a Store's key. If the order exists - in the commercetools project but does not have the store field, or the - store field references a different store, this method returns a - ResourceNotFound error. In case the orderNumber does not match the - regular expression [a-zA-Z0-9_\\-]+, it should be provided in URL-encoded - format. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"in-store/key={store_key}/orders/order-number={order_number}", - params=params, - response_class=Order, - ) - - def cart_query( - self, - store_key, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - customer_id: str = None, - ) -> CartPagedQueryResponse: - """Queries carts in a specific Store. - - The {storeKey} path parameter maps to a Store's key. A shopping cart - holds product variants and can be ordered. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - "customer_id": customer_id, - }, - _In_StoreQuerySchema, - ) - return self._client._get( - endpoint=f"in-store/key={store_key}/carts", - params=params, - response_class=CartPagedQueryResponse, - ) - - def customer_query( - self, - store_key, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CustomerPagedQueryResponse: - """A customer is a person purchasing products. customers, Orders, Comments - and Reviews can be associated to a customer. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _In_StoreQuerySchema, - ) - return self._client._get( - endpoint=f"in-store/key={store_key}/customers", - params=params, - response_class=CustomerPagedQueryResponse, - ) - - def order_query( - self, - store_key, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> OrderPagedQueryResponse: - """Queries orders in a specific Store. - - The {storeKey} path parameter maps to a Store's key. An order can be - created from a cart, usually after a checkout process has been completed. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _In_StoreQuerySchema, - ) - return self._client._get( - endpoint=f"in-store/key={store_key}/orders", - params=params, - response_class=OrderPagedQueryResponse, - ) - - def cart_create( - self, store_key, draft: CartDraft, *, expand: OptionalListStr = None - ) -> Cart: - """Creates a cart in the store specified by {storeKey}. - - The {storeKey} path parameter maps to a Store's key. When using this - endpoint the cart's store field is always set to the store specified in - the path parameter. Creating a cart can fail with an InvalidOperation if - the referenced shipping method in the CartDraft has a predicate which - does not match the cart. A shopping cart holds product variants and can - be ordered. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint=f"in-store/key={store_key}/carts", - params=params, - data_object=draft, - response_class=Cart, - ) - - def customer_create( - self, store_key, draft: CustomerDraft, *, expand: OptionalListStr = None - ) -> CustomerSignInResult: - """Creates a customer in a specific Store. - - The {storeKey} path parameter maps to a Store's key. When using this - endpoint, if omitted, the customer's stores field is set to the store - specified in the path parameter. If an anonymous cart is passed in as - when using this method, then the cart is assigned to the created customer - and the version number of the Cart increases. If the ID of an anonymous - session is given, all carts and orders will be assigned to the created - customer and the store specified. If you pass in a cart with a store - field specified, the store field must reference the same store specified - in the {storeKey} path parameter. A customer is a person purchasing - products. customers, Orders, Comments and Reviews can be associated to a - customer. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint=f"in-store/key={store_key}/customers", - params=params, - data_object=draft, - response_class=CustomerSignInResult, - ) - - def order_create( - self, store_key, draft: OrderFromCartDraft, *, expand: OptionalListStr = None - ) -> Order: - """Creates an order from a Cart from a specific Store. - - The {storeKey} path parameter maps to a Store's key. When using this - endpoint the orders's store field is always set to the store specified in - the path parameter. The cart must have a shipping address set before - creating an order. When using the Platform TaxMode, the shipping address - is used for tax calculation. An order can be created from a cart, - usually after a checkout process has been completed. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint=f"in-store/key={store_key}/orders", - params=params, - data_object=draft, - response_class=Order, - ) - - def cart_update_by_id( - self, - store_key, - id: str, - version: int, - actions: typing.List[CartUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Cart: - """Updates a cart in the store specified by {storeKey}. - - The {storeKey} path parameter maps to a Store's key. If the cart exists - in the commercetools project but does not have the store field, or the - store field references a different store, this method returns a - ResourceNotFound error. - """ - params = self._serialize_params({"expand": expand}, _In_StoreUpdateSchema) - update_action = CartUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"in-store/key={store_key}/carts/{id}", - params=params, - data_object=update_action, - response_class=Cart, - force_update=force_update, - ) - - def customer_update_by_id( - self, - store_key, - id: str, - version: int, - actions: typing.List[CustomerUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Customer: - """Updates a customer in the store specified by {storeKey}. - - The {storeKey} path parameter maps to a Store's key. If the customer - exists in the commercetools project but the stores field references a - different store, this method returns a ResourceNotFound error. - """ - params = self._serialize_params({"expand": expand}, _In_StoreUpdateSchema) - update_action = CustomerUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"in-store/key={store_key}/customers/{id}", - params=params, - data_object=update_action, - response_class=Customer, - force_update=force_update, - ) - - def customer_update_by_key( - self, - store_key, - key: str, - version: int, - actions: typing.List[CustomerUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Customer: - """If the customer exists in the commercetools project but the stores - field references a different store, - - this method returns a ResourceNotFound error. - """ - params = self._serialize_params({"expand": expand}, _In_StoreUpdateSchema) - update_action = CustomerUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"in-store/key={store_key}/customers/key={key}", - params=params, - data_object=update_action, - response_class=Customer, - force_update=force_update, - ) - - def order_update_by_id( - self, - store_key, - id: str, - version: int, - actions: typing.List[OrderUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Order: - """Updates an order in the store specified by {storeKey}. - - The {storeKey} path parameter maps to a Store's key. If the order exists - in the commercetools project but does not have the store field, or the - store field references a different store, this method returns a - ResourceNotFound error. - """ - params = self._serialize_params({"expand": expand}, _In_StoreUpdateSchema) - update_action = OrderUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"in-store/key={store_key}/orders/{id}", - params=params, - data_object=update_action, - response_class=Order, - force_update=force_update, - ) - - def order_update_by_order_number( - self, - store_key, - order_number: str, - version: int, - actions: typing.List[OrderUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Order: - """Updates an order in the store specified by {storeKey}. - - The {storeKey} path parameter maps to a Store's key. If the order exists - in the commercetools project but does not have the store field, or the - store field references a different store, this method returns a - ResourceNotFound error. In case the orderNumber does not match the - regular expression [a-zA-Z0-9_\\-]+, it should be provided in URL-encoded - format. - """ - params = self._serialize_params({"expand": expand}, _In_StoreUpdateSchema) - update_action = OrderUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"in-store/key={store_key}/orders/order-number={order_number}", - params=params, - data_object=update_action, - response_class=Order, - force_update=force_update, - ) - - def cart_delete_by_id( - self, - store_key, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Cart: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _In_StoreDeleteSchema, - ) - return self._client._delete( - endpoint=f"in-store/key={store_key}/carts/{id}", - params=params, - response_class=Cart, - force_delete=force_delete, - ) - - def customer_delete_by_id( - self, - store_key, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Customer: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _In_StoreDeleteSchema, - ) - return self._client._delete( - endpoint=f"in-store/key={store_key}/customers/{id}", - params=params, - response_class=Customer, - force_delete=force_delete, - ) - - def customer_delete_by_key( - self, - store_key, - key: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Customer: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _In_StoreDeleteSchema, - ) - return self._client._delete( - endpoint=f"in-store/key={store_key}/customers/key={key}", - params=params, - response_class=Customer, - force_delete=force_delete, - ) - - def order_delete_by_id( - self, - store_key, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Order: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _In_StoreDeleteSchema, - ) - return self._client._delete( - endpoint=f"in-store/key={store_key}/orders/{id}", - params=params, - response_class=Order, - force_delete=force_delete, - ) - - def order_delete_by_order_number( - self, - store_key, - order_number: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Order: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _In_StoreDeleteSchema, - ) - return self._client._delete( - endpoint=f"in-store/key={store_key}/orders/order-number={order_number}", - params=params, - response_class=Order, - force_delete=force_delete, - ) - - def customer_email_confirm(self, action: CustomerEmailVerify) -> Customer: - """Verifies customer's email using a token.""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint=f"in-store/key={store_key}/customers/email/confirm", - params=params, - data_object=action, - response_class=Customer, - ) - - def customer_email_token(self, action: CustomerCreateEmailToken) -> CustomerToken: - """Create a Token for verifying the Customer's Email in store - - To verify a customer's email, an email token can be created. This should - be embedded in a link and sent to the customer via email. When the - customer clicks on the link, the "verify customer's email" endpoint - should be called, which sets customer's isVerifiedEmail field to true. - """ - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint=f"in-store/key={store_key}/customers/email-token", - params=params, - data_object=action, - response_class=CustomerToken, - ) - - def customer_password(self, action: CustomerChangePassword) -> Customer: - """Change a customers password""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint=f"in-store/key={store_key}/customers/password", - params=params, - data_object=action, - response_class=Customer, - ) - - def customer_password_reset(self, action: CustomerResetPassword) -> Customer: - """Set a new password using a token.""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint=f"in-store/key={store_key}/customers/password/reset", - params=params, - data_object=action, - response_class=Customer, - ) - - def customer_password_token( - self, action: CustomerCreatePasswordResetToken - ) -> CustomerToken: - """The token value is used to reset the password of the customer with the - given email. - - The token is valid only for 10 minutes. The following workflow can be - used to reset the customer's password: * Create a password reset token - and send it embedded in a link to the customer. * When the customer - clicks on the link, the customer is retrieved with the token. * The - customer enters a new password and the "reset customer's password" - endpoint is called. - """ - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint=f"in-store/key={store_key}/customers/password-token", - params=params, - data_object=action, - response_class=CustomerToken, - ) - - def login(self, action: CustomerSignin) -> CustomerSignInResult: - """Authenticate Customer (Sign In) in store - - Retrieves the authenticated customer. - """ - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint=f"in-store/key={store_key}/login", - params=params, - data_object=action, - response_class=CustomerSignInResult, - ) diff --git a/src/commercetools/services/inventory.py b/src/commercetools/services/inventory.py deleted file mode 100644 index fb677121..00000000 --- a/src/commercetools/services/inventory.py +++ /dev/null @@ -1,120 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.inventory import ( - InventoryEntry, - InventoryEntryDraft, - InventoryEntryUpdate, - InventoryEntryUpdateAction, - InventoryPagedQueryResponse, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _InventoryEntryQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _InventoryEntryUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _InventoryEntryDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class InventoryEntryService(abstract.AbstractService): - """Inventory allows you to track stock quantities.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> InventoryEntry: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"inventory/{id}", params=params, response_class=InventoryEntry - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> InventoryPagedQueryResponse: - """Inventory allows you to track stock quantities.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _InventoryEntryQuerySchema, - ) - return self._client._get( - endpoint="inventory", - params=params, - response_class=InventoryPagedQueryResponse, - ) - - def create( - self, draft: InventoryEntryDraft, *, expand: OptionalListStr = None - ) -> InventoryEntry: - """Inventory allows you to track stock quantities.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="inventory", - params=params, - data_object=draft, - response_class=InventoryEntry, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[InventoryEntryUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> InventoryEntry: - params = self._serialize_params({"expand": expand}, _InventoryEntryUpdateSchema) - update_action = InventoryEntryUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"inventory/{id}", - params=params, - data_object=update_action, - response_class=InventoryEntry, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> InventoryEntry: - params = self._serialize_params( - {"version": version, "expand": expand}, _InventoryEntryDeleteSchema - ) - return self._client._delete( - endpoint=f"inventory/{id}", - params=params, - response_class=InventoryEntry, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/login.py b/src/commercetools/services/login.py deleted file mode 100644 index aaf52390..00000000 --- a/src/commercetools/services/login.py +++ /dev/null @@ -1,31 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.customer import CustomerSignInResult -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class LoginService(abstract.AbstractService): - """Retrieves the authenticated customer.""" - - def create(self) -> CustomerSignInResult: - """Authenticate Customer (Sign In). - - Retrieves the authenticated customer (a customer that matches the given - email/password pair). If used with an access token for Anonymous - Sessions, all orders and carts belonging to the anonymousId will be - assigned to the newly created customer. If a cart is is returned as part - of the CustomerSignInResult, it has been recalculated (It will have up- - to-date prices, taxes and discounts, and invalid line items have been - removed.). Retrieves the authenticated customer. - """ - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="login", - params=params, - data_object=None, - response_class=CustomerSignInResult, - ) diff --git a/src/commercetools/services/me.py b/src/commercetools/services/me.py deleted file mode 100644 index 1c89654b..00000000 --- a/src/commercetools/services/me.py +++ /dev/null @@ -1,530 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.cart import CartPagedQueryResponse -from commercetools.platform.models.customer import CustomerSignInResult -from commercetools.platform.models.me import ( - MyCart, - MyCartDraft, - MyCartUpdate, - MyCartUpdateAction, - MyCustomer, - MyCustomerDraft, - MyOrder, - MyOrderFromCartDraft, - MyPayment, - MyPaymentDraft, - MyPaymentPagedQueryResponse, - MyPaymentUpdate, - MyPaymentUpdateAction, - MyShoppingListDraft, - MyShoppingListUpdate, - MyShoppingListUpdateAction, -) -from commercetools.platform.models.order import OrderPagedQueryResponse -from commercetools.platform.models.shopping_list import ( - MyShoppingList, - ShoppingListPagedQueryResponse, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _MeQuerySchema( - traits.SortableSchema, - traits.PagingSchema, - traits.ExpandableSchema, - traits.QuerySchema, -): - pass - - -class _MeUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _MeDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class MeService(abstract.AbstractService): - def my_cart_get_by_id(self, id: str, *, expand: OptionalListStr = None) -> MyCart: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"me/carts/{id}", params=params, response_class=MyCart - ) - - def my_order_get_by_id(self, id: str, *, expand: OptionalListStr = None) -> MyOrder: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"me/orders/{id}", params=params, response_class=MyOrder - ) - - def my_payment_get_by_id( - self, id: str, *, expand: OptionalListStr = None - ) -> MyPayment: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"me/payments/{id}", params=params, response_class=MyPayment - ) - - def my_payment_get_by_key( - self, key: str, *, expand: OptionalListStr = None - ) -> MyPayment: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"me/payments/key={key}", params=params, response_class=MyPayment - ) - - def my_shopping_list_get_by_id( - self, id: str, *, expand: OptionalListStr = None - ) -> MyShoppingList: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"me/shopping-lists/{id}", - params=params, - response_class=MyShoppingList, - ) - - def my_shopping_list_get_by_key( - self, key: str, *, expand: OptionalListStr = None - ) -> MyShoppingList: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"me/shopping-lists/key={key}", - params=params, - response_class=MyShoppingList, - ) - - def my_cart_query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> CartPagedQueryResponse: - """A shopping cart holds product variants and can be ordered.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _MeQuerySchema, - ) - return self._client._get( - endpoint="me/carts", params=params, response_class=CartPagedQueryResponse - ) - - def my_order_query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> OrderPagedQueryResponse: - """An order can be created from a cart, usually after a checkout process has - been completed. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _MeQuerySchema, - ) - return self._client._get( - endpoint="me/orders", params=params, response_class=OrderPagedQueryResponse - ) - - def my_payment_query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> MyPaymentPagedQueryResponse: - """The My Payments endpoint creates and provides access to payments scoped - to a specific user. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _MeQuerySchema, - ) - return self._client._get( - endpoint="me/payments", - params=params, - response_class=MyPaymentPagedQueryResponse, - ) - - def my_shopping_list_query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ShoppingListPagedQueryResponse: - """The My Shopping Lists endpoint creates and provides access to shopping - lists scoped to a specific user. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _MeQuerySchema, - ) - return self._client._get( - endpoint="me/shopping-lists", - params=params, - response_class=ShoppingListPagedQueryResponse, - ) - - def query( - self, - *, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - expand: OptionalListStr = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> MyCustomer: - params = self._serialize_params( - { - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "expand": expand, - "where": where, - "predicate_var": predicate_var, - }, - _MeQuerySchema, - ) - return self._client._get( - endpoint="me", params=params, response_class=MyCustomer - ) - - def create(self) -> MyCustomer: - """Update my customer""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="me", params=params, data_object=None, response_class=MyCustomer - ) - - def my_cart_create( - self, draft: MyCartDraft, *, expand: OptionalListStr = None - ) -> MyCart: - """A shopping cart holds product variants and can be ordered.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="me/carts", params=params, data_object=draft, response_class=MyCart - ) - - def my_order_create( - self, draft: MyOrderFromCartDraft, *, expand: OptionalListStr = None - ) -> MyOrder: - """An order can be created from a cart, usually after a checkout process has - been completed. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="me/orders", - params=params, - data_object=draft, - response_class=MyOrder, - ) - - def my_payment_create( - self, draft: MyPaymentDraft, *, expand: OptionalListStr = None - ) -> MyPayment: - """The My Payments endpoint creates and provides access to payments scoped - to a specific user. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="me/payments", - params=params, - data_object=draft, - response_class=MyPayment, - ) - - def my_shopping_list_create( - self, draft: MyShoppingListDraft, *, expand: OptionalListStr = None - ) -> MyShoppingList: - """The My Shopping Lists endpoint creates and provides access to shopping - lists scoped to a specific user. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="me/shopping-lists", - params=params, - data_object=draft, - response_class=MyShoppingList, - ) - - def my_cart_update_by_id( - self, - id: str, - version: int, - actions: typing.List[MyCartUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> MyCart: - params = self._serialize_params({"expand": expand}, _MeUpdateSchema) - update_action = MyCartUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"me/carts/{id}", - params=params, - data_object=update_action, - response_class=MyCart, - force_update=force_update, - ) - - def my_payment_update_by_id( - self, - id: str, - version: int, - actions: typing.List[MyPaymentUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> MyPayment: - params = self._serialize_params({"expand": expand}, _MeUpdateSchema) - update_action = MyPaymentUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"me/payments/{id}", - params=params, - data_object=update_action, - response_class=MyPayment, - force_update=force_update, - ) - - def my_payment_update_by_key( - self, - key: str, - version: int, - actions: typing.List[MyPaymentUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> MyPayment: - params = self._serialize_params({"expand": expand}, _MeUpdateSchema) - update_action = MyPaymentUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"me/payments/key={key}", - params=params, - data_object=update_action, - response_class=MyPayment, - force_update=force_update, - ) - - def my_shopping_list_update_by_id( - self, - id: str, - version: int, - actions: typing.List[MyShoppingListUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> MyShoppingList: - params = self._serialize_params({"expand": expand}, _MeUpdateSchema) - update_action = MyShoppingListUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"me/shopping-lists/{id}", - params=params, - data_object=update_action, - response_class=MyShoppingList, - force_update=force_update, - ) - - def my_shopping_list_update_by_key( - self, - key: str, - version: int, - actions: typing.List[MyShoppingListUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> MyShoppingList: - params = self._serialize_params({"expand": expand}, _MeUpdateSchema) - update_action = MyShoppingListUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"me/shopping-lists/key={key}", - params=params, - data_object=update_action, - response_class=MyShoppingList, - force_update=force_update, - ) - - def my_cart_delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> MyCart: - params = self._serialize_params( - {"version": version, "expand": expand}, _MeDeleteSchema - ) - return self._client._delete( - endpoint=f"me/carts/{id}", - params=params, - response_class=MyCart, - force_delete=force_delete, - ) - - def my_payment_delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> MyPayment: - params = self._serialize_params( - {"version": version, "expand": expand}, _MeDeleteSchema - ) - return self._client._delete( - endpoint=f"me/payments/{id}", - params=params, - response_class=MyPayment, - force_delete=force_delete, - ) - - def my_payment_delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> MyPayment: - params = self._serialize_params( - {"version": version, "expand": expand}, _MeDeleteSchema - ) - return self._client._delete( - endpoint=f"me/payments/key={key}", - params=params, - response_class=MyPayment, - force_delete=force_delete, - ) - - def my_shopping_list_delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> MyShoppingList: - params = self._serialize_params( - {"version": version, "expand": expand}, _MeDeleteSchema - ) - return self._client._delete( - endpoint=f"me/shopping-lists/{id}", - params=params, - response_class=MyShoppingList, - force_delete=force_delete, - ) - - def my_shopping_list_delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> MyShoppingList: - params = self._serialize_params( - {"version": version, "expand": expand}, _MeDeleteSchema - ) - return self._client._delete( - endpoint=f"me/shopping-lists/key={key}", - params=params, - response_class=MyShoppingList, - force_delete=force_delete, - ) - - def active_cart(self) -> MyCart: - params: typing.Dict[str, str] = {} - return self._client._get( - endpoint="me/active-cart", params=params, response_class=MyCart - ) - - def email_confirm(self): - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="me/email/confirm", params=params, data_object=None - ) - - def login(self) -> CustomerSignInResult: - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="me/login", - params=params, - data_object=None, - response_class=CustomerSignInResult, - ) - - def password(self) -> MyCustomer: - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="me/password", - params=params, - data_object=None, - response_class=MyCustomer, - ) - - def signup(self, draft: MyCustomerDraft) -> CustomerSignInResult: - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="me/signup", - params=params, - data_object=draft, - response_class=CustomerSignInResult, - ) diff --git a/src/commercetools/services/messages.py b/src/commercetools/services/messages.py deleted file mode 100644 index c67548f7..00000000 --- a/src/commercetools/services/messages.py +++ /dev/null @@ -1,58 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.message import Message, MessagePagedQueryResponse -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _MessageQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class MessageService(abstract.AbstractService): - """A message represents a change or an action performed on a resource (like an - Order or a Product).""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Message: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"messages/{id}", params=params, response_class=Message - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> MessagePagedQueryResponse: - """A message represents a change or an action performed on a resource (like - an Order or a Product). - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _MessageQuerySchema, - ) - return self._client._get( - endpoint="messages", params=params, response_class=MessagePagedQueryResponse - ) diff --git a/src/commercetools/services/orders.py b/src/commercetools/services/orders.py deleted file mode 100644 index e4d03513..00000000 --- a/src/commercetools/services/orders.py +++ /dev/null @@ -1,344 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.order import ( - Order, - OrderFromCartDraft, - OrderImportDraft, - OrderPagedQueryResponse, - OrderUpdate, - OrderUpdateAction, -) -from commercetools.platform.models.order_edit import ( - OrderEdit, - OrderEditApply, - OrderEditDraft, - OrderEditPagedQueryResponse, - OrderEditUpdate, - OrderEditUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _OrderQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _OrderUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _OrderDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class OrderService(abstract.AbstractService): - """An order can be created from a order, usually after a checkout process has - been completed.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Order: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"orders/{id}", params=params, response_class=Order - ) - - def get_by_order_number( - self, order_number: str, *, expand: OptionalListStr = None - ) -> Order: - """In case the orderNumber does not match the regular expression - [a-zA-Z0-9_\\-]+, - - it should be provided in URL-encoded format. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"orders/order-number={order_number}", - params=params, - response_class=Order, - ) - - def order_edit_get_by_id( - self, id: str, *, expand: OptionalListStr = None - ) -> OrderEdit: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"orders/edits/{id}", params=params, response_class=OrderEdit - ) - - def order_edit_get_by_key( - self, key: str, *, expand: OptionalListStr = None - ) -> OrderEdit: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"orders/edits/key={key}", params=params, response_class=OrderEdit - ) - - def order_edit_query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> OrderEditPagedQueryResponse: - """OrderEdit are containers for financial changes after an Order has been - placed. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _OrderQuerySchema, - ) - return self._client._get( - endpoint="orders/edits", - params=params, - response_class=OrderEditPagedQueryResponse, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> OrderPagedQueryResponse: - """An order can be created from a order, usually after a checkout process - has been completed. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _OrderQuerySchema, - ) - return self._client._get( - endpoint="orders", params=params, response_class=OrderPagedQueryResponse - ) - - def create( - self, draft: OrderFromCartDraft, *, expand: OptionalListStr = None - ) -> Order: - """Creates an order from a Cart. - - The cart must have a shipping address set before creating an order. When - using the Platform TaxMode, the shipping address is used for tax - calculation. An order can be created from a order, usually after a - checkout process has been completed. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="orders", params=params, data_object=draft, response_class=Order - ) - - def order_edit_create( - self, draft: OrderEditDraft, *, expand: OptionalListStr = None - ) -> OrderEdit: - """OrderEdit are containers for financial changes after an Order has been - placed. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="orders/edits", - params=params, - data_object=draft, - response_class=OrderEdit, - ) - - def order_edit_update_by_id( - self, - id: str, - version: int, - actions: typing.List[OrderEditUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> OrderEdit: - params = self._serialize_params({"expand": expand}, _OrderUpdateSchema) - update_action = OrderEditUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"orders/edits/{id}", - params=params, - data_object=update_action, - response_class=OrderEdit, - force_update=force_update, - ) - - def order_edit_update_by_key( - self, - key: str, - version: int, - actions: typing.List[OrderEditUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> OrderEdit: - params = self._serialize_params({"expand": expand}, _OrderUpdateSchema) - update_action = OrderEditUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"orders/edits/key={key}", - params=params, - data_object=update_action, - response_class=OrderEdit, - force_update=force_update, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[OrderUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Order: - params = self._serialize_params({"expand": expand}, _OrderUpdateSchema) - update_action = OrderUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"orders/{id}", - params=params, - data_object=update_action, - response_class=Order, - force_update=force_update, - ) - - def update_by_order_number( - self, - order_number: str, - version: int, - actions: typing.List[OrderUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Order: - params = self._serialize_params({"expand": expand}, _OrderUpdateSchema) - update_action = OrderUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"orders/order-number={order_number}", - params=params, - data_object=update_action, - response_class=Order, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Order: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _OrderDeleteSchema, - ) - return self._client._delete( - endpoint=f"orders/{id}", - params=params, - response_class=Order, - force_delete=force_delete, - ) - - def delete_by_order_number( - self, - order_number: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Order: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _OrderDeleteSchema, - ) - return self._client._delete( - endpoint=f"orders/order-number={order_number}", - params=params, - response_class=Order, - force_delete=force_delete, - ) - - def order_edit_delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> OrderEdit: - params = self._serialize_params( - {"version": version, "expand": expand}, _OrderDeleteSchema - ) - return self._client._delete( - endpoint=f"orders/edits/{id}", - params=params, - response_class=OrderEdit, - force_delete=force_delete, - ) - - def order_edit_delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> OrderEdit: - params = self._serialize_params( - {"version": version, "expand": expand}, _OrderDeleteSchema - ) - return self._client._delete( - endpoint=f"orders/edits/key={key}", - params=params, - response_class=OrderEdit, - force_delete=force_delete, - ) - - def import_(self, draft: OrderImportDraft) -> Order: - """Create an Order by Import""" - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="orders/import", - params=params, - data_object=draft, - response_class=Order, - ) - - def order_edit_apply(self, id: str, action: OrderEditApply) -> OrderEdit: - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint=f"orders/edits/{id}/apply", - params=params, - data_object=action, - response_class=OrderEdit, - ) diff --git a/src/commercetools/services/payments.py b/src/commercetools/services/payments.py deleted file mode 100644 index e11c7b25..00000000 --- a/src/commercetools/services/payments.py +++ /dev/null @@ -1,173 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.payment import ( - Payment, - PaymentDraft, - PaymentPagedQueryResponse, - PaymentUpdate, - PaymentUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _PaymentQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _PaymentUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _PaymentDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.DataErasureSchema -): - pass - - -class PaymentService(abstract.AbstractService): - """Payments hold information about the current state of receiving and/or - refunding money""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Payment: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"payments/{id}", params=params, response_class=Payment - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Payment: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"payments/key={key}", params=params, response_class=Payment - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> PaymentPagedQueryResponse: - """Payments hold information about the current state of receiving and/or - refunding money - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _PaymentQuerySchema, - ) - return self._client._get( - endpoint="payments", params=params, response_class=PaymentPagedQueryResponse - ) - - def create(self, draft: PaymentDraft, *, expand: OptionalListStr = None) -> Payment: - """To create a payment object a payment draft object has to be given with - the request. - - Payments hold information about the current state of receiving and/or - refunding money - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="payments", - params=params, - data_object=draft, - response_class=Payment, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[PaymentUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Payment: - params = self._serialize_params({"expand": expand}, _PaymentUpdateSchema) - update_action = PaymentUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"payments/{id}", - params=params, - data_object=update_action, - response_class=Payment, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[PaymentUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Payment: - params = self._serialize_params({"expand": expand}, _PaymentUpdateSchema) - update_action = PaymentUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"payments/key={key}", - params=params, - data_object=update_action, - response_class=Payment, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Payment: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _PaymentDeleteSchema, - ) - return self._client._delete( - endpoint=f"payments/{id}", - params=params, - response_class=Payment, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Payment: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _PaymentDeleteSchema, - ) - return self._client._delete( - endpoint=f"payments/key={key}", - params=params, - response_class=Payment, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/product_discounts.py b/src/commercetools/services/product_discounts.py deleted file mode 100644 index eb3d5aaa..00000000 --- a/src/commercetools/services/product_discounts.py +++ /dev/null @@ -1,183 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.product_discount import ( - ProductDiscount, - ProductDiscountDraft, - ProductDiscountMatchQuery, - ProductDiscountPagedQueryResponse, - ProductDiscountUpdate, - ProductDiscountUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ProductDiscountQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ProductDiscountUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ProductDiscountDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class ProductDiscountService(abstract.AbstractService): - """Product discounts are used to change certain product prices.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> ProductDiscount: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"product-discounts/{id}", - params=params, - response_class=ProductDiscount, - ) - - def get_by_key( - self, key: str, *, expand: OptionalListStr = None - ) -> ProductDiscount: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"product-discounts/key={key}", - params=params, - response_class=ProductDiscount, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ProductDiscountPagedQueryResponse: - """Product discounts are used to change certain product prices.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ProductDiscountQuerySchema, - ) - return self._client._get( - endpoint="product-discounts", - params=params, - response_class=ProductDiscountPagedQueryResponse, - ) - - def create( - self, draft: ProductDiscountDraft, *, expand: OptionalListStr = None - ) -> ProductDiscount: - """Product discounts are used to change certain product prices.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="product-discounts", - params=params, - data_object=draft, - response_class=ProductDiscount, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ProductDiscountUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ProductDiscount: - params = self._serialize_params( - {"expand": expand}, _ProductDiscountUpdateSchema - ) - update_action = ProductDiscountUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"product-discounts/{id}", - params=params, - data_object=update_action, - response_class=ProductDiscount, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ProductDiscountUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ProductDiscount: - params = self._serialize_params( - {"expand": expand}, _ProductDiscountUpdateSchema - ) - update_action = ProductDiscountUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"product-discounts/key={key}", - params=params, - data_object=update_action, - response_class=ProductDiscount, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> ProductDiscount: - params = self._serialize_params( - {"version": version, "expand": expand}, _ProductDiscountDeleteSchema - ) - return self._client._delete( - endpoint=f"product-discounts/{id}", - params=params, - response_class=ProductDiscount, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> ProductDiscount: - params = self._serialize_params( - {"version": version, "expand": expand}, _ProductDiscountDeleteSchema - ) - return self._client._delete( - endpoint=f"product-discounts/key={key}", - params=params, - response_class=ProductDiscount, - force_delete=force_delete, - ) - - def matching(self, action: ProductDiscountMatchQuery) -> ProductDiscount: - params: typing.Dict[str, str] = {} - return self._client._post( - endpoint="product-discounts/matching", - params=params, - data_object=action, - response_class=ProductDiscount, - ) diff --git a/src/commercetools/services/product_projections.py b/src/commercetools/services/product_projections.py deleted file mode 100644 index 0e5d3c31..00000000 --- a/src/commercetools/services/product_projections.py +++ /dev/null @@ -1,330 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -import marshmallow -from marshmallow import fields - -from commercetools.helpers import OptionalList, RemoveEmptyValuesMixin -from commercetools.platform.models.product import ( - ProductProjection, - ProductProjectionPagedQueryResponse, - ProductProjectionPagedSearchResponse, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ProductProjectionGetSchema(traits.ExpandableSchema, traits.PriceSelectingSchema): - staged = fields.Bool(required=False, missing=False) - - -class _ProductProjectionQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, - traits.PriceSelectingSchema, -): - staged = fields.Bool(required=False, missing=False) - - -class _ProductProjectionSearchSchema( - traits.SortableSchema, - traits.PagingSchema, - traits.PriceSelectingSchema, - traits.ExpandableSchema, -): - fuzzy = fields.Bool(required=False, missing=False) - fuzzy_level = fields.Int(data_key="fuzzyLevel", required=False) - mark_matching_variants = fields.Bool(data_key="markMatchingVariants", missing=False) - staged = fields.Bool(required=False, missing=False) - filter = OptionalList(fields.String(), required=False) - filter_facets = OptionalList( - fields.String(), data_key="filter.facets", required=False - ) - filter_query = OptionalList( - fields.String(), data_key="filter.query", required=False - ) - facet = OptionalList(fields.String(), required=False) - text = fields.Dict() - - @marshmallow.post_dump - def _text_post_dump(self, data, **kwrags): - values = data.pop("text") - if not values: - return data - for key, val in values.items(): - data[f"text.{key}"] = val - return data - - @marshmallow.pre_load - def _text_post_load(self, data, **kwrags): - items = {} - for key in list(data.keys()): - if key.startswith("text."): - items[key[5:]] = data[key] - del data[key] - data["text"] = items - return data - - -class _ProductProjectionSuggestSchema(traits.SortableSchema, traits.PagingSchema): - fuzzy = fields.Bool(required=False, missing=False) - staged = fields.Bool(required=False, missing=False) - search_keywords = fields.Dict() - - @marshmallow.post_dump - def _search_keywords_post_dump(self, data, **kwrags): - values = data.pop("search_keywords") - if not values: - return data - for key, val in values.items(): - data[f"searchKeywords.{key}"] = val - return data - - @marshmallow.pre_load - def _search_keywords_post_load(self, data, **kwrags): - items = {} - for key in list(data.keys()): - if key.startswith("searchKeywords."): - items[key[15:]] = data[key] - del data[key] - data["search_keywords"] = items - return data - - -class ProductProjectionService(abstract.AbstractService): - """A projected representation of a product shows the product with its current - or staged data. - - The current or staged representation of a product in a catalog is called a - product projection. - """ - - def get_by_id( - self, - id: str, - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - staged: bool = None, - ) -> ProductProjection: - """Gets the current or staged representation of a product in a catalog by - ID. - - When used with an API client that has the - view_published_products:{projectKey} scope, this endpoint only returns - published (current) product projections. - """ - params = self._serialize_params( - { - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - "staged": staged, - }, - _ProductProjectionGetSchema, - ) - return self._client._get( - endpoint=f"product-projections/{id}", - params=params, - response_class=ProductProjection, - ) - - def get_by_key( - self, - key: str, - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - staged: bool = None, - ) -> ProductProjection: - """Gets the current or staged representation of a product found by Key. - - When used with an API client that has the - view_published_products:{projectKey} scope, this endpoint only returns - published (current) product projections. - """ - params = self._serialize_params( - { - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - "staged": staged, - }, - _ProductProjectionGetSchema, - ) - return self._client._get( - endpoint=f"product-projections/key={key}", - params=params, - response_class=ProductProjection, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - staged: bool = None, - ) -> ProductProjectionPagedQueryResponse: - """You can use the product projections query endpoint to get the current - or staged representations of Products. - - When used with an API client that has the - view_published_products:{projectKey} scope, this endpoint only returns - published (current) product projections. A projected representation of - a product shows the product with its current or staged data. The current - or staged representation of a product in a catalog is called a product - projection. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - "staged": staged, - }, - _ProductProjectionQuerySchema, - ) - return self._client._get( - endpoint="product-projections", - params=params, - response_class=ProductProjectionPagedQueryResponse, - ) - - def search( - self, - mark_matching_variants: bool, - *, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - expand: OptionalListStr = None, - fuzzy: bool = None, - fuzzy_level: int = None, - staged: bool = None, - filter: str = None, - filter_facets: str = None, - filter_query: str = None, - facet: str = None, - text: typing.Dict[str, str] = None, - ) -> ProductProjectionPagedSearchResponse: - """Search Product Projection - - This endpoint provides high performance search queries over - ProductProjections. The query result contains the ProductProjections for - which at least one ProductVariant matches the search query. This means - that variants can be included in the result also for which the search - query does not match. To determine which ProductVariants match the search - query, the returned ProductProjections include the additional field - isMatchingVariant. - """ - params = self._serialize_params( - { - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - "expand": expand, - "fuzzy": fuzzy, - "fuzzy_level": fuzzy_level, - "mark_matching_variants": mark_matching_variants, - "staged": staged, - "filter": filter, - "filter_facets": filter_facets, - "filter_query": filter_query, - "facet": facet, - "text": text, - }, - _ProductProjectionSearchSchema, - ) - return self._client._get( - endpoint="product-projections/search", - params=params, - response_class=ProductProjectionPagedSearchResponse, - ) - - def suggest( - self, - *, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - fuzzy: bool = None, - staged: bool = None, - search_keywords: typing.Dict[str, str] = None, - ) -> ProductProjection: - """The source of data for suggestions is the searchKeyword field in a - product - """ - params = self._serialize_params( - { - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "fuzzy": fuzzy, - "staged": staged, - "search_keywords": search_keywords, - }, - _ProductProjectionSuggestSchema, - ) - return self._client._get( - endpoint="product-projections/suggest", - params=params, - response_class=ProductProjection, - ) diff --git a/src/commercetools/services/product_types.py b/src/commercetools/services/product_types.py deleted file mode 100644 index 966452e1..00000000 --- a/src/commercetools/services/product_types.py +++ /dev/null @@ -1,173 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.product_type import ( - ProductType, - ProductTypeDraft, - ProductTypePagedQueryResponse, - ProductTypeUpdate, - ProductTypeUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ProductTypeQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ProductTypeUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ProductTypeDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class ProductTypeService(abstract.AbstractService): - """Product Types are used to describe common characteristics, most importantly - common custom attributes, - - of many concrete products. - """ - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> ProductType: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"product-types/{id}", params=params, response_class=ProductType - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> ProductType: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"product-types/key={key}", - params=params, - response_class=ProductType, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ProductTypePagedQueryResponse: - """Product Types are used to describe common characteristics, most - importantly common custom attributes, of many concrete products. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ProductTypeQuerySchema, - ) - return self._client._get( - endpoint="product-types", - params=params, - response_class=ProductTypePagedQueryResponse, - ) - - def create( - self, draft: ProductTypeDraft, *, expand: OptionalListStr = None - ) -> ProductType: - """Product Types are used to describe common characteristics, most - importantly common custom attributes, of many concrete products. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="product-types", - params=params, - data_object=draft, - response_class=ProductType, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ProductTypeUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ProductType: - params = self._serialize_params({"expand": expand}, _ProductTypeUpdateSchema) - update_action = ProductTypeUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"product-types/{id}", - params=params, - data_object=update_action, - response_class=ProductType, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ProductTypeUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ProductType: - params = self._serialize_params({"expand": expand}, _ProductTypeUpdateSchema) - update_action = ProductTypeUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"product-types/key={key}", - params=params, - data_object=update_action, - response_class=ProductType, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> ProductType: - params = self._serialize_params( - {"version": version, "expand": expand}, _ProductTypeDeleteSchema - ) - return self._client._delete( - endpoint=f"product-types/{id}", - params=params, - response_class=ProductType, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> ProductType: - params = self._serialize_params( - {"version": version, "expand": expand}, _ProductTypeDeleteSchema - ) - return self._client._delete( - endpoint=f"product-types/key={key}", - params=params, - response_class=ProductType, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/products.py b/src/commercetools/services/products.py deleted file mode 100644 index 3d93bb84..00000000 --- a/src/commercetools/services/products.py +++ /dev/null @@ -1,398 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -import marshmallow -from marshmallow import fields - -from commercetools.helpers import OptionalList, RemoveEmptyValuesMixin -from commercetools.platform.models.product import ( - Product, - ProductDraft, - ProductPagedQueryResponse, - ProductUpdate, - ProductUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ProductGetSchema(traits.ExpandableSchema, traits.PriceSelectingSchema): - pass - - -class _ProductQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, - traits.PriceSelectingSchema, -): - pass - - -class _ProductCreateSchema(traits.ExpandableSchema, traits.PriceSelectingSchema): - pass - - -class _ProductUpdateSchema( - traits.ExpandableSchema, traits.VersionedSchema, traits.PriceSelectingSchema -): - pass - - -class _ProductDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.PriceSelectingSchema -): - pass - - -class _ProductImagesSchema(marshmallow.Schema, RemoveEmptyValuesMixin): - filename = OptionalList(fields.String(), required=False) - variant = fields.Int(required=False) - sku = OptionalList(fields.String(), required=False) - staged = fields.Bool(required=False, missing=False) - - -class ProductService(abstract.AbstractService): - """Products are the sellable goods in an e-commerce project on CTP. - - This document explains some design concepts of products on CTP and describes the - available HTTP APIs for working with them. - """ - - def get_by_id( - self, - id: str, - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - ) -> Product: - """Gets the full representation of a product by ID.""" - params = self._serialize_params( - { - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductGetSchema, - ) - return self._client._get( - endpoint=f"products/{id}", params=params, response_class=Product - ) - - def get_by_key( - self, - key: str, - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - ) -> Product: - """Gets the full representation of a product by Key.""" - params = self._serialize_params( - { - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductGetSchema, - ) - return self._client._get( - endpoint=f"products/key={key}", params=params, response_class=Product - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - ) -> ProductPagedQueryResponse: - """You can use the query endpoint to get the full representations of - products. - - REMARK: We suggest to use the performance optimized search endpoint which - has a bunch functionalities, the query API lacks like sorting on custom - attributes, etc. Products are the sellable goods in an e-commerce - project on CTP. This document explains some design concepts of products - on CTP and describes the available HTTP APIs for working with them. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductQuerySchema, - ) - return self._client._get( - endpoint="products", params=params, response_class=ProductPagedQueryResponse - ) - - def create( - self, - draft: ProductDraft, - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - ) -> Product: - """To create a new product, send a representation that is going to become - the initial staged representation - - of the new product in the master catalog. If price selection query - parameters are provided, the selected prices will be added to the - response. Products are the sellable goods in an e-commerce project on - CTP. This document explains some design concepts of products on CTP and - describes the available HTTP APIs for working with them. - """ - params = self._serialize_params( - { - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductCreateSchema, - ) - return self._client._post( - endpoint="products", - params=params, - data_object=draft, - response_class=Product, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ProductUpdateAction], - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - force_update: bool = False, - ) -> Product: - params = self._serialize_params( - { - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductUpdateSchema, - ) - update_action = ProductUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"products/{id}", - params=params, - data_object=update_action, - response_class=Product, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ProductUpdateAction], - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - force_update: bool = False, - ) -> Product: - params = self._serialize_params( - { - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductUpdateSchema, - ) - update_action = ProductUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"products/key={key}", - params=params, - data_object=update_action, - response_class=Product, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - force_delete: bool = False, - ) -> Product: - params = self._serialize_params( - { - "version": version, - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductDeleteSchema, - ) - return self._client._delete( - endpoint=f"products/{id}", - params=params, - response_class=Product, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - price_currency: OptionalListStr = None, - price_country: OptionalListStr = None, - price_customer_group: OptionalListStr = None, - price_channel: OptionalListStr = None, - locale_projection: OptionalListStr = None, - store_projection: OptionalListStr = None, - force_delete: bool = False, - ) -> Product: - params = self._serialize_params( - { - "version": version, - "expand": expand, - "price_currency": price_currency, - "price_country": price_country, - "price_customer_group": price_customer_group, - "price_channel": price_channel, - "locale_projection": locale_projection, - "store_projection": store_projection, - }, - _ProductDeleteSchema, - ) - return self._client._delete( - endpoint=f"products/key={key}", - params=params, - response_class=Product, - force_delete=force_delete, - ) - - def file_upload( - self, - id: str, - fh: typing.BinaryIO, - *, - filename: str = None, - variant: int = None, - sku: str = None, - staged: bool = None, - ) -> Product: - """Uploads a binary image file to a given product variant. - - The supported image formats are JPEG, PNG and GIF. - """ - params = self._serialize_params( - {"filename": filename, "variant": variant, "sku": sku, "staged": staged}, - _ProductImagesSchema, - ) - return self._client._upload( - endpoint=f"products/{id}/images", - params=params, - response_class=Product, - file=fh, - ) - - def upload_image( - self, - id: str, - fh: typing.BinaryIO, - *, - filename: str = None, - variant: int = None, - sku: str = None, - staged: bool = None, - ) -> Product: - """Uploads a binary image file to a given product variant. - - The supported image formats are JPEG, PNG and GIF. - """ - params = self._serialize_params( - {"filename": filename, "variant": variant, "sku": sku, "staged": staged}, - _ProductImagesSchema, - ) - return self._client._upload( - endpoint=f"products/{id}/images", - params=params, - response_class=Product, - file=fh, - ) diff --git a/src/commercetools/services/project.py b/src/commercetools/services/project.py deleted file mode 100644 index 2b76131d..00000000 --- a/src/commercetools/services/project.py +++ /dev/null @@ -1,27 +0,0 @@ -from typing import List - -from commercetools.platform import models -from commercetools.services import abstract - -__all__ = ["ProjectService"] - - -class ProjectService(abstract.AbstractService): - def get(self) -> models.Order: - return self._client._get(endpoint="", params={}, response_class=models.Project) - - def update( - self, - version: int, - actions: List[models.OrderUpdateAction], - *, - force_update: bool = False, - ) -> models.Project: - update_action = models.ProjectUpdate(version=version, actions=actions) - return self._client._post( - endpoint="", - params={}, - data_object=update_action, - response_class=models.Project, - force_update=force_update, - ) diff --git a/src/commercetools/services/reviews.py b/src/commercetools/services/reviews.py deleted file mode 100644 index ad092ab7..00000000 --- a/src/commercetools/services/reviews.py +++ /dev/null @@ -1,162 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.review import ( - Review, - ReviewDraft, - ReviewPagedQueryResponse, - ReviewUpdate, - ReviewUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ReviewQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ReviewUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ReviewDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.DataErasureSchema -): - pass - - -class ReviewService(abstract.AbstractService): - """Reviews are used to evaluate products and channels.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Review: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"reviews/{id}", params=params, response_class=Review - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Review: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"reviews/key={key}", params=params, response_class=Review - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ReviewPagedQueryResponse: - """Reviews are used to evaluate products and channels.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ReviewQuerySchema, - ) - return self._client._get( - endpoint="reviews", params=params, response_class=ReviewPagedQueryResponse - ) - - def create(self, draft: ReviewDraft, *, expand: OptionalListStr = None) -> Review: - """Reviews are used to evaluate products and channels.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="reviews", params=params, data_object=draft, response_class=Review - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ReviewUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Review: - params = self._serialize_params({"expand": expand}, _ReviewUpdateSchema) - update_action = ReviewUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"reviews/{id}", - params=params, - data_object=update_action, - response_class=Review, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ReviewUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Review: - params = self._serialize_params({"expand": expand}, _ReviewUpdateSchema) - update_action = ReviewUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"reviews/key={key}", - params=params, - data_object=update_action, - response_class=Review, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Review: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _ReviewDeleteSchema, - ) - return self._client._delete( - endpoint=f"reviews/{id}", - params=params, - response_class=Review, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> Review: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _ReviewDeleteSchema, - ) - return self._client._delete( - endpoint=f"reviews/key={key}", - params=params, - response_class=Review, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/shipping_methods.py b/src/commercetools/services/shipping_methods.py deleted file mode 100644 index b2e42ad2..00000000 --- a/src/commercetools/services/shipping_methods.py +++ /dev/null @@ -1,243 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -import marshmallow -from marshmallow import fields - -from commercetools.helpers import OptionalList, RemoveEmptyValuesMixin -from commercetools.platform.models.shipping_method import ( - ShippingMethod, - ShippingMethodDraft, - ShippingMethodPagedQueryResponse, - ShippingMethodUpdate, - ShippingMethodUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ShippingMethodQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ShippingMethodUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ShippingMethodDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class _ShippingMethodMatching_CartSchema(traits.ExpandableSchema): - cart_id = OptionalList(fields.String(), data_key="cartId") - - -class _ShippingMethodMatching_LocationSchema(traits.ExpandableSchema): - country = OptionalList(fields.String()) - state = OptionalList(fields.String(), required=False) - currency = OptionalList(fields.String(), required=False) - - -class _ShippingMethodMatching_OrdereditSchema( - marshmallow.Schema, RemoveEmptyValuesMixin -): - order_edit_id = OptionalList(fields.String(), data_key="orderEditId") - country = OptionalList(fields.String()) - state = OptionalList(fields.String(), required=False) - - -class ShippingMethodService(abstract.AbstractService): - """Shipping Methods define where orders can be shipped and what the costs are.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> ShippingMethod: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"shipping-methods/{id}", - params=params, - response_class=ShippingMethod, - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> ShippingMethod: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"shipping-methods/key={key}", - params=params, - response_class=ShippingMethod, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ShippingMethodPagedQueryResponse: - """Shipping Methods define where orders can be shipped and what the costs - are. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ShippingMethodQuerySchema, - ) - return self._client._get( - endpoint="shipping-methods", - params=params, - response_class=ShippingMethodPagedQueryResponse, - ) - - def create( - self, draft: ShippingMethodDraft, *, expand: OptionalListStr = None - ) -> ShippingMethod: - """Shipping Methods define where orders can be shipped and what the costs - are. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="shipping-methods", - params=params, - data_object=draft, - response_class=ShippingMethod, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ShippingMethodUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ShippingMethod: - params = self._serialize_params({"expand": expand}, _ShippingMethodUpdateSchema) - update_action = ShippingMethodUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"shipping-methods/{id}", - params=params, - data_object=update_action, - response_class=ShippingMethod, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ShippingMethodUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ShippingMethod: - params = self._serialize_params({"expand": expand}, _ShippingMethodUpdateSchema) - update_action = ShippingMethodUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"shipping-methods/key={key}", - params=params, - data_object=update_action, - response_class=ShippingMethod, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> ShippingMethod: - params = self._serialize_params( - {"version": version, "expand": expand}, _ShippingMethodDeleteSchema - ) - return self._client._delete( - endpoint=f"shipping-methods/{id}", - params=params, - response_class=ShippingMethod, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> ShippingMethod: - params = self._serialize_params( - {"version": version, "expand": expand}, _ShippingMethodDeleteSchema - ) - return self._client._delete( - endpoint=f"shipping-methods/key={key}", - params=params, - response_class=ShippingMethod, - force_delete=force_delete, - ) - - def matching_cart( - self, cart_id: str, *, expand: OptionalListStr = None - ) -> ShippingMethodPagedQueryResponse: - """Get ShippingMethods for a cart""" - params = self._serialize_params( - {"expand": expand, "cart_id": cart_id}, _ShippingMethodMatching_CartSchema - ) - return self._client._get( - endpoint="shipping-methods/matching-cart", - params=params, - response_class=ShippingMethodPagedQueryResponse, - ) - - def matching_location( - self, - country: str, - *, - expand: OptionalListStr = None, - state: str = None, - currency: str = None, - ) -> ShippingMethodPagedQueryResponse: - """Get ShippingMethods for a location""" - params = self._serialize_params( - { - "expand": expand, - "country": country, - "state": state, - "currency": currency, - }, - _ShippingMethodMatching_LocationSchema, - ) - return self._client._get( - endpoint="shipping-methods/matching-location", - params=params, - response_class=ShippingMethodPagedQueryResponse, - ) - - def matching_orderedit( - self, order_edit_id: str, country: str, *, state: str = None - ) -> ShippingMethodPagedQueryResponse: - """Get ShippingMethods for an order edit""" - params = self._serialize_params( - {"order_edit_id": order_edit_id, "country": country, "state": state}, - _ShippingMethodMatching_OrdereditSchema, - ) - return self._client._get( - endpoint="shipping-methods/matching-orderedit", - params=params, - response_class=ShippingMethodPagedQueryResponse, - ) diff --git a/src/commercetools/services/shopping_lists.py b/src/commercetools/services/shopping_lists.py deleted file mode 100644 index 3ed6c0f6..00000000 --- a/src/commercetools/services/shopping_lists.py +++ /dev/null @@ -1,177 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.shopping_list import ( - ShoppingList, - ShoppingListDraft, - ShoppingListPagedQueryResponse, - ShoppingListUpdate, - ShoppingListUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ShoppingListQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ShoppingListUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ShoppingListDeleteSchema( - traits.VersionedSchema, traits.ExpandableSchema, traits.DataErasureSchema -): - pass - - -class ShoppingListService(abstract.AbstractService): - """shopping-lists e. - - g. for wishlist support - """ - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> ShoppingList: - """Gets a shopping list by ID.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"shopping-lists/{id}", params=params, response_class=ShoppingList - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> ShoppingList: - """Gets a shopping list by Key.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"shopping-lists/key={key}", - params=params, - response_class=ShoppingList, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ShoppingListPagedQueryResponse: - """shopping-lists e.g. for wishlist support""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ShoppingListQuerySchema, - ) - return self._client._get( - endpoint="shopping-lists", - params=params, - response_class=ShoppingListPagedQueryResponse, - ) - - def create( - self, draft: ShoppingListDraft, *, expand: OptionalListStr = None - ) -> ShoppingList: - """shopping-lists e.g. for wishlist support""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="shopping-lists", - params=params, - data_object=draft, - response_class=ShoppingList, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ShoppingListUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ShoppingList: - params = self._serialize_params({"expand": expand}, _ShoppingListUpdateSchema) - update_action = ShoppingListUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"shopping-lists/{id}", - params=params, - data_object=update_action, - response_class=ShoppingList, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ShoppingListUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> ShoppingList: - """Update a shopping list found by its Key.""" - params = self._serialize_params({"expand": expand}, _ShoppingListUpdateSchema) - update_action = ShoppingListUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"shopping-lists/key={key}", - params=params, - data_object=update_action, - response_class=ShoppingList, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> ShoppingList: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _ShoppingListDeleteSchema, - ) - return self._client._delete( - endpoint=f"shopping-lists/{id}", - params=params, - response_class=ShoppingList, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - data_erasure: bool = None, - force_delete: bool = False, - ) -> ShoppingList: - params = self._serialize_params( - {"version": version, "expand": expand, "data_erasure": data_erasure}, - _ShoppingListDeleteSchema, - ) - return self._client._delete( - endpoint=f"shopping-lists/key={key}", - params=params, - response_class=ShoppingList, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/states.py b/src/commercetools/services/states.py deleted file mode 100644 index 63369f7e..00000000 --- a/src/commercetools/services/states.py +++ /dev/null @@ -1,169 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.state import ( - State, - StateDraft, - StatePagedQueryResponse, - StateUpdate, - StateUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _StateQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _StateUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _StateDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class StateService(abstract.AbstractService): - """The commercetools platform allows you to model states of certain objects, - such as orders, line items, products, - - reviews, and payments in order to define finite state machines reflecting the - business logic you'd like to implement. - """ - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> State: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"states/{id}", params=params, response_class=State - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> State: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"states/key={key}", params=params, response_class=State - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> StatePagedQueryResponse: - """The commercetools platform allows you to model states of certain objects, - such as orders, line items, products, reviews, and payments in order to - define finite state machines reflecting the business logic you'd like to - implement. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _StateQuerySchema, - ) - return self._client._get( - endpoint="states", params=params, response_class=StatePagedQueryResponse - ) - - def create(self, draft: StateDraft, *, expand: OptionalListStr = None) -> State: - """The commercetools platform allows you to model states of certain objects, - such as orders, line items, products, reviews, and payments in order to - define finite state machines reflecting the business logic you'd like to - implement. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="states", params=params, data_object=draft, response_class=State - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[StateUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> State: - params = self._serialize_params({"expand": expand}, _StateUpdateSchema) - update_action = StateUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"states/{id}", - params=params, - data_object=update_action, - response_class=State, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[StateUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> State: - params = self._serialize_params({"expand": expand}, _StateUpdateSchema) - update_action = StateUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"states/key={key}", - params=params, - data_object=update_action, - response_class=State, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> State: - params = self._serialize_params( - {"version": version, "expand": expand}, _StateDeleteSchema - ) - return self._client._delete( - endpoint=f"states/{id}", - params=params, - response_class=State, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> State: - params = self._serialize_params( - {"version": version, "expand": expand}, _StateDeleteSchema - ) - return self._client._delete( - endpoint=f"states/key={key}", - params=params, - response_class=State, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/stores.py b/src/commercetools/services/stores.py deleted file mode 100644 index 7395f00f..00000000 --- a/src/commercetools/services/stores.py +++ /dev/null @@ -1,156 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.store import ( - Store, - StoreDraft, - StorePagedQueryResponse, - StoreUpdate, - StoreUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _StoreQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _StoreUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _StoreDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class StoreService(abstract.AbstractService): - """Stores let you model the context your customers shop in.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Store: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"stores/{id}", params=params, response_class=Store - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Store: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"stores/key={key}", params=params, response_class=Store - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> StorePagedQueryResponse: - """Stores let you model the context your customers shop in.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _StoreQuerySchema, - ) - return self._client._get( - endpoint="stores", params=params, response_class=StorePagedQueryResponse - ) - - def create(self, draft: StoreDraft, *, expand: OptionalListStr = None) -> Store: - """Stores let you model the context your customers shop in.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="stores", params=params, data_object=draft, response_class=Store - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[StoreUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Store: - params = self._serialize_params({"expand": expand}, _StoreUpdateSchema) - update_action = StoreUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"stores/{id}", - params=params, - data_object=update_action, - response_class=Store, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[StoreUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Store: - params = self._serialize_params({"expand": expand}, _StoreUpdateSchema) - update_action = StoreUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"stores/key={key}", - params=params, - data_object=update_action, - response_class=Store, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Store: - params = self._serialize_params( - {"version": version, "expand": expand}, _StoreDeleteSchema - ) - return self._client._delete( - endpoint=f"stores/{id}", - params=params, - response_class=Store, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Store: - params = self._serialize_params( - {"version": version, "expand": expand}, _StoreDeleteSchema - ) - return self._client._delete( - endpoint=f"stores/key={key}", - params=params, - response_class=Store, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/subscriptions.py b/src/commercetools/services/subscriptions.py deleted file mode 100644 index e29586ba..00000000 --- a/src/commercetools/services/subscriptions.py +++ /dev/null @@ -1,180 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.subscription import ( - Subscription, - SubscriptionDraft, - SubscriptionPagedQueryResponse, - SubscriptionUpdate, - SubscriptionUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _SubscriptionQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _SubscriptionUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _SubscriptionDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class SubscriptionService(abstract.AbstractService): - """Subscriptions allow you to be notified of new messages or changes via a - Message Queue of your choice""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Subscription: - """Retrieves the representation of a subscription by its id.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"subscriptions/{id}", params=params, response_class=Subscription - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Subscription: - """Retrieves the representation of a subscription by its key.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"subscriptions/key={key}", - params=params, - response_class=Subscription, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> SubscriptionPagedQueryResponse: - """Subscriptions allow you to be notified of new messages or changes via a - Message Queue of your choice - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _SubscriptionQuerySchema, - ) - return self._client._get( - endpoint="subscriptions", - params=params, - response_class=SubscriptionPagedQueryResponse, - ) - - def create( - self, draft: SubscriptionDraft, *, expand: OptionalListStr = None - ) -> Subscription: - """The creation of a Subscription is eventually consistent, it may take up - to a minute before it becomes fully active. - - In order to test that the destination is correctly configured, a test - message will be put into the queue. If the message could not be - delivered, the subscription will not be created. The payload of the test - message is a notification of type ResourceCreated for the resourceTypeId - subscription. Currently, a maximum of 25 subscriptions can be created per - project. Subscriptions allow you to be notified of new messages or - changes via a Message Queue of your choice - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="subscriptions", - params=params, - data_object=draft, - response_class=Subscription, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[SubscriptionUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Subscription: - params = self._serialize_params({"expand": expand}, _SubscriptionUpdateSchema) - update_action = SubscriptionUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"subscriptions/{id}", - params=params, - data_object=update_action, - response_class=Subscription, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[SubscriptionUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Subscription: - params = self._serialize_params({"expand": expand}, _SubscriptionUpdateSchema) - update_action = SubscriptionUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"subscriptions/key={key}", - params=params, - data_object=update_action, - response_class=Subscription, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Subscription: - params = self._serialize_params( - {"version": version, "expand": expand}, _SubscriptionDeleteSchema - ) - return self._client._delete( - endpoint=f"subscriptions/{id}", - params=params, - response_class=Subscription, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Subscription: - params = self._serialize_params( - {"version": version, "expand": expand}, _SubscriptionDeleteSchema - ) - return self._client._delete( - endpoint=f"subscriptions/key={key}", - params=params, - response_class=Subscription, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/tax_categories.py b/src/commercetools/services/tax_categories.py deleted file mode 100644 index 031c45c0..00000000 --- a/src/commercetools/services/tax_categories.py +++ /dev/null @@ -1,169 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.tax_category import ( - TaxCategory, - TaxCategoryDraft, - TaxCategoryPagedQueryResponse, - TaxCategoryUpdate, - TaxCategoryUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _TaxCategoryQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _TaxCategoryUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _TaxCategoryDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class TaxCategoryService(abstract.AbstractService): - """Tax Categories define how products are to be taxed in different countries.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> TaxCategory: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"tax-categories/{id}", params=params, response_class=TaxCategory - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> TaxCategory: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"tax-categories/key={key}", - params=params, - response_class=TaxCategory, - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> TaxCategoryPagedQueryResponse: - """Tax Categories define how products are to be taxed in different - countries. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _TaxCategoryQuerySchema, - ) - return self._client._get( - endpoint="tax-categories", - params=params, - response_class=TaxCategoryPagedQueryResponse, - ) - - def create( - self, draft: TaxCategoryDraft, *, expand: OptionalListStr = None - ) -> TaxCategory: - """Tax Categories define how products are to be taxed in different - countries. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="tax-categories", - params=params, - data_object=draft, - response_class=TaxCategory, - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[TaxCategoryUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> TaxCategory: - params = self._serialize_params({"expand": expand}, _TaxCategoryUpdateSchema) - update_action = TaxCategoryUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"tax-categories/{id}", - params=params, - data_object=update_action, - response_class=TaxCategory, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[TaxCategoryUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> TaxCategory: - params = self._serialize_params({"expand": expand}, _TaxCategoryUpdateSchema) - update_action = TaxCategoryUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"tax-categories/key={key}", - params=params, - data_object=update_action, - response_class=TaxCategory, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> TaxCategory: - params = self._serialize_params( - {"version": version, "expand": expand}, _TaxCategoryDeleteSchema - ) - return self._client._delete( - endpoint=f"tax-categories/{id}", - params=params, - response_class=TaxCategory, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> TaxCategory: - params = self._serialize_params( - {"version": version, "expand": expand}, _TaxCategoryDeleteSchema - ) - return self._client._delete( - endpoint=f"tax-categories/key={key}", - params=params, - response_class=TaxCategory, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/types.py b/src/commercetools/services/types.py deleted file mode 100644 index 9e38cd5a..00000000 --- a/src/commercetools/services/types.py +++ /dev/null @@ -1,160 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.type import ( - Type, - TypeDraft, - TypePagedQueryResponse, - TypeUpdate, - TypeUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _TypeQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _TypeUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _TypeDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class TypeService(abstract.AbstractService): - """Types define custom fields that are used to enhance resources as you need.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Type: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"types/{id}", params=params, response_class=Type - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Type: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"types/key={key}", params=params, response_class=Type - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> TypePagedQueryResponse: - """Types define custom fields that are used to enhance resources as you - need. - """ - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _TypeQuerySchema, - ) - return self._client._get( - endpoint="types", params=params, response_class=TypePagedQueryResponse - ) - - def create(self, draft: TypeDraft, *, expand: OptionalListStr = None) -> Type: - """Types define custom fields that are used to enhance resources as you - need. - """ - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="types", params=params, data_object=draft, response_class=Type - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[TypeUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Type: - params = self._serialize_params({"expand": expand}, _TypeUpdateSchema) - update_action = TypeUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"types/{id}", - params=params, - data_object=update_action, - response_class=Type, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[TypeUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Type: - params = self._serialize_params({"expand": expand}, _TypeUpdateSchema) - update_action = TypeUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"types/key={key}", - params=params, - data_object=update_action, - response_class=Type, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Type: - params = self._serialize_params( - {"version": version, "expand": expand}, _TypeDeleteSchema - ) - return self._client._delete( - endpoint=f"types/{id}", - params=params, - response_class=Type, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Type: - params = self._serialize_params( - {"version": version, "expand": expand}, _TypeDeleteSchema - ) - return self._client._delete( - endpoint=f"types/key={key}", - params=params, - response_class=Type, - force_delete=force_delete, - ) diff --git a/src/commercetools/services/zones.py b/src/commercetools/services/zones.py deleted file mode 100644 index bbc19939..00000000 --- a/src/commercetools/services/zones.py +++ /dev/null @@ -1,156 +0,0 @@ -# DO NOT EDIT! This file is automatically generated -import typing - -from commercetools.helpers import RemoveEmptyValuesMixin -from commercetools.platform.models.zone import ( - Zone, - ZoneDraft, - ZonePagedQueryResponse, - ZoneUpdate, - ZoneUpdateAction, -) -from commercetools.typing import OptionalListStr - -from . import abstract, traits - - -class _ZoneQuerySchema( - traits.ExpandableSchema, - traits.SortableSchema, - traits.PagingSchema, - traits.QuerySchema, -): - pass - - -class _ZoneUpdateSchema(traits.ExpandableSchema, traits.VersionedSchema): - pass - - -class _ZoneDeleteSchema(traits.VersionedSchema, traits.ExpandableSchema): - pass - - -class ZoneService(abstract.AbstractService): - """Zones allow defining ShippingRates for specific Locations.""" - - def get_by_id(self, id: str, *, expand: OptionalListStr = None) -> Zone: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"zones/{id}", params=params, response_class=Zone - ) - - def get_by_key(self, key: str, *, expand: OptionalListStr = None) -> Zone: - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._get( - endpoint=f"zones/key={key}", params=params, response_class=Zone - ) - - def query( - self, - *, - expand: OptionalListStr = None, - sort: OptionalListStr = None, - limit: int = None, - offset: int = None, - with_total: bool = None, - where: OptionalListStr = None, - predicate_var: typing.Dict[str, str] = None, - ) -> ZonePagedQueryResponse: - """Zones allow defining ShippingRates for specific Locations.""" - params = self._serialize_params( - { - "expand": expand, - "sort": sort, - "limit": limit, - "offset": offset, - "with_total": with_total, - "where": where, - "predicate_var": predicate_var, - }, - _ZoneQuerySchema, - ) - return self._client._get( - endpoint="zones", params=params, response_class=ZonePagedQueryResponse - ) - - def create(self, draft: ZoneDraft, *, expand: OptionalListStr = None) -> Zone: - """Zones allow defining ShippingRates for specific Locations.""" - params = self._serialize_params({"expand": expand}, traits.ExpandableSchema) - return self._client._post( - endpoint="zones", params=params, data_object=draft, response_class=Zone - ) - - def update_by_id( - self, - id: str, - version: int, - actions: typing.List[ZoneUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Zone: - params = self._serialize_params({"expand": expand}, _ZoneUpdateSchema) - update_action = ZoneUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"zones/{id}", - params=params, - data_object=update_action, - response_class=Zone, - force_update=force_update, - ) - - def update_by_key( - self, - key: str, - version: int, - actions: typing.List[ZoneUpdateAction], - *, - expand: OptionalListStr = None, - force_update: bool = False, - ) -> Zone: - params = self._serialize_params({"expand": expand}, _ZoneUpdateSchema) - update_action = ZoneUpdate(version=version, actions=actions) - return self._client._post( - endpoint=f"zones/key={key}", - params=params, - data_object=update_action, - response_class=Zone, - force_update=force_update, - ) - - def delete_by_id( - self, - id: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Zone: - params = self._serialize_params( - {"version": version, "expand": expand}, _ZoneDeleteSchema - ) - return self._client._delete( - endpoint=f"zones/{id}", - params=params, - response_class=Zone, - force_delete=force_delete, - ) - - def delete_by_key( - self, - key: str, - version: int, - *, - expand: OptionalListStr = None, - force_delete: bool = False, - ) -> Zone: - params = self._serialize_params( - {"version": version, "expand": expand}, _ZoneDeleteSchema - ) - return self._client._delete( - endpoint=f"zones/key={key}", - params=params, - response_class=Zone, - force_delete=force_delete, - ) diff --git a/src/commercetools/testing/abstract.py b/src/commercetools/testing/abstract.py index c9b1fad5..08d4dd74 100644 --- a/src/commercetools/testing/abstract.py +++ b/src/commercetools/testing/abstract.py @@ -5,7 +5,6 @@ import marshmallow from marshmallow import fields -from requests.packages.urllib3 import response from requests_mock.request import _RequestObjectProxy from commercetools import CommercetoolsError @@ -16,8 +15,7 @@ DuplicateFieldErrorSchema, ErrorResponseSchema, ) -from commercetools.services import traits -from commercetools.testing import utils +from commercetools.testing import traits, utils from commercetools.testing.predicates import PredicateFilter from commercetools.testing.utils import create_commercetools_response diff --git a/src/commercetools/testing/auth.py b/src/commercetools/testing/auth.py index d8ff06c1..649f97fa 100644 --- a/src/commercetools/testing/auth.py +++ b/src/commercetools/testing/auth.py @@ -91,7 +91,7 @@ def introspect(self, request): if token in stored_tokens: status = { "active": True, - "scope": "manage_project:todo", + "scope": "manage_project:example-project", "exp": self._expire_time, } else: diff --git a/src/commercetools/testing/cart_discounts.py b/src/commercetools/testing/cart_discounts.py index 064481f3..eb27d34d 100644 --- a/src/commercetools/testing/cart_discounts.py +++ b/src/commercetools/testing/cart_discounts.py @@ -41,13 +41,13 @@ def _create_from_draft( references=[], stacking_mode=draft.stacking_mode or models.StackingMode.STACKING, sort_order=draft.sort_order, - stores=draft.stores, valid_from=draft.valid_from, valid_until=draft.valid_until, requires_discount_code=draft.requires_discount_code, created_at=datetime.datetime.now(datetime.timezone.utc), last_modified_at=datetime.datetime.now(datetime.timezone.utc), custom=utils.create_from_draft(draft.custom), + stores=[], ) diff --git a/src/commercetools/testing/carts.py b/src/commercetools/testing/carts.py index 5d591d18..2e36aa73 100644 --- a/src/commercetools/testing/carts.py +++ b/src/commercetools/testing/carts.py @@ -62,6 +62,7 @@ def _create_line_item_from_draft( cent_amount=price * (line_item_draft.quantity or 0), fraction_digits=2, ), + tax_portions=[], ), taxed_price_portions=[], per_method_tax_rate=[], diff --git a/src/commercetools/testing/predicates.py b/src/commercetools/testing/predicates.py index 3fbb3bb1..33601d48 100644 --- a/src/commercetools/testing/predicates.py +++ b/src/commercetools/testing/predicates.py @@ -4,6 +4,7 @@ It uses the pratt algorithm. """ + import ast import logging import operator diff --git a/src/commercetools/testing/product_projections.py b/src/commercetools/testing/product_projections.py index 166ec135..bec5ff97 100644 --- a/src/commercetools/testing/product_projections.py +++ b/src/commercetools/testing/product_projections.py @@ -1,20 +1,28 @@ import typing +from marshmallow import fields + from commercetools.platform import models from commercetools.platform.models._schemas.product import ( ProductProjectionPagedQueryResponseSchema, ProductProjectionSchema, ProductSchema, ) -from commercetools.services.product_projections import ( - _ProductProjectionQuerySchema, - _ProductProjectionSearchSchema, -) -from commercetools.testing import utils +from commercetools.testing import traits, utils from commercetools.testing.abstract import ServiceBackend from commercetools.testing.utils import create_commercetools_response +class _ProductProjectionQuerySchema( + traits.ExpandableSchema, + traits.SortableSchema, + traits.PagingSchema, + traits.QuerySchema, + traits.PriceSelectingSchema, +): + staged = fields.Bool(required=False, missing=False) + + class ProductProjectionsBackend(ServiceBackend): service_path = "product-projections" _schema_query_params = _ProductProjectionQuerySchema @@ -22,7 +30,6 @@ class ProductProjectionsBackend(ServiceBackend): def urls(self): return [ ("^$", "GET", self.query), - ("^search", "GET", self.search), ("^search", "POST", self.search), ("^key=(?P[^/]+)$", "GET", self.get_by_key), ("^(?P[^/]+)$", "GET", self.get_by_id), @@ -57,7 +64,7 @@ def query(self, request): return create_commercetools_response(request, text=content) def search(self, request): - params = utils.parse_request_params(_ProductProjectionSearchSchema, request) + params = utils.parse_request_params(_ProductProjectionQuerySchema, request) limit = params.get("limit") diff --git a/src/commercetools/testing/products.py b/src/commercetools/testing/products.py index eb88efe9..42a26ad3 100644 --- a/src/commercetools/testing/products.py +++ b/src/commercetools/testing/products.py @@ -16,8 +16,7 @@ ProductUpdateSchema, ProductVariantSchema, ) -from commercetools.services.products import _ProductQuerySchema -from commercetools.testing import utils +from commercetools.testing import traits, utils from commercetools.testing.abstract import BaseModel, ServiceBackend from commercetools.testing.utils import ( create_commercetools_response, @@ -27,6 +26,16 @@ ) +class _ProductQuerySchema( + traits.ExpandableSchema, + traits.SortableSchema, + traits.PagingSchema, + traits.QuerySchema, + traits.PriceSelectingSchema, +): + pass + + class ProductsModel(BaseModel): _primary_type_name = "product" _resource_schema = ProductSchema @@ -47,9 +56,11 @@ def _create_from_draft( category_order_hints=draft.category_order_hints, description=draft.description, master_variant=master_variant, - variants=[self._create_variant_from_draft(vd) for vd in draft.variants] - if draft.variants - else [], + variants=( + [self._create_variant_from_draft(vd) for vd in draft.variants] + if draft.variants + else [] + ), slug=draft.slug or models.LocalizedString(), search_keywords=models.SearchKeywords(), ) diff --git a/src/commercetools/services/traits.py b/src/commercetools/testing/traits.py similarity index 100% rename from src/commercetools/services/traits.py rename to src/commercetools/testing/traits.py diff --git a/src/commercetools/testing/utils.py b/src/commercetools/testing/utils.py index 7bfeddd7..aa0f525c 100644 --- a/src/commercetools/testing/utils.py +++ b/src/commercetools/testing/utils.py @@ -108,9 +108,11 @@ def create_from_draft(draft: typing.Optional[_BaseType]): valid_until=draft.valid_until, discounted=draft.discounted, custom=create_from_draft(draft.custom), - tiers=None - if draft.tiers is None - else [create_from_draft(t) for t in draft.tiers], + tiers=( + None + if draft.tiers is None + else [create_from_draft(t) for t in draft.tiers] + ), ) raise ValueError(f"Unsupported type {draft.__class__}") diff --git a/src/commercetools/types.py b/src/commercetools/types.py deleted file mode 100644 index 90dbe94b..00000000 --- a/src/commercetools/types.py +++ /dev/null @@ -1,9 +0,0 @@ -import warnings - -from commercetools.platform.models import * # noqa - -warnings.warn( - "This `commercetools.types` module will be removed in the near future, " - "use the compatible `commercetools.platform.models`", - DeprecationWarning, -) diff --git a/tests/conftest.py b/tests/conftest.py index f948ae37..9947781a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,8 +2,3 @@ # Tricks flake8 into silencing redefining fixtures warnings. pytest_plugins = ["commercetools.contrib.pytest"] - - -@pytest.fixture -def old_client(commercetools_client): - return commercetools_client diff --git a/tests/platform/test_client.py b/tests/platform/test_client.py index a0541d95..392ef9b1 100644 --- a/tests/platform/test_client.py +++ b/tests/platform/test_client.py @@ -5,14 +5,15 @@ from requests_mock.adapter import Adapter from commercetools import CommercetoolsError -from commercetools.client import Client from commercetools.platform import models +from commercetools.platform.client import Client @pytest.fixture() def client_environment_settings(monkeypatch): monkeypatch.setenv("CTP_PROJECT_KEY", "project_key") monkeypatch.setenv("CTP_CLIENT_ID", "client_id") + monkeypatch.setenv("CTP_SCOPES", "manage_project:project_key") monkeypatch.setenv("CTP_CLIENT_SECRET", "client_secret") monkeypatch.setenv("CTP_CLIENT_SCOPES", "some_scope") monkeypatch.setenv("CTP_API_URL", "https://api.europe-west1.gcp.commercetools.com") @@ -34,14 +35,14 @@ def test_auto_refresh(commercetools_api): client = Client( client_id="unittest", client_secret="mysecret", - project_key="test", + scope=["manage_project:test"], url="https://api.europe-west1.gcp.commercetools.com", token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", - ) - client.products.query() + ).with_project_key("unittest") + client.products().get() time.sleep(1) - client.products.query() - client.products.query() + client.products().get() + client.products().get() auth_headers = set() for request in commercetools_api.requests_mock.request_history: @@ -56,7 +57,7 @@ def test_cache_token(commercetools_api): Client( client_id="unittest", client_secret="none", - project_key="test", + scope=["manage_project:test"], url="https://api.europe-west1.gcp.commercetools.com", token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", ) @@ -65,7 +66,7 @@ def test_cache_token(commercetools_api): Client( client_id="unittest", client_secret="none", - project_key="test", + scope=["manage_project:test"], url="https://api.europe-west1.gcp.commercetools.com", token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", ) @@ -82,7 +83,7 @@ def test_allows_passing_custom_http_adapter(): Client( client_id="unittest", client_secret="none", - project_key="test", + scope=["manage_project:test"], url="https://api.europe-west1.gcp.commercetools.com", token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", http_adapter=my_adapter, @@ -90,18 +91,22 @@ def test_allows_passing_custom_http_adapter(): assert len(my_adapter.request_history) == 1 -def test_resource_update_conflict(old_client): +def test_resource_update_conflict(ct_platform_client: Client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ - product = old_client.products.create( - models.ProductDraft( - key="test-product", - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - name={"en": "my-product"}, - slug={"en": "foo-bar"}, + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + name={"en": "my-product"}, + slug={"en": "foo-bar"}, + ) ) ) @@ -109,71 +114,112 @@ def test_resource_update_conflict(old_client): assert uuid.UUID(product.id) assert product.key == "test-product" - product = old_client.products.update_by_id( - id=product.id, - version=product.version, - actions=[ - models.ProductChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) - ], + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug2") + ) + ], + ) + ) ) assert product.key == "test-product" assert product.version == 2 # This should raise a version conflict error with pytest.raises(CommercetoolsError) as exc: - product = old_client.products.update_by_id( - id=product.id, - version=1, - actions=[ - models.ProductChangeSlugAction( - slug=models.LocalizedString(nl="nl-slug3") + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=1, + actions=[ + models.ProductChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug3") + ) + ], ) - ], + ) ) assert exc.value.response.status_code == 409 assert exc.value.response.errors[0].current_version == 2 # Force it - product = old_client.products.update_by_id( - id=product.id, - version=1, - actions=[ - models.ProductChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) - ], - force_update=True, + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=1, + actions=[ + models.ProductChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug2") + ) + ], + ), + options={"force_version": True}, + ) ) -def test_resource_delete_conflict(old_client): +def test_resource_delete_conflict(ct_platform_client: Client): """Test the return value of the delete methods. It doesn't test the actual delete itself. TODO: See if this is worth testing since we're using a mocking backend """ - product = old_client.products.create( - models.ProductDraft( - key="test-product", - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - name={"en": "my-product"}, - slug={"en": "foo-bar"}, + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + name={"en": "my-product"}, + slug={"en": "foo-bar"}, + ) ) ) - product = old_client.products.update_by_id( - id=product.id, - version=product.version, - actions=[ - models.ProductChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) - ], + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug2") + ) + ], + ), + ) ) assert product.version == 2 # This should raise a version conflict error with pytest.raises(CommercetoolsError) as exc: - product = old_client.products.delete_by_id(id=product.id, version=1) + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .delete(version=1) + ) assert exc.value.response.status_code == 409 assert exc.value.response.errors[0].current_version == 2 # Force it - old_client.products.delete_by_id(id=product.id, version=1, force_delete=True) + ct_platform_client.with_project_key("unittest").products().with_id( + product.id + ).delete(version=1, options={"force_version": True}) diff --git a/tests/platform/test_expand.py b/tests/platform/test_expand.py index f85f1be9..1547de2c 100644 --- a/tests/platform/test_expand.py +++ b/tests/platform/test_expand.py @@ -1,10 +1,8 @@ -import commercetools -from commercetools.platform import Client as PlatformClient -from commercetools.platform import models +from commercetools.platform import Client, models from tests.platform.test_service_order import get_test_order -def test_unknown_expand_terms(ct_platform_client: PlatformClient): +def test_unknown_expand_terms(ct_platform_client: Client): cart = ( ct_platform_client.with_project_key("unittest") .carts() @@ -29,7 +27,7 @@ def test_unknown_expand_terms(ct_platform_client: PlatformClient): assert order.id -def test_optional_expanded_terms(ct_platform_client: PlatformClient, commercetools_api): +def test_optional_expanded_terms(ct_platform_client: Client, commercetools_api): order = get_test_order() commercetools_api.orders.add_existing(order) @@ -45,9 +43,7 @@ def test_optional_expanded_terms(ct_platform_client: PlatformClient, commercetoo assert expanded_order.discount_codes is None -def test_unknown_reference_expand_terms( - ct_platform_client: PlatformClient, commercetools_api -): +def test_unknown_reference_expand_terms(ct_platform_client: Client, commercetools_api): order = get_test_order() commercetools_api.orders.add_existing(order) @@ -65,33 +61,43 @@ def test_unknown_reference_expand_terms( assert expanded_order.shipping_info.shipping_method.obj is None -def test_multiple_expand(old_client, commercetools_api): - shipping_method = old_client.shipping_methods.create( - models.ShippingMethodDraft( - key="test-shipping-method", - name="test shipping method", - tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), - zone_rates=[], - is_default=False, +def test_multiple_expand(ct_platform_client: Client, commercetools_api): + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .post( + models.ShippingMethodDraft( + key="test-shipping-method", + name="test shipping method", + tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), + zone_rates=[], + is_default=False, + ) ) ) + assert shipping_method - payment = old_client.payments.create( - models.PaymentDraft( - key="test-payment", - amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), - payment_method_info=models.PaymentMethodInfo( - payment_interface="ADYEN", method="mc" - ), - transactions=[ - models.TransactionDraft( - type=models.TransactionType.CHARGE, - amount=models.Money(cent_amount=2000, currency_code="GBP"), - state=models.TransactionState.PENDING, - ) - ], + payment = ( + ct_platform_client.with_project_key("unittest") + .payments() + .post( + models.PaymentDraft( + key="test-payment", + amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), + payment_method_info=models.PaymentMethodInfo( + payment_interface="ADYEN", method="mc" + ), + transactions=[ + models.TransactionDraft( + type=models.TransactionType.CHARGE, + amount=models.Money(cent_amount=2000, currency_code="GBP"), + state=models.TransactionState.PENDING, + ) + ], + ) ) ) + assert payment order = get_test_order() assert order.shipping_info is not None @@ -102,24 +108,32 @@ def test_multiple_expand(old_client, commercetools_api): order.payment_info.payments[0].id = payment.id commercetools_api.orders.add_existing(order) - expanded_order = old_client.orders.get_by_id( - order.id, expand=["shippingInfo.shippingMethod", "paymentInfo.payments[*]"] + expanded_order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .with_id(order.id) + .get(expand=["shippingInfo.shippingMethod", "paymentInfo.payments[*]"]) ) assert expanded_order.id assert expanded_order.shipping_info.shipping_method.obj.id == shipping_method.id assert expanded_order.payment_info.payments[0].obj.id == payment.id - expanded_order = old_client.orders.get_by_id( - order.id, expand=["shippingInfo.shippingMethod"] + expanded_order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .with_id(order.id) + .get(expand=["shippingInfo.shippingMethod"]) ) assert expanded_order.id assert expanded_order.shipping_info.shipping_method.obj.id == shipping_method.id assert expanded_order.payment_info.payments[0].obj is None - query_results = old_client.orders.query( - expand=["shippingInfo.shippingMethod", "paymentInfo.payments[*]"] + query_results = ( + ct_platform_client.with_project_key("unittest") + .orders() + .get(expand=["shippingInfo.shippingMethod", "paymentInfo.payments[*]"]) ) expanded_order = query_results.results[0] diff --git a/tests/platform/test_mock_server.py b/tests/platform/test_mock_server.py index 4197f56b..d3f841f5 100644 --- a/tests/platform/test_mock_server.py +++ b/tests/platform/test_mock_server.py @@ -2,43 +2,45 @@ import requests -from commercetools import Client from commercetools.platform import models +from commercetools.platform.client import Client from commercetools.platform.models import ( ChannelDraft, ChannelResourceIdentifier, ChannelRoleEnum, - LocalizedString, ProductDraft, ProductTypeResourceIdentifier, StoreDraft, ) -def test_http_server(commercetools_client, commercetools_http_server): +def test_http_server(ct_platform_client, commercetools_http_server): os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" client = Client( - project_key="unittest", client_id="client-id", client_secret="client-secret", - scope=[], + scope=["manage_project:test"], url=commercetools_http_server.api_url, token_url=f"{commercetools_http_server.api_url}/oauth/token", ) - query_result = client.products.query() + query_result = ct_platform_client.with_project_key("unittest").products().get() assert query_result.count == 0 - product = client.products.create( - ProductDraft( - key="test-product", - product_type=ProductTypeResourceIdentifier(key="dummy"), - name={"nl": "Testje"}, - slug={"en": "foo-bar"}, + product = ( + client.with_project_key("unittest") + .products() + .post( + ProductDraft( + key="test-product", + product_type=ProductTypeResourceIdentifier(key="dummy"), + name={"nl": "Testje"}, + slug={"en": "foo-bar"}, + ) ) ) - client.products.get_by_id(product.id) + client.with_project_key("unittes").products().with_id(product.id).get() url = commercetools_http_server.api_url + f"/unittest/products/{product.id}" response = requests.get(url, headers={"Authorization": "Bearer token"}) @@ -47,27 +49,30 @@ def test_http_server(commercetools_client, commercetools_http_server): assert data["masterData"]["staged"]["name"]["nl"] == "Testje" -def test_http_server_expanding(commercetools_client, commercetools_http_server): +def test_http_server_expanding(ct_platform_client: Client, commercetools_http_server): os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" client = Client( - project_key="unittest", client_id="client-id", client_secret="client-secret", - scope=[], + scope=["manage_project:test"], url=commercetools_http_server.api_url, token_url=f"{commercetools_http_server.api_url}/oauth/token", ) - client.channels.create( + client.with_project_key("unittest").channels().post( ChannelDraft(key="FOO", roles=[ChannelRoleEnum.PRODUCT_DISTRIBUTION]) ) - store = client.stores.create( - StoreDraft( - name=models.LocalizedString(nl="foo"), - key="FOO", - distribution_channels=[ChannelResourceIdentifier(key="FOO")], + store = ( + client.with_project_key("unittest") + .stores() + .post( + StoreDraft( + name=models.LocalizedString(nl="foo"), + key="FOO", + distribution_channels=[ChannelResourceIdentifier(key="FOO")], + ) ) ) diff --git a/tests/platform/test_service_api_clients.py b/tests/platform/test_service_api_clients.py index d07ca322..d3094067 100644 --- a/tests/platform/test_service_api_clients.py +++ b/tests/platform/test_service_api_clients.py @@ -1,15 +1,25 @@ import pytest from commercetools.platform import models +from commercetools.platform.client import Client -def test_api_client_flow(old_client, api_client_draft): - api_client = old_client.api_clients.create(api_client_draft) +def test_api_client_flow(ct_platform_client: Client, api_client_draft): + api_client = ( + ct_platform_client.with_project_key("test").api_clients().post(api_client_draft) + ) + assert api_client assert api_client.id - deleted_api_client = old_client.api_clients.delete_by_id(api_client.id) + deleted_api_client = ( + ct_platform_client.with_project_key("test") + .api_clients() + .with_id(api_client.id) + .delete() + ) + assert deleted_api_client assert api_client.id == deleted_api_client.id diff --git a/tests/platform/test_service_cart.py b/tests/platform/test_service_cart.py index 6089cb43..6dc54392 100644 --- a/tests/platform/test_service_cart.py +++ b/tests/platform/test_service_cart.py @@ -6,15 +6,15 @@ from commercetools.platform.client import Client -def test_cart_get_by_id(ct_platform_client: Client, cart_draft): - cart = ct_platform_client.with_project_key("test").carts().post(cart_draft) +def test_cart_with_id_get(ct_platform_client: Client, cart_draft): + cart = ct_platform_client.with_project_key("unittest").carts().post(cart_draft) assert cart.id @pytest.fixture def cart_draft(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") product_1 = client.products().post( models.ProductDraft( key="product-1", @@ -54,7 +54,7 @@ def cart_draft(ct_platform_client: Client): def test_update_actions(commercetools_api, ct_platform_client, cart_draft): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") cart = client.carts().post(cart_draft) payment_reference = models.PaymentReference(id=str(uuid.uuid4())) diff --git a/tests/platform/test_service_cart_discounts.py b/tests/platform/test_service_cart_discounts.py index c679836c..88bdebf9 100644 --- a/tests/platform/test_service_cart_discounts.py +++ b/tests/platform/test_service_cart_discounts.py @@ -5,12 +5,12 @@ from requests.exceptions import HTTPError from commercetools.platform import models -from commercetools.platform.client import Client as PlatformClient +from commercetools.platform.client import Client -def test_cart_discount_get_by_id(ct_platform_client: PlatformClient): +def test_cart_discount_with_id(ct_platform_client: Client): cart_discount = ( - ct_platform_client.with_project_key("foo") + ct_platform_client.with_project_key("unittest") .cart_discounts() .post( models.CartDiscountDraft( @@ -26,24 +26,24 @@ def test_cart_discount_get_by_id(ct_platform_client: PlatformClient): assert cart_discount.id cart_discount = ( - ct_platform_client.with_project_key("foo") + ct_platform_client.with_project_key("unittest") .cart_discounts() .with_id(cart_discount.id) .get() ) assert cart_discount.id - item = ( - ct_platform_client.with_project_key("foo") + cart_discount = ( + ct_platform_client.with_project_key("unittest") .cart_discounts() .with_id("invalid") .get() ) - assert item is None + assert cart_discount is None -def test_cart_discount_query(old_client): - old_client.cart_discounts.create( +def test_cart_discount_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").cart_discounts().post( models.CartDiscountDraft( name=models.LocalizedString({"en:": "test discount"}), value=models.CartDiscountValueRelative(permyriad=10), @@ -52,7 +52,7 @@ def test_cart_discount_query(old_client): requires_discount_code=False, ) ) - old_client.cart_discounts.create( + ct_platform_client.with_project_key("unittest").cart_discounts().post( models.CartDiscountDraft( name=models.LocalizedString({"en:": "test discount"}), value=models.CartDiscountValueRelative(permyriad=10), @@ -63,81 +63,123 @@ def test_cart_discount_query(old_client): ) # single sort query - result = old_client.cart_discounts.query(sort="id asc") + result = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .get(sort="id asc") + ) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.cart_discounts.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .get(sort=["id asc", "name asc"]) + ) assert len(result.results) == 2 assert result.total == 2 -def test_cart_discount_update(old_client): - cart_discount = old_client.cart_discounts.create( - models.CartDiscountDraft( - name=models.LocalizedString(en="en-cart_discount"), - value=models.CartDiscountValueRelative(permyriad=10), - is_active=True, - cart_predicate="", - sort_order="", - requires_discount_code=False, +def test_cart_discount_update(ct_platform_client: Client): + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .post( + models.CartDiscountDraft( + name=models.LocalizedString(en="en-cart_discount"), + value=models.CartDiscountValueRelative(permyriad=10), + is_active=True, + cart_predicate="", + sort_order="", + requires_discount_code=False, + ) ) ) assert cart_discount.is_active is True - cart_discount = old_client.cart_discounts.update_by_id( - id=cart_discount.id, - version=cart_discount.version, - actions=[models.CartDiscountChangeIsActiveAction(is_active=False)], + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .with_id(cart_discount.id) + .post( + models.CartDiscountUpdate( + version=cart_discount.version, + actions=[models.CartDiscountChangeIsActiveAction(is_active=False)], + ) + ) ) assert cart_discount.is_active is False @freeze_time("2021-03-01 12:34:56") -def test_cart_discount_set_valid_from(old_client): - cart_discount = old_client.cart_discounts.create( - models.CartDiscountDraft( - name=models.LocalizedString(en="en-cart_discount"), - value=models.CartDiscountValueRelative(permyriad=10), - is_active=True, - cart_predicate="", - sort_order="", - requires_discount_code=False, +def test_cart_discount_set_valid_from(ct_platform_client: Client): + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .post( + models.CartDiscountDraft( + name=models.LocalizedString(en="en-cart_discount"), + value=models.CartDiscountValueRelative(permyriad=10), + is_active=True, + cart_predicate="", + sort_order="", + requires_discount_code=False, + ) ) ) assert cart_discount.id assert cart_discount.valid_from is None - cart_discount = old_client.cart_discounts.update_by_id( - id=cart_discount.id, - version=cart_discount.version, - actions=[models.CartDiscountSetValidFromAction(valid_from=datetime.now())], + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .with_id(cart_discount.id) + .post( + models.CartDiscountUpdate( + version=cart_discount.version, + actions=[ + models.CartDiscountSetValidFromAction(valid_from=datetime.now()) + ], + ) + ) ) assert cart_discount.valid_from == datetime.now() @freeze_time("2021-03-01 12:34:56") -def test_cart_discount_set_valid_until(old_client): - cart_discount = old_client.cart_discounts.create( - models.CartDiscountDraft( - name=models.LocalizedString(en="en-cart_discount"), - value=models.CartDiscountValueRelative(permyriad=10), - is_active=True, - cart_predicate="", - sort_order="", - requires_discount_code=False, +def test_cart_discount_set_valid_until(ct_platform_client: Client): + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .post( + models.CartDiscountDraft( + name=models.LocalizedString(en="en-cart_discount"), + value=models.CartDiscountValueRelative(permyriad=10), + is_active=True, + cart_predicate="", + sort_order="", + requires_discount_code=False, + ) ) ) assert cart_discount.id assert cart_discount.valid_until is None - cart_discount = old_client.cart_discounts.update_by_id( - id=cart_discount.id, - version=cart_discount.version, - actions=[models.CartDiscountSetValidUntilAction(valid_until=datetime.now())], + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .with_id(cart_discount.id) + .post( + models.CartDiscountUpdate( + version=cart_discount.version, + actions=[ + models.CartDiscountSetValidUntilAction(valid_until=datetime.now()) + ], + ) + ) ) assert cart_discount.valid_until == datetime.now() diff --git a/tests/platform/test_service_categories.py b/tests/platform/test_service_categories.py index f1d3160a..6a438054 100644 --- a/tests/platform/test_service_categories.py +++ b/tests/platform/test_service_categories.py @@ -2,121 +2,190 @@ from requests.exceptions import HTTPError from commercetools.platform import models - - -def test_category_get_by_id(old_client): - category = old_client.categories.create( - models.CategoryDraft( - key="test-category", - name=models.LocalizedString(en="category"), - slug=models.LocalizedString(en="something"), +from commercetools.platform.client import Client + + +def test_category_with_id_get(ct_platform_client: Client): + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .post( + models.CategoryDraft( + key="test-category", + name=models.LocalizedString(en="category"), + slug=models.LocalizedString(en="something"), + ) ) ) assert category.id assert category.key == "test-category" - category = old_client.categories.get_by_id(category.id) + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_id(category.id) + .get() + ) assert category.id assert category.key == "test-category" - with pytest.raises(HTTPError): - old_client.categories.get_by_id("invalid") - - -def test_category_get_by_key(old_client): - category = old_client.categories.create( - models.CategoryDraft( - key="test-category", - name=models.LocalizedString(en="category"), - slug=models.LocalizedString(en="something"), + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_id("invalid") + .get() + ) + assert category is None + + +def test_category_get_by_key(ct_platform_client: Client): + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .post( + models.CategoryDraft( + key="test-category", + name=models.LocalizedString(en="category"), + slug=models.LocalizedString(en="something"), + ) ) ) assert category.id assert category.key == "test-category" - category = old_client.categories.get_by_key("test-category") + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_key("test-category") + .get() + ) assert category.id assert category.key == "test-category" - with pytest.raises(HTTPError): - old_client.categories.get_by_key("invalid") - - -def test_category_query(old_client): - category = old_client.categories.create( - models.CategoryDraft( - key="test-category1", - name=models.LocalizedString(en="category"), - slug=models.LocalizedString(en="something"), + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_key("invalid") + .get() + ) + assert category is None + + +def test_category_query(ct_platform_client: Client): + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .post( + models.CategoryDraft( + key="test-category1", + name=models.LocalizedString(en="category"), + slug=models.LocalizedString(en="something"), + ) ) ) - category = old_client.categories.create( - models.CategoryDraft( - key="test-category2", - name=models.LocalizedString(en="category"), - slug=models.LocalizedString(en="something"), + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .post( + models.CategoryDraft( + key="test-category2", + name=models.LocalizedString(en="category"), + slug=models.LocalizedString(en="something"), + ) ) ) # single sort query - result = old_client.categories.query(sort="id asc", limit=10) + result = ( + ct_platform_client.with_project_key("unittest") + .categories() + .get(sort="id asc", limit=10) + ) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.categories.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .categories() + .get(sort=["id asc", "name asc"]) + ) assert len(result.results) == 2 assert result.total == 2 -def test_category_update(old_client): +def test_category_update(ct_platform_client: Client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ - parent_category = old_client.categories.create( - models.CategoryDraft( - key="parent-test-category", - slug=models.LocalizedString(nl="nl-slug-parent"), - name=models.LocalizedString(nl="parent-category"), + parent_category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .post( + models.CategoryDraft( + key="parent-test-category", + slug=models.LocalizedString(nl="nl-slug-parent"), + name=models.LocalizedString(nl="parent-category"), + ) ) ) - category = old_client.categories.create( - models.CategoryDraft( - key="test-category", - slug=models.LocalizedString(nl="nl-slug"), - name=models.LocalizedString(nl="category"), - parent=models.CategoryResourceIdentifier(id=parent_category.id), - order_hint="0.00001", - description=models.LocalizedString(nl="description-nl"), + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .post( + models.CategoryDraft( + key="test-category", + slug=models.LocalizedString(nl="nl-slug"), + name=models.LocalizedString(nl="category"), + parent=models.CategoryResourceIdentifier(id=parent_category.id), + order_hint="0.00001", + description=models.LocalizedString(nl="description-nl"), + ) ) ) assert category.key == "test-category" assert category.order_hint == "0.00001" assert getattr(category.parent, "id") == parent_category.id - category = old_client.categories.update_by_id( - id=category.id, - version=category.version, - actions=[ - models.CategoryChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")), - models.CategorySetDescriptionAction( - description=models.LocalizedString(nl="updated-description-nl") - ), - ], + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_id(category.id) + .post( + models.CategoryUpdate( + version=category.version, + actions=[ + models.CategoryChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug2") + ), + models.CategorySetDescriptionAction( + description=models.LocalizedString(nl="updated-description-nl") + ), + ], + ) + ) ) assert category.key == "test-category" assert category.description == models.LocalizedString(nl="updated-description-nl") - category = old_client.categories.update_by_key( - key="test-category", - version=category.version, - actions=[ - models.CategoryChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) - ], + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_key("test-category") + .post( + models.CategoryUpdate( + version=category.version, + actions=[ + models.CategoryChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug2") + ) + ], + ) + ) ) assert category.key == "test-category" diff --git a/tests/platform/test_service_channels.py b/tests/platform/test_service_channels.py index 404b618d..568d2914 100644 --- a/tests/platform/test_service_channels.py +++ b/tests/platform/test_service_channels.py @@ -2,70 +2,101 @@ from requests.exceptions import HTTPError from commercetools.platform import models +from commercetools.platform.client import Client -def test_channel_get_by_id(old_client): - channel = old_client.channels.create( - models.ChannelDraft( - key="test-channel", roles=[models.ChannelRoleEnum.INVENTORY_SUPPLY] +def test_channel_with_id_get(ct_platform_client: Client): + channel = ( + ct_platform_client.with_project_key("unittest") + .channels() + .post( + models.ChannelDraft( + key="test-channel", roles=[models.ChannelRoleEnum.INVENTORY_SUPPLY] + ) ) ) assert channel.id assert channel.key == "test-channel" - channel = old_client.channels.get_by_id(channel.id) + channel = ( + ct_platform_client.with_project_key("unittest") + .channels() + .with_id(channel.id) + .get() + ) assert channel.id assert channel.key == "test-channel" - with pytest.raises(HTTPError): - old_client.channels.get_by_id("invalid") + channel = ( + ct_platform_client.with_project_key("unittest") + .channels() + .with_id("invalid") + .get() + ) + assert channel is None -def test_channel_query(old_client): - old_client.channels.create( +def test_channel_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").channels().post( models.ChannelDraft( key="test-channel1", roles=[models.ChannelRoleEnum.INVENTORY_SUPPLY] ) ) - old_client.channels.create( + ct_platform_client.with_project_key("unittest").channels().post( models.ChannelDraft( key="test-channel2", roles=[models.ChannelRoleEnum.INVENTORY_SUPPLY] ) ) # single sort query - result = old_client.channels.query(sort="id asc") + result = ( + ct_platform_client.with_project_key("unittest").channels().get(sort="id asc") + ) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.channels.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .channels() + .get(sort=["id asc", "name asc"]) + ) assert len(result.results) == 2 assert result.total == 2 -def test_channel_update(old_client): +def test_channel_update(ct_platform_client: Client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ - channel = old_client.channels.create( - models.ChannelDraft( - key="test-channel", - name=models.LocalizedString(nl="nl-channel"), - roles=[models.ChannelRoleEnum.INVENTORY_SUPPLY], + channel = ( + ct_platform_client.with_project_key("unittest") + .channels() + .post( + models.ChannelDraft( + key="test-channel", + name=models.LocalizedString(nl="nl-channel"), + roles=[models.ChannelRoleEnum.INVENTORY_SUPPLY], + ) ) ) assert channel.key == "test-channel" - channel = old_client.channels.update_by_id( - id=channel.id, - version=channel.version, - actions=[ - models.ChannelChangeNameAction( - name=models.LocalizedString(nl="nl-channel2") + channel = ( + ct_platform_client.with_project_key("unittest") + .channels() + .with_id(channel.id) + .post( + models.ChannelUpdate( + version=channel.version, + actions=[ + models.ChannelChangeNameAction( + name=models.LocalizedString(nl="nl-channel2") + ) + ], ) - ], + ) ) diff --git a/tests/platform/test_service_custom_objects.py b/tests/platform/test_service_custom_objects.py index d7ef9d05..9e669bf6 100644 --- a/tests/platform/test_service_custom_objects.py +++ b/tests/platform/test_service_custom_objects.py @@ -2,106 +2,168 @@ from requests.exceptions import HTTPError from commercetools.platform import models +from commercetools.platform.client import Client -def test_custom_object_get_by_container_and_key(old_client): - custom_object = old_client.custom_objects.create_or_update( - models.CustomObjectDraft(container="unittest", key="test-object", value=1234) +def test_custom_object_get_by_container_and_key(ct_platform_client: Client): + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .post( + models.CustomObjectDraft( + container="unittest", key="test-object", value=1234 + ) + ) ) + assert custom_object assert custom_object.id assert custom_object.container == "unittest" assert custom_object.key == "test-object" assert custom_object.value == 1234 - custom_object = old_client.custom_objects.get_by_container_and_key( - "unittest", "test-object" + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .with_container_and_key("unittest", "test-object") + .get() ) assert custom_object.container == "unittest" assert custom_object.key == "test-object" assert custom_object.value == 1234 - with pytest.raises(HTTPError): - old_client.custom_objects.get_by_container_and_key("invalid", "invalid") + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .with_container_and_key("invalid", "invalid") + .get() + ) + assert custom_object is None -def test_custom_object_query(old_client): - old_client.custom_objects.create_or_update( +def test_custom_object_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").custom_objects().post( models.CustomObjectDraft(container="unittest", key="test-object-1", value=1234) ) - old_client.custom_objects.create_or_update( + ct_platform_client.with_project_key("unittest").custom_objects().post( models.CustomObjectDraft(container="unittest", key="test-object-2", value=1234) ) # single sort query - result = old_client.custom_objects.query(sort="id asc") + result = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .get(sort="id asc") + ) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.custom_objects.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .get(sort=["id asc", "name asc"]) + ) assert len(result.results) == 2 assert result.total == 2 -def test_custom_object_update(old_client): +def test_custom_object_update(ct_platform_client: Client): """Test the return value of the update methods. It doesn't test the actual update itself. """ - custom_object = old_client.custom_objects.create_or_update( - models.CustomObjectDraft(container="unittest", key="test-object-1", value=1234) + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .post( + models.CustomObjectDraft( + container="unittest", key="test-object-1", value=1234 + ) + ) ) assert custom_object.key == "test-object-1" assert custom_object.value == 1234 assert custom_object.version == 1 - custom_object = old_client.custom_objects.create_or_update( - models.CustomObjectDraft(container="unittest", key="test-object-1", value=2345) + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .post( + models.CustomObjectDraft( + container="unittest", key="test-object-1", value=2345 + ) + ) ) assert custom_object.key == "test-object-1" assert custom_object.value == 2345 assert custom_object.version == 2 # And another key - custom_object = old_client.custom_objects.create_or_update( - models.CustomObjectDraft(container="unittest", key="test-object-2", value=3456) + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .post( + models.CustomObjectDraft( + container="unittest", key="test-object-2", value=3456 + ) + ) ) assert custom_object.key == "test-object-2" assert custom_object.value == 3456 assert custom_object.version == 1 -def test_custom_object_query_by_container(old_client): +def test_custom_object_query_by_container(ct_platform_client: Client): """Test filtering by container.""" - old_client.custom_objects.create_or_update( + ct_platform_client.with_project_key("unittest").custom_objects().post( models.CustomObjectDraft(container="unittest", key="test-object-1", value=1234) ) - old_client.custom_objects.create_or_update( + ct_platform_client.with_project_key("unittest").custom_objects().post( models.CustomObjectDraft(container="unittest", key="test-object-2", value=1234) ) - old_client.custom_objects.create_or_update( + ct_platform_client.with_project_key("unittest").custom_objects().post( models.CustomObjectDraft(container="unittest2", key="test-object-1", value=1234) ) - result = old_client.custom_objects.query_by_container("unittest") + result = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .with_container("unittest") + .get() + ) assert len(result.results) == 2 assert result.total == 2 -def test_delete_by_container_and_key(old_client): - custom_object = old_client.custom_objects.create_or_update( - models.CustomObjectDraft(container="unittest", key="test-object-1", value=1234) +def test_delete_by_container_and_key(ct_platform_client: Client): + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .post( + models.CustomObjectDraft( + container="unittest", key="test-object-1", value=1234 + ) + ) ) assert custom_object.id assert custom_object.key == "test-object-1" - deleted_object = old_client.custom_objects.delete_by_container_and_key( - container=custom_object.container, key=custom_object.key + deleted_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .with_container_and_key( + container=custom_object.container, key=custom_object.key + ) + .delete() ) assert deleted_object.key == "test-object-1" - with pytest.raises(HTTPError): - old_client.custom_objects.delete_by_container_and_key( + deleted_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .with_container_and_key( container=custom_object.container, key=custom_object.key ) + .delete() + ) diff --git a/tests/platform/test_service_customer_groups.py b/tests/platform/test_service_customer_groups.py index f55e171e..38c9e1bd 100644 --- a/tests/platform/test_service_customer_groups.py +++ b/tests/platform/test_service_customer_groups.py @@ -1,68 +1,103 @@ from commercetools.platform import models +from commercetools.platform.client import Client -def test_get_by_id(old_client): - customer_group = old_client.customer_groups.create( - draft=models.CustomerGroupDraft(group_name="test customer group") +def test_with_id_get(ct_platform_client: Client): + customer_group = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .post(models.CustomerGroupDraft(group_name="test customer group")) ) assert customer_group.id - customer_group = old_client.customer_groups.get_by_id(customer_group.id) + customer_group = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .with_id(customer_group.id) + .get() + ) assert customer_group -def test_get_by_key(old_client): - customer_group = old_client.customer_groups.create( - draft=models.CustomerGroupDraft( - group_name="test customer group", key="test-customer-group" +def test_get_by_key(ct_platform_client: Client): + customer_group = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .post( + models.CustomerGroupDraft( + group_name="test customer group", key="test-customer-group" + ) ) ) assert customer_group.key - customer_group = old_client.customer_groups.get_by_key(customer_group.key) + customer_group = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .with_key(customer_group.key) + .get() + ) assert customer_group -def test_query(old_client): - old_client.customer_groups.create( - draft=models.CustomerGroupDraft( - key="test-customer-group-1", group_name="group-1" - ) +def test_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").customer_groups().post( + models.CustomerGroupDraft(key="test-customer-group-1", group_name="group-1") ) - old_client.customer_groups.create( - draft=models.CustomerGroupDraft( - key="test-customer-group-2", group_name="group-2" - ) + ct_platform_client.with_project_key("unittest").customer_groups().post( + models.CustomerGroupDraft(key="test-customer-group-2", group_name="group-2") ) - result = old_client.customer_groups.query(sort="id asc", limit=10) + result = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .get(sort="id asc", limit=10) + ) assert len(result.results) == 2 assert result.total == 2 - result = old_client.customer_groups.query(sort=["id asc", "name asc"], limit=1) + result = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .get(sort=["id asc", "name asc"], limit=1) + ) assert len(result.results) == 1 assert result.total == 2 -def test_delete_by_id(old_client): - customer_group = old_client.customer_groups.create( - draft=models.CustomerGroupDraft( - group_name="test customer group", key="test-customer-group" +def test_delete_by_id(ct_platform_client: Client): + customer_group = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .post( + models.CustomerGroupDraft( + group_name="test customer group", key="test-customer-group" + ) ) ) assert customer_group.id - assert old_client.customer_groups.delete_by_id( - customer_group.id, version=customer_group.version + assert ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .with_id(customer_group.id) + .delete(version=customer_group.version) ) -def test_delete_by_key(old_client): - customer_group = old_client.customer_groups.create( - draft=models.CustomerGroupDraft( - group_name="test customer group", key="test-customer-group" +def test_delete_by_key(ct_platform_client: Client): + customer_group = ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .post( + models.CustomerGroupDraft( + group_name="test customer group", key="test-customer-group" + ) ) ) assert customer_group.key - assert old_client.customer_groups.delete_by_key( - customer_group.key, version=customer_group.version + assert ( + ct_platform_client.with_project_key("unittest") + .customer_groups() + .with_key(customer_group.key) + .delete(version=customer_group.version) ) diff --git a/tests/platform/test_service_customers.py b/tests/platform/test_service_customers.py index 4fe46ce0..d73ac2ec 100644 --- a/tests/platform/test_service_customers.py +++ b/tests/platform/test_service_customers.py @@ -1,6 +1,7 @@ import datetime from commercetools.platform import models +from commercetools.platform.client import Client def _get_draft_object(**kwargs): @@ -16,47 +17,82 @@ def _get_draft_object(**kwargs): return models.CustomerDraft(**customer) -def test_get_by_id(old_client): - result = old_client.customers.create(draft=_get_draft_object()) +def test_with_id_get(ct_platform_client: Client): + draft = _get_draft_object() + result = ct_platform_client.with_project_key("unittest").customers().post(draft) assert result.customer.id - - customer = old_client.customers.get_by_id(result.customer.id) + customer = ( + ct_platform_client.with_project_key("unittest") + .customers() + .with_id(result.customer.id) + .get() + ) assert customer -def test_get_by_key(old_client): - result = old_client.customers.create(draft=_get_draft_object(key="test-customer")) +def test_get_by_key(ct_platform_client: Client): + draft = _get_draft_object(key="test-customer") + result = ct_platform_client.with_project_key("unittest").customers().post(draft) assert result.customer.key assert result.cart is None - customer = old_client.customers.get_by_key(result.customer.key) + customer = ( + ct_platform_client.with_project_key("unittest") + .customers() + .with_key(result.customer.key) + .get() + ) assert customer -def test_query(old_client): - old_client.customers.create(draft=_get_draft_object(key="test-customer-1")) - old_client.customers.create(draft=_get_draft_object(key="test-customer-2")) +def test_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").customers().post( + _get_draft_object(key="test-customer-1") + ) + ct_platform_client.with_project_key("unittest").customers().post( + _get_draft_object(key="test-customer-2") + ) - result = old_client.customers.query(sort="id asc", limit=10) + result = ( + ct_platform_client.with_project_key("unittest") + .customers() + .get(sort="id asc", limit=10) + ) assert len(result.results) == 2 assert result.total == 2 - result = old_client.customers.query(sort=["id asc", "name asc"], limit=1) + result = ( + ct_platform_client.with_project_key("unittest") + .customers() + .get(sort=["id asc", "name asc"], limit=1) + ) assert len(result.results) == 1 assert result.total == 2 -def test_delete_by_id(old_client): - result = old_client.customers.create(draft=_get_draft_object()) +def test_delete_by_id(ct_platform_client: Client): + draft = _get_draft_object() + result = ct_platform_client.with_project_key("unittest").customers().post(draft) assert result.customer.id - assert old_client.customers.delete_by_id( - result.customer.id, version=result.customer.version + assert ( + ct_platform_client.with_project_key("unittest") + .customers() + .with_id(result.customer.id) + .delete(version=result.customer.version) ) -def test_delete_by_key(old_client): - result = old_client.customers.create(draft=_get_draft_object(key="test-customer")) +def test_delete_by_key(ct_platform_client: Client): + result = ( + ct_platform_client.with_project_key("unittest") + .customers() + .post(_get_draft_object(key="test-customer")) + ) + assert result and result.customer assert result.customer.key - assert old_client.customers.delete_by_key( - result.customer.key, version=result.customer.version + assert ( + ct_platform_client.with_project_key("unittest") + .customers() + .with_key(result.customer.key) + .delete(version=result.customer.version) ) diff --git a/tests/platform/test_service_discount_codes.py b/tests/platform/test_service_discount_codes.py index 58350718..420402e0 100644 --- a/tests/platform/test_service_discount_codes.py +++ b/tests/platform/test_service_discount_codes.py @@ -5,37 +5,54 @@ from requests.exceptions import HTTPError from commercetools.platform import models - - -def test_discount_code_get_by_id(old_client): - discount_code = old_client.discount_codes.create( - models.DiscountCodeDraft( - name=models.LocalizedString({"en": "test discount"}), - code="1337", - cart_discounts=[], +from commercetools.platform.client import Client + + +def test_discount_code_with_id_get(ct_platform_client: Client): + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .post( + models.DiscountCodeDraft( + name=models.LocalizedString({"en": "test discount"}), + code="1337", + cart_discounts=[], + ) ) ) + assert discount_code assert discount_code.id assert discount_code.code == "1337" - discount_code = old_client.discount_codes.get_by_id(discount_code.id) + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id(discount_code.id) + .get() + ) + assert discount_code assert discount_code.id assert discount_code.code == "1337" - with pytest.raises(HTTPError): - old_client.discount_codes.get_by_id("invalid") + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id("invalid") + .get() + ) + assert discount_code is None -def test_discount_code_query(old_client): - old_client.discount_codes.create( +def test_discount_code_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").discount_codes().post( models.DiscountCodeDraft( name=models.LocalizedString({"en:": "test discount"}), code="1337", cart_discounts=[], ) ) - old_client.discount_codes.create( + ct_platform_client.with_project_key("unittest").discount_codes().post( models.DiscountCodeDraft( name=models.LocalizedString({"en:": "test discount"}), code="1338", @@ -44,138 +61,205 @@ def test_discount_code_query(old_client): ) # single sort query - result = old_client.discount_codes.query(sort="id asc") + result = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .get(sort="id asc") + ) + assert result assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.discount_codes.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .get(sort=["id asc", "name asc"]) + ) + assert result assert len(result.results) == 2 assert result.total == 2 -def test_discount_code_update(old_client): - discount_code = old_client.discount_codes.create( - models.DiscountCodeDraft( - name=models.LocalizedString(en="en-discount_code"), - code="1337", - is_active=True, - cart_discounts=[], +def test_discount_code_update(ct_platform_client: Client): + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .post( + models.DiscountCodeDraft( + name=models.LocalizedString(en="en-discount_code"), + code="1337", + is_active=True, + cart_discounts=[], + ) ) ) assert discount_code.code == "1337" - discount_code = old_client.discount_codes.update_by_id( - id=discount_code.id, - version=discount_code.version, - actions=[models.DiscountCodeChangeIsActiveAction(is_active=False)], + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id(discount_code.id) + .post( + models.DiscountCodeUpdate( + version=discount_code.version, + actions=[models.DiscountCodeChangeIsActiveAction(is_active=False)], + ) + ) ) assert discount_code.is_active is False -def test_discount_code_delete(old_client): - discount_code = old_client.discount_codes.create( - models.DiscountCodeDraft( - name=models.LocalizedString(en="en-discount_code"), - code="1337", - is_active=True, - cart_discounts=[], +def test_discount_code_delete(ct_platform_client: Client): + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .post( + models.DiscountCodeDraft( + name=models.LocalizedString(en="en-discount_code"), + code="1337", + is_active=True, + cart_discounts=[], + ) ) ) assert discount_code.code == "1337" - discount_code = old_client.discount_codes.delete_by_id( - id=discount_code.id, - version=discount_code.version, + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id(discount_code.id) + .delete( + version=discount_code.version, + ) ) assert discount_code.code == "1337" - result = old_client.discount_codes.query() + result = ct_platform_client.with_project_key("unittest").discount_codes().get() assert len(result.results) == 0 @freeze_time("2021-03-01 12:34:56") -def test_discount_code_set_valid_from(old_client): - discount_code = old_client.discount_codes.create( - models.DiscountCodeDraft( - name=models.LocalizedString(en="en-discount_code"), - code="1337", - is_active=True, - cart_discounts=[], +def test_discount_code_set_valid_from(ct_platform_client: Client): + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .post( + models.DiscountCodeDraft( + name=models.LocalizedString(en="en-discount_code"), + code="1337", + is_active=True, + cart_discounts=[], + ) ) ) assert discount_code.id assert discount_code.valid_from is None - discount_code = old_client.discount_codes.update_by_id( - id=discount_code.id, - version=discount_code.version, - actions=[models.DiscountCodeSetValidFromAction(valid_from=datetime.now())], + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id(discount_code.id) + .post( + models.DiscountCodeUpdate( + version=discount_code.version, + actions=[ + models.DiscountCodeSetValidFromAction(valid_from=datetime.now()) + ], + ) + ) ) assert discount_code.valid_from == datetime.now() @freeze_time("2021-03-01 12:34:56") -def test_discount_code_set_valid_until(old_client): - discount_code = old_client.discount_codes.create( - models.DiscountCodeDraft( - name=models.LocalizedString(en="en-discount_code"), - code="1337", - is_active=True, - cart_discounts=[], +def test_discount_code_set_valid_until(ct_platform_client: Client): + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .post( + models.DiscountCodeDraft( + name=models.LocalizedString(en="en-discount_code"), + code="1337", + is_active=True, + cart_discounts=[], + ) ) ) assert discount_code.id assert discount_code.valid_until is None - discount_code = old_client.discount_codes.update_by_id( - id=discount_code.id, - version=discount_code.version, - actions=[models.DiscountCodeSetValidUntilAction(valid_until=datetime.now())], + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id(discount_code.id) + .post( + models.DiscountCodeUpdate( + version=discount_code.version, + actions=[ + models.DiscountCodeSetValidUntilAction(valid_until=datetime.now()) + ], + ) + ) ) assert discount_code.version == 2 assert discount_code.valid_until == datetime.now() -def test_discount_code_change_cart_discounts(old_client): - discount_code = old_client.discount_codes.create( - models.DiscountCodeDraft( - name=models.LocalizedString(en="en-discount_code"), - code="1337", - is_active=True, - cart_discounts=[], +def test_discount_code_change_cart_discounts(ct_platform_client: Client): + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .post( + models.DiscountCodeDraft( + name=models.LocalizedString(en="en-discount_code"), + code="1337", + is_active=True, + cart_discounts=[], + ) ) ) assert discount_code.id assert discount_code.cart_discounts == [] - cart_discount = old_client.cart_discounts.create( - models.CartDiscountDraft( - name=models.LocalizedString(en="cart-discount-test"), - value=models.CartDiscountValueDraft(type="absolute"), - cart_predicate="sku", - sort_order="1", - requires_discount_code=True, + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .post( + models.CartDiscountDraft( + name=models.LocalizedString(en="cart-discount-test"), + value=models.CartDiscountValueDraft(type="absolute"), + cart_predicate="sku", + sort_order="1", + requires_discount_code=True, + ) ) ) assert cart_discount.id - discount_code = old_client.discount_codes.update_by_id( - id=discount_code.id, - version=discount_code.version, - actions=[ - models.DiscountCodeChangeCartDiscountsAction( - cart_discounts=[ - models.CartDiscountResourceIdentifier(id=cart_discount.id) - ] + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id(discount_code.id) + .post( + models.DiscountCodeUpdate( + version=discount_code.version, + actions=[ + models.DiscountCodeChangeCartDiscountsAction( + cart_discounts=[ + models.CartDiscountResourceIdentifier(id=cart_discount.id) + ] + ) + ], ) - ], + ) ) + assert discount_code assert discount_code.version == 2 assert discount_code.cart_discounts == [ models.CartDiscountReference(id=cart_discount.id) diff --git a/tests/platform/test_service_extensions.py b/tests/platform/test_service_extensions.py index 12914143..044f20f7 100644 --- a/tests/platform/test_service_extensions.py +++ b/tests/platform/test_service_extensions.py @@ -1,61 +1,85 @@ from commercetools.platform import models +from commercetools.platform.client import Client -def test_extension_create(old_client): - extension = old_client.extensions.create( - models.ExtensionDraft( - destination=models.AWSLambdaDestination( - arn="arn:", access_key="access", access_secret="secret" - ), - triggers=[], +def test_extension_create(ct_platform_client: Client): + extension = ( + ct_platform_client.with_project_key("unittest") + .extensions() + .post( + models.ExtensionDraft( + destination=models.AWSLambdaDestination( + arn="arn:", access_key="access", access_secret="secret" + ), + triggers=[], + ) ) ) assert extension.id -def test_extension_get_by_id(old_client): - extension = old_client.extensions.create( - models.ExtensionDraft( - destination=models.AWSLambdaDestination( - arn="arn:", access_key="access", access_secret="secret" - ), - triggers=[], +def test_extension_with_id_get(ct_platform_client: Client): + extension = ( + ct_platform_client.with_project_key("unittest") + .extensions() + .post( + models.ExtensionDraft( + destination=models.AWSLambdaDestination( + arn="arn:", access_key="access", access_secret="secret" + ), + triggers=[], + ) ) ) assert extension.id - extension = old_client.extensions.get_by_id(extension.id) + extension = ( + ct_platform_client.with_project_key("unittest") + .extensions() + .with_id(extension.id) + .get() + ) assert extension.id -def test_extension_update_change_triggers(old_client): - extension = old_client.extensions.create( - models.ExtensionDraft( - destination=models.AWSLambdaDestination( - arn="arn:", access_key="access", access_secret="secret" - ), - triggers=[], +def test_extension_update_change_triggers(ct_platform_client: Client): + extension = ( + ct_platform_client.with_project_key("unittest") + .extensions() + .post( + models.ExtensionDraft( + destination=models.AWSLambdaDestination( + arn="arn:", access_key="access", access_secret="secret" + ), + triggers=[], + ) ) ) assert extension.id assert extension.triggers == [] - extension = old_client.extensions.update_by_id( - id=extension.id, - version=extension.version, - actions=[ - models.ExtensionChangeTriggersAction( - triggers=[ - models.ExtensionTrigger( - resource_type_id=models.ExtensionResourceTypeId.CART, - actions=[ - models.ExtensionAction.CREATE, - models.ExtensionAction.UPDATE, - ], + extension = ( + ct_platform_client.with_project_key("unittest") + .extensions() + .with_id(extension.id) + .post( + models.ExtensionUpdate( + version=extension.version, + actions=[ + models.ExtensionChangeTriggersAction( + triggers=[ + models.ExtensionTrigger( + resource_type_id=models.ExtensionResourceTypeId.CART, + actions=[ + models.ExtensionAction.CREATE, + models.ExtensionAction.UPDATE, + ], + ) + ] ) - ] + ], ) - ], + ) ) assert extension.triggers == [ models.ExtensionTrigger( diff --git a/tests/platform/test_service_inventory.py b/tests/platform/test_service_inventory.py index f46c4ff6..ba00db76 100644 --- a/tests/platform/test_service_inventory.py +++ b/tests/platform/test_service_inventory.py @@ -1,40 +1,58 @@ from commercetools.platform import models +from commercetools.platform.client import Client -def test_inventory_create(old_client): - inventory = old_client.inventory.create( - models.InventoryEntryDraft(sku="1", quantity_on_stock=10) +def test_inventory_create(ct_platform_client: Client): + inventory = ( + ct_platform_client.with_project_key("unittest") + .inventory() + .post(models.InventoryEntryDraft(sku="1", quantity_on_stock=10)) ) assert inventory.id assert inventory.quantity_on_stock == 10 -def test_inventory_get_by_id(old_client): - inventory = old_client.inventory.create( - models.InventoryEntryDraft(sku="1", quantity_on_stock=10) +def test_inventory_with_id_get(ct_platform_client: Client): + inventory = ( + ct_platform_client.with_project_key("unittest") + .inventory() + .post(models.InventoryEntryDraft(sku="1", quantity_on_stock=10)) ) assert inventory.id assert inventory.quantity_on_stock == 10 - inventory = old_client.inventory.get_by_id(inventory.id) + inventory = ( + ct_platform_client.with_project_key("unittest") + .inventory() + .with_id(inventory.id) + .get() + ) assert inventory.id assert inventory.quantity_on_stock == 10 -def test_inventory_update_by_id(old_client): - inventory = old_client.inventory.create( - models.InventoryEntryDraft(sku="1", quantity_on_stock=10) +def test_inventory_with_id_post(ct_platform_client: Client): + inventory = ( + ct_platform_client.with_project_key("unittest") + .inventory() + .post(models.InventoryEntryDraft(sku="1", quantity_on_stock=10)) ) assert inventory.id assert inventory.quantity_on_stock == 10 - inventory = old_client.inventory.update_by_id( - inventory.id, - version=inventory.version, - actions=[models.InventoryEntryRemoveQuantityAction(quantity=10)], + inventory = ( + ct_platform_client.with_project_key("unittest") + .inventory() + .with_id(inventory.id) + .post( + models.InventoryEntryUpdate( + version=inventory.version, + actions=[models.InventoryEntryRemoveQuantityAction(quantity=10)], + ) + ) ) assert inventory.id assert inventory.quantity_on_stock == 0 diff --git a/tests/platform/test_service_order.py b/tests/platform/test_service_order.py index aaccb86b..5fb274f9 100644 --- a/tests/platform/test_service_order.py +++ b/tests/platform/test_service_order.py @@ -1,13 +1,22 @@ import datetime from commercetools.platform import models +from commercetools.platform.client import Client -def test_orders_get_by_id(old_client): - cart = old_client.carts.create(models.CartDraft(currency="EUR")) - order = old_client.orders.create( - models.OrderFromCartDraft( - id=cart.id, cart=cart, version=1, order_number="test-order" +def test_orders_with_id_get(ct_platform_client: Client): + cart = ( + ct_platform_client.with_project_key("unittest") + .carts() + .post(models.CartDraft(currency="EUR")) + ) + order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .post( + models.OrderFromCartDraft( + id=cart.id, cart=cart, version=1, order_number="test-order" + ) ) ) @@ -15,22 +24,30 @@ def test_orders_get_by_id(old_client): assert order.order_number == "test-order" -def test_orders_query(old_client): - results = old_client.orders.query() +def test_orders_query(ct_platform_client: Client): + results = ct_platform_client.with_project_key("unittest").orders().get() assert results.total == 0 - cart = old_client.carts.create(models.CartDraft(currency="EUR")) - order = old_client.orders.create( - models.OrderFromCartDraft( - id=cart.id, cart=cart, version=1, order_number="test-order" + cart = ( + ct_platform_client.with_project_key("unittest") + .carts() + .post(models.CartDraft(currency="EUR")) + ) + order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .post( + models.OrderFromCartDraft( + id=cart.id, cart=cart, version=1, order_number="test-order" + ) ) ) - results = old_client.orders.query() + results = ct_platform_client.with_project_key("unittest").orders().get() assert results.total == 1 -def test_orders_query_filter(commercetools_api, old_client): +def test_orders_query_filter(commercetools_api, ct_platform_client: Client): order = get_test_order() commercetools_api.orders.add_existing(order) where = [ @@ -38,78 +55,110 @@ def test_orders_query_filter(commercetools_api, old_client): 'createdAt >= "2019-10-15T14:12:36.464465"', ] - results = old_client.orders.query(where=where) + results = ct_platform_client.with_project_key("unittest").orders().get(where=where) assert results.total == 1 -def test_orders_delete(commercetools_api, old_client): +def test_orders_delete(commercetools_api, ct_platform_client: Client): order = get_test_order() commercetools_api.orders.add_existing(order) - deleted_order = old_client.orders.delete_by_id(order.id, order.version) + deleted_order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .with_id(order.id) + .delete(version=order.version) + ) assert order.id == deleted_order.id -def test_add_existing_order(commercetools_api, old_client): +def test_add_existing_order(commercetools_api, ct_platform_client: Client): order = get_test_order() commercetools_api.orders.add_existing(order) - assert old_client.orders.get_by_id(order.id).order_number == order.order_number + result = ( + ct_platform_client.with_project_key("unittest").orders().with_id(order.id).get() + ) + assert result.order_number == order.order_number -def test_update_order_state_action(commercetools_api, old_client): +def test_update_order_state_action(commercetools_api, ct_platform_client: Client): order = get_test_order() commercetools_api.orders.add_existing(order) - updated_order = old_client.orders.update_by_id( - order.id, - order.version, - actions=[ - models.OrderChangeOrderStateAction(order_state=models.OrderState.CONFIRMED) - ], + updated_order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .with_id(order.id) + .post( + models.OrderUpdate( + version=order.version, + actions=[ + models.OrderChangeOrderStateAction( + order_state=models.OrderState.CONFIRMED + ) + ], + ) + ) ) assert updated_order.order_state == models.OrderState.CONFIRMED -def test_update_payment_state_action(commercetools_api, old_client): +def test_update_payment_state_action(commercetools_api, ct_platform_client: Client): order = get_test_order() order.payment_state = None commercetools_api.orders.add_existing(order) - updated_order = old_client.orders.update_by_id( - order.id, - order.version, - actions=[ - models.OrderChangePaymentStateAction(payment_state=models.PaymentState.PAID) - ], + updated_order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .with_id(order.id) + .post( + models.OrderUpdate( + version=order.version, + actions=[ + models.OrderChangePaymentStateAction( + payment_state=models.PaymentState.PAID + ) + ], + ) + ) ) assert updated_order.payment_state == models.PaymentState.PAID -def test_update_order_add_delivery(commercetools_api, old_client): +def test_update_order_add_delivery(commercetools_api, ct_platform_client: Client): order = get_test_order() commercetools_api.orders.add_existing(order) - updated_order = old_client.orders.update_by_id( - order.id, - order.version, - actions=[ - models.OrderSetBillingAddressAction(address=models.Address(country="NL")), - models.OrderAddDeliveryAction( - parcels=[ - models.ParcelDraft( - tracking_data=models.TrackingData( - tracking_id="123", carrier="Test Carrier" - ) - ) - ] - ), - ], + updated_order = ( + ct_platform_client.with_project_key("unittest") + .orders() + .with_id(order.id) + .post( + models.OrderUpdate( + version=order.version, + actions=[ + models.OrderSetBillingAddressAction( + address=models.Address(country="NL") + ), + models.OrderAddDeliveryAction( + parcels=[ + models.ParcelDraft( + tracking_data=models.TrackingData( + tracking_id="123", carrier="Test Carrier" + ) + ) + ] + ), + ], + ) + ) ) assert ( @@ -187,6 +236,7 @@ def get_test_order(): total_gross=models.CentPrecisionMoney( cent_amount=1000, currency_code="GBP", fraction_digits=2 ), + tax_portions=[], ), shipping_method_state=models.ShippingMethodState.MATCHES_CART, ), @@ -251,6 +301,7 @@ def get_test_order(): total_gross=models.CentPrecisionMoney( cent_amount=1190, currency_code="GBP", fraction_digits=2 ), + tax_portions=[], ), line_item_mode=models.LineItemMode.STANDARD, ) @@ -297,11 +348,15 @@ def get_test_order(): return order -def test_where_query_state(commercetools_api, old_client): +def test_where_query_state(commercetools_api, ct_platform_client: Client): order = get_test_order() commercetools_api.orders.add_existing(order) - result = old_client.orders.query(where='orderState in ("Open")') + result = ( + ct_platform_client.with_project_key("unittest") + .orders() + .get(where='orderState in ("Open")') + ) assert result.results[0].id == order.id diff --git a/tests/platform/test_service_payment.py b/tests/platform/test_service_payment.py index 19eec0eb..2a03fd00 100644 --- a/tests/platform/test_service_payment.py +++ b/tests/platform/test_service_payment.py @@ -1,125 +1,148 @@ from commercetools.platform import models +from commercetools.platform.client import Client -def test_payments_get_by_id(old_client): - custom_type = old_client.types.create( - models.TypeDraft( - name=models.LocalizedString(en="myType"), - key="payment-info", - resource_type_ids=[models.ResourceTypeId.PAYMENT_INTERFACE_INTERACTION], - field_definitions=[ - models.FieldDefinition( - type=models.CustomFieldStringType(), - name="operations", - label=models.LocalizedString(en="Operation"), - required=False, - ) - ], +def test_payments_with_id_get(ct_platform_client: Client): + custom_type = ( + ct_platform_client.with_project_key("unittest") + .types() + .post( + models.TypeDraft( + name=models.LocalizedString(en="myType"), + key="payment-info", + resource_type_ids=[models.ResourceTypeId.PAYMENT_INTERFACE_INTERACTION], + field_definitions=[ + models.FieldDefinition( + type=models.CustomFieldStringType(), + name="operations", + label=models.LocalizedString(en="Operation"), + required=False, + ) + ], + ) ) ) - payment = old_client.payments.create( - models.PaymentDraft( - key="test-payment", - amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), - payment_method_info=models.PaymentMethodInfo( - payment_interface="ADYEN", method="mc" - ), - transactions=[ - models.TransactionDraft( - type=models.TransactionType.CHARGE, - amount=models.Money(cent_amount=2000, currency_code="GBP"), - interaction_id="8525483242578266", - state=models.TransactionState.SUCCESS, - ) - ], - interface_interactions=[ - models.CustomFieldsDraft( - type=models.TypeResourceIdentifier(id=custom_type.id), - fields=models.FieldContainer( - { - "operations": "CANCEL,CAPTURE,REFUND", - "success": True, - "psp_reference": "8525483242578266", - "merchant_reference": "some reference", - "reason": "82132:0005:10/2020", - "amount": 2000, - "payment_method": "mc", - "event_date": "2019-01-24T11:04:17.000000Z", - "currency_code": "GBP", - "event_code": "AUTHORISATION", - "merchant_account_code": "TestMerchant", - } - ), - ) - ], + payment = ( + ct_platform_client.with_project_key("unittest") + .payments() + .post( + models.PaymentDraft( + key="test-payment", + amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), + payment_method_info=models.PaymentMethodInfo( + payment_interface="ADYEN", method="mc" + ), + transactions=[ + models.TransactionDraft( + type=models.TransactionType.CHARGE, + amount=models.Money(cent_amount=2000, currency_code="GBP"), + interaction_id="8525483242578266", + state=models.TransactionState.SUCCESS, + ) + ], + interface_interactions=[ + models.CustomFieldsDraft( + type=models.TypeResourceIdentifier(id=custom_type.id), + fields=models.FieldContainer( + { + "operations": "CANCEL,CAPTURE,REFUND", + "success": True, + "psp_reference": "8525483242578266", + "merchant_reference": "some reference", + "reason": "82132:0005:10/2020", + "amount": 2000, + "payment_method": "mc", + "event_date": "2019-01-24T11:04:17.000000Z", + "currency_code": "GBP", + "event_code": "AUTHORISATION", + "merchant_account_code": "TestMerchant", + } + ), + ) + ], + ) ) ) - + assert payment assert payment.id assert payment.key == "test-payment" -def test_update_actions(old_client): - custom_type = old_client.types.create( - models.TypeDraft( - name=models.LocalizedString(en="myType"), - key="payment-info", - resource_type_ids=[models.ResourceTypeId.PAYMENT_INTERFACE_INTERACTION], - field_definitions=[ - models.FieldDefinition( - type=models.CustomFieldStringType(), - name="operations", - label=models.LocalizedString(en="Operation"), - required=False, - ) - ], +def test_update_actions(ct_platform_client: Client): + custom_type = ( + ct_platform_client.with_project_key("unittest") + .types() + .post( + models.TypeDraft( + name=models.LocalizedString(en="myType"), + key="payment-info", + resource_type_ids=[models.ResourceTypeId.PAYMENT_INTERFACE_INTERACTION], + field_definitions=[ + models.FieldDefinition( + type=models.CustomFieldStringType(), + name="operations", + label=models.LocalizedString(en="Operation"), + required=False, + ) + ], + ) ) ) - payment = old_client.payments.create( - models.PaymentDraft( - key="test-payment", - amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), - payment_method_info=models.PaymentMethodInfo( - payment_interface="ADYEN", method="mc" - ), - transactions=[ - models.TransactionDraft( - type=models.TransactionType.CHARGE, - amount=models.Money(cent_amount=2000, currency_code="GBP"), - state=models.TransactionState.PENDING, - ) - ], + payment = ( + ct_platform_client.with_project_key("unittest") + .payments() + .post( + models.PaymentDraft( + key="test-payment", + amount_planned=models.Money(cent_amount=2000, currency_code="GBP"), + payment_method_info=models.PaymentMethodInfo( + payment_interface="ADYEN", method="mc" + ), + transactions=[ + models.TransactionDraft( + type=models.TransactionType.CHARGE, + amount=models.Money(cent_amount=2000, currency_code="GBP"), + state=models.TransactionState.PENDING, + ) + ], + ) ) ) existing_transaction = payment.transactions[0] - payment = old_client.payments.update_by_id( - payment.id, - payment.version, - actions=[ - models.PaymentAddInterfaceInteractionAction( - type=models.TypeResourceIdentifier(id=custom_type.id), - fields=models.FieldContainer({"pspRef": "1337"}), - ), - models.PaymentChangeTransactionInteractionIdAction( - transaction_id=existing_transaction.id, interaction_id="1337" - ), - models.PaymentAddTransactionAction( - transaction=models.TransactionDraft( - type=models.TransactionType.CHARGE, - amount=models.Money(currency_code="GBP", cent_amount=1000), - interaction_id="123", - state=models.TransactionState.INITIAL, - ) - ), - models.PaymentChangeTransactionStateAction( - transaction_id=existing_transaction.id, - state=models.TransactionState.SUCCESS, - ), - ], + payment = ( + ct_platform_client.with_project_key("unittest") + .payments() + .with_id(payment.id) + .post( + models.PaymentUpdate( + version=payment.version, + actions=[ + models.PaymentAddInterfaceInteractionAction( + type=models.TypeResourceIdentifier(id=custom_type.id), + fields=models.FieldContainer({"pspRef": "1337"}), + ), + models.PaymentChangeTransactionInteractionIdAction( + transaction_id=existing_transaction.id, interaction_id="1337" + ), + models.PaymentAddTransactionAction( + transaction=models.TransactionDraft( + type=models.TransactionType.CHARGE, + amount=models.Money(currency_code="GBP", cent_amount=1000), + interaction_id="123", + state=models.TransactionState.INITIAL, + ) + ), + models.PaymentChangeTransactionStateAction( + transaction_id=existing_transaction.id, + state=models.TransactionState.SUCCESS, + ), + ], + ) + ) ) assert payment.interface_interactions[0].fields == {"pspRef": "1337"} diff --git a/tests/platform/test_service_product_discounts.py b/tests/platform/test_service_product_discounts.py index cf531a36..58f7e0fd 100644 --- a/tests/platform/test_service_product_discounts.py +++ b/tests/platform/test_service_product_discounts.py @@ -1,15 +1,20 @@ from commercetools.platform import models +from commercetools.platform.client import Client -def test_product_discount_get_by_id(old_client): - product_discount = old_client.product_discounts.create( - models.ProductDiscountDraft( - name=models.LocalizedString(nl="test-discount"), - predicate="", - value=models.ProductDiscountValueRelativeDraft(permyriad=10), - is_active=True, - sort_order="", +def test_product_discount_with_id_get(ct_platform_client: Client): + product_discount = ( + ct_platform_client.with_project_key("unittest") + .product_discounts() + .post( + models.ProductDiscountDraft( + name=models.LocalizedString(nl="test-discount"), + predicate="", + value=models.ProductDiscountValueRelativeDraft(permyriad=10), + is_active=True, + sort_order="", + ) ) ) - + assert product_discount assert product_discount.id diff --git a/tests/platform/test_service_product_projections.py b/tests/platform/test_service_product_projections.py index 193343d0..36c43c3c 100644 --- a/tests/platform/test_service_product_projections.py +++ b/tests/platform/test_service_product_projections.py @@ -5,50 +5,77 @@ from commercetools.platform.client import Client -def test_product_projections_get_by_id(old_client): +def test_product_projections_with_id_get(ct_platform_client: Client): variant = models.ProductVariantDraft() - product_create = old_client.products.create( - models.ProductDraft( - key="test-product", - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - name=models.LocalizedString(en=f"my-product"), - slug=models.LocalizedString(en=f"my-product"), - master_variant=variant, - variants=[variant], - publish=False, + product_create = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + name=models.LocalizedString(en=f"my-product"), + slug=models.LocalizedString(en=f"my-product"), + master_variant=variant, + variants=[variant], + publish=False, + ) ) ) - product = old_client.product_projections.get_by_id(product_create.id, staged=True) + product = ( + ct_platform_client.with_project_key("unittest") + .product_projections() + .with_id(product_create.id) + .get(staged=True) + ) + assert product assert product.id == product_create.id assert product.key == product_create.key -def test_product_projections_get_by_id_not_found(old_client): - with pytest.raises(HTTPError): - old_client.products.get_by_id("invalid") +def test_product_projections_get_by_id_not_found(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id("invalid") + .get() + ) + assert product is None -def test_product_projections_get_by_key(old_client): +def test_product_projections_get_by_key(ct_platform_client: Client): variant = models.ProductVariantDraft() - product_create = old_client.products.create( - models.ProductDraft( - key="test-product", - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - name=models.LocalizedString(en=f"my-product"), - slug=models.LocalizedString(en=f"my-product"), - master_variant=variant, - variants=[variant], - publish=False, + product_create = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + name=models.LocalizedString(en=f"my-product"), + slug=models.LocalizedString(en=f"my-product"), + master_variant=variant, + variants=[variant], + publish=False, + ) ) ) - product = old_client.product_projections.get_by_key(product_create.key, staged=True) + product = ( + ct_platform_client.with_project_key("unittest") + .product_projections() + .with_key(product_create.key) + .get(staged=True) + ) + assert product assert product.id == product_create.id assert product.key == product_create.key -def test_product_projections_query_parameters_are_passed(old_client, commercetools_api): - old_client.products.query( +def test_product_projections_query_parameters_are_passed( + ct_platform_client: Client, commercetools_api +): + ct_platform_client.with_project_key("unittest").products().get( expand="productType", price_country="GB", price_currency="GBP" ) @@ -58,13 +85,18 @@ def test_product_projections_query_parameters_are_passed(old_client, commercetoo assert field in last_request.qs -def test_product_projections_get_by_key_not_found(old_client): - with pytest.raises(HTTPError): - old_client.products.get_by_key("invalid") +def test_product_projections_get_by_key_not_found(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id("invalid") + .get() + ) + assert product is None -def test_product_projections_query(ct_platform_client: Client, old_client): - client = ct_platform_client.with_project_key("test") +def test_product_projections_query(ct_platform_client: Client): + client = ct_platform_client.with_project_key("unittest") for key in ["product-1", "product-2"]: variant = models.ProductVariantDraft() @@ -97,6 +129,7 @@ def test_product_projections_query(ct_platform_client: Client, old_client): result = client.product_projections().get( sort="id asc", where=[f'slug(nl-NL="product-3")'], expand=["parent.category"] ) + assert result assert len(result.results) == 2 assert result.total == 2 assert result.results[0].key == "product-1" diff --git a/tests/platform/test_service_product_types.py b/tests/platform/test_service_product_types.py index 575b1e45..4186c56e 100644 --- a/tests/platform/test_service_product_types.py +++ b/tests/platform/test_service_product_types.py @@ -2,109 +2,160 @@ from requests.exceptions import HTTPError from commercetools.platform import models +from commercetools.platform.client import Client -def test_product_types_get_by_id(old_client): - product_type = old_client.product_types.create( - models.ProductTypeDraft( - key="test-product-type", name="test", description="something" +def test_product_types_with_id_get(ct_platform_client: Client): + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .post( + models.ProductTypeDraft( + key="test-product-type", name="test", description="something" + ) ) ) assert product_type.id assert product_type.key == "test-product-type" - product_type = old_client.product_types.get_by_id(product_type.id) + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_id(product_type.id) + .get() + ) assert product_type.id assert product_type.key == "test-product-type" - with pytest.raises(HTTPError) as e: - old_client.product_types.get_by_id("invalid") + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_id("invalid") + .get() + ) + assert product_type is None -def test_product_types_get_by_key(old_client): - product_type = old_client.product_types.create( - models.ProductTypeDraft( - key="test-product-type", name="test", description="something" +def test_product_types_get_by_key(ct_platform_client: Client): + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .post( + models.ProductTypeDraft( + key="test-product-type", name="test", description="something" + ) ) ) assert product_type.id assert product_type.key == "test-product-type" - product_type = old_client.product_types.get_by_key("test-product-type") + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_key("test-product-type") + .get() + ) assert product_type.id assert product_type.key == "test-product-type" - with pytest.raises(HTTPError) as e: - old_client.product_types.get_by_key("invalid") + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_id("invalid") + .get() + ) + assert product_type is None -def test_product_type_query(old_client): - old_client.product_types.create( +def test_product_type_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").product_types().post( models.ProductTypeDraft( key="test-product-type1", name="test-1", description="something" ) ) - old_client.product_types.create( + ct_platform_client.with_project_key("unittest").product_types().post( models.ProductTypeDraft( key="test-product-type2", name="test-2", description="something" ) ) # single sort query - result = old_client.product_types.query(sort="id asc") + result = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .get(sort="id asc") + ) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.product_types.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .get(sort=["id asc", "name asc"]) + ) assert len(result.results) == 2 assert result.total == 2 -def test_product_update(old_client): +def test_product_update(ct_platform_client: Client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ - product_type = old_client.product_types.create( - models.ProductTypeDraft( - key="test-product-type", name="test", description="something" + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .post( + models.ProductTypeDraft( + key="test-product-type", name="test", description="something" + ) ) ) assert product_type.id assert product_type.key == "test-product-type" - product_type = old_client.product_types.update_by_id( - id=product_type.id, version=product_type.version, actions=[] + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_id(product_type.id) + .post(models.ProductTypeUpdate(version=product_type.version, actions=[])) ) assert product_type.key == "test-product-type" - product_type = old_client.product_types.update_by_key( - key="test-product-type", version=product_type.version, actions=[] + product_type = ( + ct_platform_client.with_project_key("test") + .product_types() + .with_key(key="test-product-type") + .post(models.ProductTypeUpdate(version=product_type.version, actions=[])) ) assert product_type.key == "test-product-type" -def test_product_update_attribute_constraint_change(old_client): +def test_product_update_attribute_constraint_change(ct_platform_client: Client): attribute_name = "testConstraint" - product_type = old_client.product_types.create( - models.ProductTypeDraft( - key="test-product-type", - name="test", - description="something", - attributes=[ - models.AttributeDefinitionDraft( - type=models.AttributeTextType(), - name=attribute_name, - label=models.LocalizedString({"en": "testConstraint"}), - is_required=False, - attribute_constraint=models.AttributeConstraintEnum.SAME_FOR_ALL, - ) - ], + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .post( + models.ProductTypeDraft( + key="test-product-type", + name="test", + description="something", + attributes=[ + models.AttributeDefinitionDraft( + type=models.AttributeTextType(), + name=attribute_name, + label=models.LocalizedString({"en": "testConstraint"}), + is_required=False, + attribute_constraint=models.AttributeConstraintEnum.SAME_FOR_ALL, + ) + ], + ) ) ) @@ -115,15 +166,23 @@ def test_product_update_attribute_constraint_change(old_client): == models.AttributeConstraintEnum.SAME_FOR_ALL ) - product_type = old_client.product_types.update_by_id( - id=product_type.id, - version=product_type.version, - actions=[ - models.ProductTypeChangeAttributeConstraintAction( - attribute_name=attribute_name, - new_value=models.AttributeConstraintEnumDraft.NONE, + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_id( + product_type.id, + ) + .post( + models.ProductTypeUpdate( + version=product_type.version, + actions=[ + models.ProductTypeChangeAttributeConstraintAction( + attribute_name=attribute_name, + new_value=models.AttributeConstraintEnumDraft.NONE, + ) + ], ) - ], + ) ) assert product_type.key == "test-product-type" diff --git a/tests/platform/test_service_products.py b/tests/platform/test_service_products.py index 77a44fb7..5cd5a6c7 100644 --- a/tests/platform/test_service_products.py +++ b/tests/platform/test_service_products.py @@ -8,20 +8,24 @@ from commercetools.platform.client import Client -def test_products_create(old_client): - custom_type = old_client.types.create( - models.TypeDraft( - name=models.LocalizedString(en="myType"), - key="my-type", - resource_type_ids=[models.ResourceTypeId.ASSET], - field_definitions=[ - models.FieldDefinition( - name="foo", - type=models.CustomFieldStringType(), - label=models.LocalizedString(en="foo"), - required=False, - ) - ], +def test_products_create(ct_platform_client: Client): + custom_type = ( + ct_platform_client.with_project_key("unittest") + .types() + .post( + models.TypeDraft( + name=models.LocalizedString(en="myType"), + key="my-type", + resource_type_ids=[models.ResourceTypeId.ASSET], + field_definitions=[ + models.FieldDefinition( + name="foo", + type=models.CustomFieldStringType(), + label=models.LocalizedString(en="foo"), + required=False, + ) + ], + ) ) ) assert custom_type.id @@ -53,58 +57,86 @@ def test_products_create(old_client): ], ), ) - product = old_client.products.create(draft) + product = ct_platform_client.with_project_key("unittest").products().post(draft) assert product.id assert product.master_data.current.master_variant.assets assert product.master_data.current.master_variant.prices -def test_products_get_by_id(old_client): - product = old_client.products.create( - models.ProductDraft( - key="test-product", - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - name=models.LocalizedString(en="my-product"), - slug=models.LocalizedString(en="my-product"), - publish=True, +def test_products_with_id_get(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + name=models.LocalizedString(en="my-product"), + slug=models.LocalizedString(en="my-product"), + publish=True, + ) ) ) assert product.id assert product.key == "test-product" - product = old_client.products.get_by_id(product.id) + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .get() + ) assert product.id assert product.key == "test-product" - with pytest.raises(HTTPError) as e: - old_client.products.get_by_id("invalid") - - -def test_products_get_by_key(old_client): - product = old_client.products.create( - models.ProductDraft( - key="test-product", - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - name=models.LocalizedString(en="my-product"), - slug=models.LocalizedString(en="my-product"), - publish=True, + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id("invalid") + .get() + ) + assert product is None + + +def test_products_get_by_key(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + name=models.LocalizedString(en="my-product"), + slug=models.LocalizedString(en="my-product"), + publish=True, + ) ) ) assert product.id assert product.key == "test-product" - product = old_client.products.get_by_key("test-product") + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_key("test-product") + .get() + ) assert product.id assert product.key == "test-product" - with pytest.raises(HTTPError) as e: - old_client.products.get_by_key("invalid") + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_key("invalid") + .get() + ) + assert product is None -def test_product_query(old_client): - old_client.products.create( +def test_product_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").products().post( models.ProductDraft( key=f"product-1", product_type=models.ProductTypeResourceIdentifier(key="dummy"), @@ -113,7 +145,7 @@ def test_product_query(old_client): publish=True, ) ) - old_client.products.create( + ct_platform_client.with_project_key("unittest").products().post( models.ProductDraft( key=f"product-2", product_type=models.ProductTypeResourceIdentifier(key="dummy"), @@ -124,18 +156,26 @@ def test_product_query(old_client): ) # single sort query - result = old_client.products.query(sort="id asc", limit=2) + result = ( + ct_platform_client.with_project_key("unittest") + .products() + .get(sort="id asc", limit=2) + ) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.products.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .products() + .get(sort=["id asc", "name asc"]) + ) assert len(result.results) == 2 assert result.total == 2 def test_product_query_where(ct_platform_client: Client): - product_client = ct_platform_client.with_project_key("test").products() + product_client = ct_platform_client.with_project_key("unittest").products() product_client.post( models.ProductDraft( key="test-product1", @@ -200,91 +240,137 @@ def test_product_query_where(ct_platform_client: Client): assert result.total == 2 -def test_product_update(old_client): +def test_product_update(ct_platform_client: Client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ - product = old_client.products.create( - models.ProductDraft( - key="test-product", - name=models.LocalizedString(en=f"my-product-1"), - slug=models.LocalizedString(en=f"my-product-1"), - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - master_variant=models.ProductVariantDraft(sku="1", key="1"), + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + name=models.LocalizedString(en=f"my-product-1"), + slug=models.LocalizedString(en=f"my-product-1"), + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + master_variant=models.ProductVariantDraft(sku="1", key="1"), + ) ) ) assert uuid.UUID(product.id) assert product.key == "test-product" - product = old_client.products.update_by_id( - id=product.id, - version=product.version, - actions=[ - models.ProductChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) - ], + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug2") + ) + ], + ) + ) ) assert product.key == "test-product" assert product.master_data.published is False - product = old_client.products.update_by_id( - id=product.id, version=product.version, actions=[models.ProductPublishAction()] + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[models.ProductPublishAction()], + ) + ) ) assert product.master_data.published is True assert not product.master_data.current.master_variant.prices - product = old_client.products.update_by_id( - id=product.id, - version=product.version, - actions=[ - models.ProductSetPricesAction( - sku="1", - prices=[ - models.PriceDraft( - value=models.Money(cent_amount=1000, currency_code="GBP") + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductSetPricesAction( + sku="1", + prices=[ + models.PriceDraft( + value=models.Money( + cent_amount=1000, currency_code="GBP" + ) + ) + ], + staged=False, ) ], - staged=False, ) - ], + ) ) assert len(product.master_data.current.master_variant.prices) == 1 - product = old_client.products.update_by_key( - key="test-product", - version=product.version, - actions=[ - models.ProductChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")) - ], + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_key(key="test-product") + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductChangeSlugAction( + slug=models.LocalizedString(nl="nl-slug2") + ) + ], + ) + ) ) assert product.key == "test-product" -def test_product_update_add_change_price_staged(old_client): - product = old_client.products.create( - models.ProductDraft( - key="test-product", - name=models.LocalizedString(en=f"my-product-1"), - slug=models.LocalizedString(en=f"my-product-1"), - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - master_variant=models.ProductVariantDraft(sku="1", key="1"), +def test_product_update_add_change_price_staged(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + name=models.LocalizedString(en=f"my-product-1"), + slug=models.LocalizedString(en=f"my-product-1"), + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + master_variant=models.ProductVariantDraft(sku="1", key="1"), + ) ) ) - product = old_client.products.update_by_id( - id=product.id, - version=product.version, - actions=[ - models.ProductAddPriceAction( - sku="1", - price=models.PriceDraft( - value=models.Money(cent_amount=1000, currency_code="GBP") - ), + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductAddPriceAction( + sku="1", + price=models.PriceDraft( + value=models.Money(cent_amount=1000, currency_code="GBP") + ), + ) + ], ) - ], + ) ) assert product.master_data.current is None @@ -293,17 +379,23 @@ def test_product_update_add_change_price_staged(old_client): assert price.value.cent_amount == 1000 assert price.value.currency_code == "GBP" - product = old_client.products.update_by_id( - id=product.id, - version=product.version, - actions=[ - models.ProductChangePriceAction( - price_id=price.id, - price=models.PriceDraft( - value=models.Money(cent_amount=3000, currency_code="EUR") - ), + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductChangePriceAction( + price_id=price.id, + price=models.PriceDraft( + value=models.Money(cent_amount=3000, currency_code="EUR") + ), + ) + ], ) - ], + ) ) assert product.master_data.current is None @@ -313,41 +405,56 @@ def test_product_update_add_change_price_staged(old_client): assert price.value.currency_code == "EUR" -def test_product_update_add_price_current(old_client): - product = old_client.products.create( - models.ProductDraft( - key="test-product", - name=models.LocalizedString(en=f"my-product-1"), - slug=models.LocalizedString(en=f"my-product-1"), - product_type=models.ProductTypeResourceIdentifier(key="dummy"), - master_variant=models.ProductVariantDraft(sku="1", key="1"), - publish=True, +def test_product_update_add_price_current(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + key="test-product", + name=models.LocalizedString(en=f"my-product-1"), + slug=models.LocalizedString(en=f"my-product-1"), + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + master_variant=models.ProductVariantDraft(sku="1", key="1"), + publish=True, + ) ) ) - product = old_client.products.update_by_id( - id=product.id, - version=product.version, - actions=[ - models.ProductAddPriceAction( - sku="1", - staged=False, - price=models.PriceDraft( - value=models.Money(cent_amount=1000, currency_code="GBP") - ), + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id(product.id) + .post( + models.ProductUpdate( + version=product.version, + actions=[ + models.ProductAddPriceAction( + sku="1", + staged=False, + price=models.PriceDraft( + value=models.Money(cent_amount=1000, currency_code="GBP") + ), + ) + ], ) - ], + ) ) assert product.master_data.staged is None assert len(product.master_data.current.master_variant.prices) == 1 -def test_predicate_var(old_client): +def test_predicate_var(ct_platform_client: Client): with requests_mock.Mocker(real_http=True, case_sensitive=True) as m: - result = old_client.products.query( - where="masterData(staged(masterVariant(prices(country='NL'))))", - predicate_var={"foo": "bar"}, + + result = ( + ct_platform_client.with_project_key("unittest") + .products() + .get( + where="masterData(staged(masterVariant(prices(country='NL'))))", + predicate_var={"foo": "bar"}, + ) ) assert "var.foo" in m.request_history[0].qs diff --git a/tests/platform/test_service_project.py b/tests/platform/test_service_project.py index 24628e79..804bc96f 100644 --- a/tests/platform/test_service_project.py +++ b/tests/platform/test_service_project.py @@ -1,66 +1,81 @@ from commercetools.platform import models +from commercetools.platform.client import Client -def test_project_update_countries(old_client): - project = old_client.project.get() - project = old_client.project.update( - actions=[models.ProjectChangeCountriesAction(countries=["AT", "NL"])], - version=project.version, +def test_project_update_countries(ct_platform_client: Client): + project = ct_platform_client.with_project_key("unittest").get() + assert project + project = ct_platform_client.with_project_key("unittest").post( + models.ProjectUpdate( + actions=[models.ProjectChangeCountriesAction(countries=["AT", "NL"])], + version=project.version, + ) ) assert project.countries == ["AT", "NL"] -def test_project_update_change_messages_enabled(old_client): - project = old_client.project.get() - project = old_client.project.update( - actions=[models.ProjectChangeMessagesEnabledAction(messages_enabled=True)], - version=project.version, +def test_project_update_change_messages_enabled(ct_platform_client: Client): + project = ct_platform_client.with_project_key("unittest").get() + assert project + project = ct_platform_client.with_project_key("unittest").post( + models.ProjectUpdate( + actions=[models.ProjectChangeMessagesEnabledAction(messages_enabled=True)], + version=project.version, + ) ) assert project.messages.enabled is True -def test_project_update_change_country_tax_rate_fallback_enabled(old_client): - project = old_client.project.get() - project = old_client.project.update( - actions=[ - models.ProjectChangeCountryTaxRateFallbackEnabledAction( - country_tax_rate_fallback_enabled=True - ) - ], - version=project.version, +def test_project_update_change_country_tax_rate_fallback_enabled( + ct_platform_client: Client, +): + project = ct_platform_client.with_project_key("unittest").get() + project = ct_platform_client.with_project_key("unittest").post( + models.ProjectUpdate( + actions=[ + models.ProjectChangeCountryTaxRateFallbackEnabledAction( + country_tax_rate_fallback_enabled=True + ) + ], + version=project.version, + ) ) assert project.carts.country_tax_rate_fallback_enabled is True -def test_project_update_set_shipping_rate_input_type(old_client): - project = old_client.project.get() +def test_project_update_set_shipping_rate_input_type(ct_platform_client: Client): + project = ct_platform_client.with_project_key("unittest").get() assert project.shipping_rate_input_type is None - project = old_client.project.update( - actions=[ - models.ProjectSetShippingRateInputTypeAction( - shipping_rate_input_type=models.ShippingRateInputType( - type=models.ShippingRateTierType.CART_VALUE + project = ct_platform_client.with_project_key("unittest").post( + models.ProjectUpdate( + actions=[ + models.ProjectSetShippingRateInputTypeAction( + shipping_rate_input_type=models.ShippingRateInputType( + type=models.ShippingRateTierType.CART_VALUE + ) ) - ) - ], - version=project.version, + ], + version=project.version, + ) ) assert project.shipping_rate_input_type == models.CartValueType() - project = old_client.project.update( - actions=[ - models.ProjectSetShippingRateInputTypeAction( - shipping_rate_input_type=models.CartClassificationType( - values=[ - models.CustomFieldLocalizedEnumValue( - key="test", label=models.LocalizedString({"en": "test"}) - ) - ] + project = ct_platform_client.with_project_key("unittest").post( + models.ProjectUpdate( + actions=[ + models.ProjectSetShippingRateInputTypeAction( + shipping_rate_input_type=models.CartClassificationType( + values=[ + models.CustomFieldLocalizedEnumValue( + key="test", label=models.LocalizedString({"en": "test"}) + ) + ] + ) ) - ) - ], - version=project.version, + ], + version=project.version, + ) ) assert project.shipping_rate_input_type == models.CartClassificationType( values=[ diff --git a/tests/platform/test_service_reviews.py b/tests/platform/test_service_reviews.py index af0f0a48..d7421a3b 100644 --- a/tests/platform/test_service_reviews.py +++ b/tests/platform/test_service_reviews.py @@ -1,50 +1,103 @@ from commercetools.platform import models +from commercetools.platform.client import Client from commercetools.platform.models._schemas.review import ReviewDraftSchema -def test_create_review(old_client): - review = old_client.reviews.create(draft=models.ReviewDraft(rating=3)) +def test_create_review(ct_platform_client: Client): + review = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .post(models.ReviewDraft(rating=3)) + ) assert review.id assert review.rating == 3 -def test_get_by_id(old_client): - review = old_client.reviews.create(draft=models.ReviewDraft()) +def test_with_id_get(ct_platform_client: Client): + review = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .post(models.ReviewDraft()) + ) assert review.id - review = old_client.reviews.get_by_id(review.id) + review = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .with_id(review.id) + .get() + ) assert review -def test_get_by_key(old_client): - review = old_client.reviews.create(draft=models.ReviewDraft(key="test-review")) +def test_get_by_key(ct_platform_client: Client): + review = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .post(models.ReviewDraft(key="test-review")) + ) assert review.key - review = old_client.reviews.get_by_key(review.key) + review = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .with_key(review.key) + .get() + ) assert review -def test_query(old_client): - old_client.reviews.create(draft=models.ReviewDraft(key="test-review-1")) - old_client.reviews.create(draft=models.ReviewDraft(key="test-review-2")) +def test_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").reviews().post( + models.ReviewDraft(key="test-review-1") + ) + ct_platform_client.with_project_key("unittest").reviews().post( + models.ReviewDraft(key="test-review-2") + ) - result = old_client.reviews.query(sort="id asc", limit=10) + result = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .get(sort="id asc", limit=10) + ) assert len(result.results) == 2 assert result.total == 2 - result = old_client.reviews.query(sort=["id asc", "name asc"], limit=1) + result = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .get(sort=["id asc", "name asc"], limit=1) + ) assert len(result.results) == 1 assert result.total == 2 -def test_delete_by_id(old_client): - review = old_client.reviews.create(draft=models.ReviewDraft()) +def test_delete_by_id(ct_platform_client: Client): + review = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .post(models.ReviewDraft()) + ) assert review.id - assert old_client.reviews.delete_by_id(review.id, version=review.version) - - -def test_delete_by_key(old_client): - review = old_client.reviews.create(draft=models.ReviewDraft(key="test-review")) + assert ( + ct_platform_client.with_project_key("unittest") + .reviews() + .with_id(review.id) + .delete(version=review.version) + ) + + +def test_delete_by_key(ct_platform_client: Client): + review = ( + ct_platform_client.with_project_key("unittest") + .reviews() + .post(models.ReviewDraft(key="test-review")) + ) assert review.key - assert old_client.reviews.delete_by_key(review.key, version=review.version) + assert ( + ct_platform_client.with_project_key("unittest") + .reviews() + .with_key(review.key) + .delete(version=review.version) + ) diff --git a/tests/platform/test_service_shipping_methods.py b/tests/platform/test_service_shipping_methods.py index 6f27f884..df4149e0 100644 --- a/tests/platform/test_service_shipping_methods.py +++ b/tests/platform/test_service_shipping_methods.py @@ -2,33 +2,49 @@ from requests.exceptions import HTTPError from commercetools.platform import models - - -def test_shipping_method_get_by_id(old_client): - shipping_method = old_client.shipping_methods.create( - models.ShippingMethodDraft( - key="test-shipping-method", - name="test shipping method", - tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), - zone_rates=[], - is_default=False, +from commercetools.platform.client import Client + + +def test_shipping_method_with_id_get(ct_platform_client: Client): + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .post( + models.ShippingMethodDraft( + key="test-shipping-method", + name="test shipping method", + tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), + zone_rates=[], + is_default=False, + ) ) ) - + assert shipping_method assert shipping_method.id assert shipping_method.key == "test-shipping-method" assert shipping_method.name == "test shipping method" - shipping_method = old_client.shipping_methods.get_by_id(shipping_method.id) + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .with_id(shipping_method.id) + .get() + ) + assert shipping_method assert shipping_method.id assert shipping_method.key == "test-shipping-method" - with pytest.raises(HTTPError): - old_client.shipping_methods.get_by_id("invalid") + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .with_id("invalid") + .get() + ) + assert shipping_method is None -def test_shipping_method_query(old_client): - old_client.shipping_methods.create( +def test_shipping_method_query(ct_platform_client: Client): + ct_platform_client.with_project_key("unittest").shipping_methods().post( models.ShippingMethodDraft( key="test-shipping_method1", name="test shipping method1", @@ -37,7 +53,7 @@ def test_shipping_method_query(old_client): is_default=False, ) ) - old_client.shipping_methods.create( + ct_platform_client.with_project_key("unittest").shipping_methods().post( models.ShippingMethodDraft( key="test-shipping_method2", name="test shipping method2", @@ -48,64 +64,96 @@ def test_shipping_method_query(old_client): ) # single sort query - result = old_client.shipping_methods.query(sort="id asc") + result = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .get(sort="id asc") + ) assert len(result.results) == 2 assert result.total == 2 # multiple sort queries - result = old_client.shipping_methods.query(sort=["id asc", "name asc"]) + result = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .get(sort=["id asc", "name asc"]) + ) assert len(result.results) == 2 assert result.total == 2 -def test_shipping_method_update(old_client): +def test_shipping_method_update(ct_platform_client: Client): """Test the return value of the update methods. It doesn't test the actual update itself. TODO: See if this is worth testing since we're using a mocking backend """ - shipping_method = old_client.shipping_methods.create( - models.ShippingMethodDraft( - key="test-shipping-method", - name="test shipping method", - tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), - zone_rates=[], - is_default=False, + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .post( + models.ShippingMethodDraft( + key="test-shipping-method", + name="test shipping method", + tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), + zone_rates=[], + is_default=False, + ) ) ) assert shipping_method.key == "test-shipping-method" - shipping_method = old_client.shipping_methods.update_by_id( - id=shipping_method.id, - version=shipping_method.version, - actions=[models.ShippingMethodChangeNameAction(name="shipping-method-2")], + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .with_id(shipping_method.id) + .post( + models.ShippingMethodUpdate( + version=shipping_method.version, + actions=[ + models.ShippingMethodChangeNameAction(name="shipping-method-2") + ], + ) + ) ) assert shipping_method.key == "test-shipping-method" -def test_shipping_method_update(old_client): - shipping_method = old_client.shipping_methods.create( - models.ShippingMethodDraft( - key="test-shipping-method", - name="test shipping method", - tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), - zone_rates=[], - is_default=False, +def test_shipping_method_update_two(ct_platform_client: Client): + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .post( + models.ShippingMethodDraft( + key="test-shipping-method", + name="test shipping method", + tax_category=models.TaxCategoryResourceIdentifier(id="dummy"), + zone_rates=[], + is_default=False, + ) ) ) assert shipping_method.id assert shipping_method.localized_description is None - shipping_method = old_client.shipping_methods.update_by_id( - id=shipping_method.id, - version=shipping_method.version, - actions=[ - models.ShippingMethodSetLocalizedDescriptionAction( - localized_description=models.LocalizedString({"en": "a new lstring"}) + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .with_id(shipping_method.id) + .post( + models.ShippingMethodUpdate( + version=shipping_method.version, + actions=[ + models.ShippingMethodSetLocalizedDescriptionAction( + localized_description=models.LocalizedString( + {"en": "a new lstring"} + ) + ) + ], ) - ], + ) ) assert shipping_method.localized_description == models.LocalizedString( diff --git a/tests/platform/test_service_shopping_lists.py b/tests/platform/test_service_shopping_lists.py index f32440b7..be7bc25e 100644 --- a/tests/platform/test_service_shopping_lists.py +++ b/tests/platform/test_service_shopping_lists.py @@ -1,111 +1,168 @@ from commercetools.platform import models - - -def test_get_by_id(old_client): - product = old_client.products.create( - models.ProductDraft( - master_variant=models.ProductVariantDraft(sku="123"), - publish=True, - name=models.LocalizedString(nl="Test product"), - slug=models.LocalizedString(en=f"my-product"), - product_type=models.ProductTypeResourceIdentifier(key="dummy"), +from commercetools.platform.client import Client + + +def test_get_with_id(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + master_variant=models.ProductVariantDraft(sku="123"), + publish=True, + name=models.LocalizedString(nl="Test product"), + slug=models.LocalizedString(en=f"my-product"), + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + ) ) ) - shopping_list = old_client.shopping_lists.create( - draft=models.ShoppingListDraft( - name=models.LocalizedString({"nl": "Verlanglijstje"}), - description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), - line_items=[ - models.ShoppingListLineItemDraft(product_id=product.id, quantity=1) - ], + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .post( + models.ShoppingListDraft( + name=models.LocalizedString({"nl": "Verlanglijstje"}), + description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), + line_items=[ + models.ShoppingListLineItemDraft(product_id=product.id, quantity=1) + ], + ) ) ) + assert shopping_list assert shopping_list.id - shopping_list = old_client.shopping_lists.get_by_id(shopping_list.id) + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .with_id(shopping_list.id) + .get() + ) + assert shopping_list assert shopping_list.name["nl"] == "Verlanglijstje" assert shopping_list.description["nl"] == "Verlanglijstje van LabD" assert shopping_list.line_items[0].product_id == product.id assert shopping_list.line_items[0].quantity == 1 -def test_get_by_key(old_client): - product = old_client.products.create( - models.ProductDraft( - master_variant=models.ProductVariantDraft(sku="123"), - publish=True, - name=models.LocalizedString(nl="Test product"), - slug=models.LocalizedString(en="my-product"), - product_type=models.ProductTypeResourceIdentifier(key="dummy"), +def test_get_by_key(ct_platform_client: Client): + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .post( + models.ProductDraft( + master_variant=models.ProductVariantDraft(sku="123"), + publish=True, + name=models.LocalizedString(nl="Test product"), + slug=models.LocalizedString(en="my-product"), + product_type=models.ProductTypeResourceIdentifier(key="dummy"), + ) ) ) variant = product.master_data.current.master_variant - shopping_list = old_client.shopping_lists.create( - draft=models.ShoppingListDraft( - key="test-shopping-list", - name=models.LocalizedString({"nl": "Verlanglijstje"}), - description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), - line_items=[models.ShoppingListLineItemDraft(sku=variant.sku, quantity=1)], + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .post( + models.ShoppingListDraft( + key="test-shopping-list", + name=models.LocalizedString({"nl": "Verlanglijstje"}), + description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), + line_items=[ + models.ShoppingListLineItemDraft(sku=variant.sku, quantity=1) + ], + ) ) ) assert shopping_list.key - shopping_list = old_client.shopping_lists.get_by_key("test-shopping-list") + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .with_key("test-shopping-list") + .get() + ) assert shopping_list.name["nl"] == "Verlanglijstje" assert shopping_list.description["nl"] == "Verlanglijstje van LabD" assert shopping_list.line_items[0].variant.sku == "123" assert shopping_list.line_items[0].quantity == 1 -def test_query(old_client): +def test_query(ct_platform_client: Client): shopping_list_draft = models.ShoppingListDraft( key="test-shopping-list", name=models.LocalizedString({"nl": "Verlanglijstje"}), description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), ) - old_client.shopping_lists.create(draft=shopping_list_draft) + ct_platform_client.with_project_key("unittest").shopping_lists().post( + shopping_list_draft + ) # Update the key and create another one. shopping_list_draft.key = "test-shopping-list2" - old_client.shopping_lists.create(draft=shopping_list_draft) + ct_platform_client.with_project_key("unittest").shopping_lists().post( + shopping_list_draft + ) - result = old_client.shopping_lists.query(sort="id asc", limit=10) + result = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .get(sort="id asc", limit=10) + ) assert len(result.results) == 2 assert result.total == 2 - result = old_client.shopping_lists.query(sort=["id asc", "name asc"], limit=1) + result = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .get(sort=["id asc", "name asc"], limit=1) + ) assert len(result.results) == 1 assert result.total == 2 -def test_delete_by_id(old_client): - shopping_list = old_client.shopping_lists.create( - draft=models.ShoppingListDraft( - key="test-shopping-list", - name=models.LocalizedString({"nl": "Verlanglijstje"}), - description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), +def test_delete_by_id(ct_platform_client: Client): + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .post( + models.ShoppingListDraft( + key="test-shopping-list", + name=models.LocalizedString({"nl": "Verlanglijstje"}), + description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), + ) ) ) assert shopping_list.id - shopping_list = old_client.shopping_lists.delete_by_id( - shopping_list.id, version=shopping_list.version + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .with_id(shopping_list.id) + .delete(version=shopping_list.version) ) -def test_delete_by_key(old_client): - shopping_list = old_client.shopping_lists.create( - draft=models.ShoppingListDraft( - key="test-shopping-list", - name=models.LocalizedString({"nl": "Verlanglijstje"}), - description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), +def test_delete_by_key(ct_platform_client: Client): + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .post( + models.ShoppingListDraft( + key="test-shopping-list", + name=models.LocalizedString({"nl": "Verlanglijstje"}), + description=models.LocalizedString({"nl": "Verlanglijstje van LabD"}), + ) ) ) assert shopping_list.id - shopping_list = old_client.shopping_lists.delete_by_key( - shopping_list.key, version=shopping_list.version + shopping_list = ( + ct_platform_client.with_project_key("unittest") + .shopping_lists() + .with_key(shopping_list.key) + .delete(version=shopping_list.version) ) diff --git a/tests/platform/test_service_states.py b/tests/platform/test_service_states.py index ef26a996..10031442 100644 --- a/tests/platform/test_service_states.py +++ b/tests/platform/test_service_states.py @@ -1,10 +1,12 @@ import pytest from commercetools.platform import models +from commercetools.platform.client import Client -def test_state_flow(old_client, state_draft): - state = old_client.states.create(state_draft) +def test_state_flow(ct_platform_client: Client, state_draft): + state = ct_platform_client.with_project_key("unittest").states().post(state_draft) + assert state assert state.id new_name = models.LocalizedString({"en": "new_name"}) @@ -17,18 +19,36 @@ def test_state_flow(old_client, state_draft): roles=[models.StateRoleEnum.REVIEW_INCLUDED_IN_STATISTICS] ), ] - state = old_client.states.update_by_id(state.id, state.version, update_actions) + state = ( + ct_platform_client.with_project_key("unittest") + .states() + .with_id(state.id) + .post(models.StateUpdate(version=state.version, actions=update_actions)) + ) + assert state assert state.name == new_name assert state.description == new_description assert state.initial is True - assert len(state.roles) == 1 - - state = old_client.states.update_by_id( - state.id, state.version, [models.StateSetRolesAction(roles=[])] + assert state.roles and len(state.roles) == 1 + + state = ( + ct_platform_client.with_project_key("unittest") + .states() + .with_id(state.id) + .post( + models.StateUpdate( + version=state.version, actions=[models.StateSetRolesAction(roles=[])] + ) + ) ) assert len(state.roles) == 0 - deleted_state = old_client.states.delete_by_id(state.id, state.version) + deleted_state = ( + ct_platform_client.with_project_key("unittest") + .states() + .with_id(state.id) + .delete(version=state.version) + ) assert state.id == deleted_state.id diff --git a/tests/platform/test_service_stores.py b/tests/platform/test_service_stores.py index 5e1c21bf..6c095742 100644 --- a/tests/platform/test_service_stores.py +++ b/tests/platform/test_service_stores.py @@ -2,10 +2,10 @@ from commercetools import CommercetoolsError from commercetools.platform import models -from commercetools.platform.client import Client as PlatformClient +from commercetools.platform.client import Client -def test_store_flow(ct_platform_client: PlatformClient, store_draft): +def test_store_flow(ct_platform_client: Client, store_draft): store = ct_platform_client.with_project_key("foo").stores().post(store_draft) assert store is not None @@ -28,9 +28,7 @@ def store_draft(): ) -def test_update_actions( - commercetools_api, ct_platform_client: PlatformClient, store_draft -): +def test_update_actions(commercetools_api, ct_platform_client: Client, store_draft): store = ct_platform_client.with_project_key("foo").stores().post(store_draft) assert store is not None assert store.languages == [] @@ -53,9 +51,7 @@ def test_update_actions( assert store.languages == ["en-US"] -def test_channels_are_set( - commercetools_api, ct_platform_client: PlatformClient, store_draft -): +def test_channels_are_set(commercetools_api, ct_platform_client: Client, store_draft): store = ct_platform_client.with_project_key("foo").stores().post(store_draft) assert store.distribution_channels == [] @@ -93,9 +89,7 @@ def test_channels_are_set( assert store.distribution_channels[0].id == channel.id -def test_channel_errors( - commercetools_api, ct_platform_client: PlatformClient, store_draft -): +def test_channel_errors(commercetools_api, ct_platform_client: Client, store_draft): store = ct_platform_client.with_project_key("foo").stores().post(store_draft) ct_platform_client.with_project_key("foo").channels().post( @@ -123,7 +117,7 @@ def test_channel_errors( def test_store_channel_create( - commercetools_api, ct_platform_client: PlatformClient, store_draft + commercetools_api, ct_platform_client: Client, store_draft ): channel = ( ct_platform_client.with_project_key("foo") diff --git a/tests/platform/test_service_tax_category.py b/tests/platform/test_service_tax_category.py index ff27e09f..e9a98ff3 100644 --- a/tests/platform/test_service_tax_category.py +++ b/tests/platform/test_service_tax_category.py @@ -1,40 +1,65 @@ from commercetools.platform import models +from commercetools.platform.client import Client -def test_tax_category_create(old_client): - tax_category = old_client.tax_categories.create( - models.TaxCategoryDraft(name="Hoog", rates=[]) +def test_tax_category_create(ct_platform_client: Client): + tax_category = ( + ct_platform_client.with_project_key("unittest") + .tax_categories() + .post(models.TaxCategoryDraft(name="Hoog", rates=[])) ) - + assert tax_category assert tax_category.id assert tax_category.name == "Hoog" -def test_tax_category_get_by_id(old_client): - tax_category = old_client.tax_categories.create( - models.TaxCategoryDraft(name="Hoog", rates=[]) +def test_tax_category_get_with_id(ct_platform_client: Client): + tax_category = ( + ct_platform_client.with_project_key("unittest") + .tax_categories() + .post(models.TaxCategoryDraft(name="Hoog", rates=[])) ) + assert tax_category assert tax_category.id assert tax_category.name == "Hoog" - tax_category = old_client.tax_categories.get_by_id(tax_category.id) + tax_category = ( + ct_platform_client.with_project_key("unittest") + .tax_categories() + .with_id(tax_category.id) + .get() + ) + assert tax_category assert tax_category.id assert tax_category.name == "Hoog" -def test_tax_category_update_by_id(old_client): - tax_category = old_client.tax_categories.create( - models.TaxCategoryDraft(name="Hoog", rates=[]) +def test_tax_category_create_with_id(ct_platform_client: Client): + tax_category = ( + ct_platform_client.with_project_key("unittest") + .tax_categories() + .post(models.TaxCategoryDraft(name="Hoog", rates=[])) ) assert tax_category.id assert tax_category.name == "Hoog" - tax_category = old_client.tax_categories.update_by_id( - tax_category.id, - version=tax_category.version, - actions=[models.TaxCategorySetDescriptionAction(description="Some text")], + tax_category = ( + ct_platform_client.with_project_key("unittest") + .tax_categories() + .with_id( + tax_category.id, + ) + .post( + models.TaxCategoryUpdate( + version=tax_category.version, + actions=[ + models.TaxCategorySetDescriptionAction(description="Some text") + ], + ) + ) ) + assert tax_category assert tax_category.id assert tax_category.name == "Hoog" diff --git a/tests/platform/test_testing_headers.py b/tests/platform/test_testing_headers.py index 71d0c4b7..2017fc8d 100644 --- a/tests/platform/test_testing_headers.py +++ b/tests/platform/test_testing_headers.py @@ -2,10 +2,10 @@ from commercetools import CommercetoolsError from commercetools.platform import models -from commercetools.platform.client import Client as PlatformClient +from commercetools.platform.client import Client -def test_correlation_id_is_set_in_exception(ct_platform_client: PlatformClient): +def test_correlation_id_is_set_in_exception(ct_platform_client: Client): product = ( ct_platform_client.with_project_key("foo") .products() diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 8758c99e..a566b1fe 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -22,7 +22,7 @@ def create_products(client: ByProjectKeyRequestBuilder): def test_page_paginator(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") create_products(client) paginator = paginators.Paginator(client.products().get, sort=["id asc", "name asc"]) @@ -34,7 +34,7 @@ def test_page_paginator(ct_platform_client: Client): def test_page_paginator_slice_start(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") create_products(client) paginator = paginators.Paginator(client.products().get, sort=["id asc", "name asc"]) @@ -48,7 +48,7 @@ def test_page_paginator_slice_start(ct_platform_client: Client): def test_page_paginator_slice_stop(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") create_products(client) paginator = paginators.Paginator(client.products().get, sort=["id asc", "name asc"]) @@ -62,7 +62,7 @@ def test_page_paginator_slice_stop(ct_platform_client: Client): def test_page_paginator_slice_start_stop(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") create_products(client) paginator = paginators.Paginator(client.products().get, sort=["id asc", "name asc"]) @@ -76,7 +76,7 @@ def test_page_paginator_slice_start_stop(ct_platform_client: Client): def test_cursor_paginator(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") create_products(client) paginator = paginators.CursorPaginator( @@ -90,7 +90,7 @@ def test_cursor_paginator(ct_platform_client: Client): def test_cursor_paginator_slice_start(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") create_products(client) paginator = paginators.CursorPaginator( @@ -104,7 +104,7 @@ def test_cursor_paginator_slice_start(ct_platform_client: Client): def test_cursor_paginator_slice_stop(ct_platform_client: Client): - client = ct_platform_client.with_project_key("test") + client = ct_platform_client.with_project_key("unittest") create_products(client) paginator = paginators.CursorPaginator( diff --git a/tox.ini b/tox.ini index 65240019..3854a971 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ commands = [testenv:format] basepython = python3.10 deps = - black==22.6.0 + black==24.3.0 isort[toml]==5.10.1 skip_install = true commands =