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.
Files changed (843) hide show
  1. brevo/__init__.py +2253 -0
  2. brevo/account/__init__.py +79 -0
  3. brevo/account/client.py +317 -0
  4. brevo/account/raw_client.py +341 -0
  5. brevo/account/types/__init__.py +77 -0
  6. brevo/account/types/get_account_activity_response.py +24 -0
  7. brevo/account/types/get_account_activity_response_logs_item.py +45 -0
  8. brevo/account/types/get_account_response.py +85 -0
  9. brevo/account/types/get_account_response_address.py +43 -0
  10. brevo/account/types/get_account_response_date_time_preferences.py +38 -0
  11. brevo/account/types/get_account_response_marketing_automation.py +29 -0
  12. brevo/account/types/get_account_response_plan_item.py +53 -0
  13. brevo/account/types/get_account_response_plan_item_type.py +5 -0
  14. brevo/account/types/get_account_response_plan_verticals_item.py +63 -0
  15. brevo/account/types/get_account_response_plan_verticals_item_plan_category.py +5 -0
  16. brevo/account/types/get_account_response_plan_verticals_item_status.py +5 -0
  17. brevo/account/types/get_account_response_plan_verticals_item_users.py +35 -0
  18. brevo/account/types/get_account_response_relay.py +34 -0
  19. brevo/account/types/get_account_response_relay_data.py +40 -0
  20. brevo/balance/__init__.py +139 -0
  21. brevo/balance/client.py +2589 -0
  22. brevo/balance/raw_client.py +4538 -0
  23. brevo/balance/types/__init__.py +169 -0
  24. brevo/balance/types/create_balance_limit_request_constraint_type.py +5 -0
  25. brevo/balance/types/create_balance_limit_request_duration_unit.py +5 -0
  26. brevo/balance/types/create_balance_limit_request_transaction_type.py +5 -0
  27. brevo/balance/types/create_balance_order_response.py +96 -0
  28. brevo/balance/types/get_balance_definition_list_request_sort.py +5 -0
  29. brevo/balance/types/get_balance_definition_list_request_sort_field.py +5 -0
  30. brevo/balance/types/get_balance_definition_list_request_version.py +5 -0
  31. brevo/balance/types/get_balance_definition_list_response.py +24 -0
  32. brevo/balance/types/get_balance_definition_request_version.py +5 -0
  33. brevo/balance/types/get_balance_limit_request_version.py +5 -0
  34. brevo/balance/types/get_contact_balances_response.py +30 -0
  35. brevo/balance/types/get_contact_balances_response_balances_item.py +33 -0
  36. brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_request_sort.py +5 -0
  37. brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_request_sort_field.py +7 -0
  38. brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response.py +57 -0
  39. brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item.py +77 -0
  40. brevo/balance/types/get_subscription_balances_response.py +21 -0
  41. brevo/balance/types/get_subscription_balances_response_balance_item.py +30 -0
  42. brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_modifier.py +7 -0
  43. brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_unit.py +7 -0
  44. brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_amount_overtaking_strategy.py +7 -0
  45. brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_credit_rounding.py +7 -0
  46. brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_debit_rounding.py +7 -0
  47. brevo/balance/types/post_loyalty_balance_programs_pid_balance_definitions_request_unit.py +26 -0
  48. brevo/balance/types/post_loyalty_balance_programs_pid_subscriptions_cid_balances_response.py +66 -0
  49. brevo/balance/types/update_balance_definition_request_balance_availability_duration_modifier.py +7 -0
  50. brevo/balance/types/update_balance_definition_request_balance_availability_duration_unit.py +7 -0
  51. brevo/balance/types/update_balance_definition_request_balance_option_amount_overtaking_strategy.py +7 -0
  52. brevo/balance/types/update_balance_definition_request_balance_option_credit_rounding.py +7 -0
  53. brevo/balance/types/update_balance_definition_request_balance_option_debit_rounding.py +7 -0
  54. brevo/balance/types/update_balance_definition_request_unit.py +26 -0
  55. brevo/balance/types/update_balance_limit_request_constraint_type.py +5 -0
  56. brevo/balance/types/update_balance_limit_request_duration_unit.py +5 -0
  57. brevo/balance/types/update_balance_limit_request_transaction_type.py +5 -0
  58. brevo/client.py +773 -0
  59. brevo/companies/__init__.py +61 -0
  60. brevo/companies/client.py +994 -0
  61. brevo/companies/raw_client.py +1285 -0
  62. brevo/companies/types/__init__.py +59 -0
  63. brevo/companies/types/get_companies_request_sort.py +5 -0
  64. brevo/companies/types/get_companies_response.py +28 -0
  65. brevo/companies/types/get_crm_attributes_companies_response_item.py +40 -0
  66. brevo/companies/types/post_companies_import_response.py +26 -0
  67. brevo/companies/types/post_companies_response.py +27 -0
  68. brevo/companies/types/post_crm_attributes_request_attribute_type.py +7 -0
  69. brevo/companies/types/post_crm_attributes_request_object_type.py +5 -0
  70. brevo/companies/types/post_crm_attributes_response.py +23 -0
  71. brevo/contacts/__init__.py +289 -0
  72. brevo/contacts/client.py +3298 -0
  73. brevo/contacts/raw_client.py +4614 -0
  74. brevo/contacts/types/__init__.py +309 -0
  75. brevo/contacts/types/add_contact_to_list_request_body.py +11 -0
  76. brevo/contacts/types/add_contact_to_list_request_body_emails.py +23 -0
  77. brevo/contacts/types/add_contact_to_list_request_body_ext_ids.py +29 -0
  78. brevo/contacts/types/add_contact_to_list_request_body_ids.py +23 -0
  79. brevo/contacts/types/create_attribute_request_attribute_category.py +7 -0
  80. brevo/contacts/types/create_attribute_request_enumeration_item.py +28 -0
  81. brevo/contacts/types/create_attribute_request_type.py +7 -0
  82. brevo/contacts/types/create_contact_request_attributes_value.py +5 -0
  83. brevo/contacts/types/create_contact_response.py +23 -0
  84. brevo/contacts/types/create_doi_contact_request_attributes_value.py +5 -0
  85. brevo/contacts/types/create_folder_response.py +23 -0
  86. brevo/contacts/types/create_list_response.py +23 -0
  87. brevo/contacts/types/delete_attribute_request_attribute_category.py +7 -0
  88. brevo/contacts/types/delete_contact_request_identifier.py +5 -0
  89. brevo/contacts/types/delete_contact_request_identifier_type.py +7 -0
  90. brevo/contacts/types/get_attributes_response.py +24 -0
  91. brevo/contacts/types/get_attributes_response_attributes_item.py +57 -0
  92. brevo/contacts/types/get_attributes_response_attributes_item_category.py +7 -0
  93. brevo/contacts/types/get_attributes_response_attributes_item_enumeration_item.py +28 -0
  94. brevo/contacts/types/get_attributes_response_attributes_item_type.py +7 -0
  95. brevo/contacts/types/get_contact_info_request_identifier.py +5 -0
  96. brevo/contacts/types/get_contact_info_request_identifier_type.py +7 -0
  97. brevo/contacts/types/get_contact_info_response.py +80 -0
  98. brevo/contacts/types/get_contact_info_response_attributes.py +22 -0
  99. brevo/contacts/types/get_contact_info_response_statistics.py +86 -0
  100. brevo/contacts/types/get_contact_info_response_statistics_clicked_item.py +33 -0
  101. brevo/contacts/types/get_contact_info_response_statistics_clicked_item_links_item.py +40 -0
  102. brevo/contacts/types/get_contact_info_response_statistics_complaints_item.py +31 -0
  103. brevo/contacts/types/get_contact_info_response_statistics_delivered_item.py +31 -0
  104. brevo/contacts/types/get_contact_info_response_statistics_hard_bounces_item.py +31 -0
  105. brevo/contacts/types/get_contact_info_response_statistics_messages_sent_item.py +31 -0
  106. brevo/contacts/types/get_contact_info_response_statistics_opened_item.py +40 -0
  107. brevo/contacts/types/get_contact_info_response_statistics_soft_bounces_item.py +31 -0
  108. brevo/contacts/types/get_contact_info_response_statistics_transac_attributes_item.py +18 -0
  109. brevo/contacts/types/get_contact_info_response_statistics_unsubscriptions.py +43 -0
  110. brevo/contacts/types/get_contact_info_response_statistics_unsubscriptions_admin_unsubscription_item.py +30 -0
  111. brevo/contacts/types/get_contact_info_response_statistics_unsubscriptions_user_unsubscription_item.py +35 -0
  112. brevo/contacts/types/get_contact_stats_request_identifier.py +5 -0
  113. brevo/contacts/types/get_contact_stats_response.py +59 -0
  114. brevo/contacts/types/get_contact_stats_response_clicked_item.py +28 -0
  115. brevo/contacts/types/get_contact_stats_response_clicked_item_links_item.py +40 -0
  116. brevo/contacts/types/get_contact_stats_response_complaints_item.py +31 -0
  117. brevo/contacts/types/get_contact_stats_response_delivered_item.py +31 -0
  118. brevo/contacts/types/get_contact_stats_response_hard_bounces_item.py +31 -0
  119. brevo/contacts/types/get_contact_stats_response_messages_sent_item.py +31 -0
  120. brevo/contacts/types/get_contact_stats_response_opened_item.py +40 -0
  121. brevo/contacts/types/get_contact_stats_response_soft_bounces_item.py +31 -0
  122. brevo/contacts/types/get_contact_stats_response_transac_attributes_item.py +31 -0
  123. brevo/contacts/types/get_contact_stats_response_unsubscriptions.py +39 -0
  124. brevo/contacts/types/get_contact_stats_response_unsubscriptions_admin_unsubscription_item.py +30 -0
  125. brevo/contacts/types/get_contact_stats_response_unsubscriptions_user_unsubscription_item.py +35 -0
  126. brevo/contacts/types/get_contacts_from_list_request_sort.py +5 -0
  127. brevo/contacts/types/get_contacts_request_sort.py +5 -0
  128. brevo/contacts/types/get_folder_lists_request_sort.py +5 -0
  129. brevo/contacts/types/get_folder_lists_response.py +26 -0
  130. brevo/contacts/types/get_folders_request_sort.py +5 -0
  131. brevo/contacts/types/get_folders_response.py +26 -0
  132. brevo/contacts/types/get_list_response.py +68 -0
  133. brevo/contacts/types/get_list_response_campaign_stats_item.py +26 -0
  134. brevo/contacts/types/get_lists_request_sort.py +5 -0
  135. brevo/contacts/types/get_lists_response.py +29 -0
  136. brevo/contacts/types/get_lists_response_lists_item.py +49 -0
  137. brevo/contacts/types/get_segments_request_sort.py +5 -0
  138. brevo/contacts/types/get_segments_response.py +29 -0
  139. brevo/contacts/types/get_segments_response_segments_item.py +41 -0
  140. brevo/contacts/types/import_contacts_request_json_body_item.py +25 -0
  141. brevo/contacts/types/import_contacts_request_new_list.py +41 -0
  142. brevo/contacts/types/import_contacts_response.py +26 -0
  143. brevo/contacts/types/remove_contact_from_list_request_body.py +15 -0
  144. brevo/contacts/types/remove_contact_from_list_request_body_all.py +29 -0
  145. brevo/contacts/types/remove_contact_from_list_request_body_emails.py +23 -0
  146. brevo/contacts/types/remove_contact_from_list_request_body_ext_ids.py +29 -0
  147. brevo/contacts/types/remove_contact_from_list_request_body_ids.py +23 -0
  148. brevo/contacts/types/request_contact_export_request_custom_contact_filter.py +90 -0
  149. brevo/contacts/types/request_contact_export_request_custom_contact_filter_action_for_contacts.py +7 -0
  150. brevo/contacts/types/request_contact_export_request_custom_contact_filter_action_for_email_campaigns.py +8 -0
  151. brevo/contacts/types/request_contact_export_request_custom_contact_filter_action_for_sms_campaigns.py +7 -0
  152. brevo/contacts/types/request_contact_export_response.py +26 -0
  153. brevo/contacts/types/update_attribute_request_attribute_category.py +7 -0
  154. brevo/contacts/types/update_attribute_request_enumeration_item.py +28 -0
  155. brevo/contacts/types/update_batch_contacts_request_contacts_item.py +80 -0
  156. brevo/contacts/types/update_contact_request_attributes_value.py +5 -0
  157. brevo/contacts/types/update_contact_request_identifier.py +5 -0
  158. brevo/contacts/types/update_contact_request_identifier_type.py +7 -0
  159. brevo/conversations/__init__.py +34 -0
  160. brevo/conversations/client.py +912 -0
  161. brevo/conversations/raw_client.py +1328 -0
  162. brevo/conversations/types/__init__.py +36 -0
  163. brevo/conversations/types/put_conversations_visitor_group_response.py +31 -0
  164. brevo/core/__init__.py +125 -0
  165. brevo/core/api_error.py +23 -0
  166. brevo/core/client_wrapper.py +100 -0
  167. brevo/core/datetime_utils.py +28 -0
  168. brevo/core/file.py +67 -0
  169. brevo/core/force_multipart.py +18 -0
  170. brevo/core/http_client.py +776 -0
  171. brevo/core/http_response.py +59 -0
  172. brevo/core/http_sse/__init__.py +42 -0
  173. brevo/core/http_sse/_api.py +112 -0
  174. brevo/core/http_sse/_decoders.py +61 -0
  175. brevo/core/http_sse/_exceptions.py +7 -0
  176. brevo/core/http_sse/_models.py +17 -0
  177. brevo/core/jsonable_encoder.py +108 -0
  178. brevo/core/logging.py +107 -0
  179. brevo/core/pydantic_utilities.py +577 -0
  180. brevo/core/query_encoder.py +58 -0
  181. brevo/core/remove_none_from_dict.py +11 -0
  182. brevo/core/request_options.py +35 -0
  183. brevo/core/serialization.py +276 -0
  184. brevo/core/unchecked_base_model.py +376 -0
  185. brevo/coupons/__init__.py +49 -0
  186. brevo/coupons/client.py +550 -0
  187. brevo/coupons/raw_client.py +839 -0
  188. brevo/coupons/types/__init__.py +47 -0
  189. brevo/coupons/types/create_coupon_collection_response.py +23 -0
  190. brevo/coupons/types/get_coupon_collections_request_sort.py +5 -0
  191. brevo/coupons/types/get_coupon_collections_request_sort_by.py +7 -0
  192. brevo/coupons/types/update_coupon_collection_response.py +35 -0
  193. brevo/custom_objects/__init__.py +139 -0
  194. brevo/custom_objects/client.py +437 -0
  195. brevo/custom_objects/raw_client.py +711 -0
  196. brevo/custom_objects/types/__init__.py +177 -0
  197. brevo/custom_objects/types/batch_delete_object_records_request_identifiers.py +10 -0
  198. brevo/custom_objects/types/batch_delete_object_records_request_identifiers_ext_ids.py +23 -0
  199. brevo/custom_objects/types/batch_delete_object_records_request_identifiers_ids.py +23 -0
  200. brevo/custom_objects/types/batch_delete_object_records_response.py +27 -0
  201. brevo/custom_objects/types/getrecords_request_association.py +5 -0
  202. brevo/custom_objects/types/getrecords_request_sort.py +5 -0
  203. brevo/custom_objects/types/getrecords_response.py +26 -0
  204. brevo/custom_objects/types/getrecords_response_records_item.py +51 -0
  205. brevo/custom_objects/types/getrecords_response_records_item_associations_item.py +10 -0
  206. brevo/custom_objects/types/getrecords_response_records_item_associations_item_one.py +28 -0
  207. brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item.py +15 -0
  208. brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_one.py +28 -0
  209. brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_one_identifiers.py +27 -0
  210. brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_zero.py +28 -0
  211. brevo/custom_objects/types/getrecords_response_records_item_associations_item_one_records_item_zero_identifiers.py +27 -0
  212. brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero.py +28 -0
  213. brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item.py +15 -0
  214. brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_one.py +28 -0
  215. brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_one_identifiers.py +27 -0
  216. brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_zero.py +28 -0
  217. brevo/custom_objects/types/getrecords_response_records_item_associations_item_zero_records_item_zero_identifiers.py +27 -0
  218. brevo/custom_objects/types/getrecords_response_records_item_identifiers.py +32 -0
  219. brevo/custom_objects/types/upsertrecords_request_records_item.py +31 -0
  220. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item.py +12 -0
  221. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one.py +28 -0
  222. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item.py +15 -0
  223. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_one.py +20 -0
  224. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero.py +28 -0
  225. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers.py +32 -0
  226. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero.py +28 -0
  227. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item.py +23 -0
  228. brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item_identifiers.py +28 -0
  229. brevo/custom_objects/types/upsertrecords_request_records_item_identifiers.py +32 -0
  230. brevo/custom_objects/types/upsertrecords_response.py +29 -0
  231. brevo/deals/__init__.py +52 -0
  232. brevo/deals/client.py +1013 -0
  233. brevo/deals/raw_client.py +1326 -0
  234. brevo/deals/types/__init__.py +50 -0
  235. brevo/deals/types/get_crm_attributes_deals_response_item.py +40 -0
  236. brevo/deals/types/get_crm_deals_request_sort.py +5 -0
  237. brevo/deals/types/get_crm_deals_response.py +28 -0
  238. brevo/deals/types/post_crm_deals_import_response.py +26 -0
  239. brevo/deals/types/post_crm_deals_response.py +27 -0
  240. brevo/domains/__init__.py +79 -0
  241. brevo/domains/client.py +506 -0
  242. brevo/domains/raw_client.py +698 -0
  243. brevo/domains/types/__init__.py +83 -0
  244. brevo/domains/types/authenticate_domain_response.py +28 -0
  245. brevo/domains/types/create_domain_response.py +44 -0
  246. brevo/domains/types/create_domain_response_dns_records.py +40 -0
  247. brevo/domains/types/create_domain_response_dns_records_brevo_code.py +42 -0
  248. brevo/domains/types/create_domain_response_dns_records_dkim_record.py +42 -0
  249. brevo/domains/types/create_domain_response_dns_records_dmarc_record.py +42 -0
  250. brevo/domains/types/get_domain_configuration_response.py +41 -0
  251. brevo/domains/types/get_domain_configuration_response_dns_records.py +44 -0
  252. brevo/domains/types/get_domain_configuration_response_dns_records_brevo_code.py +42 -0
  253. brevo/domains/types/get_domain_configuration_response_dns_records_dkim_record.py +42 -0
  254. brevo/domains/types/get_domain_configuration_response_dns_records_dmarc_record.py +42 -0
  255. brevo/domains/types/get_domains_response.py +39 -0
  256. brevo/domains/types/get_domains_response_domains_item.py +56 -0
  257. brevo/domains/types/get_domains_response_domains_item_creator.py +41 -0
  258. brevo/ecommerce/__init__.py +112 -0
  259. brevo/ecommerce/client.py +2176 -0
  260. brevo/ecommerce/raw_client.py +2895 -0
  261. brevo/ecommerce/types/__init__.py +124 -0
  262. brevo/ecommerce/types/create_batch_order_response.py +28 -0
  263. brevo/ecommerce/types/create_product_alert_request_contact_identifiers.py +33 -0
  264. brevo/ecommerce/types/create_update_batch_category_request_categories_item.py +48 -0
  265. brevo/ecommerce/types/create_update_batch_category_response.py +31 -0
  266. brevo/ecommerce/types/create_update_batch_products_request_products_item.py +89 -0
  267. brevo/ecommerce/types/create_update_batch_products_request_products_item_meta_info_value.py +5 -0
  268. brevo/ecommerce/types/create_update_batch_products_response.py +31 -0
  269. brevo/ecommerce/types/create_update_category_response.py +23 -0
  270. brevo/ecommerce/types/create_update_product_request_meta_info_value.py +5 -0
  271. brevo/ecommerce/types/create_update_product_response.py +23 -0
  272. brevo/ecommerce/types/get_categories_request_sort.py +5 -0
  273. brevo/ecommerce/types/get_categories_response.py +25 -0
  274. brevo/ecommerce/types/get_ecommerce_attribution_metrics_conversion_source_conversion_source_id_request_conversion_source.py +7 -0
  275. brevo/ecommerce/types/get_ecommerce_attribution_metrics_conversion_source_conversion_source_id_response.py +40 -0
  276. brevo/ecommerce/types/get_ecommerce_attribution_metrics_conversion_source_conversion_source_id_response_conversion_source.py +7 -0
  277. brevo/ecommerce/types/get_ecommerce_attribution_metrics_response.py +30 -0
  278. brevo/ecommerce/types/get_ecommerce_attribution_metrics_response_totals.py +32 -0
  279. brevo/ecommerce/types/get_ecommerce_attribution_products_conversion_source_conversion_source_id_request_conversion_source.py +7 -0
  280. brevo/ecommerce/types/get_ecommerce_attribution_products_conversion_source_conversion_source_id_response.py +28 -0
  281. brevo/ecommerce/types/get_ecommerce_attribution_products_conversion_source_conversion_source_id_response_products_item.py +33 -0
  282. brevo/ecommerce/types/get_ecommerce_config_display_currency_response.py +23 -0
  283. brevo/ecommerce/types/get_orders_request_sort.py +5 -0
  284. brevo/ecommerce/types/get_products_request_sort.py +5 -0
  285. brevo/ecommerce/types/get_products_response.py +26 -0
  286. brevo/ecommerce/types/set_config_display_currency_response.py +23 -0
  287. brevo/email_campaigns/__init__.py +139 -0
  288. brevo/email_campaigns/client.py +1864 -0
  289. brevo/email_campaigns/raw_client.py +2472 -0
  290. brevo/email_campaigns/types/__init__.py +141 -0
  291. brevo/email_campaigns/types/create_email_campaign_request_email_expiration_date.py +33 -0
  292. brevo/email_campaigns/types/create_email_campaign_request_email_expiration_date_unit.py +5 -0
  293. brevo/email_campaigns/types/create_email_campaign_request_recipients.py +52 -0
  294. brevo/email_campaigns/types/create_email_campaign_request_sender.py +37 -0
  295. brevo/email_campaigns/types/create_email_campaign_request_winner_criteria.py +5 -0
  296. brevo/email_campaigns/types/create_email_campaign_response.py +23 -0
  297. brevo/email_campaigns/types/email_export_recipients_request_recipients_type.py +10 -0
  298. brevo/email_campaigns/types/email_export_recipients_response.py +26 -0
  299. brevo/email_campaigns/types/get_ab_test_campaign_result_response.py +64 -0
  300. brevo/email_campaigns/types/get_ab_test_campaign_result_response_clicked_links.py +28 -0
  301. brevo/email_campaigns/types/get_ab_test_campaign_result_response_statistics.py +32 -0
  302. brevo/email_campaigns/types/get_ab_test_campaign_result_response_winning_criteria.py +5 -0
  303. brevo/email_campaigns/types/get_ab_test_campaign_result_response_winning_version.py +7 -0
  304. brevo/email_campaigns/types/get_email_campaign_request_statistics.py +7 -0
  305. brevo/email_campaigns/types/get_email_campaign_response.py +234 -0
  306. brevo/email_campaigns/types/get_email_campaign_response_sender.py +33 -0
  307. brevo/email_campaigns/types/get_email_campaign_response_status.py +7 -0
  308. brevo/email_campaigns/types/get_email_campaign_response_type.py +5 -0
  309. brevo/email_campaigns/types/get_email_campaigns_request_sort.py +5 -0
  310. brevo/email_campaigns/types/get_email_campaigns_request_statistics.py +7 -0
  311. brevo/email_campaigns/types/get_email_campaigns_request_status.py +7 -0
  312. brevo/email_campaigns/types/get_email_campaigns_request_type.py +5 -0
  313. brevo/email_campaigns/types/get_email_campaigns_response.py +25 -0
  314. brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item.py +234 -0
  315. brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_sender.py +33 -0
  316. brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_status.py +7 -0
  317. brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_type.py +5 -0
  318. brevo/email_campaigns/types/get_shared_template_url_response.py +29 -0
  319. brevo/email_campaigns/types/update_email_campaign_request_email_expiration_date.py +33 -0
  320. brevo/email_campaigns/types/update_email_campaign_request_email_expiration_date_unit.py +5 -0
  321. brevo/email_campaigns/types/update_email_campaign_request_recipients.py +53 -0
  322. brevo/email_campaigns/types/update_email_campaign_request_sender.py +37 -0
  323. brevo/email_campaigns/types/update_email_campaign_request_winner_criteria.py +5 -0
  324. brevo/email_campaigns/types/upload_image_to_gallery_response.py +23 -0
  325. brevo/environment.py +7 -0
  326. brevo/errors/__init__.py +80 -0
  327. brevo/errors/bad_request_error.py +10 -0
  328. brevo/errors/conflict_error.py +11 -0
  329. brevo/errors/expectation_failed_error.py +11 -0
  330. brevo/errors/failed_dependency_error.py +10 -0
  331. brevo/errors/forbidden_error.py +10 -0
  332. brevo/errors/internal_server_error.py +10 -0
  333. brevo/errors/method_not_allowed_error.py +11 -0
  334. brevo/errors/not_found_error.py +10 -0
  335. brevo/errors/payment_required_error.py +11 -0
  336. brevo/errors/precondition_failed_error.py +11 -0
  337. brevo/errors/too_early_error.py +11 -0
  338. brevo/errors/too_many_requests_error.py +11 -0
  339. brevo/errors/unauthorized_error.py +10 -0
  340. brevo/errors/unprocessable_entity_error.py +11 -0
  341. brevo/errors/unsupported_media_type_error.py +11 -0
  342. brevo/event/__init__.py +52 -0
  343. brevo/event/client.py +184 -0
  344. brevo/event/raw_client.py +230 -0
  345. brevo/event/types/__init__.py +50 -0
  346. brevo/event/types/create_event_request_contact_properties_value.py +5 -0
  347. brevo/event/types/create_event_request_event_properties_value.py +5 -0
  348. brevo/event/types/create_event_request_identifiers.py +52 -0
  349. brevo/event/types/create_event_request_object.py +33 -0
  350. brevo/event/types/create_event_request_object_identifiers.py +32 -0
  351. brevo/external_feeds/__init__.py +79 -0
  352. brevo/external_feeds/client.py +915 -0
  353. brevo/external_feeds/raw_client.py +1087 -0
  354. brevo/external_feeds/types/__init__.py +77 -0
  355. brevo/external_feeds/types/create_external_feed_request_auth_type.py +5 -0
  356. brevo/external_feeds/types/create_external_feed_request_headers_item.py +28 -0
  357. brevo/external_feeds/types/create_external_feed_response.py +23 -0
  358. brevo/external_feeds/types/get_all_external_feeds_request_auth_type.py +5 -0
  359. brevo/external_feeds/types/get_all_external_feeds_request_sort.py +5 -0
  360. brevo/external_feeds/types/get_all_external_feeds_response.py +29 -0
  361. brevo/external_feeds/types/get_all_external_feeds_response_feeds_item.py +96 -0
  362. brevo/external_feeds/types/get_all_external_feeds_response_feeds_item_auth_type.py +5 -0
  363. brevo/external_feeds/types/get_all_external_feeds_response_feeds_item_headers_item.py +28 -0
  364. brevo/external_feeds/types/get_external_feed_by_uuid_response.py +105 -0
  365. brevo/external_feeds/types/get_external_feed_by_uuid_response_auth_type.py +5 -0
  366. brevo/external_feeds/types/get_external_feed_by_uuid_response_headers_item.py +28 -0
  367. brevo/external_feeds/types/update_external_feed_request_auth_type.py +5 -0
  368. brevo/external_feeds/types/update_external_feed_request_headers_item.py +28 -0
  369. brevo/files/__init__.py +38 -0
  370. brevo/files/client.py +479 -0
  371. brevo/files/raw_client.py +675 -0
  372. brevo/files/types/__init__.py +40 -0
  373. brevo/files/types/get_crm_files_id_response.py +30 -0
  374. brevo/files/types/get_crm_files_request_entity.py +5 -0
  375. brevo/files/types/get_crm_files_request_sort.py +5 -0
  376. brevo/inbound_parsing/__init__.py +58 -0
  377. brevo/inbound_parsing/client.py +323 -0
  378. brevo/inbound_parsing/raw_client.py +420 -0
  379. brevo/inbound_parsing/types/__init__.py +60 -0
  380. brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response.py +72 -0
  381. brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response_attachments_item.py +40 -0
  382. brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response_logs_item.py +30 -0
  383. brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response_logs_item_type.py +7 -0
  384. brevo/inbound_parsing/types/get_inbound_email_events_request_sort.py +5 -0
  385. brevo/inbound_parsing/types/get_inbound_email_events_response.py +21 -0
  386. brevo/inbound_parsing/types/get_inbound_email_events_response_events_item.py +42 -0
  387. brevo/master_account/__init__.py +202 -0
  388. brevo/master_account/client.py +2757 -0
  389. brevo/master_account/raw_client.py +3351 -0
  390. brevo/master_account/types/__init__.py +244 -0
  391. brevo/master_account/types/get_corporate_group_id_response.py +31 -0
  392. brevo/master_account/types/get_corporate_group_id_response_group.py +35 -0
  393. brevo/master_account/types/get_corporate_group_id_response_sub_accounts_item.py +35 -0
  394. brevo/master_account/types/get_corporate_group_id_response_users_item.py +36 -0
  395. brevo/master_account/types/get_corporate_invited_users_list_response.py +24 -0
  396. brevo/master_account/types/get_corporate_invited_users_list_response_users_item.py +50 -0
  397. brevo/master_account/types/get_corporate_invited_users_list_response_users_item_feature_access.py +69 -0
  398. brevo/master_account/types/get_corporate_invited_users_list_response_users_item_groups.py +32 -0
  399. brevo/master_account/types/get_corporate_ip_response_item.py +22 -0
  400. brevo/master_account/types/get_corporate_master_account_response.py +57 -0
  401. brevo/master_account/types/get_corporate_master_account_response_billing_info.py +48 -0
  402. brevo/master_account/types/get_corporate_master_account_response_billing_info_address.py +50 -0
  403. brevo/master_account/types/get_corporate_master_account_response_billing_info_name.py +35 -0
  404. brevo/master_account/types/get_corporate_master_account_response_plan_info.py +63 -0
  405. brevo/master_account/types/get_corporate_master_account_response_plan_info_features_item.py +62 -0
  406. brevo/master_account/types/get_corporate_master_account_response_plan_info_plan_period.py +5 -0
  407. brevo/master_account/types/get_corporate_sub_account_id_response.py +48 -0
  408. brevo/master_account/types/get_corporate_sub_account_id_response_groups_item.py +28 -0
  409. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info.py +42 -0
  410. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits.py +65 -0
  411. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_emails.py +32 -0
  412. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_external_feeds.py +33 -0
  413. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_sms.py +32 -0
  414. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_whatsapp.py +32 -0
  415. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_credits_wp_subscribers.py +32 -0
  416. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features.py +58 -0
  417. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_inbox.py +32 -0
  418. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_landing_page.py +32 -0
  419. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_sales_users.py +33 -0
  420. brevo/master_account/types/get_corporate_sub_account_id_response_plan_info_features_users.py +32 -0
  421. brevo/master_account/types/get_corporate_sub_account_response.py +32 -0
  422. brevo/master_account/types/get_corporate_sub_account_response_sub_accounts_item.py +48 -0
  423. brevo/master_account/types/get_corporate_sub_account_response_sub_accounts_item_groups_item.py +28 -0
  424. brevo/master_account/types/get_corporate_user_permission_response.py +40 -0
  425. brevo/master_account/types/get_corporate_user_permission_response_feature_access.py +62 -0
  426. brevo/master_account/types/get_corporate_user_permission_response_groups_item.py +32 -0
  427. brevo/master_account/types/get_sub_account_groups_response_item.py +30 -0
  428. brevo/master_account/types/invite_admin_user_request_privileges_item.py +38 -0
  429. brevo/master_account/types/invite_admin_user_request_privileges_item_feature.py +18 -0
  430. brevo/master_account/types/invite_admin_user_request_privileges_item_permissions_item.py +7 -0
  431. brevo/master_account/types/invite_admin_user_response.py +20 -0
  432. brevo/master_account/types/post_corporate_group_response.py +20 -0
  433. brevo/master_account/types/post_corporate_sub_account_key_response.py +28 -0
  434. brevo/master_account/types/post_corporate_sub_account_request_language.py +5 -0
  435. brevo/master_account/types/post_corporate_sub_account_response.py +23 -0
  436. brevo/master_account/types/post_corporate_sub_account_sso_token_request_target.py +17 -0
  437. brevo/master_account/types/put_corporate_sub_account_id_plan_request_credits.py +59 -0
  438. brevo/master_account/types/put_corporate_sub_account_id_plan_request_features.py +44 -0
  439. brevo/master_account/types/put_corporate_sub_accounts_plan_request_credits.py +59 -0
  440. brevo/master_account/types/put_corporate_sub_accounts_plan_request_features.py +39 -0
  441. brevo/master_account/types/put_corporate_user_email_permissions_request_privileges_item.py +42 -0
  442. brevo/master_account/types/put_corporate_user_email_permissions_request_privileges_item_feature.py +18 -0
  443. brevo/master_account/types/put_corporate_user_email_permissions_request_privileges_item_permissions_item.py +10 -0
  444. brevo/master_account/types/put_corporate_user_invitation_action_email_request_action.py +5 -0
  445. brevo/master_account/types/put_corporate_user_invitation_action_email_response.py +23 -0
  446. brevo/notes/__init__.py +38 -0
  447. brevo/notes/client.py +548 -0
  448. brevo/notes/raw_client.py +766 -0
  449. brevo/notes/types/__init__.py +40 -0
  450. brevo/notes/types/get_crm_notes_request_entity.py +5 -0
  451. brevo/notes/types/get_crm_notes_request_sort.py +5 -0
  452. brevo/notes/types/post_crm_notes_response.py +27 -0
  453. brevo/payments/__init__.py +38 -0
  454. brevo/payments/client.py +315 -0
  455. brevo/payments/raw_client.py +532 -0
  456. brevo/payments/types/__init__.py +40 -0
  457. brevo/payments/types/create_payment_request_response.py +28 -0
  458. brevo/payments/types/get_payment_request_response.py +47 -0
  459. brevo/payments/types/get_payment_request_response_status.py +5 -0
  460. brevo/process/__init__.py +79 -0
  461. brevo/process/client.py +304 -0
  462. brevo/process/raw_client.py +372 -0
  463. brevo/process/types/__init__.py +77 -0
  464. brevo/process/types/get_process_response.py +62 -0
  465. brevo/process/types/get_process_response_info.py +36 -0
  466. brevo/process/types/get_process_response_info_export.py +32 -0
  467. brevo/process/types/get_process_response_info_import.py +57 -0
  468. brevo/process/types/get_process_response_name.py +16 -0
  469. brevo/process/types/get_process_response_status.py +7 -0
  470. brevo/process/types/get_processes_request_sort.py +5 -0
  471. brevo/process/types/get_processes_response.py +29 -0
  472. brevo/process/types/get_processes_response_processes_item.py +62 -0
  473. brevo/process/types/get_processes_response_processes_item_info.py +36 -0
  474. brevo/process/types/get_processes_response_processes_item_info_export.py +32 -0
  475. brevo/process/types/get_processes_response_processes_item_info_import.py +57 -0
  476. brevo/process/types/get_processes_response_processes_item_name.py +16 -0
  477. brevo/process/types/get_processes_response_processes_item_status.py +7 -0
  478. brevo/program/__init__.py +67 -0
  479. brevo/program/client.py +1128 -0
  480. brevo/program/raw_client.py +2526 -0
  481. brevo/program/types/__init__.py +67 -0
  482. brevo/program/types/get_lp_list_request_sort_field.py +5 -0
  483. brevo/program/types/get_lp_list_response.py +24 -0
  484. brevo/program/types/get_parameter_subscription_info_response.py +44 -0
  485. brevo/program/types/get_parameter_subscription_info_response_balance.py +41 -0
  486. brevo/program/types/get_parameter_subscription_info_response_balance_balances_item.py +30 -0
  487. brevo/program/types/get_parameter_subscription_info_response_members_item.py +36 -0
  488. brevo/program/types/get_parameter_subscription_info_response_reward_item.py +66 -0
  489. brevo/program/types/get_parameter_subscription_info_response_tier_item.py +56 -0
  490. brevo/program/types/subscribe_member_to_a_subscription_response.py +46 -0
  491. brevo/program/types/subscribe_to_loyalty_program_response.py +56 -0
  492. brevo/py.typed +0 -0
  493. brevo/reward/__init__.py +115 -0
  494. brevo/reward/client.py +1285 -0
  495. brevo/reward/raw_client.py +2564 -0
  496. brevo/reward/types/__init__.py +139 -0
  497. brevo/reward/types/create_reward_response.py +64 -0
  498. brevo/reward/types/create_voucher_response.py +76 -0
  499. brevo/reward/types/get_code_count_response.py +23 -0
  500. brevo/reward/types/get_loyalty_offer_programs_pid_offers_request_version.py +5 -0
  501. brevo/reward/types/get_loyalty_offer_programs_pid_offers_response.py +34 -0
  502. brevo/reward/types/get_loyalty_offer_programs_pid_offers_response_items_item.py +67 -0
  503. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_request_version.py +5 -0
  504. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response.py +269 -0
  505. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_expiration_modifier.py +7 -0
  506. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_generator.py +52 -0
  507. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_limits_item.py +68 -0
  508. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_products_item.py +40 -0
  509. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_reward_configs.py +33 -0
  510. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule.py +101 -0
  511. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule_event.py +28 -0
  512. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule_results_item.py +43 -0
  513. brevo/reward/types/get_loyalty_offer_programs_pid_rewards_rid_response_rule_results_item_parameters_item.py +37 -0
  514. brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_request_sort.py +5 -0
  515. brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_request_sort_field.py +5 -0
  516. brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_response.py +49 -0
  517. brevo/reward/types/get_loyalty_offer_programs_pid_vouchers_response_contact_rewards_item.py +70 -0
  518. brevo/reward/types/redeem_voucher_request_order.py +85 -0
  519. brevo/reward/types/redeem_voucher_request_order_billing.py +55 -0
  520. brevo/reward/types/redeem_voucher_request_order_identifiers.py +28 -0
  521. brevo/reward/types/redeem_voucher_request_order_products_item.py +46 -0
  522. brevo/reward/types/validate_reward_response.py +23 -0
  523. brevo/senders/__init__.py +67 -0
  524. brevo/senders/client.py +808 -0
  525. brevo/senders/raw_client.py +1089 -0
  526. brevo/senders/types/__init__.py +65 -0
  527. brevo/senders/types/create_sender_request_ips_item.py +36 -0
  528. brevo/senders/types/create_sender_response.py +42 -0
  529. brevo/senders/types/get_ips_from_sender_response.py +25 -0
  530. brevo/senders/types/get_ips_from_sender_response_ips_item.py +38 -0
  531. brevo/senders/types/get_ips_response.py +25 -0
  532. brevo/senders/types/get_ips_response_ips_item.py +38 -0
  533. brevo/senders/types/get_senders_response.py +24 -0
  534. brevo/senders/types/get_senders_response_senders_item.py +46 -0
  535. brevo/senders/types/get_senders_response_senders_item_ips_item.py +33 -0
  536. brevo/senders/types/update_sender_request_ips_item.py +36 -0
  537. brevo/sms_campaigns/__init__.py +73 -0
  538. brevo/sms_campaigns/client.py +1078 -0
  539. brevo/sms_campaigns/raw_client.py +1501 -0
  540. brevo/sms_campaigns/types/__init__.py +71 -0
  541. brevo/sms_campaigns/types/create_sms_campaign_request_recipients.py +33 -0
  542. brevo/sms_campaigns/types/create_sms_campaign_response.py +23 -0
  543. brevo/sms_campaigns/types/get_sms_campaign_response.py +74 -0
  544. brevo/sms_campaigns/types/get_sms_campaign_response_status.py +7 -0
  545. brevo/sms_campaigns/types/get_sms_campaigns_request_sort.py +5 -0
  546. brevo/sms_campaigns/types/get_sms_campaigns_request_status.py +7 -0
  547. brevo/sms_campaigns/types/get_sms_campaigns_response.py +25 -0
  548. brevo/sms_campaigns/types/get_sms_campaigns_response_campaigns_item.py +74 -0
  549. brevo/sms_campaigns/types/get_sms_campaigns_response_campaigns_item_status.py +7 -0
  550. brevo/sms_campaigns/types/request_sms_recipient_export_request_recipients_type.py +7 -0
  551. brevo/sms_campaigns/types/request_sms_recipient_export_response.py +26 -0
  552. brevo/sms_campaigns/types/update_sms_campaign_request_recipients.py +33 -0
  553. brevo/sms_templates/__init__.py +49 -0
  554. brevo/sms_templates/client.py +133 -0
  555. brevo/sms_templates/raw_client.py +151 -0
  556. brevo/sms_templates/types/__init__.py +47 -0
  557. brevo/sms_templates/types/get_sms_templates_request_sort.py +5 -0
  558. brevo/sms_templates/types/get_sms_templates_response.py +26 -0
  559. brevo/sms_templates/types/get_sms_templates_response_templates_item.py +86 -0
  560. brevo/sms_templates/types/get_sms_templates_response_templates_item_compliance.py +37 -0
  561. brevo/tasks/__init__.py +55 -0
  562. brevo/tasks/client.py +814 -0
  563. brevo/tasks/raw_client.py +992 -0
  564. brevo/tasks/types/__init__.py +53 -0
  565. brevo/tasks/types/get_crm_tasks_request_filter_date.py +5 -0
  566. brevo/tasks/types/get_crm_tasks_request_filter_status.py +5 -0
  567. brevo/tasks/types/get_crm_tasks_request_sort.py +5 -0
  568. brevo/tasks/types/get_crm_tasks_response.py +28 -0
  569. brevo/tasks/types/get_crm_tasktypes_response.py +32 -0
  570. brevo/tasks/types/post_crm_tasks_response.py +27 -0
  571. brevo/tier/__init__.py +79 -0
  572. brevo/tier/client.py +1144 -0
  573. brevo/tier/raw_client.py +2360 -0
  574. brevo/tier/types/__init__.py +79 -0
  575. brevo/tier/types/add_subscription_to_tier_response.py +53 -0
  576. brevo/tier/types/create_tier_for_tier_group_request_access_conditions_item.py +31 -0
  577. brevo/tier/types/create_tier_for_tier_group_request_tier_rewards_item.py +26 -0
  578. brevo/tier/types/create_tier_group_request_downgrade_strategy.py +7 -0
  579. brevo/tier/types/create_tier_group_request_upgrade_strategy.py +7 -0
  580. brevo/tier/types/get_list_of_tier_groups_request_version.py +5 -0
  581. brevo/tier/types/get_list_of_tier_groups_response.py +21 -0
  582. brevo/tier/types/get_loyalty_program_tier_request_version.py +5 -0
  583. brevo/tier/types/get_loyalty_program_tier_response.py +21 -0
  584. brevo/tier/types/get_tier_group_request_version.py +5 -0
  585. brevo/tier/types/update_tier_group_request_downgrade_strategy.py +7 -0
  586. brevo/tier/types/update_tier_group_request_upgrade_strategy.py +7 -0
  587. brevo/tier/types/update_tier_request_access_conditions_item.py +31 -0
  588. brevo/tier/types/update_tier_request_tier_rewards_item.py +26 -0
  589. brevo/transactional_emails/__init__.py +175 -0
  590. brevo/transactional_emails/client.py +2544 -0
  591. brevo/transactional_emails/raw_client.py +3240 -0
  592. brevo/transactional_emails/types/__init__.py +189 -0
  593. brevo/transactional_emails/types/create_smtp_template_request_sender.py +37 -0
  594. brevo/transactional_emails/types/create_smtp_template_response.py +23 -0
  595. brevo/transactional_emails/types/get_aggregated_smtp_report_response.py +85 -0
  596. brevo/transactional_emails/types/get_blocked_domains_response.py +23 -0
  597. brevo/transactional_emails/types/get_email_event_report_request_event.py +23 -0
  598. brevo/transactional_emails/types/get_email_event_report_request_sort.py +5 -0
  599. brevo/transactional_emails/types/get_email_event_report_response.py +21 -0
  600. brevo/transactional_emails/types/get_email_event_report_response_events_item.py +79 -0
  601. brevo/transactional_emails/types/get_email_event_report_response_events_item_event.py +23 -0
  602. brevo/transactional_emails/types/get_scheduled_email_by_id_request_sort.py +5 -0
  603. brevo/transactional_emails/types/get_scheduled_email_by_id_request_status.py +5 -0
  604. brevo/transactional_emails/types/get_scheduled_email_by_id_response.py +10 -0
  605. brevo/transactional_emails/types/get_scheduled_email_by_id_response_batches.py +25 -0
  606. brevo/transactional_emails/types/get_scheduled_email_by_id_response_batches_batches_item.py +39 -0
  607. brevo/transactional_emails/types/get_scheduled_email_by_id_response_batches_batches_item_status.py +7 -0
  608. brevo/transactional_emails/types/get_scheduled_email_by_id_response_created_at.py +37 -0
  609. brevo/transactional_emails/types/get_scheduled_email_by_id_response_created_at_status.py +7 -0
  610. brevo/transactional_emails/types/get_smtp_report_request_sort.py +5 -0
  611. brevo/transactional_emails/types/get_smtp_report_response.py +21 -0
  612. brevo/transactional_emails/types/get_smtp_report_response_reports_item.py +86 -0
  613. brevo/transactional_emails/types/get_smtp_templates_request_sort.py +5 -0
  614. brevo/transactional_emails/types/get_smtp_templates_response.py +26 -0
  615. brevo/transactional_emails/types/get_transac_blocked_contacts_request_sort.py +5 -0
  616. brevo/transactional_emails/types/get_transac_blocked_contacts_response.py +25 -0
  617. brevo/transactional_emails/types/get_transac_blocked_contacts_response_contacts_item.py +44 -0
  618. brevo/transactional_emails/types/get_transac_blocked_contacts_response_contacts_item_reason.py +35 -0
  619. brevo/transactional_emails/types/get_transac_blocked_contacts_response_contacts_item_reason_code.py +15 -0
  620. brevo/transactional_emails/types/get_transac_email_content_response.py +57 -0
  621. brevo/transactional_emails/types/get_transac_email_content_response_events_item.py +28 -0
  622. brevo/transactional_emails/types/get_transac_emails_list_request_sort.py +5 -0
  623. brevo/transactional_emails/types/get_transac_emails_list_response.py +34 -0
  624. brevo/transactional_emails/types/get_transac_emails_list_response_transactional_emails_item.py +61 -0
  625. brevo/transactional_emails/types/post_preview_smtp_email_templates_response.py +49 -0
  626. brevo/transactional_emails/types/send_transac_email_request_attachment_item.py +33 -0
  627. brevo/transactional_emails/types/send_transac_email_request_bcc_item.py +28 -0
  628. brevo/transactional_emails/types/send_transac_email_request_cc_item.py +28 -0
  629. brevo/transactional_emails/types/send_transac_email_request_message_versions_item.py +73 -0
  630. brevo/transactional_emails/types/send_transac_email_request_message_versions_item_bcc_item.py +28 -0
  631. brevo/transactional_emails/types/send_transac_email_request_message_versions_item_cc_item.py +28 -0
  632. brevo/transactional_emails/types/send_transac_email_request_message_versions_item_reply_to.py +32 -0
  633. brevo/transactional_emails/types/send_transac_email_request_message_versions_item_to_item.py +28 -0
  634. brevo/transactional_emails/types/send_transac_email_request_reply_to.py +32 -0
  635. brevo/transactional_emails/types/send_transac_email_request_sender.py +37 -0
  636. brevo/transactional_emails/types/send_transac_email_request_to_item.py +28 -0
  637. brevo/transactional_emails/types/send_transac_email_response.py +29 -0
  638. brevo/transactional_emails/types/update_smtp_template_request_sender.py +37 -0
  639. brevo/transactional_sms/__init__.py +70 -0
  640. brevo/transactional_sms/client.py +726 -0
  641. brevo/transactional_sms/raw_client.py +913 -0
  642. brevo/transactional_sms/types/__init__.py +68 -0
  643. brevo/transactional_sms/types/get_sms_events_request_event.py +20 -0
  644. brevo/transactional_sms/types/get_sms_events_request_sort.py +5 -0
  645. brevo/transactional_sms/types/get_sms_events_response.py +21 -0
  646. brevo/transactional_sms/types/get_sms_events_response_events_item.py +52 -0
  647. brevo/transactional_sms/types/get_sms_events_response_events_item_event.py +20 -0
  648. brevo/transactional_sms/types/get_transac_aggregated_sms_report_response.py +75 -0
  649. brevo/transactional_sms/types/get_transac_sms_report_request_sort.py +5 -0
  650. brevo/transactional_sms/types/get_transac_sms_report_response.py +21 -0
  651. brevo/transactional_sms/types/get_transac_sms_report_response_reports_item.py +76 -0
  652. brevo/transactional_sms/types/send_async_transactional_sms_response.py +22 -0
  653. brevo/transactional_sms/types/send_transac_sms_response.py +38 -0
  654. brevo/transactional_whats_app/__init__.py +64 -0
  655. brevo/transactional_whats_app/client.py +283 -0
  656. brevo/transactional_whats_app/raw_client.py +326 -0
  657. brevo/transactional_whats_app/types/__init__.py +62 -0
  658. brevo/transactional_whats_app/types/get_whatsapp_event_report_request_event.py +7 -0
  659. brevo/transactional_whats_app/types/get_whatsapp_event_report_request_sort.py +5 -0
  660. brevo/transactional_whats_app/types/get_whatsapp_event_report_response.py +21 -0
  661. brevo/transactional_whats_app/types/get_whatsapp_event_report_response_events_item.py +65 -0
  662. brevo/transactional_whats_app/types/get_whatsapp_event_report_response_events_item_event.py +7 -0
  663. brevo/transactional_whats_app/types/send_whatsapp_message_request.py +8 -0
  664. brevo/transactional_whats_app/types/send_whatsapp_message_request_params.py +41 -0
  665. brevo/transactional_whats_app/types/send_whatsapp_message_request_text.py +35 -0
  666. brevo/transactional_whats_app/types/send_whatsapp_message_response.py +26 -0
  667. brevo/types/__init__.py +373 -0
  668. brevo/types/ab_test_version_clicks.py +7 -0
  669. brevo/types/ab_test_version_clicks_item.py +35 -0
  670. brevo/types/ab_test_version_stats.py +35 -0
  671. brevo/types/bad_request_error_body.py +29 -0
  672. brevo/types/bad_request_error_body_code.py +45 -0
  673. brevo/types/balance_definition.py +139 -0
  674. brevo/types/balance_definition_balance_availability_duration_modifier.py +7 -0
  675. brevo/types/balance_limit.py +78 -0
  676. brevo/types/cart.py +38 -0
  677. brevo/types/company.py +45 -0
  678. brevo/types/configuration.py +30 -0
  679. brevo/types/contact_error_model.py +34 -0
  680. brevo/types/contact_error_model_code.py +16 -0
  681. brevo/types/conversations_message.py +187 -0
  682. brevo/types/conversations_message_attachments_item.py +50 -0
  683. brevo/types/conversations_message_bcc_item.py +21 -0
  684. brevo/types/conversations_message_cc_item.py +21 -0
  685. brevo/types/conversations_message_file.py +46 -0
  686. brevo/types/conversations_message_file_image_info.py +39 -0
  687. brevo/types/conversations_message_forwarded_to_source_status.py +29 -0
  688. brevo/types/conversations_message_from.py +25 -0
  689. brevo/types/conversations_message_reply_to.py +25 -0
  690. brevo/types/conversations_message_to_item.py +21 -0
  691. brevo/types/conversations_message_type.py +5 -0
  692. brevo/types/conversion_source_metrics.py +35 -0
  693. brevo/types/conversion_source_metrics_conversion_source.py +7 -0
  694. brevo/types/create_update_folder.py +23 -0
  695. brevo/types/deal.py +45 -0
  696. brevo/types/error_model.py +28 -0
  697. brevo/types/file_data.py +60 -0
  698. brevo/types/forbidden_error_body.py +29 -0
  699. brevo/types/forbidden_error_body_code.py +45 -0
  700. brevo/types/get_campaign_recipients.py +25 -0
  701. brevo/types/get_campaign_stats.py +130 -0
  702. brevo/types/get_category_details.py +54 -0
  703. brevo/types/get_contact_details.py +75 -0
  704. brevo/types/get_contact_details_attributes.py +22 -0
  705. brevo/types/get_contacts.py +25 -0
  706. brevo/types/get_coupon_collection.py +75 -0
  707. brevo/types/get_device_browser_stats.py +44 -0
  708. brevo/types/get_extended_campaign_overview.py +230 -0
  709. brevo/types/get_extended_campaign_overview_sender.py +33 -0
  710. brevo/types/get_extended_campaign_overview_status.py +7 -0
  711. brevo/types/get_extended_campaign_overview_type.py +5 -0
  712. brevo/types/get_extended_campaign_stats.py +63 -0
  713. brevo/types/get_extended_campaign_stats_links_stats.py +22 -0
  714. brevo/types/get_extended_campaign_stats_stats_by_device.py +39 -0
  715. brevo/types/get_folder.py +46 -0
  716. brevo/types/get_list.py +46 -0
  717. brevo/types/get_product_details.py +115 -0
  718. brevo/types/get_sms_campaign_overview.py +69 -0
  719. brevo/types/get_sms_campaign_overview_status.py +7 -0
  720. brevo/types/get_sms_campaign_stats.py +55 -0
  721. brevo/types/get_smtp_template_overview.py +93 -0
  722. brevo/types/get_smtp_template_overview_sender.py +33 -0
  723. brevo/types/get_sso_token.py +23 -0
  724. brevo/types/get_webhook.py +74 -0
  725. brevo/types/get_webhook_channel.py +5 -0
  726. brevo/types/get_webhook_type.py +5 -0
  727. brevo/types/inviteuser.py +31 -0
  728. brevo/types/inviteuser_privileges_item.py +34 -0
  729. brevo/types/inviteuser_privileges_item_feature.py +24 -0
  730. brevo/types/inviteuser_privileges_item_permissions_item.py +39 -0
  731. brevo/types/loyalty_program.py +82 -0
  732. brevo/types/loyalty_program_state.py +5 -0
  733. brevo/types/node_response.py +63 -0
  734. brevo/types/not_found_error_body.py +29 -0
  735. brevo/types/not_found_error_body_code.py +45 -0
  736. brevo/types/note.py +61 -0
  737. brevo/types/note_data.py +44 -0
  738. brevo/types/notification.py +32 -0
  739. brevo/types/order.py +85 -0
  740. brevo/types/order_billing.py +66 -0
  741. brevo/types/order_identifiers.py +42 -0
  742. brevo/types/order_meta_info_value.py +5 -0
  743. brevo/types/order_products_item.py +43 -0
  744. brevo/types/pipeline.py +38 -0
  745. brevo/types/pipeline_stages_item.py +32 -0
  746. brevo/types/pipelines.py +7 -0
  747. brevo/types/post_contact_info.py +21 -0
  748. brevo/types/post_contact_info_contacts.py +37 -0
  749. brevo/types/post_contact_info_contacts_failure.py +5 -0
  750. brevo/types/post_contact_info_contacts_success.py +5 -0
  751. brevo/types/post_send_failed.py +46 -0
  752. brevo/types/redeem.py +92 -0
  753. brevo/types/rule_condition_response.py +52 -0
  754. brevo/types/send_report.py +30 -0
  755. brevo/types/send_report_email.py +32 -0
  756. brevo/types/send_report_language.py +5 -0
  757. brevo/types/send_test_email.py +29 -0
  758. brevo/types/send_transac_sms.py +66 -0
  759. brevo/types/send_transac_sms_tag.py +28 -0
  760. brevo/types/send_transac_sms_tag_field.py +5 -0
  761. brevo/types/send_transac_sms_type.py +5 -0
  762. brevo/types/task.py +55 -0
  763. brevo/types/task_reminder.py +39 -0
  764. brevo/types/task_reminder_types_item.py +5 -0
  765. brevo/types/task_reminder_unit.py +5 -0
  766. brevo/types/tier.py +63 -0
  767. brevo/types/tier_access_conditions_item.py +38 -0
  768. brevo/types/tier_group.py +70 -0
  769. brevo/types/tier_group_downgrade_strategy.py +7 -0
  770. brevo/types/tier_group_upgrade_strategy.py +7 -0
  771. brevo/types/tier_tier_rewards_item.py +33 -0
  772. brevo/types/transaction.py +110 -0
  773. brevo/types/unauthorized_error_body.py +29 -0
  774. brevo/types/unauthorized_error_body_code.py +45 -0
  775. brevo/types/update_campaign_status.py +28 -0
  776. brevo/types/update_campaign_status_status.py +8 -0
  777. brevo/types/value_response.py +67 -0
  778. brevo/types/variables_items.py +22 -0
  779. brevo/types/whatsapp_camp_stats.py +26 -0
  780. brevo/user/__init__.py +67 -0
  781. brevo/user/client.py +806 -0
  782. brevo/user/raw_client.py +977 -0
  783. brevo/user/types/__init__.py +67 -0
  784. brevo/user/types/edit_user_permission_response.py +33 -0
  785. brevo/user/types/get_invited_users_list_response.py +24 -0
  786. brevo/user/types/get_invited_users_list_response_users_item.py +39 -0
  787. brevo/user/types/get_invited_users_list_response_users_item_feature_access.py +37 -0
  788. brevo/user/types/get_user_permission_response.py +38 -0
  789. brevo/user/types/get_user_permission_response_privileges_item.py +21 -0
  790. brevo/user/types/inviteuser_response.py +28 -0
  791. brevo/user/types/put_revoke_user_permission_response.py +28 -0
  792. brevo/user/types/putresendcancelinvitation_request_action.py +5 -0
  793. brevo/user/types/putresendcancelinvitation_response.py +28 -0
  794. brevo/version.py +3 -0
  795. brevo/webhooks/__init__.py +82 -0
  796. brevo/webhooks/client.py +982 -0
  797. brevo/webhooks/raw_client.py +1211 -0
  798. brevo/webhooks/types/__init__.py +80 -0
  799. brevo/webhooks/types/create_webhook_request_auth.py +32 -0
  800. brevo/webhooks/types/create_webhook_request_channel.py +5 -0
  801. brevo/webhooks/types/create_webhook_request_events_item.py +26 -0
  802. brevo/webhooks/types/create_webhook_request_headers_item.py +28 -0
  803. brevo/webhooks/types/create_webhook_request_type.py +5 -0
  804. brevo/webhooks/types/create_webhook_response.py +23 -0
  805. brevo/webhooks/types/export_webhooks_history_request_event.py +26 -0
  806. brevo/webhooks/types/export_webhooks_history_request_type.py +5 -0
  807. brevo/webhooks/types/export_webhooks_history_response.py +26 -0
  808. brevo/webhooks/types/get_webhooks_request_sort.py +5 -0
  809. brevo/webhooks/types/get_webhooks_request_type.py +5 -0
  810. brevo/webhooks/types/get_webhooks_response.py +21 -0
  811. brevo/webhooks/types/update_webhook_request_auth.py +32 -0
  812. brevo/webhooks/types/update_webhook_request_events_item.py +26 -0
  813. brevo/webhooks/types/update_webhook_request_headers_item.py +28 -0
  814. brevo/whats_app_campaigns/__init__.py +106 -0
  815. brevo/whats_app_campaigns/client.py +1064 -0
  816. brevo/whats_app_campaigns/raw_client.py +1311 -0
  817. brevo/whats_app_campaigns/types/__init__.py +110 -0
  818. brevo/whats_app_campaigns/types/create_whats_app_campaign_request_recipients.py +41 -0
  819. brevo/whats_app_campaigns/types/create_whats_app_campaign_response.py +23 -0
  820. brevo/whats_app_campaigns/types/create_whats_app_template_request_category.py +5 -0
  821. brevo/whats_app_campaigns/types/create_whats_app_template_request_source.py +5 -0
  822. brevo/whats_app_campaigns/types/create_whats_app_template_response.py +23 -0
  823. brevo/whats_app_campaigns/types/get_whats_app_campaign_response.py +69 -0
  824. brevo/whats_app_campaigns/types/get_whats_app_campaign_response_campaign_status.py +7 -0
  825. brevo/whats_app_campaigns/types/get_whats_app_campaign_response_template.py +61 -0
  826. brevo/whats_app_campaigns/types/get_whats_app_campaign_response_template_components_item.py +21 -0
  827. brevo/whats_app_campaigns/types/get_whats_app_campaigns_request_sort.py +5 -0
  828. brevo/whats_app_campaigns/types/get_whats_app_campaigns_response.py +25 -0
  829. brevo/whats_app_campaigns/types/get_whats_app_campaigns_response_campaigns_item.py +84 -0
  830. brevo/whats_app_campaigns/types/get_whats_app_campaigns_response_campaigns_item_campaign_status.py +7 -0
  831. brevo/whats_app_campaigns/types/get_whats_app_config_response.py +63 -0
  832. brevo/whats_app_campaigns/types/get_whats_app_config_response_phone_number_name_status.py +7 -0
  833. brevo/whats_app_campaigns/types/get_whats_app_config_response_phone_number_quality.py +5 -0
  834. brevo/whats_app_campaigns/types/get_whats_app_config_response_whatsapp_business_account_status.py +7 -0
  835. brevo/whats_app_campaigns/types/get_whats_app_templates_request_sort.py +5 -0
  836. brevo/whats_app_campaigns/types/get_whats_app_templates_request_source.py +5 -0
  837. brevo/whats_app_campaigns/types/get_whats_app_templates_response.py +26 -0
  838. brevo/whats_app_campaigns/types/get_whats_app_templates_response_templates_item.py +65 -0
  839. brevo/whats_app_campaigns/types/update_whats_app_campaign_request_campaign_status.py +5 -0
  840. brevo/whats_app_campaigns/types/update_whats_app_campaign_request_recipients.py +41 -0
  841. brevo_python-4.0.1.dist-info/METADATA +1072 -0
  842. brevo_python-4.0.1.dist-info/RECORD +843 -0
  843. brevo_python-4.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,4614 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.request_options import RequestOptions
11
+ from ..core.serialization import convert_and_respect_annotation_metadata
12
+ from ..core.unchecked_base_model import construct_type
13
+ from ..errors.bad_request_error import BadRequestError
14
+ from ..errors.method_not_allowed_error import MethodNotAllowedError
15
+ from ..errors.not_found_error import NotFoundError
16
+ from ..errors.too_early_error import TooEarlyError
17
+ from ..errors.too_many_requests_error import TooManyRequestsError
18
+ from ..types.contact_error_model import ContactErrorModel
19
+ from ..types.error_model import ErrorModel
20
+ from ..types.get_contacts import GetContacts
21
+ from ..types.get_folder import GetFolder
22
+ from ..types.post_contact_info import PostContactInfo
23
+ from .types.add_contact_to_list_request_body import AddContactToListRequestBody
24
+ from .types.create_attribute_request_attribute_category import CreateAttributeRequestAttributeCategory
25
+ from .types.create_attribute_request_enumeration_item import CreateAttributeRequestEnumerationItem
26
+ from .types.create_attribute_request_type import CreateAttributeRequestType
27
+ from .types.create_contact_request_attributes_value import CreateContactRequestAttributesValue
28
+ from .types.create_contact_response import CreateContactResponse
29
+ from .types.create_doi_contact_request_attributes_value import CreateDoiContactRequestAttributesValue
30
+ from .types.create_folder_response import CreateFolderResponse
31
+ from .types.create_list_response import CreateListResponse
32
+ from .types.delete_attribute_request_attribute_category import DeleteAttributeRequestAttributeCategory
33
+ from .types.delete_contact_request_identifier import DeleteContactRequestIdentifier
34
+ from .types.delete_contact_request_identifier_type import DeleteContactRequestIdentifierType
35
+ from .types.get_attributes_response import GetAttributesResponse
36
+ from .types.get_contact_info_request_identifier import GetContactInfoRequestIdentifier
37
+ from .types.get_contact_info_request_identifier_type import GetContactInfoRequestIdentifierType
38
+ from .types.get_contact_info_response import GetContactInfoResponse
39
+ from .types.get_contact_stats_request_identifier import GetContactStatsRequestIdentifier
40
+ from .types.get_contact_stats_response import GetContactStatsResponse
41
+ from .types.get_contacts_from_list_request_sort import GetContactsFromListRequestSort
42
+ from .types.get_contacts_request_sort import GetContactsRequestSort
43
+ from .types.get_folder_lists_request_sort import GetFolderListsRequestSort
44
+ from .types.get_folder_lists_response import GetFolderListsResponse
45
+ from .types.get_folders_request_sort import GetFoldersRequestSort
46
+ from .types.get_folders_response import GetFoldersResponse
47
+ from .types.get_list_response import GetListResponse
48
+ from .types.get_lists_request_sort import GetListsRequestSort
49
+ from .types.get_lists_response import GetListsResponse
50
+ from .types.get_segments_request_sort import GetSegmentsRequestSort
51
+ from .types.get_segments_response import GetSegmentsResponse
52
+ from .types.import_contacts_request_json_body_item import ImportContactsRequestJsonBodyItem
53
+ from .types.import_contacts_request_new_list import ImportContactsRequestNewList
54
+ from .types.import_contacts_response import ImportContactsResponse
55
+ from .types.remove_contact_from_list_request_body import RemoveContactFromListRequestBody
56
+ from .types.request_contact_export_request_custom_contact_filter import RequestContactExportRequestCustomContactFilter
57
+ from .types.request_contact_export_response import RequestContactExportResponse
58
+ from .types.update_attribute_request_attribute_category import UpdateAttributeRequestAttributeCategory
59
+ from .types.update_attribute_request_enumeration_item import UpdateAttributeRequestEnumerationItem
60
+ from .types.update_batch_contacts_request_contacts_item import UpdateBatchContactsRequestContactsItem
61
+ from .types.update_contact_request_attributes_value import UpdateContactRequestAttributesValue
62
+ from .types.update_contact_request_identifier import UpdateContactRequestIdentifier
63
+ from .types.update_contact_request_identifier_type import UpdateContactRequestIdentifierType
64
+
65
+ # this is used as the default value for optional parameters
66
+ OMIT = typing.cast(typing.Any, ...)
67
+
68
+
69
+ class RawContactsClient:
70
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
71
+ self._client_wrapper = client_wrapper
72
+
73
+ def get_contacts(
74
+ self,
75
+ *,
76
+ limit: typing.Optional[int] = None,
77
+ offset: typing.Optional[int] = None,
78
+ modified_since: typing.Optional[str] = None,
79
+ created_since: typing.Optional[str] = None,
80
+ sort: typing.Optional[GetContactsRequestSort] = None,
81
+ segment_id: typing.Optional[int] = None,
82
+ list_ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
83
+ filter: typing.Optional[str] = None,
84
+ request_options: typing.Optional[RequestOptions] = None,
85
+ ) -> HttpResponse[GetContacts]:
86
+ """
87
+ <Note title="Follow this format when passing a SMS phone number as an attribute">
88
+ Accepted Number Formats
89
+
90
+ 91xxxxxxxxxx
91
+ +91xxxxxxxxxx
92
+ 0091xxxxxxxxxx
93
+ </Note>
94
+
95
+ Parameters
96
+ ----------
97
+ limit : typing.Optional[int]
98
+ Number of documents per page
99
+
100
+ offset : typing.Optional[int]
101
+ Index of the first document of the page
102
+
103
+ modified_since : typing.Optional[str]
104
+ Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.**
105
+
106
+ created_since : typing.Optional[str]
107
+ Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.**
108
+
109
+ sort : typing.Optional[GetContactsRequestSort]
110
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
111
+
112
+ segment_id : typing.Optional[int]
113
+ Id of the segment. **Either listIds or segmentId can be passed.**
114
+
115
+ list_ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
116
+ Ids of the list. **Either listIds or segmentId can be passed.**
117
+
118
+ filter : typing.Optional[str]
119
+ Filter the contacts on the basis of attributes. **Allowed operator: equals. For multiple-choice options, the filter will apply an AND condition between the options. For category attributes, the filter will work with both id and value. (e.g. filter=equals(FIRSTNAME,"Antoine"), filter=equals(B1, true), filter=equals(DOB, "1989-11-23"), filter=equals(GENDER, "1"), filter=equals(GENDER, "MALE"), filter=equals(COUNTRY,"USA, INDIA")**
120
+
121
+ request_options : typing.Optional[RequestOptions]
122
+ Request-specific configuration.
123
+
124
+ Returns
125
+ -------
126
+ HttpResponse[GetContacts]
127
+ All contacts listed
128
+ """
129
+ _response = self._client_wrapper.httpx_client.request(
130
+ "contacts",
131
+ method="GET",
132
+ params={
133
+ "limit": limit,
134
+ "offset": offset,
135
+ "modifiedSince": modified_since,
136
+ "createdSince": created_since,
137
+ "sort": sort,
138
+ "segmentId": segment_id,
139
+ "listIds": list_ids,
140
+ "filter": filter,
141
+ },
142
+ request_options=request_options,
143
+ )
144
+ try:
145
+ if 200 <= _response.status_code < 300:
146
+ _data = typing.cast(
147
+ GetContacts,
148
+ construct_type(
149
+ type_=GetContacts, # type: ignore
150
+ object_=_response.json(),
151
+ ),
152
+ )
153
+ return HttpResponse(response=_response, data=_data)
154
+ if _response.status_code == 400:
155
+ raise BadRequestError(
156
+ headers=dict(_response.headers),
157
+ body=typing.cast(
158
+ typing.Any,
159
+ construct_type(
160
+ type_=typing.Any, # type: ignore
161
+ object_=_response.json(),
162
+ ),
163
+ ),
164
+ )
165
+ if _response.status_code == 429:
166
+ raise TooManyRequestsError(
167
+ headers=dict(_response.headers),
168
+ body=typing.cast(
169
+ ErrorModel,
170
+ construct_type(
171
+ type_=ErrorModel, # type: ignore
172
+ object_=_response.json(),
173
+ ),
174
+ ),
175
+ )
176
+ _response_json = _response.json()
177
+ except JSONDecodeError:
178
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
179
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
180
+
181
+ def create_contact(
182
+ self,
183
+ *,
184
+ attributes: typing.Optional[typing.Dict[str, CreateContactRequestAttributesValue]] = OMIT,
185
+ email: typing.Optional[str] = OMIT,
186
+ email_blacklisted: typing.Optional[bool] = OMIT,
187
+ ext_id: typing.Optional[str] = OMIT,
188
+ list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
189
+ sms_blacklisted: typing.Optional[bool] = OMIT,
190
+ smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
191
+ update_enabled: typing.Optional[bool] = OMIT,
192
+ request_options: typing.Optional[RequestOptions] = None,
193
+ ) -> HttpResponse[CreateContactResponse]:
194
+ """
195
+ Creates new contacts on Brevo. Contacts can be created by passing either - <br><br> 1. email address of the contact (email_id), <br> 2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"} <br> 3. ext_id <br>
196
+
197
+ Parameters
198
+ ----------
199
+ attributes : typing.Optional[typing.Dict[str, CreateContactRequestAttributesValue]]
200
+ Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. **These attributes must be present in your Brevo account**. For eg: **{"FNAME":"Elly", "LNAME":"Roger", "COUNTRIES": ["India","China"]}**
201
+
202
+ email : typing.Optional[str]
203
+ Email address of the user. **Mandatory if "ext_id" & "SMS" field is not passed.**
204
+
205
+ email_blacklisted : typing.Optional[bool]
206
+ Set this field to blacklist the contact for emails (emailBlacklisted = true)
207
+
208
+ ext_id : typing.Optional[str]
209
+ Pass your own Id to create a contact.
210
+
211
+ list_ids : typing.Optional[typing.Sequence[int]]
212
+ Ids of the lists to add the contact to
213
+
214
+ sms_blacklisted : typing.Optional[bool]
215
+ Set this field to blacklist the contact for SMS (smsBlacklisted = true)
216
+
217
+ smtp_blacklist_sender : typing.Optional[typing.Sequence[str]]
218
+ transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true )
219
+
220
+ update_enabled : typing.Optional[bool]
221
+ Facilitate to update the existing contact in the same request (updateEnabled = true)
222
+
223
+ request_options : typing.Optional[RequestOptions]
224
+ Request-specific configuration.
225
+
226
+ Returns
227
+ -------
228
+ HttpResponse[CreateContactResponse]
229
+ Contact created
230
+ """
231
+ _response = self._client_wrapper.httpx_client.request(
232
+ "contacts",
233
+ method="POST",
234
+ json={
235
+ "attributes": convert_and_respect_annotation_metadata(
236
+ object_=attributes,
237
+ annotation=typing.Dict[str, CreateContactRequestAttributesValue],
238
+ direction="write",
239
+ ),
240
+ "email": email,
241
+ "emailBlacklisted": email_blacklisted,
242
+ "ext_id": ext_id,
243
+ "listIds": list_ids,
244
+ "smsBlacklisted": sms_blacklisted,
245
+ "smtpBlacklistSender": smtp_blacklist_sender,
246
+ "updateEnabled": update_enabled,
247
+ },
248
+ headers={
249
+ "content-type": "application/json",
250
+ },
251
+ request_options=request_options,
252
+ omit=OMIT,
253
+ )
254
+ try:
255
+ if 200 <= _response.status_code < 300:
256
+ _data = typing.cast(
257
+ CreateContactResponse,
258
+ construct_type(
259
+ type_=CreateContactResponse, # type: ignore
260
+ object_=_response.json(),
261
+ ),
262
+ )
263
+ return HttpResponse(response=_response, data=_data)
264
+ if _response.status_code == 400:
265
+ raise BadRequestError(
266
+ headers=dict(_response.headers),
267
+ body=typing.cast(
268
+ typing.Any,
269
+ construct_type(
270
+ type_=typing.Any, # type: ignore
271
+ object_=_response.json(),
272
+ ),
273
+ ),
274
+ )
275
+ if _response.status_code == 425:
276
+ raise TooEarlyError(
277
+ headers=dict(_response.headers),
278
+ body=typing.cast(
279
+ ContactErrorModel,
280
+ construct_type(
281
+ type_=ContactErrorModel, # type: ignore
282
+ object_=_response.json(),
283
+ ),
284
+ ),
285
+ )
286
+ _response_json = _response.json()
287
+ except JSONDecodeError:
288
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
289
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
290
+
291
+ def get_attributes(
292
+ self, *, request_options: typing.Optional[RequestOptions] = None
293
+ ) -> HttpResponse[GetAttributesResponse]:
294
+ """
295
+ Parameters
296
+ ----------
297
+ request_options : typing.Optional[RequestOptions]
298
+ Request-specific configuration.
299
+
300
+ Returns
301
+ -------
302
+ HttpResponse[GetAttributesResponse]
303
+ Attributes listed
304
+ """
305
+ _response = self._client_wrapper.httpx_client.request(
306
+ "contacts/attributes",
307
+ method="GET",
308
+ request_options=request_options,
309
+ )
310
+ try:
311
+ if 200 <= _response.status_code < 300:
312
+ _data = typing.cast(
313
+ GetAttributesResponse,
314
+ construct_type(
315
+ type_=GetAttributesResponse, # type: ignore
316
+ object_=_response.json(),
317
+ ),
318
+ )
319
+ return HttpResponse(response=_response, data=_data)
320
+ _response_json = _response.json()
321
+ except JSONDecodeError:
322
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
323
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
324
+
325
+ def create_attribute(
326
+ self,
327
+ attribute_category: CreateAttributeRequestAttributeCategory,
328
+ attribute_name: str,
329
+ *,
330
+ enumeration: typing.Optional[typing.Sequence[CreateAttributeRequestEnumerationItem]] = OMIT,
331
+ is_recurring: typing.Optional[bool] = OMIT,
332
+ multi_category_options: typing.Optional[typing.Sequence[str]] = OMIT,
333
+ type: typing.Optional[CreateAttributeRequestType] = OMIT,
334
+ value: typing.Optional[str] = OMIT,
335
+ request_options: typing.Optional[RequestOptions] = None,
336
+ ) -> HttpResponse[None]:
337
+ """
338
+ Parameters
339
+ ----------
340
+ attribute_category : CreateAttributeRequestAttributeCategory
341
+ Category of the attribute
342
+
343
+ attribute_name : str
344
+ Name of the attribute
345
+
346
+ enumeration : typing.Optional[typing.Sequence[CreateAttributeRequestEnumerationItem]]
347
+ List of values and labels that the attribute can take. **Use only if the attribute's category is "category"**. None of the category options can exceed max 200 characters. For example: **[{"value":1, "label":"male"}, {"value":2, "label":"female"}]**
348
+
349
+ is_recurring : typing.Optional[bool]
350
+ Type of the attribute. **Use only if the attribute's category is 'calculated' or 'global'**
351
+
352
+ multi_category_options : typing.Optional[typing.Sequence[str]]
353
+ List of options you want to add for multiple-choice attribute. **Use only if the attribute's category is "normal" and attribute's type is "multiple-choice". None of the multicategory options can exceed max 200 characters.** For example: **["USA","INDIA"]**
354
+
355
+ type : typing.Optional[CreateAttributeRequestType]
356
+ Type of the attribute. **Use only if the attribute's category is 'normal', 'category' or 'transactional'** Type **user and multiple-choice** is only available if the category is **normal** attribute Type **id** is only available if the category is **transactional** attribute Type **category** is only available if the category is **category** attribute
357
+
358
+ value : typing.Optional[str]
359
+ Value of the attribute. **Use only if the attribute's category is 'calculated' or 'global'**
360
+
361
+ request_options : typing.Optional[RequestOptions]
362
+ Request-specific configuration.
363
+
364
+ Returns
365
+ -------
366
+ HttpResponse[None]
367
+ """
368
+ _response = self._client_wrapper.httpx_client.request(
369
+ f"contacts/attributes/{jsonable_encoder(attribute_category)}/{jsonable_encoder(attribute_name)}",
370
+ method="POST",
371
+ json={
372
+ "enumeration": convert_and_respect_annotation_metadata(
373
+ object_=enumeration,
374
+ annotation=typing.Sequence[CreateAttributeRequestEnumerationItem],
375
+ direction="write",
376
+ ),
377
+ "isRecurring": is_recurring,
378
+ "multiCategoryOptions": multi_category_options,
379
+ "type": type,
380
+ "value": value,
381
+ },
382
+ headers={
383
+ "content-type": "application/json",
384
+ },
385
+ request_options=request_options,
386
+ omit=OMIT,
387
+ )
388
+ try:
389
+ if 200 <= _response.status_code < 300:
390
+ return HttpResponse(response=_response, data=None)
391
+ if _response.status_code == 400:
392
+ raise BadRequestError(
393
+ headers=dict(_response.headers),
394
+ body=typing.cast(
395
+ typing.Any,
396
+ construct_type(
397
+ type_=typing.Any, # type: ignore
398
+ object_=_response.json(),
399
+ ),
400
+ ),
401
+ )
402
+ _response_json = _response.json()
403
+ except JSONDecodeError:
404
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
405
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
406
+
407
+ def update_attribute(
408
+ self,
409
+ attribute_category: UpdateAttributeRequestAttributeCategory,
410
+ attribute_name: str,
411
+ *,
412
+ enumeration: typing.Optional[typing.Sequence[UpdateAttributeRequestEnumerationItem]] = OMIT,
413
+ multi_category_options: typing.Optional[typing.Sequence[str]] = OMIT,
414
+ value: typing.Optional[str] = OMIT,
415
+ request_options: typing.Optional[RequestOptions] = None,
416
+ ) -> HttpResponse[None]:
417
+ """
418
+ Parameters
419
+ ----------
420
+ attribute_category : UpdateAttributeRequestAttributeCategory
421
+ Category of the attribute
422
+
423
+ attribute_name : str
424
+ Name of the existing attribute
425
+
426
+ enumeration : typing.Optional[typing.Sequence[UpdateAttributeRequestEnumerationItem]]
427
+ List of the values and labels that the attribute can take. **Use only if the attribute's category is "category"** None of the category options can exceed max 200 characters. For example, **[{"value":1, "label":"male"}, {"value":2, "label":"female"}]**
428
+
429
+ multi_category_options : typing.Optional[typing.Sequence[str]]
430
+ Use this option to add multiple-choice attributes options only if the attribute's category is "normal". **This option is specifically designed for updating multiple-choice attributes. None of the multicategory options can exceed max 200 characters.**. For example: **["USA","INDIA"]**
431
+
432
+ value : typing.Optional[str]
433
+ Value of the attribute to update. **Use only if the attribute's category is 'calculated' or 'global'**
434
+
435
+ request_options : typing.Optional[RequestOptions]
436
+ Request-specific configuration.
437
+
438
+ Returns
439
+ -------
440
+ HttpResponse[None]
441
+ """
442
+ _response = self._client_wrapper.httpx_client.request(
443
+ f"contacts/attributes/{jsonable_encoder(attribute_category)}/{jsonable_encoder(attribute_name)}",
444
+ method="PUT",
445
+ json={
446
+ "enumeration": convert_and_respect_annotation_metadata(
447
+ object_=enumeration,
448
+ annotation=typing.Sequence[UpdateAttributeRequestEnumerationItem],
449
+ direction="write",
450
+ ),
451
+ "multiCategoryOptions": multi_category_options,
452
+ "value": value,
453
+ },
454
+ headers={
455
+ "content-type": "application/json",
456
+ },
457
+ request_options=request_options,
458
+ omit=OMIT,
459
+ )
460
+ try:
461
+ if 200 <= _response.status_code < 300:
462
+ return HttpResponse(response=_response, data=None)
463
+ if _response.status_code == 400:
464
+ raise BadRequestError(
465
+ headers=dict(_response.headers),
466
+ body=typing.cast(
467
+ typing.Any,
468
+ construct_type(
469
+ type_=typing.Any, # type: ignore
470
+ object_=_response.json(),
471
+ ),
472
+ ),
473
+ )
474
+ if _response.status_code == 404:
475
+ raise NotFoundError(
476
+ headers=dict(_response.headers),
477
+ body=typing.cast(
478
+ typing.Any,
479
+ construct_type(
480
+ type_=typing.Any, # type: ignore
481
+ object_=_response.json(),
482
+ ),
483
+ ),
484
+ )
485
+ _response_json = _response.json()
486
+ except JSONDecodeError:
487
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
488
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
489
+
490
+ def delete_attribute(
491
+ self,
492
+ attribute_category: DeleteAttributeRequestAttributeCategory,
493
+ attribute_name: str,
494
+ *,
495
+ request_options: typing.Optional[RequestOptions] = None,
496
+ ) -> HttpResponse[None]:
497
+ """
498
+ Parameters
499
+ ----------
500
+ attribute_category : DeleteAttributeRequestAttributeCategory
501
+ Category of the attribute
502
+
503
+ attribute_name : str
504
+ Name of the existing attribute
505
+
506
+ request_options : typing.Optional[RequestOptions]
507
+ Request-specific configuration.
508
+
509
+ Returns
510
+ -------
511
+ HttpResponse[None]
512
+ """
513
+ _response = self._client_wrapper.httpx_client.request(
514
+ f"contacts/attributes/{jsonable_encoder(attribute_category)}/{jsonable_encoder(attribute_name)}",
515
+ method="DELETE",
516
+ request_options=request_options,
517
+ )
518
+ try:
519
+ if 200 <= _response.status_code < 300:
520
+ return HttpResponse(response=_response, data=None)
521
+ if _response.status_code == 400:
522
+ raise BadRequestError(
523
+ headers=dict(_response.headers),
524
+ body=typing.cast(
525
+ typing.Any,
526
+ construct_type(
527
+ type_=typing.Any, # type: ignore
528
+ object_=_response.json(),
529
+ ),
530
+ ),
531
+ )
532
+ if _response.status_code == 404:
533
+ raise NotFoundError(
534
+ headers=dict(_response.headers),
535
+ body=typing.cast(
536
+ typing.Any,
537
+ construct_type(
538
+ type_=typing.Any, # type: ignore
539
+ object_=_response.json(),
540
+ ),
541
+ ),
542
+ )
543
+ _response_json = _response.json()
544
+ except JSONDecodeError:
545
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
546
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
547
+
548
+ def delete_multi_attribute_options(
549
+ self,
550
+ multiple_choice_attribute: str,
551
+ multiple_choice_attribute_option: str,
552
+ *,
553
+ request_options: typing.Optional[RequestOptions] = None,
554
+ ) -> HttpResponse[None]:
555
+ """
556
+ Parameters
557
+ ----------
558
+ multiple_choice_attribute : str
559
+ Name of the existing multiple-choice attribute
560
+
561
+ multiple_choice_attribute_option : str
562
+ Name of the existing multiple-choice attribute option that you want to delete
563
+
564
+ request_options : typing.Optional[RequestOptions]
565
+ Request-specific configuration.
566
+
567
+ Returns
568
+ -------
569
+ HttpResponse[None]
570
+ """
571
+ _response = self._client_wrapper.httpx_client.request(
572
+ f"contacts/attributes/multiple-choice/{jsonable_encoder(multiple_choice_attribute)}/{jsonable_encoder(multiple_choice_attribute_option)}",
573
+ method="DELETE",
574
+ request_options=request_options,
575
+ )
576
+ try:
577
+ if 200 <= _response.status_code < 300:
578
+ return HttpResponse(response=_response, data=None)
579
+ if _response.status_code == 400:
580
+ raise BadRequestError(
581
+ headers=dict(_response.headers),
582
+ body=typing.cast(
583
+ typing.Any,
584
+ construct_type(
585
+ type_=typing.Any, # type: ignore
586
+ object_=_response.json(),
587
+ ),
588
+ ),
589
+ )
590
+ if _response.status_code == 404:
591
+ raise NotFoundError(
592
+ headers=dict(_response.headers),
593
+ body=typing.cast(
594
+ typing.Any,
595
+ construct_type(
596
+ type_=typing.Any, # type: ignore
597
+ object_=_response.json(),
598
+ ),
599
+ ),
600
+ )
601
+ _response_json = _response.json()
602
+ except JSONDecodeError:
603
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
604
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
605
+
606
+ def update_batch_contacts(
607
+ self,
608
+ *,
609
+ contacts: typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]] = OMIT,
610
+ request_options: typing.Optional[RequestOptions] = None,
611
+ ) -> HttpResponse[None]:
612
+ """
613
+ Parameters
614
+ ----------
615
+ contacts : typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]]
616
+ List of contacts to be updated
617
+
618
+ request_options : typing.Optional[RequestOptions]
619
+ Request-specific configuration.
620
+
621
+ Returns
622
+ -------
623
+ HttpResponse[None]
624
+ """
625
+ _response = self._client_wrapper.httpx_client.request(
626
+ "contacts/batch",
627
+ method="POST",
628
+ json={
629
+ "contacts": convert_and_respect_annotation_metadata(
630
+ object_=contacts,
631
+ annotation=typing.Sequence[UpdateBatchContactsRequestContactsItem],
632
+ direction="write",
633
+ ),
634
+ },
635
+ headers={
636
+ "content-type": "application/json",
637
+ },
638
+ request_options=request_options,
639
+ omit=OMIT,
640
+ )
641
+ try:
642
+ if 200 <= _response.status_code < 300:
643
+ return HttpResponse(response=_response, data=None)
644
+ if _response.status_code == 400:
645
+ raise BadRequestError(
646
+ headers=dict(_response.headers),
647
+ body=typing.cast(
648
+ typing.Any,
649
+ construct_type(
650
+ type_=typing.Any, # type: ignore
651
+ object_=_response.json(),
652
+ ),
653
+ ),
654
+ )
655
+ _response_json = _response.json()
656
+ except JSONDecodeError:
657
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
658
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
659
+
660
+ def create_doi_contact(
661
+ self,
662
+ *,
663
+ email: str,
664
+ include_list_ids: typing.Sequence[int],
665
+ redirection_url: str,
666
+ template_id: int,
667
+ attributes: typing.Optional[typing.Dict[str, CreateDoiContactRequestAttributesValue]] = OMIT,
668
+ exclude_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
669
+ request_options: typing.Optional[RequestOptions] = None,
670
+ ) -> HttpResponse[None]:
671
+ """
672
+ <Note title="How to use attributes param?">
673
+ attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
674
+ </Note>
675
+
676
+ Parameters
677
+ ----------
678
+ email : str
679
+ Email address where the confirmation email will be sent. This email address will be the identifier for all other contact attributes.
680
+
681
+ include_list_ids : typing.Sequence[int]
682
+ Lists under user account where contact should be added
683
+
684
+ redirection_url : str
685
+ URL of the web page that user will be redirected to after clicking on the double opt in URL. When editing your DOI template you can reference this URL by using the tag **{{ params.DOIurl }}**.
686
+
687
+ template_id : int
688
+ Id of the Double opt-in (DOI) template
689
+
690
+ attributes : typing.Optional[typing.Dict[str, CreateDoiContactRequestAttributesValue]]
691
+ Pass the set of attributes and their values. **These attributes must be present in your Brevo account**. For eg. **{'FNAME':'Elly', 'LNAME':'Roger', 'COUNTRIES': ['India','China']}**
692
+
693
+ exclude_list_ids : typing.Optional[typing.Sequence[int]]
694
+ Lists under user account where contact should not be added
695
+
696
+ request_options : typing.Optional[RequestOptions]
697
+ Request-specific configuration.
698
+
699
+ Returns
700
+ -------
701
+ HttpResponse[None]
702
+ """
703
+ _response = self._client_wrapper.httpx_client.request(
704
+ "contacts/doubleOptinConfirmation",
705
+ method="POST",
706
+ json={
707
+ "attributes": convert_and_respect_annotation_metadata(
708
+ object_=attributes,
709
+ annotation=typing.Dict[str, CreateDoiContactRequestAttributesValue],
710
+ direction="write",
711
+ ),
712
+ "email": email,
713
+ "excludeListIds": exclude_list_ids,
714
+ "includeListIds": include_list_ids,
715
+ "redirectionUrl": redirection_url,
716
+ "templateId": template_id,
717
+ },
718
+ headers={
719
+ "content-type": "application/json",
720
+ },
721
+ request_options=request_options,
722
+ omit=OMIT,
723
+ )
724
+ try:
725
+ if 200 <= _response.status_code < 300:
726
+ return HttpResponse(response=_response, data=None)
727
+ if _response.status_code == 400:
728
+ raise BadRequestError(
729
+ headers=dict(_response.headers),
730
+ body=typing.cast(
731
+ typing.Any,
732
+ construct_type(
733
+ type_=typing.Any, # type: ignore
734
+ object_=_response.json(),
735
+ ),
736
+ ),
737
+ )
738
+ _response_json = _response.json()
739
+ except JSONDecodeError:
740
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
741
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
742
+
743
+ def request_contact_export(
744
+ self,
745
+ *,
746
+ custom_contact_filter: RequestContactExportRequestCustomContactFilter,
747
+ disable_notification: typing.Optional[bool] = OMIT,
748
+ export_attributes: typing.Optional[typing.Sequence[str]] = OMIT,
749
+ export_mandatory_attributes: typing.Optional[bool] = OMIT,
750
+ export_metadata: typing.Optional[typing.Sequence[str]] = OMIT,
751
+ export_date_in_utc: typing.Optional[bool] = OMIT,
752
+ export_subscription_status: typing.Optional[typing.Sequence[str]] = OMIT,
753
+ notify_url: typing.Optional[str] = OMIT,
754
+ request_options: typing.Optional[RequestOptions] = None,
755
+ ) -> HttpResponse[RequestContactExportResponse]:
756
+ """
757
+ It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv.
758
+
759
+ Parameters
760
+ ----------
761
+ custom_contact_filter : RequestContactExportRequestCustomContactFilter
762
+ Set the filter for the contacts to be exported.
763
+
764
+ disable_notification : typing.Optional[bool]
765
+ To avoid generating the email notification upon contact export, pass **true**
766
+
767
+ export_attributes : typing.Optional[typing.Sequence[str]]
768
+ List of all the attributes that you want to export. **These attributes must be present in your contact database. It is required if exportMandatoryAttributes is set false. ** For example: **['fname', 'lname', 'email']**
769
+
770
+ export_mandatory_attributes : typing.Optional[bool]
771
+ To export mandatory attributes like EMAIL, ADDED_TIME, MODIFIED_TIME
772
+
773
+ export_metadata : typing.Optional[typing.Sequence[str]]
774
+ Export metadata of contacts such as _listIds, ADDED_TIME, MODIFIED_TIME.
775
+
776
+ export_date_in_utc : typing.Optional[bool]
777
+ Specifies whether the date fields createdAt, modifiedAt in the exported data should be returned in UTC format.
778
+
779
+ export_subscription_status : typing.Optional[typing.Sequence[str]]
780
+ Export subscription status of contacts for email & sms marketting. Pass email_marketing to obtain the marketing email subscription status & sms_marketing to retrieve the marketing SMS status of the contact.
781
+
782
+ notify_url : typing.Optional[str]
783
+ Webhook that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479
784
+
785
+ request_options : typing.Optional[RequestOptions]
786
+ Request-specific configuration.
787
+
788
+ Returns
789
+ -------
790
+ HttpResponse[RequestContactExportResponse]
791
+ process id created
792
+ """
793
+ _response = self._client_wrapper.httpx_client.request(
794
+ "contacts/export",
795
+ method="POST",
796
+ json={
797
+ "customContactFilter": convert_and_respect_annotation_metadata(
798
+ object_=custom_contact_filter,
799
+ annotation=RequestContactExportRequestCustomContactFilter,
800
+ direction="write",
801
+ ),
802
+ "disableNotification": disable_notification,
803
+ "exportAttributes": export_attributes,
804
+ "exportMandatoryAttributes": export_mandatory_attributes,
805
+ "exportMetadata": export_metadata,
806
+ "exportDateInUTC": export_date_in_utc,
807
+ "exportSubscriptionStatus": export_subscription_status,
808
+ "notifyUrl": notify_url,
809
+ },
810
+ headers={
811
+ "content-type": "application/json",
812
+ },
813
+ request_options=request_options,
814
+ omit=OMIT,
815
+ )
816
+ try:
817
+ if 200 <= _response.status_code < 300:
818
+ _data = typing.cast(
819
+ RequestContactExportResponse,
820
+ construct_type(
821
+ type_=RequestContactExportResponse, # type: ignore
822
+ object_=_response.json(),
823
+ ),
824
+ )
825
+ return HttpResponse(response=_response, data=_data)
826
+ if _response.status_code == 400:
827
+ raise BadRequestError(
828
+ headers=dict(_response.headers),
829
+ body=typing.cast(
830
+ typing.Any,
831
+ construct_type(
832
+ type_=typing.Any, # type: ignore
833
+ object_=_response.json(),
834
+ ),
835
+ ),
836
+ )
837
+ if _response.status_code == 429:
838
+ raise TooManyRequestsError(
839
+ headers=dict(_response.headers),
840
+ body=typing.cast(
841
+ ErrorModel,
842
+ construct_type(
843
+ type_=ErrorModel, # type: ignore
844
+ object_=_response.json(),
845
+ ),
846
+ ),
847
+ )
848
+ _response_json = _response.json()
849
+ except JSONDecodeError:
850
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
851
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
852
+
853
+ def get_folders(
854
+ self,
855
+ *,
856
+ limit: typing.Optional[int] = None,
857
+ offset: typing.Optional[int] = None,
858
+ sort: typing.Optional[GetFoldersRequestSort] = None,
859
+ request_options: typing.Optional[RequestOptions] = None,
860
+ ) -> HttpResponse[GetFoldersResponse]:
861
+ """
862
+ <Note>
863
+ Ongoing changes for this endpoint
864
+
865
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
866
+
867
+ These are non breaking changes.
868
+
869
+ The default value for the attributes will be 0.
870
+
871
+ The uniqueSubscribers field is deprecated
872
+ </Note>
873
+
874
+ Parameters
875
+ ----------
876
+ limit : typing.Optional[int]
877
+ Number of documents per page
878
+
879
+ offset : typing.Optional[int]
880
+ Index of the first document of the page
881
+
882
+ sort : typing.Optional[GetFoldersRequestSort]
883
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
884
+
885
+ request_options : typing.Optional[RequestOptions]
886
+ Request-specific configuration.
887
+
888
+ Returns
889
+ -------
890
+ HttpResponse[GetFoldersResponse]
891
+ Folders informations
892
+ """
893
+ _response = self._client_wrapper.httpx_client.request(
894
+ "contacts/folders",
895
+ method="GET",
896
+ params={
897
+ "limit": limit,
898
+ "offset": offset,
899
+ "sort": sort,
900
+ },
901
+ request_options=request_options,
902
+ )
903
+ try:
904
+ if 200 <= _response.status_code < 300:
905
+ _data = typing.cast(
906
+ GetFoldersResponse,
907
+ construct_type(
908
+ type_=GetFoldersResponse, # type: ignore
909
+ object_=_response.json(),
910
+ ),
911
+ )
912
+ return HttpResponse(response=_response, data=_data)
913
+ if _response.status_code == 400:
914
+ raise BadRequestError(
915
+ headers=dict(_response.headers),
916
+ body=typing.cast(
917
+ typing.Any,
918
+ construct_type(
919
+ type_=typing.Any, # type: ignore
920
+ object_=_response.json(),
921
+ ),
922
+ ),
923
+ )
924
+ _response_json = _response.json()
925
+ except JSONDecodeError:
926
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
927
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
928
+
929
+ def create_folder(
930
+ self, *, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
931
+ ) -> HttpResponse[CreateFolderResponse]:
932
+ """
933
+ Parameters
934
+ ----------
935
+ name : typing.Optional[str]
936
+ Name of the folder
937
+
938
+ request_options : typing.Optional[RequestOptions]
939
+ Request-specific configuration.
940
+
941
+ Returns
942
+ -------
943
+ HttpResponse[CreateFolderResponse]
944
+ successfully created
945
+ """
946
+ _response = self._client_wrapper.httpx_client.request(
947
+ "contacts/folders",
948
+ method="POST",
949
+ json={
950
+ "name": name,
951
+ },
952
+ headers={
953
+ "content-type": "application/json",
954
+ },
955
+ request_options=request_options,
956
+ omit=OMIT,
957
+ )
958
+ try:
959
+ if 200 <= _response.status_code < 300:
960
+ _data = typing.cast(
961
+ CreateFolderResponse,
962
+ construct_type(
963
+ type_=CreateFolderResponse, # type: ignore
964
+ object_=_response.json(),
965
+ ),
966
+ )
967
+ return HttpResponse(response=_response, data=_data)
968
+ if _response.status_code == 400:
969
+ raise BadRequestError(
970
+ headers=dict(_response.headers),
971
+ body=typing.cast(
972
+ typing.Any,
973
+ construct_type(
974
+ type_=typing.Any, # type: ignore
975
+ object_=_response.json(),
976
+ ),
977
+ ),
978
+ )
979
+ _response_json = _response.json()
980
+ except JSONDecodeError:
981
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
982
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
983
+
984
+ def get_folder(
985
+ self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None
986
+ ) -> HttpResponse[GetFolder]:
987
+ """
988
+ <Note>
989
+ Ongoing changes for this endpoint.
990
+
991
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
992
+
993
+ These are non breaking changes. The default value for the attributes will be 0.
994
+ </Note>
995
+
996
+ Parameters
997
+ ----------
998
+ folder_id : int
999
+ id of the folder
1000
+
1001
+ request_options : typing.Optional[RequestOptions]
1002
+ Request-specific configuration.
1003
+
1004
+ Returns
1005
+ -------
1006
+ HttpResponse[GetFolder]
1007
+ Folder details
1008
+ """
1009
+ _response = self._client_wrapper.httpx_client.request(
1010
+ f"contacts/folders/{jsonable_encoder(folder_id)}",
1011
+ method="GET",
1012
+ request_options=request_options,
1013
+ )
1014
+ try:
1015
+ if 200 <= _response.status_code < 300:
1016
+ _data = typing.cast(
1017
+ GetFolder,
1018
+ construct_type(
1019
+ type_=GetFolder, # type: ignore
1020
+ object_=_response.json(),
1021
+ ),
1022
+ )
1023
+ return HttpResponse(response=_response, data=_data)
1024
+ if _response.status_code == 400:
1025
+ raise BadRequestError(
1026
+ headers=dict(_response.headers),
1027
+ body=typing.cast(
1028
+ typing.Any,
1029
+ construct_type(
1030
+ type_=typing.Any, # type: ignore
1031
+ object_=_response.json(),
1032
+ ),
1033
+ ),
1034
+ )
1035
+ if _response.status_code == 404:
1036
+ raise NotFoundError(
1037
+ headers=dict(_response.headers),
1038
+ body=typing.cast(
1039
+ typing.Any,
1040
+ construct_type(
1041
+ type_=typing.Any, # type: ignore
1042
+ object_=_response.json(),
1043
+ ),
1044
+ ),
1045
+ )
1046
+ _response_json = _response.json()
1047
+ except JSONDecodeError:
1048
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1049
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1050
+
1051
+ def update_folder(
1052
+ self,
1053
+ folder_id: int,
1054
+ *,
1055
+ name: typing.Optional[str] = OMIT,
1056
+ request_options: typing.Optional[RequestOptions] = None,
1057
+ ) -> HttpResponse[None]:
1058
+ """
1059
+ Parameters
1060
+ ----------
1061
+ folder_id : int
1062
+ Id of the folder
1063
+
1064
+ name : typing.Optional[str]
1065
+ Name of the folder
1066
+
1067
+ request_options : typing.Optional[RequestOptions]
1068
+ Request-specific configuration.
1069
+
1070
+ Returns
1071
+ -------
1072
+ HttpResponse[None]
1073
+ """
1074
+ _response = self._client_wrapper.httpx_client.request(
1075
+ f"contacts/folders/{jsonable_encoder(folder_id)}",
1076
+ method="PUT",
1077
+ json={
1078
+ "name": name,
1079
+ },
1080
+ headers={
1081
+ "content-type": "application/json",
1082
+ },
1083
+ request_options=request_options,
1084
+ omit=OMIT,
1085
+ )
1086
+ try:
1087
+ if 200 <= _response.status_code < 300:
1088
+ return HttpResponse(response=_response, data=None)
1089
+ if _response.status_code == 400:
1090
+ raise BadRequestError(
1091
+ headers=dict(_response.headers),
1092
+ body=typing.cast(
1093
+ typing.Any,
1094
+ construct_type(
1095
+ type_=typing.Any, # type: ignore
1096
+ object_=_response.json(),
1097
+ ),
1098
+ ),
1099
+ )
1100
+ if _response.status_code == 404:
1101
+ raise NotFoundError(
1102
+ headers=dict(_response.headers),
1103
+ body=typing.cast(
1104
+ typing.Any,
1105
+ construct_type(
1106
+ type_=typing.Any, # type: ignore
1107
+ object_=_response.json(),
1108
+ ),
1109
+ ),
1110
+ )
1111
+ _response_json = _response.json()
1112
+ except JSONDecodeError:
1113
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1114
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1115
+
1116
+ def delete_folder(
1117
+ self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None
1118
+ ) -> HttpResponse[None]:
1119
+ """
1120
+ Parameters
1121
+ ----------
1122
+ folder_id : int
1123
+ Id of the folder
1124
+
1125
+ request_options : typing.Optional[RequestOptions]
1126
+ Request-specific configuration.
1127
+
1128
+ Returns
1129
+ -------
1130
+ HttpResponse[None]
1131
+ """
1132
+ _response = self._client_wrapper.httpx_client.request(
1133
+ f"contacts/folders/{jsonable_encoder(folder_id)}",
1134
+ method="DELETE",
1135
+ request_options=request_options,
1136
+ )
1137
+ try:
1138
+ if 200 <= _response.status_code < 300:
1139
+ return HttpResponse(response=_response, data=None)
1140
+ if _response.status_code == 400:
1141
+ raise BadRequestError(
1142
+ headers=dict(_response.headers),
1143
+ body=typing.cast(
1144
+ typing.Any,
1145
+ construct_type(
1146
+ type_=typing.Any, # type: ignore
1147
+ object_=_response.json(),
1148
+ ),
1149
+ ),
1150
+ )
1151
+ if _response.status_code == 404:
1152
+ raise NotFoundError(
1153
+ headers=dict(_response.headers),
1154
+ body=typing.cast(
1155
+ typing.Any,
1156
+ construct_type(
1157
+ type_=typing.Any, # type: ignore
1158
+ object_=_response.json(),
1159
+ ),
1160
+ ),
1161
+ )
1162
+ _response_json = _response.json()
1163
+ except JSONDecodeError:
1164
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1165
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1166
+
1167
+ def get_folder_lists(
1168
+ self,
1169
+ folder_id: int,
1170
+ *,
1171
+ limit: typing.Optional[int] = None,
1172
+ offset: typing.Optional[int] = None,
1173
+ sort: typing.Optional[GetFolderListsRequestSort] = None,
1174
+ request_options: typing.Optional[RequestOptions] = None,
1175
+ ) -> HttpResponse[GetFolderListsResponse]:
1176
+ """
1177
+ <Note>
1178
+ Ongoing changes for this endpoint.
1179
+
1180
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
1181
+
1182
+ These are non breaking changes. The default value for the attributes will be 0.
1183
+ </Note>
1184
+
1185
+ Parameters
1186
+ ----------
1187
+ folder_id : int
1188
+ Id of the folder
1189
+
1190
+ limit : typing.Optional[int]
1191
+ Number of documents per page
1192
+
1193
+ offset : typing.Optional[int]
1194
+ Index of the first document of the page
1195
+
1196
+ sort : typing.Optional[GetFolderListsRequestSort]
1197
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
1198
+
1199
+ request_options : typing.Optional[RequestOptions]
1200
+ Request-specific configuration.
1201
+
1202
+ Returns
1203
+ -------
1204
+ HttpResponse[GetFolderListsResponse]
1205
+ Folder's Lists details
1206
+ """
1207
+ _response = self._client_wrapper.httpx_client.request(
1208
+ f"contacts/folders/{jsonable_encoder(folder_id)}/lists",
1209
+ method="GET",
1210
+ params={
1211
+ "limit": limit,
1212
+ "offset": offset,
1213
+ "sort": sort,
1214
+ },
1215
+ request_options=request_options,
1216
+ )
1217
+ try:
1218
+ if 200 <= _response.status_code < 300:
1219
+ _data = typing.cast(
1220
+ GetFolderListsResponse,
1221
+ construct_type(
1222
+ type_=GetFolderListsResponse, # type: ignore
1223
+ object_=_response.json(),
1224
+ ),
1225
+ )
1226
+ return HttpResponse(response=_response, data=_data)
1227
+ if _response.status_code == 400:
1228
+ raise BadRequestError(
1229
+ headers=dict(_response.headers),
1230
+ body=typing.cast(
1231
+ typing.Any,
1232
+ construct_type(
1233
+ type_=typing.Any, # type: ignore
1234
+ object_=_response.json(),
1235
+ ),
1236
+ ),
1237
+ )
1238
+ if _response.status_code == 404:
1239
+ raise NotFoundError(
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 import_contacts(
1255
+ self,
1256
+ *,
1257
+ disable_notification: typing.Optional[bool] = OMIT,
1258
+ email_blacklist: typing.Optional[bool] = OMIT,
1259
+ empty_contacts_attributes: typing.Optional[bool] = OMIT,
1260
+ file_body: typing.Optional[str] = OMIT,
1261
+ file_url: typing.Optional[str] = OMIT,
1262
+ json_body: typing.Optional[typing.Sequence[ImportContactsRequestJsonBodyItem]] = OMIT,
1263
+ list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
1264
+ new_list: typing.Optional[ImportContactsRequestNewList] = OMIT,
1265
+ notify_url: typing.Optional[str] = OMIT,
1266
+ sms_blacklist: typing.Optional[bool] = OMIT,
1267
+ update_existing_contacts: typing.Optional[bool] = OMIT,
1268
+ request_options: typing.Optional[RequestOptions] = None,
1269
+ ) -> HttpResponse[ImportContactsResponse]:
1270
+ """
1271
+ It returns the background process ID which on completion calls the notify URL that you have set in the input. **Note**: - Any contact attribute that doesn't exist in your account will be ignored at import end.
1272
+
1273
+ Parameters
1274
+ ----------
1275
+ disable_notification : typing.Optional[bool]
1276
+ To disable email notification
1277
+
1278
+ email_blacklist : typing.Optional[bool]
1279
+ To blacklist all the contacts for email
1280
+
1281
+ empty_contacts_attributes : typing.Optional[bool]
1282
+ To facilitate the choice to erase any attribute of the existing contacts with empty value. emptyContactsAttributes = true means the empty fields in your import will erase any attribute that currently contain data in Brevo, & emptyContactsAttributes = false means the empty fields will not affect your existing data ( **only available if `updateExistingContacts` set to true **)
1283
+
1284
+ file_body : typing.Optional[str]
1285
+ **Mandatory if fileUrl and jsonBody is not defined.** CSV content to be imported. Use semicolon to separate multiple attributes. **Maximum allowed file body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of file body size while parsing. Please use fileUrl instead to import bigger files.
1286
+
1287
+ file_url : typing.Optional[str]
1288
+ **Mandatory if fileBody and jsonBody is not defined.** URL of the file to be imported (**no local file**). Possible file formats: #### .txt, .csv, .json
1289
+
1290
+ json_body : typing.Optional[typing.Sequence[ImportContactsRequestJsonBodyItem]]
1291
+ **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files.
1292
+
1293
+ list_ids : typing.Optional[typing.Sequence[int]]
1294
+ **Mandatory if newList is not defined.** Ids of the lists in which the contacts shall be imported. For example, **[2, 4, 7]**.
1295
+
1296
+ new_list : typing.Optional[ImportContactsRequestNewList]
1297
+ To create a new list and import the contacts into it, pass the listName and an optional folderId.
1298
+
1299
+ notify_url : typing.Optional[str]
1300
+ URL that will be called once the import process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479
1301
+
1302
+ sms_blacklist : typing.Optional[bool]
1303
+ To blacklist all the contacts for sms
1304
+
1305
+ update_existing_contacts : typing.Optional[bool]
1306
+ To facilitate the choice to update the existing contacts
1307
+
1308
+ request_options : typing.Optional[RequestOptions]
1309
+ Request-specific configuration.
1310
+
1311
+ Returns
1312
+ -------
1313
+ HttpResponse[ImportContactsResponse]
1314
+ process id created
1315
+ """
1316
+ _response = self._client_wrapper.httpx_client.request(
1317
+ "contacts/import",
1318
+ method="POST",
1319
+ json={
1320
+ "disableNotification": disable_notification,
1321
+ "emailBlacklist": email_blacklist,
1322
+ "emptyContactsAttributes": empty_contacts_attributes,
1323
+ "fileBody": file_body,
1324
+ "fileUrl": file_url,
1325
+ "jsonBody": convert_and_respect_annotation_metadata(
1326
+ object_=json_body, annotation=typing.Sequence[ImportContactsRequestJsonBodyItem], direction="write"
1327
+ ),
1328
+ "listIds": list_ids,
1329
+ "newList": convert_and_respect_annotation_metadata(
1330
+ object_=new_list, annotation=ImportContactsRequestNewList, direction="write"
1331
+ ),
1332
+ "notifyUrl": notify_url,
1333
+ "smsBlacklist": sms_blacklist,
1334
+ "updateExistingContacts": update_existing_contacts,
1335
+ },
1336
+ headers={
1337
+ "content-type": "application/json",
1338
+ },
1339
+ request_options=request_options,
1340
+ omit=OMIT,
1341
+ )
1342
+ try:
1343
+ if 200 <= _response.status_code < 300:
1344
+ _data = typing.cast(
1345
+ ImportContactsResponse,
1346
+ construct_type(
1347
+ type_=ImportContactsResponse, # type: ignore
1348
+ object_=_response.json(),
1349
+ ),
1350
+ )
1351
+ return HttpResponse(response=_response, data=_data)
1352
+ if _response.status_code == 400:
1353
+ raise BadRequestError(
1354
+ headers=dict(_response.headers),
1355
+ body=typing.cast(
1356
+ typing.Any,
1357
+ construct_type(
1358
+ type_=typing.Any, # type: ignore
1359
+ object_=_response.json(),
1360
+ ),
1361
+ ),
1362
+ )
1363
+ _response_json = _response.json()
1364
+ except JSONDecodeError:
1365
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1366
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1367
+
1368
+ def get_lists(
1369
+ self,
1370
+ *,
1371
+ limit: typing.Optional[int] = None,
1372
+ offset: typing.Optional[int] = None,
1373
+ sort: typing.Optional[GetListsRequestSort] = None,
1374
+ request_options: typing.Optional[RequestOptions] = None,
1375
+ ) -> HttpResponse[GetListsResponse]:
1376
+ """
1377
+ <Note>
1378
+ Ongoing changes for this endpoint.
1379
+
1380
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
1381
+
1382
+ These are non breaking changes. The default value for the attributes will be 0.
1383
+ </Note>
1384
+
1385
+ Parameters
1386
+ ----------
1387
+ limit : typing.Optional[int]
1388
+ Number of documents per page
1389
+
1390
+ offset : typing.Optional[int]
1391
+ Index of the first document of the page
1392
+
1393
+ sort : typing.Optional[GetListsRequestSort]
1394
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
1395
+
1396
+ request_options : typing.Optional[RequestOptions]
1397
+ Request-specific configuration.
1398
+
1399
+ Returns
1400
+ -------
1401
+ HttpResponse[GetListsResponse]
1402
+ Lists informations
1403
+ """
1404
+ _response = self._client_wrapper.httpx_client.request(
1405
+ "contacts/lists",
1406
+ method="GET",
1407
+ params={
1408
+ "limit": limit,
1409
+ "offset": offset,
1410
+ "sort": sort,
1411
+ },
1412
+ request_options=request_options,
1413
+ )
1414
+ try:
1415
+ if 200 <= _response.status_code < 300:
1416
+ _data = typing.cast(
1417
+ GetListsResponse,
1418
+ construct_type(
1419
+ type_=GetListsResponse, # type: ignore
1420
+ object_=_response.json(),
1421
+ ),
1422
+ )
1423
+ return HttpResponse(response=_response, data=_data)
1424
+ if _response.status_code == 400:
1425
+ raise BadRequestError(
1426
+ headers=dict(_response.headers),
1427
+ body=typing.cast(
1428
+ typing.Any,
1429
+ construct_type(
1430
+ type_=typing.Any, # type: ignore
1431
+ object_=_response.json(),
1432
+ ),
1433
+ ),
1434
+ )
1435
+ _response_json = _response.json()
1436
+ except JSONDecodeError:
1437
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1438
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1439
+
1440
+ def create_list(
1441
+ self, *, folder_id: int, name: str, request_options: typing.Optional[RequestOptions] = None
1442
+ ) -> HttpResponse[CreateListResponse]:
1443
+ """
1444
+ Parameters
1445
+ ----------
1446
+ folder_id : int
1447
+ Id of the parent folder in which this list is to be created
1448
+
1449
+ name : str
1450
+ Name of the list
1451
+
1452
+ request_options : typing.Optional[RequestOptions]
1453
+ Request-specific configuration.
1454
+
1455
+ Returns
1456
+ -------
1457
+ HttpResponse[CreateListResponse]
1458
+ successfully created
1459
+ """
1460
+ _response = self._client_wrapper.httpx_client.request(
1461
+ "contacts/lists",
1462
+ method="POST",
1463
+ json={
1464
+ "folderId": folder_id,
1465
+ "name": name,
1466
+ },
1467
+ headers={
1468
+ "content-type": "application/json",
1469
+ },
1470
+ request_options=request_options,
1471
+ omit=OMIT,
1472
+ )
1473
+ try:
1474
+ if 200 <= _response.status_code < 300:
1475
+ _data = typing.cast(
1476
+ CreateListResponse,
1477
+ construct_type(
1478
+ type_=CreateListResponse, # type: ignore
1479
+ object_=_response.json(),
1480
+ ),
1481
+ )
1482
+ return HttpResponse(response=_response, data=_data)
1483
+ if _response.status_code == 400:
1484
+ raise BadRequestError(
1485
+ headers=dict(_response.headers),
1486
+ body=typing.cast(
1487
+ typing.Any,
1488
+ construct_type(
1489
+ type_=typing.Any, # type: ignore
1490
+ object_=_response.json(),
1491
+ ),
1492
+ ),
1493
+ )
1494
+ _response_json = _response.json()
1495
+ except JSONDecodeError:
1496
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1497
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1498
+
1499
+ def get_list(
1500
+ self,
1501
+ list_id: int,
1502
+ *,
1503
+ start_date: typing.Optional[str] = None,
1504
+ end_date: typing.Optional[str] = None,
1505
+ request_options: typing.Optional[RequestOptions] = None,
1506
+ ) -> HttpResponse[GetListResponse]:
1507
+ """
1508
+ Parameters
1509
+ ----------
1510
+ list_id : int
1511
+ Id of the list
1512
+
1513
+ start_date : typing.Optional[str]
1514
+ **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result**
1515
+
1516
+ end_date : typing.Optional[str]
1517
+ **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result**
1518
+
1519
+ request_options : typing.Optional[RequestOptions]
1520
+ Request-specific configuration.
1521
+
1522
+ Returns
1523
+ -------
1524
+ HttpResponse[GetListResponse]
1525
+ List informations
1526
+ """
1527
+ _response = self._client_wrapper.httpx_client.request(
1528
+ f"contacts/lists/{jsonable_encoder(list_id)}",
1529
+ method="GET",
1530
+ params={
1531
+ "startDate": start_date,
1532
+ "endDate": end_date,
1533
+ },
1534
+ request_options=request_options,
1535
+ )
1536
+ try:
1537
+ if 200 <= _response.status_code < 300:
1538
+ _data = typing.cast(
1539
+ GetListResponse,
1540
+ construct_type(
1541
+ type_=GetListResponse, # type: ignore
1542
+ object_=_response.json(),
1543
+ ),
1544
+ )
1545
+ return HttpResponse(response=_response, data=_data)
1546
+ if _response.status_code == 400:
1547
+ raise BadRequestError(
1548
+ headers=dict(_response.headers),
1549
+ body=typing.cast(
1550
+ typing.Any,
1551
+ construct_type(
1552
+ type_=typing.Any, # type: ignore
1553
+ object_=_response.json(),
1554
+ ),
1555
+ ),
1556
+ )
1557
+ if _response.status_code == 404:
1558
+ raise NotFoundError(
1559
+ headers=dict(_response.headers),
1560
+ body=typing.cast(
1561
+ typing.Any,
1562
+ construct_type(
1563
+ type_=typing.Any, # type: ignore
1564
+ object_=_response.json(),
1565
+ ),
1566
+ ),
1567
+ )
1568
+ _response_json = _response.json()
1569
+ except JSONDecodeError:
1570
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1571
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1572
+
1573
+ def update_list(
1574
+ self,
1575
+ list_id: int,
1576
+ *,
1577
+ folder_id: typing.Optional[int] = OMIT,
1578
+ name: typing.Optional[str] = OMIT,
1579
+ request_options: typing.Optional[RequestOptions] = None,
1580
+ ) -> HttpResponse[None]:
1581
+ """
1582
+ Parameters
1583
+ ----------
1584
+ list_id : int
1585
+ Id of the list
1586
+
1587
+ folder_id : typing.Optional[int]
1588
+ Id of the folder in which the list is to be moved. Either of the two parameters (name, folderId) can be updated at a time.
1589
+
1590
+ name : typing.Optional[str]
1591
+ Name of the list. Either of the two parameters (name, folderId) can be updated at a time.
1592
+
1593
+ request_options : typing.Optional[RequestOptions]
1594
+ Request-specific configuration.
1595
+
1596
+ Returns
1597
+ -------
1598
+ HttpResponse[None]
1599
+ """
1600
+ _response = self._client_wrapper.httpx_client.request(
1601
+ f"contacts/lists/{jsonable_encoder(list_id)}",
1602
+ method="PUT",
1603
+ json={
1604
+ "folderId": folder_id,
1605
+ "name": name,
1606
+ },
1607
+ headers={
1608
+ "content-type": "application/json",
1609
+ },
1610
+ request_options=request_options,
1611
+ omit=OMIT,
1612
+ )
1613
+ try:
1614
+ if 200 <= _response.status_code < 300:
1615
+ return HttpResponse(response=_response, data=None)
1616
+ if _response.status_code == 400:
1617
+ raise BadRequestError(
1618
+ headers=dict(_response.headers),
1619
+ body=typing.cast(
1620
+ typing.Any,
1621
+ construct_type(
1622
+ type_=typing.Any, # type: ignore
1623
+ object_=_response.json(),
1624
+ ),
1625
+ ),
1626
+ )
1627
+ if _response.status_code == 404:
1628
+ raise NotFoundError(
1629
+ headers=dict(_response.headers),
1630
+ body=typing.cast(
1631
+ typing.Any,
1632
+ construct_type(
1633
+ type_=typing.Any, # type: ignore
1634
+ object_=_response.json(),
1635
+ ),
1636
+ ),
1637
+ )
1638
+ _response_json = _response.json()
1639
+ except JSONDecodeError:
1640
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1641
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1642
+
1643
+ def delete_list(
1644
+ self, list_id: int, *, request_options: typing.Optional[RequestOptions] = None
1645
+ ) -> HttpResponse[None]:
1646
+ """
1647
+ Parameters
1648
+ ----------
1649
+ list_id : int
1650
+ Id of the list
1651
+
1652
+ request_options : typing.Optional[RequestOptions]
1653
+ Request-specific configuration.
1654
+
1655
+ Returns
1656
+ -------
1657
+ HttpResponse[None]
1658
+ """
1659
+ _response = self._client_wrapper.httpx_client.request(
1660
+ f"contacts/lists/{jsonable_encoder(list_id)}",
1661
+ method="DELETE",
1662
+ request_options=request_options,
1663
+ )
1664
+ try:
1665
+ if 200 <= _response.status_code < 300:
1666
+ return HttpResponse(response=_response, data=None)
1667
+ if _response.status_code == 400:
1668
+ raise BadRequestError(
1669
+ headers=dict(_response.headers),
1670
+ body=typing.cast(
1671
+ typing.Any,
1672
+ construct_type(
1673
+ type_=typing.Any, # type: ignore
1674
+ object_=_response.json(),
1675
+ ),
1676
+ ),
1677
+ )
1678
+ if _response.status_code == 404:
1679
+ raise NotFoundError(
1680
+ headers=dict(_response.headers),
1681
+ body=typing.cast(
1682
+ typing.Any,
1683
+ construct_type(
1684
+ type_=typing.Any, # type: ignore
1685
+ object_=_response.json(),
1686
+ ),
1687
+ ),
1688
+ )
1689
+ _response_json = _response.json()
1690
+ except JSONDecodeError:
1691
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1692
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1693
+
1694
+ def get_contacts_from_list(
1695
+ self,
1696
+ list_id: int,
1697
+ *,
1698
+ modified_since: typing.Optional[str] = None,
1699
+ limit: typing.Optional[int] = None,
1700
+ offset: typing.Optional[int] = None,
1701
+ sort: typing.Optional[GetContactsFromListRequestSort] = None,
1702
+ request_options: typing.Optional[RequestOptions] = None,
1703
+ ) -> HttpResponse[GetContacts]:
1704
+ """
1705
+ Parameters
1706
+ ----------
1707
+ list_id : int
1708
+ Id of the list
1709
+
1710
+ modified_since : typing.Optional[str]
1711
+ Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.**
1712
+
1713
+ limit : typing.Optional[int]
1714
+ Number of documents per page
1715
+
1716
+ offset : typing.Optional[int]
1717
+ Index of the first document of the page
1718
+
1719
+ sort : typing.Optional[GetContactsFromListRequestSort]
1720
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
1721
+
1722
+ request_options : typing.Optional[RequestOptions]
1723
+ Request-specific configuration.
1724
+
1725
+ Returns
1726
+ -------
1727
+ HttpResponse[GetContacts]
1728
+ Contact informations
1729
+ """
1730
+ _response = self._client_wrapper.httpx_client.request(
1731
+ f"contacts/lists/{jsonable_encoder(list_id)}/contacts",
1732
+ method="GET",
1733
+ params={
1734
+ "modifiedSince": modified_since,
1735
+ "limit": limit,
1736
+ "offset": offset,
1737
+ "sort": sort,
1738
+ },
1739
+ request_options=request_options,
1740
+ )
1741
+ try:
1742
+ if 200 <= _response.status_code < 300:
1743
+ _data = typing.cast(
1744
+ GetContacts,
1745
+ construct_type(
1746
+ type_=GetContacts, # type: ignore
1747
+ object_=_response.json(),
1748
+ ),
1749
+ )
1750
+ return HttpResponse(response=_response, data=_data)
1751
+ if _response.status_code == 400:
1752
+ raise BadRequestError(
1753
+ headers=dict(_response.headers),
1754
+ body=typing.cast(
1755
+ typing.Any,
1756
+ construct_type(
1757
+ type_=typing.Any, # type: ignore
1758
+ object_=_response.json(),
1759
+ ),
1760
+ ),
1761
+ )
1762
+ if _response.status_code == 404:
1763
+ raise NotFoundError(
1764
+ headers=dict(_response.headers),
1765
+ body=typing.cast(
1766
+ typing.Any,
1767
+ construct_type(
1768
+ type_=typing.Any, # type: ignore
1769
+ object_=_response.json(),
1770
+ ),
1771
+ ),
1772
+ )
1773
+ _response_json = _response.json()
1774
+ except JSONDecodeError:
1775
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1776
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1777
+
1778
+ def add_contact_to_list(
1779
+ self,
1780
+ list_id: int,
1781
+ *,
1782
+ request: AddContactToListRequestBody,
1783
+ request_options: typing.Optional[RequestOptions] = None,
1784
+ ) -> HttpResponse[PostContactInfo]:
1785
+ """
1786
+ Parameters
1787
+ ----------
1788
+ list_id : int
1789
+ Id of the list
1790
+
1791
+ request : AddContactToListRequestBody
1792
+
1793
+ request_options : typing.Optional[RequestOptions]
1794
+ Request-specific configuration.
1795
+
1796
+ Returns
1797
+ -------
1798
+ HttpResponse[PostContactInfo]
1799
+ All contacts have been added successfully to the list with details of failed ones
1800
+ """
1801
+ _response = self._client_wrapper.httpx_client.request(
1802
+ f"contacts/lists/{jsonable_encoder(list_id)}/contacts/add",
1803
+ method="POST",
1804
+ json=convert_and_respect_annotation_metadata(
1805
+ object_=request, annotation=AddContactToListRequestBody, direction="write"
1806
+ ),
1807
+ headers={
1808
+ "content-type": "application/json",
1809
+ },
1810
+ request_options=request_options,
1811
+ omit=OMIT,
1812
+ )
1813
+ try:
1814
+ if 200 <= _response.status_code < 300:
1815
+ _data = typing.cast(
1816
+ PostContactInfo,
1817
+ construct_type(
1818
+ type_=PostContactInfo, # type: ignore
1819
+ object_=_response.json(),
1820
+ ),
1821
+ )
1822
+ return HttpResponse(response=_response, data=_data)
1823
+ if _response.status_code == 400:
1824
+ raise BadRequestError(
1825
+ headers=dict(_response.headers),
1826
+ body=typing.cast(
1827
+ typing.Any,
1828
+ construct_type(
1829
+ type_=typing.Any, # type: ignore
1830
+ object_=_response.json(),
1831
+ ),
1832
+ ),
1833
+ )
1834
+ if _response.status_code == 404:
1835
+ raise NotFoundError(
1836
+ headers=dict(_response.headers),
1837
+ body=typing.cast(
1838
+ typing.Any,
1839
+ construct_type(
1840
+ type_=typing.Any, # type: ignore
1841
+ object_=_response.json(),
1842
+ ),
1843
+ ),
1844
+ )
1845
+ _response_json = _response.json()
1846
+ except JSONDecodeError:
1847
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1848
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1849
+
1850
+ def remove_contact_from_list(
1851
+ self,
1852
+ list_id: int,
1853
+ *,
1854
+ request: RemoveContactFromListRequestBody,
1855
+ request_options: typing.Optional[RequestOptions] = None,
1856
+ ) -> HttpResponse[PostContactInfo]:
1857
+ """
1858
+ Parameters
1859
+ ----------
1860
+ list_id : int
1861
+ Id of the list
1862
+
1863
+ request : RemoveContactFromListRequestBody
1864
+
1865
+ request_options : typing.Optional[RequestOptions]
1866
+ Request-specific configuration.
1867
+
1868
+ Returns
1869
+ -------
1870
+ HttpResponse[PostContactInfo]
1871
+ All contacts have been removed successfully from the list with details of failed ones
1872
+ """
1873
+ _response = self._client_wrapper.httpx_client.request(
1874
+ f"contacts/lists/{jsonable_encoder(list_id)}/contacts/remove",
1875
+ method="POST",
1876
+ json=convert_and_respect_annotation_metadata(
1877
+ object_=request, annotation=RemoveContactFromListRequestBody, direction="write"
1878
+ ),
1879
+ headers={
1880
+ "content-type": "application/json",
1881
+ },
1882
+ request_options=request_options,
1883
+ omit=OMIT,
1884
+ )
1885
+ try:
1886
+ if 200 <= _response.status_code < 300:
1887
+ _data = typing.cast(
1888
+ PostContactInfo,
1889
+ construct_type(
1890
+ type_=PostContactInfo, # type: ignore
1891
+ object_=_response.json(),
1892
+ ),
1893
+ )
1894
+ return HttpResponse(response=_response, data=_data)
1895
+ if _response.status_code == 400:
1896
+ raise BadRequestError(
1897
+ headers=dict(_response.headers),
1898
+ body=typing.cast(
1899
+ typing.Any,
1900
+ construct_type(
1901
+ type_=typing.Any, # type: ignore
1902
+ object_=_response.json(),
1903
+ ),
1904
+ ),
1905
+ )
1906
+ if _response.status_code == 404:
1907
+ raise NotFoundError(
1908
+ headers=dict(_response.headers),
1909
+ body=typing.cast(
1910
+ typing.Any,
1911
+ construct_type(
1912
+ type_=typing.Any, # type: ignore
1913
+ object_=_response.json(),
1914
+ ),
1915
+ ),
1916
+ )
1917
+ _response_json = _response.json()
1918
+ except JSONDecodeError:
1919
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1920
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1921
+
1922
+ def get_segments(
1923
+ self,
1924
+ *,
1925
+ limit: typing.Optional[int] = None,
1926
+ offset: typing.Optional[int] = None,
1927
+ sort: typing.Optional[GetSegmentsRequestSort] = None,
1928
+ request_options: typing.Optional[RequestOptions] = None,
1929
+ ) -> HttpResponse[GetSegmentsResponse]:
1930
+ """
1931
+ Parameters
1932
+ ----------
1933
+ limit : typing.Optional[int]
1934
+ Number of documents per page
1935
+
1936
+ offset : typing.Optional[int]
1937
+ Index of the first document of the page
1938
+
1939
+ sort : typing.Optional[GetSegmentsRequestSort]
1940
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
1941
+
1942
+ request_options : typing.Optional[RequestOptions]
1943
+ Request-specific configuration.
1944
+
1945
+ Returns
1946
+ -------
1947
+ HttpResponse[GetSegmentsResponse]
1948
+ Segments informations
1949
+ """
1950
+ _response = self._client_wrapper.httpx_client.request(
1951
+ "contacts/segments",
1952
+ method="GET",
1953
+ params={
1954
+ "limit": limit,
1955
+ "offset": offset,
1956
+ "sort": sort,
1957
+ },
1958
+ request_options=request_options,
1959
+ )
1960
+ try:
1961
+ if 200 <= _response.status_code < 300:
1962
+ _data = typing.cast(
1963
+ GetSegmentsResponse,
1964
+ construct_type(
1965
+ type_=GetSegmentsResponse, # type: ignore
1966
+ object_=_response.json(),
1967
+ ),
1968
+ )
1969
+ return HttpResponse(response=_response, data=_data)
1970
+ if _response.status_code == 400:
1971
+ raise BadRequestError(
1972
+ headers=dict(_response.headers),
1973
+ body=typing.cast(
1974
+ typing.Any,
1975
+ construct_type(
1976
+ type_=typing.Any, # type: ignore
1977
+ object_=_response.json(),
1978
+ ),
1979
+ ),
1980
+ )
1981
+ _response_json = _response.json()
1982
+ except JSONDecodeError:
1983
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1984
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1985
+
1986
+ def get_contact_info(
1987
+ self,
1988
+ identifier: GetContactInfoRequestIdentifier,
1989
+ *,
1990
+ identifier_type: typing.Optional[GetContactInfoRequestIdentifierType] = None,
1991
+ start_date: typing.Optional[str] = None,
1992
+ end_date: typing.Optional[str] = None,
1993
+ request_options: typing.Optional[RequestOptions] = None,
1994
+ ) -> HttpResponse[GetContactInfoResponse]:
1995
+ """
1996
+ <Note title="Follow this format when passing a SMS phone number as an attribute">
1997
+ Accepted Number Formats
1998
+
1999
+ 91xxxxxxxxxx
2000
+ +91xxxxxxxxxx
2001
+ 0091xxxxxxxxxx
2002
+ </Note>
2003
+
2004
+ There are 2 ways to get a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact. <br><br> Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute <br><br>Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges.
2005
+
2006
+ Parameters
2007
+ ----------
2008
+ identifier : GetContactInfoRequestIdentifier
2009
+ Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded)
2010
+
2011
+ identifier_type : typing.Optional[GetContactInfoRequestIdentifierType]
2012
+ email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
2013
+
2014
+ start_date : typing.Optional[str]
2015
+ **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
2016
+
2017
+ end_date : typing.Optional[str]
2018
+ **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.
2019
+
2020
+ request_options : typing.Optional[RequestOptions]
2021
+ Request-specific configuration.
2022
+
2023
+ Returns
2024
+ -------
2025
+ HttpResponse[GetContactInfoResponse]
2026
+ Contact informations
2027
+ """
2028
+ _response = self._client_wrapper.httpx_client.request(
2029
+ f"contacts/{jsonable_encoder(identifier)}",
2030
+ method="GET",
2031
+ params={
2032
+ "identifierType": identifier_type,
2033
+ "startDate": start_date,
2034
+ "endDate": end_date,
2035
+ },
2036
+ request_options=request_options,
2037
+ )
2038
+ try:
2039
+ if 200 <= _response.status_code < 300:
2040
+ _data = typing.cast(
2041
+ GetContactInfoResponse,
2042
+ construct_type(
2043
+ type_=GetContactInfoResponse, # type: ignore
2044
+ object_=_response.json(),
2045
+ ),
2046
+ )
2047
+ return HttpResponse(response=_response, data=_data)
2048
+ if _response.status_code == 400:
2049
+ raise BadRequestError(
2050
+ headers=dict(_response.headers),
2051
+ body=typing.cast(
2052
+ typing.Any,
2053
+ construct_type(
2054
+ type_=typing.Any, # type: ignore
2055
+ object_=_response.json(),
2056
+ ),
2057
+ ),
2058
+ )
2059
+ if _response.status_code == 404:
2060
+ raise NotFoundError(
2061
+ headers=dict(_response.headers),
2062
+ body=typing.cast(
2063
+ typing.Any,
2064
+ construct_type(
2065
+ type_=typing.Any, # type: ignore
2066
+ object_=_response.json(),
2067
+ ),
2068
+ ),
2069
+ )
2070
+ _response_json = _response.json()
2071
+ except JSONDecodeError:
2072
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2073
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2074
+
2075
+ def update_contact(
2076
+ self,
2077
+ identifier: UpdateContactRequestIdentifier,
2078
+ *,
2079
+ identifier_type: typing.Optional[UpdateContactRequestIdentifierType] = None,
2080
+ attributes: typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]] = OMIT,
2081
+ email_blacklisted: typing.Optional[bool] = OMIT,
2082
+ ext_id: typing.Optional[str] = OMIT,
2083
+ list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
2084
+ sms_blacklisted: typing.Optional[bool] = OMIT,
2085
+ smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
2086
+ unlink_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
2087
+ request_options: typing.Optional[RequestOptions] = None,
2088
+ ) -> HttpResponse[None]:
2089
+ """
2090
+ There are 2 ways to update a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact. <br><br> Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
2091
+
2092
+ Parameters
2093
+ ----------
2094
+ identifier : UpdateContactRequestIdentifier
2095
+ Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value
2096
+
2097
+ identifier_type : typing.Optional[UpdateContactRequestIdentifierType]
2098
+ email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
2099
+
2100
+ attributes : typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]]
2101
+ Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger", "COUNTRIES":["India","China"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored .Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}**
2102
+
2103
+ email_blacklisted : typing.Optional[bool]
2104
+ Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true)
2105
+
2106
+ ext_id : typing.Optional[str]
2107
+ Pass your own Id to update ext_id of a contact.
2108
+
2109
+ list_ids : typing.Optional[typing.Sequence[int]]
2110
+ Ids of the lists to add the contact to
2111
+
2112
+ sms_blacklisted : typing.Optional[bool]
2113
+ Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true)
2114
+
2115
+ smtp_blacklist_sender : typing.Optional[typing.Sequence[str]]
2116
+ transactional email forbidden sender for contact. Use only for email Contact
2117
+
2118
+ unlink_list_ids : typing.Optional[typing.Sequence[int]]
2119
+ Ids of the lists to remove the contact from
2120
+
2121
+ request_options : typing.Optional[RequestOptions]
2122
+ Request-specific configuration.
2123
+
2124
+ Returns
2125
+ -------
2126
+ HttpResponse[None]
2127
+ """
2128
+ _response = self._client_wrapper.httpx_client.request(
2129
+ f"contacts/{jsonable_encoder(identifier)}",
2130
+ method="PUT",
2131
+ params={
2132
+ "identifierType": identifier_type,
2133
+ },
2134
+ json={
2135
+ "attributes": convert_and_respect_annotation_metadata(
2136
+ object_=attributes,
2137
+ annotation=typing.Dict[str, UpdateContactRequestAttributesValue],
2138
+ direction="write",
2139
+ ),
2140
+ "emailBlacklisted": email_blacklisted,
2141
+ "ext_id": ext_id,
2142
+ "listIds": list_ids,
2143
+ "smsBlacklisted": sms_blacklisted,
2144
+ "smtpBlacklistSender": smtp_blacklist_sender,
2145
+ "unlinkListIds": unlink_list_ids,
2146
+ },
2147
+ headers={
2148
+ "content-type": "application/json",
2149
+ },
2150
+ request_options=request_options,
2151
+ omit=OMIT,
2152
+ )
2153
+ try:
2154
+ if 200 <= _response.status_code < 300:
2155
+ return HttpResponse(response=_response, data=None)
2156
+ if _response.status_code == 400:
2157
+ raise BadRequestError(
2158
+ headers=dict(_response.headers),
2159
+ body=typing.cast(
2160
+ typing.Any,
2161
+ construct_type(
2162
+ type_=typing.Any, # type: ignore
2163
+ object_=_response.json(),
2164
+ ),
2165
+ ),
2166
+ )
2167
+ if _response.status_code == 404:
2168
+ raise NotFoundError(
2169
+ headers=dict(_response.headers),
2170
+ body=typing.cast(
2171
+ typing.Any,
2172
+ construct_type(
2173
+ type_=typing.Any, # type: ignore
2174
+ object_=_response.json(),
2175
+ ),
2176
+ ),
2177
+ )
2178
+ if _response.status_code == 425:
2179
+ raise TooEarlyError(
2180
+ headers=dict(_response.headers),
2181
+ body=typing.cast(
2182
+ ContactErrorModel,
2183
+ construct_type(
2184
+ type_=ContactErrorModel, # type: ignore
2185
+ object_=_response.json(),
2186
+ ),
2187
+ ),
2188
+ )
2189
+ _response_json = _response.json()
2190
+ except JSONDecodeError:
2191
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2192
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2193
+
2194
+ def delete_contact(
2195
+ self,
2196
+ identifier: DeleteContactRequestIdentifier,
2197
+ *,
2198
+ identifier_type: typing.Optional[DeleteContactRequestIdentifierType] = None,
2199
+ request_options: typing.Optional[RequestOptions] = None,
2200
+ ) -> HttpResponse[None]:
2201
+ """
2202
+ There are 2 ways to delete a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact. <br><br> Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute.
2203
+
2204
+ Parameters
2205
+ ----------
2206
+ identifier : DeleteContactRequestIdentifier
2207
+ Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded)
2208
+
2209
+ identifier_type : typing.Optional[DeleteContactRequestIdentifierType]
2210
+ email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
2211
+
2212
+ request_options : typing.Optional[RequestOptions]
2213
+ Request-specific configuration.
2214
+
2215
+ Returns
2216
+ -------
2217
+ HttpResponse[None]
2218
+ """
2219
+ _response = self._client_wrapper.httpx_client.request(
2220
+ f"contacts/{jsonable_encoder(identifier)}",
2221
+ method="DELETE",
2222
+ params={
2223
+ "identifierType": identifier_type,
2224
+ },
2225
+ request_options=request_options,
2226
+ )
2227
+ try:
2228
+ if 200 <= _response.status_code < 300:
2229
+ return HttpResponse(response=_response, data=None)
2230
+ if _response.status_code == 400:
2231
+ raise BadRequestError(
2232
+ headers=dict(_response.headers),
2233
+ body=typing.cast(
2234
+ typing.Any,
2235
+ construct_type(
2236
+ type_=typing.Any, # type: ignore
2237
+ object_=_response.json(),
2238
+ ),
2239
+ ),
2240
+ )
2241
+ if _response.status_code == 404:
2242
+ raise NotFoundError(
2243
+ headers=dict(_response.headers),
2244
+ body=typing.cast(
2245
+ typing.Any,
2246
+ construct_type(
2247
+ type_=typing.Any, # type: ignore
2248
+ object_=_response.json(),
2249
+ ),
2250
+ ),
2251
+ )
2252
+ if _response.status_code == 405:
2253
+ raise MethodNotAllowedError(
2254
+ headers=dict(_response.headers),
2255
+ body=typing.cast(
2256
+ ErrorModel,
2257
+ construct_type(
2258
+ type_=ErrorModel, # type: ignore
2259
+ object_=_response.json(),
2260
+ ),
2261
+ ),
2262
+ )
2263
+ _response_json = _response.json()
2264
+ except JSONDecodeError:
2265
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2266
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2267
+
2268
+ def get_contact_stats(
2269
+ self,
2270
+ identifier: GetContactStatsRequestIdentifier,
2271
+ *,
2272
+ start_date: typing.Optional[str] = None,
2273
+ end_date: typing.Optional[str] = None,
2274
+ request_options: typing.Optional[RequestOptions] = None,
2275
+ ) -> HttpResponse[GetContactStatsResponse]:
2276
+ """
2277
+ Parameters
2278
+ ----------
2279
+ identifier : GetContactStatsRequestIdentifier
2280
+ Email (urlencoded) OR ID of the contact
2281
+
2282
+ start_date : typing.Optional[str]
2283
+ **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
2284
+
2285
+ end_date : typing.Optional[str]
2286
+ **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days
2287
+
2288
+ request_options : typing.Optional[RequestOptions]
2289
+ Request-specific configuration.
2290
+
2291
+ Returns
2292
+ -------
2293
+ HttpResponse[GetContactStatsResponse]
2294
+ Contact campaign statistics informations
2295
+ """
2296
+ _response = self._client_wrapper.httpx_client.request(
2297
+ f"contacts/{jsonable_encoder(identifier)}/campaignStats",
2298
+ method="GET",
2299
+ params={
2300
+ "startDate": start_date,
2301
+ "endDate": end_date,
2302
+ },
2303
+ request_options=request_options,
2304
+ )
2305
+ try:
2306
+ if 200 <= _response.status_code < 300:
2307
+ _data = typing.cast(
2308
+ GetContactStatsResponse,
2309
+ construct_type(
2310
+ type_=GetContactStatsResponse, # type: ignore
2311
+ object_=_response.json(),
2312
+ ),
2313
+ )
2314
+ return HttpResponse(response=_response, data=_data)
2315
+ if _response.status_code == 400:
2316
+ raise BadRequestError(
2317
+ headers=dict(_response.headers),
2318
+ body=typing.cast(
2319
+ typing.Any,
2320
+ construct_type(
2321
+ type_=typing.Any, # type: ignore
2322
+ object_=_response.json(),
2323
+ ),
2324
+ ),
2325
+ )
2326
+ if _response.status_code == 404:
2327
+ raise NotFoundError(
2328
+ headers=dict(_response.headers),
2329
+ body=typing.cast(
2330
+ typing.Any,
2331
+ construct_type(
2332
+ type_=typing.Any, # type: ignore
2333
+ object_=_response.json(),
2334
+ ),
2335
+ ),
2336
+ )
2337
+ _response_json = _response.json()
2338
+ except JSONDecodeError:
2339
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2340
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2341
+
2342
+
2343
+ class AsyncRawContactsClient:
2344
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
2345
+ self._client_wrapper = client_wrapper
2346
+
2347
+ async def get_contacts(
2348
+ self,
2349
+ *,
2350
+ limit: typing.Optional[int] = None,
2351
+ offset: typing.Optional[int] = None,
2352
+ modified_since: typing.Optional[str] = None,
2353
+ created_since: typing.Optional[str] = None,
2354
+ sort: typing.Optional[GetContactsRequestSort] = None,
2355
+ segment_id: typing.Optional[int] = None,
2356
+ list_ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
2357
+ filter: typing.Optional[str] = None,
2358
+ request_options: typing.Optional[RequestOptions] = None,
2359
+ ) -> AsyncHttpResponse[GetContacts]:
2360
+ """
2361
+ <Note title="Follow this format when passing a SMS phone number as an attribute">
2362
+ Accepted Number Formats
2363
+
2364
+ 91xxxxxxxxxx
2365
+ +91xxxxxxxxxx
2366
+ 0091xxxxxxxxxx
2367
+ </Note>
2368
+
2369
+ Parameters
2370
+ ----------
2371
+ limit : typing.Optional[int]
2372
+ Number of documents per page
2373
+
2374
+ offset : typing.Optional[int]
2375
+ Index of the first document of the page
2376
+
2377
+ modified_since : typing.Optional[str]
2378
+ Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.**
2379
+
2380
+ created_since : typing.Optional[str]
2381
+ Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.**
2382
+
2383
+ sort : typing.Optional[GetContactsRequestSort]
2384
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
2385
+
2386
+ segment_id : typing.Optional[int]
2387
+ Id of the segment. **Either listIds or segmentId can be passed.**
2388
+
2389
+ list_ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
2390
+ Ids of the list. **Either listIds or segmentId can be passed.**
2391
+
2392
+ filter : typing.Optional[str]
2393
+ Filter the contacts on the basis of attributes. **Allowed operator: equals. For multiple-choice options, the filter will apply an AND condition between the options. For category attributes, the filter will work with both id and value. (e.g. filter=equals(FIRSTNAME,"Antoine"), filter=equals(B1, true), filter=equals(DOB, "1989-11-23"), filter=equals(GENDER, "1"), filter=equals(GENDER, "MALE"), filter=equals(COUNTRY,"USA, INDIA")**
2394
+
2395
+ request_options : typing.Optional[RequestOptions]
2396
+ Request-specific configuration.
2397
+
2398
+ Returns
2399
+ -------
2400
+ AsyncHttpResponse[GetContacts]
2401
+ All contacts listed
2402
+ """
2403
+ _response = await self._client_wrapper.httpx_client.request(
2404
+ "contacts",
2405
+ method="GET",
2406
+ params={
2407
+ "limit": limit,
2408
+ "offset": offset,
2409
+ "modifiedSince": modified_since,
2410
+ "createdSince": created_since,
2411
+ "sort": sort,
2412
+ "segmentId": segment_id,
2413
+ "listIds": list_ids,
2414
+ "filter": filter,
2415
+ },
2416
+ request_options=request_options,
2417
+ )
2418
+ try:
2419
+ if 200 <= _response.status_code < 300:
2420
+ _data = typing.cast(
2421
+ GetContacts,
2422
+ construct_type(
2423
+ type_=GetContacts, # type: ignore
2424
+ object_=_response.json(),
2425
+ ),
2426
+ )
2427
+ return AsyncHttpResponse(response=_response, data=_data)
2428
+ if _response.status_code == 400:
2429
+ raise BadRequestError(
2430
+ headers=dict(_response.headers),
2431
+ body=typing.cast(
2432
+ typing.Any,
2433
+ construct_type(
2434
+ type_=typing.Any, # type: ignore
2435
+ object_=_response.json(),
2436
+ ),
2437
+ ),
2438
+ )
2439
+ if _response.status_code == 429:
2440
+ raise TooManyRequestsError(
2441
+ headers=dict(_response.headers),
2442
+ body=typing.cast(
2443
+ ErrorModel,
2444
+ construct_type(
2445
+ type_=ErrorModel, # type: ignore
2446
+ object_=_response.json(),
2447
+ ),
2448
+ ),
2449
+ )
2450
+ _response_json = _response.json()
2451
+ except JSONDecodeError:
2452
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2453
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2454
+
2455
+ async def create_contact(
2456
+ self,
2457
+ *,
2458
+ attributes: typing.Optional[typing.Dict[str, CreateContactRequestAttributesValue]] = OMIT,
2459
+ email: typing.Optional[str] = OMIT,
2460
+ email_blacklisted: typing.Optional[bool] = OMIT,
2461
+ ext_id: typing.Optional[str] = OMIT,
2462
+ list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
2463
+ sms_blacklisted: typing.Optional[bool] = OMIT,
2464
+ smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
2465
+ update_enabled: typing.Optional[bool] = OMIT,
2466
+ request_options: typing.Optional[RequestOptions] = None,
2467
+ ) -> AsyncHttpResponse[CreateContactResponse]:
2468
+ """
2469
+ Creates new contacts on Brevo. Contacts can be created by passing either - <br><br> 1. email address of the contact (email_id), <br> 2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"} <br> 3. ext_id <br>
2470
+
2471
+ Parameters
2472
+ ----------
2473
+ attributes : typing.Optional[typing.Dict[str, CreateContactRequestAttributesValue]]
2474
+ Pass the set of attributes and their values. The attribute's parameter should be passed in capital letter while creating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored. **These attributes must be present in your Brevo account**. For eg: **{"FNAME":"Elly", "LNAME":"Roger", "COUNTRIES": ["India","China"]}**
2475
+
2476
+ email : typing.Optional[str]
2477
+ Email address of the user. **Mandatory if "ext_id" & "SMS" field is not passed.**
2478
+
2479
+ email_blacklisted : typing.Optional[bool]
2480
+ Set this field to blacklist the contact for emails (emailBlacklisted = true)
2481
+
2482
+ ext_id : typing.Optional[str]
2483
+ Pass your own Id to create a contact.
2484
+
2485
+ list_ids : typing.Optional[typing.Sequence[int]]
2486
+ Ids of the lists to add the contact to
2487
+
2488
+ sms_blacklisted : typing.Optional[bool]
2489
+ Set this field to blacklist the contact for SMS (smsBlacklisted = true)
2490
+
2491
+ smtp_blacklist_sender : typing.Optional[typing.Sequence[str]]
2492
+ transactional email forbidden sender for contact. Use only for email Contact ( only available if updateEnabled = true )
2493
+
2494
+ update_enabled : typing.Optional[bool]
2495
+ Facilitate to update the existing contact in the same request (updateEnabled = true)
2496
+
2497
+ request_options : typing.Optional[RequestOptions]
2498
+ Request-specific configuration.
2499
+
2500
+ Returns
2501
+ -------
2502
+ AsyncHttpResponse[CreateContactResponse]
2503
+ Contact created
2504
+ """
2505
+ _response = await self._client_wrapper.httpx_client.request(
2506
+ "contacts",
2507
+ method="POST",
2508
+ json={
2509
+ "attributes": convert_and_respect_annotation_metadata(
2510
+ object_=attributes,
2511
+ annotation=typing.Dict[str, CreateContactRequestAttributesValue],
2512
+ direction="write",
2513
+ ),
2514
+ "email": email,
2515
+ "emailBlacklisted": email_blacklisted,
2516
+ "ext_id": ext_id,
2517
+ "listIds": list_ids,
2518
+ "smsBlacklisted": sms_blacklisted,
2519
+ "smtpBlacklistSender": smtp_blacklist_sender,
2520
+ "updateEnabled": update_enabled,
2521
+ },
2522
+ headers={
2523
+ "content-type": "application/json",
2524
+ },
2525
+ request_options=request_options,
2526
+ omit=OMIT,
2527
+ )
2528
+ try:
2529
+ if 200 <= _response.status_code < 300:
2530
+ _data = typing.cast(
2531
+ CreateContactResponse,
2532
+ construct_type(
2533
+ type_=CreateContactResponse, # type: ignore
2534
+ object_=_response.json(),
2535
+ ),
2536
+ )
2537
+ return AsyncHttpResponse(response=_response, data=_data)
2538
+ if _response.status_code == 400:
2539
+ raise BadRequestError(
2540
+ headers=dict(_response.headers),
2541
+ body=typing.cast(
2542
+ typing.Any,
2543
+ construct_type(
2544
+ type_=typing.Any, # type: ignore
2545
+ object_=_response.json(),
2546
+ ),
2547
+ ),
2548
+ )
2549
+ if _response.status_code == 425:
2550
+ raise TooEarlyError(
2551
+ headers=dict(_response.headers),
2552
+ body=typing.cast(
2553
+ ContactErrorModel,
2554
+ construct_type(
2555
+ type_=ContactErrorModel, # type: ignore
2556
+ object_=_response.json(),
2557
+ ),
2558
+ ),
2559
+ )
2560
+ _response_json = _response.json()
2561
+ except JSONDecodeError:
2562
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2563
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2564
+
2565
+ async def get_attributes(
2566
+ self, *, request_options: typing.Optional[RequestOptions] = None
2567
+ ) -> AsyncHttpResponse[GetAttributesResponse]:
2568
+ """
2569
+ Parameters
2570
+ ----------
2571
+ request_options : typing.Optional[RequestOptions]
2572
+ Request-specific configuration.
2573
+
2574
+ Returns
2575
+ -------
2576
+ AsyncHttpResponse[GetAttributesResponse]
2577
+ Attributes listed
2578
+ """
2579
+ _response = await self._client_wrapper.httpx_client.request(
2580
+ "contacts/attributes",
2581
+ method="GET",
2582
+ request_options=request_options,
2583
+ )
2584
+ try:
2585
+ if 200 <= _response.status_code < 300:
2586
+ _data = typing.cast(
2587
+ GetAttributesResponse,
2588
+ construct_type(
2589
+ type_=GetAttributesResponse, # type: ignore
2590
+ object_=_response.json(),
2591
+ ),
2592
+ )
2593
+ return AsyncHttpResponse(response=_response, data=_data)
2594
+ _response_json = _response.json()
2595
+ except JSONDecodeError:
2596
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2597
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2598
+
2599
+ async def create_attribute(
2600
+ self,
2601
+ attribute_category: CreateAttributeRequestAttributeCategory,
2602
+ attribute_name: str,
2603
+ *,
2604
+ enumeration: typing.Optional[typing.Sequence[CreateAttributeRequestEnumerationItem]] = OMIT,
2605
+ is_recurring: typing.Optional[bool] = OMIT,
2606
+ multi_category_options: typing.Optional[typing.Sequence[str]] = OMIT,
2607
+ type: typing.Optional[CreateAttributeRequestType] = OMIT,
2608
+ value: typing.Optional[str] = OMIT,
2609
+ request_options: typing.Optional[RequestOptions] = None,
2610
+ ) -> AsyncHttpResponse[None]:
2611
+ """
2612
+ Parameters
2613
+ ----------
2614
+ attribute_category : CreateAttributeRequestAttributeCategory
2615
+ Category of the attribute
2616
+
2617
+ attribute_name : str
2618
+ Name of the attribute
2619
+
2620
+ enumeration : typing.Optional[typing.Sequence[CreateAttributeRequestEnumerationItem]]
2621
+ List of values and labels that the attribute can take. **Use only if the attribute's category is "category"**. None of the category options can exceed max 200 characters. For example: **[{"value":1, "label":"male"}, {"value":2, "label":"female"}]**
2622
+
2623
+ is_recurring : typing.Optional[bool]
2624
+ Type of the attribute. **Use only if the attribute's category is 'calculated' or 'global'**
2625
+
2626
+ multi_category_options : typing.Optional[typing.Sequence[str]]
2627
+ List of options you want to add for multiple-choice attribute. **Use only if the attribute's category is "normal" and attribute's type is "multiple-choice". None of the multicategory options can exceed max 200 characters.** For example: **["USA","INDIA"]**
2628
+
2629
+ type : typing.Optional[CreateAttributeRequestType]
2630
+ Type of the attribute. **Use only if the attribute's category is 'normal', 'category' or 'transactional'** Type **user and multiple-choice** is only available if the category is **normal** attribute Type **id** is only available if the category is **transactional** attribute Type **category** is only available if the category is **category** attribute
2631
+
2632
+ value : typing.Optional[str]
2633
+ Value of the attribute. **Use only if the attribute's category is 'calculated' or 'global'**
2634
+
2635
+ request_options : typing.Optional[RequestOptions]
2636
+ Request-specific configuration.
2637
+
2638
+ Returns
2639
+ -------
2640
+ AsyncHttpResponse[None]
2641
+ """
2642
+ _response = await self._client_wrapper.httpx_client.request(
2643
+ f"contacts/attributes/{jsonable_encoder(attribute_category)}/{jsonable_encoder(attribute_name)}",
2644
+ method="POST",
2645
+ json={
2646
+ "enumeration": convert_and_respect_annotation_metadata(
2647
+ object_=enumeration,
2648
+ annotation=typing.Sequence[CreateAttributeRequestEnumerationItem],
2649
+ direction="write",
2650
+ ),
2651
+ "isRecurring": is_recurring,
2652
+ "multiCategoryOptions": multi_category_options,
2653
+ "type": type,
2654
+ "value": value,
2655
+ },
2656
+ headers={
2657
+ "content-type": "application/json",
2658
+ },
2659
+ request_options=request_options,
2660
+ omit=OMIT,
2661
+ )
2662
+ try:
2663
+ if 200 <= _response.status_code < 300:
2664
+ return AsyncHttpResponse(response=_response, data=None)
2665
+ if _response.status_code == 400:
2666
+ raise BadRequestError(
2667
+ headers=dict(_response.headers),
2668
+ body=typing.cast(
2669
+ typing.Any,
2670
+ construct_type(
2671
+ type_=typing.Any, # type: ignore
2672
+ object_=_response.json(),
2673
+ ),
2674
+ ),
2675
+ )
2676
+ _response_json = _response.json()
2677
+ except JSONDecodeError:
2678
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2679
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2680
+
2681
+ async def update_attribute(
2682
+ self,
2683
+ attribute_category: UpdateAttributeRequestAttributeCategory,
2684
+ attribute_name: str,
2685
+ *,
2686
+ enumeration: typing.Optional[typing.Sequence[UpdateAttributeRequestEnumerationItem]] = OMIT,
2687
+ multi_category_options: typing.Optional[typing.Sequence[str]] = OMIT,
2688
+ value: typing.Optional[str] = OMIT,
2689
+ request_options: typing.Optional[RequestOptions] = None,
2690
+ ) -> AsyncHttpResponse[None]:
2691
+ """
2692
+ Parameters
2693
+ ----------
2694
+ attribute_category : UpdateAttributeRequestAttributeCategory
2695
+ Category of the attribute
2696
+
2697
+ attribute_name : str
2698
+ Name of the existing attribute
2699
+
2700
+ enumeration : typing.Optional[typing.Sequence[UpdateAttributeRequestEnumerationItem]]
2701
+ List of the values and labels that the attribute can take. **Use only if the attribute's category is "category"** None of the category options can exceed max 200 characters. For example, **[{"value":1, "label":"male"}, {"value":2, "label":"female"}]**
2702
+
2703
+ multi_category_options : typing.Optional[typing.Sequence[str]]
2704
+ Use this option to add multiple-choice attributes options only if the attribute's category is "normal". **This option is specifically designed for updating multiple-choice attributes. None of the multicategory options can exceed max 200 characters.**. For example: **["USA","INDIA"]**
2705
+
2706
+ value : typing.Optional[str]
2707
+ Value of the attribute to update. **Use only if the attribute's category is 'calculated' or 'global'**
2708
+
2709
+ request_options : typing.Optional[RequestOptions]
2710
+ Request-specific configuration.
2711
+
2712
+ Returns
2713
+ -------
2714
+ AsyncHttpResponse[None]
2715
+ """
2716
+ _response = await self._client_wrapper.httpx_client.request(
2717
+ f"contacts/attributes/{jsonable_encoder(attribute_category)}/{jsonable_encoder(attribute_name)}",
2718
+ method="PUT",
2719
+ json={
2720
+ "enumeration": convert_and_respect_annotation_metadata(
2721
+ object_=enumeration,
2722
+ annotation=typing.Sequence[UpdateAttributeRequestEnumerationItem],
2723
+ direction="write",
2724
+ ),
2725
+ "multiCategoryOptions": multi_category_options,
2726
+ "value": value,
2727
+ },
2728
+ headers={
2729
+ "content-type": "application/json",
2730
+ },
2731
+ request_options=request_options,
2732
+ omit=OMIT,
2733
+ )
2734
+ try:
2735
+ if 200 <= _response.status_code < 300:
2736
+ return AsyncHttpResponse(response=_response, data=None)
2737
+ if _response.status_code == 400:
2738
+ raise BadRequestError(
2739
+ headers=dict(_response.headers),
2740
+ body=typing.cast(
2741
+ typing.Any,
2742
+ construct_type(
2743
+ type_=typing.Any, # type: ignore
2744
+ object_=_response.json(),
2745
+ ),
2746
+ ),
2747
+ )
2748
+ if _response.status_code == 404:
2749
+ raise NotFoundError(
2750
+ headers=dict(_response.headers),
2751
+ body=typing.cast(
2752
+ typing.Any,
2753
+ construct_type(
2754
+ type_=typing.Any, # type: ignore
2755
+ object_=_response.json(),
2756
+ ),
2757
+ ),
2758
+ )
2759
+ _response_json = _response.json()
2760
+ except JSONDecodeError:
2761
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2762
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2763
+
2764
+ async def delete_attribute(
2765
+ self,
2766
+ attribute_category: DeleteAttributeRequestAttributeCategory,
2767
+ attribute_name: str,
2768
+ *,
2769
+ request_options: typing.Optional[RequestOptions] = None,
2770
+ ) -> AsyncHttpResponse[None]:
2771
+ """
2772
+ Parameters
2773
+ ----------
2774
+ attribute_category : DeleteAttributeRequestAttributeCategory
2775
+ Category of the attribute
2776
+
2777
+ attribute_name : str
2778
+ Name of the existing attribute
2779
+
2780
+ request_options : typing.Optional[RequestOptions]
2781
+ Request-specific configuration.
2782
+
2783
+ Returns
2784
+ -------
2785
+ AsyncHttpResponse[None]
2786
+ """
2787
+ _response = await self._client_wrapper.httpx_client.request(
2788
+ f"contacts/attributes/{jsonable_encoder(attribute_category)}/{jsonable_encoder(attribute_name)}",
2789
+ method="DELETE",
2790
+ request_options=request_options,
2791
+ )
2792
+ try:
2793
+ if 200 <= _response.status_code < 300:
2794
+ return AsyncHttpResponse(response=_response, data=None)
2795
+ if _response.status_code == 400:
2796
+ raise BadRequestError(
2797
+ headers=dict(_response.headers),
2798
+ body=typing.cast(
2799
+ typing.Any,
2800
+ construct_type(
2801
+ type_=typing.Any, # type: ignore
2802
+ object_=_response.json(),
2803
+ ),
2804
+ ),
2805
+ )
2806
+ if _response.status_code == 404:
2807
+ raise NotFoundError(
2808
+ headers=dict(_response.headers),
2809
+ body=typing.cast(
2810
+ typing.Any,
2811
+ construct_type(
2812
+ type_=typing.Any, # type: ignore
2813
+ object_=_response.json(),
2814
+ ),
2815
+ ),
2816
+ )
2817
+ _response_json = _response.json()
2818
+ except JSONDecodeError:
2819
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2820
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2821
+
2822
+ async def delete_multi_attribute_options(
2823
+ self,
2824
+ multiple_choice_attribute: str,
2825
+ multiple_choice_attribute_option: str,
2826
+ *,
2827
+ request_options: typing.Optional[RequestOptions] = None,
2828
+ ) -> AsyncHttpResponse[None]:
2829
+ """
2830
+ Parameters
2831
+ ----------
2832
+ multiple_choice_attribute : str
2833
+ Name of the existing multiple-choice attribute
2834
+
2835
+ multiple_choice_attribute_option : str
2836
+ Name of the existing multiple-choice attribute option that you want to delete
2837
+
2838
+ request_options : typing.Optional[RequestOptions]
2839
+ Request-specific configuration.
2840
+
2841
+ Returns
2842
+ -------
2843
+ AsyncHttpResponse[None]
2844
+ """
2845
+ _response = await self._client_wrapper.httpx_client.request(
2846
+ f"contacts/attributes/multiple-choice/{jsonable_encoder(multiple_choice_attribute)}/{jsonable_encoder(multiple_choice_attribute_option)}",
2847
+ method="DELETE",
2848
+ request_options=request_options,
2849
+ )
2850
+ try:
2851
+ if 200 <= _response.status_code < 300:
2852
+ return AsyncHttpResponse(response=_response, data=None)
2853
+ if _response.status_code == 400:
2854
+ raise BadRequestError(
2855
+ headers=dict(_response.headers),
2856
+ body=typing.cast(
2857
+ typing.Any,
2858
+ construct_type(
2859
+ type_=typing.Any, # type: ignore
2860
+ object_=_response.json(),
2861
+ ),
2862
+ ),
2863
+ )
2864
+ if _response.status_code == 404:
2865
+ raise NotFoundError(
2866
+ headers=dict(_response.headers),
2867
+ body=typing.cast(
2868
+ typing.Any,
2869
+ construct_type(
2870
+ type_=typing.Any, # type: ignore
2871
+ object_=_response.json(),
2872
+ ),
2873
+ ),
2874
+ )
2875
+ _response_json = _response.json()
2876
+ except JSONDecodeError:
2877
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2878
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2879
+
2880
+ async def update_batch_contacts(
2881
+ self,
2882
+ *,
2883
+ contacts: typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]] = OMIT,
2884
+ request_options: typing.Optional[RequestOptions] = None,
2885
+ ) -> AsyncHttpResponse[None]:
2886
+ """
2887
+ Parameters
2888
+ ----------
2889
+ contacts : typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]]
2890
+ List of contacts to be updated
2891
+
2892
+ request_options : typing.Optional[RequestOptions]
2893
+ Request-specific configuration.
2894
+
2895
+ Returns
2896
+ -------
2897
+ AsyncHttpResponse[None]
2898
+ """
2899
+ _response = await self._client_wrapper.httpx_client.request(
2900
+ "contacts/batch",
2901
+ method="POST",
2902
+ json={
2903
+ "contacts": convert_and_respect_annotation_metadata(
2904
+ object_=contacts,
2905
+ annotation=typing.Sequence[UpdateBatchContactsRequestContactsItem],
2906
+ direction="write",
2907
+ ),
2908
+ },
2909
+ headers={
2910
+ "content-type": "application/json",
2911
+ },
2912
+ request_options=request_options,
2913
+ omit=OMIT,
2914
+ )
2915
+ try:
2916
+ if 200 <= _response.status_code < 300:
2917
+ return AsyncHttpResponse(response=_response, data=None)
2918
+ if _response.status_code == 400:
2919
+ raise BadRequestError(
2920
+ headers=dict(_response.headers),
2921
+ body=typing.cast(
2922
+ typing.Any,
2923
+ construct_type(
2924
+ type_=typing.Any, # type: ignore
2925
+ object_=_response.json(),
2926
+ ),
2927
+ ),
2928
+ )
2929
+ _response_json = _response.json()
2930
+ except JSONDecodeError:
2931
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2932
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2933
+
2934
+ async def create_doi_contact(
2935
+ self,
2936
+ *,
2937
+ email: str,
2938
+ include_list_ids: typing.Sequence[int],
2939
+ redirection_url: str,
2940
+ template_id: int,
2941
+ attributes: typing.Optional[typing.Dict[str, CreateDoiContactRequestAttributesValue]] = OMIT,
2942
+ exclude_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
2943
+ request_options: typing.Optional[RequestOptions] = None,
2944
+ ) -> AsyncHttpResponse[None]:
2945
+ """
2946
+ <Note title="How to use attributes param?">
2947
+ attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
2948
+ </Note>
2949
+
2950
+ Parameters
2951
+ ----------
2952
+ email : str
2953
+ Email address where the confirmation email will be sent. This email address will be the identifier for all other contact attributes.
2954
+
2955
+ include_list_ids : typing.Sequence[int]
2956
+ Lists under user account where contact should be added
2957
+
2958
+ redirection_url : str
2959
+ URL of the web page that user will be redirected to after clicking on the double opt in URL. When editing your DOI template you can reference this URL by using the tag **{{ params.DOIurl }}**.
2960
+
2961
+ template_id : int
2962
+ Id of the Double opt-in (DOI) template
2963
+
2964
+ attributes : typing.Optional[typing.Dict[str, CreateDoiContactRequestAttributesValue]]
2965
+ Pass the set of attributes and their values. **These attributes must be present in your Brevo account**. For eg. **{'FNAME':'Elly', 'LNAME':'Roger', 'COUNTRIES': ['India','China']}**
2966
+
2967
+ exclude_list_ids : typing.Optional[typing.Sequence[int]]
2968
+ Lists under user account where contact should not be added
2969
+
2970
+ request_options : typing.Optional[RequestOptions]
2971
+ Request-specific configuration.
2972
+
2973
+ Returns
2974
+ -------
2975
+ AsyncHttpResponse[None]
2976
+ """
2977
+ _response = await self._client_wrapper.httpx_client.request(
2978
+ "contacts/doubleOptinConfirmation",
2979
+ method="POST",
2980
+ json={
2981
+ "attributes": convert_and_respect_annotation_metadata(
2982
+ object_=attributes,
2983
+ annotation=typing.Dict[str, CreateDoiContactRequestAttributesValue],
2984
+ direction="write",
2985
+ ),
2986
+ "email": email,
2987
+ "excludeListIds": exclude_list_ids,
2988
+ "includeListIds": include_list_ids,
2989
+ "redirectionUrl": redirection_url,
2990
+ "templateId": template_id,
2991
+ },
2992
+ headers={
2993
+ "content-type": "application/json",
2994
+ },
2995
+ request_options=request_options,
2996
+ omit=OMIT,
2997
+ )
2998
+ try:
2999
+ if 200 <= _response.status_code < 300:
3000
+ return AsyncHttpResponse(response=_response, data=None)
3001
+ if _response.status_code == 400:
3002
+ raise BadRequestError(
3003
+ headers=dict(_response.headers),
3004
+ body=typing.cast(
3005
+ typing.Any,
3006
+ construct_type(
3007
+ type_=typing.Any, # type: ignore
3008
+ object_=_response.json(),
3009
+ ),
3010
+ ),
3011
+ )
3012
+ _response_json = _response.json()
3013
+ except JSONDecodeError:
3014
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3015
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3016
+
3017
+ async def request_contact_export(
3018
+ self,
3019
+ *,
3020
+ custom_contact_filter: RequestContactExportRequestCustomContactFilter,
3021
+ disable_notification: typing.Optional[bool] = OMIT,
3022
+ export_attributes: typing.Optional[typing.Sequence[str]] = OMIT,
3023
+ export_mandatory_attributes: typing.Optional[bool] = OMIT,
3024
+ export_metadata: typing.Optional[typing.Sequence[str]] = OMIT,
3025
+ export_date_in_utc: typing.Optional[bool] = OMIT,
3026
+ export_subscription_status: typing.Optional[typing.Sequence[str]] = OMIT,
3027
+ notify_url: typing.Optional[str] = OMIT,
3028
+ request_options: typing.Optional[RequestOptions] = None,
3029
+ ) -> AsyncHttpResponse[RequestContactExportResponse]:
3030
+ """
3031
+ It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv.
3032
+
3033
+ Parameters
3034
+ ----------
3035
+ custom_contact_filter : RequestContactExportRequestCustomContactFilter
3036
+ Set the filter for the contacts to be exported.
3037
+
3038
+ disable_notification : typing.Optional[bool]
3039
+ To avoid generating the email notification upon contact export, pass **true**
3040
+
3041
+ export_attributes : typing.Optional[typing.Sequence[str]]
3042
+ List of all the attributes that you want to export. **These attributes must be present in your contact database. It is required if exportMandatoryAttributes is set false. ** For example: **['fname', 'lname', 'email']**
3043
+
3044
+ export_mandatory_attributes : typing.Optional[bool]
3045
+ To export mandatory attributes like EMAIL, ADDED_TIME, MODIFIED_TIME
3046
+
3047
+ export_metadata : typing.Optional[typing.Sequence[str]]
3048
+ Export metadata of contacts such as _listIds, ADDED_TIME, MODIFIED_TIME.
3049
+
3050
+ export_date_in_utc : typing.Optional[bool]
3051
+ Specifies whether the date fields createdAt, modifiedAt in the exported data should be returned in UTC format.
3052
+
3053
+ export_subscription_status : typing.Optional[typing.Sequence[str]]
3054
+ Export subscription status of contacts for email & sms marketting. Pass email_marketing to obtain the marketing email subscription status & sms_marketing to retrieve the marketing SMS status of the contact.
3055
+
3056
+ notify_url : typing.Optional[str]
3057
+ Webhook that will be called once the export process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479
3058
+
3059
+ request_options : typing.Optional[RequestOptions]
3060
+ Request-specific configuration.
3061
+
3062
+ Returns
3063
+ -------
3064
+ AsyncHttpResponse[RequestContactExportResponse]
3065
+ process id created
3066
+ """
3067
+ _response = await self._client_wrapper.httpx_client.request(
3068
+ "contacts/export",
3069
+ method="POST",
3070
+ json={
3071
+ "customContactFilter": convert_and_respect_annotation_metadata(
3072
+ object_=custom_contact_filter,
3073
+ annotation=RequestContactExportRequestCustomContactFilter,
3074
+ direction="write",
3075
+ ),
3076
+ "disableNotification": disable_notification,
3077
+ "exportAttributes": export_attributes,
3078
+ "exportMandatoryAttributes": export_mandatory_attributes,
3079
+ "exportMetadata": export_metadata,
3080
+ "exportDateInUTC": export_date_in_utc,
3081
+ "exportSubscriptionStatus": export_subscription_status,
3082
+ "notifyUrl": notify_url,
3083
+ },
3084
+ headers={
3085
+ "content-type": "application/json",
3086
+ },
3087
+ request_options=request_options,
3088
+ omit=OMIT,
3089
+ )
3090
+ try:
3091
+ if 200 <= _response.status_code < 300:
3092
+ _data = typing.cast(
3093
+ RequestContactExportResponse,
3094
+ construct_type(
3095
+ type_=RequestContactExportResponse, # type: ignore
3096
+ object_=_response.json(),
3097
+ ),
3098
+ )
3099
+ return AsyncHttpResponse(response=_response, data=_data)
3100
+ if _response.status_code == 400:
3101
+ raise BadRequestError(
3102
+ headers=dict(_response.headers),
3103
+ body=typing.cast(
3104
+ typing.Any,
3105
+ construct_type(
3106
+ type_=typing.Any, # type: ignore
3107
+ object_=_response.json(),
3108
+ ),
3109
+ ),
3110
+ )
3111
+ if _response.status_code == 429:
3112
+ raise TooManyRequestsError(
3113
+ headers=dict(_response.headers),
3114
+ body=typing.cast(
3115
+ ErrorModel,
3116
+ construct_type(
3117
+ type_=ErrorModel, # type: ignore
3118
+ object_=_response.json(),
3119
+ ),
3120
+ ),
3121
+ )
3122
+ _response_json = _response.json()
3123
+ except JSONDecodeError:
3124
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3125
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3126
+
3127
+ async def get_folders(
3128
+ self,
3129
+ *,
3130
+ limit: typing.Optional[int] = None,
3131
+ offset: typing.Optional[int] = None,
3132
+ sort: typing.Optional[GetFoldersRequestSort] = None,
3133
+ request_options: typing.Optional[RequestOptions] = None,
3134
+ ) -> AsyncHttpResponse[GetFoldersResponse]:
3135
+ """
3136
+ <Note>
3137
+ Ongoing changes for this endpoint
3138
+
3139
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
3140
+
3141
+ These are non breaking changes.
3142
+
3143
+ The default value for the attributes will be 0.
3144
+
3145
+ The uniqueSubscribers field is deprecated
3146
+ </Note>
3147
+
3148
+ Parameters
3149
+ ----------
3150
+ limit : typing.Optional[int]
3151
+ Number of documents per page
3152
+
3153
+ offset : typing.Optional[int]
3154
+ Index of the first document of the page
3155
+
3156
+ sort : typing.Optional[GetFoldersRequestSort]
3157
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
3158
+
3159
+ request_options : typing.Optional[RequestOptions]
3160
+ Request-specific configuration.
3161
+
3162
+ Returns
3163
+ -------
3164
+ AsyncHttpResponse[GetFoldersResponse]
3165
+ Folders informations
3166
+ """
3167
+ _response = await self._client_wrapper.httpx_client.request(
3168
+ "contacts/folders",
3169
+ method="GET",
3170
+ params={
3171
+ "limit": limit,
3172
+ "offset": offset,
3173
+ "sort": sort,
3174
+ },
3175
+ request_options=request_options,
3176
+ )
3177
+ try:
3178
+ if 200 <= _response.status_code < 300:
3179
+ _data = typing.cast(
3180
+ GetFoldersResponse,
3181
+ construct_type(
3182
+ type_=GetFoldersResponse, # type: ignore
3183
+ object_=_response.json(),
3184
+ ),
3185
+ )
3186
+ return AsyncHttpResponse(response=_response, data=_data)
3187
+ if _response.status_code == 400:
3188
+ raise BadRequestError(
3189
+ headers=dict(_response.headers),
3190
+ body=typing.cast(
3191
+ typing.Any,
3192
+ construct_type(
3193
+ type_=typing.Any, # type: ignore
3194
+ object_=_response.json(),
3195
+ ),
3196
+ ),
3197
+ )
3198
+ _response_json = _response.json()
3199
+ except JSONDecodeError:
3200
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3201
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3202
+
3203
+ async def create_folder(
3204
+ self, *, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
3205
+ ) -> AsyncHttpResponse[CreateFolderResponse]:
3206
+ """
3207
+ Parameters
3208
+ ----------
3209
+ name : typing.Optional[str]
3210
+ Name of the folder
3211
+
3212
+ request_options : typing.Optional[RequestOptions]
3213
+ Request-specific configuration.
3214
+
3215
+ Returns
3216
+ -------
3217
+ AsyncHttpResponse[CreateFolderResponse]
3218
+ successfully created
3219
+ """
3220
+ _response = await self._client_wrapper.httpx_client.request(
3221
+ "contacts/folders",
3222
+ method="POST",
3223
+ json={
3224
+ "name": name,
3225
+ },
3226
+ headers={
3227
+ "content-type": "application/json",
3228
+ },
3229
+ request_options=request_options,
3230
+ omit=OMIT,
3231
+ )
3232
+ try:
3233
+ if 200 <= _response.status_code < 300:
3234
+ _data = typing.cast(
3235
+ CreateFolderResponse,
3236
+ construct_type(
3237
+ type_=CreateFolderResponse, # type: ignore
3238
+ object_=_response.json(),
3239
+ ),
3240
+ )
3241
+ return AsyncHttpResponse(response=_response, data=_data)
3242
+ if _response.status_code == 400:
3243
+ raise BadRequestError(
3244
+ headers=dict(_response.headers),
3245
+ body=typing.cast(
3246
+ typing.Any,
3247
+ construct_type(
3248
+ type_=typing.Any, # type: ignore
3249
+ object_=_response.json(),
3250
+ ),
3251
+ ),
3252
+ )
3253
+ _response_json = _response.json()
3254
+ except JSONDecodeError:
3255
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3256
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3257
+
3258
+ async def get_folder(
3259
+ self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None
3260
+ ) -> AsyncHttpResponse[GetFolder]:
3261
+ """
3262
+ <Note>
3263
+ Ongoing changes for this endpoint.
3264
+
3265
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
3266
+
3267
+ These are non breaking changes. The default value for the attributes will be 0.
3268
+ </Note>
3269
+
3270
+ Parameters
3271
+ ----------
3272
+ folder_id : int
3273
+ id of the folder
3274
+
3275
+ request_options : typing.Optional[RequestOptions]
3276
+ Request-specific configuration.
3277
+
3278
+ Returns
3279
+ -------
3280
+ AsyncHttpResponse[GetFolder]
3281
+ Folder details
3282
+ """
3283
+ _response = await self._client_wrapper.httpx_client.request(
3284
+ f"contacts/folders/{jsonable_encoder(folder_id)}",
3285
+ method="GET",
3286
+ request_options=request_options,
3287
+ )
3288
+ try:
3289
+ if 200 <= _response.status_code < 300:
3290
+ _data = typing.cast(
3291
+ GetFolder,
3292
+ construct_type(
3293
+ type_=GetFolder, # type: ignore
3294
+ object_=_response.json(),
3295
+ ),
3296
+ )
3297
+ return AsyncHttpResponse(response=_response, data=_data)
3298
+ if _response.status_code == 400:
3299
+ raise BadRequestError(
3300
+ headers=dict(_response.headers),
3301
+ body=typing.cast(
3302
+ typing.Any,
3303
+ construct_type(
3304
+ type_=typing.Any, # type: ignore
3305
+ object_=_response.json(),
3306
+ ),
3307
+ ),
3308
+ )
3309
+ if _response.status_code == 404:
3310
+ raise NotFoundError(
3311
+ headers=dict(_response.headers),
3312
+ body=typing.cast(
3313
+ typing.Any,
3314
+ construct_type(
3315
+ type_=typing.Any, # type: ignore
3316
+ object_=_response.json(),
3317
+ ),
3318
+ ),
3319
+ )
3320
+ _response_json = _response.json()
3321
+ except JSONDecodeError:
3322
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3323
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3324
+
3325
+ async def update_folder(
3326
+ self,
3327
+ folder_id: int,
3328
+ *,
3329
+ name: typing.Optional[str] = OMIT,
3330
+ request_options: typing.Optional[RequestOptions] = None,
3331
+ ) -> AsyncHttpResponse[None]:
3332
+ """
3333
+ Parameters
3334
+ ----------
3335
+ folder_id : int
3336
+ Id of the folder
3337
+
3338
+ name : typing.Optional[str]
3339
+ Name of the folder
3340
+
3341
+ request_options : typing.Optional[RequestOptions]
3342
+ Request-specific configuration.
3343
+
3344
+ Returns
3345
+ -------
3346
+ AsyncHttpResponse[None]
3347
+ """
3348
+ _response = await self._client_wrapper.httpx_client.request(
3349
+ f"contacts/folders/{jsonable_encoder(folder_id)}",
3350
+ method="PUT",
3351
+ json={
3352
+ "name": name,
3353
+ },
3354
+ headers={
3355
+ "content-type": "application/json",
3356
+ },
3357
+ request_options=request_options,
3358
+ omit=OMIT,
3359
+ )
3360
+ try:
3361
+ if 200 <= _response.status_code < 300:
3362
+ return AsyncHttpResponse(response=_response, data=None)
3363
+ if _response.status_code == 400:
3364
+ raise BadRequestError(
3365
+ headers=dict(_response.headers),
3366
+ body=typing.cast(
3367
+ typing.Any,
3368
+ construct_type(
3369
+ type_=typing.Any, # type: ignore
3370
+ object_=_response.json(),
3371
+ ),
3372
+ ),
3373
+ )
3374
+ if _response.status_code == 404:
3375
+ raise NotFoundError(
3376
+ headers=dict(_response.headers),
3377
+ body=typing.cast(
3378
+ typing.Any,
3379
+ construct_type(
3380
+ type_=typing.Any, # type: ignore
3381
+ object_=_response.json(),
3382
+ ),
3383
+ ),
3384
+ )
3385
+ _response_json = _response.json()
3386
+ except JSONDecodeError:
3387
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3388
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3389
+
3390
+ async def delete_folder(
3391
+ self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None
3392
+ ) -> AsyncHttpResponse[None]:
3393
+ """
3394
+ Parameters
3395
+ ----------
3396
+ folder_id : int
3397
+ Id of the folder
3398
+
3399
+ request_options : typing.Optional[RequestOptions]
3400
+ Request-specific configuration.
3401
+
3402
+ Returns
3403
+ -------
3404
+ AsyncHttpResponse[None]
3405
+ """
3406
+ _response = await self._client_wrapper.httpx_client.request(
3407
+ f"contacts/folders/{jsonable_encoder(folder_id)}",
3408
+ method="DELETE",
3409
+ request_options=request_options,
3410
+ )
3411
+ try:
3412
+ if 200 <= _response.status_code < 300:
3413
+ return AsyncHttpResponse(response=_response, data=None)
3414
+ if _response.status_code == 400:
3415
+ raise BadRequestError(
3416
+ headers=dict(_response.headers),
3417
+ body=typing.cast(
3418
+ typing.Any,
3419
+ construct_type(
3420
+ type_=typing.Any, # type: ignore
3421
+ object_=_response.json(),
3422
+ ),
3423
+ ),
3424
+ )
3425
+ if _response.status_code == 404:
3426
+ raise NotFoundError(
3427
+ headers=dict(_response.headers),
3428
+ body=typing.cast(
3429
+ typing.Any,
3430
+ construct_type(
3431
+ type_=typing.Any, # type: ignore
3432
+ object_=_response.json(),
3433
+ ),
3434
+ ),
3435
+ )
3436
+ _response_json = _response.json()
3437
+ except JSONDecodeError:
3438
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3439
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3440
+
3441
+ async def get_folder_lists(
3442
+ self,
3443
+ folder_id: int,
3444
+ *,
3445
+ limit: typing.Optional[int] = None,
3446
+ offset: typing.Optional[int] = None,
3447
+ sort: typing.Optional[GetFolderListsRequestSort] = None,
3448
+ request_options: typing.Optional[RequestOptions] = None,
3449
+ ) -> AsyncHttpResponse[GetFolderListsResponse]:
3450
+ """
3451
+ <Note>
3452
+ Ongoing changes for this endpoint.
3453
+
3454
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
3455
+
3456
+ These are non breaking changes. The default value for the attributes will be 0.
3457
+ </Note>
3458
+
3459
+ Parameters
3460
+ ----------
3461
+ folder_id : int
3462
+ Id of the folder
3463
+
3464
+ limit : typing.Optional[int]
3465
+ Number of documents per page
3466
+
3467
+ offset : typing.Optional[int]
3468
+ Index of the first document of the page
3469
+
3470
+ sort : typing.Optional[GetFolderListsRequestSort]
3471
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
3472
+
3473
+ request_options : typing.Optional[RequestOptions]
3474
+ Request-specific configuration.
3475
+
3476
+ Returns
3477
+ -------
3478
+ AsyncHttpResponse[GetFolderListsResponse]
3479
+ Folder's Lists details
3480
+ """
3481
+ _response = await self._client_wrapper.httpx_client.request(
3482
+ f"contacts/folders/{jsonable_encoder(folder_id)}/lists",
3483
+ method="GET",
3484
+ params={
3485
+ "limit": limit,
3486
+ "offset": offset,
3487
+ "sort": sort,
3488
+ },
3489
+ request_options=request_options,
3490
+ )
3491
+ try:
3492
+ if 200 <= _response.status_code < 300:
3493
+ _data = typing.cast(
3494
+ GetFolderListsResponse,
3495
+ construct_type(
3496
+ type_=GetFolderListsResponse, # type: ignore
3497
+ object_=_response.json(),
3498
+ ),
3499
+ )
3500
+ return AsyncHttpResponse(response=_response, data=_data)
3501
+ if _response.status_code == 400:
3502
+ raise BadRequestError(
3503
+ headers=dict(_response.headers),
3504
+ body=typing.cast(
3505
+ typing.Any,
3506
+ construct_type(
3507
+ type_=typing.Any, # type: ignore
3508
+ object_=_response.json(),
3509
+ ),
3510
+ ),
3511
+ )
3512
+ if _response.status_code == 404:
3513
+ raise NotFoundError(
3514
+ headers=dict(_response.headers),
3515
+ body=typing.cast(
3516
+ typing.Any,
3517
+ construct_type(
3518
+ type_=typing.Any, # type: ignore
3519
+ object_=_response.json(),
3520
+ ),
3521
+ ),
3522
+ )
3523
+ _response_json = _response.json()
3524
+ except JSONDecodeError:
3525
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3526
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3527
+
3528
+ async def import_contacts(
3529
+ self,
3530
+ *,
3531
+ disable_notification: typing.Optional[bool] = OMIT,
3532
+ email_blacklist: typing.Optional[bool] = OMIT,
3533
+ empty_contacts_attributes: typing.Optional[bool] = OMIT,
3534
+ file_body: typing.Optional[str] = OMIT,
3535
+ file_url: typing.Optional[str] = OMIT,
3536
+ json_body: typing.Optional[typing.Sequence[ImportContactsRequestJsonBodyItem]] = OMIT,
3537
+ list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
3538
+ new_list: typing.Optional[ImportContactsRequestNewList] = OMIT,
3539
+ notify_url: typing.Optional[str] = OMIT,
3540
+ sms_blacklist: typing.Optional[bool] = OMIT,
3541
+ update_existing_contacts: typing.Optional[bool] = OMIT,
3542
+ request_options: typing.Optional[RequestOptions] = None,
3543
+ ) -> AsyncHttpResponse[ImportContactsResponse]:
3544
+ """
3545
+ It returns the background process ID which on completion calls the notify URL that you have set in the input. **Note**: - Any contact attribute that doesn't exist in your account will be ignored at import end.
3546
+
3547
+ Parameters
3548
+ ----------
3549
+ disable_notification : typing.Optional[bool]
3550
+ To disable email notification
3551
+
3552
+ email_blacklist : typing.Optional[bool]
3553
+ To blacklist all the contacts for email
3554
+
3555
+ empty_contacts_attributes : typing.Optional[bool]
3556
+ To facilitate the choice to erase any attribute of the existing contacts with empty value. emptyContactsAttributes = true means the empty fields in your import will erase any attribute that currently contain data in Brevo, & emptyContactsAttributes = false means the empty fields will not affect your existing data ( **only available if `updateExistingContacts` set to true **)
3557
+
3558
+ file_body : typing.Optional[str]
3559
+ **Mandatory if fileUrl and jsonBody is not defined.** CSV content to be imported. Use semicolon to separate multiple attributes. **Maximum allowed file body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of file body size while parsing. Please use fileUrl instead to import bigger files.
3560
+
3561
+ file_url : typing.Optional[str]
3562
+ **Mandatory if fileBody and jsonBody is not defined.** URL of the file to be imported (**no local file**). Possible file formats: #### .txt, .csv, .json
3563
+
3564
+ json_body : typing.Optional[typing.Sequence[ImportContactsRequestJsonBodyItem]]
3565
+ **Mandatory if fileUrl and fileBody is not defined.** JSON content to be imported. **Maximum allowed json body size is 10MB** . However we recommend a safe limit of around 8 MB to avoid the issues caused due to increase of json body size while parsing. Please use fileUrl instead to import bigger files.
3566
+
3567
+ list_ids : typing.Optional[typing.Sequence[int]]
3568
+ **Mandatory if newList is not defined.** Ids of the lists in which the contacts shall be imported. For example, **[2, 4, 7]**.
3569
+
3570
+ new_list : typing.Optional[ImportContactsRequestNewList]
3571
+ To create a new list and import the contacts into it, pass the listName and an optional folderId.
3572
+
3573
+ notify_url : typing.Optional[str]
3574
+ URL that will be called once the import process is finished. For reference, https://help.brevo.com/hc/en-us/articles/360007666479
3575
+
3576
+ sms_blacklist : typing.Optional[bool]
3577
+ To blacklist all the contacts for sms
3578
+
3579
+ update_existing_contacts : typing.Optional[bool]
3580
+ To facilitate the choice to update the existing contacts
3581
+
3582
+ request_options : typing.Optional[RequestOptions]
3583
+ Request-specific configuration.
3584
+
3585
+ Returns
3586
+ -------
3587
+ AsyncHttpResponse[ImportContactsResponse]
3588
+ process id created
3589
+ """
3590
+ _response = await self._client_wrapper.httpx_client.request(
3591
+ "contacts/import",
3592
+ method="POST",
3593
+ json={
3594
+ "disableNotification": disable_notification,
3595
+ "emailBlacklist": email_blacklist,
3596
+ "emptyContactsAttributes": empty_contacts_attributes,
3597
+ "fileBody": file_body,
3598
+ "fileUrl": file_url,
3599
+ "jsonBody": convert_and_respect_annotation_metadata(
3600
+ object_=json_body, annotation=typing.Sequence[ImportContactsRequestJsonBodyItem], direction="write"
3601
+ ),
3602
+ "listIds": list_ids,
3603
+ "newList": convert_and_respect_annotation_metadata(
3604
+ object_=new_list, annotation=ImportContactsRequestNewList, direction="write"
3605
+ ),
3606
+ "notifyUrl": notify_url,
3607
+ "smsBlacklist": sms_blacklist,
3608
+ "updateExistingContacts": update_existing_contacts,
3609
+ },
3610
+ headers={
3611
+ "content-type": "application/json",
3612
+ },
3613
+ request_options=request_options,
3614
+ omit=OMIT,
3615
+ )
3616
+ try:
3617
+ if 200 <= _response.status_code < 300:
3618
+ _data = typing.cast(
3619
+ ImportContactsResponse,
3620
+ construct_type(
3621
+ type_=ImportContactsResponse, # type: ignore
3622
+ object_=_response.json(),
3623
+ ),
3624
+ )
3625
+ return AsyncHttpResponse(response=_response, data=_data)
3626
+ if _response.status_code == 400:
3627
+ raise BadRequestError(
3628
+ headers=dict(_response.headers),
3629
+ body=typing.cast(
3630
+ typing.Any,
3631
+ construct_type(
3632
+ type_=typing.Any, # type: ignore
3633
+ object_=_response.json(),
3634
+ ),
3635
+ ),
3636
+ )
3637
+ _response_json = _response.json()
3638
+ except JSONDecodeError:
3639
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3640
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3641
+
3642
+ async def get_lists(
3643
+ self,
3644
+ *,
3645
+ limit: typing.Optional[int] = None,
3646
+ offset: typing.Optional[int] = None,
3647
+ sort: typing.Optional[GetListsRequestSort] = None,
3648
+ request_options: typing.Optional[RequestOptions] = None,
3649
+ ) -> AsyncHttpResponse[GetListsResponse]:
3650
+ """
3651
+ <Note>
3652
+ Ongoing changes for this endpoint.
3653
+
3654
+ We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
3655
+
3656
+ These are non breaking changes. The default value for the attributes will be 0.
3657
+ </Note>
3658
+
3659
+ Parameters
3660
+ ----------
3661
+ limit : typing.Optional[int]
3662
+ Number of documents per page
3663
+
3664
+ offset : typing.Optional[int]
3665
+ Index of the first document of the page
3666
+
3667
+ sort : typing.Optional[GetListsRequestSort]
3668
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
3669
+
3670
+ request_options : typing.Optional[RequestOptions]
3671
+ Request-specific configuration.
3672
+
3673
+ Returns
3674
+ -------
3675
+ AsyncHttpResponse[GetListsResponse]
3676
+ Lists informations
3677
+ """
3678
+ _response = await self._client_wrapper.httpx_client.request(
3679
+ "contacts/lists",
3680
+ method="GET",
3681
+ params={
3682
+ "limit": limit,
3683
+ "offset": offset,
3684
+ "sort": sort,
3685
+ },
3686
+ request_options=request_options,
3687
+ )
3688
+ try:
3689
+ if 200 <= _response.status_code < 300:
3690
+ _data = typing.cast(
3691
+ GetListsResponse,
3692
+ construct_type(
3693
+ type_=GetListsResponse, # type: ignore
3694
+ object_=_response.json(),
3695
+ ),
3696
+ )
3697
+ return AsyncHttpResponse(response=_response, data=_data)
3698
+ if _response.status_code == 400:
3699
+ raise BadRequestError(
3700
+ headers=dict(_response.headers),
3701
+ body=typing.cast(
3702
+ typing.Any,
3703
+ construct_type(
3704
+ type_=typing.Any, # type: ignore
3705
+ object_=_response.json(),
3706
+ ),
3707
+ ),
3708
+ )
3709
+ _response_json = _response.json()
3710
+ except JSONDecodeError:
3711
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3712
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3713
+
3714
+ async def create_list(
3715
+ self, *, folder_id: int, name: str, request_options: typing.Optional[RequestOptions] = None
3716
+ ) -> AsyncHttpResponse[CreateListResponse]:
3717
+ """
3718
+ Parameters
3719
+ ----------
3720
+ folder_id : int
3721
+ Id of the parent folder in which this list is to be created
3722
+
3723
+ name : str
3724
+ Name of the list
3725
+
3726
+ request_options : typing.Optional[RequestOptions]
3727
+ Request-specific configuration.
3728
+
3729
+ Returns
3730
+ -------
3731
+ AsyncHttpResponse[CreateListResponse]
3732
+ successfully created
3733
+ """
3734
+ _response = await self._client_wrapper.httpx_client.request(
3735
+ "contacts/lists",
3736
+ method="POST",
3737
+ json={
3738
+ "folderId": folder_id,
3739
+ "name": name,
3740
+ },
3741
+ headers={
3742
+ "content-type": "application/json",
3743
+ },
3744
+ request_options=request_options,
3745
+ omit=OMIT,
3746
+ )
3747
+ try:
3748
+ if 200 <= _response.status_code < 300:
3749
+ _data = typing.cast(
3750
+ CreateListResponse,
3751
+ construct_type(
3752
+ type_=CreateListResponse, # type: ignore
3753
+ object_=_response.json(),
3754
+ ),
3755
+ )
3756
+ return AsyncHttpResponse(response=_response, data=_data)
3757
+ if _response.status_code == 400:
3758
+ raise BadRequestError(
3759
+ headers=dict(_response.headers),
3760
+ body=typing.cast(
3761
+ typing.Any,
3762
+ construct_type(
3763
+ type_=typing.Any, # type: ignore
3764
+ object_=_response.json(),
3765
+ ),
3766
+ ),
3767
+ )
3768
+ _response_json = _response.json()
3769
+ except JSONDecodeError:
3770
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3771
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3772
+
3773
+ async def get_list(
3774
+ self,
3775
+ list_id: int,
3776
+ *,
3777
+ start_date: typing.Optional[str] = None,
3778
+ end_date: typing.Optional[str] = None,
3779
+ request_options: typing.Optional[RequestOptions] = None,
3780
+ ) -> AsyncHttpResponse[GetListResponse]:
3781
+ """
3782
+ Parameters
3783
+ ----------
3784
+ list_id : int
3785
+ Id of the list
3786
+
3787
+ start_date : typing.Optional[str]
3788
+ **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result**
3789
+
3790
+ end_date : typing.Optional[str]
3791
+ **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result**
3792
+
3793
+ request_options : typing.Optional[RequestOptions]
3794
+ Request-specific configuration.
3795
+
3796
+ Returns
3797
+ -------
3798
+ AsyncHttpResponse[GetListResponse]
3799
+ List informations
3800
+ """
3801
+ _response = await self._client_wrapper.httpx_client.request(
3802
+ f"contacts/lists/{jsonable_encoder(list_id)}",
3803
+ method="GET",
3804
+ params={
3805
+ "startDate": start_date,
3806
+ "endDate": end_date,
3807
+ },
3808
+ request_options=request_options,
3809
+ )
3810
+ try:
3811
+ if 200 <= _response.status_code < 300:
3812
+ _data = typing.cast(
3813
+ GetListResponse,
3814
+ construct_type(
3815
+ type_=GetListResponse, # type: ignore
3816
+ object_=_response.json(),
3817
+ ),
3818
+ )
3819
+ return AsyncHttpResponse(response=_response, data=_data)
3820
+ if _response.status_code == 400:
3821
+ raise BadRequestError(
3822
+ headers=dict(_response.headers),
3823
+ body=typing.cast(
3824
+ typing.Any,
3825
+ construct_type(
3826
+ type_=typing.Any, # type: ignore
3827
+ object_=_response.json(),
3828
+ ),
3829
+ ),
3830
+ )
3831
+ if _response.status_code == 404:
3832
+ raise NotFoundError(
3833
+ headers=dict(_response.headers),
3834
+ body=typing.cast(
3835
+ typing.Any,
3836
+ construct_type(
3837
+ type_=typing.Any, # type: ignore
3838
+ object_=_response.json(),
3839
+ ),
3840
+ ),
3841
+ )
3842
+ _response_json = _response.json()
3843
+ except JSONDecodeError:
3844
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3845
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3846
+
3847
+ async def update_list(
3848
+ self,
3849
+ list_id: int,
3850
+ *,
3851
+ folder_id: typing.Optional[int] = OMIT,
3852
+ name: typing.Optional[str] = OMIT,
3853
+ request_options: typing.Optional[RequestOptions] = None,
3854
+ ) -> AsyncHttpResponse[None]:
3855
+ """
3856
+ Parameters
3857
+ ----------
3858
+ list_id : int
3859
+ Id of the list
3860
+
3861
+ folder_id : typing.Optional[int]
3862
+ Id of the folder in which the list is to be moved. Either of the two parameters (name, folderId) can be updated at a time.
3863
+
3864
+ name : typing.Optional[str]
3865
+ Name of the list. Either of the two parameters (name, folderId) can be updated at a time.
3866
+
3867
+ request_options : typing.Optional[RequestOptions]
3868
+ Request-specific configuration.
3869
+
3870
+ Returns
3871
+ -------
3872
+ AsyncHttpResponse[None]
3873
+ """
3874
+ _response = await self._client_wrapper.httpx_client.request(
3875
+ f"contacts/lists/{jsonable_encoder(list_id)}",
3876
+ method="PUT",
3877
+ json={
3878
+ "folderId": folder_id,
3879
+ "name": name,
3880
+ },
3881
+ headers={
3882
+ "content-type": "application/json",
3883
+ },
3884
+ request_options=request_options,
3885
+ omit=OMIT,
3886
+ )
3887
+ try:
3888
+ if 200 <= _response.status_code < 300:
3889
+ return AsyncHttpResponse(response=_response, data=None)
3890
+ if _response.status_code == 400:
3891
+ raise BadRequestError(
3892
+ headers=dict(_response.headers),
3893
+ body=typing.cast(
3894
+ typing.Any,
3895
+ construct_type(
3896
+ type_=typing.Any, # type: ignore
3897
+ object_=_response.json(),
3898
+ ),
3899
+ ),
3900
+ )
3901
+ if _response.status_code == 404:
3902
+ raise NotFoundError(
3903
+ headers=dict(_response.headers),
3904
+ body=typing.cast(
3905
+ typing.Any,
3906
+ construct_type(
3907
+ type_=typing.Any, # type: ignore
3908
+ object_=_response.json(),
3909
+ ),
3910
+ ),
3911
+ )
3912
+ _response_json = _response.json()
3913
+ except JSONDecodeError:
3914
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3915
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3916
+
3917
+ async def delete_list(
3918
+ self, list_id: int, *, request_options: typing.Optional[RequestOptions] = None
3919
+ ) -> AsyncHttpResponse[None]:
3920
+ """
3921
+ Parameters
3922
+ ----------
3923
+ list_id : int
3924
+ Id of the list
3925
+
3926
+ request_options : typing.Optional[RequestOptions]
3927
+ Request-specific configuration.
3928
+
3929
+ Returns
3930
+ -------
3931
+ AsyncHttpResponse[None]
3932
+ """
3933
+ _response = await self._client_wrapper.httpx_client.request(
3934
+ f"contacts/lists/{jsonable_encoder(list_id)}",
3935
+ method="DELETE",
3936
+ request_options=request_options,
3937
+ )
3938
+ try:
3939
+ if 200 <= _response.status_code < 300:
3940
+ return AsyncHttpResponse(response=_response, data=None)
3941
+ if _response.status_code == 400:
3942
+ raise BadRequestError(
3943
+ headers=dict(_response.headers),
3944
+ body=typing.cast(
3945
+ typing.Any,
3946
+ construct_type(
3947
+ type_=typing.Any, # type: ignore
3948
+ object_=_response.json(),
3949
+ ),
3950
+ ),
3951
+ )
3952
+ if _response.status_code == 404:
3953
+ raise NotFoundError(
3954
+ headers=dict(_response.headers),
3955
+ body=typing.cast(
3956
+ typing.Any,
3957
+ construct_type(
3958
+ type_=typing.Any, # type: ignore
3959
+ object_=_response.json(),
3960
+ ),
3961
+ ),
3962
+ )
3963
+ _response_json = _response.json()
3964
+ except JSONDecodeError:
3965
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3966
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3967
+
3968
+ async def get_contacts_from_list(
3969
+ self,
3970
+ list_id: int,
3971
+ *,
3972
+ modified_since: typing.Optional[str] = None,
3973
+ limit: typing.Optional[int] = None,
3974
+ offset: typing.Optional[int] = None,
3975
+ sort: typing.Optional[GetContactsFromListRequestSort] = None,
3976
+ request_options: typing.Optional[RequestOptions] = None,
3977
+ ) -> AsyncHttpResponse[GetContacts]:
3978
+ """
3979
+ Parameters
3980
+ ----------
3981
+ list_id : int
3982
+ Id of the list
3983
+
3984
+ modified_since : typing.Optional[str]
3985
+ Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.**
3986
+
3987
+ limit : typing.Optional[int]
3988
+ Number of documents per page
3989
+
3990
+ offset : typing.Optional[int]
3991
+ Index of the first document of the page
3992
+
3993
+ sort : typing.Optional[GetContactsFromListRequestSort]
3994
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
3995
+
3996
+ request_options : typing.Optional[RequestOptions]
3997
+ Request-specific configuration.
3998
+
3999
+ Returns
4000
+ -------
4001
+ AsyncHttpResponse[GetContacts]
4002
+ Contact informations
4003
+ """
4004
+ _response = await self._client_wrapper.httpx_client.request(
4005
+ f"contacts/lists/{jsonable_encoder(list_id)}/contacts",
4006
+ method="GET",
4007
+ params={
4008
+ "modifiedSince": modified_since,
4009
+ "limit": limit,
4010
+ "offset": offset,
4011
+ "sort": sort,
4012
+ },
4013
+ request_options=request_options,
4014
+ )
4015
+ try:
4016
+ if 200 <= _response.status_code < 300:
4017
+ _data = typing.cast(
4018
+ GetContacts,
4019
+ construct_type(
4020
+ type_=GetContacts, # type: ignore
4021
+ object_=_response.json(),
4022
+ ),
4023
+ )
4024
+ return AsyncHttpResponse(response=_response, data=_data)
4025
+ if _response.status_code == 400:
4026
+ raise BadRequestError(
4027
+ headers=dict(_response.headers),
4028
+ body=typing.cast(
4029
+ typing.Any,
4030
+ construct_type(
4031
+ type_=typing.Any, # type: ignore
4032
+ object_=_response.json(),
4033
+ ),
4034
+ ),
4035
+ )
4036
+ if _response.status_code == 404:
4037
+ raise NotFoundError(
4038
+ headers=dict(_response.headers),
4039
+ body=typing.cast(
4040
+ typing.Any,
4041
+ construct_type(
4042
+ type_=typing.Any, # type: ignore
4043
+ object_=_response.json(),
4044
+ ),
4045
+ ),
4046
+ )
4047
+ _response_json = _response.json()
4048
+ except JSONDecodeError:
4049
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4050
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4051
+
4052
+ async def add_contact_to_list(
4053
+ self,
4054
+ list_id: int,
4055
+ *,
4056
+ request: AddContactToListRequestBody,
4057
+ request_options: typing.Optional[RequestOptions] = None,
4058
+ ) -> AsyncHttpResponse[PostContactInfo]:
4059
+ """
4060
+ Parameters
4061
+ ----------
4062
+ list_id : int
4063
+ Id of the list
4064
+
4065
+ request : AddContactToListRequestBody
4066
+
4067
+ request_options : typing.Optional[RequestOptions]
4068
+ Request-specific configuration.
4069
+
4070
+ Returns
4071
+ -------
4072
+ AsyncHttpResponse[PostContactInfo]
4073
+ All contacts have been added successfully to the list with details of failed ones
4074
+ """
4075
+ _response = await self._client_wrapper.httpx_client.request(
4076
+ f"contacts/lists/{jsonable_encoder(list_id)}/contacts/add",
4077
+ method="POST",
4078
+ json=convert_and_respect_annotation_metadata(
4079
+ object_=request, annotation=AddContactToListRequestBody, direction="write"
4080
+ ),
4081
+ headers={
4082
+ "content-type": "application/json",
4083
+ },
4084
+ request_options=request_options,
4085
+ omit=OMIT,
4086
+ )
4087
+ try:
4088
+ if 200 <= _response.status_code < 300:
4089
+ _data = typing.cast(
4090
+ PostContactInfo,
4091
+ construct_type(
4092
+ type_=PostContactInfo, # type: ignore
4093
+ object_=_response.json(),
4094
+ ),
4095
+ )
4096
+ return AsyncHttpResponse(response=_response, data=_data)
4097
+ if _response.status_code == 400:
4098
+ raise BadRequestError(
4099
+ headers=dict(_response.headers),
4100
+ body=typing.cast(
4101
+ typing.Any,
4102
+ construct_type(
4103
+ type_=typing.Any, # type: ignore
4104
+ object_=_response.json(),
4105
+ ),
4106
+ ),
4107
+ )
4108
+ if _response.status_code == 404:
4109
+ raise NotFoundError(
4110
+ headers=dict(_response.headers),
4111
+ body=typing.cast(
4112
+ typing.Any,
4113
+ construct_type(
4114
+ type_=typing.Any, # type: ignore
4115
+ object_=_response.json(),
4116
+ ),
4117
+ ),
4118
+ )
4119
+ _response_json = _response.json()
4120
+ except JSONDecodeError:
4121
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4122
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4123
+
4124
+ async def remove_contact_from_list(
4125
+ self,
4126
+ list_id: int,
4127
+ *,
4128
+ request: RemoveContactFromListRequestBody,
4129
+ request_options: typing.Optional[RequestOptions] = None,
4130
+ ) -> AsyncHttpResponse[PostContactInfo]:
4131
+ """
4132
+ Parameters
4133
+ ----------
4134
+ list_id : int
4135
+ Id of the list
4136
+
4137
+ request : RemoveContactFromListRequestBody
4138
+
4139
+ request_options : typing.Optional[RequestOptions]
4140
+ Request-specific configuration.
4141
+
4142
+ Returns
4143
+ -------
4144
+ AsyncHttpResponse[PostContactInfo]
4145
+ All contacts have been removed successfully from the list with details of failed ones
4146
+ """
4147
+ _response = await self._client_wrapper.httpx_client.request(
4148
+ f"contacts/lists/{jsonable_encoder(list_id)}/contacts/remove",
4149
+ method="POST",
4150
+ json=convert_and_respect_annotation_metadata(
4151
+ object_=request, annotation=RemoveContactFromListRequestBody, direction="write"
4152
+ ),
4153
+ headers={
4154
+ "content-type": "application/json",
4155
+ },
4156
+ request_options=request_options,
4157
+ omit=OMIT,
4158
+ )
4159
+ try:
4160
+ if 200 <= _response.status_code < 300:
4161
+ _data = typing.cast(
4162
+ PostContactInfo,
4163
+ construct_type(
4164
+ type_=PostContactInfo, # type: ignore
4165
+ object_=_response.json(),
4166
+ ),
4167
+ )
4168
+ return AsyncHttpResponse(response=_response, data=_data)
4169
+ if _response.status_code == 400:
4170
+ raise BadRequestError(
4171
+ headers=dict(_response.headers),
4172
+ body=typing.cast(
4173
+ typing.Any,
4174
+ construct_type(
4175
+ type_=typing.Any, # type: ignore
4176
+ object_=_response.json(),
4177
+ ),
4178
+ ),
4179
+ )
4180
+ if _response.status_code == 404:
4181
+ raise NotFoundError(
4182
+ headers=dict(_response.headers),
4183
+ body=typing.cast(
4184
+ typing.Any,
4185
+ construct_type(
4186
+ type_=typing.Any, # type: ignore
4187
+ object_=_response.json(),
4188
+ ),
4189
+ ),
4190
+ )
4191
+ _response_json = _response.json()
4192
+ except JSONDecodeError:
4193
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4194
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4195
+
4196
+ async def get_segments(
4197
+ self,
4198
+ *,
4199
+ limit: typing.Optional[int] = None,
4200
+ offset: typing.Optional[int] = None,
4201
+ sort: typing.Optional[GetSegmentsRequestSort] = None,
4202
+ request_options: typing.Optional[RequestOptions] = None,
4203
+ ) -> AsyncHttpResponse[GetSegmentsResponse]:
4204
+ """
4205
+ Parameters
4206
+ ----------
4207
+ limit : typing.Optional[int]
4208
+ Number of documents per page
4209
+
4210
+ offset : typing.Optional[int]
4211
+ Index of the first document of the page
4212
+
4213
+ sort : typing.Optional[GetSegmentsRequestSort]
4214
+ Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
4215
+
4216
+ request_options : typing.Optional[RequestOptions]
4217
+ Request-specific configuration.
4218
+
4219
+ Returns
4220
+ -------
4221
+ AsyncHttpResponse[GetSegmentsResponse]
4222
+ Segments informations
4223
+ """
4224
+ _response = await self._client_wrapper.httpx_client.request(
4225
+ "contacts/segments",
4226
+ method="GET",
4227
+ params={
4228
+ "limit": limit,
4229
+ "offset": offset,
4230
+ "sort": sort,
4231
+ },
4232
+ request_options=request_options,
4233
+ )
4234
+ try:
4235
+ if 200 <= _response.status_code < 300:
4236
+ _data = typing.cast(
4237
+ GetSegmentsResponse,
4238
+ construct_type(
4239
+ type_=GetSegmentsResponse, # type: ignore
4240
+ object_=_response.json(),
4241
+ ),
4242
+ )
4243
+ return AsyncHttpResponse(response=_response, data=_data)
4244
+ if _response.status_code == 400:
4245
+ raise BadRequestError(
4246
+ headers=dict(_response.headers),
4247
+ body=typing.cast(
4248
+ typing.Any,
4249
+ construct_type(
4250
+ type_=typing.Any, # type: ignore
4251
+ object_=_response.json(),
4252
+ ),
4253
+ ),
4254
+ )
4255
+ _response_json = _response.json()
4256
+ except JSONDecodeError:
4257
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4258
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4259
+
4260
+ async def get_contact_info(
4261
+ self,
4262
+ identifier: GetContactInfoRequestIdentifier,
4263
+ *,
4264
+ identifier_type: typing.Optional[GetContactInfoRequestIdentifierType] = None,
4265
+ start_date: typing.Optional[str] = None,
4266
+ end_date: typing.Optional[str] = None,
4267
+ request_options: typing.Optional[RequestOptions] = None,
4268
+ ) -> AsyncHttpResponse[GetContactInfoResponse]:
4269
+ """
4270
+ <Note title="Follow this format when passing a SMS phone number as an attribute">
4271
+ Accepted Number Formats
4272
+
4273
+ 91xxxxxxxxxx
4274
+ +91xxxxxxxxxx
4275
+ 0091xxxxxxxxxx
4276
+ </Note>
4277
+
4278
+ There are 2 ways to get a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact. <br><br> Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute <br><br>Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges.
4279
+
4280
+ Parameters
4281
+ ----------
4282
+ identifier : GetContactInfoRequestIdentifier
4283
+ Email (urlencoded) OR ID of the contact OR its SMS attribute value OR EXT_ID attribute (urlencoded)
4284
+
4285
+ identifier_type : typing.Optional[GetContactInfoRequestIdentifierType]
4286
+ email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
4287
+
4288
+ start_date : typing.Optional[str]
4289
+ **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
4290
+
4291
+ end_date : typing.Optional[str]
4292
+ **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.
4293
+
4294
+ request_options : typing.Optional[RequestOptions]
4295
+ Request-specific configuration.
4296
+
4297
+ Returns
4298
+ -------
4299
+ AsyncHttpResponse[GetContactInfoResponse]
4300
+ Contact informations
4301
+ """
4302
+ _response = await self._client_wrapper.httpx_client.request(
4303
+ f"contacts/{jsonable_encoder(identifier)}",
4304
+ method="GET",
4305
+ params={
4306
+ "identifierType": identifier_type,
4307
+ "startDate": start_date,
4308
+ "endDate": end_date,
4309
+ },
4310
+ request_options=request_options,
4311
+ )
4312
+ try:
4313
+ if 200 <= _response.status_code < 300:
4314
+ _data = typing.cast(
4315
+ GetContactInfoResponse,
4316
+ construct_type(
4317
+ type_=GetContactInfoResponse, # type: ignore
4318
+ object_=_response.json(),
4319
+ ),
4320
+ )
4321
+ return AsyncHttpResponse(response=_response, data=_data)
4322
+ if _response.status_code == 400:
4323
+ raise BadRequestError(
4324
+ headers=dict(_response.headers),
4325
+ body=typing.cast(
4326
+ typing.Any,
4327
+ construct_type(
4328
+ type_=typing.Any, # type: ignore
4329
+ object_=_response.json(),
4330
+ ),
4331
+ ),
4332
+ )
4333
+ if _response.status_code == 404:
4334
+ raise NotFoundError(
4335
+ headers=dict(_response.headers),
4336
+ body=typing.cast(
4337
+ typing.Any,
4338
+ construct_type(
4339
+ type_=typing.Any, # type: ignore
4340
+ object_=_response.json(),
4341
+ ),
4342
+ ),
4343
+ )
4344
+ _response_json = _response.json()
4345
+ except JSONDecodeError:
4346
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4347
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4348
+
4349
+ async def update_contact(
4350
+ self,
4351
+ identifier: UpdateContactRequestIdentifier,
4352
+ *,
4353
+ identifier_type: typing.Optional[UpdateContactRequestIdentifierType] = None,
4354
+ attributes: typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]] = OMIT,
4355
+ email_blacklisted: typing.Optional[bool] = OMIT,
4356
+ ext_id: typing.Optional[str] = OMIT,
4357
+ list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
4358
+ sms_blacklisted: typing.Optional[bool] = OMIT,
4359
+ smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
4360
+ unlink_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
4361
+ request_options: typing.Optional[RequestOptions] = None,
4362
+ ) -> AsyncHttpResponse[None]:
4363
+ """
4364
+ There are 2 ways to update a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact. <br><br> Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
4365
+
4366
+ Parameters
4367
+ ----------
4368
+ identifier : UpdateContactRequestIdentifier
4369
+ Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value
4370
+
4371
+ identifier_type : typing.Optional[UpdateContactRequestIdentifierType]
4372
+ email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
4373
+
4374
+ attributes : typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]]
4375
+ Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger", "COUNTRIES":["India","China"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored .Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}**
4376
+
4377
+ email_blacklisted : typing.Optional[bool]
4378
+ Set/unset this field to blacklist/allow the contact for emails (emailBlacklisted = true)
4379
+
4380
+ ext_id : typing.Optional[str]
4381
+ Pass your own Id to update ext_id of a contact.
4382
+
4383
+ list_ids : typing.Optional[typing.Sequence[int]]
4384
+ Ids of the lists to add the contact to
4385
+
4386
+ sms_blacklisted : typing.Optional[bool]
4387
+ Set/unset this field to blacklist/allow the contact for SMS (smsBlacklisted = true)
4388
+
4389
+ smtp_blacklist_sender : typing.Optional[typing.Sequence[str]]
4390
+ transactional email forbidden sender for contact. Use only for email Contact
4391
+
4392
+ unlink_list_ids : typing.Optional[typing.Sequence[int]]
4393
+ Ids of the lists to remove the contact from
4394
+
4395
+ request_options : typing.Optional[RequestOptions]
4396
+ Request-specific configuration.
4397
+
4398
+ Returns
4399
+ -------
4400
+ AsyncHttpResponse[None]
4401
+ """
4402
+ _response = await self._client_wrapper.httpx_client.request(
4403
+ f"contacts/{jsonable_encoder(identifier)}",
4404
+ method="PUT",
4405
+ params={
4406
+ "identifierType": identifier_type,
4407
+ },
4408
+ json={
4409
+ "attributes": convert_and_respect_annotation_metadata(
4410
+ object_=attributes,
4411
+ annotation=typing.Dict[str, UpdateContactRequestAttributesValue],
4412
+ direction="write",
4413
+ ),
4414
+ "emailBlacklisted": email_blacklisted,
4415
+ "ext_id": ext_id,
4416
+ "listIds": list_ids,
4417
+ "smsBlacklisted": sms_blacklisted,
4418
+ "smtpBlacklistSender": smtp_blacklist_sender,
4419
+ "unlinkListIds": unlink_list_ids,
4420
+ },
4421
+ headers={
4422
+ "content-type": "application/json",
4423
+ },
4424
+ request_options=request_options,
4425
+ omit=OMIT,
4426
+ )
4427
+ try:
4428
+ if 200 <= _response.status_code < 300:
4429
+ return AsyncHttpResponse(response=_response, data=None)
4430
+ if _response.status_code == 400:
4431
+ raise BadRequestError(
4432
+ headers=dict(_response.headers),
4433
+ body=typing.cast(
4434
+ typing.Any,
4435
+ construct_type(
4436
+ type_=typing.Any, # type: ignore
4437
+ object_=_response.json(),
4438
+ ),
4439
+ ),
4440
+ )
4441
+ if _response.status_code == 404:
4442
+ raise NotFoundError(
4443
+ headers=dict(_response.headers),
4444
+ body=typing.cast(
4445
+ typing.Any,
4446
+ construct_type(
4447
+ type_=typing.Any, # type: ignore
4448
+ object_=_response.json(),
4449
+ ),
4450
+ ),
4451
+ )
4452
+ if _response.status_code == 425:
4453
+ raise TooEarlyError(
4454
+ headers=dict(_response.headers),
4455
+ body=typing.cast(
4456
+ ContactErrorModel,
4457
+ construct_type(
4458
+ type_=ContactErrorModel, # type: ignore
4459
+ object_=_response.json(),
4460
+ ),
4461
+ ),
4462
+ )
4463
+ _response_json = _response.json()
4464
+ except JSONDecodeError:
4465
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4466
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4467
+
4468
+ async def delete_contact(
4469
+ self,
4470
+ identifier: DeleteContactRequestIdentifier,
4471
+ *,
4472
+ identifier_type: typing.Optional[DeleteContactRequestIdentifierType] = None,
4473
+ request_options: typing.Optional[RequestOptions] = None,
4474
+ ) -> AsyncHttpResponse[None]:
4475
+ """
4476
+ There are 2 ways to delete a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact. <br><br> Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute.
4477
+
4478
+ Parameters
4479
+ ----------
4480
+ identifier : DeleteContactRequestIdentifier
4481
+ Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded)
4482
+
4483
+ identifier_type : typing.Optional[DeleteContactRequestIdentifierType]
4484
+ email_id for Email, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
4485
+
4486
+ request_options : typing.Optional[RequestOptions]
4487
+ Request-specific configuration.
4488
+
4489
+ Returns
4490
+ -------
4491
+ AsyncHttpResponse[None]
4492
+ """
4493
+ _response = await self._client_wrapper.httpx_client.request(
4494
+ f"contacts/{jsonable_encoder(identifier)}",
4495
+ method="DELETE",
4496
+ params={
4497
+ "identifierType": identifier_type,
4498
+ },
4499
+ request_options=request_options,
4500
+ )
4501
+ try:
4502
+ if 200 <= _response.status_code < 300:
4503
+ return AsyncHttpResponse(response=_response, data=None)
4504
+ if _response.status_code == 400:
4505
+ raise BadRequestError(
4506
+ headers=dict(_response.headers),
4507
+ body=typing.cast(
4508
+ typing.Any,
4509
+ construct_type(
4510
+ type_=typing.Any, # type: ignore
4511
+ object_=_response.json(),
4512
+ ),
4513
+ ),
4514
+ )
4515
+ if _response.status_code == 404:
4516
+ raise NotFoundError(
4517
+ headers=dict(_response.headers),
4518
+ body=typing.cast(
4519
+ typing.Any,
4520
+ construct_type(
4521
+ type_=typing.Any, # type: ignore
4522
+ object_=_response.json(),
4523
+ ),
4524
+ ),
4525
+ )
4526
+ if _response.status_code == 405:
4527
+ raise MethodNotAllowedError(
4528
+ headers=dict(_response.headers),
4529
+ body=typing.cast(
4530
+ ErrorModel,
4531
+ construct_type(
4532
+ type_=ErrorModel, # type: ignore
4533
+ object_=_response.json(),
4534
+ ),
4535
+ ),
4536
+ )
4537
+ _response_json = _response.json()
4538
+ except JSONDecodeError:
4539
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4540
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4541
+
4542
+ async def get_contact_stats(
4543
+ self,
4544
+ identifier: GetContactStatsRequestIdentifier,
4545
+ *,
4546
+ start_date: typing.Optional[str] = None,
4547
+ end_date: typing.Optional[str] = None,
4548
+ request_options: typing.Optional[RequestOptions] = None,
4549
+ ) -> AsyncHttpResponse[GetContactStatsResponse]:
4550
+ """
4551
+ Parameters
4552
+ ----------
4553
+ identifier : GetContactStatsRequestIdentifier
4554
+ Email (urlencoded) OR ID of the contact
4555
+
4556
+ start_date : typing.Optional[str]
4557
+ **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
4558
+
4559
+ end_date : typing.Optional[str]
4560
+ **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days
4561
+
4562
+ request_options : typing.Optional[RequestOptions]
4563
+ Request-specific configuration.
4564
+
4565
+ Returns
4566
+ -------
4567
+ AsyncHttpResponse[GetContactStatsResponse]
4568
+ Contact campaign statistics informations
4569
+ """
4570
+ _response = await self._client_wrapper.httpx_client.request(
4571
+ f"contacts/{jsonable_encoder(identifier)}/campaignStats",
4572
+ method="GET",
4573
+ params={
4574
+ "startDate": start_date,
4575
+ "endDate": end_date,
4576
+ },
4577
+ request_options=request_options,
4578
+ )
4579
+ try:
4580
+ if 200 <= _response.status_code < 300:
4581
+ _data = typing.cast(
4582
+ GetContactStatsResponse,
4583
+ construct_type(
4584
+ type_=GetContactStatsResponse, # type: ignore
4585
+ object_=_response.json(),
4586
+ ),
4587
+ )
4588
+ return AsyncHttpResponse(response=_response, data=_data)
4589
+ if _response.status_code == 400:
4590
+ raise BadRequestError(
4591
+ headers=dict(_response.headers),
4592
+ body=typing.cast(
4593
+ typing.Any,
4594
+ construct_type(
4595
+ type_=typing.Any, # type: ignore
4596
+ object_=_response.json(),
4597
+ ),
4598
+ ),
4599
+ )
4600
+ if _response.status_code == 404:
4601
+ raise NotFoundError(
4602
+ headers=dict(_response.headers),
4603
+ body=typing.cast(
4604
+ typing.Any,
4605
+ construct_type(
4606
+ type_=typing.Any, # type: ignore
4607
+ object_=_response.json(),
4608
+ ),
4609
+ ),
4610
+ )
4611
+ _response_json = _response.json()
4612
+ except JSONDecodeError:
4613
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4614
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)