brevo-python 4.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brevo/__init__.py +2253 -0
- brevo/account/__init__.py +79 -0
- brevo/account/client.py +317 -0
- brevo/account/raw_client.py +341 -0
- brevo/account/types/__init__.py +77 -0
- brevo/account/types/get_account_activity_response.py +24 -0
- brevo/account/types/get_account_activity_response_logs_item.py +45 -0
- brevo/account/types/get_account_response.py +85 -0
- brevo/account/types/get_account_response_address.py +43 -0
- brevo/account/types/get_account_response_date_time_preferences.py +38 -0
- brevo/account/types/get_account_response_marketing_automation.py +29 -0
- brevo/account/types/get_account_response_plan_item.py +53 -0
- brevo/account/types/get_account_response_plan_item_type.py +5 -0
- brevo/account/types/get_account_response_plan_verticals_item.py +63 -0
- brevo/account/types/get_account_response_plan_verticals_item_plan_category.py +5 -0
- brevo/account/types/get_account_response_plan_verticals_item_status.py +5 -0
- brevo/account/types/get_account_response_plan_verticals_item_users.py +35 -0
- brevo/account/types/get_account_response_relay.py +34 -0
- brevo/account/types/get_account_response_relay_data.py +40 -0
- brevo/balance/__init__.py +139 -0
- brevo/balance/client.py +2589 -0
- brevo/balance/raw_client.py +4538 -0
- brevo/balance/types/__init__.py +169 -0
- brevo/balance/types/create_balance_limit_request_constraint_type.py +5 -0
- brevo/balance/types/create_balance_limit_request_duration_unit.py +5 -0
- brevo/balance/types/create_balance_limit_request_transaction_type.py +5 -0
- brevo/balance/types/create_balance_order_response.py +96 -0
- brevo/balance/types/get_balance_definition_list_request_sort.py +5 -0
- brevo/balance/types/get_balance_definition_list_request_sort_field.py +5 -0
- brevo/balance/types/get_balance_definition_list_request_version.py +5 -0
- brevo/balance/types/get_balance_definition_list_response.py +24 -0
- brevo/balance/types/get_balance_definition_request_version.py +5 -0
- brevo/balance/types/get_balance_limit_request_version.py +5 -0
- brevo/balance/types/get_contact_balances_response.py +30 -0
- brevo/balance/types/get_contact_balances_response_balances_item.py +33 -0
- brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_request_sort.py +5 -0
- brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_request_sort_field.py +7 -0
- brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response.py +57 -0
- brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item.py +77 -0
- brevo/balance/types/get_subscription_balances_response.py +21 -0
- brevo/balance/types/get_subscription_balances_response_balance_item.py +30 -0
- brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_modifier.py +7 -0
- brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_unit.py +7 -0
- brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_amount_overtaking_strategy.py +7 -0
- brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_credit_rounding.py +7 -0
- brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_debit_rounding.py +7 -0
- brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_unit.py +26 -0
- brevo/balance/types/post_loyalty_balance_programs_pid_subscriptions_cid_balances_response.py +66 -0
- brevo/balance/types/update_balance_definition_request_balance_availability_duration_modifier.py +7 -0
- brevo/balance/types/update_balance_definition_request_balance_availability_duration_unit.py +7 -0
- brevo/balance/types/update_balance_definition_request_balance_option_amount_overtaking_strategy.py +7 -0
- brevo/balance/types/update_balance_definition_request_balance_option_credit_rounding.py +7 -0
- brevo/balance/types/update_balance_definition_request_balance_option_debit_rounding.py +7 -0
- brevo/balance/types/update_balance_definition_request_unit.py +26 -0
- brevo/balance/types/update_balance_limit_request_constraint_type.py +5 -0
- brevo/balance/types/update_balance_limit_request_duration_unit.py +5 -0
- brevo/balance/types/update_balance_limit_request_transaction_type.py +5 -0
- brevo/client.py +773 -0
- brevo/companies/__init__.py +61 -0
- brevo/companies/client.py +994 -0
- brevo/companies/raw_client.py +1285 -0
- brevo/companies/types/__init__.py +59 -0
- brevo/companies/types/get_companies_request_sort.py +5 -0
- brevo/companies/types/get_companies_response.py +28 -0
- brevo/companies/types/get_crm_attributes_companies_response_item.py +40 -0
- brevo/companies/types/post_companies_import_response.py +26 -0
- brevo/companies/types/post_companies_response.py +27 -0
- brevo/companies/types/post_crm_attributes_request_attribute_type.py +7 -0
- brevo/companies/types/post_crm_attributes_request_object_type.py +5 -0
- brevo/companies/types/post_crm_attributes_response.py +23 -0
- brevo/contacts/__init__.py +289 -0
- brevo/contacts/client.py +3298 -0
- brevo/contacts/raw_client.py +4614 -0
- brevo/contacts/types/__init__.py +309 -0
- brevo/contacts/types/add_contact_to_list_request_body.py +11 -0
- brevo/contacts/types/add_contact_to_list_request_body_emails.py +23 -0
- brevo/contacts/types/add_contact_to_list_request_body_ext_ids.py +29 -0
- brevo/contacts/types/add_contact_to_list_request_body_ids.py +23 -0
- brevo/contacts/types/create_attribute_request_attribute_category.py +7 -0
- brevo/contacts/types/create_attribute_request_enumeration_item.py +28 -0
- brevo/contacts/types/create_attribute_request_type.py +7 -0
- brevo/contacts/types/create_contact_request_attributes_value.py +5 -0
- brevo/contacts/types/create_contact_response.py +23 -0
- brevo/contacts/types/create_doi_contact_request_attributes_value.py +5 -0
- brevo/contacts/types/create_folder_response.py +23 -0
- brevo/contacts/types/create_list_response.py +23 -0
- brevo/contacts/types/delete_attribute_request_attribute_category.py +7 -0
- brevo/contacts/types/delete_contact_request_identifier.py +5 -0
- brevo/contacts/types/delete_contact_request_identifier_type.py +7 -0
- brevo/contacts/types/get_attributes_response.py +24 -0
- brevo/contacts/types/get_attributes_response_attributes_item.py +57 -0
- brevo/contacts/types/get_attributes_response_attributes_item_category.py +7 -0
- brevo/contacts/types/get_attributes_response_attributes_item_enumeration_item.py +28 -0
- brevo/contacts/types/get_attributes_response_attributes_item_type.py +7 -0
- brevo/contacts/types/get_contact_info_request_identifier.py +5 -0
- brevo/contacts/types/get_contact_info_request_identifier_type.py +7 -0
- brevo/contacts/types/get_contact_info_response.py +80 -0
- brevo/contacts/types/get_contact_info_response_attributes.py +22 -0
- brevo/contacts/types/get_contact_info_response_statistics.py +86 -0
- brevo/contacts/types/get_contact_info_response_statistics_clicked_item.py +33 -0
- brevo/contacts/types/get_contact_info_response_statistics_clicked_item_links_item.py +40 -0
- brevo/contacts/types/get_contact_info_response_statistics_complaints_item.py +31 -0
- brevo/contacts/types/get_contact_info_response_statistics_delivered_item.py +31 -0
- brevo/contacts/types/get_contact_info_response_statistics_hard_bounces_item.py +31 -0
- brevo/contacts/types/get_contact_info_response_statistics_messages_sent_item.py +31 -0
- brevo/contacts/types/get_contact_info_response_statistics_opened_item.py +40 -0
- brevo/contacts/types/get_contact_info_response_statistics_soft_bounces_item.py +31 -0
- brevo/contacts/types/get_contact_info_response_statistics_transac_attributes_item.py +18 -0
- brevo/contacts/types/get_contact_info_response_statistics_unsubscriptions.py +43 -0
- brevo/contacts/types/get_contact_info_response_statistics_unsubscriptions_admin_unsubscription_item.py +30 -0
- brevo/contacts/types/get_contact_info_response_statistics_unsubscriptions_user_unsubscription_item.py +35 -0
- brevo/contacts/types/get_contact_stats_request_identifier.py +5 -0
- brevo/contacts/types/get_contact_stats_response.py +59 -0
- brevo/contacts/types/get_contact_stats_response_clicked_item.py +28 -0
- brevo/contacts/types/get_contact_stats_response_clicked_item_links_item.py +40 -0
- brevo/contacts/types/get_contact_stats_response_complaints_item.py +31 -0
- brevo/contacts/types/get_contact_stats_response_delivered_item.py +31 -0
- brevo/contacts/types/get_contact_stats_response_hard_bounces_item.py +31 -0
- brevo/contacts/types/get_contact_stats_response_messages_sent_item.py +31 -0
- brevo/contacts/types/get_contact_stats_response_opened_item.py +40 -0
- brevo/contacts/types/get_contact_stats_response_soft_bounces_item.py +31 -0
- brevo/contacts/types/get_contact_stats_response_transac_attributes_item.py +31 -0
- brevo/contacts/types/get_contact_stats_response_unsubscriptions.py +39 -0
- brevo/contacts/types/get_contact_stats_response_unsubscriptions_admin_unsubscription_item.py +30 -0
- brevo/contacts/types/get_contact_stats_response_unsubscriptions_user_unsubscription_item.py +35 -0
- brevo/contacts/types/get_contacts_from_list_request_sort.py +5 -0
- brevo/contacts/types/get_contacts_request_sort.py +5 -0
- brevo/contacts/types/get_folder_lists_request_sort.py +5 -0
- brevo/contacts/types/get_folder_lists_response.py +26 -0
- brevo/contacts/types/get_folders_request_sort.py +5 -0
- brevo/contacts/types/get_folders_response.py +26 -0
- brevo/contacts/types/get_list_response.py +68 -0
- brevo/contacts/types/get_list_response_campaign_stats_item.py +26 -0
- brevo/contacts/types/get_lists_request_sort.py +5 -0
- brevo/contacts/types/get_lists_response.py +29 -0
- brevo/contacts/types/get_lists_response_lists_item.py +49 -0
- brevo/contacts/types/get_segments_request_sort.py +5 -0
- brevo/contacts/types/get_segments_response.py +29 -0
- brevo/contacts/types/get_segments_response_segments_item.py +41 -0
- brevo/contacts/types/import_contacts_request_json_body_item.py +25 -0
- brevo/contacts/types/import_contacts_request_new_list.py +41 -0
- brevo/contacts/types/import_contacts_response.py +26 -0
- brevo/contacts/types/remove_contact_from_list_request_body.py +15 -0
- brevo/contacts/types/remove_contact_from_list_request_body_all.py +29 -0
- brevo/contacts/types/remove_contact_from_list_request_body_emails.py +23 -0
- brevo/contacts/types/remove_contact_from_list_request_body_ext_ids.py +29 -0
- brevo/contacts/types/remove_contact_from_list_request_body_ids.py +23 -0
- brevo/contacts/types/request_contact_export_request_custom_contact_filter.py +90 -0
- brevo/contacts/types/request_contact_export_request_custom_contact_filter_action_for_contacts.py +7 -0
- brevo/contacts/types/request_contact_export_request_custom_contact_filter_action_for_email_campaigns.py +8 -0
- brevo/contacts/types/request_contact_export_request_custom_contact_filter_action_for_sms_campaigns.py +7 -0
- brevo/contacts/types/request_contact_export_response.py +26 -0
- brevo/contacts/types/update_attribute_request_attribute_category.py +7 -0
- brevo/contacts/types/update_attribute_request_enumeration_item.py +28 -0
- brevo/contacts/types/update_batch_contacts_request_contacts_item.py +80 -0
- brevo/contacts/types/update_contact_request_attributes_value.py +5 -0
- brevo/contacts/types/update_contact_request_identifier.py +5 -0
- brevo/contacts/types/update_contact_request_identifier_type.py +7 -0
- brevo/conversations/__init__.py +34 -0
- brevo/conversations/client.py +912 -0
- brevo/conversations/raw_client.py +1328 -0
- brevo/conversations/types/__init__.py +36 -0
- brevo/conversations/types/put_conversations_visitor_group_response.py +31 -0
- brevo/core/__init__.py +125 -0
- brevo/core/api_error.py +23 -0
- brevo/core/client_wrapper.py +100 -0
- brevo/core/datetime_utils.py +28 -0
- brevo/core/file.py +67 -0
- brevo/core/force_multipart.py +18 -0
- brevo/core/http_client.py +776 -0
- brevo/core/http_response.py +59 -0
- brevo/core/http_sse/__init__.py +42 -0
- brevo/core/http_sse/_api.py +112 -0
- brevo/core/http_sse/_decoders.py +61 -0
- brevo/core/http_sse/_exceptions.py +7 -0
- brevo/core/http_sse/_models.py +17 -0
- brevo/core/jsonable_encoder.py +108 -0
- brevo/core/logging.py +107 -0
- brevo/core/pydantic_utilities.py +577 -0
- brevo/core/query_encoder.py +58 -0
- brevo/core/remove_none_from_dict.py +11 -0
- brevo/core/request_options.py +35 -0
- brevo/core/serialization.py +276 -0
- brevo/core/unchecked_base_model.py +376 -0
- brevo/coupons/__init__.py +49 -0
- brevo/coupons/client.py +550 -0
- brevo/coupons/raw_client.py +839 -0
- brevo/coupons/types/__init__.py +47 -0
- brevo/coupons/types/create_coupon_collection_response.py +23 -0
- brevo/coupons/types/get_coupon_collections_request_sort.py +5 -0
- brevo/coupons/types/get_coupon_collections_request_sort_by.py +7 -0
- brevo/coupons/types/update_coupon_collection_response.py +35 -0
- brevo/custom_objects/__init__.py +139 -0
- brevo/custom_objects/client.py +437 -0
- brevo/custom_objects/raw_client.py +711 -0
- brevo/custom_objects/types/__init__.py +177 -0
- brevo/custom_objects/types/batch_delete_object_records_request_identifiers.py +10 -0
- brevo/custom_objects/types/batch_delete_object_records_request_identifiers_ext_ids.py +23 -0
- brevo/custom_objects/types/batch_delete_object_records_request_identifiers_ids.py +23 -0
- brevo/custom_objects/types/batch_delete_object_records_response.py +27 -0
- brevo/custom_objects/types/getrecords_request_association.py +5 -0
- brevo/custom_objects/types/getrecords_request_sort.py +5 -0
- brevo/custom_objects/types/getrecords_response.py +26 -0
- brevo/custom_objects/types/getrecords_response_records_item.py +51 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item.py +10 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_one.py +28 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item.py +15 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_one.py +28 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_one_identifiers.py +27 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_zero.py +28 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_zero_identifiers.py +27 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero.py +28 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item.py +15 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_one.py +28 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_one_identifiers.py +27 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_zero.py +28 -0
- brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_zero_identifiers.py +27 -0
- brevo/custom_objects/types/getrecords_response_records_item_identifiers.py +32 -0
- brevo/custom_objects/types/upsertrecords_request_records_item.py +31 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item.py +12 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one.py +28 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item.py +15 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_one.py +20 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero.py +28 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers.py +32 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero.py +28 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item.py +23 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item_identifiers.py +28 -0
- brevo/custom_objects/types/upsertrecords_request_records_item_identifiers.py +32 -0
- brevo/custom_objects/types/upsertrecords_response.py +29 -0
- brevo/deals/__init__.py +52 -0
- brevo/deals/client.py +1013 -0
- brevo/deals/raw_client.py +1326 -0
- brevo/deals/types/__init__.py +50 -0
- brevo/deals/types/get_crm_attributes_deals_response_item.py +40 -0
- brevo/deals/types/get_crm_deals_request_sort.py +5 -0
- brevo/deals/types/get_crm_deals_response.py +28 -0
- brevo/deals/types/post_crm_deals_import_response.py +26 -0
- brevo/deals/types/post_crm_deals_response.py +27 -0
- brevo/domains/__init__.py +79 -0
- brevo/domains/client.py +506 -0
- brevo/domains/raw_client.py +698 -0
- brevo/domains/types/__init__.py +83 -0
- brevo/domains/types/authenticate_domain_response.py +28 -0
- brevo/domains/types/create_domain_response.py +44 -0
- brevo/domains/types/create_domain_response_dns_records.py +40 -0
- brevo/domains/types/create_domain_response_dns_records_brevo_code.py +42 -0
- brevo/domains/types/create_domain_response_dns_records_dkim_record.py +42 -0
- brevo/domains/types/create_domain_response_dns_records_dmarc_record.py +42 -0
- brevo/domains/types/get_domain_configuration_response.py +41 -0
- brevo/domains/types/get_domain_configuration_response_dns_records.py +44 -0
- brevo/domains/types/get_domain_configuration_response_dns_records_brevo_code.py +42 -0
- brevo/domains/types/get_domain_configuration_response_dns_records_dkim_record.py +42 -0
- brevo/domains/types/get_domain_configuration_response_dns_records_dmarc_record.py +42 -0
- brevo/domains/types/get_domains_response.py +39 -0
- brevo/domains/types/get_domains_response_domains_item.py +56 -0
- brevo/domains/types/get_domains_response_domains_item_creator.py +41 -0
- brevo/ecommerce/__init__.py +112 -0
- brevo/ecommerce/client.py +2176 -0
- brevo/ecommerce/raw_client.py +2895 -0
- brevo/ecommerce/types/__init__.py +124 -0
- brevo/ecommerce/types/create_batch_order_response.py +28 -0
- brevo/ecommerce/types/create_product_alert_request_contact_identifiers.py +33 -0
- brevo/ecommerce/types/create_update_batch_category_request_categories_item.py +48 -0
- brevo/ecommerce/types/create_update_batch_category_response.py +31 -0
- brevo/ecommerce/types/create_update_batch_products_request_products_item.py +89 -0
- brevo/ecommerce/types/create_update_batch_products_request_products_item_meta_info_value.py +5 -0
- brevo/ecommerce/types/create_update_batch_products_response.py +31 -0
- brevo/ecommerce/types/create_update_category_response.py +23 -0
- brevo/ecommerce/types/create_update_product_request_meta_info_value.py +5 -0
- brevo/ecommerce/types/create_update_product_response.py +23 -0
- brevo/ecommerce/types/get_categories_request_sort.py +5 -0
- brevo/ecommerce/types/get_categories_response.py +25 -0
- brevo/ecommerce/types/get_ecommerce_attribution_metrics_conversion_source_conversion_source_id_request_conversion_source.py +7 -0
- brevo/ecommerce/types/get_ecommerce_attribution_metrics_conversion_source_conversion_source_id_response.py +40 -0
- brevo/ecommerce/types/get_ecommerce_attribution_metrics_conversion_source_conversion_source_id_response_conversion_source.py +7 -0
- brevo/ecommerce/types/get_ecommerce_attribution_metrics_response.py +30 -0
- brevo/ecommerce/types/get_ecommerce_attribution_metrics_response_totals.py +32 -0
- brevo/ecommerce/types/get_ecommerce_attribution_products_conversion_source_conversion_source_id_request_conversion_source.py +7 -0
- brevo/ecommerce/types/get_ecommerce_attribution_products_conversion_source_conversion_source_id_response.py +28 -0
- brevo/ecommerce/types/get_ecommerce_attribution_products_conversion_source_conversion_source_id_response_products_item.py +33 -0
- brevo/ecommerce/types/get_ecommerce_config_display_currency_response.py +23 -0
- brevo/ecommerce/types/get_orders_request_sort.py +5 -0
- brevo/ecommerce/types/get_products_request_sort.py +5 -0
- brevo/ecommerce/types/get_products_response.py +26 -0
- brevo/ecommerce/types/set_config_display_currency_response.py +23 -0
- brevo/email_campaigns/__init__.py +139 -0
- brevo/email_campaigns/client.py +1864 -0
- brevo/email_campaigns/raw_client.py +2472 -0
- brevo/email_campaigns/types/__init__.py +141 -0
- brevo/email_campaigns/types/create_email_campaign_request_email_expiration_date.py +33 -0
- brevo/email_campaigns/types/create_email_campaign_request_email_expiration_date_unit.py +5 -0
- brevo/email_campaigns/types/create_email_campaign_request_recipients.py +52 -0
- brevo/email_campaigns/types/create_email_campaign_request_sender.py +37 -0
- brevo/email_campaigns/types/create_email_campaign_request_winner_criteria.py +5 -0
- brevo/email_campaigns/types/create_email_campaign_response.py +23 -0
- brevo/email_campaigns/types/email_export_recipients_request_recipients_type.py +10 -0
- brevo/email_campaigns/types/email_export_recipients_response.py +26 -0
- brevo/email_campaigns/types/get_ab_test_campaign_result_response.py +64 -0
- brevo/email_campaigns/types/get_ab_test_campaign_result_response_clicked_links.py +28 -0
- brevo/email_campaigns/types/get_ab_test_campaign_result_response_statistics.py +32 -0
- brevo/email_campaigns/types/get_ab_test_campaign_result_response_winning_criteria.py +5 -0
- brevo/email_campaigns/types/get_ab_test_campaign_result_response_winning_version.py +7 -0
- brevo/email_campaigns/types/get_email_campaign_request_statistics.py +7 -0
- brevo/email_campaigns/types/get_email_campaign_response.py +234 -0
- brevo/email_campaigns/types/get_email_campaign_response_sender.py +33 -0
- brevo/email_campaigns/types/get_email_campaign_response_status.py +7 -0
- brevo/email_campaigns/types/get_email_campaign_response_type.py +5 -0
- brevo/email_campaigns/types/get_email_campaigns_request_sort.py +5 -0
- brevo/email_campaigns/types/get_email_campaigns_request_statistics.py +7 -0
- brevo/email_campaigns/types/get_email_campaigns_request_status.py +7 -0
- brevo/email_campaigns/types/get_email_campaigns_request_type.py +5 -0
- brevo/email_campaigns/types/get_email_campaigns_response.py +25 -0
- brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item.py +234 -0
- brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_sender.py +33 -0
- brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_status.py +7 -0
- brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_type.py +5 -0
- brevo/email_campaigns/types/get_shared_template_url_response.py +29 -0
- brevo/email_campaigns/types/update_email_campaign_request_email_expiration_date.py +33 -0
- brevo/email_campaigns/types/update_email_campaign_request_email_expiration_date_unit.py +5 -0
- brevo/email_campaigns/types/update_email_campaign_request_recipients.py +53 -0
- brevo/email_campaigns/types/update_email_campaign_request_sender.py +37 -0
- brevo/email_campaigns/types/update_email_campaign_request_winner_criteria.py +5 -0
- brevo/email_campaigns/types/upload_image_to_gallery_response.py +23 -0
- brevo/environment.py +7 -0
- brevo/errors/__init__.py +80 -0
- brevo/errors/bad_request_error.py +10 -0
- brevo/errors/conflict_error.py +11 -0
- brevo/errors/expectation_failed_error.py +11 -0
- brevo/errors/failed_dependency_error.py +10 -0
- brevo/errors/forbidden_error.py +10 -0
- brevo/errors/internal_server_error.py +10 -0
- brevo/errors/method_not_allowed_error.py +11 -0
- brevo/errors/not_found_error.py +10 -0
- brevo/errors/payment_required_error.py +11 -0
- brevo/errors/precondition_failed_error.py +11 -0
- brevo/errors/too_early_error.py +11 -0
- brevo/errors/too_many_requests_error.py +11 -0
- brevo/errors/unauthorized_error.py +10 -0
- brevo/errors/unprocessable_entity_error.py +11 -0
- brevo/errors/unsupported_media_type_error.py +11 -0
- brevo/event/__init__.py +52 -0
- brevo/event/client.py +184 -0
- brevo/event/raw_client.py +230 -0
- brevo/event/types/__init__.py +50 -0
- brevo/event/types/create_event_request_contact_properties_value.py +5 -0
- brevo/event/types/create_event_request_event_properties_value.py +5 -0
- brevo/event/types/create_event_request_identifiers.py +52 -0
- brevo/event/types/create_event_request_object.py +33 -0
- brevo/event/types/create_event_request_object_identifiers.py +32 -0
- brevo/external_feeds/__init__.py +79 -0
- brevo/external_feeds/client.py +915 -0
- brevo/external_feeds/raw_client.py +1087 -0
- brevo/external_feeds/types/__init__.py +77 -0
- brevo/external_feeds/types/create_external_feed_request_auth_type.py +5 -0
- brevo/external_feeds/types/create_external_feed_request_headers_item.py +28 -0
- brevo/external_feeds/types/create_external_feed_response.py +23 -0
- brevo/external_feeds/types/get_all_external_feeds_request_auth_type.py +5 -0
- brevo/external_feeds/types/get_all_external_feeds_request_sort.py +5 -0
- brevo/external_feeds/types/get_all_external_feeds_response.py +29 -0
- brevo/external_feeds/types/get_all_external_feeds_response_feeds_item.py +96 -0
- brevo/external_feeds/types/get_all_external_feeds_response_feeds_item_auth_type.py +5 -0
- brevo/external_feeds/types/get_all_external_feeds_response_feeds_item_headers_item.py +28 -0
- brevo/external_feeds/types/get_external_feed_by_uuid_response.py +105 -0
- brevo/external_feeds/types/get_external_feed_by_uuid_response_auth_type.py +5 -0
- brevo/external_feeds/types/get_external_feed_by_uuid_response_headers_item.py +28 -0
- brevo/external_feeds/types/update_external_feed_request_auth_type.py +5 -0
- brevo/external_feeds/types/update_external_feed_request_headers_item.py +28 -0
- brevo/files/__init__.py +38 -0
- brevo/files/client.py +479 -0
- brevo/files/raw_client.py +675 -0
- brevo/files/types/__init__.py +40 -0
- brevo/files/types/get_crm_files_id_response.py +30 -0
- brevo/files/types/get_crm_files_request_entity.py +5 -0
- brevo/files/types/get_crm_files_request_sort.py +5 -0
- brevo/inbound_parsing/__init__.py +58 -0
- brevo/inbound_parsing/client.py +323 -0
- brevo/inbound_parsing/raw_client.py +420 -0
- brevo/inbound_parsing/types/__init__.py +60 -0
- brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response.py +72 -0
- brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response_attachments_item.py +40 -0
- brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response_logs_item.py +30 -0
- brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response_logs_item_type.py +7 -0
- brevo/inbound_parsing/types/get_inbound_email_events_request_sort.py +5 -0
- brevo/inbound_parsing/types/get_inbound_email_events_response.py +21 -0
- brevo/inbound_parsing/types/get_inbound_email_events_response_events_item.py +42 -0
- brevo/master_account/__init__.py +202 -0
- brevo/master_account/client.py +2757 -0
- brevo/master_account/raw_client.py +3351 -0
- brevo/master_account/types/__init__.py +244 -0
- brevo/master_account/types/get_corporate_group_id_response.py +31 -0
- brevo/master_account/types/get_corporate_group_id_response_group.py +35 -0
- brevo/master_account/types/get_corporate_group_id_response_sub_accounts_item.py +35 -0
- brevo/master_account/types/get_corporate_group_id_response_users_item.py +36 -0
- brevo/master_account/types/get_corporate_invited_users_list_response.py +24 -0
- brevo/master_account/types/get_corporate_invited_users_list_response_users_item.py +50 -0
- brevo/master_account/types/get_corporate_invited_users_list_response_users_item_feature_access.py +69 -0
- brevo/master_account/types/get_corporate_invited_users_list_response_users_item_groups.py +32 -0
- brevo/master_account/types/get_corporate_ip_response_item.py +22 -0
- brevo/master_account/types/get_corporate_master_account_response.py +57 -0
- brevo/master_account/types/get_corporate_master_account_response_billing_info.py +48 -0
- brevo/master_account/types/get_corporate_master_account_response_billing_info_address.py +50 -0
- brevo/master_account/types/get_corporate_master_account_response_billing_info_name.py +35 -0
- brevo/master_account/types/get_corporate_master_account_response_plan_info.py +63 -0
- brevo/master_account/types/get_corporate_master_account_response_plan_info_features_item.py +62 -0
- brevo/master_account/types/get_corporate_master_account_response_plan_info_plan_period.py +5 -0
- brevo/master_account/types/get_corporate_sub_account_id_response.py +48 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_groups_item.py +28 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info.py +42 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits.py +65 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_emails.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_external_feeds.py +33 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_sms.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_whatsapp.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_wp_subscribers.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features.py +58 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_inbox.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_landing_page.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_sales_users.py +33 -0
- brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_users.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_response.py +32 -0
- brevo/master_account/types/get_corporate_sub_account_response_sub_accounts_item.py +48 -0
- brevo/master_account/types/get_corporate_sub_account_response_sub_accounts_item_groups_item.py +28 -0
- brevo/master_account/types/get_corporate_user_permission_response.py +40 -0
- brevo/master_account/types/get_corporate_user_permission_response_feature_access.py +62 -0
- brevo/master_account/types/get_corporate_user_permission_response_groups_item.py +32 -0
- brevo/master_account/types/get_sub_account_groups_response_item.py +30 -0
- brevo/master_account/types/invite_admin_user_request_privileges_item.py +38 -0
- brevo/master_account/types/invite_admin_user_request_privileges_item_feature.py +18 -0
- brevo/master_account/types/invite_admin_user_request_privileges_item_permissions_item.py +7 -0
- brevo/master_account/types/invite_admin_user_response.py +20 -0
- brevo/master_account/types/post_corporate_group_response.py +20 -0
- brevo/master_account/types/post_corporate_sub_account_key_response.py +28 -0
- brevo/master_account/types/post_corporate_sub_account_request_language.py +5 -0
- brevo/master_account/types/post_corporate_sub_account_response.py +23 -0
- brevo/master_account/types/post_corporate_sub_account_sso_token_request_target.py +17 -0
- brevo/master_account/types/put_corporate_sub_account_id_plan_request_credits.py +59 -0
- brevo/master_account/types/put_corporate_sub_account_id_plan_request_features.py +44 -0
- brevo/master_account/types/put_corporate_sub_accounts_plan_request_credits.py +59 -0
- brevo/master_account/types/put_corporate_sub_accounts_plan_request_features.py +39 -0
- brevo/master_account/types/put_corporate_user_email_permissions_request_privileges_item.py +42 -0
- brevo/master_account/types/put_corporate_user_email_permissions_request_privileges_item_feature.py +18 -0
- brevo/master_account/types/put_corporate_user_email_permissions_request_privileges_item_permissions_item.py +10 -0
- brevo/master_account/types/put_corporate_user_invitation_action_email_request_action.py +5 -0
- brevo/master_account/types/put_corporate_user_invitation_action_email_response.py +23 -0
- brevo/notes/__init__.py +38 -0
- brevo/notes/client.py +548 -0
- brevo/notes/raw_client.py +766 -0
- brevo/notes/types/__init__.py +40 -0
- brevo/notes/types/get_crm_notes_request_entity.py +5 -0
- brevo/notes/types/get_crm_notes_request_sort.py +5 -0
- brevo/notes/types/post_crm_notes_response.py +27 -0
- brevo/payments/__init__.py +38 -0
- brevo/payments/client.py +315 -0
- brevo/payments/raw_client.py +532 -0
- brevo/payments/types/__init__.py +40 -0
- brevo/payments/types/create_payment_request_response.py +28 -0
- brevo/payments/types/get_payment_request_response.py +47 -0
- brevo/payments/types/get_payment_request_response_status.py +5 -0
- brevo/process/__init__.py +79 -0
- brevo/process/client.py +304 -0
- brevo/process/raw_client.py +372 -0
- brevo/process/types/__init__.py +77 -0
- brevo/process/types/get_process_response.py +62 -0
- brevo/process/types/get_process_response_info.py +36 -0
- brevo/process/types/get_process_response_info_export.py +32 -0
- brevo/process/types/get_process_response_info_import.py +57 -0
- brevo/process/types/get_process_response_name.py +16 -0
- brevo/process/types/get_process_response_status.py +7 -0
- brevo/process/types/get_processes_request_sort.py +5 -0
- brevo/process/types/get_processes_response.py +29 -0
- brevo/process/types/get_processes_response_processes_item.py +62 -0
- brevo/process/types/get_processes_response_processes_item_info.py +36 -0
- brevo/process/types/get_processes_response_processes_item_info_export.py +32 -0
- brevo/process/types/get_processes_response_processes_item_info_import.py +57 -0
- brevo/process/types/get_processes_response_processes_item_name.py +16 -0
- brevo/process/types/get_processes_response_processes_item_status.py +7 -0
- brevo/program/__init__.py +67 -0
- brevo/program/client.py +1128 -0
- brevo/program/raw_client.py +2526 -0
- brevo/program/types/__init__.py +67 -0
- brevo/program/types/get_lp_list_request_sort_field.py +5 -0
- brevo/program/types/get_lp_list_response.py +24 -0
- brevo/program/types/get_parameter_subscription_info_response.py +44 -0
- brevo/program/types/get_parameter_subscription_info_response_balance.py +41 -0
- brevo/program/types/get_parameter_subscription_info_response_balance_balances_item.py +30 -0
- brevo/program/types/get_parameter_subscription_info_response_members_item.py +36 -0
- brevo/program/types/get_parameter_subscription_info_response_reward_item.py +66 -0
- brevo/program/types/get_parameter_subscription_info_response_tier_item.py +56 -0
- brevo/program/types/subscribe_member_to_a_subscription_response.py +46 -0
- brevo/program/types/subscribe_to_loyalty_program_response.py +56 -0
- brevo/py.typed +0 -0
- brevo/reward/__init__.py +115 -0
- brevo/reward/client.py +1285 -0
- brevo/reward/raw_client.py +2564 -0
- brevo/reward/types/__init__.py +139 -0
- brevo/reward/types/create_reward_response.py +64 -0
- brevo/reward/types/create_voucher_response.py +76 -0
- brevo/reward/types/get_code_count_response.py +23 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_offers_request_version.py +5 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_offers_response.py +34 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_offers_response_items_item.py +67 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_request_version.py +5 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response.py +269 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_expiration_modifier.py +7 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_generator.py +52 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_limits_item.py +68 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_products_item.py +40 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_reward_configs.py +33 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule.py +101 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule_event.py +28 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule_results_item.py +43 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule_results_item_parameters_item.py +37 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_request_sort.py +5 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_request_sort_field.py +5 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_response.py +49 -0
- brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_response_contact_rewards_item.py +70 -0
- brevo/reward/types/redeem_voucher_request_order.py +85 -0
- brevo/reward/types/redeem_voucher_request_order_billing.py +55 -0
- brevo/reward/types/redeem_voucher_request_order_identifiers.py +28 -0
- brevo/reward/types/redeem_voucher_request_order_products_item.py +46 -0
- brevo/reward/types/validate_reward_response.py +23 -0
- brevo/senders/__init__.py +67 -0
- brevo/senders/client.py +808 -0
- brevo/senders/raw_client.py +1089 -0
- brevo/senders/types/__init__.py +65 -0
- brevo/senders/types/create_sender_request_ips_item.py +36 -0
- brevo/senders/types/create_sender_response.py +42 -0
- brevo/senders/types/get_ips_from_sender_response.py +25 -0
- brevo/senders/types/get_ips_from_sender_response_ips_item.py +38 -0
- brevo/senders/types/get_ips_response.py +25 -0
- brevo/senders/types/get_ips_response_ips_item.py +38 -0
- brevo/senders/types/get_senders_response.py +24 -0
- brevo/senders/types/get_senders_response_senders_item.py +46 -0
- brevo/senders/types/get_senders_response_senders_item_ips_item.py +33 -0
- brevo/senders/types/update_sender_request_ips_item.py +36 -0
- brevo/sms_campaigns/__init__.py +73 -0
- brevo/sms_campaigns/client.py +1078 -0
- brevo/sms_campaigns/raw_client.py +1501 -0
- brevo/sms_campaigns/types/__init__.py +71 -0
- brevo/sms_campaigns/types/create_sms_campaign_request_recipients.py +33 -0
- brevo/sms_campaigns/types/create_sms_campaign_response.py +23 -0
- brevo/sms_campaigns/types/get_sms_campaign_response.py +74 -0
- brevo/sms_campaigns/types/get_sms_campaign_response_status.py +7 -0
- brevo/sms_campaigns/types/get_sms_campaigns_request_sort.py +5 -0
- brevo/sms_campaigns/types/get_sms_campaigns_request_status.py +7 -0
- brevo/sms_campaigns/types/get_sms_campaigns_response.py +25 -0
- brevo/sms_campaigns/types/get_sms_campaigns_response_campaigns_item.py +74 -0
- brevo/sms_campaigns/types/get_sms_campaigns_response_campaigns_item_status.py +7 -0
- brevo/sms_campaigns/types/request_sms_recipient_export_request_recipients_type.py +7 -0
- brevo/sms_campaigns/types/request_sms_recipient_export_response.py +26 -0
- brevo/sms_campaigns/types/update_sms_campaign_request_recipients.py +33 -0
- brevo/sms_templates/__init__.py +49 -0
- brevo/sms_templates/client.py +133 -0
- brevo/sms_templates/raw_client.py +151 -0
- brevo/sms_templates/types/__init__.py +47 -0
- brevo/sms_templates/types/get_sms_templates_request_sort.py +5 -0
- brevo/sms_templates/types/get_sms_templates_response.py +26 -0
- brevo/sms_templates/types/get_sms_templates_response_templates_item.py +86 -0
- brevo/sms_templates/types/get_sms_templates_response_templates_item_compliance.py +37 -0
- brevo/tasks/__init__.py +55 -0
- brevo/tasks/client.py +814 -0
- brevo/tasks/raw_client.py +992 -0
- brevo/tasks/types/__init__.py +53 -0
- brevo/tasks/types/get_crm_tasks_request_filter_date.py +5 -0
- brevo/tasks/types/get_crm_tasks_request_filter_status.py +5 -0
- brevo/tasks/types/get_crm_tasks_request_sort.py +5 -0
- brevo/tasks/types/get_crm_tasks_response.py +28 -0
- brevo/tasks/types/get_crm_tasktypes_response.py +32 -0
- brevo/tasks/types/post_crm_tasks_response.py +27 -0
- brevo/tier/__init__.py +79 -0
- brevo/tier/client.py +1144 -0
- brevo/tier/raw_client.py +2360 -0
- brevo/tier/types/__init__.py +79 -0
- brevo/tier/types/add_subscription_to_tier_response.py +53 -0
- brevo/tier/types/create_tier_for_tier_group_request_access_conditions_item.py +31 -0
- brevo/tier/types/create_tier_for_tier_group_request_tier_rewards_item.py +26 -0
- brevo/tier/types/create_tier_group_request_downgrade_strategy.py +7 -0
- brevo/tier/types/create_tier_group_request_upgrade_strategy.py +7 -0
- brevo/tier/types/get_list_of_tier_groups_request_version.py +5 -0
- brevo/tier/types/get_list_of_tier_groups_response.py +21 -0
- brevo/tier/types/get_loyalty_program_tier_request_version.py +5 -0
- brevo/tier/types/get_loyalty_program_tier_response.py +21 -0
- brevo/tier/types/get_tier_group_request_version.py +5 -0
- brevo/tier/types/update_tier_group_request_downgrade_strategy.py +7 -0
- brevo/tier/types/update_tier_group_request_upgrade_strategy.py +7 -0
- brevo/tier/types/update_tier_request_access_conditions_item.py +31 -0
- brevo/tier/types/update_tier_request_tier_rewards_item.py +26 -0
- brevo/transactional_emails/__init__.py +175 -0
- brevo/transactional_emails/client.py +2544 -0
- brevo/transactional_emails/raw_client.py +3240 -0
- brevo/transactional_emails/types/__init__.py +189 -0
- brevo/transactional_emails/types/create_smtp_template_request_sender.py +37 -0
- brevo/transactional_emails/types/create_smtp_template_response.py +23 -0
- brevo/transactional_emails/types/get_aggregated_smtp_report_response.py +85 -0
- brevo/transactional_emails/types/get_blocked_domains_response.py +23 -0
- brevo/transactional_emails/types/get_email_event_report_request_event.py +23 -0
- brevo/transactional_emails/types/get_email_event_report_request_sort.py +5 -0
- brevo/transactional_emails/types/get_email_event_report_response.py +21 -0
- brevo/transactional_emails/types/get_email_event_report_response_events_item.py +79 -0
- brevo/transactional_emails/types/get_email_event_report_response_events_item_event.py +23 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_request_sort.py +5 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_request_status.py +5 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_response.py +10 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_response_batches.py +25 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_response_batches_batches_item.py +39 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_response_batches_batches_item_status.py +7 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_response_created_at.py +37 -0
- brevo/transactional_emails/types/get_scheduled_email_by_id_response_created_at_status.py +7 -0
- brevo/transactional_emails/types/get_smtp_report_request_sort.py +5 -0
- brevo/transactional_emails/types/get_smtp_report_response.py +21 -0
- brevo/transactional_emails/types/get_smtp_report_response_reports_item.py +86 -0
- brevo/transactional_emails/types/get_smtp_templates_request_sort.py +5 -0
- brevo/transactional_emails/types/get_smtp_templates_response.py +26 -0
- brevo/transactional_emails/types/get_transac_blocked_contacts_request_sort.py +5 -0
- brevo/transactional_emails/types/get_transac_blocked_contacts_response.py +25 -0
- brevo/transactional_emails/types/get_transac_blocked_contacts_response_contacts_item.py +44 -0
- brevo/transactional_emails/types/get_transac_blocked_contacts_response_contacts_item_reason.py +35 -0
- brevo/transactional_emails/types/get_transac_blocked_contacts_response_contacts_item_reason_code.py +15 -0
- brevo/transactional_emails/types/get_transac_email_content_response.py +57 -0
- brevo/transactional_emails/types/get_transac_email_content_response_events_item.py +28 -0
- brevo/transactional_emails/types/get_transac_emails_list_request_sort.py +5 -0
- brevo/transactional_emails/types/get_transac_emails_list_response.py +34 -0
- brevo/transactional_emails/types/get_transac_emails_list_response_transactional_emails_item.py +61 -0
- brevo/transactional_emails/types/post_preview_smtp_email_templates_response.py +49 -0
- brevo/transactional_emails/types/send_transac_email_request_attachment_item.py +33 -0
- brevo/transactional_emails/types/send_transac_email_request_bcc_item.py +28 -0
- brevo/transactional_emails/types/send_transac_email_request_cc_item.py +28 -0
- brevo/transactional_emails/types/send_transac_email_request_message_versions_item.py +73 -0
- brevo/transactional_emails/types/send_transac_email_request_message_versions_item_bcc_item.py +28 -0
- brevo/transactional_emails/types/send_transac_email_request_message_versions_item_cc_item.py +28 -0
- brevo/transactional_emails/types/send_transac_email_request_message_versions_item_reply_to.py +32 -0
- brevo/transactional_emails/types/send_transac_email_request_message_versions_item_to_item.py +28 -0
- brevo/transactional_emails/types/send_transac_email_request_reply_to.py +32 -0
- brevo/transactional_emails/types/send_transac_email_request_sender.py +37 -0
- brevo/transactional_emails/types/send_transac_email_request_to_item.py +28 -0
- brevo/transactional_emails/types/send_transac_email_response.py +29 -0
- brevo/transactional_emails/types/update_smtp_template_request_sender.py +37 -0
- brevo/transactional_sms/__init__.py +70 -0
- brevo/transactional_sms/client.py +726 -0
- brevo/transactional_sms/raw_client.py +913 -0
- brevo/transactional_sms/types/__init__.py +68 -0
- brevo/transactional_sms/types/get_sms_events_request_event.py +20 -0
- brevo/transactional_sms/types/get_sms_events_request_sort.py +5 -0
- brevo/transactional_sms/types/get_sms_events_response.py +21 -0
- brevo/transactional_sms/types/get_sms_events_response_events_item.py +52 -0
- brevo/transactional_sms/types/get_sms_events_response_events_item_event.py +20 -0
- brevo/transactional_sms/types/get_transac_aggregated_sms_report_response.py +75 -0
- brevo/transactional_sms/types/get_transac_sms_report_request_sort.py +5 -0
- brevo/transactional_sms/types/get_transac_sms_report_response.py +21 -0
- brevo/transactional_sms/types/get_transac_sms_report_response_reports_item.py +76 -0
- brevo/transactional_sms/types/send_async_transactional_sms_response.py +22 -0
- brevo/transactional_sms/types/send_transac_sms_response.py +38 -0
- brevo/transactional_whats_app/__init__.py +64 -0
- brevo/transactional_whats_app/client.py +283 -0
- brevo/transactional_whats_app/raw_client.py +326 -0
- brevo/transactional_whats_app/types/__init__.py +62 -0
- brevo/transactional_whats_app/types/get_whatsapp_event_report_request_event.py +7 -0
- brevo/transactional_whats_app/types/get_whatsapp_event_report_request_sort.py +5 -0
- brevo/transactional_whats_app/types/get_whatsapp_event_report_response.py +21 -0
- brevo/transactional_whats_app/types/get_whatsapp_event_report_response_events_item.py +65 -0
- brevo/transactional_whats_app/types/get_whatsapp_event_report_response_events_item_event.py +7 -0
- brevo/transactional_whats_app/types/send_whatsapp_message_request.py +8 -0
- brevo/transactional_whats_app/types/send_whatsapp_message_request_params.py +41 -0
- brevo/transactional_whats_app/types/send_whatsapp_message_request_text.py +35 -0
- brevo/transactional_whats_app/types/send_whatsapp_message_response.py +26 -0
- brevo/types/__init__.py +373 -0
- brevo/types/ab_test_version_clicks.py +7 -0
- brevo/types/ab_test_version_clicks_item.py +35 -0
- brevo/types/ab_test_version_stats.py +35 -0
- brevo/types/bad_request_error_body.py +29 -0
- brevo/types/bad_request_error_body_code.py +45 -0
- brevo/types/balance_definition.py +139 -0
- brevo/types/balance_definition_balance_availability_duration_modifier.py +7 -0
- brevo/types/balance_limit.py +78 -0
- brevo/types/cart.py +38 -0
- brevo/types/company.py +45 -0
- brevo/types/configuration.py +30 -0
- brevo/types/contact_error_model.py +34 -0
- brevo/types/contact_error_model_code.py +16 -0
- brevo/types/conversations_message.py +187 -0
- brevo/types/conversations_message_attachments_item.py +50 -0
- brevo/types/conversations_message_bcc_item.py +21 -0
- brevo/types/conversations_message_cc_item.py +21 -0
- brevo/types/conversations_message_file.py +46 -0
- brevo/types/conversations_message_file_image_info.py +39 -0
- brevo/types/conversations_message_forwarded_to_source_status.py +29 -0
- brevo/types/conversations_message_from.py +25 -0
- brevo/types/conversations_message_reply_to.py +25 -0
- brevo/types/conversations_message_to_item.py +21 -0
- brevo/types/conversations_message_type.py +5 -0
- brevo/types/conversion_source_metrics.py +35 -0
- brevo/types/conversion_source_metrics_conversion_source.py +7 -0
- brevo/types/create_update_folder.py +23 -0
- brevo/types/deal.py +45 -0
- brevo/types/error_model.py +28 -0
- brevo/types/file_data.py +60 -0
- brevo/types/forbidden_error_body.py +29 -0
- brevo/types/forbidden_error_body_code.py +45 -0
- brevo/types/get_campaign_recipients.py +25 -0
- brevo/types/get_campaign_stats.py +130 -0
- brevo/types/get_category_details.py +54 -0
- brevo/types/get_contact_details.py +75 -0
- brevo/types/get_contact_details_attributes.py +22 -0
- brevo/types/get_contacts.py +25 -0
- brevo/types/get_coupon_collection.py +75 -0
- brevo/types/get_device_browser_stats.py +44 -0
- brevo/types/get_extended_campaign_overview.py +230 -0
- brevo/types/get_extended_campaign_overview_sender.py +33 -0
- brevo/types/get_extended_campaign_overview_status.py +7 -0
- brevo/types/get_extended_campaign_overview_type.py +5 -0
- brevo/types/get_extended_campaign_stats.py +63 -0
- brevo/types/get_extended_campaign_stats_links_stats.py +22 -0
- brevo/types/get_extended_campaign_stats_stats_by_device.py +39 -0
- brevo/types/get_folder.py +46 -0
- brevo/types/get_list.py +46 -0
- brevo/types/get_product_details.py +115 -0
- brevo/types/get_sms_campaign_overview.py +69 -0
- brevo/types/get_sms_campaign_overview_status.py +7 -0
- brevo/types/get_sms_campaign_stats.py +55 -0
- brevo/types/get_smtp_template_overview.py +93 -0
- brevo/types/get_smtp_template_overview_sender.py +33 -0
- brevo/types/get_sso_token.py +23 -0
- brevo/types/get_webhook.py +74 -0
- brevo/types/get_webhook_channel.py +5 -0
- brevo/types/get_webhook_type.py +5 -0
- brevo/types/inviteuser.py +31 -0
- brevo/types/inviteuser_privileges_item.py +34 -0
- brevo/types/inviteuser_privileges_item_feature.py +24 -0
- brevo/types/inviteuser_privileges_item_permissions_item.py +39 -0
- brevo/types/loyalty_program.py +82 -0
- brevo/types/loyalty_program_state.py +5 -0
- brevo/types/node_response.py +63 -0
- brevo/types/not_found_error_body.py +29 -0
- brevo/types/not_found_error_body_code.py +45 -0
- brevo/types/note.py +61 -0
- brevo/types/note_data.py +44 -0
- brevo/types/notification.py +32 -0
- brevo/types/order.py +85 -0
- brevo/types/order_billing.py +66 -0
- brevo/types/order_identifiers.py +42 -0
- brevo/types/order_meta_info_value.py +5 -0
- brevo/types/order_products_item.py +43 -0
- brevo/types/pipeline.py +38 -0
- brevo/types/pipeline_stages_item.py +32 -0
- brevo/types/pipelines.py +7 -0
- brevo/types/post_contact_info.py +21 -0
- brevo/types/post_contact_info_contacts.py +37 -0
- brevo/types/post_contact_info_contacts_failure.py +5 -0
- brevo/types/post_contact_info_contacts_success.py +5 -0
- brevo/types/post_send_failed.py +46 -0
- brevo/types/redeem.py +92 -0
- brevo/types/rule_condition_response.py +52 -0
- brevo/types/send_report.py +30 -0
- brevo/types/send_report_email.py +32 -0
- brevo/types/send_report_language.py +5 -0
- brevo/types/send_test_email.py +29 -0
- brevo/types/send_transac_sms.py +66 -0
- brevo/types/send_transac_sms_tag.py +28 -0
- brevo/types/send_transac_sms_tag_field.py +5 -0
- brevo/types/send_transac_sms_type.py +5 -0
- brevo/types/task.py +55 -0
- brevo/types/task_reminder.py +39 -0
- brevo/types/task_reminder_types_item.py +5 -0
- brevo/types/task_reminder_unit.py +5 -0
- brevo/types/tier.py +63 -0
- brevo/types/tier_access_conditions_item.py +38 -0
- brevo/types/tier_group.py +70 -0
- brevo/types/tier_group_downgrade_strategy.py +7 -0
- brevo/types/tier_group_upgrade_strategy.py +7 -0
- brevo/types/tier_tier_rewards_item.py +33 -0
- brevo/types/transaction.py +110 -0
- brevo/types/unauthorized_error_body.py +29 -0
- brevo/types/unauthorized_error_body_code.py +45 -0
- brevo/types/update_campaign_status.py +28 -0
- brevo/types/update_campaign_status_status.py +8 -0
- brevo/types/value_response.py +67 -0
- brevo/types/variables_items.py +22 -0
- brevo/types/whatsapp_camp_stats.py +26 -0
- brevo/user/__init__.py +67 -0
- brevo/user/client.py +806 -0
- brevo/user/raw_client.py +977 -0
- brevo/user/types/__init__.py +67 -0
- brevo/user/types/edit_user_permission_response.py +33 -0
- brevo/user/types/get_invited_users_list_response.py +24 -0
- brevo/user/types/get_invited_users_list_response_users_item.py +39 -0
- brevo/user/types/get_invited_users_list_response_users_item_feature_access.py +37 -0
- brevo/user/types/get_user_permission_response.py +38 -0
- brevo/user/types/get_user_permission_response_privileges_item.py +21 -0
- brevo/user/types/inviteuser_response.py +28 -0
- brevo/user/types/put_revoke_user_permission_response.py +28 -0
- brevo/user/types/putresendcancelinvitation_request_action.py +5 -0
- brevo/user/types/putresendcancelinvitation_response.py +28 -0
- brevo/version.py +3 -0
- brevo/webhooks/__init__.py +82 -0
- brevo/webhooks/client.py +982 -0
- brevo/webhooks/raw_client.py +1211 -0
- brevo/webhooks/types/__init__.py +80 -0
- brevo/webhooks/types/create_webhook_request_auth.py +32 -0
- brevo/webhooks/types/create_webhook_request_channel.py +5 -0
- brevo/webhooks/types/create_webhook_request_events_item.py +26 -0
- brevo/webhooks/types/create_webhook_request_headers_item.py +28 -0
- brevo/webhooks/types/create_webhook_request_type.py +5 -0
- brevo/webhooks/types/create_webhook_response.py +23 -0
- brevo/webhooks/types/export_webhooks_history_request_event.py +26 -0
- brevo/webhooks/types/export_webhooks_history_request_type.py +5 -0
- brevo/webhooks/types/export_webhooks_history_response.py +26 -0
- brevo/webhooks/types/get_webhooks_request_sort.py +5 -0
- brevo/webhooks/types/get_webhooks_request_type.py +5 -0
- brevo/webhooks/types/get_webhooks_response.py +21 -0
- brevo/webhooks/types/update_webhook_request_auth.py +32 -0
- brevo/webhooks/types/update_webhook_request_events_item.py +26 -0
- brevo/webhooks/types/update_webhook_request_headers_item.py +28 -0
- brevo/whats_app_campaigns/__init__.py +106 -0
- brevo/whats_app_campaigns/client.py +1064 -0
- brevo/whats_app_campaigns/raw_client.py +1311 -0
- brevo/whats_app_campaigns/types/__init__.py +110 -0
- brevo/whats_app_campaigns/types/create_whats_app_campaign_request_recipients.py +41 -0
- brevo/whats_app_campaigns/types/create_whats_app_campaign_response.py +23 -0
- brevo/whats_app_campaigns/types/create_whats_app_template_request_category.py +5 -0
- brevo/whats_app_campaigns/types/create_whats_app_template_request_source.py +5 -0
- brevo/whats_app_campaigns/types/create_whats_app_template_response.py +23 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaign_response.py +69 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaign_response_campaign_status.py +7 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaign_response_template.py +61 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaign_response_template_components_item.py +21 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaigns_request_sort.py +5 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaigns_response.py +25 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaigns_response_campaigns_item.py +84 -0
- brevo/whats_app_campaigns/types/get_whats_app_campaigns_response_campaigns_item_campaign_status.py +7 -0
- brevo/whats_app_campaigns/types/get_whats_app_config_response.py +63 -0
- brevo/whats_app_campaigns/types/get_whats_app_config_response_phone_number_name_status.py +7 -0
- brevo/whats_app_campaigns/types/get_whats_app_config_response_phone_number_quality.py +5 -0
- brevo/whats_app_campaigns/types/get_whats_app_config_response_whatsapp_business_account_status.py +7 -0
- brevo/whats_app_campaigns/types/get_whats_app_templates_request_sort.py +5 -0
- brevo/whats_app_campaigns/types/get_whats_app_templates_request_source.py +5 -0
- brevo/whats_app_campaigns/types/get_whats_app_templates_response.py +26 -0
- brevo/whats_app_campaigns/types/get_whats_app_templates_response_templates_item.py +65 -0
- brevo/whats_app_campaigns/types/update_whats_app_campaign_request_campaign_status.py +5 -0
- brevo/whats_app_campaigns/types/update_whats_app_campaign_request_recipients.py +41 -0
- brevo_python-4.0.1.dist-info/METADATA +1072 -0
- brevo_python-4.0.1.dist-info/RECORD +843 -0
- brevo_python-4.0.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,3240 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from ..core.api_error import ApiError
|
|
8
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
10
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
11
|
+
from ..core.request_options import RequestOptions
|
|
12
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
13
|
+
from ..core.unchecked_base_model import construct_type
|
|
14
|
+
from ..errors.bad_request_error import BadRequestError
|
|
15
|
+
from ..errors.not_found_error import NotFoundError
|
|
16
|
+
from ..types.get_smtp_template_overview import GetSmtpTemplateOverview
|
|
17
|
+
from .types.create_smtp_template_request_sender import CreateSmtpTemplateRequestSender
|
|
18
|
+
from .types.create_smtp_template_response import CreateSmtpTemplateResponse
|
|
19
|
+
from .types.get_aggregated_smtp_report_response import GetAggregatedSmtpReportResponse
|
|
20
|
+
from .types.get_blocked_domains_response import GetBlockedDomainsResponse
|
|
21
|
+
from .types.get_email_event_report_request_event import GetEmailEventReportRequestEvent
|
|
22
|
+
from .types.get_email_event_report_request_sort import GetEmailEventReportRequestSort
|
|
23
|
+
from .types.get_email_event_report_response import GetEmailEventReportResponse
|
|
24
|
+
from .types.get_scheduled_email_by_id_request_sort import GetScheduledEmailByIdRequestSort
|
|
25
|
+
from .types.get_scheduled_email_by_id_request_status import GetScheduledEmailByIdRequestStatus
|
|
26
|
+
from .types.get_scheduled_email_by_id_response import GetScheduledEmailByIdResponse
|
|
27
|
+
from .types.get_smtp_report_request_sort import GetSmtpReportRequestSort
|
|
28
|
+
from .types.get_smtp_report_response import GetSmtpReportResponse
|
|
29
|
+
from .types.get_smtp_templates_request_sort import GetSmtpTemplatesRequestSort
|
|
30
|
+
from .types.get_smtp_templates_response import GetSmtpTemplatesResponse
|
|
31
|
+
from .types.get_transac_blocked_contacts_request_sort import GetTransacBlockedContactsRequestSort
|
|
32
|
+
from .types.get_transac_blocked_contacts_response import GetTransacBlockedContactsResponse
|
|
33
|
+
from .types.get_transac_email_content_response import GetTransacEmailContentResponse
|
|
34
|
+
from .types.get_transac_emails_list_request_sort import GetTransacEmailsListRequestSort
|
|
35
|
+
from .types.get_transac_emails_list_response import GetTransacEmailsListResponse
|
|
36
|
+
from .types.post_preview_smtp_email_templates_response import PostPreviewSmtpEmailTemplatesResponse
|
|
37
|
+
from .types.send_transac_email_request_attachment_item import SendTransacEmailRequestAttachmentItem
|
|
38
|
+
from .types.send_transac_email_request_bcc_item import SendTransacEmailRequestBccItem
|
|
39
|
+
from .types.send_transac_email_request_cc_item import SendTransacEmailRequestCcItem
|
|
40
|
+
from .types.send_transac_email_request_message_versions_item import SendTransacEmailRequestMessageVersionsItem
|
|
41
|
+
from .types.send_transac_email_request_reply_to import SendTransacEmailRequestReplyTo
|
|
42
|
+
from .types.send_transac_email_request_sender import SendTransacEmailRequestSender
|
|
43
|
+
from .types.send_transac_email_request_to_item import SendTransacEmailRequestToItem
|
|
44
|
+
from .types.send_transac_email_response import SendTransacEmailResponse
|
|
45
|
+
from .types.update_smtp_template_request_sender import UpdateSmtpTemplateRequestSender
|
|
46
|
+
|
|
47
|
+
# this is used as the default value for optional parameters
|
|
48
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class RawTransactionalEmailsClient:
|
|
52
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
53
|
+
self._client_wrapper = client_wrapper
|
|
54
|
+
|
|
55
|
+
def get_transac_blocked_contacts(
|
|
56
|
+
self,
|
|
57
|
+
*,
|
|
58
|
+
start_date: typing.Optional[str] = None,
|
|
59
|
+
end_date: typing.Optional[str] = None,
|
|
60
|
+
limit: typing.Optional[int] = None,
|
|
61
|
+
offset: typing.Optional[int] = None,
|
|
62
|
+
senders: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
63
|
+
sort: typing.Optional[GetTransacBlockedContactsRequestSort] = None,
|
|
64
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
65
|
+
) -> HttpResponse[GetTransacBlockedContactsResponse]:
|
|
66
|
+
"""
|
|
67
|
+
Parameters
|
|
68
|
+
----------
|
|
69
|
+
start_date : typing.Optional[str]
|
|
70
|
+
**Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts
|
|
71
|
+
|
|
72
|
+
end_date : typing.Optional[str]
|
|
73
|
+
**Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts
|
|
74
|
+
|
|
75
|
+
limit : typing.Optional[int]
|
|
76
|
+
Number of documents returned per page
|
|
77
|
+
|
|
78
|
+
offset : typing.Optional[int]
|
|
79
|
+
Index of the first document on the page
|
|
80
|
+
|
|
81
|
+
senders : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
82
|
+
Comma separated list of emails of the senders from which contacts are blocked or unsubscribed
|
|
83
|
+
|
|
84
|
+
sort : typing.Optional[GetTransacBlockedContactsRequestSort]
|
|
85
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
86
|
+
|
|
87
|
+
request_options : typing.Optional[RequestOptions]
|
|
88
|
+
Request-specific configuration.
|
|
89
|
+
|
|
90
|
+
Returns
|
|
91
|
+
-------
|
|
92
|
+
HttpResponse[GetTransacBlockedContactsResponse]
|
|
93
|
+
List of blocked or unsubscribed transactional contacts
|
|
94
|
+
"""
|
|
95
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
96
|
+
"smtp/blockedContacts",
|
|
97
|
+
method="GET",
|
|
98
|
+
params={
|
|
99
|
+
"startDate": start_date,
|
|
100
|
+
"endDate": end_date,
|
|
101
|
+
"limit": limit,
|
|
102
|
+
"offset": offset,
|
|
103
|
+
"senders": senders,
|
|
104
|
+
"sort": sort,
|
|
105
|
+
},
|
|
106
|
+
request_options=request_options,
|
|
107
|
+
)
|
|
108
|
+
try:
|
|
109
|
+
if 200 <= _response.status_code < 300:
|
|
110
|
+
_data = typing.cast(
|
|
111
|
+
GetTransacBlockedContactsResponse,
|
|
112
|
+
construct_type(
|
|
113
|
+
type_=GetTransacBlockedContactsResponse, # type: ignore
|
|
114
|
+
object_=_response.json(),
|
|
115
|
+
),
|
|
116
|
+
)
|
|
117
|
+
return HttpResponse(response=_response, data=_data)
|
|
118
|
+
if _response.status_code == 400:
|
|
119
|
+
raise BadRequestError(
|
|
120
|
+
headers=dict(_response.headers),
|
|
121
|
+
body=typing.cast(
|
|
122
|
+
typing.Any,
|
|
123
|
+
construct_type(
|
|
124
|
+
type_=typing.Any, # type: ignore
|
|
125
|
+
object_=_response.json(),
|
|
126
|
+
),
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
_response_json = _response.json()
|
|
130
|
+
except JSONDecodeError:
|
|
131
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
132
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
133
|
+
|
|
134
|
+
def unblock_or_resubscribe_a_transactional_contact(
|
|
135
|
+
self, email: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
136
|
+
) -> HttpResponse[None]:
|
|
137
|
+
"""
|
|
138
|
+
Parameters
|
|
139
|
+
----------
|
|
140
|
+
email : str
|
|
141
|
+
contact email (urlencoded) to unblock.
|
|
142
|
+
|
|
143
|
+
request_options : typing.Optional[RequestOptions]
|
|
144
|
+
Request-specific configuration.
|
|
145
|
+
|
|
146
|
+
Returns
|
|
147
|
+
-------
|
|
148
|
+
HttpResponse[None]
|
|
149
|
+
"""
|
|
150
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
151
|
+
f"smtp/blockedContacts/{jsonable_encoder(email)}",
|
|
152
|
+
method="DELETE",
|
|
153
|
+
request_options=request_options,
|
|
154
|
+
)
|
|
155
|
+
try:
|
|
156
|
+
if 200 <= _response.status_code < 300:
|
|
157
|
+
return HttpResponse(response=_response, data=None)
|
|
158
|
+
if _response.status_code == 400:
|
|
159
|
+
raise BadRequestError(
|
|
160
|
+
headers=dict(_response.headers),
|
|
161
|
+
body=typing.cast(
|
|
162
|
+
typing.Any,
|
|
163
|
+
construct_type(
|
|
164
|
+
type_=typing.Any, # type: ignore
|
|
165
|
+
object_=_response.json(),
|
|
166
|
+
),
|
|
167
|
+
),
|
|
168
|
+
)
|
|
169
|
+
if _response.status_code == 404:
|
|
170
|
+
raise NotFoundError(
|
|
171
|
+
headers=dict(_response.headers),
|
|
172
|
+
body=typing.cast(
|
|
173
|
+
typing.Any,
|
|
174
|
+
construct_type(
|
|
175
|
+
type_=typing.Any, # type: ignore
|
|
176
|
+
object_=_response.json(),
|
|
177
|
+
),
|
|
178
|
+
),
|
|
179
|
+
)
|
|
180
|
+
_response_json = _response.json()
|
|
181
|
+
except JSONDecodeError:
|
|
182
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
183
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
184
|
+
|
|
185
|
+
def get_blocked_domains(
|
|
186
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
187
|
+
) -> HttpResponse[GetBlockedDomainsResponse]:
|
|
188
|
+
"""
|
|
189
|
+
Get the list of blocked domains
|
|
190
|
+
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
request_options : typing.Optional[RequestOptions]
|
|
194
|
+
Request-specific configuration.
|
|
195
|
+
|
|
196
|
+
Returns
|
|
197
|
+
-------
|
|
198
|
+
HttpResponse[GetBlockedDomainsResponse]
|
|
199
|
+
List of blocked domains
|
|
200
|
+
"""
|
|
201
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
202
|
+
"smtp/blockedDomains",
|
|
203
|
+
method="GET",
|
|
204
|
+
request_options=request_options,
|
|
205
|
+
)
|
|
206
|
+
try:
|
|
207
|
+
if 200 <= _response.status_code < 300:
|
|
208
|
+
_data = typing.cast(
|
|
209
|
+
GetBlockedDomainsResponse,
|
|
210
|
+
construct_type(
|
|
211
|
+
type_=GetBlockedDomainsResponse, # type: ignore
|
|
212
|
+
object_=_response.json(),
|
|
213
|
+
),
|
|
214
|
+
)
|
|
215
|
+
return HttpResponse(response=_response, data=_data)
|
|
216
|
+
_response_json = _response.json()
|
|
217
|
+
except JSONDecodeError:
|
|
218
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
219
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
220
|
+
|
|
221
|
+
def block_new_domain(
|
|
222
|
+
self, *, domain: str, request_options: typing.Optional[RequestOptions] = None
|
|
223
|
+
) -> HttpResponse[None]:
|
|
224
|
+
"""
|
|
225
|
+
Blocks a new domain in order to avoid messages being sent to the same
|
|
226
|
+
|
|
227
|
+
Parameters
|
|
228
|
+
----------
|
|
229
|
+
domain : str
|
|
230
|
+
name of the domain to be blocked
|
|
231
|
+
|
|
232
|
+
request_options : typing.Optional[RequestOptions]
|
|
233
|
+
Request-specific configuration.
|
|
234
|
+
|
|
235
|
+
Returns
|
|
236
|
+
-------
|
|
237
|
+
HttpResponse[None]
|
|
238
|
+
"""
|
|
239
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
240
|
+
"smtp/blockedDomains",
|
|
241
|
+
method="POST",
|
|
242
|
+
json={
|
|
243
|
+
"domain": domain,
|
|
244
|
+
},
|
|
245
|
+
headers={
|
|
246
|
+
"content-type": "application/json",
|
|
247
|
+
},
|
|
248
|
+
request_options=request_options,
|
|
249
|
+
omit=OMIT,
|
|
250
|
+
)
|
|
251
|
+
try:
|
|
252
|
+
if 200 <= _response.status_code < 300:
|
|
253
|
+
return HttpResponse(response=_response, data=None)
|
|
254
|
+
if _response.status_code == 400:
|
|
255
|
+
raise BadRequestError(
|
|
256
|
+
headers=dict(_response.headers),
|
|
257
|
+
body=typing.cast(
|
|
258
|
+
typing.Any,
|
|
259
|
+
construct_type(
|
|
260
|
+
type_=typing.Any, # type: ignore
|
|
261
|
+
object_=_response.json(),
|
|
262
|
+
),
|
|
263
|
+
),
|
|
264
|
+
)
|
|
265
|
+
_response_json = _response.json()
|
|
266
|
+
except JSONDecodeError:
|
|
267
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
268
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
269
|
+
|
|
270
|
+
def delete_blocked_domain(
|
|
271
|
+
self, domain: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
272
|
+
) -> HttpResponse[None]:
|
|
273
|
+
"""
|
|
274
|
+
Unblocks an existing domain from the list of blocked domains
|
|
275
|
+
|
|
276
|
+
Parameters
|
|
277
|
+
----------
|
|
278
|
+
domain : str
|
|
279
|
+
The name of the domain to be deleted
|
|
280
|
+
|
|
281
|
+
request_options : typing.Optional[RequestOptions]
|
|
282
|
+
Request-specific configuration.
|
|
283
|
+
|
|
284
|
+
Returns
|
|
285
|
+
-------
|
|
286
|
+
HttpResponse[None]
|
|
287
|
+
"""
|
|
288
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
289
|
+
f"smtp/blockedDomains/{jsonable_encoder(domain)}",
|
|
290
|
+
method="DELETE",
|
|
291
|
+
request_options=request_options,
|
|
292
|
+
)
|
|
293
|
+
try:
|
|
294
|
+
if 200 <= _response.status_code < 300:
|
|
295
|
+
return HttpResponse(response=_response, data=None)
|
|
296
|
+
if _response.status_code == 400:
|
|
297
|
+
raise BadRequestError(
|
|
298
|
+
headers=dict(_response.headers),
|
|
299
|
+
body=typing.cast(
|
|
300
|
+
typing.Any,
|
|
301
|
+
construct_type(
|
|
302
|
+
type_=typing.Any, # type: ignore
|
|
303
|
+
object_=_response.json(),
|
|
304
|
+
),
|
|
305
|
+
),
|
|
306
|
+
)
|
|
307
|
+
if _response.status_code == 404:
|
|
308
|
+
raise NotFoundError(
|
|
309
|
+
headers=dict(_response.headers),
|
|
310
|
+
body=typing.cast(
|
|
311
|
+
typing.Any,
|
|
312
|
+
construct_type(
|
|
313
|
+
type_=typing.Any, # type: ignore
|
|
314
|
+
object_=_response.json(),
|
|
315
|
+
),
|
|
316
|
+
),
|
|
317
|
+
)
|
|
318
|
+
_response_json = _response.json()
|
|
319
|
+
except JSONDecodeError:
|
|
320
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
321
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
322
|
+
|
|
323
|
+
def delete_hardbounces(
|
|
324
|
+
self,
|
|
325
|
+
*,
|
|
326
|
+
contact_email: typing.Optional[str] = OMIT,
|
|
327
|
+
end_date: typing.Optional[str] = OMIT,
|
|
328
|
+
start_date: typing.Optional[str] = OMIT,
|
|
329
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
330
|
+
) -> HttpResponse[None]:
|
|
331
|
+
"""
|
|
332
|
+
Delete hardbounces. To use carefully (e.g. in case of temporary ISP failures)
|
|
333
|
+
|
|
334
|
+
Parameters
|
|
335
|
+
----------
|
|
336
|
+
contact_email : typing.Optional[str]
|
|
337
|
+
Target a specific email address
|
|
338
|
+
|
|
339
|
+
end_date : typing.Optional[str]
|
|
340
|
+
Ending date (YYYY-MM-DD) of the time period for deletion. The hardbounces until this date will be deleted. Must be greater than or equal to the startDate
|
|
341
|
+
|
|
342
|
+
start_date : typing.Optional[str]
|
|
343
|
+
Starting date (YYYY-MM-DD) of the time period for deletion. The hardbounces occurred after this date will be deleted. Must be less than or equal to the endDate
|
|
344
|
+
|
|
345
|
+
request_options : typing.Optional[RequestOptions]
|
|
346
|
+
Request-specific configuration.
|
|
347
|
+
|
|
348
|
+
Returns
|
|
349
|
+
-------
|
|
350
|
+
HttpResponse[None]
|
|
351
|
+
"""
|
|
352
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
353
|
+
"smtp/deleteHardbounces",
|
|
354
|
+
method="POST",
|
|
355
|
+
json={
|
|
356
|
+
"contactEmail": contact_email,
|
|
357
|
+
"endDate": end_date,
|
|
358
|
+
"startDate": start_date,
|
|
359
|
+
},
|
|
360
|
+
headers={
|
|
361
|
+
"content-type": "application/json",
|
|
362
|
+
},
|
|
363
|
+
request_options=request_options,
|
|
364
|
+
omit=OMIT,
|
|
365
|
+
)
|
|
366
|
+
try:
|
|
367
|
+
if 200 <= _response.status_code < 300:
|
|
368
|
+
return HttpResponse(response=_response, data=None)
|
|
369
|
+
if _response.status_code == 400:
|
|
370
|
+
raise BadRequestError(
|
|
371
|
+
headers=dict(_response.headers),
|
|
372
|
+
body=typing.cast(
|
|
373
|
+
typing.Any,
|
|
374
|
+
construct_type(
|
|
375
|
+
type_=typing.Any, # type: ignore
|
|
376
|
+
object_=_response.json(),
|
|
377
|
+
),
|
|
378
|
+
),
|
|
379
|
+
)
|
|
380
|
+
_response_json = _response.json()
|
|
381
|
+
except JSONDecodeError:
|
|
382
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
383
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
384
|
+
|
|
385
|
+
def send_transac_email(
|
|
386
|
+
self,
|
|
387
|
+
*,
|
|
388
|
+
attachment: typing.Optional[typing.Sequence[SendTransacEmailRequestAttachmentItem]] = OMIT,
|
|
389
|
+
batch_id: typing.Optional[str] = OMIT,
|
|
390
|
+
bcc: typing.Optional[typing.Sequence[SendTransacEmailRequestBccItem]] = OMIT,
|
|
391
|
+
cc: typing.Optional[typing.Sequence[SendTransacEmailRequestCcItem]] = OMIT,
|
|
392
|
+
headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
393
|
+
html_content: typing.Optional[str] = OMIT,
|
|
394
|
+
message_versions: typing.Optional[typing.Sequence[SendTransacEmailRequestMessageVersionsItem]] = OMIT,
|
|
395
|
+
params: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
396
|
+
reply_to: typing.Optional[SendTransacEmailRequestReplyTo] = OMIT,
|
|
397
|
+
scheduled_at: typing.Optional[dt.datetime] = OMIT,
|
|
398
|
+
sender: typing.Optional[SendTransacEmailRequestSender] = OMIT,
|
|
399
|
+
subject: typing.Optional[str] = OMIT,
|
|
400
|
+
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
401
|
+
template_id: typing.Optional[int] = OMIT,
|
|
402
|
+
text_content: typing.Optional[str] = OMIT,
|
|
403
|
+
to: typing.Optional[typing.Sequence[SendTransacEmailRequestToItem]] = OMIT,
|
|
404
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
405
|
+
) -> HttpResponse[SendTransacEmailResponse]:
|
|
406
|
+
"""
|
|
407
|
+
Parameters
|
|
408
|
+
----------
|
|
409
|
+
attachment : typing.Optional[typing.Sequence[SendTransacEmailRequestAttachmentItem]]
|
|
410
|
+
Array of attachment objects. Each attachment must include either an absolute URL (no local file paths) or base64-encoded content, along with the attachment filename. The `name` field is required when `content` is provided. Supported file extensions: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass, xlsm. When `templateId` is specified: if the template uses the New Template Language format, both `url` and `content` attachment types are supported; if the template uses the Old Template Language format, the `attachment` parameter is ignored.
|
|
411
|
+
|
|
412
|
+
batch_id : typing.Optional[str]
|
|
413
|
+
UUIDv4 identifier for the scheduled batch of transactional emails. If omitted, a valid UUIDv4 batch identifier is automatically generated.
|
|
414
|
+
|
|
415
|
+
bcc : typing.Optional[typing.Sequence[SendTransacEmailRequestBccItem]]
|
|
416
|
+
Array of BCC recipient objects. Each object contains an email address and an optional name.
|
|
417
|
+
|
|
418
|
+
cc : typing.Optional[typing.Sequence[SendTransacEmailRequestCcItem]]
|
|
419
|
+
Array of CC recipient objects. Each object contains an email address and an optional name.
|
|
420
|
+
|
|
421
|
+
headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
422
|
+
Custom email headers (non-standard headers) to include in the email. The `sender.ip` header can be set to specify the IP address used for sending transactional emails (dedicated IP users only). Header names must use Title-Case-Format (words separated by hyphens with the first letter of each word capitalized). Headers not in this format are automatically converted. Standard email headers are not supported. Example: `{"sender.ip":"1.2.3.4", "X-Mailin-custom":"some_custom_value", "Idempotency-Key":"abc-123"}`
|
|
423
|
+
|
|
424
|
+
html_content : typing.Optional[str]
|
|
425
|
+
HTML body content of the email. Required when `templateId` is not provided. Ignored when `templateId` is provided.
|
|
426
|
+
|
|
427
|
+
message_versions : typing.Optional[typing.Sequence[SendTransacEmailRequestMessageVersionsItem]]
|
|
428
|
+
Array of message version objects for sending customized email variants. The `templateId` can be customized per version only if a global `templateId` is provided. The `htmlContent` and `textContent` can be customized per version only if at least one of these is present in the global parameters. Global parameters such as `to` (required), `bcc`, `cc`, `replyTo`, and `subject` can be customized per version. Maximum total recipients per API request is 2000. Maximum recipients per message version is 99. Individual `params` objects must not exceed 100 KB. Cumulative `params` across all versions must not exceed 1000 KB. See https://developers.brevo.com/docs/batch-send-transactional-emails for detailed usage instructions.
|
|
429
|
+
|
|
430
|
+
params : typing.Optional[typing.Dict[str, typing.Any]]
|
|
431
|
+
Key-value pairs for template variable substitution. Only applicable when the template uses the New Template Language format.
|
|
432
|
+
|
|
433
|
+
reply_to : typing.Optional[SendTransacEmailRequestReplyTo]
|
|
434
|
+
Reply-to email address (required) and optional display name. Recipients will use this address when replying to the email.
|
|
435
|
+
|
|
436
|
+
scheduled_at : typing.Optional[dt.datetime]
|
|
437
|
+
UTC date-time when the email should be sent (format: YYYY-MM-DDTHH:mm:ss.SSSZ). Include timezone information in the date-time value. Scheduled emails may be delayed by up to 5 minutes.
|
|
438
|
+
|
|
439
|
+
sender : typing.Optional[SendTransacEmailRequestSender]
|
|
440
|
+
Sender information. Required when `templateId` is not provided. Specify either an email address (with optional name) or a sender ID. The `name` field is ignored when `id` is provided.
|
|
441
|
+
|
|
442
|
+
subject : typing.Optional[str]
|
|
443
|
+
Email subject line. Required when `templateId` is not provided.
|
|
444
|
+
|
|
445
|
+
tags : typing.Optional[typing.Sequence[str]]
|
|
446
|
+
Array of tags for categorizing and filtering emails
|
|
447
|
+
|
|
448
|
+
template_id : typing.Optional[int]
|
|
449
|
+
Template identifier
|
|
450
|
+
|
|
451
|
+
text_content : typing.Optional[str]
|
|
452
|
+
Plain text body content of the email. Ignored when `templateId` is provided.
|
|
453
|
+
|
|
454
|
+
to : typing.Optional[typing.Sequence[SendTransacEmailRequestToItem]]
|
|
455
|
+
Array of recipient objects. Each object contains an email address and an optional display name. Required when `messageVersions` is not provided. Ignored when `messageVersions` is provided. Example: `[{"name":"Jimmy", "email":"jimmy@example.com"}, {"name":"Joe", "email":"joe@example.com"}]`
|
|
456
|
+
|
|
457
|
+
request_options : typing.Optional[RequestOptions]
|
|
458
|
+
Request-specific configuration.
|
|
459
|
+
|
|
460
|
+
Returns
|
|
461
|
+
-------
|
|
462
|
+
HttpResponse[SendTransacEmailResponse]
|
|
463
|
+
Transactional email sent successfully
|
|
464
|
+
"""
|
|
465
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
466
|
+
"smtp/email",
|
|
467
|
+
method="POST",
|
|
468
|
+
json={
|
|
469
|
+
"attachment": convert_and_respect_annotation_metadata(
|
|
470
|
+
object_=attachment,
|
|
471
|
+
annotation=typing.Sequence[SendTransacEmailRequestAttachmentItem],
|
|
472
|
+
direction="write",
|
|
473
|
+
),
|
|
474
|
+
"batchId": batch_id,
|
|
475
|
+
"bcc": convert_and_respect_annotation_metadata(
|
|
476
|
+
object_=bcc, annotation=typing.Sequence[SendTransacEmailRequestBccItem], direction="write"
|
|
477
|
+
),
|
|
478
|
+
"cc": convert_and_respect_annotation_metadata(
|
|
479
|
+
object_=cc, annotation=typing.Sequence[SendTransacEmailRequestCcItem], direction="write"
|
|
480
|
+
),
|
|
481
|
+
"headers": headers,
|
|
482
|
+
"htmlContent": html_content,
|
|
483
|
+
"messageVersions": convert_and_respect_annotation_metadata(
|
|
484
|
+
object_=message_versions,
|
|
485
|
+
annotation=typing.Sequence[SendTransacEmailRequestMessageVersionsItem],
|
|
486
|
+
direction="write",
|
|
487
|
+
),
|
|
488
|
+
"params": params,
|
|
489
|
+
"replyTo": convert_and_respect_annotation_metadata(
|
|
490
|
+
object_=reply_to, annotation=SendTransacEmailRequestReplyTo, direction="write"
|
|
491
|
+
),
|
|
492
|
+
"scheduledAt": scheduled_at,
|
|
493
|
+
"sender": convert_and_respect_annotation_metadata(
|
|
494
|
+
object_=sender, annotation=SendTransacEmailRequestSender, direction="write"
|
|
495
|
+
),
|
|
496
|
+
"subject": subject,
|
|
497
|
+
"tags": tags,
|
|
498
|
+
"templateId": template_id,
|
|
499
|
+
"textContent": text_content,
|
|
500
|
+
"to": convert_and_respect_annotation_metadata(
|
|
501
|
+
object_=to, annotation=typing.Sequence[SendTransacEmailRequestToItem], direction="write"
|
|
502
|
+
),
|
|
503
|
+
},
|
|
504
|
+
headers={
|
|
505
|
+
"content-type": "application/json",
|
|
506
|
+
},
|
|
507
|
+
request_options=request_options,
|
|
508
|
+
omit=OMIT,
|
|
509
|
+
)
|
|
510
|
+
try:
|
|
511
|
+
if 200 <= _response.status_code < 300:
|
|
512
|
+
_data = typing.cast(
|
|
513
|
+
SendTransacEmailResponse,
|
|
514
|
+
construct_type(
|
|
515
|
+
type_=SendTransacEmailResponse, # type: ignore
|
|
516
|
+
object_=_response.json(),
|
|
517
|
+
),
|
|
518
|
+
)
|
|
519
|
+
return HttpResponse(response=_response, data=_data)
|
|
520
|
+
if _response.status_code == 400:
|
|
521
|
+
raise BadRequestError(
|
|
522
|
+
headers=dict(_response.headers),
|
|
523
|
+
body=typing.cast(
|
|
524
|
+
typing.Any,
|
|
525
|
+
construct_type(
|
|
526
|
+
type_=typing.Any, # type: ignore
|
|
527
|
+
object_=_response.json(),
|
|
528
|
+
),
|
|
529
|
+
),
|
|
530
|
+
)
|
|
531
|
+
_response_json = _response.json()
|
|
532
|
+
except JSONDecodeError:
|
|
533
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
534
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
535
|
+
|
|
536
|
+
def delete_scheduled_email_by_id(
|
|
537
|
+
self, identifier: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
538
|
+
) -> HttpResponse[None]:
|
|
539
|
+
"""
|
|
540
|
+
Delete scheduled batch of emails by batchId or single scheduled email by messageId
|
|
541
|
+
|
|
542
|
+
Parameters
|
|
543
|
+
----------
|
|
544
|
+
identifier : str
|
|
545
|
+
The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.
|
|
546
|
+
|
|
547
|
+
request_options : typing.Optional[RequestOptions]
|
|
548
|
+
Request-specific configuration.
|
|
549
|
+
|
|
550
|
+
Returns
|
|
551
|
+
-------
|
|
552
|
+
HttpResponse[None]
|
|
553
|
+
"""
|
|
554
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
555
|
+
f"smtp/email/{jsonable_encoder(identifier)}",
|
|
556
|
+
method="DELETE",
|
|
557
|
+
request_options=request_options,
|
|
558
|
+
)
|
|
559
|
+
try:
|
|
560
|
+
if 200 <= _response.status_code < 300:
|
|
561
|
+
return HttpResponse(response=_response, data=None)
|
|
562
|
+
if _response.status_code == 400:
|
|
563
|
+
raise BadRequestError(
|
|
564
|
+
headers=dict(_response.headers),
|
|
565
|
+
body=typing.cast(
|
|
566
|
+
typing.Any,
|
|
567
|
+
construct_type(
|
|
568
|
+
type_=typing.Any, # type: ignore
|
|
569
|
+
object_=_response.json(),
|
|
570
|
+
),
|
|
571
|
+
),
|
|
572
|
+
)
|
|
573
|
+
if _response.status_code == 404:
|
|
574
|
+
raise NotFoundError(
|
|
575
|
+
headers=dict(_response.headers),
|
|
576
|
+
body=typing.cast(
|
|
577
|
+
typing.Any,
|
|
578
|
+
construct_type(
|
|
579
|
+
type_=typing.Any, # type: ignore
|
|
580
|
+
object_=_response.json(),
|
|
581
|
+
),
|
|
582
|
+
),
|
|
583
|
+
)
|
|
584
|
+
_response_json = _response.json()
|
|
585
|
+
except JSONDecodeError:
|
|
586
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
587
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
588
|
+
|
|
589
|
+
def get_scheduled_email_by_id(
|
|
590
|
+
self,
|
|
591
|
+
identifier: str,
|
|
592
|
+
*,
|
|
593
|
+
start_date: typing.Optional[dt.date] = None,
|
|
594
|
+
end_date: typing.Optional[dt.date] = None,
|
|
595
|
+
sort: typing.Optional[GetScheduledEmailByIdRequestSort] = None,
|
|
596
|
+
status: typing.Optional[GetScheduledEmailByIdRequestStatus] = None,
|
|
597
|
+
limit: typing.Optional[int] = None,
|
|
598
|
+
offset: typing.Optional[int] = None,
|
|
599
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
600
|
+
) -> HttpResponse[GetScheduledEmailByIdResponse]:
|
|
601
|
+
"""
|
|
602
|
+
Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old)
|
|
603
|
+
|
|
604
|
+
Parameters
|
|
605
|
+
----------
|
|
606
|
+
identifier : str
|
|
607
|
+
The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.
|
|
608
|
+
|
|
609
|
+
start_date : typing.Optional[dt.date]
|
|
610
|
+
Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date.
|
|
611
|
+
|
|
612
|
+
end_date : typing.Optional[dt.date]
|
|
613
|
+
Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.
|
|
614
|
+
|
|
615
|
+
sort : typing.Optional[GetScheduledEmailByIdRequestSort]
|
|
616
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`.
|
|
617
|
+
|
|
618
|
+
status : typing.Optional[GetScheduledEmailByIdRequestStatus]
|
|
619
|
+
Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`.
|
|
620
|
+
|
|
621
|
+
limit : typing.Optional[int]
|
|
622
|
+
Number of documents returned per page. Not valid when identifier is `messageId`.
|
|
623
|
+
|
|
624
|
+
offset : typing.Optional[int]
|
|
625
|
+
Index of the first document on the page. Not valid when identifier is `messageId`.
|
|
626
|
+
|
|
627
|
+
request_options : typing.Optional[RequestOptions]
|
|
628
|
+
Request-specific configuration.
|
|
629
|
+
|
|
630
|
+
Returns
|
|
631
|
+
-------
|
|
632
|
+
HttpResponse[GetScheduledEmailByIdResponse]
|
|
633
|
+
Scheduled email batches
|
|
634
|
+
"""
|
|
635
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
636
|
+
f"smtp/emailStatus/{jsonable_encoder(identifier)}",
|
|
637
|
+
method="GET",
|
|
638
|
+
params={
|
|
639
|
+
"startDate": str(start_date) if start_date is not None else None,
|
|
640
|
+
"endDate": str(end_date) if end_date is not None else None,
|
|
641
|
+
"sort": sort,
|
|
642
|
+
"status": status,
|
|
643
|
+
"limit": limit,
|
|
644
|
+
"offset": offset,
|
|
645
|
+
},
|
|
646
|
+
request_options=request_options,
|
|
647
|
+
)
|
|
648
|
+
try:
|
|
649
|
+
if 200 <= _response.status_code < 300:
|
|
650
|
+
_data = typing.cast(
|
|
651
|
+
GetScheduledEmailByIdResponse,
|
|
652
|
+
construct_type(
|
|
653
|
+
type_=GetScheduledEmailByIdResponse, # type: ignore
|
|
654
|
+
object_=_response.json(),
|
|
655
|
+
),
|
|
656
|
+
)
|
|
657
|
+
return HttpResponse(response=_response, data=_data)
|
|
658
|
+
if _response.status_code == 400:
|
|
659
|
+
raise BadRequestError(
|
|
660
|
+
headers=dict(_response.headers),
|
|
661
|
+
body=typing.cast(
|
|
662
|
+
typing.Any,
|
|
663
|
+
construct_type(
|
|
664
|
+
type_=typing.Any, # type: ignore
|
|
665
|
+
object_=_response.json(),
|
|
666
|
+
),
|
|
667
|
+
),
|
|
668
|
+
)
|
|
669
|
+
if _response.status_code == 404:
|
|
670
|
+
raise NotFoundError(
|
|
671
|
+
headers=dict(_response.headers),
|
|
672
|
+
body=typing.cast(
|
|
673
|
+
typing.Any,
|
|
674
|
+
construct_type(
|
|
675
|
+
type_=typing.Any, # type: ignore
|
|
676
|
+
object_=_response.json(),
|
|
677
|
+
),
|
|
678
|
+
),
|
|
679
|
+
)
|
|
680
|
+
_response_json = _response.json()
|
|
681
|
+
except JSONDecodeError:
|
|
682
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
683
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
684
|
+
|
|
685
|
+
def get_transac_emails_list(
|
|
686
|
+
self,
|
|
687
|
+
*,
|
|
688
|
+
email: typing.Optional[str] = None,
|
|
689
|
+
template_id: typing.Optional[int] = None,
|
|
690
|
+
message_id: typing.Optional[str] = None,
|
|
691
|
+
start_date: typing.Optional[str] = None,
|
|
692
|
+
end_date: typing.Optional[str] = None,
|
|
693
|
+
sort: typing.Optional[GetTransacEmailsListRequestSort] = None,
|
|
694
|
+
limit: typing.Optional[int] = None,
|
|
695
|
+
offset: typing.Optional[int] = None,
|
|
696
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
697
|
+
) -> HttpResponse[GetTransacEmailsListResponse]:
|
|
698
|
+
"""
|
|
699
|
+
This endpoint will show the list of emails for past 30 days by default. To retrieve emails before that time, please pass startDate and endDate in query filters.
|
|
700
|
+
|
|
701
|
+
Parameters
|
|
702
|
+
----------
|
|
703
|
+
email : typing.Optional[str]
|
|
704
|
+
**Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent.
|
|
705
|
+
|
|
706
|
+
template_id : typing.Optional[int]
|
|
707
|
+
**Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email.
|
|
708
|
+
|
|
709
|
+
message_id : typing.Optional[str]
|
|
710
|
+
**Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent.
|
|
711
|
+
|
|
712
|
+
start_date : typing.Optional[str]
|
|
713
|
+
**Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**.
|
|
714
|
+
|
|
715
|
+
end_date : typing.Optional[str]
|
|
716
|
+
**Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.**
|
|
717
|
+
|
|
718
|
+
sort : typing.Optional[GetTransacEmailsListRequestSort]
|
|
719
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
720
|
+
|
|
721
|
+
limit : typing.Optional[int]
|
|
722
|
+
Number of documents returned per page
|
|
723
|
+
|
|
724
|
+
offset : typing.Optional[int]
|
|
725
|
+
Index of the first document in the page
|
|
726
|
+
|
|
727
|
+
request_options : typing.Optional[RequestOptions]
|
|
728
|
+
Request-specific configuration.
|
|
729
|
+
|
|
730
|
+
Returns
|
|
731
|
+
-------
|
|
732
|
+
HttpResponse[GetTransacEmailsListResponse]
|
|
733
|
+
List of transactional emails
|
|
734
|
+
"""
|
|
735
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
736
|
+
"smtp/emails",
|
|
737
|
+
method="GET",
|
|
738
|
+
params={
|
|
739
|
+
"email": email,
|
|
740
|
+
"templateId": template_id,
|
|
741
|
+
"messageId": message_id,
|
|
742
|
+
"startDate": start_date,
|
|
743
|
+
"endDate": end_date,
|
|
744
|
+
"sort": sort,
|
|
745
|
+
"limit": limit,
|
|
746
|
+
"offset": offset,
|
|
747
|
+
},
|
|
748
|
+
request_options=request_options,
|
|
749
|
+
)
|
|
750
|
+
try:
|
|
751
|
+
if 200 <= _response.status_code < 300:
|
|
752
|
+
_data = typing.cast(
|
|
753
|
+
GetTransacEmailsListResponse,
|
|
754
|
+
construct_type(
|
|
755
|
+
type_=GetTransacEmailsListResponse, # type: ignore
|
|
756
|
+
object_=_response.json(),
|
|
757
|
+
),
|
|
758
|
+
)
|
|
759
|
+
return HttpResponse(response=_response, data=_data)
|
|
760
|
+
if _response.status_code == 400:
|
|
761
|
+
raise BadRequestError(
|
|
762
|
+
headers=dict(_response.headers),
|
|
763
|
+
body=typing.cast(
|
|
764
|
+
typing.Any,
|
|
765
|
+
construct_type(
|
|
766
|
+
type_=typing.Any, # type: ignore
|
|
767
|
+
object_=_response.json(),
|
|
768
|
+
),
|
|
769
|
+
),
|
|
770
|
+
)
|
|
771
|
+
_response_json = _response.json()
|
|
772
|
+
except JSONDecodeError:
|
|
773
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
774
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
775
|
+
|
|
776
|
+
def get_transac_email_content(
|
|
777
|
+
self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
778
|
+
) -> HttpResponse[GetTransacEmailContentResponse]:
|
|
779
|
+
"""
|
|
780
|
+
<Note title="How to get uuid?">
|
|
781
|
+
You can get the uuid using either of the following methods:
|
|
782
|
+
|
|
783
|
+
Send a GET request to https://api.brevo.com/v3/smtp/emails and pass the message_id in the url. Use your api-key to authenticate the request and you will get your uuid as a response.
|
|
784
|
+
|
|
785
|
+
The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
|
|
786
|
+
</Note>
|
|
787
|
+
|
|
788
|
+
Parameters
|
|
789
|
+
----------
|
|
790
|
+
uuid_ : str
|
|
791
|
+
Unique id of the transactional email that has been sent to a particular contact
|
|
792
|
+
|
|
793
|
+
request_options : typing.Optional[RequestOptions]
|
|
794
|
+
Request-specific configuration.
|
|
795
|
+
|
|
796
|
+
Returns
|
|
797
|
+
-------
|
|
798
|
+
HttpResponse[GetTransacEmailContentResponse]
|
|
799
|
+
Transactional email content
|
|
800
|
+
"""
|
|
801
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
802
|
+
f"smtp/emails/{jsonable_encoder(uuid_)}",
|
|
803
|
+
method="GET",
|
|
804
|
+
request_options=request_options,
|
|
805
|
+
)
|
|
806
|
+
try:
|
|
807
|
+
if 200 <= _response.status_code < 300:
|
|
808
|
+
_data = typing.cast(
|
|
809
|
+
GetTransacEmailContentResponse,
|
|
810
|
+
construct_type(
|
|
811
|
+
type_=GetTransacEmailContentResponse, # type: ignore
|
|
812
|
+
object_=_response.json(),
|
|
813
|
+
),
|
|
814
|
+
)
|
|
815
|
+
return HttpResponse(response=_response, data=_data)
|
|
816
|
+
_response_json = _response.json()
|
|
817
|
+
except JSONDecodeError:
|
|
818
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
819
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
820
|
+
|
|
821
|
+
def delete_an_smtp_transactional_log(
|
|
822
|
+
self, identifier: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
823
|
+
) -> HttpResponse[None]:
|
|
824
|
+
"""
|
|
825
|
+
Parameters
|
|
826
|
+
----------
|
|
827
|
+
identifier : str
|
|
828
|
+
MessageId of the transactional log(s) to delete
|
|
829
|
+
|
|
830
|
+
request_options : typing.Optional[RequestOptions]
|
|
831
|
+
Request-specific configuration.
|
|
832
|
+
|
|
833
|
+
Returns
|
|
834
|
+
-------
|
|
835
|
+
HttpResponse[None]
|
|
836
|
+
"""
|
|
837
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
838
|
+
f"smtp/log/{jsonable_encoder(identifier)}",
|
|
839
|
+
method="DELETE",
|
|
840
|
+
request_options=request_options,
|
|
841
|
+
)
|
|
842
|
+
try:
|
|
843
|
+
if 200 <= _response.status_code < 300:
|
|
844
|
+
return HttpResponse(response=_response, data=None)
|
|
845
|
+
if _response.status_code == 400:
|
|
846
|
+
raise BadRequestError(
|
|
847
|
+
headers=dict(_response.headers),
|
|
848
|
+
body=typing.cast(
|
|
849
|
+
typing.Any,
|
|
850
|
+
construct_type(
|
|
851
|
+
type_=typing.Any, # type: ignore
|
|
852
|
+
object_=_response.json(),
|
|
853
|
+
),
|
|
854
|
+
),
|
|
855
|
+
)
|
|
856
|
+
if _response.status_code == 404:
|
|
857
|
+
raise NotFoundError(
|
|
858
|
+
headers=dict(_response.headers),
|
|
859
|
+
body=typing.cast(
|
|
860
|
+
typing.Any,
|
|
861
|
+
construct_type(
|
|
862
|
+
type_=typing.Any, # type: ignore
|
|
863
|
+
object_=_response.json(),
|
|
864
|
+
),
|
|
865
|
+
),
|
|
866
|
+
)
|
|
867
|
+
_response_json = _response.json()
|
|
868
|
+
except JSONDecodeError:
|
|
869
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
870
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
871
|
+
|
|
872
|
+
def get_aggregated_smtp_report(
|
|
873
|
+
self,
|
|
874
|
+
*,
|
|
875
|
+
start_date: typing.Optional[str] = None,
|
|
876
|
+
end_date: typing.Optional[str] = None,
|
|
877
|
+
days: typing.Optional[int] = None,
|
|
878
|
+
tag: typing.Optional[str] = None,
|
|
879
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
880
|
+
) -> HttpResponse[GetAggregatedSmtpReportResponse]:
|
|
881
|
+
"""
|
|
882
|
+
This endpoint will show the aggregated stats for past 90 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days
|
|
883
|
+
|
|
884
|
+
Parameters
|
|
885
|
+
----------
|
|
886
|
+
start_date : typing.Optional[str]
|
|
887
|
+
**Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate
|
|
888
|
+
|
|
889
|
+
end_date : typing.Optional[str]
|
|
890
|
+
**Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate
|
|
891
|
+
|
|
892
|
+
days : typing.Optional[int]
|
|
893
|
+
Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_
|
|
894
|
+
|
|
895
|
+
tag : typing.Optional[str]
|
|
896
|
+
Tag of the emails
|
|
897
|
+
|
|
898
|
+
request_options : typing.Optional[RequestOptions]
|
|
899
|
+
Request-specific configuration.
|
|
900
|
+
|
|
901
|
+
Returns
|
|
902
|
+
-------
|
|
903
|
+
HttpResponse[GetAggregatedSmtpReportResponse]
|
|
904
|
+
Aggregated report informations
|
|
905
|
+
"""
|
|
906
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
907
|
+
"smtp/statistics/aggregatedReport",
|
|
908
|
+
method="GET",
|
|
909
|
+
params={
|
|
910
|
+
"startDate": start_date,
|
|
911
|
+
"endDate": end_date,
|
|
912
|
+
"days": days,
|
|
913
|
+
"tag": tag,
|
|
914
|
+
},
|
|
915
|
+
request_options=request_options,
|
|
916
|
+
)
|
|
917
|
+
try:
|
|
918
|
+
if 200 <= _response.status_code < 300:
|
|
919
|
+
_data = typing.cast(
|
|
920
|
+
GetAggregatedSmtpReportResponse,
|
|
921
|
+
construct_type(
|
|
922
|
+
type_=GetAggregatedSmtpReportResponse, # type: ignore
|
|
923
|
+
object_=_response.json(),
|
|
924
|
+
),
|
|
925
|
+
)
|
|
926
|
+
return HttpResponse(response=_response, data=_data)
|
|
927
|
+
if _response.status_code == 400:
|
|
928
|
+
raise BadRequestError(
|
|
929
|
+
headers=dict(_response.headers),
|
|
930
|
+
body=typing.cast(
|
|
931
|
+
typing.Any,
|
|
932
|
+
construct_type(
|
|
933
|
+
type_=typing.Any, # type: ignore
|
|
934
|
+
object_=_response.json(),
|
|
935
|
+
),
|
|
936
|
+
),
|
|
937
|
+
)
|
|
938
|
+
_response_json = _response.json()
|
|
939
|
+
except JSONDecodeError:
|
|
940
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
941
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
942
|
+
|
|
943
|
+
def get_email_event_report(
|
|
944
|
+
self,
|
|
945
|
+
*,
|
|
946
|
+
limit: typing.Optional[int] = None,
|
|
947
|
+
offset: typing.Optional[int] = None,
|
|
948
|
+
start_date: typing.Optional[str] = None,
|
|
949
|
+
end_date: typing.Optional[str] = None,
|
|
950
|
+
days: typing.Optional[int] = None,
|
|
951
|
+
email: typing.Optional[str] = None,
|
|
952
|
+
event: typing.Optional[GetEmailEventReportRequestEvent] = None,
|
|
953
|
+
tags: typing.Optional[str] = None,
|
|
954
|
+
message_id: typing.Optional[str] = None,
|
|
955
|
+
template_id: typing.Optional[int] = None,
|
|
956
|
+
sort: typing.Optional[GetEmailEventReportRequestSort] = None,
|
|
957
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
958
|
+
) -> HttpResponse[GetEmailEventReportResponse]:
|
|
959
|
+
"""
|
|
960
|
+
This endpoint will show the aggregated stats for past 30 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days
|
|
961
|
+
|
|
962
|
+
Parameters
|
|
963
|
+
----------
|
|
964
|
+
limit : typing.Optional[int]
|
|
965
|
+
Number limitation for the result returned
|
|
966
|
+
|
|
967
|
+
offset : typing.Optional[int]
|
|
968
|
+
Beginning point in the list to retrieve from.
|
|
969
|
+
|
|
970
|
+
start_date : typing.Optional[str]
|
|
971
|
+
**Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate
|
|
972
|
+
|
|
973
|
+
end_date : typing.Optional[str]
|
|
974
|
+
**Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate
|
|
975
|
+
|
|
976
|
+
days : typing.Optional[int]
|
|
977
|
+
Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_
|
|
978
|
+
|
|
979
|
+
email : typing.Optional[str]
|
|
980
|
+
Filter the report for a specific email addresses
|
|
981
|
+
|
|
982
|
+
event : typing.Optional[GetEmailEventReportRequestEvent]
|
|
983
|
+
Filter the report for a specific event type
|
|
984
|
+
|
|
985
|
+
tags : typing.Optional[str]
|
|
986
|
+
Filter the report for tags (serialized and urlencoded array)
|
|
987
|
+
|
|
988
|
+
message_id : typing.Optional[str]
|
|
989
|
+
Filter on a specific message id
|
|
990
|
+
|
|
991
|
+
template_id : typing.Optional[int]
|
|
992
|
+
Filter on a specific template id
|
|
993
|
+
|
|
994
|
+
sort : typing.Optional[GetEmailEventReportRequestSort]
|
|
995
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
996
|
+
|
|
997
|
+
request_options : typing.Optional[RequestOptions]
|
|
998
|
+
Request-specific configuration.
|
|
999
|
+
|
|
1000
|
+
Returns
|
|
1001
|
+
-------
|
|
1002
|
+
HttpResponse[GetEmailEventReportResponse]
|
|
1003
|
+
Email events report informations
|
|
1004
|
+
"""
|
|
1005
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1006
|
+
"smtp/statistics/events",
|
|
1007
|
+
method="GET",
|
|
1008
|
+
params={
|
|
1009
|
+
"limit": limit,
|
|
1010
|
+
"offset": offset,
|
|
1011
|
+
"startDate": start_date,
|
|
1012
|
+
"endDate": end_date,
|
|
1013
|
+
"days": days,
|
|
1014
|
+
"email": email,
|
|
1015
|
+
"event": event,
|
|
1016
|
+
"tags": tags,
|
|
1017
|
+
"messageId": message_id,
|
|
1018
|
+
"templateId": template_id,
|
|
1019
|
+
"sort": sort,
|
|
1020
|
+
},
|
|
1021
|
+
request_options=request_options,
|
|
1022
|
+
)
|
|
1023
|
+
try:
|
|
1024
|
+
if 200 <= _response.status_code < 300:
|
|
1025
|
+
_data = typing.cast(
|
|
1026
|
+
GetEmailEventReportResponse,
|
|
1027
|
+
construct_type(
|
|
1028
|
+
type_=GetEmailEventReportResponse, # type: ignore
|
|
1029
|
+
object_=_response.json(),
|
|
1030
|
+
),
|
|
1031
|
+
)
|
|
1032
|
+
return HttpResponse(response=_response, data=_data)
|
|
1033
|
+
if _response.status_code == 400:
|
|
1034
|
+
raise BadRequestError(
|
|
1035
|
+
headers=dict(_response.headers),
|
|
1036
|
+
body=typing.cast(
|
|
1037
|
+
typing.Any,
|
|
1038
|
+
construct_type(
|
|
1039
|
+
type_=typing.Any, # type: ignore
|
|
1040
|
+
object_=_response.json(),
|
|
1041
|
+
),
|
|
1042
|
+
),
|
|
1043
|
+
)
|
|
1044
|
+
_response_json = _response.json()
|
|
1045
|
+
except JSONDecodeError:
|
|
1046
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1047
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1048
|
+
|
|
1049
|
+
def get_smtp_report(
|
|
1050
|
+
self,
|
|
1051
|
+
*,
|
|
1052
|
+
limit: typing.Optional[int] = None,
|
|
1053
|
+
offset: typing.Optional[int] = None,
|
|
1054
|
+
start_date: typing.Optional[str] = None,
|
|
1055
|
+
end_date: typing.Optional[str] = None,
|
|
1056
|
+
days: typing.Optional[int] = None,
|
|
1057
|
+
tag: typing.Optional[str] = None,
|
|
1058
|
+
sort: typing.Optional[GetSmtpReportRequestSort] = None,
|
|
1059
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1060
|
+
) -> HttpResponse[GetSmtpReportResponse]:
|
|
1061
|
+
"""
|
|
1062
|
+
Parameters
|
|
1063
|
+
----------
|
|
1064
|
+
limit : typing.Optional[int]
|
|
1065
|
+
Number of documents returned per page
|
|
1066
|
+
|
|
1067
|
+
offset : typing.Optional[int]
|
|
1068
|
+
Index of the first document on the page
|
|
1069
|
+
|
|
1070
|
+
start_date : typing.Optional[str]
|
|
1071
|
+
**Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD)
|
|
1072
|
+
|
|
1073
|
+
end_date : typing.Optional[str]
|
|
1074
|
+
**Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD)
|
|
1075
|
+
|
|
1076
|
+
days : typing.Optional[int]
|
|
1077
|
+
Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_
|
|
1078
|
+
|
|
1079
|
+
tag : typing.Optional[str]
|
|
1080
|
+
Tag of the emails
|
|
1081
|
+
|
|
1082
|
+
sort : typing.Optional[GetSmtpReportRequestSort]
|
|
1083
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
1084
|
+
|
|
1085
|
+
request_options : typing.Optional[RequestOptions]
|
|
1086
|
+
Request-specific configuration.
|
|
1087
|
+
|
|
1088
|
+
Returns
|
|
1089
|
+
-------
|
|
1090
|
+
HttpResponse[GetSmtpReportResponse]
|
|
1091
|
+
Aggregated report informations
|
|
1092
|
+
"""
|
|
1093
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1094
|
+
"smtp/statistics/reports",
|
|
1095
|
+
method="GET",
|
|
1096
|
+
params={
|
|
1097
|
+
"limit": limit,
|
|
1098
|
+
"offset": offset,
|
|
1099
|
+
"startDate": start_date,
|
|
1100
|
+
"endDate": end_date,
|
|
1101
|
+
"days": days,
|
|
1102
|
+
"tag": tag,
|
|
1103
|
+
"sort": sort,
|
|
1104
|
+
},
|
|
1105
|
+
request_options=request_options,
|
|
1106
|
+
)
|
|
1107
|
+
try:
|
|
1108
|
+
if 200 <= _response.status_code < 300:
|
|
1109
|
+
_data = typing.cast(
|
|
1110
|
+
GetSmtpReportResponse,
|
|
1111
|
+
construct_type(
|
|
1112
|
+
type_=GetSmtpReportResponse, # type: ignore
|
|
1113
|
+
object_=_response.json(),
|
|
1114
|
+
),
|
|
1115
|
+
)
|
|
1116
|
+
return HttpResponse(response=_response, data=_data)
|
|
1117
|
+
if _response.status_code == 400:
|
|
1118
|
+
raise BadRequestError(
|
|
1119
|
+
headers=dict(_response.headers),
|
|
1120
|
+
body=typing.cast(
|
|
1121
|
+
typing.Any,
|
|
1122
|
+
construct_type(
|
|
1123
|
+
type_=typing.Any, # type: ignore
|
|
1124
|
+
object_=_response.json(),
|
|
1125
|
+
),
|
|
1126
|
+
),
|
|
1127
|
+
)
|
|
1128
|
+
_response_json = _response.json()
|
|
1129
|
+
except JSONDecodeError:
|
|
1130
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1131
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1132
|
+
|
|
1133
|
+
def post_preview_smtp_email_templates(
|
|
1134
|
+
self, *, request: typing.Any, request_options: typing.Optional[RequestOptions] = None
|
|
1135
|
+
) -> HttpResponse[PostPreviewSmtpEmailTemplatesResponse]:
|
|
1136
|
+
"""
|
|
1137
|
+
Parameters
|
|
1138
|
+
----------
|
|
1139
|
+
request : typing.Any
|
|
1140
|
+
|
|
1141
|
+
request_options : typing.Optional[RequestOptions]
|
|
1142
|
+
Request-specific configuration.
|
|
1143
|
+
|
|
1144
|
+
Returns
|
|
1145
|
+
-------
|
|
1146
|
+
HttpResponse[PostPreviewSmtpEmailTemplatesResponse]
|
|
1147
|
+
successfully fetched template's preview fields
|
|
1148
|
+
"""
|
|
1149
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1150
|
+
"smtp/template/preview",
|
|
1151
|
+
method="POST",
|
|
1152
|
+
json=request,
|
|
1153
|
+
headers={
|
|
1154
|
+
"content-type": "application/json",
|
|
1155
|
+
},
|
|
1156
|
+
request_options=request_options,
|
|
1157
|
+
omit=OMIT,
|
|
1158
|
+
)
|
|
1159
|
+
try:
|
|
1160
|
+
if 200 <= _response.status_code < 300:
|
|
1161
|
+
_data = typing.cast(
|
|
1162
|
+
PostPreviewSmtpEmailTemplatesResponse,
|
|
1163
|
+
construct_type(
|
|
1164
|
+
type_=PostPreviewSmtpEmailTemplatesResponse, # type: ignore
|
|
1165
|
+
object_=_response.json(),
|
|
1166
|
+
),
|
|
1167
|
+
)
|
|
1168
|
+
return HttpResponse(response=_response, data=_data)
|
|
1169
|
+
if _response.status_code == 400:
|
|
1170
|
+
raise BadRequestError(
|
|
1171
|
+
headers=dict(_response.headers),
|
|
1172
|
+
body=typing.cast(
|
|
1173
|
+
typing.Any,
|
|
1174
|
+
construct_type(
|
|
1175
|
+
type_=typing.Any, # type: ignore
|
|
1176
|
+
object_=_response.json(),
|
|
1177
|
+
),
|
|
1178
|
+
),
|
|
1179
|
+
)
|
|
1180
|
+
_response_json = _response.json()
|
|
1181
|
+
except JSONDecodeError:
|
|
1182
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1183
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1184
|
+
|
|
1185
|
+
def get_smtp_templates(
|
|
1186
|
+
self,
|
|
1187
|
+
*,
|
|
1188
|
+
template_status: typing.Optional[bool] = None,
|
|
1189
|
+
limit: typing.Optional[int] = None,
|
|
1190
|
+
offset: typing.Optional[int] = None,
|
|
1191
|
+
sort: typing.Optional[GetSmtpTemplatesRequestSort] = None,
|
|
1192
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1193
|
+
) -> HttpResponse[GetSmtpTemplatesResponse]:
|
|
1194
|
+
"""
|
|
1195
|
+
Parameters
|
|
1196
|
+
----------
|
|
1197
|
+
template_status : typing.Optional[bool]
|
|
1198
|
+
Filter on the status of the template. Active = true, inactive = false
|
|
1199
|
+
|
|
1200
|
+
limit : typing.Optional[int]
|
|
1201
|
+
Number of documents returned per page
|
|
1202
|
+
|
|
1203
|
+
offset : typing.Optional[int]
|
|
1204
|
+
Index of the first document in the page
|
|
1205
|
+
|
|
1206
|
+
sort : typing.Optional[GetSmtpTemplatesRequestSort]
|
|
1207
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
1208
|
+
|
|
1209
|
+
request_options : typing.Optional[RequestOptions]
|
|
1210
|
+
Request-specific configuration.
|
|
1211
|
+
|
|
1212
|
+
Returns
|
|
1213
|
+
-------
|
|
1214
|
+
HttpResponse[GetSmtpTemplatesResponse]
|
|
1215
|
+
transactional email templates informations
|
|
1216
|
+
"""
|
|
1217
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1218
|
+
"smtp/templates",
|
|
1219
|
+
method="GET",
|
|
1220
|
+
params={
|
|
1221
|
+
"templateStatus": template_status,
|
|
1222
|
+
"limit": limit,
|
|
1223
|
+
"offset": offset,
|
|
1224
|
+
"sort": sort,
|
|
1225
|
+
},
|
|
1226
|
+
request_options=request_options,
|
|
1227
|
+
)
|
|
1228
|
+
try:
|
|
1229
|
+
if 200 <= _response.status_code < 300:
|
|
1230
|
+
_data = typing.cast(
|
|
1231
|
+
GetSmtpTemplatesResponse,
|
|
1232
|
+
construct_type(
|
|
1233
|
+
type_=GetSmtpTemplatesResponse, # type: ignore
|
|
1234
|
+
object_=_response.json(),
|
|
1235
|
+
),
|
|
1236
|
+
)
|
|
1237
|
+
return HttpResponse(response=_response, data=_data)
|
|
1238
|
+
if _response.status_code == 400:
|
|
1239
|
+
raise BadRequestError(
|
|
1240
|
+
headers=dict(_response.headers),
|
|
1241
|
+
body=typing.cast(
|
|
1242
|
+
typing.Any,
|
|
1243
|
+
construct_type(
|
|
1244
|
+
type_=typing.Any, # type: ignore
|
|
1245
|
+
object_=_response.json(),
|
|
1246
|
+
),
|
|
1247
|
+
),
|
|
1248
|
+
)
|
|
1249
|
+
_response_json = _response.json()
|
|
1250
|
+
except JSONDecodeError:
|
|
1251
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1252
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1253
|
+
|
|
1254
|
+
def create_smtp_template(
|
|
1255
|
+
self,
|
|
1256
|
+
*,
|
|
1257
|
+
sender: CreateSmtpTemplateRequestSender,
|
|
1258
|
+
subject: str,
|
|
1259
|
+
template_name: str,
|
|
1260
|
+
attachment_url: typing.Optional[str] = OMIT,
|
|
1261
|
+
html_content: typing.Optional[str] = OMIT,
|
|
1262
|
+
html_url: typing.Optional[str] = OMIT,
|
|
1263
|
+
is_active: typing.Optional[bool] = OMIT,
|
|
1264
|
+
reply_to: typing.Optional[str] = OMIT,
|
|
1265
|
+
tag: typing.Optional[str] = OMIT,
|
|
1266
|
+
to_field: typing.Optional[str] = OMIT,
|
|
1267
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1268
|
+
) -> HttpResponse[CreateSmtpTemplateResponse]:
|
|
1269
|
+
"""
|
|
1270
|
+
Parameters
|
|
1271
|
+
----------
|
|
1272
|
+
sender : CreateSmtpTemplateRequestSender
|
|
1273
|
+
Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{"name":"xyz", "email":"example@abc.com"}** **{"name":"xyz", "id":123}**
|
|
1274
|
+
|
|
1275
|
+
subject : str
|
|
1276
|
+
Subject of the template
|
|
1277
|
+
|
|
1278
|
+
template_name : str
|
|
1279
|
+
Name of the template
|
|
1280
|
+
|
|
1281
|
+
attachment_url : typing.Optional[str]
|
|
1282
|
+
Absolute url of the attachment (**no local file**). Extension allowed: #### xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps'
|
|
1283
|
+
|
|
1284
|
+
html_content : typing.Optional[str]
|
|
1285
|
+
Body of the message (HTML version). The field must have more than 10 characters. **REQUIRED if htmlUrl is empty**
|
|
1286
|
+
|
|
1287
|
+
html_url : typing.Optional[str]
|
|
1288
|
+
Url which contents the body of the email message. REQUIRED if htmlContent is empty
|
|
1289
|
+
|
|
1290
|
+
is_active : typing.Optional[bool]
|
|
1291
|
+
Status of template. isActive = true means template is active and isActive = false means template is inactive
|
|
1292
|
+
|
|
1293
|
+
reply_to : typing.Optional[str]
|
|
1294
|
+
Email on which campaign recipients will be able to reply to
|
|
1295
|
+
|
|
1296
|
+
tag : typing.Optional[str]
|
|
1297
|
+
Tag of the template
|
|
1298
|
+
|
|
1299
|
+
to_field : typing.Optional[str]
|
|
1300
|
+
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
|
|
1301
|
+
|
|
1302
|
+
request_options : typing.Optional[RequestOptions]
|
|
1303
|
+
Request-specific configuration.
|
|
1304
|
+
|
|
1305
|
+
Returns
|
|
1306
|
+
-------
|
|
1307
|
+
HttpResponse[CreateSmtpTemplateResponse]
|
|
1308
|
+
successfully created
|
|
1309
|
+
"""
|
|
1310
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1311
|
+
"smtp/templates",
|
|
1312
|
+
method="POST",
|
|
1313
|
+
json={
|
|
1314
|
+
"attachmentUrl": attachment_url,
|
|
1315
|
+
"htmlContent": html_content,
|
|
1316
|
+
"htmlUrl": html_url,
|
|
1317
|
+
"isActive": is_active,
|
|
1318
|
+
"replyTo": reply_to,
|
|
1319
|
+
"sender": convert_and_respect_annotation_metadata(
|
|
1320
|
+
object_=sender, annotation=CreateSmtpTemplateRequestSender, direction="write"
|
|
1321
|
+
),
|
|
1322
|
+
"subject": subject,
|
|
1323
|
+
"tag": tag,
|
|
1324
|
+
"templateName": template_name,
|
|
1325
|
+
"toField": to_field,
|
|
1326
|
+
},
|
|
1327
|
+
headers={
|
|
1328
|
+
"content-type": "application/json",
|
|
1329
|
+
},
|
|
1330
|
+
request_options=request_options,
|
|
1331
|
+
omit=OMIT,
|
|
1332
|
+
)
|
|
1333
|
+
try:
|
|
1334
|
+
if 200 <= _response.status_code < 300:
|
|
1335
|
+
_data = typing.cast(
|
|
1336
|
+
CreateSmtpTemplateResponse,
|
|
1337
|
+
construct_type(
|
|
1338
|
+
type_=CreateSmtpTemplateResponse, # type: ignore
|
|
1339
|
+
object_=_response.json(),
|
|
1340
|
+
),
|
|
1341
|
+
)
|
|
1342
|
+
return HttpResponse(response=_response, data=_data)
|
|
1343
|
+
if _response.status_code == 400:
|
|
1344
|
+
raise BadRequestError(
|
|
1345
|
+
headers=dict(_response.headers),
|
|
1346
|
+
body=typing.cast(
|
|
1347
|
+
typing.Any,
|
|
1348
|
+
construct_type(
|
|
1349
|
+
type_=typing.Any, # type: ignore
|
|
1350
|
+
object_=_response.json(),
|
|
1351
|
+
),
|
|
1352
|
+
),
|
|
1353
|
+
)
|
|
1354
|
+
_response_json = _response.json()
|
|
1355
|
+
except JSONDecodeError:
|
|
1356
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1357
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1358
|
+
|
|
1359
|
+
def get_smtp_template(
|
|
1360
|
+
self, template_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
1361
|
+
) -> HttpResponse[GetSmtpTemplateOverview]:
|
|
1362
|
+
"""
|
|
1363
|
+
Parameters
|
|
1364
|
+
----------
|
|
1365
|
+
template_id : int
|
|
1366
|
+
id of the template
|
|
1367
|
+
|
|
1368
|
+
request_options : typing.Optional[RequestOptions]
|
|
1369
|
+
Request-specific configuration.
|
|
1370
|
+
|
|
1371
|
+
Returns
|
|
1372
|
+
-------
|
|
1373
|
+
HttpResponse[GetSmtpTemplateOverview]
|
|
1374
|
+
Email template informations
|
|
1375
|
+
"""
|
|
1376
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1377
|
+
f"smtp/templates/{jsonable_encoder(template_id)}",
|
|
1378
|
+
method="GET",
|
|
1379
|
+
request_options=request_options,
|
|
1380
|
+
)
|
|
1381
|
+
try:
|
|
1382
|
+
if 200 <= _response.status_code < 300:
|
|
1383
|
+
_data = typing.cast(
|
|
1384
|
+
GetSmtpTemplateOverview,
|
|
1385
|
+
construct_type(
|
|
1386
|
+
type_=GetSmtpTemplateOverview, # type: ignore
|
|
1387
|
+
object_=_response.json(),
|
|
1388
|
+
),
|
|
1389
|
+
)
|
|
1390
|
+
return HttpResponse(response=_response, data=_data)
|
|
1391
|
+
if _response.status_code == 400:
|
|
1392
|
+
raise BadRequestError(
|
|
1393
|
+
headers=dict(_response.headers),
|
|
1394
|
+
body=typing.cast(
|
|
1395
|
+
typing.Any,
|
|
1396
|
+
construct_type(
|
|
1397
|
+
type_=typing.Any, # type: ignore
|
|
1398
|
+
object_=_response.json(),
|
|
1399
|
+
),
|
|
1400
|
+
),
|
|
1401
|
+
)
|
|
1402
|
+
if _response.status_code == 404:
|
|
1403
|
+
raise NotFoundError(
|
|
1404
|
+
headers=dict(_response.headers),
|
|
1405
|
+
body=typing.cast(
|
|
1406
|
+
typing.Any,
|
|
1407
|
+
construct_type(
|
|
1408
|
+
type_=typing.Any, # type: ignore
|
|
1409
|
+
object_=_response.json(),
|
|
1410
|
+
),
|
|
1411
|
+
),
|
|
1412
|
+
)
|
|
1413
|
+
_response_json = _response.json()
|
|
1414
|
+
except JSONDecodeError:
|
|
1415
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1416
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1417
|
+
|
|
1418
|
+
def update_smtp_template(
|
|
1419
|
+
self,
|
|
1420
|
+
template_id: int,
|
|
1421
|
+
*,
|
|
1422
|
+
attachment_url: typing.Optional[str] = OMIT,
|
|
1423
|
+
html_content: typing.Optional[str] = OMIT,
|
|
1424
|
+
html_url: typing.Optional[str] = OMIT,
|
|
1425
|
+
is_active: typing.Optional[bool] = OMIT,
|
|
1426
|
+
reply_to: typing.Optional[str] = OMIT,
|
|
1427
|
+
sender: typing.Optional[UpdateSmtpTemplateRequestSender] = OMIT,
|
|
1428
|
+
subject: typing.Optional[str] = OMIT,
|
|
1429
|
+
tag: typing.Optional[str] = OMIT,
|
|
1430
|
+
template_name: typing.Optional[str] = OMIT,
|
|
1431
|
+
to_field: typing.Optional[str] = OMIT,
|
|
1432
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1433
|
+
) -> HttpResponse[None]:
|
|
1434
|
+
"""
|
|
1435
|
+
Parameters
|
|
1436
|
+
----------
|
|
1437
|
+
template_id : int
|
|
1438
|
+
id of the template
|
|
1439
|
+
|
|
1440
|
+
attachment_url : typing.Optional[str]
|
|
1441
|
+
Absolute url of the attachment (**no local file**). Extensions allowed: #### xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps
|
|
1442
|
+
|
|
1443
|
+
html_content : typing.Optional[str]
|
|
1444
|
+
**Required if htmlUrl is empty**. If the template is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that template. Body of the message (HTML must have more than 10 characters)
|
|
1445
|
+
|
|
1446
|
+
html_url : typing.Optional[str]
|
|
1447
|
+
**Required if htmlContent is empty**. URL to the body of the email (HTML)
|
|
1448
|
+
|
|
1449
|
+
is_active : typing.Optional[bool]
|
|
1450
|
+
Status of the template. isActive = false means template is inactive, isActive = true means template is active
|
|
1451
|
+
|
|
1452
|
+
reply_to : typing.Optional[str]
|
|
1453
|
+
Email on which campaign recipients will be able to reply to
|
|
1454
|
+
|
|
1455
|
+
sender : typing.Optional[UpdateSmtpTemplateRequestSender]
|
|
1456
|
+
Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{"name":"xyz", "email":"example@abc.com"}** **{"name":"xyz", "id":123}**
|
|
1457
|
+
|
|
1458
|
+
subject : typing.Optional[str]
|
|
1459
|
+
Subject of the email
|
|
1460
|
+
|
|
1461
|
+
tag : typing.Optional[str]
|
|
1462
|
+
Tag of the template
|
|
1463
|
+
|
|
1464
|
+
template_name : typing.Optional[str]
|
|
1465
|
+
Name of the template
|
|
1466
|
+
|
|
1467
|
+
to_field : typing.Optional[str]
|
|
1468
|
+
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
|
|
1469
|
+
|
|
1470
|
+
request_options : typing.Optional[RequestOptions]
|
|
1471
|
+
Request-specific configuration.
|
|
1472
|
+
|
|
1473
|
+
Returns
|
|
1474
|
+
-------
|
|
1475
|
+
HttpResponse[None]
|
|
1476
|
+
"""
|
|
1477
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1478
|
+
f"smtp/templates/{jsonable_encoder(template_id)}",
|
|
1479
|
+
method="PUT",
|
|
1480
|
+
json={
|
|
1481
|
+
"attachmentUrl": attachment_url,
|
|
1482
|
+
"htmlContent": html_content,
|
|
1483
|
+
"htmlUrl": html_url,
|
|
1484
|
+
"isActive": is_active,
|
|
1485
|
+
"replyTo": reply_to,
|
|
1486
|
+
"sender": convert_and_respect_annotation_metadata(
|
|
1487
|
+
object_=sender, annotation=UpdateSmtpTemplateRequestSender, direction="write"
|
|
1488
|
+
),
|
|
1489
|
+
"subject": subject,
|
|
1490
|
+
"tag": tag,
|
|
1491
|
+
"templateName": template_name,
|
|
1492
|
+
"toField": to_field,
|
|
1493
|
+
},
|
|
1494
|
+
headers={
|
|
1495
|
+
"content-type": "application/json",
|
|
1496
|
+
},
|
|
1497
|
+
request_options=request_options,
|
|
1498
|
+
omit=OMIT,
|
|
1499
|
+
)
|
|
1500
|
+
try:
|
|
1501
|
+
if 200 <= _response.status_code < 300:
|
|
1502
|
+
return HttpResponse(response=_response, data=None)
|
|
1503
|
+
if _response.status_code == 400:
|
|
1504
|
+
raise BadRequestError(
|
|
1505
|
+
headers=dict(_response.headers),
|
|
1506
|
+
body=typing.cast(
|
|
1507
|
+
typing.Any,
|
|
1508
|
+
construct_type(
|
|
1509
|
+
type_=typing.Any, # type: ignore
|
|
1510
|
+
object_=_response.json(),
|
|
1511
|
+
),
|
|
1512
|
+
),
|
|
1513
|
+
)
|
|
1514
|
+
if _response.status_code == 404:
|
|
1515
|
+
raise NotFoundError(
|
|
1516
|
+
headers=dict(_response.headers),
|
|
1517
|
+
body=typing.cast(
|
|
1518
|
+
typing.Any,
|
|
1519
|
+
construct_type(
|
|
1520
|
+
type_=typing.Any, # type: ignore
|
|
1521
|
+
object_=_response.json(),
|
|
1522
|
+
),
|
|
1523
|
+
),
|
|
1524
|
+
)
|
|
1525
|
+
_response_json = _response.json()
|
|
1526
|
+
except JSONDecodeError:
|
|
1527
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1528
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1529
|
+
|
|
1530
|
+
def delete_smtp_template(
|
|
1531
|
+
self, template_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
1532
|
+
) -> HttpResponse[None]:
|
|
1533
|
+
"""
|
|
1534
|
+
Parameters
|
|
1535
|
+
----------
|
|
1536
|
+
template_id : int
|
|
1537
|
+
id of the template
|
|
1538
|
+
|
|
1539
|
+
request_options : typing.Optional[RequestOptions]
|
|
1540
|
+
Request-specific configuration.
|
|
1541
|
+
|
|
1542
|
+
Returns
|
|
1543
|
+
-------
|
|
1544
|
+
HttpResponse[None]
|
|
1545
|
+
"""
|
|
1546
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1547
|
+
f"smtp/templates/{jsonable_encoder(template_id)}",
|
|
1548
|
+
method="DELETE",
|
|
1549
|
+
request_options=request_options,
|
|
1550
|
+
)
|
|
1551
|
+
try:
|
|
1552
|
+
if 200 <= _response.status_code < 300:
|
|
1553
|
+
return HttpResponse(response=_response, data=None)
|
|
1554
|
+
if _response.status_code == 400:
|
|
1555
|
+
raise BadRequestError(
|
|
1556
|
+
headers=dict(_response.headers),
|
|
1557
|
+
body=typing.cast(
|
|
1558
|
+
typing.Any,
|
|
1559
|
+
construct_type(
|
|
1560
|
+
type_=typing.Any, # type: ignore
|
|
1561
|
+
object_=_response.json(),
|
|
1562
|
+
),
|
|
1563
|
+
),
|
|
1564
|
+
)
|
|
1565
|
+
if _response.status_code == 404:
|
|
1566
|
+
raise NotFoundError(
|
|
1567
|
+
headers=dict(_response.headers),
|
|
1568
|
+
body=typing.cast(
|
|
1569
|
+
typing.Any,
|
|
1570
|
+
construct_type(
|
|
1571
|
+
type_=typing.Any, # type: ignore
|
|
1572
|
+
object_=_response.json(),
|
|
1573
|
+
),
|
|
1574
|
+
),
|
|
1575
|
+
)
|
|
1576
|
+
_response_json = _response.json()
|
|
1577
|
+
except JSONDecodeError:
|
|
1578
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1579
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1580
|
+
|
|
1581
|
+
def send_test_template(
|
|
1582
|
+
self,
|
|
1583
|
+
template_id: int,
|
|
1584
|
+
*,
|
|
1585
|
+
email_to: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1586
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1587
|
+
) -> HttpResponse[None]:
|
|
1588
|
+
"""
|
|
1589
|
+
Parameters
|
|
1590
|
+
----------
|
|
1591
|
+
template_id : int
|
|
1592
|
+
Id of the template
|
|
1593
|
+
|
|
1594
|
+
email_to : typing.Optional[typing.Sequence[str]]
|
|
1595
|
+
List of the email addresses of the recipients whom you wish to send the test mail. _If left empty, the test mail will be sent to your entire test list. You can not send more than 50 test emails per day_.
|
|
1596
|
+
|
|
1597
|
+
request_options : typing.Optional[RequestOptions]
|
|
1598
|
+
Request-specific configuration.
|
|
1599
|
+
|
|
1600
|
+
Returns
|
|
1601
|
+
-------
|
|
1602
|
+
HttpResponse[None]
|
|
1603
|
+
"""
|
|
1604
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1605
|
+
f"smtp/templates/{jsonable_encoder(template_id)}/sendTest",
|
|
1606
|
+
method="POST",
|
|
1607
|
+
json={
|
|
1608
|
+
"emailTo": email_to,
|
|
1609
|
+
},
|
|
1610
|
+
headers={
|
|
1611
|
+
"content-type": "application/json",
|
|
1612
|
+
},
|
|
1613
|
+
request_options=request_options,
|
|
1614
|
+
omit=OMIT,
|
|
1615
|
+
)
|
|
1616
|
+
try:
|
|
1617
|
+
if 200 <= _response.status_code < 300:
|
|
1618
|
+
return HttpResponse(response=_response, data=None)
|
|
1619
|
+
if _response.status_code == 400:
|
|
1620
|
+
raise BadRequestError(
|
|
1621
|
+
headers=dict(_response.headers),
|
|
1622
|
+
body=typing.cast(
|
|
1623
|
+
typing.Any,
|
|
1624
|
+
construct_type(
|
|
1625
|
+
type_=typing.Any, # type: ignore
|
|
1626
|
+
object_=_response.json(),
|
|
1627
|
+
),
|
|
1628
|
+
),
|
|
1629
|
+
)
|
|
1630
|
+
if _response.status_code == 404:
|
|
1631
|
+
raise NotFoundError(
|
|
1632
|
+
headers=dict(_response.headers),
|
|
1633
|
+
body=typing.cast(
|
|
1634
|
+
typing.Any,
|
|
1635
|
+
construct_type(
|
|
1636
|
+
type_=typing.Any, # type: ignore
|
|
1637
|
+
object_=_response.json(),
|
|
1638
|
+
),
|
|
1639
|
+
),
|
|
1640
|
+
)
|
|
1641
|
+
_response_json = _response.json()
|
|
1642
|
+
except JSONDecodeError:
|
|
1643
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1644
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
class AsyncRawTransactionalEmailsClient:
|
|
1648
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1649
|
+
self._client_wrapper = client_wrapper
|
|
1650
|
+
|
|
1651
|
+
async def get_transac_blocked_contacts(
|
|
1652
|
+
self,
|
|
1653
|
+
*,
|
|
1654
|
+
start_date: typing.Optional[str] = None,
|
|
1655
|
+
end_date: typing.Optional[str] = None,
|
|
1656
|
+
limit: typing.Optional[int] = None,
|
|
1657
|
+
offset: typing.Optional[int] = None,
|
|
1658
|
+
senders: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
1659
|
+
sort: typing.Optional[GetTransacBlockedContactsRequestSort] = None,
|
|
1660
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1661
|
+
) -> AsyncHttpResponse[GetTransacBlockedContactsResponse]:
|
|
1662
|
+
"""
|
|
1663
|
+
Parameters
|
|
1664
|
+
----------
|
|
1665
|
+
start_date : typing.Optional[str]
|
|
1666
|
+
**Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts
|
|
1667
|
+
|
|
1668
|
+
end_date : typing.Optional[str]
|
|
1669
|
+
**Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts
|
|
1670
|
+
|
|
1671
|
+
limit : typing.Optional[int]
|
|
1672
|
+
Number of documents returned per page
|
|
1673
|
+
|
|
1674
|
+
offset : typing.Optional[int]
|
|
1675
|
+
Index of the first document on the page
|
|
1676
|
+
|
|
1677
|
+
senders : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
1678
|
+
Comma separated list of emails of the senders from which contacts are blocked or unsubscribed
|
|
1679
|
+
|
|
1680
|
+
sort : typing.Optional[GetTransacBlockedContactsRequestSort]
|
|
1681
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
1682
|
+
|
|
1683
|
+
request_options : typing.Optional[RequestOptions]
|
|
1684
|
+
Request-specific configuration.
|
|
1685
|
+
|
|
1686
|
+
Returns
|
|
1687
|
+
-------
|
|
1688
|
+
AsyncHttpResponse[GetTransacBlockedContactsResponse]
|
|
1689
|
+
List of blocked or unsubscribed transactional contacts
|
|
1690
|
+
"""
|
|
1691
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1692
|
+
"smtp/blockedContacts",
|
|
1693
|
+
method="GET",
|
|
1694
|
+
params={
|
|
1695
|
+
"startDate": start_date,
|
|
1696
|
+
"endDate": end_date,
|
|
1697
|
+
"limit": limit,
|
|
1698
|
+
"offset": offset,
|
|
1699
|
+
"senders": senders,
|
|
1700
|
+
"sort": sort,
|
|
1701
|
+
},
|
|
1702
|
+
request_options=request_options,
|
|
1703
|
+
)
|
|
1704
|
+
try:
|
|
1705
|
+
if 200 <= _response.status_code < 300:
|
|
1706
|
+
_data = typing.cast(
|
|
1707
|
+
GetTransacBlockedContactsResponse,
|
|
1708
|
+
construct_type(
|
|
1709
|
+
type_=GetTransacBlockedContactsResponse, # type: ignore
|
|
1710
|
+
object_=_response.json(),
|
|
1711
|
+
),
|
|
1712
|
+
)
|
|
1713
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1714
|
+
if _response.status_code == 400:
|
|
1715
|
+
raise BadRequestError(
|
|
1716
|
+
headers=dict(_response.headers),
|
|
1717
|
+
body=typing.cast(
|
|
1718
|
+
typing.Any,
|
|
1719
|
+
construct_type(
|
|
1720
|
+
type_=typing.Any, # type: ignore
|
|
1721
|
+
object_=_response.json(),
|
|
1722
|
+
),
|
|
1723
|
+
),
|
|
1724
|
+
)
|
|
1725
|
+
_response_json = _response.json()
|
|
1726
|
+
except JSONDecodeError:
|
|
1727
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1728
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1729
|
+
|
|
1730
|
+
async def unblock_or_resubscribe_a_transactional_contact(
|
|
1731
|
+
self, email: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1732
|
+
) -> AsyncHttpResponse[None]:
|
|
1733
|
+
"""
|
|
1734
|
+
Parameters
|
|
1735
|
+
----------
|
|
1736
|
+
email : str
|
|
1737
|
+
contact email (urlencoded) to unblock.
|
|
1738
|
+
|
|
1739
|
+
request_options : typing.Optional[RequestOptions]
|
|
1740
|
+
Request-specific configuration.
|
|
1741
|
+
|
|
1742
|
+
Returns
|
|
1743
|
+
-------
|
|
1744
|
+
AsyncHttpResponse[None]
|
|
1745
|
+
"""
|
|
1746
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1747
|
+
f"smtp/blockedContacts/{jsonable_encoder(email)}",
|
|
1748
|
+
method="DELETE",
|
|
1749
|
+
request_options=request_options,
|
|
1750
|
+
)
|
|
1751
|
+
try:
|
|
1752
|
+
if 200 <= _response.status_code < 300:
|
|
1753
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1754
|
+
if _response.status_code == 400:
|
|
1755
|
+
raise BadRequestError(
|
|
1756
|
+
headers=dict(_response.headers),
|
|
1757
|
+
body=typing.cast(
|
|
1758
|
+
typing.Any,
|
|
1759
|
+
construct_type(
|
|
1760
|
+
type_=typing.Any, # type: ignore
|
|
1761
|
+
object_=_response.json(),
|
|
1762
|
+
),
|
|
1763
|
+
),
|
|
1764
|
+
)
|
|
1765
|
+
if _response.status_code == 404:
|
|
1766
|
+
raise NotFoundError(
|
|
1767
|
+
headers=dict(_response.headers),
|
|
1768
|
+
body=typing.cast(
|
|
1769
|
+
typing.Any,
|
|
1770
|
+
construct_type(
|
|
1771
|
+
type_=typing.Any, # type: ignore
|
|
1772
|
+
object_=_response.json(),
|
|
1773
|
+
),
|
|
1774
|
+
),
|
|
1775
|
+
)
|
|
1776
|
+
_response_json = _response.json()
|
|
1777
|
+
except JSONDecodeError:
|
|
1778
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1779
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1780
|
+
|
|
1781
|
+
async def get_blocked_domains(
|
|
1782
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1783
|
+
) -> AsyncHttpResponse[GetBlockedDomainsResponse]:
|
|
1784
|
+
"""
|
|
1785
|
+
Get the list of blocked domains
|
|
1786
|
+
|
|
1787
|
+
Parameters
|
|
1788
|
+
----------
|
|
1789
|
+
request_options : typing.Optional[RequestOptions]
|
|
1790
|
+
Request-specific configuration.
|
|
1791
|
+
|
|
1792
|
+
Returns
|
|
1793
|
+
-------
|
|
1794
|
+
AsyncHttpResponse[GetBlockedDomainsResponse]
|
|
1795
|
+
List of blocked domains
|
|
1796
|
+
"""
|
|
1797
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1798
|
+
"smtp/blockedDomains",
|
|
1799
|
+
method="GET",
|
|
1800
|
+
request_options=request_options,
|
|
1801
|
+
)
|
|
1802
|
+
try:
|
|
1803
|
+
if 200 <= _response.status_code < 300:
|
|
1804
|
+
_data = typing.cast(
|
|
1805
|
+
GetBlockedDomainsResponse,
|
|
1806
|
+
construct_type(
|
|
1807
|
+
type_=GetBlockedDomainsResponse, # type: ignore
|
|
1808
|
+
object_=_response.json(),
|
|
1809
|
+
),
|
|
1810
|
+
)
|
|
1811
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1812
|
+
_response_json = _response.json()
|
|
1813
|
+
except JSONDecodeError:
|
|
1814
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1815
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1816
|
+
|
|
1817
|
+
async def block_new_domain(
|
|
1818
|
+
self, *, domain: str, request_options: typing.Optional[RequestOptions] = None
|
|
1819
|
+
) -> AsyncHttpResponse[None]:
|
|
1820
|
+
"""
|
|
1821
|
+
Blocks a new domain in order to avoid messages being sent to the same
|
|
1822
|
+
|
|
1823
|
+
Parameters
|
|
1824
|
+
----------
|
|
1825
|
+
domain : str
|
|
1826
|
+
name of the domain to be blocked
|
|
1827
|
+
|
|
1828
|
+
request_options : typing.Optional[RequestOptions]
|
|
1829
|
+
Request-specific configuration.
|
|
1830
|
+
|
|
1831
|
+
Returns
|
|
1832
|
+
-------
|
|
1833
|
+
AsyncHttpResponse[None]
|
|
1834
|
+
"""
|
|
1835
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1836
|
+
"smtp/blockedDomains",
|
|
1837
|
+
method="POST",
|
|
1838
|
+
json={
|
|
1839
|
+
"domain": domain,
|
|
1840
|
+
},
|
|
1841
|
+
headers={
|
|
1842
|
+
"content-type": "application/json",
|
|
1843
|
+
},
|
|
1844
|
+
request_options=request_options,
|
|
1845
|
+
omit=OMIT,
|
|
1846
|
+
)
|
|
1847
|
+
try:
|
|
1848
|
+
if 200 <= _response.status_code < 300:
|
|
1849
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1850
|
+
if _response.status_code == 400:
|
|
1851
|
+
raise BadRequestError(
|
|
1852
|
+
headers=dict(_response.headers),
|
|
1853
|
+
body=typing.cast(
|
|
1854
|
+
typing.Any,
|
|
1855
|
+
construct_type(
|
|
1856
|
+
type_=typing.Any, # type: ignore
|
|
1857
|
+
object_=_response.json(),
|
|
1858
|
+
),
|
|
1859
|
+
),
|
|
1860
|
+
)
|
|
1861
|
+
_response_json = _response.json()
|
|
1862
|
+
except JSONDecodeError:
|
|
1863
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1864
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1865
|
+
|
|
1866
|
+
async def delete_blocked_domain(
|
|
1867
|
+
self, domain: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1868
|
+
) -> AsyncHttpResponse[None]:
|
|
1869
|
+
"""
|
|
1870
|
+
Unblocks an existing domain from the list of blocked domains
|
|
1871
|
+
|
|
1872
|
+
Parameters
|
|
1873
|
+
----------
|
|
1874
|
+
domain : str
|
|
1875
|
+
The name of the domain to be deleted
|
|
1876
|
+
|
|
1877
|
+
request_options : typing.Optional[RequestOptions]
|
|
1878
|
+
Request-specific configuration.
|
|
1879
|
+
|
|
1880
|
+
Returns
|
|
1881
|
+
-------
|
|
1882
|
+
AsyncHttpResponse[None]
|
|
1883
|
+
"""
|
|
1884
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1885
|
+
f"smtp/blockedDomains/{jsonable_encoder(domain)}",
|
|
1886
|
+
method="DELETE",
|
|
1887
|
+
request_options=request_options,
|
|
1888
|
+
)
|
|
1889
|
+
try:
|
|
1890
|
+
if 200 <= _response.status_code < 300:
|
|
1891
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1892
|
+
if _response.status_code == 400:
|
|
1893
|
+
raise BadRequestError(
|
|
1894
|
+
headers=dict(_response.headers),
|
|
1895
|
+
body=typing.cast(
|
|
1896
|
+
typing.Any,
|
|
1897
|
+
construct_type(
|
|
1898
|
+
type_=typing.Any, # type: ignore
|
|
1899
|
+
object_=_response.json(),
|
|
1900
|
+
),
|
|
1901
|
+
),
|
|
1902
|
+
)
|
|
1903
|
+
if _response.status_code == 404:
|
|
1904
|
+
raise NotFoundError(
|
|
1905
|
+
headers=dict(_response.headers),
|
|
1906
|
+
body=typing.cast(
|
|
1907
|
+
typing.Any,
|
|
1908
|
+
construct_type(
|
|
1909
|
+
type_=typing.Any, # type: ignore
|
|
1910
|
+
object_=_response.json(),
|
|
1911
|
+
),
|
|
1912
|
+
),
|
|
1913
|
+
)
|
|
1914
|
+
_response_json = _response.json()
|
|
1915
|
+
except JSONDecodeError:
|
|
1916
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1917
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1918
|
+
|
|
1919
|
+
async def delete_hardbounces(
|
|
1920
|
+
self,
|
|
1921
|
+
*,
|
|
1922
|
+
contact_email: typing.Optional[str] = OMIT,
|
|
1923
|
+
end_date: typing.Optional[str] = OMIT,
|
|
1924
|
+
start_date: typing.Optional[str] = OMIT,
|
|
1925
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1926
|
+
) -> AsyncHttpResponse[None]:
|
|
1927
|
+
"""
|
|
1928
|
+
Delete hardbounces. To use carefully (e.g. in case of temporary ISP failures)
|
|
1929
|
+
|
|
1930
|
+
Parameters
|
|
1931
|
+
----------
|
|
1932
|
+
contact_email : typing.Optional[str]
|
|
1933
|
+
Target a specific email address
|
|
1934
|
+
|
|
1935
|
+
end_date : typing.Optional[str]
|
|
1936
|
+
Ending date (YYYY-MM-DD) of the time period for deletion. The hardbounces until this date will be deleted. Must be greater than or equal to the startDate
|
|
1937
|
+
|
|
1938
|
+
start_date : typing.Optional[str]
|
|
1939
|
+
Starting date (YYYY-MM-DD) of the time period for deletion. The hardbounces occurred after this date will be deleted. Must be less than or equal to the endDate
|
|
1940
|
+
|
|
1941
|
+
request_options : typing.Optional[RequestOptions]
|
|
1942
|
+
Request-specific configuration.
|
|
1943
|
+
|
|
1944
|
+
Returns
|
|
1945
|
+
-------
|
|
1946
|
+
AsyncHttpResponse[None]
|
|
1947
|
+
"""
|
|
1948
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1949
|
+
"smtp/deleteHardbounces",
|
|
1950
|
+
method="POST",
|
|
1951
|
+
json={
|
|
1952
|
+
"contactEmail": contact_email,
|
|
1953
|
+
"endDate": end_date,
|
|
1954
|
+
"startDate": start_date,
|
|
1955
|
+
},
|
|
1956
|
+
headers={
|
|
1957
|
+
"content-type": "application/json",
|
|
1958
|
+
},
|
|
1959
|
+
request_options=request_options,
|
|
1960
|
+
omit=OMIT,
|
|
1961
|
+
)
|
|
1962
|
+
try:
|
|
1963
|
+
if 200 <= _response.status_code < 300:
|
|
1964
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1965
|
+
if _response.status_code == 400:
|
|
1966
|
+
raise BadRequestError(
|
|
1967
|
+
headers=dict(_response.headers),
|
|
1968
|
+
body=typing.cast(
|
|
1969
|
+
typing.Any,
|
|
1970
|
+
construct_type(
|
|
1971
|
+
type_=typing.Any, # type: ignore
|
|
1972
|
+
object_=_response.json(),
|
|
1973
|
+
),
|
|
1974
|
+
),
|
|
1975
|
+
)
|
|
1976
|
+
_response_json = _response.json()
|
|
1977
|
+
except JSONDecodeError:
|
|
1978
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1979
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1980
|
+
|
|
1981
|
+
async def send_transac_email(
|
|
1982
|
+
self,
|
|
1983
|
+
*,
|
|
1984
|
+
attachment: typing.Optional[typing.Sequence[SendTransacEmailRequestAttachmentItem]] = OMIT,
|
|
1985
|
+
batch_id: typing.Optional[str] = OMIT,
|
|
1986
|
+
bcc: typing.Optional[typing.Sequence[SendTransacEmailRequestBccItem]] = OMIT,
|
|
1987
|
+
cc: typing.Optional[typing.Sequence[SendTransacEmailRequestCcItem]] = OMIT,
|
|
1988
|
+
headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
1989
|
+
html_content: typing.Optional[str] = OMIT,
|
|
1990
|
+
message_versions: typing.Optional[typing.Sequence[SendTransacEmailRequestMessageVersionsItem]] = OMIT,
|
|
1991
|
+
params: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
1992
|
+
reply_to: typing.Optional[SendTransacEmailRequestReplyTo] = OMIT,
|
|
1993
|
+
scheduled_at: typing.Optional[dt.datetime] = OMIT,
|
|
1994
|
+
sender: typing.Optional[SendTransacEmailRequestSender] = OMIT,
|
|
1995
|
+
subject: typing.Optional[str] = OMIT,
|
|
1996
|
+
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1997
|
+
template_id: typing.Optional[int] = OMIT,
|
|
1998
|
+
text_content: typing.Optional[str] = OMIT,
|
|
1999
|
+
to: typing.Optional[typing.Sequence[SendTransacEmailRequestToItem]] = OMIT,
|
|
2000
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2001
|
+
) -> AsyncHttpResponse[SendTransacEmailResponse]:
|
|
2002
|
+
"""
|
|
2003
|
+
Parameters
|
|
2004
|
+
----------
|
|
2005
|
+
attachment : typing.Optional[typing.Sequence[SendTransacEmailRequestAttachmentItem]]
|
|
2006
|
+
Array of attachment objects. Each attachment must include either an absolute URL (no local file paths) or base64-encoded content, along with the attachment filename. The `name` field is required when `content` is provided. Supported file extensions: xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub, eps, odt, mp3, m4a, m4v, wma, ogg, flac, wav, aif, aifc, aiff, mp4, mov, avi, mkv, mpeg, mpg, wmv, pkpass, xlsm. When `templateId` is specified: if the template uses the New Template Language format, both `url` and `content` attachment types are supported; if the template uses the Old Template Language format, the `attachment` parameter is ignored.
|
|
2007
|
+
|
|
2008
|
+
batch_id : typing.Optional[str]
|
|
2009
|
+
UUIDv4 identifier for the scheduled batch of transactional emails. If omitted, a valid UUIDv4 batch identifier is automatically generated.
|
|
2010
|
+
|
|
2011
|
+
bcc : typing.Optional[typing.Sequence[SendTransacEmailRequestBccItem]]
|
|
2012
|
+
Array of BCC recipient objects. Each object contains an email address and an optional name.
|
|
2013
|
+
|
|
2014
|
+
cc : typing.Optional[typing.Sequence[SendTransacEmailRequestCcItem]]
|
|
2015
|
+
Array of CC recipient objects. Each object contains an email address and an optional name.
|
|
2016
|
+
|
|
2017
|
+
headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
2018
|
+
Custom email headers (non-standard headers) to include in the email. The `sender.ip` header can be set to specify the IP address used for sending transactional emails (dedicated IP users only). Header names must use Title-Case-Format (words separated by hyphens with the first letter of each word capitalized). Headers not in this format are automatically converted. Standard email headers are not supported. Example: `{"sender.ip":"1.2.3.4", "X-Mailin-custom":"some_custom_value", "Idempotency-Key":"abc-123"}`
|
|
2019
|
+
|
|
2020
|
+
html_content : typing.Optional[str]
|
|
2021
|
+
HTML body content of the email. Required when `templateId` is not provided. Ignored when `templateId` is provided.
|
|
2022
|
+
|
|
2023
|
+
message_versions : typing.Optional[typing.Sequence[SendTransacEmailRequestMessageVersionsItem]]
|
|
2024
|
+
Array of message version objects for sending customized email variants. The `templateId` can be customized per version only if a global `templateId` is provided. The `htmlContent` and `textContent` can be customized per version only if at least one of these is present in the global parameters. Global parameters such as `to` (required), `bcc`, `cc`, `replyTo`, and `subject` can be customized per version. Maximum total recipients per API request is 2000. Maximum recipients per message version is 99. Individual `params` objects must not exceed 100 KB. Cumulative `params` across all versions must not exceed 1000 KB. See https://developers.brevo.com/docs/batch-send-transactional-emails for detailed usage instructions.
|
|
2025
|
+
|
|
2026
|
+
params : typing.Optional[typing.Dict[str, typing.Any]]
|
|
2027
|
+
Key-value pairs for template variable substitution. Only applicable when the template uses the New Template Language format.
|
|
2028
|
+
|
|
2029
|
+
reply_to : typing.Optional[SendTransacEmailRequestReplyTo]
|
|
2030
|
+
Reply-to email address (required) and optional display name. Recipients will use this address when replying to the email.
|
|
2031
|
+
|
|
2032
|
+
scheduled_at : typing.Optional[dt.datetime]
|
|
2033
|
+
UTC date-time when the email should be sent (format: YYYY-MM-DDTHH:mm:ss.SSSZ). Include timezone information in the date-time value. Scheduled emails may be delayed by up to 5 minutes.
|
|
2034
|
+
|
|
2035
|
+
sender : typing.Optional[SendTransacEmailRequestSender]
|
|
2036
|
+
Sender information. Required when `templateId` is not provided. Specify either an email address (with optional name) or a sender ID. The `name` field is ignored when `id` is provided.
|
|
2037
|
+
|
|
2038
|
+
subject : typing.Optional[str]
|
|
2039
|
+
Email subject line. Required when `templateId` is not provided.
|
|
2040
|
+
|
|
2041
|
+
tags : typing.Optional[typing.Sequence[str]]
|
|
2042
|
+
Array of tags for categorizing and filtering emails
|
|
2043
|
+
|
|
2044
|
+
template_id : typing.Optional[int]
|
|
2045
|
+
Template identifier
|
|
2046
|
+
|
|
2047
|
+
text_content : typing.Optional[str]
|
|
2048
|
+
Plain text body content of the email. Ignored when `templateId` is provided.
|
|
2049
|
+
|
|
2050
|
+
to : typing.Optional[typing.Sequence[SendTransacEmailRequestToItem]]
|
|
2051
|
+
Array of recipient objects. Each object contains an email address and an optional display name. Required when `messageVersions` is not provided. Ignored when `messageVersions` is provided. Example: `[{"name":"Jimmy", "email":"jimmy@example.com"}, {"name":"Joe", "email":"joe@example.com"}]`
|
|
2052
|
+
|
|
2053
|
+
request_options : typing.Optional[RequestOptions]
|
|
2054
|
+
Request-specific configuration.
|
|
2055
|
+
|
|
2056
|
+
Returns
|
|
2057
|
+
-------
|
|
2058
|
+
AsyncHttpResponse[SendTransacEmailResponse]
|
|
2059
|
+
Transactional email sent successfully
|
|
2060
|
+
"""
|
|
2061
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2062
|
+
"smtp/email",
|
|
2063
|
+
method="POST",
|
|
2064
|
+
json={
|
|
2065
|
+
"attachment": convert_and_respect_annotation_metadata(
|
|
2066
|
+
object_=attachment,
|
|
2067
|
+
annotation=typing.Sequence[SendTransacEmailRequestAttachmentItem],
|
|
2068
|
+
direction="write",
|
|
2069
|
+
),
|
|
2070
|
+
"batchId": batch_id,
|
|
2071
|
+
"bcc": convert_and_respect_annotation_metadata(
|
|
2072
|
+
object_=bcc, annotation=typing.Sequence[SendTransacEmailRequestBccItem], direction="write"
|
|
2073
|
+
),
|
|
2074
|
+
"cc": convert_and_respect_annotation_metadata(
|
|
2075
|
+
object_=cc, annotation=typing.Sequence[SendTransacEmailRequestCcItem], direction="write"
|
|
2076
|
+
),
|
|
2077
|
+
"headers": headers,
|
|
2078
|
+
"htmlContent": html_content,
|
|
2079
|
+
"messageVersions": convert_and_respect_annotation_metadata(
|
|
2080
|
+
object_=message_versions,
|
|
2081
|
+
annotation=typing.Sequence[SendTransacEmailRequestMessageVersionsItem],
|
|
2082
|
+
direction="write",
|
|
2083
|
+
),
|
|
2084
|
+
"params": params,
|
|
2085
|
+
"replyTo": convert_and_respect_annotation_metadata(
|
|
2086
|
+
object_=reply_to, annotation=SendTransacEmailRequestReplyTo, direction="write"
|
|
2087
|
+
),
|
|
2088
|
+
"scheduledAt": scheduled_at,
|
|
2089
|
+
"sender": convert_and_respect_annotation_metadata(
|
|
2090
|
+
object_=sender, annotation=SendTransacEmailRequestSender, direction="write"
|
|
2091
|
+
),
|
|
2092
|
+
"subject": subject,
|
|
2093
|
+
"tags": tags,
|
|
2094
|
+
"templateId": template_id,
|
|
2095
|
+
"textContent": text_content,
|
|
2096
|
+
"to": convert_and_respect_annotation_metadata(
|
|
2097
|
+
object_=to, annotation=typing.Sequence[SendTransacEmailRequestToItem], direction="write"
|
|
2098
|
+
),
|
|
2099
|
+
},
|
|
2100
|
+
headers={
|
|
2101
|
+
"content-type": "application/json",
|
|
2102
|
+
},
|
|
2103
|
+
request_options=request_options,
|
|
2104
|
+
omit=OMIT,
|
|
2105
|
+
)
|
|
2106
|
+
try:
|
|
2107
|
+
if 200 <= _response.status_code < 300:
|
|
2108
|
+
_data = typing.cast(
|
|
2109
|
+
SendTransacEmailResponse,
|
|
2110
|
+
construct_type(
|
|
2111
|
+
type_=SendTransacEmailResponse, # type: ignore
|
|
2112
|
+
object_=_response.json(),
|
|
2113
|
+
),
|
|
2114
|
+
)
|
|
2115
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2116
|
+
if _response.status_code == 400:
|
|
2117
|
+
raise BadRequestError(
|
|
2118
|
+
headers=dict(_response.headers),
|
|
2119
|
+
body=typing.cast(
|
|
2120
|
+
typing.Any,
|
|
2121
|
+
construct_type(
|
|
2122
|
+
type_=typing.Any, # type: ignore
|
|
2123
|
+
object_=_response.json(),
|
|
2124
|
+
),
|
|
2125
|
+
),
|
|
2126
|
+
)
|
|
2127
|
+
_response_json = _response.json()
|
|
2128
|
+
except JSONDecodeError:
|
|
2129
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2130
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2131
|
+
|
|
2132
|
+
async def delete_scheduled_email_by_id(
|
|
2133
|
+
self, identifier: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2134
|
+
) -> AsyncHttpResponse[None]:
|
|
2135
|
+
"""
|
|
2136
|
+
Delete scheduled batch of emails by batchId or single scheduled email by messageId
|
|
2137
|
+
|
|
2138
|
+
Parameters
|
|
2139
|
+
----------
|
|
2140
|
+
identifier : str
|
|
2141
|
+
The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.
|
|
2142
|
+
|
|
2143
|
+
request_options : typing.Optional[RequestOptions]
|
|
2144
|
+
Request-specific configuration.
|
|
2145
|
+
|
|
2146
|
+
Returns
|
|
2147
|
+
-------
|
|
2148
|
+
AsyncHttpResponse[None]
|
|
2149
|
+
"""
|
|
2150
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2151
|
+
f"smtp/email/{jsonable_encoder(identifier)}",
|
|
2152
|
+
method="DELETE",
|
|
2153
|
+
request_options=request_options,
|
|
2154
|
+
)
|
|
2155
|
+
try:
|
|
2156
|
+
if 200 <= _response.status_code < 300:
|
|
2157
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
2158
|
+
if _response.status_code == 400:
|
|
2159
|
+
raise BadRequestError(
|
|
2160
|
+
headers=dict(_response.headers),
|
|
2161
|
+
body=typing.cast(
|
|
2162
|
+
typing.Any,
|
|
2163
|
+
construct_type(
|
|
2164
|
+
type_=typing.Any, # type: ignore
|
|
2165
|
+
object_=_response.json(),
|
|
2166
|
+
),
|
|
2167
|
+
),
|
|
2168
|
+
)
|
|
2169
|
+
if _response.status_code == 404:
|
|
2170
|
+
raise NotFoundError(
|
|
2171
|
+
headers=dict(_response.headers),
|
|
2172
|
+
body=typing.cast(
|
|
2173
|
+
typing.Any,
|
|
2174
|
+
construct_type(
|
|
2175
|
+
type_=typing.Any, # type: ignore
|
|
2176
|
+
object_=_response.json(),
|
|
2177
|
+
),
|
|
2178
|
+
),
|
|
2179
|
+
)
|
|
2180
|
+
_response_json = _response.json()
|
|
2181
|
+
except JSONDecodeError:
|
|
2182
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2183
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2184
|
+
|
|
2185
|
+
async def get_scheduled_email_by_id(
|
|
2186
|
+
self,
|
|
2187
|
+
identifier: str,
|
|
2188
|
+
*,
|
|
2189
|
+
start_date: typing.Optional[dt.date] = None,
|
|
2190
|
+
end_date: typing.Optional[dt.date] = None,
|
|
2191
|
+
sort: typing.Optional[GetScheduledEmailByIdRequestSort] = None,
|
|
2192
|
+
status: typing.Optional[GetScheduledEmailByIdRequestStatus] = None,
|
|
2193
|
+
limit: typing.Optional[int] = None,
|
|
2194
|
+
offset: typing.Optional[int] = None,
|
|
2195
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2196
|
+
) -> AsyncHttpResponse[GetScheduledEmailByIdResponse]:
|
|
2197
|
+
"""
|
|
2198
|
+
Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old)
|
|
2199
|
+
|
|
2200
|
+
Parameters
|
|
2201
|
+
----------
|
|
2202
|
+
identifier : str
|
|
2203
|
+
The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.
|
|
2204
|
+
|
|
2205
|
+
start_date : typing.Optional[dt.date]
|
|
2206
|
+
Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date.
|
|
2207
|
+
|
|
2208
|
+
end_date : typing.Optional[dt.date]
|
|
2209
|
+
Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.
|
|
2210
|
+
|
|
2211
|
+
sort : typing.Optional[GetScheduledEmailByIdRequestSort]
|
|
2212
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`.
|
|
2213
|
+
|
|
2214
|
+
status : typing.Optional[GetScheduledEmailByIdRequestStatus]
|
|
2215
|
+
Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`.
|
|
2216
|
+
|
|
2217
|
+
limit : typing.Optional[int]
|
|
2218
|
+
Number of documents returned per page. Not valid when identifier is `messageId`.
|
|
2219
|
+
|
|
2220
|
+
offset : typing.Optional[int]
|
|
2221
|
+
Index of the first document on the page. Not valid when identifier is `messageId`.
|
|
2222
|
+
|
|
2223
|
+
request_options : typing.Optional[RequestOptions]
|
|
2224
|
+
Request-specific configuration.
|
|
2225
|
+
|
|
2226
|
+
Returns
|
|
2227
|
+
-------
|
|
2228
|
+
AsyncHttpResponse[GetScheduledEmailByIdResponse]
|
|
2229
|
+
Scheduled email batches
|
|
2230
|
+
"""
|
|
2231
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2232
|
+
f"smtp/emailStatus/{jsonable_encoder(identifier)}",
|
|
2233
|
+
method="GET",
|
|
2234
|
+
params={
|
|
2235
|
+
"startDate": str(start_date) if start_date is not None else None,
|
|
2236
|
+
"endDate": str(end_date) if end_date is not None else None,
|
|
2237
|
+
"sort": sort,
|
|
2238
|
+
"status": status,
|
|
2239
|
+
"limit": limit,
|
|
2240
|
+
"offset": offset,
|
|
2241
|
+
},
|
|
2242
|
+
request_options=request_options,
|
|
2243
|
+
)
|
|
2244
|
+
try:
|
|
2245
|
+
if 200 <= _response.status_code < 300:
|
|
2246
|
+
_data = typing.cast(
|
|
2247
|
+
GetScheduledEmailByIdResponse,
|
|
2248
|
+
construct_type(
|
|
2249
|
+
type_=GetScheduledEmailByIdResponse, # type: ignore
|
|
2250
|
+
object_=_response.json(),
|
|
2251
|
+
),
|
|
2252
|
+
)
|
|
2253
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2254
|
+
if _response.status_code == 400:
|
|
2255
|
+
raise BadRequestError(
|
|
2256
|
+
headers=dict(_response.headers),
|
|
2257
|
+
body=typing.cast(
|
|
2258
|
+
typing.Any,
|
|
2259
|
+
construct_type(
|
|
2260
|
+
type_=typing.Any, # type: ignore
|
|
2261
|
+
object_=_response.json(),
|
|
2262
|
+
),
|
|
2263
|
+
),
|
|
2264
|
+
)
|
|
2265
|
+
if _response.status_code == 404:
|
|
2266
|
+
raise NotFoundError(
|
|
2267
|
+
headers=dict(_response.headers),
|
|
2268
|
+
body=typing.cast(
|
|
2269
|
+
typing.Any,
|
|
2270
|
+
construct_type(
|
|
2271
|
+
type_=typing.Any, # type: ignore
|
|
2272
|
+
object_=_response.json(),
|
|
2273
|
+
),
|
|
2274
|
+
),
|
|
2275
|
+
)
|
|
2276
|
+
_response_json = _response.json()
|
|
2277
|
+
except JSONDecodeError:
|
|
2278
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2279
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2280
|
+
|
|
2281
|
+
async def get_transac_emails_list(
|
|
2282
|
+
self,
|
|
2283
|
+
*,
|
|
2284
|
+
email: typing.Optional[str] = None,
|
|
2285
|
+
template_id: typing.Optional[int] = None,
|
|
2286
|
+
message_id: typing.Optional[str] = None,
|
|
2287
|
+
start_date: typing.Optional[str] = None,
|
|
2288
|
+
end_date: typing.Optional[str] = None,
|
|
2289
|
+
sort: typing.Optional[GetTransacEmailsListRequestSort] = None,
|
|
2290
|
+
limit: typing.Optional[int] = None,
|
|
2291
|
+
offset: typing.Optional[int] = None,
|
|
2292
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2293
|
+
) -> AsyncHttpResponse[GetTransacEmailsListResponse]:
|
|
2294
|
+
"""
|
|
2295
|
+
This endpoint will show the list of emails for past 30 days by default. To retrieve emails before that time, please pass startDate and endDate in query filters.
|
|
2296
|
+
|
|
2297
|
+
Parameters
|
|
2298
|
+
----------
|
|
2299
|
+
email : typing.Optional[str]
|
|
2300
|
+
**Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent.
|
|
2301
|
+
|
|
2302
|
+
template_id : typing.Optional[int]
|
|
2303
|
+
**Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email.
|
|
2304
|
+
|
|
2305
|
+
message_id : typing.Optional[str]
|
|
2306
|
+
**Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent.
|
|
2307
|
+
|
|
2308
|
+
start_date : typing.Optional[str]
|
|
2309
|
+
**Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**.
|
|
2310
|
+
|
|
2311
|
+
end_date : typing.Optional[str]
|
|
2312
|
+
**Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.**
|
|
2313
|
+
|
|
2314
|
+
sort : typing.Optional[GetTransacEmailsListRequestSort]
|
|
2315
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
2316
|
+
|
|
2317
|
+
limit : typing.Optional[int]
|
|
2318
|
+
Number of documents returned per page
|
|
2319
|
+
|
|
2320
|
+
offset : typing.Optional[int]
|
|
2321
|
+
Index of the first document in the page
|
|
2322
|
+
|
|
2323
|
+
request_options : typing.Optional[RequestOptions]
|
|
2324
|
+
Request-specific configuration.
|
|
2325
|
+
|
|
2326
|
+
Returns
|
|
2327
|
+
-------
|
|
2328
|
+
AsyncHttpResponse[GetTransacEmailsListResponse]
|
|
2329
|
+
List of transactional emails
|
|
2330
|
+
"""
|
|
2331
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2332
|
+
"smtp/emails",
|
|
2333
|
+
method="GET",
|
|
2334
|
+
params={
|
|
2335
|
+
"email": email,
|
|
2336
|
+
"templateId": template_id,
|
|
2337
|
+
"messageId": message_id,
|
|
2338
|
+
"startDate": start_date,
|
|
2339
|
+
"endDate": end_date,
|
|
2340
|
+
"sort": sort,
|
|
2341
|
+
"limit": limit,
|
|
2342
|
+
"offset": offset,
|
|
2343
|
+
},
|
|
2344
|
+
request_options=request_options,
|
|
2345
|
+
)
|
|
2346
|
+
try:
|
|
2347
|
+
if 200 <= _response.status_code < 300:
|
|
2348
|
+
_data = typing.cast(
|
|
2349
|
+
GetTransacEmailsListResponse,
|
|
2350
|
+
construct_type(
|
|
2351
|
+
type_=GetTransacEmailsListResponse, # type: ignore
|
|
2352
|
+
object_=_response.json(),
|
|
2353
|
+
),
|
|
2354
|
+
)
|
|
2355
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2356
|
+
if _response.status_code == 400:
|
|
2357
|
+
raise BadRequestError(
|
|
2358
|
+
headers=dict(_response.headers),
|
|
2359
|
+
body=typing.cast(
|
|
2360
|
+
typing.Any,
|
|
2361
|
+
construct_type(
|
|
2362
|
+
type_=typing.Any, # type: ignore
|
|
2363
|
+
object_=_response.json(),
|
|
2364
|
+
),
|
|
2365
|
+
),
|
|
2366
|
+
)
|
|
2367
|
+
_response_json = _response.json()
|
|
2368
|
+
except JSONDecodeError:
|
|
2369
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2370
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2371
|
+
|
|
2372
|
+
async def get_transac_email_content(
|
|
2373
|
+
self, uuid_: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2374
|
+
) -> AsyncHttpResponse[GetTransacEmailContentResponse]:
|
|
2375
|
+
"""
|
|
2376
|
+
<Note title="How to get uuid?">
|
|
2377
|
+
You can get the uuid using either of the following methods:
|
|
2378
|
+
|
|
2379
|
+
Send a GET request to https://api.brevo.com/v3/smtp/emails and pass the message_id in the url. Use your api-key to authenticate the request and you will get your uuid as a response.
|
|
2380
|
+
|
|
2381
|
+
The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
|
|
2382
|
+
</Note>
|
|
2383
|
+
|
|
2384
|
+
Parameters
|
|
2385
|
+
----------
|
|
2386
|
+
uuid_ : str
|
|
2387
|
+
Unique id of the transactional email that has been sent to a particular contact
|
|
2388
|
+
|
|
2389
|
+
request_options : typing.Optional[RequestOptions]
|
|
2390
|
+
Request-specific configuration.
|
|
2391
|
+
|
|
2392
|
+
Returns
|
|
2393
|
+
-------
|
|
2394
|
+
AsyncHttpResponse[GetTransacEmailContentResponse]
|
|
2395
|
+
Transactional email content
|
|
2396
|
+
"""
|
|
2397
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2398
|
+
f"smtp/emails/{jsonable_encoder(uuid_)}",
|
|
2399
|
+
method="GET",
|
|
2400
|
+
request_options=request_options,
|
|
2401
|
+
)
|
|
2402
|
+
try:
|
|
2403
|
+
if 200 <= _response.status_code < 300:
|
|
2404
|
+
_data = typing.cast(
|
|
2405
|
+
GetTransacEmailContentResponse,
|
|
2406
|
+
construct_type(
|
|
2407
|
+
type_=GetTransacEmailContentResponse, # type: ignore
|
|
2408
|
+
object_=_response.json(),
|
|
2409
|
+
),
|
|
2410
|
+
)
|
|
2411
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2412
|
+
_response_json = _response.json()
|
|
2413
|
+
except JSONDecodeError:
|
|
2414
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2415
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2416
|
+
|
|
2417
|
+
async def delete_an_smtp_transactional_log(
|
|
2418
|
+
self, identifier: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2419
|
+
) -> AsyncHttpResponse[None]:
|
|
2420
|
+
"""
|
|
2421
|
+
Parameters
|
|
2422
|
+
----------
|
|
2423
|
+
identifier : str
|
|
2424
|
+
MessageId of the transactional log(s) to delete
|
|
2425
|
+
|
|
2426
|
+
request_options : typing.Optional[RequestOptions]
|
|
2427
|
+
Request-specific configuration.
|
|
2428
|
+
|
|
2429
|
+
Returns
|
|
2430
|
+
-------
|
|
2431
|
+
AsyncHttpResponse[None]
|
|
2432
|
+
"""
|
|
2433
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2434
|
+
f"smtp/log/{jsonable_encoder(identifier)}",
|
|
2435
|
+
method="DELETE",
|
|
2436
|
+
request_options=request_options,
|
|
2437
|
+
)
|
|
2438
|
+
try:
|
|
2439
|
+
if 200 <= _response.status_code < 300:
|
|
2440
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
2441
|
+
if _response.status_code == 400:
|
|
2442
|
+
raise BadRequestError(
|
|
2443
|
+
headers=dict(_response.headers),
|
|
2444
|
+
body=typing.cast(
|
|
2445
|
+
typing.Any,
|
|
2446
|
+
construct_type(
|
|
2447
|
+
type_=typing.Any, # type: ignore
|
|
2448
|
+
object_=_response.json(),
|
|
2449
|
+
),
|
|
2450
|
+
),
|
|
2451
|
+
)
|
|
2452
|
+
if _response.status_code == 404:
|
|
2453
|
+
raise NotFoundError(
|
|
2454
|
+
headers=dict(_response.headers),
|
|
2455
|
+
body=typing.cast(
|
|
2456
|
+
typing.Any,
|
|
2457
|
+
construct_type(
|
|
2458
|
+
type_=typing.Any, # type: ignore
|
|
2459
|
+
object_=_response.json(),
|
|
2460
|
+
),
|
|
2461
|
+
),
|
|
2462
|
+
)
|
|
2463
|
+
_response_json = _response.json()
|
|
2464
|
+
except JSONDecodeError:
|
|
2465
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2466
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2467
|
+
|
|
2468
|
+
async def get_aggregated_smtp_report(
|
|
2469
|
+
self,
|
|
2470
|
+
*,
|
|
2471
|
+
start_date: typing.Optional[str] = None,
|
|
2472
|
+
end_date: typing.Optional[str] = None,
|
|
2473
|
+
days: typing.Optional[int] = None,
|
|
2474
|
+
tag: typing.Optional[str] = None,
|
|
2475
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2476
|
+
) -> AsyncHttpResponse[GetAggregatedSmtpReportResponse]:
|
|
2477
|
+
"""
|
|
2478
|
+
This endpoint will show the aggregated stats for past 90 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days
|
|
2479
|
+
|
|
2480
|
+
Parameters
|
|
2481
|
+
----------
|
|
2482
|
+
start_date : typing.Optional[str]
|
|
2483
|
+
**Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate
|
|
2484
|
+
|
|
2485
|
+
end_date : typing.Optional[str]
|
|
2486
|
+
**Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate
|
|
2487
|
+
|
|
2488
|
+
days : typing.Optional[int]
|
|
2489
|
+
Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_
|
|
2490
|
+
|
|
2491
|
+
tag : typing.Optional[str]
|
|
2492
|
+
Tag of the emails
|
|
2493
|
+
|
|
2494
|
+
request_options : typing.Optional[RequestOptions]
|
|
2495
|
+
Request-specific configuration.
|
|
2496
|
+
|
|
2497
|
+
Returns
|
|
2498
|
+
-------
|
|
2499
|
+
AsyncHttpResponse[GetAggregatedSmtpReportResponse]
|
|
2500
|
+
Aggregated report informations
|
|
2501
|
+
"""
|
|
2502
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2503
|
+
"smtp/statistics/aggregatedReport",
|
|
2504
|
+
method="GET",
|
|
2505
|
+
params={
|
|
2506
|
+
"startDate": start_date,
|
|
2507
|
+
"endDate": end_date,
|
|
2508
|
+
"days": days,
|
|
2509
|
+
"tag": tag,
|
|
2510
|
+
},
|
|
2511
|
+
request_options=request_options,
|
|
2512
|
+
)
|
|
2513
|
+
try:
|
|
2514
|
+
if 200 <= _response.status_code < 300:
|
|
2515
|
+
_data = typing.cast(
|
|
2516
|
+
GetAggregatedSmtpReportResponse,
|
|
2517
|
+
construct_type(
|
|
2518
|
+
type_=GetAggregatedSmtpReportResponse, # type: ignore
|
|
2519
|
+
object_=_response.json(),
|
|
2520
|
+
),
|
|
2521
|
+
)
|
|
2522
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2523
|
+
if _response.status_code == 400:
|
|
2524
|
+
raise BadRequestError(
|
|
2525
|
+
headers=dict(_response.headers),
|
|
2526
|
+
body=typing.cast(
|
|
2527
|
+
typing.Any,
|
|
2528
|
+
construct_type(
|
|
2529
|
+
type_=typing.Any, # type: ignore
|
|
2530
|
+
object_=_response.json(),
|
|
2531
|
+
),
|
|
2532
|
+
),
|
|
2533
|
+
)
|
|
2534
|
+
_response_json = _response.json()
|
|
2535
|
+
except JSONDecodeError:
|
|
2536
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2537
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2538
|
+
|
|
2539
|
+
async def get_email_event_report(
|
|
2540
|
+
self,
|
|
2541
|
+
*,
|
|
2542
|
+
limit: typing.Optional[int] = None,
|
|
2543
|
+
offset: typing.Optional[int] = None,
|
|
2544
|
+
start_date: typing.Optional[str] = None,
|
|
2545
|
+
end_date: typing.Optional[str] = None,
|
|
2546
|
+
days: typing.Optional[int] = None,
|
|
2547
|
+
email: typing.Optional[str] = None,
|
|
2548
|
+
event: typing.Optional[GetEmailEventReportRequestEvent] = None,
|
|
2549
|
+
tags: typing.Optional[str] = None,
|
|
2550
|
+
message_id: typing.Optional[str] = None,
|
|
2551
|
+
template_id: typing.Optional[int] = None,
|
|
2552
|
+
sort: typing.Optional[GetEmailEventReportRequestSort] = None,
|
|
2553
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2554
|
+
) -> AsyncHttpResponse[GetEmailEventReportResponse]:
|
|
2555
|
+
"""
|
|
2556
|
+
This endpoint will show the aggregated stats for past 30 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days
|
|
2557
|
+
|
|
2558
|
+
Parameters
|
|
2559
|
+
----------
|
|
2560
|
+
limit : typing.Optional[int]
|
|
2561
|
+
Number limitation for the result returned
|
|
2562
|
+
|
|
2563
|
+
offset : typing.Optional[int]
|
|
2564
|
+
Beginning point in the list to retrieve from.
|
|
2565
|
+
|
|
2566
|
+
start_date : typing.Optional[str]
|
|
2567
|
+
**Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate
|
|
2568
|
+
|
|
2569
|
+
end_date : typing.Optional[str]
|
|
2570
|
+
**Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate
|
|
2571
|
+
|
|
2572
|
+
days : typing.Optional[int]
|
|
2573
|
+
Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_
|
|
2574
|
+
|
|
2575
|
+
email : typing.Optional[str]
|
|
2576
|
+
Filter the report for a specific email addresses
|
|
2577
|
+
|
|
2578
|
+
event : typing.Optional[GetEmailEventReportRequestEvent]
|
|
2579
|
+
Filter the report for a specific event type
|
|
2580
|
+
|
|
2581
|
+
tags : typing.Optional[str]
|
|
2582
|
+
Filter the report for tags (serialized and urlencoded array)
|
|
2583
|
+
|
|
2584
|
+
message_id : typing.Optional[str]
|
|
2585
|
+
Filter on a specific message id
|
|
2586
|
+
|
|
2587
|
+
template_id : typing.Optional[int]
|
|
2588
|
+
Filter on a specific template id
|
|
2589
|
+
|
|
2590
|
+
sort : typing.Optional[GetEmailEventReportRequestSort]
|
|
2591
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
2592
|
+
|
|
2593
|
+
request_options : typing.Optional[RequestOptions]
|
|
2594
|
+
Request-specific configuration.
|
|
2595
|
+
|
|
2596
|
+
Returns
|
|
2597
|
+
-------
|
|
2598
|
+
AsyncHttpResponse[GetEmailEventReportResponse]
|
|
2599
|
+
Email events report informations
|
|
2600
|
+
"""
|
|
2601
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2602
|
+
"smtp/statistics/events",
|
|
2603
|
+
method="GET",
|
|
2604
|
+
params={
|
|
2605
|
+
"limit": limit,
|
|
2606
|
+
"offset": offset,
|
|
2607
|
+
"startDate": start_date,
|
|
2608
|
+
"endDate": end_date,
|
|
2609
|
+
"days": days,
|
|
2610
|
+
"email": email,
|
|
2611
|
+
"event": event,
|
|
2612
|
+
"tags": tags,
|
|
2613
|
+
"messageId": message_id,
|
|
2614
|
+
"templateId": template_id,
|
|
2615
|
+
"sort": sort,
|
|
2616
|
+
},
|
|
2617
|
+
request_options=request_options,
|
|
2618
|
+
)
|
|
2619
|
+
try:
|
|
2620
|
+
if 200 <= _response.status_code < 300:
|
|
2621
|
+
_data = typing.cast(
|
|
2622
|
+
GetEmailEventReportResponse,
|
|
2623
|
+
construct_type(
|
|
2624
|
+
type_=GetEmailEventReportResponse, # type: ignore
|
|
2625
|
+
object_=_response.json(),
|
|
2626
|
+
),
|
|
2627
|
+
)
|
|
2628
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2629
|
+
if _response.status_code == 400:
|
|
2630
|
+
raise BadRequestError(
|
|
2631
|
+
headers=dict(_response.headers),
|
|
2632
|
+
body=typing.cast(
|
|
2633
|
+
typing.Any,
|
|
2634
|
+
construct_type(
|
|
2635
|
+
type_=typing.Any, # type: ignore
|
|
2636
|
+
object_=_response.json(),
|
|
2637
|
+
),
|
|
2638
|
+
),
|
|
2639
|
+
)
|
|
2640
|
+
_response_json = _response.json()
|
|
2641
|
+
except JSONDecodeError:
|
|
2642
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2643
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2644
|
+
|
|
2645
|
+
async def get_smtp_report(
|
|
2646
|
+
self,
|
|
2647
|
+
*,
|
|
2648
|
+
limit: typing.Optional[int] = None,
|
|
2649
|
+
offset: typing.Optional[int] = None,
|
|
2650
|
+
start_date: typing.Optional[str] = None,
|
|
2651
|
+
end_date: typing.Optional[str] = None,
|
|
2652
|
+
days: typing.Optional[int] = None,
|
|
2653
|
+
tag: typing.Optional[str] = None,
|
|
2654
|
+
sort: typing.Optional[GetSmtpReportRequestSort] = None,
|
|
2655
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2656
|
+
) -> AsyncHttpResponse[GetSmtpReportResponse]:
|
|
2657
|
+
"""
|
|
2658
|
+
Parameters
|
|
2659
|
+
----------
|
|
2660
|
+
limit : typing.Optional[int]
|
|
2661
|
+
Number of documents returned per page
|
|
2662
|
+
|
|
2663
|
+
offset : typing.Optional[int]
|
|
2664
|
+
Index of the first document on the page
|
|
2665
|
+
|
|
2666
|
+
start_date : typing.Optional[str]
|
|
2667
|
+
**Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD)
|
|
2668
|
+
|
|
2669
|
+
end_date : typing.Optional[str]
|
|
2670
|
+
**Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD)
|
|
2671
|
+
|
|
2672
|
+
days : typing.Optional[int]
|
|
2673
|
+
Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_
|
|
2674
|
+
|
|
2675
|
+
tag : typing.Optional[str]
|
|
2676
|
+
Tag of the emails
|
|
2677
|
+
|
|
2678
|
+
sort : typing.Optional[GetSmtpReportRequestSort]
|
|
2679
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
2680
|
+
|
|
2681
|
+
request_options : typing.Optional[RequestOptions]
|
|
2682
|
+
Request-specific configuration.
|
|
2683
|
+
|
|
2684
|
+
Returns
|
|
2685
|
+
-------
|
|
2686
|
+
AsyncHttpResponse[GetSmtpReportResponse]
|
|
2687
|
+
Aggregated report informations
|
|
2688
|
+
"""
|
|
2689
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2690
|
+
"smtp/statistics/reports",
|
|
2691
|
+
method="GET",
|
|
2692
|
+
params={
|
|
2693
|
+
"limit": limit,
|
|
2694
|
+
"offset": offset,
|
|
2695
|
+
"startDate": start_date,
|
|
2696
|
+
"endDate": end_date,
|
|
2697
|
+
"days": days,
|
|
2698
|
+
"tag": tag,
|
|
2699
|
+
"sort": sort,
|
|
2700
|
+
},
|
|
2701
|
+
request_options=request_options,
|
|
2702
|
+
)
|
|
2703
|
+
try:
|
|
2704
|
+
if 200 <= _response.status_code < 300:
|
|
2705
|
+
_data = typing.cast(
|
|
2706
|
+
GetSmtpReportResponse,
|
|
2707
|
+
construct_type(
|
|
2708
|
+
type_=GetSmtpReportResponse, # type: ignore
|
|
2709
|
+
object_=_response.json(),
|
|
2710
|
+
),
|
|
2711
|
+
)
|
|
2712
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2713
|
+
if _response.status_code == 400:
|
|
2714
|
+
raise BadRequestError(
|
|
2715
|
+
headers=dict(_response.headers),
|
|
2716
|
+
body=typing.cast(
|
|
2717
|
+
typing.Any,
|
|
2718
|
+
construct_type(
|
|
2719
|
+
type_=typing.Any, # type: ignore
|
|
2720
|
+
object_=_response.json(),
|
|
2721
|
+
),
|
|
2722
|
+
),
|
|
2723
|
+
)
|
|
2724
|
+
_response_json = _response.json()
|
|
2725
|
+
except JSONDecodeError:
|
|
2726
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2727
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2728
|
+
|
|
2729
|
+
async def post_preview_smtp_email_templates(
|
|
2730
|
+
self, *, request: typing.Any, request_options: typing.Optional[RequestOptions] = None
|
|
2731
|
+
) -> AsyncHttpResponse[PostPreviewSmtpEmailTemplatesResponse]:
|
|
2732
|
+
"""
|
|
2733
|
+
Parameters
|
|
2734
|
+
----------
|
|
2735
|
+
request : typing.Any
|
|
2736
|
+
|
|
2737
|
+
request_options : typing.Optional[RequestOptions]
|
|
2738
|
+
Request-specific configuration.
|
|
2739
|
+
|
|
2740
|
+
Returns
|
|
2741
|
+
-------
|
|
2742
|
+
AsyncHttpResponse[PostPreviewSmtpEmailTemplatesResponse]
|
|
2743
|
+
successfully fetched template's preview fields
|
|
2744
|
+
"""
|
|
2745
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2746
|
+
"smtp/template/preview",
|
|
2747
|
+
method="POST",
|
|
2748
|
+
json=request,
|
|
2749
|
+
headers={
|
|
2750
|
+
"content-type": "application/json",
|
|
2751
|
+
},
|
|
2752
|
+
request_options=request_options,
|
|
2753
|
+
omit=OMIT,
|
|
2754
|
+
)
|
|
2755
|
+
try:
|
|
2756
|
+
if 200 <= _response.status_code < 300:
|
|
2757
|
+
_data = typing.cast(
|
|
2758
|
+
PostPreviewSmtpEmailTemplatesResponse,
|
|
2759
|
+
construct_type(
|
|
2760
|
+
type_=PostPreviewSmtpEmailTemplatesResponse, # type: ignore
|
|
2761
|
+
object_=_response.json(),
|
|
2762
|
+
),
|
|
2763
|
+
)
|
|
2764
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2765
|
+
if _response.status_code == 400:
|
|
2766
|
+
raise BadRequestError(
|
|
2767
|
+
headers=dict(_response.headers),
|
|
2768
|
+
body=typing.cast(
|
|
2769
|
+
typing.Any,
|
|
2770
|
+
construct_type(
|
|
2771
|
+
type_=typing.Any, # type: ignore
|
|
2772
|
+
object_=_response.json(),
|
|
2773
|
+
),
|
|
2774
|
+
),
|
|
2775
|
+
)
|
|
2776
|
+
_response_json = _response.json()
|
|
2777
|
+
except JSONDecodeError:
|
|
2778
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2779
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2780
|
+
|
|
2781
|
+
async def get_smtp_templates(
|
|
2782
|
+
self,
|
|
2783
|
+
*,
|
|
2784
|
+
template_status: typing.Optional[bool] = None,
|
|
2785
|
+
limit: typing.Optional[int] = None,
|
|
2786
|
+
offset: typing.Optional[int] = None,
|
|
2787
|
+
sort: typing.Optional[GetSmtpTemplatesRequestSort] = None,
|
|
2788
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2789
|
+
) -> AsyncHttpResponse[GetSmtpTemplatesResponse]:
|
|
2790
|
+
"""
|
|
2791
|
+
Parameters
|
|
2792
|
+
----------
|
|
2793
|
+
template_status : typing.Optional[bool]
|
|
2794
|
+
Filter on the status of the template. Active = true, inactive = false
|
|
2795
|
+
|
|
2796
|
+
limit : typing.Optional[int]
|
|
2797
|
+
Number of documents returned per page
|
|
2798
|
+
|
|
2799
|
+
offset : typing.Optional[int]
|
|
2800
|
+
Index of the first document in the page
|
|
2801
|
+
|
|
2802
|
+
sort : typing.Optional[GetSmtpTemplatesRequestSort]
|
|
2803
|
+
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
|
|
2804
|
+
|
|
2805
|
+
request_options : typing.Optional[RequestOptions]
|
|
2806
|
+
Request-specific configuration.
|
|
2807
|
+
|
|
2808
|
+
Returns
|
|
2809
|
+
-------
|
|
2810
|
+
AsyncHttpResponse[GetSmtpTemplatesResponse]
|
|
2811
|
+
transactional email templates informations
|
|
2812
|
+
"""
|
|
2813
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2814
|
+
"smtp/templates",
|
|
2815
|
+
method="GET",
|
|
2816
|
+
params={
|
|
2817
|
+
"templateStatus": template_status,
|
|
2818
|
+
"limit": limit,
|
|
2819
|
+
"offset": offset,
|
|
2820
|
+
"sort": sort,
|
|
2821
|
+
},
|
|
2822
|
+
request_options=request_options,
|
|
2823
|
+
)
|
|
2824
|
+
try:
|
|
2825
|
+
if 200 <= _response.status_code < 300:
|
|
2826
|
+
_data = typing.cast(
|
|
2827
|
+
GetSmtpTemplatesResponse,
|
|
2828
|
+
construct_type(
|
|
2829
|
+
type_=GetSmtpTemplatesResponse, # type: ignore
|
|
2830
|
+
object_=_response.json(),
|
|
2831
|
+
),
|
|
2832
|
+
)
|
|
2833
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2834
|
+
if _response.status_code == 400:
|
|
2835
|
+
raise BadRequestError(
|
|
2836
|
+
headers=dict(_response.headers),
|
|
2837
|
+
body=typing.cast(
|
|
2838
|
+
typing.Any,
|
|
2839
|
+
construct_type(
|
|
2840
|
+
type_=typing.Any, # type: ignore
|
|
2841
|
+
object_=_response.json(),
|
|
2842
|
+
),
|
|
2843
|
+
),
|
|
2844
|
+
)
|
|
2845
|
+
_response_json = _response.json()
|
|
2846
|
+
except JSONDecodeError:
|
|
2847
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2848
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2849
|
+
|
|
2850
|
+
async def create_smtp_template(
|
|
2851
|
+
self,
|
|
2852
|
+
*,
|
|
2853
|
+
sender: CreateSmtpTemplateRequestSender,
|
|
2854
|
+
subject: str,
|
|
2855
|
+
template_name: str,
|
|
2856
|
+
attachment_url: typing.Optional[str] = OMIT,
|
|
2857
|
+
html_content: typing.Optional[str] = OMIT,
|
|
2858
|
+
html_url: typing.Optional[str] = OMIT,
|
|
2859
|
+
is_active: typing.Optional[bool] = OMIT,
|
|
2860
|
+
reply_to: typing.Optional[str] = OMIT,
|
|
2861
|
+
tag: typing.Optional[str] = OMIT,
|
|
2862
|
+
to_field: typing.Optional[str] = OMIT,
|
|
2863
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2864
|
+
) -> AsyncHttpResponse[CreateSmtpTemplateResponse]:
|
|
2865
|
+
"""
|
|
2866
|
+
Parameters
|
|
2867
|
+
----------
|
|
2868
|
+
sender : CreateSmtpTemplateRequestSender
|
|
2869
|
+
Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{"name":"xyz", "email":"example@abc.com"}** **{"name":"xyz", "id":123}**
|
|
2870
|
+
|
|
2871
|
+
subject : str
|
|
2872
|
+
Subject of the template
|
|
2873
|
+
|
|
2874
|
+
template_name : str
|
|
2875
|
+
Name of the template
|
|
2876
|
+
|
|
2877
|
+
attachment_url : typing.Optional[str]
|
|
2878
|
+
Absolute url of the attachment (**no local file**). Extension allowed: #### xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps'
|
|
2879
|
+
|
|
2880
|
+
html_content : typing.Optional[str]
|
|
2881
|
+
Body of the message (HTML version). The field must have more than 10 characters. **REQUIRED if htmlUrl is empty**
|
|
2882
|
+
|
|
2883
|
+
html_url : typing.Optional[str]
|
|
2884
|
+
Url which contents the body of the email message. REQUIRED if htmlContent is empty
|
|
2885
|
+
|
|
2886
|
+
is_active : typing.Optional[bool]
|
|
2887
|
+
Status of template. isActive = true means template is active and isActive = false means template is inactive
|
|
2888
|
+
|
|
2889
|
+
reply_to : typing.Optional[str]
|
|
2890
|
+
Email on which campaign recipients will be able to reply to
|
|
2891
|
+
|
|
2892
|
+
tag : typing.Optional[str]
|
|
2893
|
+
Tag of the template
|
|
2894
|
+
|
|
2895
|
+
to_field : typing.Optional[str]
|
|
2896
|
+
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
|
|
2897
|
+
|
|
2898
|
+
request_options : typing.Optional[RequestOptions]
|
|
2899
|
+
Request-specific configuration.
|
|
2900
|
+
|
|
2901
|
+
Returns
|
|
2902
|
+
-------
|
|
2903
|
+
AsyncHttpResponse[CreateSmtpTemplateResponse]
|
|
2904
|
+
successfully created
|
|
2905
|
+
"""
|
|
2906
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2907
|
+
"smtp/templates",
|
|
2908
|
+
method="POST",
|
|
2909
|
+
json={
|
|
2910
|
+
"attachmentUrl": attachment_url,
|
|
2911
|
+
"htmlContent": html_content,
|
|
2912
|
+
"htmlUrl": html_url,
|
|
2913
|
+
"isActive": is_active,
|
|
2914
|
+
"replyTo": reply_to,
|
|
2915
|
+
"sender": convert_and_respect_annotation_metadata(
|
|
2916
|
+
object_=sender, annotation=CreateSmtpTemplateRequestSender, direction="write"
|
|
2917
|
+
),
|
|
2918
|
+
"subject": subject,
|
|
2919
|
+
"tag": tag,
|
|
2920
|
+
"templateName": template_name,
|
|
2921
|
+
"toField": to_field,
|
|
2922
|
+
},
|
|
2923
|
+
headers={
|
|
2924
|
+
"content-type": "application/json",
|
|
2925
|
+
},
|
|
2926
|
+
request_options=request_options,
|
|
2927
|
+
omit=OMIT,
|
|
2928
|
+
)
|
|
2929
|
+
try:
|
|
2930
|
+
if 200 <= _response.status_code < 300:
|
|
2931
|
+
_data = typing.cast(
|
|
2932
|
+
CreateSmtpTemplateResponse,
|
|
2933
|
+
construct_type(
|
|
2934
|
+
type_=CreateSmtpTemplateResponse, # type: ignore
|
|
2935
|
+
object_=_response.json(),
|
|
2936
|
+
),
|
|
2937
|
+
)
|
|
2938
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2939
|
+
if _response.status_code == 400:
|
|
2940
|
+
raise BadRequestError(
|
|
2941
|
+
headers=dict(_response.headers),
|
|
2942
|
+
body=typing.cast(
|
|
2943
|
+
typing.Any,
|
|
2944
|
+
construct_type(
|
|
2945
|
+
type_=typing.Any, # type: ignore
|
|
2946
|
+
object_=_response.json(),
|
|
2947
|
+
),
|
|
2948
|
+
),
|
|
2949
|
+
)
|
|
2950
|
+
_response_json = _response.json()
|
|
2951
|
+
except JSONDecodeError:
|
|
2952
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2953
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2954
|
+
|
|
2955
|
+
async def get_smtp_template(
|
|
2956
|
+
self, template_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
2957
|
+
) -> AsyncHttpResponse[GetSmtpTemplateOverview]:
|
|
2958
|
+
"""
|
|
2959
|
+
Parameters
|
|
2960
|
+
----------
|
|
2961
|
+
template_id : int
|
|
2962
|
+
id of the template
|
|
2963
|
+
|
|
2964
|
+
request_options : typing.Optional[RequestOptions]
|
|
2965
|
+
Request-specific configuration.
|
|
2966
|
+
|
|
2967
|
+
Returns
|
|
2968
|
+
-------
|
|
2969
|
+
AsyncHttpResponse[GetSmtpTemplateOverview]
|
|
2970
|
+
Email template informations
|
|
2971
|
+
"""
|
|
2972
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2973
|
+
f"smtp/templates/{jsonable_encoder(template_id)}",
|
|
2974
|
+
method="GET",
|
|
2975
|
+
request_options=request_options,
|
|
2976
|
+
)
|
|
2977
|
+
try:
|
|
2978
|
+
if 200 <= _response.status_code < 300:
|
|
2979
|
+
_data = typing.cast(
|
|
2980
|
+
GetSmtpTemplateOverview,
|
|
2981
|
+
construct_type(
|
|
2982
|
+
type_=GetSmtpTemplateOverview, # type: ignore
|
|
2983
|
+
object_=_response.json(),
|
|
2984
|
+
),
|
|
2985
|
+
)
|
|
2986
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2987
|
+
if _response.status_code == 400:
|
|
2988
|
+
raise BadRequestError(
|
|
2989
|
+
headers=dict(_response.headers),
|
|
2990
|
+
body=typing.cast(
|
|
2991
|
+
typing.Any,
|
|
2992
|
+
construct_type(
|
|
2993
|
+
type_=typing.Any, # type: ignore
|
|
2994
|
+
object_=_response.json(),
|
|
2995
|
+
),
|
|
2996
|
+
),
|
|
2997
|
+
)
|
|
2998
|
+
if _response.status_code == 404:
|
|
2999
|
+
raise NotFoundError(
|
|
3000
|
+
headers=dict(_response.headers),
|
|
3001
|
+
body=typing.cast(
|
|
3002
|
+
typing.Any,
|
|
3003
|
+
construct_type(
|
|
3004
|
+
type_=typing.Any, # type: ignore
|
|
3005
|
+
object_=_response.json(),
|
|
3006
|
+
),
|
|
3007
|
+
),
|
|
3008
|
+
)
|
|
3009
|
+
_response_json = _response.json()
|
|
3010
|
+
except JSONDecodeError:
|
|
3011
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3012
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3013
|
+
|
|
3014
|
+
async def update_smtp_template(
|
|
3015
|
+
self,
|
|
3016
|
+
template_id: int,
|
|
3017
|
+
*,
|
|
3018
|
+
attachment_url: typing.Optional[str] = OMIT,
|
|
3019
|
+
html_content: typing.Optional[str] = OMIT,
|
|
3020
|
+
html_url: typing.Optional[str] = OMIT,
|
|
3021
|
+
is_active: typing.Optional[bool] = OMIT,
|
|
3022
|
+
reply_to: typing.Optional[str] = OMIT,
|
|
3023
|
+
sender: typing.Optional[UpdateSmtpTemplateRequestSender] = OMIT,
|
|
3024
|
+
subject: typing.Optional[str] = OMIT,
|
|
3025
|
+
tag: typing.Optional[str] = OMIT,
|
|
3026
|
+
template_name: typing.Optional[str] = OMIT,
|
|
3027
|
+
to_field: typing.Optional[str] = OMIT,
|
|
3028
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3029
|
+
) -> AsyncHttpResponse[None]:
|
|
3030
|
+
"""
|
|
3031
|
+
Parameters
|
|
3032
|
+
----------
|
|
3033
|
+
template_id : int
|
|
3034
|
+
id of the template
|
|
3035
|
+
|
|
3036
|
+
attachment_url : typing.Optional[str]
|
|
3037
|
+
Absolute url of the attachment (**no local file**). Extensions allowed: #### xlsx, xls, ods, docx, docm, doc, csv, pdf, txt, gif, jpg, jpeg, png, tif, tiff, rtf, bmp, cgm, css, shtml, html, htm, zip, xml, ppt, pptx, tar, ez, ics, mobi, msg, pub and eps
|
|
3038
|
+
|
|
3039
|
+
html_content : typing.Optional[str]
|
|
3040
|
+
**Required if htmlUrl is empty**. If the template is designed using Drag & Drop editor via HTML content, then the design page will not have Drag & Drop editor access for that template. Body of the message (HTML must have more than 10 characters)
|
|
3041
|
+
|
|
3042
|
+
html_url : typing.Optional[str]
|
|
3043
|
+
**Required if htmlContent is empty**. URL to the body of the email (HTML)
|
|
3044
|
+
|
|
3045
|
+
is_active : typing.Optional[bool]
|
|
3046
|
+
Status of the template. isActive = false means template is inactive, isActive = true means template is active
|
|
3047
|
+
|
|
3048
|
+
reply_to : typing.Optional[str]
|
|
3049
|
+
Email on which campaign recipients will be able to reply to
|
|
3050
|
+
|
|
3051
|
+
sender : typing.Optional[UpdateSmtpTemplateRequestSender]
|
|
3052
|
+
Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{"name":"xyz", "email":"example@abc.com"}** **{"name":"xyz", "id":123}**
|
|
3053
|
+
|
|
3054
|
+
subject : typing.Optional[str]
|
|
3055
|
+
Subject of the email
|
|
3056
|
+
|
|
3057
|
+
tag : typing.Optional[str]
|
|
3058
|
+
Tag of the template
|
|
3059
|
+
|
|
3060
|
+
template_name : typing.Optional[str]
|
|
3061
|
+
Name of the template
|
|
3062
|
+
|
|
3063
|
+
to_field : typing.Optional[str]
|
|
3064
|
+
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
|
|
3065
|
+
|
|
3066
|
+
request_options : typing.Optional[RequestOptions]
|
|
3067
|
+
Request-specific configuration.
|
|
3068
|
+
|
|
3069
|
+
Returns
|
|
3070
|
+
-------
|
|
3071
|
+
AsyncHttpResponse[None]
|
|
3072
|
+
"""
|
|
3073
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3074
|
+
f"smtp/templates/{jsonable_encoder(template_id)}",
|
|
3075
|
+
method="PUT",
|
|
3076
|
+
json={
|
|
3077
|
+
"attachmentUrl": attachment_url,
|
|
3078
|
+
"htmlContent": html_content,
|
|
3079
|
+
"htmlUrl": html_url,
|
|
3080
|
+
"isActive": is_active,
|
|
3081
|
+
"replyTo": reply_to,
|
|
3082
|
+
"sender": convert_and_respect_annotation_metadata(
|
|
3083
|
+
object_=sender, annotation=UpdateSmtpTemplateRequestSender, direction="write"
|
|
3084
|
+
),
|
|
3085
|
+
"subject": subject,
|
|
3086
|
+
"tag": tag,
|
|
3087
|
+
"templateName": template_name,
|
|
3088
|
+
"toField": to_field,
|
|
3089
|
+
},
|
|
3090
|
+
headers={
|
|
3091
|
+
"content-type": "application/json",
|
|
3092
|
+
},
|
|
3093
|
+
request_options=request_options,
|
|
3094
|
+
omit=OMIT,
|
|
3095
|
+
)
|
|
3096
|
+
try:
|
|
3097
|
+
if 200 <= _response.status_code < 300:
|
|
3098
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
3099
|
+
if _response.status_code == 400:
|
|
3100
|
+
raise BadRequestError(
|
|
3101
|
+
headers=dict(_response.headers),
|
|
3102
|
+
body=typing.cast(
|
|
3103
|
+
typing.Any,
|
|
3104
|
+
construct_type(
|
|
3105
|
+
type_=typing.Any, # type: ignore
|
|
3106
|
+
object_=_response.json(),
|
|
3107
|
+
),
|
|
3108
|
+
),
|
|
3109
|
+
)
|
|
3110
|
+
if _response.status_code == 404:
|
|
3111
|
+
raise NotFoundError(
|
|
3112
|
+
headers=dict(_response.headers),
|
|
3113
|
+
body=typing.cast(
|
|
3114
|
+
typing.Any,
|
|
3115
|
+
construct_type(
|
|
3116
|
+
type_=typing.Any, # type: ignore
|
|
3117
|
+
object_=_response.json(),
|
|
3118
|
+
),
|
|
3119
|
+
),
|
|
3120
|
+
)
|
|
3121
|
+
_response_json = _response.json()
|
|
3122
|
+
except JSONDecodeError:
|
|
3123
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3124
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3125
|
+
|
|
3126
|
+
async def delete_smtp_template(
|
|
3127
|
+
self, template_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
3128
|
+
) -> AsyncHttpResponse[None]:
|
|
3129
|
+
"""
|
|
3130
|
+
Parameters
|
|
3131
|
+
----------
|
|
3132
|
+
template_id : int
|
|
3133
|
+
id of the template
|
|
3134
|
+
|
|
3135
|
+
request_options : typing.Optional[RequestOptions]
|
|
3136
|
+
Request-specific configuration.
|
|
3137
|
+
|
|
3138
|
+
Returns
|
|
3139
|
+
-------
|
|
3140
|
+
AsyncHttpResponse[None]
|
|
3141
|
+
"""
|
|
3142
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3143
|
+
f"smtp/templates/{jsonable_encoder(template_id)}",
|
|
3144
|
+
method="DELETE",
|
|
3145
|
+
request_options=request_options,
|
|
3146
|
+
)
|
|
3147
|
+
try:
|
|
3148
|
+
if 200 <= _response.status_code < 300:
|
|
3149
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
3150
|
+
if _response.status_code == 400:
|
|
3151
|
+
raise BadRequestError(
|
|
3152
|
+
headers=dict(_response.headers),
|
|
3153
|
+
body=typing.cast(
|
|
3154
|
+
typing.Any,
|
|
3155
|
+
construct_type(
|
|
3156
|
+
type_=typing.Any, # type: ignore
|
|
3157
|
+
object_=_response.json(),
|
|
3158
|
+
),
|
|
3159
|
+
),
|
|
3160
|
+
)
|
|
3161
|
+
if _response.status_code == 404:
|
|
3162
|
+
raise NotFoundError(
|
|
3163
|
+
headers=dict(_response.headers),
|
|
3164
|
+
body=typing.cast(
|
|
3165
|
+
typing.Any,
|
|
3166
|
+
construct_type(
|
|
3167
|
+
type_=typing.Any, # type: ignore
|
|
3168
|
+
object_=_response.json(),
|
|
3169
|
+
),
|
|
3170
|
+
),
|
|
3171
|
+
)
|
|
3172
|
+
_response_json = _response.json()
|
|
3173
|
+
except JSONDecodeError:
|
|
3174
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3175
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3176
|
+
|
|
3177
|
+
async def send_test_template(
|
|
3178
|
+
self,
|
|
3179
|
+
template_id: int,
|
|
3180
|
+
*,
|
|
3181
|
+
email_to: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
3182
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3183
|
+
) -> AsyncHttpResponse[None]:
|
|
3184
|
+
"""
|
|
3185
|
+
Parameters
|
|
3186
|
+
----------
|
|
3187
|
+
template_id : int
|
|
3188
|
+
Id of the template
|
|
3189
|
+
|
|
3190
|
+
email_to : typing.Optional[typing.Sequence[str]]
|
|
3191
|
+
List of the email addresses of the recipients whom you wish to send the test mail. _If left empty, the test mail will be sent to your entire test list. You can not send more than 50 test emails per day_.
|
|
3192
|
+
|
|
3193
|
+
request_options : typing.Optional[RequestOptions]
|
|
3194
|
+
Request-specific configuration.
|
|
3195
|
+
|
|
3196
|
+
Returns
|
|
3197
|
+
-------
|
|
3198
|
+
AsyncHttpResponse[None]
|
|
3199
|
+
"""
|
|
3200
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3201
|
+
f"smtp/templates/{jsonable_encoder(template_id)}/sendTest",
|
|
3202
|
+
method="POST",
|
|
3203
|
+
json={
|
|
3204
|
+
"emailTo": email_to,
|
|
3205
|
+
},
|
|
3206
|
+
headers={
|
|
3207
|
+
"content-type": "application/json",
|
|
3208
|
+
},
|
|
3209
|
+
request_options=request_options,
|
|
3210
|
+
omit=OMIT,
|
|
3211
|
+
)
|
|
3212
|
+
try:
|
|
3213
|
+
if 200 <= _response.status_code < 300:
|
|
3214
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
3215
|
+
if _response.status_code == 400:
|
|
3216
|
+
raise BadRequestError(
|
|
3217
|
+
headers=dict(_response.headers),
|
|
3218
|
+
body=typing.cast(
|
|
3219
|
+
typing.Any,
|
|
3220
|
+
construct_type(
|
|
3221
|
+
type_=typing.Any, # type: ignore
|
|
3222
|
+
object_=_response.json(),
|
|
3223
|
+
),
|
|
3224
|
+
),
|
|
3225
|
+
)
|
|
3226
|
+
if _response.status_code == 404:
|
|
3227
|
+
raise NotFoundError(
|
|
3228
|
+
headers=dict(_response.headers),
|
|
3229
|
+
body=typing.cast(
|
|
3230
|
+
typing.Any,
|
|
3231
|
+
construct_type(
|
|
3232
|
+
type_=typing.Any, # type: ignore
|
|
3233
|
+
object_=_response.json(),
|
|
3234
|
+
),
|
|
3235
|
+
),
|
|
3236
|
+
)
|
|
3237
|
+
_response_json = _response.json()
|
|
3238
|
+
except JSONDecodeError:
|
|
3239
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3240
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|