├── .bumpversion.cfg ├── .editorconfig ├── .github └── workflows │ ├── python-release.yml │ └── python-test.yml ├── .gitignore ├── .readthedocs.yml ├── CHANGES.md ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.rst ├── docs ├── Makefile ├── api │ ├── commercetools.client.rst │ ├── commercetools.schemas.rst │ ├── commercetools.types.rst │ └── commercetools.utils.rst ├── changes.md ├── conf.py ├── index.rst └── make.bat ├── mypy.ini ├── pycharm_debug.py ├── pyproject.toml ├── requirements_dev.txt ├── setup.cfg ├── setup.py ├── src └── commercetools │ ├── __init__.py │ ├── base_client.py │ ├── checkout │ └── models │ │ ├── common.py │ │ ├── error.py │ │ ├── payments.py │ │ └── responses.py │ ├── constants.py │ ├── contrib │ ├── __init__.py │ └── pytest.py │ ├── exceptions.py │ ├── frontend │ ├── .py │ ├── __init__.py │ ├── client │ │ ├── __init__.py │ │ ├── action │ │ │ ├── __init__.py │ │ │ ├── frontastic_action_by_namespace_by_action_request_builder.py │ │ │ └── frontastic_action_request_builder.py │ │ ├── api │ │ │ ├── __init__.py │ │ │ └── api_request_builder.py │ │ ├── build │ │ │ ├── __init__.py │ │ │ └── api_build_request_builder.py │ │ ├── context │ │ │ ├── __init__.py │ │ │ └── frontastic_context_request_builder.py │ │ ├── data_source │ │ │ ├── __init__.py │ │ │ ├── frontastic_data_source_by_identifier_request_builder.py │ │ │ └── frontastic_data_source_request_builder.py │ │ ├── frontastic │ │ │ ├── __init__.py │ │ │ └── frontastic_request_builder.py │ │ ├── page │ │ │ ├── __init__.py │ │ │ └── frontastic_page_request_builder.py │ │ ├── preview │ │ │ ├── __init__.py │ │ │ └── frontastic_preview_request_builder.py │ │ └── upload │ │ │ ├── __init__.py │ │ │ └── api_build_upload_request_builder.py │ └── models │ │ ├── __init__.py │ │ ├── _abstract.py │ │ ├── _schemas │ │ └── common.py │ │ └── common.py │ ├── helpers.py │ ├── importapi │ ├── __init__.py │ ├── client │ │ ├── __init__.py │ │ ├── by_project_key_request_builder.py │ │ ├── categories │ │ │ ├── __init__.py │ │ │ └── by_project_key_categories_request_builder.py │ │ ├── customers │ │ │ ├── __init__.py │ │ │ └── by_project_key_customers_request_builder.py │ │ ├── discount_codes │ │ │ ├── __init__.py │ │ │ └── by_project_key_discount_codes_request_builder.py │ │ ├── import_containers │ │ │ ├── __init__.py │ │ │ ├── by_project_key_categories_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_categories_import_containers_request_builder.py │ │ │ ├── by_project_key_customers_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_customers_import_containers_request_builder.py │ │ │ ├── by_project_key_discount_codes_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_discount_codes_import_containers_request_builder.py │ │ │ ├── by_project_key_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_import_containers_request_builder.py │ │ │ ├── by_project_key_inventories_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_inventories_import_containers_request_builder.py │ │ │ ├── by_project_key_order_patches_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_order_patches_import_containers_request_builder.py │ │ │ ├── by_project_key_orders_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_orders_import_containers_request_builder.py │ │ │ ├── by_project_key_prices_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_prices_import_containers_request_builder.py │ │ │ ├── by_project_key_product_drafts_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_product_drafts_import_containers_request_builder.py │ │ │ ├── by_project_key_product_types_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_product_types_import_containers_request_builder.py │ │ │ ├── by_project_key_product_variant_patches_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_product_variant_patches_import_containers_request_builder.py │ │ │ ├── by_project_key_product_variants_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_product_variants_import_containers_request_builder.py │ │ │ ├── by_project_key_products_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_products_import_containers_request_builder.py │ │ │ ├── by_project_key_standalone_prices_import_containers_by_import_container_key_request_builder.py │ │ │ ├── by_project_key_standalone_prices_import_containers_request_builder.py │ │ │ ├── by_project_key_types_import_containers_by_import_container_key_request_builder.py │ │ │ └── by_project_key_types_import_containers_request_builder.py │ │ ├── import_operations │ │ │ ├── __init__.py │ │ │ ├── by_project_key_import_containers_by_import_container_key_import_operations_request_builder.py │ │ │ ├── by_project_key_import_operations_by_id_request_builder.py │ │ │ └── by_project_key_import_operations_request_builder.py │ │ ├── import_summaries │ │ │ ├── __init__.py │ │ │ └── by_project_key_import_containers_by_import_container_key_import_summaries_request_builder.py │ │ ├── inventories │ │ │ ├── __init__.py │ │ │ └── by_project_key_inventories_request_builder.py │ │ ├── order_patches │ │ │ ├── __init__.py │ │ │ └── by_project_key_order_patches_request_builder.py │ │ ├── orders │ │ │ ├── __init__.py │ │ │ └── by_project_key_orders_request_builder.py │ │ ├── prices │ │ │ ├── __init__.py │ │ │ └── by_project_key_prices_request_builder.py │ │ ├── product_drafts │ │ │ ├── __init__.py │ │ │ └── by_project_key_product_drafts_request_builder.py │ │ ├── product_types │ │ │ ├── __init__.py │ │ │ └── by_project_key_product_types_request_builder.py │ │ ├── product_variant_patches │ │ │ ├── __init__.py │ │ │ └── by_project_key_product_variant_patches_request_builder.py │ │ ├── product_variants │ │ │ ├── __init__.py │ │ │ └── by_project_key_product_variants_request_builder.py │ │ ├── products │ │ │ ├── __init__.py │ │ │ └── by_project_key_products_request_builder.py │ │ ├── standalone_prices │ │ │ ├── __init__.py │ │ │ └── by_project_key_standalone_prices_request_builder.py │ │ └── types │ │ │ ├── __init__.py │ │ │ └── by_project_key_types_request_builder.py │ └── models │ │ ├── __init__.py │ │ ├── _abstract.py │ │ ├── _schemas │ │ ├── categories.py │ │ ├── common.py │ │ ├── customers.py │ │ ├── customfields.py │ │ ├── discount_codes.py │ │ ├── errors.py │ │ ├── importcontainers.py │ │ ├── importoperations.py │ │ ├── importrequests.py │ │ ├── importsummaries.py │ │ ├── inventories.py │ │ ├── order_patches.py │ │ ├── orders.py │ │ ├── prices.py │ │ ├── productdrafts.py │ │ ├── products.py │ │ ├── producttypes.py │ │ ├── productvariants.py │ │ ├── standalone_prices.py │ │ └── types.py │ │ ├── categories.py │ │ ├── common.py │ │ ├── customers.py │ │ ├── customfields.py │ │ ├── discount_codes.py │ │ ├── errors.py │ │ ├── importcontainers.py │ │ ├── importoperations.py │ │ ├── importrequests.py │ │ ├── importsummaries.py │ │ ├── inventories.py │ │ ├── order_patches.py │ │ ├── orders.py │ │ ├── prices.py │ │ ├── productdrafts.py │ │ ├── products.py │ │ ├── producttypes.py │ │ ├── productvariants.py │ │ ├── standalone_prices.py │ │ └── types.py │ ├── paginators.py │ ├── platform │ ├── .py │ ├── __init__.py │ ├── client │ │ ├── __init__.py │ │ ├── active_cart │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_active_cart_request_builder.py │ │ │ └── by_project_key_me_active_cart_request_builder.py │ │ ├── api_clients │ │ │ ├── __init__.py │ │ │ ├── by_project_key_api_clients_by_id_request_builder.py │ │ │ └── by_project_key_api_clients_request_builder.py │ │ ├── apply │ │ │ ├── __init__.py │ │ │ └── by_project_key_orders_edits_by_id_apply_request_builder.py │ │ ├── approval_flows │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_by_id_request_builder.py │ │ │ └── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_flows_request_builder.py │ │ ├── approval_rules │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_by_id_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_key_by_key_request_builder.py │ │ │ └── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_approval_rules_request_builder.py │ │ ├── as_associate │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_request_builder.py │ │ │ └── by_project_key_as_associate_request_builder.py │ │ ├── associate_roles │ │ │ ├── __init__.py │ │ │ ├── by_project_key_associate_roles_by_id_request_builder.py │ │ │ ├── by_project_key_associate_roles_key_by_key_request_builder.py │ │ │ └── by_project_key_associate_roles_request_builder.py │ │ ├── attribute_groups │ │ │ ├── __init__.py │ │ │ ├── by_project_key_attribute_groups_by_id_request_builder.py │ │ │ ├── by_project_key_attribute_groups_key_by_key_request_builder.py │ │ │ └── by_project_key_attribute_groups_request_builder.py │ │ ├── business_units │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_business_units_by_id_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_business_units_key_by_key_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_business_units_request_builder.py │ │ │ ├── by_project_key_business_units_by_id_request_builder.py │ │ │ ├── by_project_key_business_units_key_by_key_request_builder.py │ │ │ ├── by_project_key_business_units_request_builder.py │ │ │ ├── by_project_key_me_business_units_by_id_request_builder.py │ │ │ ├── by_project_key_me_business_units_key_by_key_request_builder.py │ │ │ └── by_project_key_me_business_units_request_builder.py │ │ ├── by_project_key_request_builder.py │ │ ├── cart_discounts │ │ │ ├── __init__.py │ │ │ ├── by_project_key_cart_discounts_by_id_request_builder.py │ │ │ ├── by_project_key_cart_discounts_key_by_key_request_builder.py │ │ │ ├── by_project_key_cart_discounts_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_cart_discounts_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_cart_discounts_key_by_key_request_builder.py │ │ │ └── by_project_key_in_store_key_by_store_key_cart_discounts_request_builder.py │ │ ├── carts │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_by_id_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_key_by_key_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_request_builder.py │ │ │ ├── by_project_key_carts_by_id_request_builder.py │ │ │ ├── by_project_key_carts_customer_id_by_customer_id_request_builder.py │ │ │ ├── by_project_key_carts_key_by_key_request_builder.py │ │ │ ├── by_project_key_carts_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_carts_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_carts_customer_id_by_customer_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_carts_key_by_key_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_carts_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_carts_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_carts_request_builder.py │ │ │ ├── by_project_key_me_carts_by_id_request_builder.py │ │ │ ├── by_project_key_me_carts_key_by_key_request_builder.py │ │ │ └── by_project_key_me_carts_request_builder.py │ │ ├── categories │ │ │ ├── __init__.py │ │ │ ├── by_project_key_categories_by_id_request_builder.py │ │ │ ├── by_project_key_categories_key_by_key_request_builder.py │ │ │ └── by_project_key_categories_request_builder.py │ │ ├── channels │ │ │ ├── __init__.py │ │ │ ├── by_project_key_channels_by_id_request_builder.py │ │ │ └── by_project_key_channels_request_builder.py │ │ ├── confirm │ │ │ ├── __init__.py │ │ │ ├── by_project_key_customers_email_confirm_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_customers_email_confirm_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_email_confirm_request_builder.py │ │ │ └── by_project_key_me_email_confirm_request_builder.py │ │ ├── custom_objects │ │ │ ├── __init__.py │ │ │ ├── by_project_key_custom_objects_by_container_by_key_request_builder.py │ │ │ ├── by_project_key_custom_objects_by_container_request_builder.py │ │ │ └── by_project_key_custom_objects_request_builder.py │ │ ├── customer_groups │ │ │ ├── __init__.py │ │ │ ├── by_project_key_customer_groups_by_id_request_builder.py │ │ │ ├── by_project_key_customer_groups_key_by_key_request_builder.py │ │ │ └── by_project_key_customer_groups_request_builder.py │ │ ├── customers │ │ │ ├── __init__.py │ │ │ ├── by_project_key_customers_by_id_request_builder.py │ │ │ ├── by_project_key_customers_email_token_by_email_token_request_builder.py │ │ │ ├── by_project_key_customers_key_by_key_request_builder.py │ │ │ ├── by_project_key_customers_password_token_by_password_token_request_builder.py │ │ │ ├── by_project_key_customers_request_builder.py │ │ │ ├── by_project_key_in_business_unit_key_by_business_unit_key_me_customers_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_customers_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_customers_email_token_by_email_token_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_customers_key_by_key_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_customers_password_token_by_password_token_request_builder.py │ │ │ └── by_project_key_in_store_key_by_store_key_customers_request_builder.py │ │ ├── discount_codes │ │ │ ├── __init__.py │ │ │ ├── by_project_key_discount_codes_by_id_request_builder.py │ │ │ ├── by_project_key_discount_codes_key_by_key_request_builder.py │ │ │ └── by_project_key_discount_codes_request_builder.py │ │ ├── edits │ │ │ ├── __init__.py │ │ │ ├── by_project_key_orders_edits_by_id_request_builder.py │ │ │ ├── by_project_key_orders_edits_key_by_key_request_builder.py │ │ │ └── by_project_key_orders_edits_request_builder.py │ │ ├── email_token │ │ │ ├── __init__.py │ │ │ ├── by_project_key_customers_email_token_request_builder.py │ │ │ └── by_project_key_in_store_key_by_store_key_customers_email_token_request_builder.py │ │ ├── extensions │ │ │ ├── __init__.py │ │ │ ├── by_project_key_extensions_by_id_request_builder.py │ │ │ ├── by_project_key_extensions_key_by_key_request_builder.py │ │ │ └── by_project_key_extensions_request_builder.py │ │ ├── graphql │ │ │ ├── __init__.py │ │ │ └── by_project_key_graphql_request_builder.py │ │ ├── health │ │ │ ├── __init__.py │ │ │ └── by_project_key_subscriptions_by_id_health_request_builder.py │ │ ├── images │ │ │ ├── __init__.py │ │ │ └── by_project_key_products_by_id_images_request_builder.py │ │ ├── import_ │ │ │ ├── __init__.py │ │ │ └── by_project_key_orders_import_request_builder.py │ │ ├── in_business_unit │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_request_builder.py │ │ │ └── by_project_key_in_business_unit_key_by_business_unit_key_request_builder.py │ │ ├── in_store │ │ │ ├── __init__.py │ │ │ └── by_project_key_in_store_key_by_store_key_request_builder.py │ │ ├── inventory │ │ │ ├── __init__.py │ │ │ ├── by_project_key_inventory_by_id_request_builder.py │ │ │ ├── by_project_key_inventory_key_by_key_request_builder.py │ │ │ └── by_project_key_inventory_request_builder.py │ │ ├── login │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_login_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_login_request_builder.py │ │ │ ├── by_project_key_login_request_builder.py │ │ │ └── by_project_key_me_login_request_builder.py │ │ ├── matching │ │ │ ├── __init__.py │ │ │ └── by_project_key_product_discounts_matching_request_builder.py │ │ ├── matching_cart │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_shipping_methods_matching_cart_request_builder.py │ │ │ └── by_project_key_shipping_methods_matching_cart_request_builder.py │ │ ├── matching_cart_location │ │ │ ├── __init__.py │ │ │ └── by_project_key_shipping_methods_matching_cart_location_request_builder.py │ │ ├── matching_location │ │ │ ├── __init__.py │ │ │ └── by_project_key_shipping_methods_matching_location_request_builder.py │ │ ├── matching_orderedit │ │ │ ├── __init__.py │ │ │ └── by_project_key_shipping_methods_matching_orderedit_request_builder.py │ │ ├── me │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_business_unit_key_by_business_unit_key_me_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_request_builder.py │ │ │ └── by_project_key_me_request_builder.py │ │ ├── messages │ │ │ ├── __init__.py │ │ │ ├── by_project_key_messages_by_id_request_builder.py │ │ │ └── by_project_key_messages_request_builder.py │ │ ├── orders │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_by_id_request_builder.py │ │ │ ├── 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 │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_orders_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_orders_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_orders_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_orders_order_number_by_order_number_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_orders_request_builder.py │ │ │ ├── by_project_key_me_orders_by_id_request_builder.py │ │ │ ├── by_project_key_me_orders_request_builder.py │ │ │ ├── by_project_key_orders_by_id_request_builder.py │ │ │ ├── by_project_key_orders_order_number_by_order_number_request_builder.py │ │ │ └── by_project_key_orders_request_builder.py │ │ ├── password │ │ │ ├── __init__.py │ │ │ ├── by_project_key_customers_password_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_customers_password_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_password_request_builder.py │ │ │ └── by_project_key_me_password_request_builder.py │ │ ├── password_token │ │ │ ├── __init__.py │ │ │ ├── by_project_key_customers_password_token_request_builder.py │ │ │ └── by_project_key_in_store_key_by_store_key_customers_password_token_request_builder.py │ │ ├── payments │ │ │ ├── __init__.py │ │ │ ├── by_project_key_me_payments_by_id_request_builder.py │ │ │ ├── by_project_key_me_payments_request_builder.py │ │ │ ├── by_project_key_payments_by_id_request_builder.py │ │ │ ├── by_project_key_payments_key_by_key_request_builder.py │ │ │ └── by_project_key_payments_request_builder.py │ │ ├── product_discounts │ │ │ ├── __init__.py │ │ │ ├── by_project_key_product_discounts_by_id_request_builder.py │ │ │ ├── by_project_key_product_discounts_key_by_key_request_builder.py │ │ │ └── by_project_key_product_discounts_request_builder.py │ │ ├── product_projections │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_product_projections_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_product_projections_key_by_key_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_product_projections_request_builder.py │ │ │ ├── by_project_key_product_projections_by_id_request_builder.py │ │ │ ├── by_project_key_product_projections_key_by_key_request_builder.py │ │ │ └── by_project_key_product_projections_request_builder.py │ │ ├── product_selection_assignments │ │ │ ├── __init__.py │ │ │ └── by_project_key_in_store_key_by_store_key_product_selection_assignments_request_builder.py │ │ ├── product_selections │ │ │ ├── __init__.py │ │ │ ├── by_project_key_product_selections_by_id_request_builder.py │ │ │ ├── by_project_key_product_selections_key_by_key_request_builder.py │ │ │ ├── by_project_key_product_selections_request_builder.py │ │ │ ├── by_project_key_products_by_id_product_selections_request_builder.py │ │ │ └── by_project_key_products_key_by_key_product_selections_request_builder.py │ │ ├── product_tailoring │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_product_tailoring_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_request_builder.py │ │ │ ├── by_project_key_product_tailoring_by_id_request_builder.py │ │ │ ├── by_project_key_product_tailoring_key_by_key_request_builder.py │ │ │ └── by_project_key_product_tailoring_request_builder.py │ │ ├── product_types │ │ │ ├── __init__.py │ │ │ ├── by_project_key_product_types_by_id_request_builder.py │ │ │ ├── by_project_key_product_types_key_by_key_request_builder.py │ │ │ └── by_project_key_product_types_request_builder.py │ │ ├── products │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_products_request_builder.py │ │ │ ├── by_project_key_product_selections_by_id_products_request_builder.py │ │ │ ├── by_project_key_product_selections_key_by_key_products_request_builder.py │ │ │ ├── by_project_key_products_by_id_request_builder.py │ │ │ ├── by_project_key_products_key_by_key_request_builder.py │ │ │ └── by_project_key_products_request_builder.py │ │ ├── quote_requests │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_by_id_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_key_by_key_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quote_requests_request_builder.py │ │ │ ├── by_project_key_me_quote_requests_by_id_request_builder.py │ │ │ ├── by_project_key_me_quote_requests_key_by_key_request_builder.py │ │ │ ├── by_project_key_me_quote_requests_request_builder.py │ │ │ ├── by_project_key_quote_requests_by_id_request_builder.py │ │ │ ├── by_project_key_quote_requests_key_by_key_request_builder.py │ │ │ └── by_project_key_quote_requests_request_builder.py │ │ ├── quotes │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_orders_quotes_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_by_id_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_key_by_key_request_builder.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_quotes_request_builder.py │ │ │ ├── by_project_key_me_orders_quotes_request_builder.py │ │ │ ├── by_project_key_me_quotes_by_id_request_builder.py │ │ │ ├── by_project_key_me_quotes_key_by_key_request_builder.py │ │ │ ├── by_project_key_me_quotes_request_builder.py │ │ │ ├── by_project_key_orders_quotes_request_builder.py │ │ │ ├── by_project_key_quotes_by_id_request_builder.py │ │ │ ├── by_project_key_quotes_key_by_key_request_builder.py │ │ │ └── by_project_key_quotes_request_builder.py │ │ ├── replicate │ │ │ ├── __init__.py │ │ │ ├── by_project_key_as_associate_by_associate_id_in_business_unit_key_by_business_unit_key_carts_replicate_request_builder.py │ │ │ ├── by_project_key_carts_replicate_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_carts_replicate_request_builder.py │ │ │ └── by_project_key_me_carts_replicate_request_builder.py │ │ ├── reset │ │ │ ├── __init__.py │ │ │ ├── by_project_key_customers_password_reset_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_customers_password_reset_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_password_reset_request_builder.py │ │ │ └── by_project_key_me_password_reset_request_builder.py │ │ ├── reviews │ │ │ ├── __init__.py │ │ │ ├── by_project_key_reviews_by_id_request_builder.py │ │ │ ├── by_project_key_reviews_key_by_key_request_builder.py │ │ │ └── by_project_key_reviews_request_builder.py │ │ ├── search │ │ │ ├── __init__.py │ │ │ ├── by_project_key_orders_search_request_builder.py │ │ │ ├── by_project_key_product_projections_search_request_builder.py │ │ │ └── by_project_key_products_search_request_builder.py │ │ ├── shipping_methods │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_shipping_methods_request_builder.py │ │ │ ├── by_project_key_shipping_methods_by_id_request_builder.py │ │ │ ├── by_project_key_shipping_methods_key_by_key_request_builder.py │ │ │ └── by_project_key_shipping_methods_request_builder.py │ │ ├── shopping_lists │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_shopping_lists_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_shopping_lists_key_by_key_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_shopping_lists_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_shopping_lists_by_id_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_shopping_lists_key_by_key_request_builder.py │ │ │ ├── by_project_key_in_store_key_by_store_key_shopping_lists_request_builder.py │ │ │ ├── by_project_key_me_shopping_lists_by_id_request_builder.py │ │ │ ├── by_project_key_me_shopping_lists_key_by_key_request_builder.py │ │ │ ├── by_project_key_me_shopping_lists_request_builder.py │ │ │ ├── by_project_key_shopping_lists_by_id_request_builder.py │ │ │ ├── by_project_key_shopping_lists_key_by_key_request_builder.py │ │ │ └── by_project_key_shopping_lists_request_builder.py │ │ ├── signup │ │ │ ├── __init__.py │ │ │ ├── by_project_key_in_store_key_by_store_key_me_signup_request_builder.py │ │ │ └── by_project_key_me_signup_request_builder.py │ │ ├── staged_quotes │ │ │ ├── __init__.py │ │ │ ├── by_project_key_staged_quotes_by_id_request_builder.py │ │ │ ├── by_project_key_staged_quotes_key_by_key_request_builder.py │ │ │ └── by_project_key_staged_quotes_request_builder.py │ │ ├── standalone_prices │ │ │ ├── __init__.py │ │ │ ├── by_project_key_standalone_prices_by_id_request_builder.py │ │ │ ├── by_project_key_standalone_prices_key_by_key_request_builder.py │ │ │ └── by_project_key_standalone_prices_request_builder.py │ │ ├── states │ │ │ ├── __init__.py │ │ │ ├── by_project_key_states_by_id_request_builder.py │ │ │ ├── by_project_key_states_key_by_key_request_builder.py │ │ │ └── by_project_key_states_request_builder.py │ │ ├── stores │ │ │ ├── __init__.py │ │ │ ├── by_project_key_stores_by_id_request_builder.py │ │ │ ├── by_project_key_stores_key_by_key_request_builder.py │ │ │ └── by_project_key_stores_request_builder.py │ │ ├── subscriptions │ │ │ ├── __init__.py │ │ │ ├── by_project_key_subscriptions_by_id_request_builder.py │ │ │ ├── by_project_key_subscriptions_key_by_key_request_builder.py │ │ │ └── by_project_key_subscriptions_request_builder.py │ │ ├── suggest │ │ │ ├── __init__.py │ │ │ └── by_project_key_product_projections_suggest_request_builder.py │ │ ├── tax_categories │ │ │ ├── __init__.py │ │ │ ├── by_project_key_tax_categories_by_id_request_builder.py │ │ │ ├── by_project_key_tax_categories_key_by_key_request_builder.py │ │ │ └── by_project_key_tax_categories_request_builder.py │ │ ├── types │ │ │ ├── __init__.py │ │ │ ├── by_project_key_types_by_id_request_builder.py │ │ │ ├── by_project_key_types_key_by_key_request_builder.py │ │ │ └── by_project_key_types_request_builder.py │ │ └── zones │ │ │ ├── __init__.py │ │ │ ├── by_project_key_zones_by_id_request_builder.py │ │ │ ├── by_project_key_zones_key_by_key_request_builder.py │ │ │ └── by_project_key_zones_request_builder.py │ └── models │ │ ├── __init__.py │ │ ├── _abstract.py │ │ ├── _schemas │ │ ├── api_client.py │ │ ├── approval_flow.py │ │ ├── approval_rule.py │ │ ├── associate_role.py │ │ ├── attribute_group.py │ │ ├── business_unit.py │ │ ├── cart.py │ │ ├── cart_discount.py │ │ ├── category.py │ │ ├── channel.py │ │ ├── common.py │ │ ├── custom_object.py │ │ ├── customer.py │ │ ├── customer_group.py │ │ ├── discount_code.py │ │ ├── error.py │ │ ├── extension.py │ │ ├── graph_ql.py │ │ ├── inventory.py │ │ ├── me.py │ │ ├── message.py │ │ ├── order.py │ │ ├── order_edit.py │ │ ├── payment.py │ │ ├── product.py │ │ ├── product_discount.py │ │ ├── product_search.py │ │ ├── product_selection.py │ │ ├── product_tailoring.py │ │ ├── product_type.py │ │ ├── project.py │ │ ├── quote.py │ │ ├── quote_request.py │ │ ├── review.py │ │ ├── search.py │ │ ├── shipping_method.py │ │ ├── shopping_list.py │ │ ├── staged_quote.py │ │ ├── standalone_price.py │ │ ├── state.py │ │ ├── store.py │ │ ├── store_country.py │ │ ├── subscription.py │ │ ├── tax_category.py │ │ ├── type.py │ │ └── zone.py │ │ ├── api_client.py │ │ ├── approval_flow.py │ │ ├── approval_rule.py │ │ ├── associate_role.py │ │ ├── attribute_group.py │ │ ├── business_unit.py │ │ ├── cart.py │ │ ├── cart_discount.py │ │ ├── category.py │ │ ├── channel.py │ │ ├── common.py │ │ ├── custom_object.py │ │ ├── customer.py │ │ ├── customer_group.py │ │ ├── discount_code.py │ │ ├── error.py │ │ ├── extension.py │ │ ├── graph_ql.py │ │ ├── inventory.py │ │ ├── me.py │ │ ├── message.py │ │ ├── order.py │ │ ├── order_edit.py │ │ ├── payment.py │ │ ├── product.py │ │ ├── product_discount.py │ │ ├── product_search.py │ │ ├── product_selection.py │ │ ├── product_tailoring.py │ │ ├── product_type.py │ │ ├── project.py │ │ ├── quote.py │ │ ├── quote_request.py │ │ ├── review.py │ │ ├── search.py │ │ ├── shipping_method.py │ │ ├── shopping_list.py │ │ ├── staged_quote.py │ │ ├── standalone_price.py │ │ ├── state.py │ │ ├── store.py │ │ ├── store_country.py │ │ ├── subscription.py │ │ ├── tax_category.py │ │ ├── type.py │ │ └── zone.py │ ├── predicates.py │ ├── protocols.py │ ├── py.typed │ ├── testing │ ├── __init__.py │ ├── abstract.py │ ├── api_clients.py │ ├── auth.py │ ├── cart_discounts.py │ ├── carts.py │ ├── categories.py │ ├── channels.py │ ├── custom_objects.py │ ├── customer_groups.py │ ├── customers.py │ ├── discount_codes.py │ ├── extensions.py │ ├── internal.py │ ├── inventory.py │ ├── orders.py │ ├── payments.py │ ├── predicates.py │ ├── product_discounts.py │ ├── product_projections.py │ ├── product_types.py │ ├── products.py │ ├── project.py │ ├── reviews.py │ ├── server.py │ ├── shipping_methods.py │ ├── shopping_lists.py │ ├── states.py │ ├── stores.py │ ├── subscriptions.py │ ├── tax_categories.py │ ├── traits.py │ ├── types.py │ ├── utils.py │ └── zones.py │ ├── typing.py │ ├── utils.py │ └── version.py ├── tests ├── __init__.py ├── conftest.py ├── importapi │ └── test_models.py ├── platform │ ├── conftest.py │ ├── models │ │ ├── __init__.py │ │ ├── test_extension.py │ │ ├── test_message.py │ │ ├── test_order.py │ │ └── test_project.py │ ├── test_client.py │ ├── test_custom_fields.py │ ├── test_errors.py │ ├── test_expand.py │ ├── test_helpers.py │ ├── test_mock_server.py │ ├── test_models_messages.py │ ├── test_predicate.py │ ├── test_service_api_clients.py │ ├── test_service_cart.py │ ├── test_service_cart_discounts.py │ ├── test_service_categories.py │ ├── test_service_channels.py │ ├── test_service_custom_objects.py │ ├── test_service_customer_groups.py │ ├── test_service_customers.py │ ├── test_service_discount_codes.py │ ├── test_service_extensions.py │ ├── test_service_inventory.py │ ├── test_service_order.py │ ├── test_service_payment.py │ ├── test_service_product_discounts.py │ ├── test_service_product_projections.py │ ├── test_service_product_types.py │ ├── test_service_products.py │ ├── test_service_project.py │ ├── test_service_reviews.py │ ├── test_service_shipping_methods.py │ ├── test_service_shopping_lists.py │ ├── test_service_states.py │ ├── test_service_stores.py │ ├── test_service_tax_category.py │ ├── test_testing_headers.py │ ├── test_testing_predicates.py │ ├── test_types.py │ └── test_utils.py └── test_pagination.py └── tox.ini /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 14.0.0 3 | commit = True 4 | tag = True 5 | tag_name = {new_version} 6 | parse = ^ 7 | (?P\d+)\.(?P\d+)\.(?P\d+) # minimum major.minor.patch, 1.2.3 8 | (?: 9 | (?Pb|rc) # pre-release segment 10 | (?P\d+) # pre-release version num 11 | )? 12 | serialize = 13 | {major}.{minor}.{patch}{prerel}{prerelversion} 14 | {major}.{minor}.{patch} 15 | 16 | [bumpversion:part:prerel] 17 | values = 18 | b 19 | rc 20 | 21 | [bumpversion:file:setup.py] 22 | [bumpversion:file:commercetools/version.py] 23 | 24 | [bumpversion:file:docs/conf.py] 25 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.yml] 4 | indent_size = 2 5 | shift_width = 2 6 | 7 | [Makefile] 8 | indent_style = tab 9 | indent_size = 4 10 | -------------------------------------------------------------------------------- /.github/workflows/python-release.yml: -------------------------------------------------------------------------------- 1 | name: Release to PyPi 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | jobs: 8 | release: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Set up Python 3.12 13 | uses: actions/setup-python@v5 14 | with: 15 | python-version: "3.12" 16 | 17 | - name: Install build requirements 18 | run: python -m pip install wheel 19 | 20 | - name: Build package 21 | run: python setup.py sdist bdist_wheel 22 | 23 | - name: Publish package 24 | uses: pypa/gh-action-pypi-publish@v1.8.14 25 | with: 26 | user: __token__ 27 | password: ${{ secrets.pypi_password }} 28 | -------------------------------------------------------------------------------- /.github/workflows/python-test.yml: -------------------------------------------------------------------------------- 1 | name: Python Tests 2 | 3 | on: 4 | # This should run the workflow for all non-forked pushes 5 | push: 6 | pull_request: 7 | branches: 8 | # This should run the workflow for forked PRs 9 | - '**:**' 10 | 11 | 12 | jobs: 13 | 14 | format: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Set up Python 3.12 20 | uses: actions/setup-python@v5 21 | with: 22 | python-version: "3.12" 23 | 24 | - name: Install dependencies 25 | run: pip install tox 26 | 27 | - name: Validate formatting 28 | run: tox -e format 29 | 30 | test: 31 | runs-on: ubuntu-latest 32 | strategy: 33 | max-parallel: 4 34 | matrix: 35 | python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] 36 | steps: 37 | - uses: actions/checkout@v4 38 | 39 | - name: Set up Python ${{ matrix.python-version }} 40 | uses: actions/setup-python@v5 41 | with: 42 | python-version: ${{ matrix.python-version }} 43 | 44 | - name: Install dependencies 45 | run: | 46 | python -m pip install --upgrade pip 47 | pip install tox tox-gh-actions 48 | 49 | - name: Test with tox 50 | run: tox 51 | 52 | - name: Prepare artifacts 53 | run: mkdir .coverage-data && mv .coverage.* .coverage-data/ 54 | 55 | - uses: actions/upload-artifact@v4 56 | with: 57 | name: coverage-data-${{ matrix.python-version }} 58 | path: .coverage-data/ 59 | 60 | coverage: 61 | runs-on: ubuntu-latest 62 | needs: [test] 63 | steps: 64 | - uses: actions/checkout@v4 65 | - uses: actions/download-artifact@v4 66 | with: 67 | path: . 68 | pattern: coverage-data-* 69 | merge-multiple: true 70 | 71 | - name: Set up Python 3.12 72 | uses: actions/setup-python@v5 73 | with: 74 | python-version: "3.12" 75 | 76 | - name: Install dependencies 77 | run: | 78 | python -m pip install --upgrade pip 79 | pip install tox 80 | 81 | - name: Prepare Coverage report 82 | run: tox -e coverage-report 83 | 84 | - name: Upload to codecov 85 | uses: codecov/codecov-action@v4 86 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .venv/ 2 | *.pyc 3 | __pycache__/ 4 | .cache/ 5 | *.egg-info 6 | .mypy_cache/ 7 | .coverage 8 | .python-version 9 | pip-wheel-metadata/ 10 | .idea/ 11 | .vscode/ 12 | .tox/ 13 | .coverage.* 14 | 15 | # Env 16 | env/ 17 | 18 | # Dist files 19 | /build/ 20 | /dist/ 21 | /docs/_build/ 22 | 23 | 24 | # Local test files 25 | /api.py 26 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | build: 2 | image: latest 3 | 4 | python: 5 | version: 3.6 6 | 7 | requirements_file: requirements_dev.txt 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Lab Digital 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | # Exclude everything by default 2 | exclude * 3 | recursive-exclude * * 4 | 5 | include MANIFEST.in 6 | include LICENSE 7 | include README.rst 8 | include setup.cfg 9 | include setup.py 10 | 11 | graft src 12 | graft tests 13 | 14 | global-exclude __pycache__ 15 | global-exclude *.py[co] 16 | global-exclude .DS_Store 17 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docs 2 | 3 | 4 | install: 5 | pip install -e .[test] 6 | 7 | generate: 8 | java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/api/api.raml -o src/commercetools/platform/ -t PYTHON_CLIENT 9 | java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/importapi/api.raml -o src/commercetools/importapi/ -t PYTHON_CLIENT 10 | java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/frontend-api/api.raml -o src/commercetools/frontend/ -t PYTHON_CLIENT 11 | java -jar ../rmf-codegen/rmf-codegen.jar generate ../commercetools-api-reference/api-specs/checkout/api.raml -o src/commercetools/checkout/ -t PYTHON_CLIENT 12 | find src/ -name "gen.properties" -delete 13 | isort src/commercetools/ 14 | black src/commercetools/ 15 | 16 | test: 17 | pytest tests/ 18 | 19 | mypy: 20 | mypy --config-file=mypy.ini src/commercetools 21 | 22 | coverage: 23 | pytest --cov=commercetools 24 | 25 | runserver: 26 | python -mcommercetools.testing.server 27 | 28 | format: 29 | isort src tests 30 | black src/ tests/ 31 | 32 | release: 33 | pip install twine wheel 34 | rm -rf build/* dist/* 35 | python setup.py sdist bdist_wheel 36 | twine upload dist/* 37 | 38 | docs: 39 | make -C docs html 40 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/api/commercetools.schemas.rst: -------------------------------------------------------------------------------- 1 | Serialization/Deserialization 2 | ============================= 3 | 4 | .. note:: 5 | 6 | This `Marshmallow`_ schemas are automatically generated based on the 7 | `Commercetools RAML API documents`_. 8 | 9 | .. _Marshmallow: http://github.com/marshmallow-code/ 10 | .. _Commercetools RAML API documents: https://github.com/commercetools/commercetools-api-reference 11 | 12 | .. automodule:: commercetools.schemas 13 | :members: 14 | :exclude-members: 15 | -------------------------------------------------------------------------------- /docs/api/commercetools.types.rst: -------------------------------------------------------------------------------- 1 | Data objects 2 | ============ 3 | 4 | .. note:: 5 | 6 | The data objects are automatically generated using the ols RAML 7 | `Commercetools RAML API documents`_. 8 | 9 | .. _Commercetools RAML API documents: https://github.com/commercetools/commercetools-api-reference 10 | 11 | .. automodule:: commercetools.types 12 | :members: 13 | :undoc-members: 14 | :inherited-members: 15 | :show-inheritance: 16 | -------------------------------------------------------------------------------- /docs/api/commercetools.utils.rst: -------------------------------------------------------------------------------- 1 | Utils 2 | ===== 3 | 4 | .. automodule:: commercetools.utils 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/changes.md: -------------------------------------------------------------------------------- 1 | .. include:: ../CHANGES.md 2 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Commercetools Python SDK 2 | ======================== 3 | 4 | This is an unofficial Python SDK for the Commercetools platform. It only 5 | supports Python 3.6+ and uses type annotation for an improved development 6 | experience. 7 | 8 | The API is mostly generated using the commercetools api RAML file and uses the 9 | attr library for the dataobjects and marshmallow for the serialization and 10 | deserialization steps. 11 | 12 | Installation 13 | ------------ 14 | 15 | pip install commercetools 16 | 17 | Example 18 | ------- 19 | 20 | .. code-block:: python 21 | 22 | from commercetools import Client 23 | 24 | client = Client( 25 | project_key="", 26 | client_id="", 27 | client_secret="", 28 | scope=[""], 29 | url="https://api.europe-west1.gcp.commercetools.com", 30 | token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", 31 | ) 32 | 33 | product = client.products.get_by_id("00633d11-c5bb-434e-b132-73f7e130b4e3") 34 | print(product) 35 | 36 | The client can also be configured by setting the following environment 37 | variables: 38 | 39 | 40 | .. code-block:: sh 41 | 42 | export CTP_PROJECT_KEY="" 43 | export CTP_CLIENT_SECRET="" 44 | export CTP_CLIENT_ID="" 45 | export CTP_AUTH_URL="https://auth.europe-west1.gcp.commercetools.com" 46 | export CTP_API_URL="https://api.europe-west1.gcp.commercetools.com" 47 | export CTP_SCOPES="" 48 | 49 | And then constructing a client without arguments: 50 | 51 | .. code-block:: python 52 | 53 | from commercetools import Client 54 | 55 | client = Client() 56 | 57 | product = client.products.get_by_id("00633d11-c5bb-434e-b132-73f7e130b4e3") 58 | print(product) 59 | 60 | .. toctree:: 61 | :maxdepth: 2 62 | :caption: Usage Documentation 63 | 64 | 65 | .. toctree:: 66 | :maxdepth: 2 67 | :caption: API Documentation 68 | 69 | api/commercetools.client 70 | api/commercetools.types 71 | api/commercetools.schemas 72 | api/commercetools.utils 73 | 74 | .. toctree:: 75 | :maxdepth: 2 76 | :caption: Changes 77 | 78 | changes 79 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | ignore_missing_imports = True 3 | python_version = 3.6 4 | warn_unused_configs = True 5 | mypy_path = src 6 | check_untyped_defs = True 7 | -------------------------------------------------------------------------------- /pycharm_debug.py: -------------------------------------------------------------------------------- 1 | """Use this to debug the mock server in Pycharm""" 2 | import sys 3 | import os 4 | import runpy 5 | 6 | path = os.path.dirname(sys.modules[__name__].__file__) 7 | path = os.path.join(path, "..") 8 | sys.path.insert(0, path) 9 | runpy.run_module("commercetools.testing.server", run_name="__main__", alter_sys=True) 10 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | 2 | [build-system] 3 | requires = ["setuptools>=40.6.0", "wheel"] 4 | build-backend = "setuptools.build_meta" 5 | 6 | [tool.coverage.paths] 7 | source = ["src", ".tox/*/site-packages"] 8 | 9 | [tool.isort] 10 | line_length = 88 11 | multi_line_output = 3 12 | include_trailing_comma = true 13 | balanced_wrapping = true 14 | default_section = "THIRDPARTY" 15 | known_first_party = ["commercetools", "tests"] 16 | use_parentheses = true 17 | -------------------------------------------------------------------------------- /requirements_dev.txt: -------------------------------------------------------------------------------- 1 | -e .[docs,test] 2 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 99 3 | max-complexity = 10 4 | per-file-ignores = 5 | src/commercetools/schemas/*.py:E501,F401 6 | src/commercetools/types/*.py:E501,F401 7 | 8 | 9 | [tool:pytest] 10 | minversion = 6.0 11 | testpaths = tests 12 | -------------------------------------------------------------------------------- /src/commercetools/__init__.py: -------------------------------------------------------------------------------- 1 | from .exceptions import CommercetoolsError 2 | from .version import __version__ 3 | 4 | __all__ = ["CommercetoolsError"] 5 | -------------------------------------------------------------------------------- /src/commercetools/constants.py: -------------------------------------------------------------------------------- 1 | HEADER_CORRELATION_ID = "X-Correlation-ID" 2 | -------------------------------------------------------------------------------- /src/commercetools/contrib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labd/commercetools-python-sdk/929268c7649b1d6d3eca62778f30829387ee192f/src/commercetools/contrib/__init__.py -------------------------------------------------------------------------------- /src/commercetools/contrib/pytest.py: -------------------------------------------------------------------------------- 1 | import threading 2 | import time 3 | import typing 4 | 5 | import pytest 6 | import requests 7 | 8 | from commercetools.platform.client import Client as PlatformClient 9 | from commercetools.testing import backend_mocker 10 | from commercetools.testing.server import Server 11 | 12 | 13 | @pytest.fixture(autouse=True) 14 | def reset_token_cache(): 15 | from commercetools.utils import DefaultTokenSaver 16 | 17 | DefaultTokenSaver.clear_cache() 18 | 19 | 20 | @pytest.fixture() 21 | def commercetools_api(): 22 | with backend_mocker() as m: 23 | yield m 24 | 25 | 26 | @pytest.fixture 27 | def ct_platform_client( 28 | commercetools_api, 29 | ) -> typing.Generator[PlatformClient, None, None]: 30 | yield PlatformClient( 31 | client_id="client-id", 32 | client_secret="client-secret", 33 | scope=["manage_project:test"], 34 | url="https://api.europe-west1.gcp.commercetools.com", 35 | token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token", 36 | ) 37 | 38 | 39 | @pytest.fixture() 40 | def commercetools_http_server(commercetools_api): 41 | is_running = threading.Event() 42 | server = Server(commercetools_api) 43 | 44 | def serve(): 45 | from werkzeug.serving import run_simple 46 | 47 | is_running.set() 48 | server.api_url = "http://localhost:8989" 49 | run_simple("localhost", port=8989, application=server) 50 | 51 | thread = threading.Thread(target=serve, daemon=True) 52 | thread.start() 53 | 54 | if is_running.wait(): 55 | for i in range(0, 5): 56 | response = requests.get(server.api_url + "/-/health") 57 | if response.status_code == 200: 58 | break 59 | time.sleep(0.5) 60 | 61 | yield server 62 | 63 | thread.join(timeout=0) 64 | -------------------------------------------------------------------------------- /src/commercetools/exceptions.py: -------------------------------------------------------------------------------- 1 | import typing 2 | 3 | from commercetools.protocols import Model 4 | 5 | 6 | class CommercetoolsError(Exception): 7 | response: Model 8 | correlation_id: typing.Optional[str] 9 | 10 | def __init__( 11 | self, 12 | message: typing.Any, 13 | errors: typing.List[dict], 14 | response: Model, 15 | correlation_id: str = None, 16 | ) -> None: 17 | super().__init__(message) 18 | self.response = response 19 | self.errors = errors 20 | self.correlation_id = correlation_id 21 | 22 | def __str__(self): 23 | result = super().__str__() 24 | if self.details: 25 | return f"{result} ({', '.join(self.details)})" 26 | return result 27 | 28 | @property 29 | def details(self) -> typing.List[str]: 30 | return [ 31 | e["detailedErrorMessage"] 32 | for e in self.errors 33 | if "detailedErrorMessage" in e 34 | ] 35 | 36 | @property 37 | def codes(self) -> typing.List[str]: 38 | try: 39 | if self.response.errors is not None: 40 | return [e.code for e in self.response.errors] 41 | else: 42 | return [] 43 | except AttributeError: 44 | return [] 45 | 46 | @property 47 | def code(self) -> str: 48 | """Convenience property to easily get the error code. 49 | 50 | Returns the code of the first error, just as 51 | 'message' is always the message of the first error. 52 | """ 53 | try: 54 | return self.codes[0] 55 | except KeyError: 56 | return "" 57 | -------------------------------------------------------------------------------- /src/commercetools/frontend/.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import re 8 | 9 | import marshmallow 10 | import marshmallow_enum 11 | 12 | from commercetools import helpers 13 | from ... import models 14 | import typing 15 | 16 | # Fields 17 | 18 | 19 | # Marshmallow Schemas 20 | -------------------------------------------------------------------------------- /src/commercetools/frontend/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | from .client import Client 8 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | from commercetools.base_client import BaseClient 8 | 9 | from .api.api_request_builder import ApiRequestBuilder 10 | from .frontastic.frontastic_request_builder import FrontasticRequestBuilder 11 | 12 | 13 | class Client(BaseClient): 14 | 15 | def __init__(self, *args, **kwargs): 16 | kwargs.setdefault("url", "https://{project}-{customer}.frontastic.io") 17 | super().__init__(**kwargs) 18 | 19 | def frontastic(self) -> FrontasticRequestBuilder: 20 | return FrontasticRequestBuilder( 21 | client=self, 22 | ) 23 | 24 | def api(self) -> ApiRequestBuilder: 25 | return ApiRequestBuilder( 26 | client=self, 27 | ) 28 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/action/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/action/frontastic_action_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .frontastic_action_by_namespace_by_action_request_builder import ( 11 | FrontasticActionByNamespaceByActionRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class FrontasticActionRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | 22 | def __init__( 23 | self, 24 | client: "BaseClient", 25 | ): 26 | self._client = client 27 | 28 | def with_namespace_value_with_action_value( 29 | self, namespace: str, action: str 30 | ) -> FrontasticActionByNamespaceByActionRequestBuilder: 31 | return FrontasticActionByNamespaceByActionRequestBuilder( 32 | namespace=namespace, 33 | action=action, 34 | client=self._client, 35 | ) 36 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/api/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/api/api_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..build.api_build_request_builder import ApiBuildRequestBuilder 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class ApiRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | 20 | def __init__( 21 | self, 22 | client: "BaseClient", 23 | ): 24 | self._client = client 25 | 26 | def build(self) -> ApiBuildRequestBuilder: 27 | return ApiBuildRequestBuilder( 28 | client=self._client, 29 | ) 30 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/build/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/build/api_build_request_builder.py: -------------------------------------------------------------------------------- 1 | 2 | # This file is automatically generated by the rmf-codegen project. 3 | # 4 | # The Python code generator is maintained by Lab Digital. If you want to 5 | # contribute to this project then please do not edit this file directly 6 | # but send a pull request to the Lab Digital fork of rmf-codegen at 7 | # https://github.com/labd/rmf-codegen 8 | from ..upload.api_build_upload_request_builder import ApiBuildUploadRequestBuilder 9 | import typing 10 | import warnings 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class ApiBuildRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | 20 | 21 | def __init__( 22 | self, 23 | client: "BaseClient", 24 | ): 25 | self._client = client 26 | 27 | def upload(self) -> ApiBuildUploadRequestBuilder: 28 | return ApiBuildUploadRequestBuilder( 29 | client=self._client, 30 | ) 31 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/context/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/context/frontastic_context_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.common import ProjectContext 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class FrontasticContextRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | 20 | def __init__( 21 | self, 22 | client: "BaseClient", 23 | ): 24 | self._client = client 25 | 26 | def get( 27 | self, 28 | *, 29 | headers: typing.Dict[str, str] = None, 30 | options: typing.Dict[str, typing.Any] = None, 31 | ) -> "ProjectContext": 32 | """Returns information about the project locales setup and the environment in which the requested host acts in. \ 33 | 34 | Headers: 35 | 36 | - `Accept` - `application/json` - Required 37 | 38 | """ 39 | headers = {} if headers is None else headers 40 | response = self._client._get( 41 | endpoint=f"/frontastic/context", params={}, headers=headers, options=options 42 | ) 43 | if response.status_code == 200: 44 | return ProjectContext.deserialize(response.json()) 45 | warnings.warn("Unhandled status code %d" % response.status_code) 46 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/data_source/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/data_source/frontastic_data_source_by_identifier_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.common import DataSourceResponse 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class FrontasticDataSourceByIdentifierRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | _identifier: str 20 | 21 | def __init__( 22 | self, 23 | identifier: str, 24 | client: "BaseClient", 25 | ): 26 | self._identifier = identifier 27 | self._client = client 28 | 29 | def get( 30 | self, 31 | body: object, 32 | *, 33 | headers: typing.Dict[str, str] = None, 34 | options: typing.Dict[str, typing.Any] = None, 35 | ) -> typing.Optional["DataSourceResponse"]: 36 | """Returns data and preview from the data source.""" 37 | headers = {} if headers is None else headers 38 | response = self._client._get( 39 | endpoint=f"/frontastic/data-source/{self._identifier}", 40 | params={}, 41 | headers=headers, 42 | options=options, 43 | ) 44 | if response.status_code == 200: 45 | return DataSourceResponse.deserialize(response.json()) 46 | elif response.status_code == 415: 47 | return None 48 | warnings.warn("Unhandled status code %d" % response.status_code) 49 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/data_source/frontastic_data_source_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .frontastic_data_source_by_identifier_request_builder import ( 11 | FrontasticDataSourceByIdentifierRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class FrontasticDataSourceRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | 22 | def __init__( 23 | self, 24 | client: "BaseClient", 25 | ): 26 | self._client = client 27 | 28 | def with_identifier_value( 29 | self, identifier: str 30 | ) -> FrontasticDataSourceByIdentifierRequestBuilder: 31 | return FrontasticDataSourceByIdentifierRequestBuilder( 32 | identifier=identifier, 33 | client=self._client, 34 | ) 35 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/frontastic/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/frontastic/frontastic_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..action.frontastic_action_request_builder import FrontasticActionRequestBuilder 11 | from ..context.frontastic_context_request_builder import FrontasticContextRequestBuilder 12 | from ..data_source.frontastic_data_source_request_builder import ( 13 | FrontasticDataSourceRequestBuilder, 14 | ) 15 | from ..page.frontastic_page_request_builder import FrontasticPageRequestBuilder 16 | from ..preview.frontastic_preview_request_builder import FrontasticPreviewRequestBuilder 17 | 18 | if typing.TYPE_CHECKING: 19 | from ...base_client import BaseClient 20 | 21 | 22 | class FrontasticRequestBuilder: 23 | 24 | _client: "BaseClient" 25 | 26 | def __init__( 27 | self, 28 | client: "BaseClient", 29 | ): 30 | self._client = client 31 | 32 | def context(self) -> FrontasticContextRequestBuilder: 33 | return FrontasticContextRequestBuilder( 34 | client=self._client, 35 | ) 36 | 37 | def page(self) -> FrontasticPageRequestBuilder: 38 | return FrontasticPageRequestBuilder( 39 | client=self._client, 40 | ) 41 | 42 | def preview(self) -> FrontasticPreviewRequestBuilder: 43 | return FrontasticPreviewRequestBuilder( 44 | client=self._client, 45 | ) 46 | 47 | def action(self) -> FrontasticActionRequestBuilder: 48 | return FrontasticActionRequestBuilder( 49 | client=self._client, 50 | ) 51 | 52 | def data_source(self) -> FrontasticDataSourceRequestBuilder: 53 | return FrontasticDataSourceRequestBuilder( 54 | client=self._client, 55 | ) 56 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/page/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/page/frontastic_page_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.common import Error, PageDataResponse, RedirectResponse 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class FrontasticPageRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | 20 | def __init__( 21 | self, 22 | client: "BaseClient", 23 | ): 24 | self._client = client 25 | 26 | def get( 27 | self, 28 | *, 29 | headers: typing.Dict[str, str] = None, 30 | options: typing.Dict[str, typing.Any] = None, 31 | ) -> "PageDataResponse": 32 | """Returns the structure and data of the published page displayed from commercetools Frontend. \ 33 | 34 | Headers: 35 | 36 | - `Frontastic-Path` - `^/.*$` - Required 37 | - `Accept` - `application/json` - Required 38 | - `Frontastic-Locale` - [Locale](ctp:frontend-api:type:Locale) - Required 39 | 40 | """ 41 | headers = {} if headers is None else headers 42 | response = self._client._get( 43 | endpoint=f"/frontastic/page", params={}, headers=headers, options=options 44 | ) 45 | if response.status_code == 200: 46 | return PageDataResponse.deserialize(response.json()) 47 | elif response.status_code == 301: 48 | obj = RedirectResponse.deserialize(response.json()) 49 | raise self._client._create_exception(obj, response) 50 | elif response.status_code == 404: 51 | obj = Error.deserialize(response.json()) 52 | raise self._client._create_exception(obj, response) 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/preview/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/preview/frontastic_preview_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.common import Error, PagePreviewDataResponse 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class FrontasticPreviewRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | 20 | def __init__( 21 | self, 22 | client: "BaseClient", 23 | ): 24 | self._client = client 25 | 26 | def get( 27 | self, 28 | *, 29 | locale: str, 30 | preview_id: str, 31 | headers: typing.Dict[str, str] = None, 32 | options: typing.Dict[str, typing.Any] = None, 33 | ) -> "PagePreviewDataResponse": 34 | """Returns the page structure and data for a specific [preview](/../frontend-studio/using-the-page-builder) by its `previewId`. \ 35 | 36 | Headers: 37 | 38 | - `Accept` - `application/json` - Required 39 | 40 | """ 41 | headers = {} if headers is None else headers 42 | response = self._client._get( 43 | endpoint=f"/frontastic/preview", 44 | params={"locale": locale, "previewId": preview_id}, 45 | headers=headers, 46 | options=options, 47 | ) 48 | if response.status_code == 200: 49 | return PagePreviewDataResponse.deserialize(response.json()) 50 | elif response.status_code == 404: 51 | obj = Error.deserialize(response.json()) 52 | raise self._client._create_exception(obj, response) 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/upload/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/frontend/client/upload/api_build_upload_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.common import BuildUpload 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class ApiBuildUploadRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | 20 | def __init__( 21 | self, 22 | client: "BaseClient", 23 | ): 24 | self._client = client 25 | 26 | def post( 27 | self, 28 | body: "BuildUpload", 29 | *, 30 | headers: typing.Dict[str, str] = None, 31 | options: typing.Dict[str, typing.Any] = None, 32 | ) -> object: 33 | """Uploads your backend builds from your custom CI environment to the Studio.""" 34 | headers = {} if headers is None else headers 35 | response = self._client._post( 36 | endpoint=f"/api/build/upload", 37 | params={}, 38 | json=body.serialize(), 39 | headers={"Content-Type": "multipart/form-data", **headers}, 40 | options=options, 41 | ) 42 | if response.status_code == 200: 43 | return object.deserialize(response.json()) 44 | warnings.warn("Unhandled status code %d" % response.status_code) 45 | -------------------------------------------------------------------------------- /src/commercetools/frontend/models/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | 8 | from . import * # noqa 9 | from .common import * # noqa 10 | -------------------------------------------------------------------------------- /src/commercetools/frontend/models/_abstract.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | 8 | 9 | class _BaseType: 10 | def __eq__(self, other): 11 | if other.__class__ is self.__class__: 12 | return self.__values__() == other.__values__() 13 | else: 14 | return NotImplemented 15 | 16 | def __ne__(self, other): 17 | result = self.__eq__(other) 18 | if result is NotImplemented: 19 | return NotImplemented 20 | else: 21 | return not result 22 | 23 | def __lt__(self, other): 24 | if other.__class__ is self.__class__: 25 | return self.__values__() < other.__values__() 26 | else: 27 | return NotImplemented 28 | 29 | def __le__(self, other): 30 | if other.__class__ is self.__class__: 31 | return self.__values__() <= other.__values__() 32 | else: 33 | return NotImplemented 34 | 35 | def __gt__(self, other): 36 | if other.__class__ is self.__class__: 37 | return self.__values__() > other.__values__() 38 | else: 39 | return NotImplemented 40 | 41 | def __ge__(self, other): 42 | if other.__class__ is self.__class__: 43 | return self.__values__() >= other.__values__() 44 | else: 45 | return NotImplemented 46 | 47 | def __values__(self): 48 | return tuple(self.__dict__.values()) 49 | 50 | def __hash__(self): 51 | return hash((self.__class__,) + self.__values__()) 52 | 53 | def __repr__(self): 54 | return "%s(%s)" % ( 55 | self.__class__.__name__, 56 | ", ".join("%s=%r" % (k, v) for k, v in self.__dict__.items()), 57 | ) 58 | -------------------------------------------------------------------------------- /src/commercetools/importapi/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | from .client import Client 8 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | from commercetools.base_client import BaseClient 8 | 9 | from .by_project_key_request_builder import ByProjectKeyRequestBuilder 10 | 11 | 12 | class Client(BaseClient): 13 | 14 | def __init__(self, *args, **kwargs): 15 | kwargs.setdefault("url", "https://import.europe-west1.gcp.commercetools.com") 16 | super().__init__(**kwargs) 17 | 18 | def with_project_key_value(self, project_key: str) -> ByProjectKeyRequestBuilder: 19 | return ByProjectKeyRequestBuilder( 20 | project_key=project_key, 21 | client=self, 22 | ) 23 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/categories/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/categories/by_project_key_categories_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_categories_import_containers_request_builder import ( 11 | ByProjectKeyCategoriesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyCategoriesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers(self) -> ByProjectKeyCategoriesImportContainersRequestBuilder: 32 | return ByProjectKeyCategoriesImportContainersRequestBuilder( 33 | project_key=self._project_key, 34 | client=self._client, 35 | ) 36 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/customers/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/customers/by_project_key_customers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_customers_import_containers_request_builder import ( 11 | ByProjectKeyCustomersImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyCustomersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers(self) -> ByProjectKeyCustomersImportContainersRequestBuilder: 32 | return ByProjectKeyCustomersImportContainersRequestBuilder( 33 | project_key=self._project_key, 34 | client=self._client, 35 | ) 36 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/discount_codes/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/discount_codes/by_project_key_discount_codes_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_discount_codes_import_containers_request_builder import ( 11 | ByProjectKeyDiscountCodesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyDiscountCodesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyDiscountCodesImportContainersRequestBuilder: 34 | return ByProjectKeyDiscountCodesImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_categories_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_categories_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyCategoriesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyCategoriesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyCategoriesImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyCategoriesImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_customers_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_customers_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyCustomersImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyCustomersImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyCustomersImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyCustomersImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_discount_codes_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_discount_codes_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyDiscountCodesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder: 34 | return ( 35 | ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder( 36 | import_container_key=import_container_key, 37 | project_key=self._project_key, 38 | client=self._client, 39 | ) 40 | ) 41 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_inventories_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_inventories_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyInventoriesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyInventoriesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyInventoriesImportContainersByImportContainerKeyRequestBuilder: 34 | return ( 35 | ByProjectKeyInventoriesImportContainersByImportContainerKeyRequestBuilder( 36 | import_container_key=import_container_key, 37 | project_key=self._project_key, 38 | client=self._client, 39 | ) 40 | ) 41 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_order_patches_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_order_patches_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyOrderPatchesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyOrderPatchesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyOrderPatchesImportContainersByImportContainerKeyRequestBuilder: 34 | return ( 35 | ByProjectKeyOrderPatchesImportContainersByImportContainerKeyRequestBuilder( 36 | import_container_key=import_container_key, 37 | project_key=self._project_key, 38 | client=self._client, 39 | ) 40 | ) 41 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_orders_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_orders_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyOrdersImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyOrdersImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyOrdersImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyOrdersImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_prices_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_prices_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyPricesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyPricesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyPricesImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyPricesImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_product_drafts_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_product_drafts_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyProductDraftsImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductDraftsImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyProductDraftsImportContainersByImportContainerKeyRequestBuilder: 34 | return ( 35 | ByProjectKeyProductDraftsImportContainersByImportContainerKeyRequestBuilder( 36 | import_container_key=import_container_key, 37 | project_key=self._project_key, 38 | client=self._client, 39 | ) 40 | ) 41 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_product_types_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_product_types_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyProductTypesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductTypesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyProductTypesImportContainersByImportContainerKeyRequestBuilder: 34 | return ( 35 | ByProjectKeyProductTypesImportContainersByImportContainerKeyRequestBuilder( 36 | import_container_key=import_container_key, 37 | project_key=self._project_key, 38 | client=self._client, 39 | ) 40 | ) 41 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_product_variant_patches_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_product_variant_patches_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyProductVariantPatchesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductVariantPatchesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyProductVariantPatchesImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyProductVariantPatchesImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_product_variants_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_product_variants_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyProductVariantsImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductVariantsImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyProductVariantsImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyProductVariantsImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_products_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_products_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyProductsImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductsImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyProductsImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyProductsImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_standalone_prices_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_standalone_prices_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyStandalonePricesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_containers/by_project_key_types_import_containers_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_types_import_containers_by_import_container_key_request_builder import ( 11 | ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyTypesImportContainersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_import_container_key_value( 32 | self, import_container_key: str 33 | ) -> ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder: 34 | return ByProjectKeyTypesImportContainersByImportContainerKeyRequestBuilder( 35 | import_container_key=import_container_key, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_operations/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_operations/by_project_key_import_operations_by_id_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.errors import ErrorResponse 11 | from ...models.importoperations import ImportOperation 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyImportOperationsByIdRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | _id: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | id: str, 27 | client: "BaseClient", 28 | ): 29 | self._project_key = project_key 30 | self._id = id 31 | self._client = client 32 | 33 | def get( 34 | self, 35 | *, 36 | headers: typing.Dict[str, str] = None, 37 | options: typing.Dict[str, typing.Any] = None, 38 | ) -> "ImportOperation": 39 | """Retrieves the [ImportOperation](ctp:import:type:ImportOperation) of a given ID.""" 40 | headers = {} if headers is None else headers 41 | response = self._client._get( 42 | endpoint=f"/{self._project_key}/import-operations/{self._id}", 43 | params={}, 44 | headers=headers, 45 | options=options, 46 | ) 47 | if response.status_code == 200: 48 | return ImportOperation.deserialize(response.json()) 49 | elif response.status_code in (404, 503): 50 | obj = ErrorResponse.deserialize(response.json()) 51 | raise self._client._create_exception(obj, response) 52 | warnings.warn("Unhandled status code %d" % response.status_code) 53 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_operations/by_project_key_import_operations_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_import_operations_by_id_request_builder import ( 11 | ByProjectKeyImportOperationsByIdRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyImportOperationsRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_id_value(self, id: str) -> ByProjectKeyImportOperationsByIdRequestBuilder: 32 | return ByProjectKeyImportOperationsByIdRequestBuilder( 33 | id=id, 34 | project_key=self._project_key, 35 | client=self._client, 36 | ) 37 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_summaries/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/import_summaries/by_project_key_import_containers_by_import_container_key_import_summaries_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.importsummaries import ImportSummary 11 | 12 | if typing.TYPE_CHECKING: 13 | from ...base_client import BaseClient 14 | 15 | 16 | class ByProjectKeyImportContainersByImportContainerKeyImportSummariesRequestBuilder: 17 | 18 | _client: "BaseClient" 19 | _project_key: str 20 | _import_container_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | import_container_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._import_container_key = import_container_key 30 | self._client = client 31 | 32 | def get( 33 | self, 34 | *, 35 | headers: typing.Dict[str, str] = None, 36 | options: typing.Dict[str, typing.Any] = None, 37 | ) -> "ImportSummary": 38 | """Retrieves an [ImportSummary](ctp:import:type:ImportSummary) for the given import container. An [ImportSummary](ctp:import:type:ImportSummary) is calculated on demand.""" 39 | headers = {} if headers is None else headers 40 | response = self._client._get( 41 | endpoint=f"/{self._project_key}/import-containers/{self._import_container_key}/import-summaries", 42 | params={}, 43 | headers=headers, 44 | options=options, 45 | ) 46 | if response.status_code == 200: 47 | return ImportSummary.deserialize(response.json()) 48 | warnings.warn("Unhandled status code %d" % response.status_code) 49 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/inventories/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/inventories/by_project_key_inventories_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_inventories_import_containers_request_builder import ( 11 | ByProjectKeyInventoriesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyInventoriesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyInventoriesImportContainersRequestBuilder: 34 | return ByProjectKeyInventoriesImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/order_patches/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/order_patches/by_project_key_order_patches_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_order_patches_import_containers_request_builder import ( 11 | ByProjectKeyOrderPatchesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyOrderPatchesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyOrderPatchesImportContainersRequestBuilder: 34 | return ByProjectKeyOrderPatchesImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/orders/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/orders/by_project_key_orders_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_orders_import_containers_request_builder import ( 11 | ByProjectKeyOrdersImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyOrdersRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers(self) -> ByProjectKeyOrdersImportContainersRequestBuilder: 32 | return ByProjectKeyOrdersImportContainersRequestBuilder( 33 | project_key=self._project_key, 34 | client=self._client, 35 | ) 36 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/prices/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/prices/by_project_key_prices_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_prices_import_containers_request_builder import ( 11 | ByProjectKeyPricesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyPricesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers(self) -> ByProjectKeyPricesImportContainersRequestBuilder: 32 | return ByProjectKeyPricesImportContainersRequestBuilder( 33 | project_key=self._project_key, 34 | client=self._client, 35 | ) 36 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_drafts/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_drafts/by_project_key_product_drafts_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_product_drafts_import_containers_request_builder import ( 11 | ByProjectKeyProductDraftsImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductDraftsRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyProductDraftsImportContainersRequestBuilder: 34 | return ByProjectKeyProductDraftsImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_types/by_project_key_product_types_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_product_types_import_containers_request_builder import ( 11 | ByProjectKeyProductTypesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductTypesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyProductTypesImportContainersRequestBuilder: 34 | return ByProjectKeyProductTypesImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_variant_patches/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_variant_patches/by_project_key_product_variant_patches_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_product_variant_patches_import_containers_request_builder import ( 11 | ByProjectKeyProductVariantPatchesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductVariantPatchesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyProductVariantPatchesImportContainersRequestBuilder: 34 | return ByProjectKeyProductVariantPatchesImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_variants/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/product_variants/by_project_key_product_variants_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_product_variants_import_containers_request_builder import ( 11 | ByProjectKeyProductVariantsImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductVariantsRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyProductVariantsImportContainersRequestBuilder: 34 | return ByProjectKeyProductVariantsImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/products/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/products/by_project_key_products_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_products_import_containers_request_builder import ( 11 | ByProjectKeyProductsImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyProductsRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers(self) -> ByProjectKeyProductsImportContainersRequestBuilder: 32 | return ByProjectKeyProductsImportContainersRequestBuilder( 33 | project_key=self._project_key, 34 | client=self._client, 35 | ) 36 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/standalone_prices/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/standalone_prices/by_project_key_standalone_prices_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_standalone_prices_import_containers_request_builder import ( 11 | ByProjectKeyStandalonePricesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyStandalonePricesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers( 32 | self, 33 | ) -> ByProjectKeyStandalonePricesImportContainersRequestBuilder: 34 | return ByProjectKeyStandalonePricesImportContainersRequestBuilder( 35 | project_key=self._project_key, 36 | client=self._client, 37 | ) 38 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/importapi/client/types/by_project_key_types_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..import_containers.by_project_key_types_import_containers_request_builder import ( 11 | ByProjectKeyTypesImportContainersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyTypesRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def import_containers(self) -> ByProjectKeyTypesImportContainersRequestBuilder: 32 | return ByProjectKeyTypesImportContainersRequestBuilder( 33 | project_key=self._project_key, 34 | client=self._client, 35 | ) 36 | -------------------------------------------------------------------------------- /src/commercetools/importapi/models/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | 8 | from .categories import * # noqa 9 | from .common import * # noqa 10 | from .customers import * # noqa 11 | from .customfields import * # noqa 12 | from .discount_codes import * # noqa 13 | from .errors import * # noqa 14 | from .importcontainers import * # noqa 15 | from .importoperations import * # noqa 16 | from .importrequests import * # noqa 17 | from .importsummaries import * # noqa 18 | from .inventories import * # noqa 19 | from .order_patches import * # noqa 20 | from .orders import * # noqa 21 | from .prices import * # noqa 22 | from .productdrafts import * # noqa 23 | from .products import * # noqa 24 | from .producttypes import * # noqa 25 | from .productvariants import * # noqa 26 | from .standalone_prices import * # noqa 27 | from .types import * # noqa 28 | -------------------------------------------------------------------------------- /src/commercetools/importapi/models/_abstract.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | 8 | 9 | class _BaseType: 10 | def __eq__(self, other): 11 | if other.__class__ is self.__class__: 12 | return self.__values__() == other.__values__() 13 | else: 14 | return NotImplemented 15 | 16 | def __ne__(self, other): 17 | result = self.__eq__(other) 18 | if result is NotImplemented: 19 | return NotImplemented 20 | else: 21 | return not result 22 | 23 | def __lt__(self, other): 24 | if other.__class__ is self.__class__: 25 | return self.__values__() < other.__values__() 26 | else: 27 | return NotImplemented 28 | 29 | def __le__(self, other): 30 | if other.__class__ is self.__class__: 31 | return self.__values__() <= other.__values__() 32 | else: 33 | return NotImplemented 34 | 35 | def __gt__(self, other): 36 | if other.__class__ is self.__class__: 37 | return self.__values__() > other.__values__() 38 | else: 39 | return NotImplemented 40 | 41 | def __ge__(self, other): 42 | if other.__class__ is self.__class__: 43 | return self.__values__() >= other.__values__() 44 | else: 45 | return NotImplemented 46 | 47 | def __values__(self): 48 | return tuple(self.__dict__.values()) 49 | 50 | def __hash__(self): 51 | return hash((self.__class__,) + self.__values__()) 52 | 53 | def __repr__(self): 54 | return "%s(%s)" % ( 55 | self.__class__.__name__, 56 | ", ".join("%s=%r" % (k, v) for k, v in self.__dict__.items()), 57 | ) 58 | -------------------------------------------------------------------------------- /src/commercetools/importapi/models/_schemas/importsummaries.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import re 8 | import typing 9 | 10 | import marshmallow 11 | import marshmallow_enum 12 | 13 | from commercetools import helpers 14 | 15 | from ... import models 16 | 17 | # Fields 18 | 19 | 20 | # Marshmallow Schemas 21 | class ImportSummarySchema(helpers.BaseSchema): 22 | states = helpers.LazyNestedField( 23 | nested=helpers.absmod(__name__, ".OperationStatesSchema"), 24 | allow_none=True, 25 | unknown=marshmallow.EXCLUDE, 26 | load_default=None, 27 | ) 28 | total = marshmallow.fields.Integer(allow_none=True, load_default=None) 29 | 30 | class Meta: 31 | unknown = marshmallow.EXCLUDE 32 | 33 | @marshmallow.post_load 34 | def post_load(self, data, **kwargs): 35 | 36 | return models.ImportSummary(**data) 37 | 38 | 39 | class OperationStatesSchema(helpers.BaseSchema): 40 | processing = marshmallow.fields.Integer(allow_none=True, load_default=None) 41 | validation_failed = marshmallow.fields.Integer( 42 | allow_none=True, load_default=None, data_key="validationFailed" 43 | ) 44 | unresolved = marshmallow.fields.Integer(allow_none=True, load_default=None) 45 | wait_for_master_variant = marshmallow.fields.Integer( 46 | allow_none=True, load_default=None, data_key="waitForMasterVariant" 47 | ) 48 | imported = marshmallow.fields.Integer(allow_none=True, load_default=None) 49 | rejected = marshmallow.fields.Integer(allow_none=True, load_default=None) 50 | canceled = marshmallow.fields.Integer(allow_none=True, load_default=None) 51 | 52 | class Meta: 53 | unknown = marshmallow.EXCLUDE 54 | 55 | @marshmallow.post_load 56 | def post_load(self, data, **kwargs): 57 | 58 | return models.OperationStates(**data) 59 | -------------------------------------------------------------------------------- /src/commercetools/importapi/models/_schemas/inventories.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import re 8 | import typing 9 | 10 | import marshmallow 11 | import marshmallow_enum 12 | 13 | from commercetools import helpers 14 | 15 | from ... import models 16 | from .common import ImportResourceSchema 17 | 18 | # Fields 19 | 20 | 21 | # Marshmallow Schemas 22 | class InventoryImportSchema(ImportResourceSchema): 23 | sku = marshmallow.fields.String(allow_none=True, load_default=None) 24 | quantity_on_stock = marshmallow.fields.Integer( 25 | allow_none=True, load_default=None, data_key="quantityOnStock" 26 | ) 27 | restockable_in_days = marshmallow.fields.Integer( 28 | allow_none=True, 29 | metadata={"omit_empty": True}, 30 | load_default=None, 31 | data_key="restockableInDays", 32 | ) 33 | expected_delivery = marshmallow.fields.DateTime( 34 | allow_none=True, 35 | metadata={"omit_empty": True}, 36 | load_default=None, 37 | data_key="expectedDelivery", 38 | ) 39 | supply_channel = helpers.LazyNestedField( 40 | nested=helpers.absmod(__name__, ".common.ChannelKeyReferenceSchema"), 41 | allow_none=True, 42 | unknown=marshmallow.EXCLUDE, 43 | metadata={"omit_empty": True}, 44 | load_default=None, 45 | data_key="supplyChannel", 46 | ) 47 | custom = helpers.LazyNestedField( 48 | nested=helpers.absmod(__name__, ".customfields.CustomSchema"), 49 | allow_none=True, 50 | unknown=marshmallow.EXCLUDE, 51 | metadata={"omit_empty": True}, 52 | load_default=None, 53 | ) 54 | 55 | class Meta: 56 | unknown = marshmallow.EXCLUDE 57 | 58 | @marshmallow.post_load 59 | def post_load(self, data, **kwargs): 60 | 61 | return models.InventoryImport(**data) 62 | -------------------------------------------------------------------------------- /src/commercetools/platform/.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import re 8 | 9 | import marshmallow 10 | import marshmallow_enum 11 | 12 | from commercetools import helpers 13 | from ... import models 14 | import typing 15 | 16 | # Fields 17 | 18 | 19 | # Marshmallow Schemas 20 | -------------------------------------------------------------------------------- /src/commercetools/platform/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | from .client import Client 8 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | from commercetools.base_client import BaseClient 8 | 9 | from .by_project_key_request_builder import ByProjectKeyRequestBuilder 10 | 11 | 12 | class Client(BaseClient): 13 | 14 | def __init__(self, *args, **kwargs): 15 | kwargs.setdefault("url", "https://api.{region}.commercetools.com") 16 | super().__init__(**kwargs) 17 | 18 | def with_project_key(self, project_key: str) -> ByProjectKeyRequestBuilder: 19 | """The Project endpoint is used to retrieve certain information from a project.""" 20 | return ByProjectKeyRequestBuilder( 21 | project_key=project_key, 22 | client=self, 23 | ) 24 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/active_cart/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/api_clients/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/apply/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/apply/by_project_key_orders_edits_by_id_apply_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.error import ErrorResponse 11 | from ...models.order_edit import OrderEdit, OrderEditApply 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyOrdersEditsByIDApplyRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | _id: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | id: str, 27 | client: "BaseClient", 28 | ): 29 | self._project_key = project_key 30 | self._id = id 31 | self._client = client 32 | 33 | def post( 34 | self, 35 | body: "OrderEditApply", 36 | *, 37 | headers: typing.Dict[str, str] = None, 38 | options: typing.Dict[str, typing.Any] = None, 39 | ) -> typing.Optional["OrderEdit"]: 40 | """Applying an OrderEdit produces the [OrderEditApplied](ctp:api:type:OrderEditAppliedMessage) Message.""" 41 | headers = {} if headers is None else headers 42 | response = self._client._post( 43 | endpoint=f"/{self._project_key}/orders/edits/{self._id}/apply", 44 | params={}, 45 | json=body.serialize(), 46 | headers={"Content-Type": "application/json", **headers}, 47 | options=options, 48 | ) 49 | if response.status_code == 200: 50 | return OrderEdit.deserialize(response.json()) 51 | elif response.status_code in (400, 401, 403, 500, 502, 503): 52 | obj = ErrorResponse.deserialize(response.json()) 53 | raise self._client._create_exception(obj, response) 54 | elif response.status_code == 404: 55 | return None 56 | warnings.warn("Unhandled status code %d" % response.status_code) 57 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/approval_flows/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/approval_rules/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/as_associate/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/as_associate/by_project_key_as_associate_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_as_associate_by_associate_id_request_builder import ( 11 | ByProjectKeyAsAssociateByAssociateIdRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyAsAssociateRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | client: "BaseClient", 27 | ): 28 | self._project_key = project_key 29 | self._client = client 30 | 31 | def with_associate_id_value( 32 | self, associate_id: str 33 | ) -> ByProjectKeyAsAssociateByAssociateIdRequestBuilder: 34 | return ByProjectKeyAsAssociateByAssociateIdRequestBuilder( 35 | associate_id=associate_id, 36 | project_key=self._project_key, 37 | client=self._client, 38 | ) 39 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/associate_roles/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/attribute_groups/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/business_units/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/cart_discounts/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/carts/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/categories/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/channels/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/confirm/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/confirm/by_project_key_customers_email_confirm_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import Customer, CustomerEmailVerify 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyCustomersEmailConfirmRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | client: "BaseClient", 26 | ): 27 | self._project_key = project_key 28 | self._client = client 29 | 30 | def post( 31 | self, 32 | body: "CustomerEmailVerify", 33 | *, 34 | headers: typing.Dict[str, str] = None, 35 | options: typing.Dict[str, typing.Any] = None, 36 | ) -> typing.Optional["Customer"]: 37 | """Verifying the email of the Customer produces the [CustomerEmailVerified](ctp:api:type:CustomerEmailVerifiedMessage) Message.""" 38 | headers = {} if headers is None else headers 39 | response = self._client._post( 40 | endpoint=f"/{self._project_key}/customers/email/confirm", 41 | params={}, 42 | json=body.serialize(), 43 | headers={"Content-Type": "application/json", **headers}, 44 | options=options, 45 | ) 46 | if response.status_code == 200: 47 | return Customer.deserialize(response.json()) 48 | elif response.status_code in (400, 401, 403, 500, 502, 503): 49 | obj = ErrorResponse.deserialize(response.json()) 50 | raise self._client._create_exception(obj, response) 51 | elif response.status_code == 404: 52 | return None 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/confirm/by_project_key_me_email_confirm_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import Customer, MyCustomerEmailVerify 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyMeEmailConfirmRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | client: "BaseClient", 26 | ): 27 | self._project_key = project_key 28 | self._client = client 29 | 30 | def post( 31 | self, 32 | body: "MyCustomerEmailVerify", 33 | *, 34 | headers: typing.Dict[str, str] = None, 35 | options: typing.Dict[str, typing.Any] = None, 36 | ) -> typing.Optional["Customer"]: 37 | """This is the last step in the [email verification process of a Customer](/../api/projects/customers#email-verification-of-customer).""" 38 | headers = {} if headers is None else headers 39 | response = self._client._post( 40 | endpoint=f"/{self._project_key}/me/email/confirm", 41 | params={}, 42 | json=body.serialize(), 43 | headers={"Content-Type": "application/json", **headers}, 44 | options=options, 45 | ) 46 | if response.status_code == 200: 47 | return Customer.deserialize(response.json()) 48 | elif response.status_code in (400, 401, 403, 500, 502, 503): 49 | obj = ErrorResponse.deserialize(response.json()) 50 | raise self._client._create_exception(obj, response) 51 | elif response.status_code == 404: 52 | return None 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/custom_objects/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/customer_groups/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/customers/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/customers/by_project_key_customers_email_token_by_email_token_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import Customer 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyCustomersEmailTokenByEmailTokenRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | _email_token: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | email_token: str, 27 | client: "BaseClient", 28 | ): 29 | self._project_key = project_key 30 | self._email_token = email_token 31 | self._client = client 32 | 33 | def get( 34 | self, 35 | *, 36 | expand: typing.List["str"] = None, 37 | headers: typing.Dict[str, str] = None, 38 | options: typing.Dict[str, typing.Any] = None, 39 | ) -> typing.Optional["Customer"]: 40 | headers = {} if headers is None else headers 41 | response = self._client._get( 42 | endpoint=f"/{self._project_key}/customers/email-token={self._email_token}", 43 | params={"expand": expand}, 44 | headers=headers, 45 | options=options, 46 | ) 47 | if response.status_code == 200: 48 | return Customer.deserialize(response.json()) 49 | elif response.status_code in (400, 401, 403, 500, 502, 503): 50 | obj = ErrorResponse.deserialize(response.json()) 51 | raise self._client._create_exception(obj, response) 52 | elif response.status_code == 404: 53 | return None 54 | warnings.warn("Unhandled status code %d" % response.status_code) 55 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/customers/by_project_key_customers_password_token_by_password_token_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import Customer 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyCustomersPasswordTokenByPasswordTokenRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | _password_token: str 22 | 23 | def __init__( 24 | self, 25 | project_key: str, 26 | password_token: str, 27 | client: "BaseClient", 28 | ): 29 | self._project_key = project_key 30 | self._password_token = password_token 31 | self._client = client 32 | 33 | def get( 34 | self, 35 | *, 36 | expand: typing.List["str"] = None, 37 | headers: typing.Dict[str, str] = None, 38 | options: typing.Dict[str, typing.Any] = None, 39 | ) -> typing.Optional["Customer"]: 40 | headers = {} if headers is None else headers 41 | response = self._client._get( 42 | endpoint=f"/{self._project_key}/customers/password-token={self._password_token}", 43 | params={"expand": expand}, 44 | headers=headers, 45 | options=options, 46 | ) 47 | if response.status_code == 200: 48 | return Customer.deserialize(response.json()) 49 | elif response.status_code in (400, 401, 403, 500, 502, 503): 50 | obj = ErrorResponse.deserialize(response.json()) 51 | raise self._client._create_exception(obj, response) 52 | elif response.status_code == 404: 53 | return None 54 | warnings.warn("Unhandled status code %d" % response.status_code) 55 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/discount_codes/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/edits/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/email_token/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/email_token/by_project_key_customers_email_token_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import CustomerCreateEmailToken, CustomerToken 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyCustomersEmailTokenRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | client: "BaseClient", 26 | ): 27 | self._project_key = project_key 28 | self._client = client 29 | 30 | def post( 31 | self, 32 | body: "CustomerCreateEmailToken", 33 | *, 34 | headers: typing.Dict[str, str] = None, 35 | options: typing.Dict[str, typing.Any] = None, 36 | ) -> typing.Optional["CustomerToken"]: 37 | """Produces the [CustomerEmailTokenCreated](ctp:api:type:CustomerEmailTokenCreatedMessage) Message.""" 38 | headers = {} if headers is None else headers 39 | response = self._client._post( 40 | endpoint=f"/{self._project_key}/customers/email-token", 41 | params={}, 42 | json=body.serialize(), 43 | headers={"Content-Type": "application/json", **headers}, 44 | options=options, 45 | ) 46 | if response.status_code == 200: 47 | return CustomerToken.deserialize(response.json()) 48 | elif response.status_code in (400, 401, 403, 500, 502, 503): 49 | obj = ErrorResponse.deserialize(response.json()) 50 | raise self._client._create_exception(obj, response) 51 | elif response.status_code == 404: 52 | return None 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/extensions/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/graphql/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/graphql/by_project_key_graphql_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.error import ErrorResponse 11 | from ...models.graph_ql import GraphQLRequest, GraphQLResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyGraphqlRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | client: "BaseClient", 26 | ): 27 | self._project_key = project_key 28 | self._client = client 29 | 30 | def post( 31 | self, 32 | body: "GraphQLRequest", 33 | *, 34 | headers: typing.Dict[str, str] = None, 35 | options: typing.Dict[str, typing.Any] = None, 36 | ) -> typing.Optional["GraphQLResponse"]: 37 | """Execute a GraphQL query""" 38 | headers = {} if headers is None else headers 39 | response = self._client._post( 40 | endpoint=f"/{self._project_key}/graphql", 41 | params={}, 42 | json=body.serialize(), 43 | headers={"Content-Type": "application/graphql", **headers}, 44 | options=options, 45 | ) 46 | if response.status_code == 200: 47 | return GraphQLResponse.deserialize(response.json()) 48 | elif response.status_code in (400, 401, 403, 500, 502, 503): 49 | obj = ErrorResponse.deserialize(response.json()) 50 | raise self._client._create_exception(obj, response) 51 | elif response.status_code == 404: 52 | return None 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/health/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/health/by_project_key_subscriptions_by_id_health_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | if typing.TYPE_CHECKING: 11 | from ...base_client import BaseClient 12 | 13 | 14 | class ByProjectKeySubscriptionsByIDHealthRequestBuilder: 15 | 16 | _client: "BaseClient" 17 | _project_key: str 18 | _id: str 19 | 20 | def __init__( 21 | self, 22 | project_key: str, 23 | id: str, 24 | client: "BaseClient", 25 | ): 26 | self._project_key = project_key 27 | self._id = id 28 | self._client = client 29 | 30 | def get( 31 | self, 32 | *, 33 | headers: typing.Dict[str, str] = None, 34 | options: typing.Dict[str, typing.Any] = None, 35 | ) -> typing.Optional[None]: 36 | """This endpoint can be polled by a monitoring or alerting system that checks the health of your Subscriptions. To ease integration with such systems this endpoint does not require [Authorization](/../api/authorization).""" 37 | headers = {} if headers is None else headers 38 | response = self._client._get( 39 | endpoint=f"/{self._project_key}/subscriptions/{self._id}/health", 40 | params={}, 41 | headers=headers, 42 | options=options, 43 | ) 44 | if response.status_code == 200: 45 | return None 46 | elif response.status_code in (400, 503): 47 | return None 48 | warnings.warn("Unhandled status code %d" % response.status_code) 49 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/images/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/import_/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/in_business_unit/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/in_business_unit/by_project_key_in_business_unit_key_by_business_unit_key_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..me.by_project_key_in_business_unit_key_by_business_unit_key_me_request_builder import ( 11 | ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | _business_unit_key: str 23 | 24 | def __init__( 25 | self, 26 | project_key: str, 27 | business_unit_key: str, 28 | client: "BaseClient", 29 | ): 30 | self._project_key = project_key 31 | self._business_unit_key = business_unit_key 32 | self._client = client 33 | 34 | def me(self) -> ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeRequestBuilder: 35 | return ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeRequestBuilder( 36 | project_key=self._project_key, 37 | business_unit_key=self._business_unit_key, 38 | client=self._client, 39 | ) 40 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/in_store/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/inventory/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/login/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/matching/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/matching_cart/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/matching_cart_location/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/matching_location/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/matching_orderedit/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/me/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/me/by_project_key_in_business_unit_key_by_business_unit_key_me_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..customers.by_project_key_in_business_unit_key_by_business_unit_key_me_customers_request_builder import ( 11 | ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | _business_unit_key: str 23 | 24 | def __init__( 25 | self, 26 | project_key: str, 27 | business_unit_key: str, 28 | client: "BaseClient", 29 | ): 30 | self._project_key = project_key 31 | self._business_unit_key = business_unit_key 32 | self._client = client 33 | 34 | def customers( 35 | self, 36 | ) -> ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestBuilder: 37 | return ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestBuilder( 38 | project_key=self._project_key, 39 | business_unit_key=self._business_unit_key, 40 | client=self._client, 41 | ) 42 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/messages/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/orders/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/password/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/password/by_project_key_customers_password_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import Customer, CustomerChangePassword 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyCustomersPasswordRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | client: "BaseClient", 26 | ): 27 | self._project_key = project_key 28 | self._client = client 29 | 30 | def post( 31 | self, 32 | body: "CustomerChangePassword", 33 | *, 34 | headers: typing.Dict[str, str] = None, 35 | options: typing.Dict[str, typing.Any] = None, 36 | ) -> typing.Optional["Customer"]: 37 | """Changing the password produces the [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=false`.""" 38 | headers = {} if headers is None else headers 39 | response = self._client._post( 40 | endpoint=f"/{self._project_key}/customers/password", 41 | params={}, 42 | json=body.serialize(), 43 | headers={"Content-Type": "application/json", **headers}, 44 | options=options, 45 | ) 46 | if response.status_code == 200: 47 | return Customer.deserialize(response.json()) 48 | elif response.status_code in (400, 401, 403, 500, 502, 503): 49 | obj = ErrorResponse.deserialize(response.json()) 50 | raise self._client._create_exception(obj, response) 51 | elif response.status_code == 404: 52 | return None 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/password_token/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/password_token/by_project_key_customers_password_token_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import CustomerCreatePasswordResetToken, CustomerToken 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyCustomersPasswordTokenRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | client: "BaseClient", 26 | ): 27 | self._project_key = project_key 28 | self._client = client 29 | 30 | def post( 31 | self, 32 | body: "CustomerCreatePasswordResetToken", 33 | *, 34 | headers: typing.Dict[str, str] = None, 35 | options: typing.Dict[str, typing.Any] = None, 36 | ) -> typing.Optional["CustomerToken"]: 37 | headers = {} if headers is None else headers 38 | response = self._client._post( 39 | endpoint=f"/{self._project_key}/customers/password-token", 40 | params={}, 41 | json=body.serialize(), 42 | headers={"Content-Type": "application/json", **headers}, 43 | options=options, 44 | ) 45 | if response.status_code == 200: 46 | return CustomerToken.deserialize(response.json()) 47 | elif response.status_code in (400, 401, 403, 500, 502, 503): 48 | obj = ErrorResponse.deserialize(response.json()) 49 | raise self._client._create_exception(obj, response) 50 | elif response.status_code == 404: 51 | return None 52 | warnings.warn("Unhandled status code %d" % response.status_code) 53 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/payments/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/product_discounts/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/product_projections/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/product_projections/by_project_key_in_store_key_by_store_key_product_projections_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_in_store_key_by_store_key_product_projections_by_id_request_builder import ( 11 | ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDRequestBuilder, 12 | ) 13 | from .by_project_key_in_store_key_by_store_key_product_projections_key_by_key_request_builder import ( 14 | ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyRequestBuilder, 15 | ) 16 | 17 | if typing.TYPE_CHECKING: 18 | from ...base_client import BaseClient 19 | 20 | 21 | class ByProjectKeyInStoreKeyByStoreKeyProductProjectionsRequestBuilder: 22 | 23 | _client: "BaseClient" 24 | _project_key: str 25 | _store_key: str 26 | 27 | def __init__( 28 | self, 29 | project_key: str, 30 | store_key: str, 31 | client: "BaseClient", 32 | ): 33 | self._project_key = project_key 34 | self._store_key = store_key 35 | self._client = client 36 | 37 | def with_key( 38 | self, key: str 39 | ) -> ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyRequestBuilder: 40 | return ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyRequestBuilder( 41 | key=key, 42 | project_key=self._project_key, 43 | store_key=self._store_key, 44 | client=self._client, 45 | ) 46 | 47 | def with_id( 48 | self, id: str 49 | ) -> ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDRequestBuilder: 50 | return ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDRequestBuilder( 51 | id=id, 52 | project_key=self._project_key, 53 | store_key=self._store_key, 54 | client=self._client, 55 | ) 56 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/product_selection_assignments/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/product_selections/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/product_tailoring/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/product_types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/products/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..product_tailoring.by_project_key_in_store_key_by_store_key_products_by_product_id_product_tailoring_request_builder import ( 11 | ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | _store_key: str 23 | _product_id: str 24 | 25 | def __init__( 26 | self, 27 | project_key: str, 28 | store_key: str, 29 | product_id: str, 30 | client: "BaseClient", 31 | ): 32 | self._project_key = project_key 33 | self._store_key = store_key 34 | self._product_id = product_id 35 | self._client = client 36 | 37 | def product_tailoring( 38 | self, 39 | ) -> ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringRequestBuilder: 40 | return ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDProductTailoringRequestBuilder( 41 | project_key=self._project_key, 42 | store_key=self._store_key, 43 | product_id=self._product_id, 44 | client=self._client, 45 | ) 46 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..product_tailoring.by_project_key_in_store_key_by_store_key_products_key_by_product_key_product_tailoring_request_builder import ( 11 | ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | _store_key: str 23 | _product_key: str 24 | 25 | def __init__( 26 | self, 27 | project_key: str, 28 | store_key: str, 29 | product_key: str, 30 | client: "BaseClient", 31 | ): 32 | self._project_key = project_key 33 | self._store_key = store_key 34 | self._product_key = product_key 35 | self._client = client 36 | 37 | def product_tailoring( 38 | self, 39 | ) -> ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringRequestBuilder: 40 | return ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyProductTailoringRequestBuilder( 41 | project_key=self._project_key, 42 | store_key=self._store_key, 43 | product_key=self._product_key, 44 | client=self._client, 45 | ) 46 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/products/by_project_key_in_store_key_by_store_key_products_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from .by_project_key_in_store_key_by_store_key_products_by_product_id_request_builder import ( 11 | ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder, 12 | ) 13 | from .by_project_key_in_store_key_by_store_key_products_key_by_product_key_request_builder import ( 14 | ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder, 15 | ) 16 | 17 | if typing.TYPE_CHECKING: 18 | from ...base_client import BaseClient 19 | 20 | 21 | class ByProjectKeyInStoreKeyByStoreKeyProductsRequestBuilder: 22 | 23 | _client: "BaseClient" 24 | _project_key: str 25 | _store_key: str 26 | 27 | def __init__( 28 | self, 29 | project_key: str, 30 | store_key: str, 31 | client: "BaseClient", 32 | ): 33 | self._project_key = project_key 34 | self._store_key = store_key 35 | self._client = client 36 | 37 | def with_product_id( 38 | self, product_id: str 39 | ) -> ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder: 40 | return ByProjectKeyInStoreKeyByStoreKeyProductsByProductIDRequestBuilder( 41 | product_id=product_id, 42 | project_key=self._project_key, 43 | store_key=self._store_key, 44 | client=self._client, 45 | ) 46 | 47 | def with_product_key( 48 | self, product_key: str 49 | ) -> ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder: 50 | return ByProjectKeyInStoreKeyByStoreKeyProductsKeyByProductKeyRequestBuilder( 51 | product_key=product_key, 52 | project_key=self._project_key, 53 | store_key=self._store_key, 54 | client=self._client, 55 | ) 56 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/quote_requests/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/quotes/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/replicate/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/reset/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/reset/by_project_key_customers_password_reset_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ...models.customer import Customer, CustomerResetPassword 11 | from ...models.error import ErrorResponse 12 | 13 | if typing.TYPE_CHECKING: 14 | from ...base_client import BaseClient 15 | 16 | 17 | class ByProjectKeyCustomersPasswordResetRequestBuilder: 18 | 19 | _client: "BaseClient" 20 | _project_key: str 21 | 22 | def __init__( 23 | self, 24 | project_key: str, 25 | client: "BaseClient", 26 | ): 27 | self._project_key = project_key 28 | self._client = client 29 | 30 | def post( 31 | self, 32 | body: "CustomerResetPassword", 33 | *, 34 | headers: typing.Dict[str, str] = None, 35 | options: typing.Dict[str, typing.Any] = None, 36 | ) -> typing.Optional["Customer"]: 37 | """Resetting the password of the Customer produces the [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=true`.""" 38 | headers = {} if headers is None else headers 39 | response = self._client._post( 40 | endpoint=f"/{self._project_key}/customers/password/reset", 41 | params={}, 42 | json=body.serialize(), 43 | headers={"Content-Type": "application/json", **headers}, 44 | options=options, 45 | ) 46 | if response.status_code == 200: 47 | return Customer.deserialize(response.json()) 48 | elif response.status_code in (400, 401, 403, 500, 502, 503): 49 | obj = ErrorResponse.deserialize(response.json()) 50 | raise self._client._create_exception(obj, response) 51 | elif response.status_code == 404: 52 | return None 53 | warnings.warn("Unhandled status code %d" % response.status_code) 54 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/reviews/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/search/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/shipping_methods/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/shipping_methods/by_project_key_in_store_key_by_store_key_shipping_methods_request_builder.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import typing 8 | import warnings 9 | 10 | from ..matching_cart.by_project_key_in_store_key_by_store_key_shipping_methods_matching_cart_request_builder import ( 11 | ByProjectKeyInStoreKeyByStoreKeyShippingMethodsMatchingCartRequestBuilder, 12 | ) 13 | 14 | if typing.TYPE_CHECKING: 15 | from ...base_client import BaseClient 16 | 17 | 18 | class ByProjectKeyInStoreKeyByStoreKeyShippingMethodsRequestBuilder: 19 | 20 | _client: "BaseClient" 21 | _project_key: str 22 | _store_key: str 23 | 24 | def __init__( 25 | self, 26 | project_key: str, 27 | store_key: str, 28 | client: "BaseClient", 29 | ): 30 | self._project_key = project_key 31 | self._store_key = store_key 32 | self._client = client 33 | 34 | def matching_cart( 35 | self, 36 | ) -> ByProjectKeyInStoreKeyByStoreKeyShippingMethodsMatchingCartRequestBuilder: 37 | """Get ShippingMethods for a cart in a store""" 38 | return ( 39 | ByProjectKeyInStoreKeyByStoreKeyShippingMethodsMatchingCartRequestBuilder( 40 | project_key=self._project_key, 41 | store_key=self._store_key, 42 | client=self._client, 43 | ) 44 | ) 45 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/shopping_lists/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/signup/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/staged_quotes/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/standalone_prices/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/states/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/stores/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/subscriptions/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/suggest/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/tax_categories/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/types/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/client/zones/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | -------------------------------------------------------------------------------- /src/commercetools/platform/models/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | 8 | from . import * # noqa 9 | from .api_client import * # noqa 10 | from .approval_flow import * # noqa 11 | from .approval_rule import * # noqa 12 | from .associate_role import * # noqa 13 | from .attribute_group import * # noqa 14 | from .business_unit import * # noqa 15 | from .cart import * # noqa 16 | from .cart_discount import * # noqa 17 | from .category import * # noqa 18 | from .channel import * # noqa 19 | from .common import * # noqa 20 | from .custom_object import * # noqa 21 | from .customer import * # noqa 22 | from .customer_group import * # noqa 23 | from .discount_code import * # noqa 24 | from .error import * # noqa 25 | from .extension import * # noqa 26 | from .graph_ql import * # noqa 27 | from .inventory import * # noqa 28 | from .me import * # noqa 29 | from .message import * # noqa 30 | from .order import * # noqa 31 | from .order_edit import * # noqa 32 | from .payment import * # noqa 33 | from .product import * # noqa 34 | from .product_discount import * # noqa 35 | from .product_search import * # noqa 36 | from .product_selection import * # noqa 37 | from .product_tailoring import * # noqa 38 | from .product_type import * # noqa 39 | from .project import * # noqa 40 | from .quote import * # noqa 41 | from .quote_request import * # noqa 42 | from .review import * # noqa 43 | from .search import * # noqa 44 | from .shipping_method import * # noqa 45 | from .shopping_list import * # noqa 46 | from .staged_quote import * # noqa 47 | from .standalone_price import * # noqa 48 | from .state import * # noqa 49 | from .store import * # noqa 50 | from .store_country import * # noqa 51 | from .subscription import * # noqa 52 | from .tax_category import * # noqa 53 | from .type import * # noqa 54 | from .zone import * # noqa 55 | -------------------------------------------------------------------------------- /src/commercetools/platform/models/_abstract.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | 8 | 9 | class _BaseType: 10 | def __eq__(self, other): 11 | if other.__class__ is self.__class__: 12 | return self.__values__() == other.__values__() 13 | else: 14 | return NotImplemented 15 | 16 | def __ne__(self, other): 17 | result = self.__eq__(other) 18 | if result is NotImplemented: 19 | return NotImplemented 20 | else: 21 | return not result 22 | 23 | def __lt__(self, other): 24 | if other.__class__ is self.__class__: 25 | return self.__values__() < other.__values__() 26 | else: 27 | return NotImplemented 28 | 29 | def __le__(self, other): 30 | if other.__class__ is self.__class__: 31 | return self.__values__() <= other.__values__() 32 | else: 33 | return NotImplemented 34 | 35 | def __gt__(self, other): 36 | if other.__class__ is self.__class__: 37 | return self.__values__() > other.__values__() 38 | else: 39 | return NotImplemented 40 | 41 | def __ge__(self, other): 42 | if other.__class__ is self.__class__: 43 | return self.__values__() >= other.__values__() 44 | else: 45 | return NotImplemented 46 | 47 | def __values__(self): 48 | return tuple(self.__dict__.values()) 49 | 50 | def __hash__(self): 51 | return hash((self.__class__,) + self.__values__()) 52 | 53 | def __repr__(self): 54 | return "%s(%s)" % ( 55 | self.__class__.__name__, 56 | ", ".join("%s=%r" % (k, v) for k, v in self.__dict__.items()), 57 | ) 58 | -------------------------------------------------------------------------------- /src/commercetools/platform/models/_schemas/store_country.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | import re 8 | import typing 9 | 10 | import marshmallow 11 | import marshmallow_enum 12 | 13 | from commercetools import helpers 14 | 15 | from ... import models 16 | 17 | # Fields 18 | 19 | 20 | # Marshmallow Schemas 21 | class StoreCountrySchema(helpers.BaseSchema): 22 | code = marshmallow.fields.String(allow_none=True, load_default=None) 23 | 24 | class Meta: 25 | unknown = marshmallow.EXCLUDE 26 | 27 | @marshmallow.post_load 28 | def post_load(self, data, **kwargs): 29 | 30 | return models.StoreCountry(**data) 31 | -------------------------------------------------------------------------------- /src/commercetools/platform/models/store_country.py: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by the rmf-codegen project. 2 | # 3 | # The Python code generator is maintained by Lab Digital. If you want to 4 | # contribute to this project then please do not edit this file directly 5 | # but send a pull request to the Lab Digital fork of rmf-codegen at 6 | # https://github.com/labd/rmf-codegen 7 | 8 | import datetime 9 | import enum 10 | import typing 11 | 12 | from ._abstract import _BaseType 13 | 14 | __all__ = ["StoreCountry"] 15 | 16 | 17 | class StoreCountry(_BaseType): 18 | #: Two-digit country code as per [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). 19 | code: str 20 | 21 | def __init__(self, *, code: str): 22 | self.code = code 23 | 24 | super().__init__() 25 | 26 | @classmethod 27 | def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "StoreCountry": 28 | from ._schemas.store_country import StoreCountrySchema 29 | 30 | return StoreCountrySchema().load(data) 31 | 32 | def serialize(self) -> typing.Dict[str, typing.Any]: 33 | from ._schemas.store_country import StoreCountrySchema 34 | 35 | return StoreCountrySchema().dump(self) 36 | -------------------------------------------------------------------------------- /src/commercetools/protocols.py: -------------------------------------------------------------------------------- 1 | import typing 2 | 3 | try: 4 | from typing import Protocol 5 | except ImportError: # Python < 3.8 6 | Protocol = object 7 | 8 | 9 | class Model(Protocol): 10 | @classmethod 11 | def deserialize(cls, data: typing.Dict[str, typing.Any]) -> "Model": ... 12 | 13 | def serialize(self) -> typing.Dict[str, typing.Any]: ... 14 | -------------------------------------------------------------------------------- /src/commercetools/py.typed: -------------------------------------------------------------------------------- 1 | # PEP561 2 | -------------------------------------------------------------------------------- /src/commercetools/testing/api_clients.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import typing 3 | import uuid 4 | 5 | from commercetools.platform import models 6 | from commercetools.platform.models._schemas.api_client import ( 7 | ApiClientDraftSchema, 8 | ApiClientPagedQueryResponseSchema, 9 | ApiClientSchema, 10 | ) 11 | from commercetools.testing.abstract import BaseModel, ServiceBackend 12 | 13 | 14 | class ApiClientsModel(BaseModel): 15 | _primary_type_name = "api-client" 16 | _resource_schema = ApiClientSchema 17 | 18 | def _create_from_draft( 19 | self, draft: models.ApiClientDraft, id: typing.Optional[str] = None 20 | ) -> models.ApiClient: 21 | object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) 22 | return models.ApiClient( 23 | id=str(object_id), 24 | name=draft.name, 25 | scope=draft.scope, 26 | secret=str(uuid.uuid4()), 27 | created_at=datetime.datetime.now(datetime.timezone.utc), 28 | ) 29 | 30 | 31 | class ApiClientsBackend(ServiceBackend): 32 | service_path = "api-clients" 33 | model_class = ApiClientsModel 34 | _schema_draft = ApiClientDraftSchema 35 | _schema_query_response = ApiClientPagedQueryResponseSchema 36 | _verify_version = False 37 | 38 | def urls(self): 39 | return [ 40 | ("^$", "GET", self.query), 41 | ("^$", "POST", self.create), 42 | ("^(?P[^/]+)$", "GET", self.get_by_id), 43 | ("^(?P[^/]+)$", "DELETE", self.delete_by_id), 44 | ] 45 | -------------------------------------------------------------------------------- /src/commercetools/testing/channels.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import typing 3 | import uuid 4 | 5 | from commercetools.platform import models 6 | from commercetools.platform.models._schemas.channel import ( 7 | ChannelDraftSchema, 8 | ChannelPagedQueryResponseSchema, 9 | ChannelSchema, 10 | ChannelUpdateSchema, 11 | ) 12 | from commercetools.testing import utils 13 | from commercetools.testing.abstract import BaseModel, ServiceBackend 14 | 15 | 16 | class ChannelsModel(BaseModel): 17 | _resource_schema = ChannelSchema 18 | _primary_type_name = "channel" 19 | _unique_values = ["key"] 20 | 21 | def _create_from_draft( 22 | self, draft: models.ChannelDraft, id: typing.Optional[str] = None 23 | ) -> models.Channel: 24 | object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) 25 | return models.Channel( 26 | id=str(object_id), 27 | version=1, 28 | name=draft.name, 29 | description=draft.description, 30 | roles=draft.roles, 31 | key=draft.key, 32 | created_at=datetime.datetime.now(datetime.timezone.utc), 33 | last_modified_at=datetime.datetime.now(datetime.timezone.utc), 34 | custom=utils.create_from_draft(draft.custom), 35 | ) 36 | 37 | 38 | class ChannelsBackend(ServiceBackend): 39 | service_path = "channels" 40 | model_class = ChannelsModel 41 | _schema_draft = ChannelDraftSchema 42 | _schema_update = ChannelUpdateSchema 43 | _schema_query_response = ChannelPagedQueryResponseSchema 44 | 45 | def urls(self): 46 | return [ 47 | ("^$", "GET", self.query), 48 | ("^$", "POST", self.create), 49 | ("^(?P[^/]+)$", "GET", self.get_by_id), 50 | ("^(?P[^/]+)$", "POST", self.update_by_id), 51 | ("^(?P[^/]+)$", "DELETE", self.delete_by_id), 52 | ] 53 | -------------------------------------------------------------------------------- /src/commercetools/testing/extensions.py: -------------------------------------------------------------------------------- 1 | import copy 2 | import datetime 3 | import typing 4 | import uuid 5 | 6 | from commercetools.platform import models 7 | from commercetools.platform.models._schemas.extension import ( 8 | ExtensionDraftSchema, 9 | ExtensionPagedQueryResponseSchema, 10 | ExtensionSchema, 11 | ExtensionUpdateSchema, 12 | ) 13 | from commercetools.testing.abstract import BaseModel, ServiceBackend 14 | from commercetools.testing.utils import update_attribute, update_nested_object_attribute 15 | 16 | 17 | class ExtensionsModel(BaseModel): 18 | _primary_type_name = "extension" 19 | _resource_schema = ExtensionSchema 20 | _unique_values = ["key"] 21 | 22 | def _create_from_draft( 23 | self, draft: models.ExtensionDraft, id: typing.Optional[str] = None 24 | ) -> models.Extension: 25 | object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) 26 | return models.Extension( 27 | id=str(object_id), 28 | version=1, 29 | created_at=datetime.datetime.now(datetime.timezone.utc), 30 | last_modified_at=datetime.datetime.now(datetime.timezone.utc), 31 | key=draft.key, 32 | destination=draft.destination, 33 | triggers=draft.triggers, 34 | timeout_in_ms=draft.timeout_in_ms, 35 | ) 36 | 37 | 38 | class ExtensionsBackend(ServiceBackend): 39 | service_path = "extensions" 40 | model_class = ExtensionsModel 41 | _schema_draft = ExtensionDraftSchema 42 | _schema_update = ExtensionUpdateSchema 43 | _schema_query_response = ExtensionPagedQueryResponseSchema 44 | 45 | def urls(self): 46 | return [ 47 | ("^$", "GET", self.query), 48 | ("^$", "POST", self.create), 49 | ("^(?P[^/]+)$", "GET", self.get_by_id), 50 | ("^(?P[^/]+)$", "POST", self.update_by_id), 51 | ("^(?P[^/]+)$", "DELETE", self.delete_by_id), 52 | ("^key=(?P[^/]+)$", "DELETE", self.delete_by_key), 53 | ] 54 | 55 | _actions = { 56 | "changeTriggers": update_nested_object_attribute("triggers", "triggers"), 57 | } 58 | -------------------------------------------------------------------------------- /src/commercetools/testing/internal.py: -------------------------------------------------------------------------------- 1 | from commercetools.testing.abstract import BaseBackend, BaseModel 2 | from commercetools.testing.utils import create_commercetools_response 3 | 4 | 5 | class InternalBackend(BaseBackend): 6 | path_prefix = r"/-/(?P.*)" 7 | hostnames = [ 8 | "auth.europe-west1.gcp.commercetools.com", 9 | "auth.sphere.io", 10 | "localhost", 11 | ] 12 | 13 | def urls(self): 14 | return [("^health$", "GET", self.health)] 15 | 16 | def health(self, request): 17 | response = create_commercetools_response(request, json={}) 18 | return response 19 | -------------------------------------------------------------------------------- /src/commercetools/testing/product_discounts.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import typing 3 | import uuid 4 | 5 | from commercetools.platform import models 6 | from commercetools.platform.models._schemas.product_discount import ( 7 | ProductDiscountDraftSchema, 8 | ProductDiscountPagedQueryResponseSchema, 9 | ProductDiscountSchema, 10 | ProductDiscountUpdateSchema, 11 | ) 12 | from commercetools.testing.abstract import BaseModel, ServiceBackend 13 | 14 | 15 | class ProductDiscountsModel(BaseModel): 16 | _primary_type_name = "product-discount" 17 | _resource_schema = ProductDiscountSchema 18 | 19 | def _create_from_draft( 20 | self, draft: models.ProductDiscountDraft, id: typing.Optional[str] = None 21 | ) -> models.ProductDiscount: 22 | object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) 23 | return models.ProductDiscount( 24 | id=str(object_id), 25 | version=1, 26 | created_at=datetime.datetime.now(datetime.timezone.utc), 27 | last_modified_at=datetime.datetime.now(datetime.timezone.utc), 28 | name=draft.name, 29 | description=draft.description, 30 | value=draft.value, 31 | predicate=draft.predicate, 32 | sort_order=draft.sort_order, 33 | references=[], 34 | is_active=draft.is_active, 35 | valid_from=draft.valid_from, 36 | valid_until=draft.valid_until, 37 | ) 38 | 39 | 40 | class ProductDiscountsBackend(ServiceBackend): 41 | service_path = "product-discounts" 42 | model_class = ProductDiscountsModel 43 | 44 | _schema_draft = ProductDiscountDraftSchema 45 | _schema_update = ProductDiscountUpdateSchema 46 | _schema_query_response = ProductDiscountPagedQueryResponseSchema 47 | 48 | def urls(self): 49 | return [ 50 | ("^$", "GET", self.query), 51 | ("^$", "POST", self.create), 52 | ("^(?P[^/]+)$", "GET", self.get_by_id), 53 | ("^(?P[^/]+)$", "POST", self.update_by_id), 54 | ("^(?P[^/]+)$", "DELETE", self.delete_by_id), 55 | ] 56 | -------------------------------------------------------------------------------- /src/commercetools/typing.py: -------------------------------------------------------------------------------- 1 | import typing 2 | from uuid import UUID 3 | 4 | OptionalListStr = typing.Union[typing.List[str], str, None] 5 | OptionalListInt = typing.Union[typing.List[str], str, None] 6 | OptionalListUUID = typing.Union[typing.List[UUID], UUID, None] 7 | -------------------------------------------------------------------------------- /src/commercetools/utils.py: -------------------------------------------------------------------------------- 1 | import threading 2 | import urllib.parse 3 | 4 | tls = threading.local() 5 | 6 | 7 | class BaseTokenSaver: 8 | def get_token(self, client_id, scopes): 9 | raise NotImplementedError() 10 | 11 | def add_token(self, client_id, scopes, token): 12 | raise NotImplementedError() 13 | 14 | def _create_token_hash(self, client_id, scopes): 15 | assert scopes is not None 16 | return "%s:%s" % (client_id, ";".join(scopes)) 17 | 18 | 19 | class DefaultTokenSaver(BaseTokenSaver): 20 | @property 21 | def storage(self): 22 | items = getattr(tls, "tokens", None) 23 | if items is None: 24 | items = {} 25 | setattr(tls, "tokens", items) 26 | return items 27 | 28 | def add_token(self, client_id, scopes, token): 29 | name = self._create_token_hash(client_id, scopes) 30 | self.storage[name] = token 31 | 32 | def get_token(self, client_id, scopes): 33 | name = self._create_token_hash(client_id, scopes) 34 | return self.storage.get(name) 35 | 36 | @classmethod 37 | def clear_cache(cls): 38 | items = getattr(tls, "tokens", {}) 39 | items.clear() 40 | 41 | 42 | def fix_token_url(token_url: str) -> str: 43 | """ 44 | Ensure the token url has the right format. 45 | 46 | Often clients only pass the base url instead of the complete 47 | token url, which gets confusing for users. 48 | """ 49 | parts = urllib.parse.urlparse(token_url) 50 | if parts.path == "": 51 | token_url = urllib.parse.urlunparse((*parts[:2], "/oauth/token", *parts[3:])) 52 | return token_url 53 | -------------------------------------------------------------------------------- /src/commercetools/version.py: -------------------------------------------------------------------------------- 1 | __version__ = "2023.6.29" 2 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labd/commercetools-python-sdk/929268c7649b1d6d3eca62778f30829387ee192f/tests/__init__.py -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | # Tricks flake8 into silencing redefining fixtures warnings. 4 | pytest_plugins = ["commercetools.contrib.pytest"] 5 | -------------------------------------------------------------------------------- /tests/importapi/test_models.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | from commercetools.importapi import models 4 | 5 | 6 | def test_serialization_optional_values(): 7 | item = models.LineItemImportDraft( 8 | name={"nl-NL": "foobar"}, 9 | variant=models.LineItemProductVariantImportDraft(sku="foobar"), 10 | price=models.LineItemPrice( 11 | value=models.Money(cent_amount=1000, currency_code="EUR"), 12 | ), 13 | quantity=3, 14 | ) 15 | 16 | data = item.serialize() 17 | item_cycle = models.LineItemImportDraft.deserialize(data) 18 | data_cycle = item_cycle.serialize() 19 | 20 | expected = { 21 | "name": {"nl-NL": "foobar"}, 22 | "price": { 23 | "value": { 24 | "centAmount": 1000, 25 | "currencyCode": "EUR", 26 | "type": "centPrecision", 27 | } 28 | }, 29 | "quantity": 3.0, 30 | "variant": {"sku": "foobar"}, 31 | } 32 | assert expected == data 33 | assert expected == data_cycle 34 | 35 | 36 | def test_serialization_optional_values(): 37 | now = datetime.datetime(2021, 1, 30, 11, 21, 8) 38 | custom = models.Custom( 39 | type=models.TypeKeyReference(key="my-custom-type"), 40 | fields=models.FieldContainer( 41 | { 42 | "foo": models.NumberField(value=1234), 43 | "itemDate": models.DateTimeField(value=now), 44 | } 45 | ), 46 | ) 47 | data = custom.serialize() 48 | expected = { 49 | "fields": { 50 | "foo": { 51 | "type": "Number", 52 | "value": 1234, 53 | }, 54 | "itemDate": { 55 | "type": "DateTime", 56 | "value": "2021-01-30T11:21:08", 57 | }, 58 | }, 59 | "type": {"typeId": "type", "key": "my-custom-type"}, 60 | } 61 | assert data == expected 62 | -------------------------------------------------------------------------------- /tests/platform/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from commercetools.contrib.pytest import ct_platform_client 4 | -------------------------------------------------------------------------------- /tests/platform/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labd/commercetools-python-sdk/929268c7649b1d6d3eca62778f30829387ee192f/tests/platform/models/__init__.py -------------------------------------------------------------------------------- /tests/platform/models/test_message.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform.models import message 2 | 3 | 4 | def test_deserialize_order_created(): 5 | result = message.OrderCreatedMessage.deserialize( 6 | { 7 | "createdAt": "2021-01-30T16:34:06.907Z", 8 | "id": "cb093b59-045d-47eb-8c6e-0a7fbf15b14b", 9 | "notificationType": "Message", 10 | "payloadNotIncluded": { 11 | "payloadType": "OrderCreated", 12 | "reason": "Payload too large", 13 | }, 14 | "projectKey": "some-project", 15 | "resource": { 16 | "id": "a41e26ce-8801-4795-bc93-b1507e1d925f", 17 | "typeId": "order", 18 | }, 19 | "resourceUserProvidedIdentifiers": {"orderNumber": "ORDER00001"}, 20 | "resourceVersion": 1, 21 | "sequenceNumber": 1, 22 | "version": 1, 23 | } 24 | ) 25 | assert result.id == "cb093b59-045d-47eb-8c6e-0a7fbf15b14b" 26 | assert result.resource 27 | -------------------------------------------------------------------------------- /tests/platform/models/test_project.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform.models import project 2 | 3 | 4 | def test_serialize_deserialize(): 5 | data = { 6 | "key": "unittest", 7 | "name": "SDK Test", 8 | "countries": ["AT", "NL", "CH", "BE", "GB", "DE", "IT", "LU", "ES"], 9 | "currencies": ["EUR", "GBP", "CHF"], 10 | "languages": [ 11 | "en-GB", 12 | "de-DE", 13 | "fr-FR", 14 | "nl-BE", 15 | "nl-NL", 16 | "fr-BE", 17 | "it-IT", 18 | "es-ES", 19 | "pt-PT", 20 | ], 21 | "createdAt": "2018-10-24T08:58:22.935Z", 22 | "carts": {"countryTaxRateFallbackEnabled": True}, 23 | "trialUntil": "2018-12", 24 | "messages": {"enabled": False, "deleteDaysAfterCreation": 15}, 25 | "version": 9, 26 | } 27 | result = project.Project.deserialize(data) 28 | serialized = project.Project.serialize(result) 29 | 30 | # TODO: Ideally the serialized data is exactly the same as the original input 31 | # This is true except for the date (got 2018-10-24T08:58:22.935000+00:00 instead of Z) 32 | # assert serialized == data 33 | -------------------------------------------------------------------------------- /tests/platform/test_custom_fields.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform import models 2 | from commercetools.platform.models._schemas.type import CustomFieldsDraftSchema 3 | 4 | 5 | def test_serialize_field_container(): 6 | draft = models.CustomFieldsDraft( 7 | type=models.TypeResourceIdentifier(id="foobar"), 8 | fields=models.FieldContainer(foobar=10), 9 | ) 10 | 11 | result = draft.serialize() 12 | expected = { 13 | "fields": {"foobar": 10}, 14 | "type": {"typeId": "type", "id": "foobar"}, 15 | } 16 | assert expected == result 17 | 18 | roundtrip = models.CustomFieldsDraft.deserialize(expected) 19 | assert draft == roundtrip 20 | -------------------------------------------------------------------------------- /tests/platform/test_helpers.py: -------------------------------------------------------------------------------- 1 | from marshmallow import Schema, fields 2 | 3 | from commercetools import helpers 4 | 5 | 6 | class Dummy(Schema): 7 | items = helpers.OptionalList(fields.String()) 8 | 9 | 10 | def test_optional_list_str(): 11 | data = Dummy().dump({"items": "foobar"}) 12 | assert data["items"] == ["foobar"] 13 | 14 | 15 | def test_optional_list_items(): 16 | data = Dummy().dump({"items": ["foobar"]}) 17 | assert data["items"] == ["foobar"] 18 | -------------------------------------------------------------------------------- /tests/platform/test_models_messages.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform import models 2 | 3 | 4 | def test_non_equality(): 5 | obj = models.Message.deserialize( 6 | { 7 | "id": "174adf2f-783f-4ce5-a2d5-ee7d3ee7caf4", 8 | "version": 1, 9 | "sequenceNumber": 1, 10 | "resource": { 11 | "typeId": "category", 12 | "id": "45251684-d693-409d-9864-f93f486adb95", 13 | }, 14 | "resourceVersion": 1, 15 | "type": "CategoryCreated", 16 | "category": { 17 | "id": "45251684-d693-409d-9864-f93f486adb95", 18 | "version": 1, 19 | "name": {"en": "myCategory"}, 20 | "slug": {"en": "my-category"}, 21 | "ancestors": [], 22 | "orderHint": "0.000014556311799451762128695", 23 | "createdAt": "2016-02-16T13:59:39.945Z", 24 | "lastModifiedAt": "2016-02-16T13:59:39.945Z", 25 | "assets": [], 26 | "lastMessageSequenceNumber": 1, 27 | }, 28 | "createdAt": "2016-02-16T13:59:39.945Z", 29 | "lastModifiedAt": "2016-02-16T13:59:39.945Z", 30 | } 31 | ) 32 | assert isinstance(obj, models.CategoryCreatedMessage) 33 | -------------------------------------------------------------------------------- /tests/platform/test_service_api_clients.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from commercetools.platform import models 4 | from commercetools.platform.client import Client 5 | 6 | 7 | def test_api_client_flow(ct_platform_client: Client, api_client_draft): 8 | api_client = ( 9 | ct_platform_client.with_project_key("test").api_clients().post(api_client_draft) 10 | ) 11 | 12 | assert api_client 13 | assert api_client.id 14 | 15 | deleted_api_client = ( 16 | ct_platform_client.with_project_key("test") 17 | .api_clients() 18 | .with_id(api_client.id) 19 | .delete() 20 | ) 21 | 22 | assert deleted_api_client 23 | assert api_client.id == deleted_api_client.id 24 | 25 | 26 | @pytest.fixture 27 | def api_client_draft(): 28 | return models.ApiClientDraft( 29 | name="Test API Client", scope="manage_project:some_project_key" 30 | ) 31 | -------------------------------------------------------------------------------- /tests/platform/test_service_inventory.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform import models 2 | from commercetools.platform.client import Client 3 | 4 | 5 | def test_inventory_create(ct_platform_client: Client): 6 | inventory = ( 7 | ct_platform_client.with_project_key("unittest") 8 | .inventory() 9 | .post(models.InventoryEntryDraft(sku="1", quantity_on_stock=10)) 10 | ) 11 | 12 | assert inventory.id 13 | assert inventory.quantity_on_stock == 10 14 | 15 | 16 | def test_inventory_with_id_get(ct_platform_client: Client): 17 | inventory = ( 18 | ct_platform_client.with_project_key("unittest") 19 | .inventory() 20 | .post(models.InventoryEntryDraft(sku="1", quantity_on_stock=10)) 21 | ) 22 | 23 | assert inventory.id 24 | assert inventory.quantity_on_stock == 10 25 | 26 | inventory = ( 27 | ct_platform_client.with_project_key("unittest") 28 | .inventory() 29 | .with_id(inventory.id) 30 | .get() 31 | ) 32 | assert inventory.id 33 | assert inventory.quantity_on_stock == 10 34 | 35 | 36 | def test_inventory_with_id_post(ct_platform_client: Client): 37 | inventory = ( 38 | ct_platform_client.with_project_key("unittest") 39 | .inventory() 40 | .post(models.InventoryEntryDraft(sku="1", quantity_on_stock=10)) 41 | ) 42 | 43 | assert inventory.id 44 | assert inventory.quantity_on_stock == 10 45 | 46 | inventory = ( 47 | ct_platform_client.with_project_key("unittest") 48 | .inventory() 49 | .with_id(inventory.id) 50 | .post( 51 | models.InventoryEntryUpdate( 52 | version=inventory.version, 53 | actions=[models.InventoryEntryRemoveQuantityAction(quantity=10)], 54 | ) 55 | ) 56 | ) 57 | assert inventory.id 58 | assert inventory.quantity_on_stock == 0 59 | -------------------------------------------------------------------------------- /tests/platform/test_service_product_discounts.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform import models 2 | from commercetools.platform.client import Client 3 | 4 | 5 | def test_product_discount_with_id_get(ct_platform_client: Client): 6 | product_discount = ( 7 | ct_platform_client.with_project_key("unittest") 8 | .product_discounts() 9 | .post( 10 | models.ProductDiscountDraft( 11 | name=models.LocalizedString(nl="test-discount"), 12 | predicate="", 13 | value=models.ProductDiscountValueRelativeDraft(permyriad=10), 14 | is_active=True, 15 | sort_order="", 16 | ) 17 | ) 18 | ) 19 | assert product_discount 20 | assert product_discount.id 21 | -------------------------------------------------------------------------------- /tests/platform/test_service_states.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from commercetools.platform import models 4 | from commercetools.platform.client import Client 5 | 6 | 7 | def test_state_flow(ct_platform_client: Client, state_draft): 8 | state = ct_platform_client.with_project_key("unittest").states().post(state_draft) 9 | assert state 10 | assert state.id 11 | 12 | new_name = models.LocalizedString({"en": "new_name"}) 13 | new_description = models.LocalizedString({"en": "new_description"}) 14 | update_actions = [ 15 | models.StateSetNameAction(name=new_name), 16 | models.StateSetDescriptionAction(description=new_description), 17 | models.StateChangeInitialAction(initial=True), 18 | models.StateSetRolesAction( 19 | roles=[models.StateRoleEnum.REVIEW_INCLUDED_IN_STATISTICS] 20 | ), 21 | ] 22 | state = ( 23 | ct_platform_client.with_project_key("unittest") 24 | .states() 25 | .with_id(state.id) 26 | .post(models.StateUpdate(version=state.version, actions=update_actions)) 27 | ) 28 | assert state 29 | assert state.name == new_name 30 | assert state.description == new_description 31 | assert state.initial is True 32 | assert state.roles and len(state.roles) == 1 33 | 34 | state = ( 35 | ct_platform_client.with_project_key("unittest") 36 | .states() 37 | .with_id(state.id) 38 | .post( 39 | models.StateUpdate( 40 | version=state.version, actions=[models.StateSetRolesAction(roles=[])] 41 | ) 42 | ) 43 | ) 44 | assert len(state.roles) == 0 45 | 46 | deleted_state = ( 47 | ct_platform_client.with_project_key("unittest") 48 | .states() 49 | .with_id(state.id) 50 | .delete(version=state.version) 51 | ) 52 | assert state.id == deleted_state.id 53 | 54 | 55 | @pytest.fixture 56 | def state_draft(): 57 | return models.StateDraft( 58 | key="test state", 59 | name=models.LocalizedString({"en": "test store"}), 60 | description=models.LocalizedString({"en": "test store"}), 61 | initial=False, 62 | type=models.StateTypeEnum.REVIEW_STATE, 63 | ) 64 | -------------------------------------------------------------------------------- /tests/platform/test_service_tax_category.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform import models 2 | from commercetools.platform.client import Client 3 | 4 | 5 | def test_tax_category_create(ct_platform_client: Client): 6 | tax_category = ( 7 | ct_platform_client.with_project_key("unittest") 8 | .tax_categories() 9 | .post(models.TaxCategoryDraft(name="Hoog", rates=[])) 10 | ) 11 | assert tax_category 12 | assert tax_category.id 13 | assert tax_category.name == "Hoog" 14 | 15 | 16 | def test_tax_category_get_with_id(ct_platform_client: Client): 17 | tax_category = ( 18 | ct_platform_client.with_project_key("unittest") 19 | .tax_categories() 20 | .post(models.TaxCategoryDraft(name="Hoog", rates=[])) 21 | ) 22 | 23 | assert tax_category 24 | assert tax_category.id 25 | assert tax_category.name == "Hoog" 26 | 27 | tax_category = ( 28 | ct_platform_client.with_project_key("unittest") 29 | .tax_categories() 30 | .with_id(tax_category.id) 31 | .get() 32 | ) 33 | assert tax_category 34 | assert tax_category.id 35 | assert tax_category.name == "Hoog" 36 | 37 | 38 | def test_tax_category_create_with_id(ct_platform_client: Client): 39 | tax_category = ( 40 | ct_platform_client.with_project_key("unittest") 41 | .tax_categories() 42 | .post(models.TaxCategoryDraft(name="Hoog", rates=[])) 43 | ) 44 | 45 | assert tax_category.id 46 | assert tax_category.name == "Hoog" 47 | 48 | tax_category = ( 49 | ct_platform_client.with_project_key("unittest") 50 | .tax_categories() 51 | .with_id( 52 | tax_category.id, 53 | ) 54 | .post( 55 | models.TaxCategoryUpdate( 56 | version=tax_category.version, 57 | actions=[ 58 | models.TaxCategorySetDescriptionAction(description="Some text") 59 | ], 60 | ) 61 | ) 62 | ) 63 | assert tax_category 64 | assert tax_category.id 65 | assert tax_category.name == "Hoog" 66 | -------------------------------------------------------------------------------- /tests/platform/test_testing_headers.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from commercetools import CommercetoolsError 4 | from commercetools.platform import models 5 | from commercetools.platform.client import Client 6 | 7 | 8 | def test_correlation_id_is_set_in_exception(ct_platform_client: Client): 9 | product = ( 10 | ct_platform_client.with_project_key("foo") 11 | .products() 12 | .post( 13 | models.ProductDraft( 14 | key="test-product", 15 | name=models.LocalizedString(en=f"my-product"), 16 | slug=models.LocalizedString(en=f"my-product"), 17 | product_type=models.ProductTypeResourceIdentifier(key="dummy"), 18 | ) 19 | ) 20 | ) 21 | 22 | product = ( 23 | ct_platform_client.with_project_key("foo") 24 | .products() 25 | .with_id(product.id) 26 | .post( 27 | models.ProductUpdate( 28 | version=product.version, 29 | actions=[ 30 | models.ProductChangeSlugAction( 31 | slug=models.LocalizedString(nl="nl-slug2") 32 | ) 33 | ], 34 | ) 35 | ) 36 | ) 37 | 38 | # This should raise a version conflict error 39 | with pytest.raises(CommercetoolsError) as exc: 40 | product = ( 41 | ct_platform_client.with_project_key("foo") 42 | .products() 43 | .with_id(product.id) 44 | .post( 45 | models.ProductUpdate( 46 | version=1, # conflicting version 47 | actions=[ 48 | models.ProductChangeSlugAction( 49 | slug=models.LocalizedString(nl="nl-slug2") 50 | ) 51 | ], 52 | ) 53 | ) 54 | ) 55 | 56 | assert exc.value.correlation_id is not None 57 | -------------------------------------------------------------------------------- /tests/platform/test_types.py: -------------------------------------------------------------------------------- 1 | from commercetools.platform import models 2 | 3 | 4 | def test_non_equality(): 5 | obj_1 = models.ProductDraft( 6 | slug=models.LocalizedString(en="test-2"), 7 | name=models.LocalizedString(en="test-1"), 8 | product_type=models.ProductTypeResourceIdentifier(key="dummy"), 9 | ) 10 | obj_2 = models.ProductDraft( 11 | slug=models.LocalizedString(en="test-1"), 12 | name=models.LocalizedString(en="test-1"), 13 | product_type=models.ProductTypeResourceIdentifier(key="dummy"), 14 | ) 15 | assert obj_1 != obj_2 16 | 17 | 18 | def test_equality(): 19 | obj_1 = models.ProductDraft( 20 | slug=models.LocalizedString(en="test-1"), 21 | name=models.LocalizedString(en="test-1"), 22 | product_type=models.ProductTypeResourceIdentifier(key="dummy"), 23 | ) 24 | obj_2 = models.ProductDraft( 25 | slug=models.LocalizedString(en="test-1"), 26 | name=models.LocalizedString(en="test-1"), 27 | product_type=models.ProductTypeResourceIdentifier(key="dummy"), 28 | ) 29 | assert obj_1 == obj_2 30 | -------------------------------------------------------------------------------- /tests/platform/test_utils.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from commercetools.utils import fix_token_url 4 | 5 | 6 | @pytest.mark.parametrize( 7 | "token_url,expected_url", 8 | [ 9 | ( 10 | "https://auth.europe-west1.gcp.commercetools.com", 11 | "https://auth.europe-west1.gcp.commercetools.com/oauth/token", 12 | ), 13 | ( 14 | "https://auth.europe-west1.gcp.commercetools.com/oauth/token", 15 | "https://auth.europe-west1.gcp.commercetools.com/oauth/token", 16 | ), 17 | ("https://auth.commercetools.co", "https://auth.commercetools.co/oauth/token"), 18 | ( 19 | "https://auth.europe-west1.gcp.commercetools.com?test=123", 20 | "https://auth.europe-west1.gcp.commercetools.com/oauth/token?test=123", 21 | ), 22 | ], 23 | ) 24 | def test_fix_token_url(token_url, expected_url): 25 | assert fix_token_url(token_url) == expected_url 26 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py36,py37,py38,py39,py310 3 | 4 | [gh-actions] 5 | python = 6 | 3.6: py36 7 | 3.7: py37 8 | 3.8: py38 9 | 3.9: py39 10 | 3.10: py310 11 | 12 | [testenv] 13 | commands = coverage run --source commercetools --parallel -m pytest {posargs} 14 | extras = test 15 | 16 | [testenv:coverage-report] 17 | basepython = python3.10 18 | deps = coverage[toml] 19 | skip_install = true 20 | commands = 21 | coverage combine 22 | coverage xml 23 | coverage report 24 | 25 | [testenv:format] 26 | basepython = python3.10 27 | deps = 28 | black==24.3.0 29 | isort[toml]==5.10.1 30 | skip_install = true 31 | commands = 32 | isort --check-only src tests 33 | black --check src/ tests/ 34 | --------------------------------------------------------------------------------