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,4538 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
10
+ from ..core.jsonable_encoder import jsonable_encoder
11
+ from ..core.request_options import RequestOptions
12
+ from ..core.unchecked_base_model import construct_type
13
+ from ..errors.failed_dependency_error import FailedDependencyError
14
+ from ..errors.forbidden_error import ForbiddenError
15
+ from ..errors.internal_server_error import InternalServerError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..errors.unauthorized_error import UnauthorizedError
18
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
19
+ from ..types.balance_definition import BalanceDefinition
20
+ from ..types.balance_limit import BalanceLimit
21
+ from ..types.error_model import ErrorModel
22
+ from ..types.transaction import Transaction
23
+ from .types.create_balance_limit_request_constraint_type import CreateBalanceLimitRequestConstraintType
24
+ from .types.create_balance_limit_request_duration_unit import CreateBalanceLimitRequestDurationUnit
25
+ from .types.create_balance_limit_request_transaction_type import CreateBalanceLimitRequestTransactionType
26
+ from .types.create_balance_order_response import CreateBalanceOrderResponse
27
+ from .types.get_balance_definition_list_request_sort import GetBalanceDefinitionListRequestSort
28
+ from .types.get_balance_definition_list_request_sort_field import GetBalanceDefinitionListRequestSortField
29
+ from .types.get_balance_definition_list_request_version import GetBalanceDefinitionListRequestVersion
30
+ from .types.get_balance_definition_list_response import GetBalanceDefinitionListResponse
31
+ from .types.get_balance_definition_request_version import GetBalanceDefinitionRequestVersion
32
+ from .types.get_balance_limit_request_version import GetBalanceLimitRequestVersion
33
+ from .types.get_contact_balances_response import GetContactBalancesResponse
34
+ from .types.get_loyalty_balance_programs_pid_transaction_history_request_sort import (
35
+ GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort,
36
+ )
37
+ from .types.get_loyalty_balance_programs_pid_transaction_history_request_sort_field import (
38
+ GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField,
39
+ )
40
+ from .types.get_loyalty_balance_programs_pid_transaction_history_response import (
41
+ GetLoyaltyBalanceProgramsPidTransactionHistoryResponse,
42
+ )
43
+ from .types.get_subscription_balances_response import GetSubscriptionBalancesResponse
44
+ from .types.post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_modifier import (
45
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier,
46
+ )
47
+ from .types.post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_unit import (
48
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationUnit,
49
+ )
50
+ from .types.post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_amount_overtaking_strategy import (
51
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionAmountOvertakingStrategy,
52
+ )
53
+ from .types.post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_credit_rounding import (
54
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionCreditRounding,
55
+ )
56
+ from .types.post_loyalty_balance_programs_pid_balance_definitions_request_balance_option_debit_rounding import (
57
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionDebitRounding,
58
+ )
59
+ from .types.post_loyalty_balance_programs_pid_balance_definitions_request_unit import (
60
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestUnit,
61
+ )
62
+ from .types.post_loyalty_balance_programs_pid_subscriptions_cid_balances_response import (
63
+ PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse,
64
+ )
65
+ from .types.update_balance_definition_request_balance_availability_duration_modifier import (
66
+ UpdateBalanceDefinitionRequestBalanceAvailabilityDurationModifier,
67
+ )
68
+ from .types.update_balance_definition_request_balance_availability_duration_unit import (
69
+ UpdateBalanceDefinitionRequestBalanceAvailabilityDurationUnit,
70
+ )
71
+ from .types.update_balance_definition_request_balance_option_amount_overtaking_strategy import (
72
+ UpdateBalanceDefinitionRequestBalanceOptionAmountOvertakingStrategy,
73
+ )
74
+ from .types.update_balance_definition_request_balance_option_credit_rounding import (
75
+ UpdateBalanceDefinitionRequestBalanceOptionCreditRounding,
76
+ )
77
+ from .types.update_balance_definition_request_balance_option_debit_rounding import (
78
+ UpdateBalanceDefinitionRequestBalanceOptionDebitRounding,
79
+ )
80
+ from .types.update_balance_definition_request_unit import UpdateBalanceDefinitionRequestUnit
81
+ from .types.update_balance_limit_request_constraint_type import UpdateBalanceLimitRequestConstraintType
82
+ from .types.update_balance_limit_request_duration_unit import UpdateBalanceLimitRequestDurationUnit
83
+ from .types.update_balance_limit_request_transaction_type import UpdateBalanceLimitRequestTransactionType
84
+
85
+ # this is used as the default value for optional parameters
86
+ OMIT = typing.cast(typing.Any, ...)
87
+
88
+
89
+ class RawBalanceClient:
90
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
91
+ self._client_wrapper = client_wrapper
92
+
93
+ def get_active_balances_api(
94
+ self,
95
+ pid: str,
96
+ *,
97
+ contact_id: int,
98
+ balance_definition_id: str,
99
+ limit: typing.Optional[int] = None,
100
+ offset: typing.Optional[int] = None,
101
+ sort_field: typing.Optional[str] = None,
102
+ sort: typing.Optional[str] = None,
103
+ request_options: typing.Optional[RequestOptions] = None,
104
+ ) -> HttpResponse[BalanceLimit]:
105
+ """
106
+ Returns Active Balances
107
+
108
+ Parameters
109
+ ----------
110
+ pid : str
111
+ Loyalty Program Id
112
+
113
+ contact_id : int
114
+ Contact ID
115
+
116
+ balance_definition_id : str
117
+ Balance Definition ID
118
+
119
+ limit : typing.Optional[int]
120
+ Limit
121
+
122
+ offset : typing.Optional[int]
123
+ Offset
124
+
125
+ sort_field : typing.Optional[str]
126
+ Sort Field
127
+
128
+ sort : typing.Optional[str]
129
+ Sort Order
130
+
131
+ request_options : typing.Optional[RequestOptions]
132
+ Request-specific configuration.
133
+
134
+ Returns
135
+ -------
136
+ HttpResponse[BalanceLimit]
137
+ Successful retrieval of active balance
138
+ """
139
+ _response = self._client_wrapper.httpx_client.request(
140
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/active-balance",
141
+ method="GET",
142
+ params={
143
+ "limit": limit,
144
+ "offset": offset,
145
+ "sort_field": sort_field,
146
+ "sort": sort,
147
+ "contact_id": contact_id,
148
+ "balance_definition_id": balance_definition_id,
149
+ },
150
+ request_options=request_options,
151
+ )
152
+ try:
153
+ if 200 <= _response.status_code < 300:
154
+ _data = typing.cast(
155
+ BalanceLimit,
156
+ construct_type(
157
+ type_=BalanceLimit, # type: ignore
158
+ object_=_response.json(),
159
+ ),
160
+ )
161
+ return HttpResponse(response=_response, data=_data)
162
+ if _response.status_code == 401:
163
+ raise UnauthorizedError(
164
+ headers=dict(_response.headers),
165
+ body=typing.cast(
166
+ typing.Any,
167
+ construct_type(
168
+ type_=typing.Any, # type: ignore
169
+ object_=_response.json(),
170
+ ),
171
+ ),
172
+ )
173
+ if _response.status_code == 403:
174
+ raise ForbiddenError(
175
+ headers=dict(_response.headers),
176
+ body=typing.cast(
177
+ typing.Any,
178
+ construct_type(
179
+ type_=typing.Any, # type: ignore
180
+ object_=_response.json(),
181
+ ),
182
+ ),
183
+ )
184
+ if _response.status_code == 404:
185
+ raise NotFoundError(
186
+ headers=dict(_response.headers),
187
+ body=typing.cast(
188
+ typing.Any,
189
+ construct_type(
190
+ type_=typing.Any, # type: ignore
191
+ object_=_response.json(),
192
+ ),
193
+ ),
194
+ )
195
+ if _response.status_code == 422:
196
+ raise UnprocessableEntityError(
197
+ headers=dict(_response.headers),
198
+ body=typing.cast(
199
+ ErrorModel,
200
+ construct_type(
201
+ type_=ErrorModel, # type: ignore
202
+ object_=_response.json(),
203
+ ),
204
+ ),
205
+ )
206
+ if _response.status_code == 500:
207
+ raise InternalServerError(
208
+ headers=dict(_response.headers),
209
+ body=typing.cast(
210
+ typing.Any,
211
+ construct_type(
212
+ type_=typing.Any, # type: ignore
213
+ object_=_response.json(),
214
+ ),
215
+ ),
216
+ )
217
+ _response_json = _response.json()
218
+ except JSONDecodeError:
219
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
220
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
221
+
222
+ def get_balance_definition_list(
223
+ self,
224
+ pid: str,
225
+ *,
226
+ limit: typing.Optional[int] = None,
227
+ offset: typing.Optional[int] = None,
228
+ sort_field: typing.Optional[GetBalanceDefinitionListRequestSortField] = None,
229
+ sort: typing.Optional[GetBalanceDefinitionListRequestSort] = None,
230
+ version: typing.Optional[GetBalanceDefinitionListRequestVersion] = None,
231
+ request_options: typing.Optional[RequestOptions] = None,
232
+ ) -> HttpResponse[GetBalanceDefinitionListResponse]:
233
+ """
234
+ Returns balance definition page
235
+
236
+ Parameters
237
+ ----------
238
+ pid : str
239
+ Loyalty Program Id
240
+
241
+ limit : typing.Optional[int]
242
+ Limit the number of records returned
243
+
244
+ offset : typing.Optional[int]
245
+ Offset to paginate records
246
+
247
+ sort_field : typing.Optional[GetBalanceDefinitionListRequestSortField]
248
+ Field to sort by
249
+
250
+ sort : typing.Optional[GetBalanceDefinitionListRequestSort]
251
+ Sort direction
252
+
253
+ version : typing.Optional[GetBalanceDefinitionListRequestVersion]
254
+ Version
255
+
256
+ request_options : typing.Optional[RequestOptions]
257
+ Request-specific configuration.
258
+
259
+ Returns
260
+ -------
261
+ HttpResponse[GetBalanceDefinitionListResponse]
262
+ Successful retrieval of balance definition page
263
+ """
264
+ _response = self._client_wrapper.httpx_client.request(
265
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions",
266
+ method="GET",
267
+ params={
268
+ "limit": limit,
269
+ "offset": offset,
270
+ "sortField": sort_field,
271
+ "sort": sort,
272
+ "version": version,
273
+ },
274
+ request_options=request_options,
275
+ )
276
+ try:
277
+ if 200 <= _response.status_code < 300:
278
+ _data = typing.cast(
279
+ GetBalanceDefinitionListResponse,
280
+ construct_type(
281
+ type_=GetBalanceDefinitionListResponse, # type: ignore
282
+ object_=_response.json(),
283
+ ),
284
+ )
285
+ return HttpResponse(response=_response, data=_data)
286
+ if _response.status_code == 401:
287
+ raise UnauthorizedError(
288
+ headers=dict(_response.headers),
289
+ body=typing.cast(
290
+ typing.Any,
291
+ construct_type(
292
+ type_=typing.Any, # type: ignore
293
+ object_=_response.json(),
294
+ ),
295
+ ),
296
+ )
297
+ if _response.status_code == 403:
298
+ raise ForbiddenError(
299
+ headers=dict(_response.headers),
300
+ body=typing.cast(
301
+ typing.Any,
302
+ construct_type(
303
+ type_=typing.Any, # type: ignore
304
+ object_=_response.json(),
305
+ ),
306
+ ),
307
+ )
308
+ if _response.status_code == 422:
309
+ raise UnprocessableEntityError(
310
+ headers=dict(_response.headers),
311
+ body=typing.cast(
312
+ ErrorModel,
313
+ construct_type(
314
+ type_=ErrorModel, # type: ignore
315
+ object_=_response.json(),
316
+ ),
317
+ ),
318
+ )
319
+ if _response.status_code == 500:
320
+ raise InternalServerError(
321
+ headers=dict(_response.headers),
322
+ body=typing.cast(
323
+ typing.Any,
324
+ construct_type(
325
+ type_=typing.Any, # type: ignore
326
+ object_=_response.json(),
327
+ ),
328
+ ),
329
+ )
330
+ _response_json = _response.json()
331
+ except JSONDecodeError:
332
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
333
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
334
+
335
+ def create_balance_definition(
336
+ self,
337
+ pid: str,
338
+ *,
339
+ name: str,
340
+ unit: PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestUnit,
341
+ balance_availability_duration_modifier: typing.Optional[
342
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier
343
+ ] = OMIT,
344
+ balance_availability_duration_unit: typing.Optional[
345
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationUnit
346
+ ] = OMIT,
347
+ balance_availability_duration_value: typing.Optional[int] = OMIT,
348
+ balance_expiration_date: typing.Optional[dt.date] = OMIT,
349
+ balance_option_amount_overtaking_strategy: typing.Optional[
350
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionAmountOvertakingStrategy
351
+ ] = OMIT,
352
+ balance_option_credit_rounding: typing.Optional[
353
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionCreditRounding
354
+ ] = OMIT,
355
+ balance_option_debit_rounding: typing.Optional[
356
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionDebitRounding
357
+ ] = OMIT,
358
+ description: typing.Optional[str] = OMIT,
359
+ image_ref: typing.Optional[str] = OMIT,
360
+ max_amount: typing.Optional[float] = OMIT,
361
+ max_credit_amount_limit: typing.Optional[float] = OMIT,
362
+ max_debit_amount_limit: typing.Optional[float] = OMIT,
363
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
364
+ min_amount: typing.Optional[float] = OMIT,
365
+ request_options: typing.Optional[RequestOptions] = None,
366
+ ) -> HttpResponse[BalanceDefinition]:
367
+ """
368
+ Creates balance definition and returns information
369
+
370
+ Parameters
371
+ ----------
372
+ pid : str
373
+ Loyalty Program Id
374
+
375
+ name : str
376
+ Name of the balance definition.
377
+
378
+ unit : PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestUnit
379
+ Unit of balance measurement.
380
+
381
+ balance_availability_duration_modifier : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier]
382
+ Defines when the balance expires within the selected duration.
383
+
384
+ balance_availability_duration_unit : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationUnit]
385
+ Unit of time for balance validity.
386
+
387
+ balance_availability_duration_value : typing.Optional[int]
388
+ Number of time units before the balance expires.
389
+
390
+ balance_expiration_date : typing.Optional[dt.date]
391
+ Fixed expiration date (`dd/mm` format) as an alternative to duration-based expiry.
392
+
393
+ balance_option_amount_overtaking_strategy : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionAmountOvertakingStrategy]
394
+ Defines whether partial credit is allowed when reaching max balance.
395
+
396
+ balance_option_credit_rounding : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionCreditRounding]
397
+ Defines rounding strategy for credit transactions.
398
+
399
+ balance_option_debit_rounding : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionDebitRounding]
400
+ Defines rounding strategy for debit transactions.
401
+
402
+ description : typing.Optional[str]
403
+ Short description of the balance definition.
404
+
405
+ image_ref : typing.Optional[str]
406
+ URL of an optional image reference.
407
+
408
+ max_amount : typing.Optional[float]
409
+ Maximum allowable balance amount.
410
+
411
+ max_credit_amount_limit : typing.Optional[float]
412
+ Maximum credit allowed per operation.
413
+
414
+ max_debit_amount_limit : typing.Optional[float]
415
+ Maximum debit allowed per operation.
416
+
417
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
418
+ Additional metadata for the balance definition.
419
+
420
+ min_amount : typing.Optional[float]
421
+ Minimum allowable balance amount.
422
+
423
+ request_options : typing.Optional[RequestOptions]
424
+ Request-specific configuration.
425
+
426
+ Returns
427
+ -------
428
+ HttpResponse[BalanceDefinition]
429
+ Successful creation of balance definition
430
+ """
431
+ _response = self._client_wrapper.httpx_client.request(
432
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions",
433
+ method="POST",
434
+ json={
435
+ "balanceAvailabilityDurationModifier": balance_availability_duration_modifier,
436
+ "balanceAvailabilityDurationUnit": balance_availability_duration_unit,
437
+ "balanceAvailabilityDurationValue": balance_availability_duration_value,
438
+ "balanceExpirationDate": balance_expiration_date,
439
+ "balanceOptionAmountOvertakingStrategy": balance_option_amount_overtaking_strategy,
440
+ "balanceOptionCreditRounding": balance_option_credit_rounding,
441
+ "balanceOptionDebitRounding": balance_option_debit_rounding,
442
+ "description": description,
443
+ "imageRef": image_ref,
444
+ "maxAmount": max_amount,
445
+ "maxCreditAmountLimit": max_credit_amount_limit,
446
+ "maxDebitAmountLimit": max_debit_amount_limit,
447
+ "meta": meta,
448
+ "minAmount": min_amount,
449
+ "name": name,
450
+ "unit": unit,
451
+ },
452
+ headers={
453
+ "content-type": "application/json",
454
+ },
455
+ request_options=request_options,
456
+ omit=OMIT,
457
+ )
458
+ try:
459
+ if 200 <= _response.status_code < 300:
460
+ _data = typing.cast(
461
+ BalanceDefinition,
462
+ construct_type(
463
+ type_=BalanceDefinition, # type: ignore
464
+ object_=_response.json(),
465
+ ),
466
+ )
467
+ return HttpResponse(response=_response, data=_data)
468
+ if _response.status_code == 401:
469
+ raise UnauthorizedError(
470
+ headers=dict(_response.headers),
471
+ body=typing.cast(
472
+ typing.Any,
473
+ construct_type(
474
+ type_=typing.Any, # type: ignore
475
+ object_=_response.json(),
476
+ ),
477
+ ),
478
+ )
479
+ if _response.status_code == 403:
480
+ raise ForbiddenError(
481
+ headers=dict(_response.headers),
482
+ body=typing.cast(
483
+ typing.Any,
484
+ construct_type(
485
+ type_=typing.Any, # type: ignore
486
+ object_=_response.json(),
487
+ ),
488
+ ),
489
+ )
490
+ if _response.status_code == 404:
491
+ raise NotFoundError(
492
+ headers=dict(_response.headers),
493
+ body=typing.cast(
494
+ typing.Any,
495
+ construct_type(
496
+ type_=typing.Any, # type: ignore
497
+ object_=_response.json(),
498
+ ),
499
+ ),
500
+ )
501
+ if _response.status_code == 422:
502
+ raise UnprocessableEntityError(
503
+ headers=dict(_response.headers),
504
+ body=typing.cast(
505
+ ErrorModel,
506
+ construct_type(
507
+ type_=ErrorModel, # type: ignore
508
+ object_=_response.json(),
509
+ ),
510
+ ),
511
+ )
512
+ if _response.status_code == 500:
513
+ raise InternalServerError(
514
+ headers=dict(_response.headers),
515
+ body=typing.cast(
516
+ typing.Any,
517
+ construct_type(
518
+ type_=typing.Any, # type: ignore
519
+ object_=_response.json(),
520
+ ),
521
+ ),
522
+ )
523
+ _response_json = _response.json()
524
+ except JSONDecodeError:
525
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
526
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
527
+
528
+ def get_balance_definition(
529
+ self,
530
+ pid: str,
531
+ bdid: str,
532
+ *,
533
+ version: typing.Optional[GetBalanceDefinitionRequestVersion] = None,
534
+ request_options: typing.Optional[RequestOptions] = None,
535
+ ) -> HttpResponse[BalanceDefinition]:
536
+ """
537
+ Returns balance definition
538
+
539
+ Parameters
540
+ ----------
541
+ pid : str
542
+ Loyalty Program Id
543
+
544
+ bdid : str
545
+ Balance Definition Id
546
+
547
+ version : typing.Optional[GetBalanceDefinitionRequestVersion]
548
+ Version
549
+
550
+ request_options : typing.Optional[RequestOptions]
551
+ Request-specific configuration.
552
+
553
+ Returns
554
+ -------
555
+ HttpResponse[BalanceDefinition]
556
+ Successful retrieval of balance definition
557
+ """
558
+ _response = self._client_wrapper.httpx_client.request(
559
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}",
560
+ method="GET",
561
+ params={
562
+ "version": version,
563
+ },
564
+ request_options=request_options,
565
+ )
566
+ try:
567
+ if 200 <= _response.status_code < 300:
568
+ _data = typing.cast(
569
+ BalanceDefinition,
570
+ construct_type(
571
+ type_=BalanceDefinition, # type: ignore
572
+ object_=_response.json(),
573
+ ),
574
+ )
575
+ return HttpResponse(response=_response, data=_data)
576
+ if _response.status_code == 401:
577
+ raise UnauthorizedError(
578
+ headers=dict(_response.headers),
579
+ body=typing.cast(
580
+ typing.Any,
581
+ construct_type(
582
+ type_=typing.Any, # type: ignore
583
+ object_=_response.json(),
584
+ ),
585
+ ),
586
+ )
587
+ if _response.status_code == 403:
588
+ raise ForbiddenError(
589
+ headers=dict(_response.headers),
590
+ body=typing.cast(
591
+ typing.Any,
592
+ construct_type(
593
+ type_=typing.Any, # type: ignore
594
+ object_=_response.json(),
595
+ ),
596
+ ),
597
+ )
598
+ if _response.status_code == 404:
599
+ raise NotFoundError(
600
+ headers=dict(_response.headers),
601
+ body=typing.cast(
602
+ typing.Any,
603
+ construct_type(
604
+ type_=typing.Any, # type: ignore
605
+ object_=_response.json(),
606
+ ),
607
+ ),
608
+ )
609
+ if _response.status_code == 422:
610
+ raise UnprocessableEntityError(
611
+ headers=dict(_response.headers),
612
+ body=typing.cast(
613
+ ErrorModel,
614
+ construct_type(
615
+ type_=ErrorModel, # type: ignore
616
+ object_=_response.json(),
617
+ ),
618
+ ),
619
+ )
620
+ if _response.status_code == 500:
621
+ raise InternalServerError(
622
+ headers=dict(_response.headers),
623
+ body=typing.cast(
624
+ typing.Any,
625
+ construct_type(
626
+ type_=typing.Any, # type: ignore
627
+ object_=_response.json(),
628
+ ),
629
+ ),
630
+ )
631
+ _response_json = _response.json()
632
+ except JSONDecodeError:
633
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
634
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
635
+
636
+ def update_balance_definition(
637
+ self,
638
+ pid: str,
639
+ bdid: str,
640
+ *,
641
+ name: str,
642
+ unit: UpdateBalanceDefinitionRequestUnit,
643
+ balance_availability_duration_modifier: typing.Optional[
644
+ UpdateBalanceDefinitionRequestBalanceAvailabilityDurationModifier
645
+ ] = OMIT,
646
+ balance_availability_duration_unit: typing.Optional[
647
+ UpdateBalanceDefinitionRequestBalanceAvailabilityDurationUnit
648
+ ] = OMIT,
649
+ balance_availability_duration_value: typing.Optional[int] = OMIT,
650
+ balance_expiration_date: typing.Optional[str] = OMIT,
651
+ balance_option_amount_overtaking_strategy: typing.Optional[
652
+ UpdateBalanceDefinitionRequestBalanceOptionAmountOvertakingStrategy
653
+ ] = OMIT,
654
+ balance_option_credit_rounding: typing.Optional[
655
+ UpdateBalanceDefinitionRequestBalanceOptionCreditRounding
656
+ ] = OMIT,
657
+ balance_option_debit_rounding: typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionDebitRounding] = OMIT,
658
+ description: typing.Optional[str] = OMIT,
659
+ image_ref: typing.Optional[str] = OMIT,
660
+ max_amount: typing.Optional[float] = OMIT,
661
+ max_credit_amount_limit: typing.Optional[float] = OMIT,
662
+ max_debit_amount_limit: typing.Optional[float] = OMIT,
663
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
664
+ min_amount: typing.Optional[float] = OMIT,
665
+ request_options: typing.Optional[RequestOptions] = None,
666
+ ) -> HttpResponse[BalanceDefinition]:
667
+ """
668
+ Updates Balance definition
669
+
670
+ Parameters
671
+ ----------
672
+ pid : str
673
+ Loyalty Program Id
674
+
675
+ bdid : str
676
+ Balance Definition Id
677
+
678
+ name : str
679
+ Name of the balance definition.
680
+
681
+ unit : UpdateBalanceDefinitionRequestUnit
682
+ Unit of balance measurement.
683
+
684
+ balance_availability_duration_modifier : typing.Optional[UpdateBalanceDefinitionRequestBalanceAvailabilityDurationModifier]
685
+ Defines when the balance expires within the selected duration.
686
+
687
+ balance_availability_duration_unit : typing.Optional[UpdateBalanceDefinitionRequestBalanceAvailabilityDurationUnit]
688
+ Unit of time for balance validity.
689
+
690
+ balance_availability_duration_value : typing.Optional[int]
691
+ Number of time units before the balance expires.
692
+
693
+ balance_expiration_date : typing.Optional[str]
694
+ Expiration date (`dd/mm` format) or empty if not applicable.
695
+
696
+ balance_option_amount_overtaking_strategy : typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionAmountOvertakingStrategy]
697
+ Defines whether partial credit is allowed when reaching max balance.
698
+
699
+ balance_option_credit_rounding : typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionCreditRounding]
700
+ Rounding strategy for credit transactions.
701
+
702
+ balance_option_debit_rounding : typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionDebitRounding]
703
+ Rounding strategy for debit transactions.
704
+
705
+ description : typing.Optional[str]
706
+ Short description of the balance definition.
707
+
708
+ image_ref : typing.Optional[str]
709
+ URL of an optional image reference.
710
+
711
+ max_amount : typing.Optional[float]
712
+ Maximum allowable balance amount.
713
+
714
+ max_credit_amount_limit : typing.Optional[float]
715
+ Maximum credit allowed per operation.
716
+
717
+ max_debit_amount_limit : typing.Optional[float]
718
+ Maximum debit allowed per operation.
719
+
720
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
721
+ Optional metadata for the balance definition.
722
+
723
+ min_amount : typing.Optional[float]
724
+ Minimum allowable balance amount.
725
+
726
+ request_options : typing.Optional[RequestOptions]
727
+ Request-specific configuration.
728
+
729
+ Returns
730
+ -------
731
+ HttpResponse[BalanceDefinition]
732
+ Successful update of balance definition
733
+ """
734
+ _response = self._client_wrapper.httpx_client.request(
735
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}",
736
+ method="PUT",
737
+ json={
738
+ "balanceAvailabilityDurationModifier": balance_availability_duration_modifier,
739
+ "balanceAvailabilityDurationUnit": balance_availability_duration_unit,
740
+ "balanceAvailabilityDurationValue": balance_availability_duration_value,
741
+ "balanceExpirationDate": balance_expiration_date,
742
+ "balanceOptionAmountOvertakingStrategy": balance_option_amount_overtaking_strategy,
743
+ "balanceOptionCreditRounding": balance_option_credit_rounding,
744
+ "balanceOptionDebitRounding": balance_option_debit_rounding,
745
+ "description": description,
746
+ "imageRef": image_ref,
747
+ "maxAmount": max_amount,
748
+ "maxCreditAmountLimit": max_credit_amount_limit,
749
+ "maxDebitAmountLimit": max_debit_amount_limit,
750
+ "meta": meta,
751
+ "minAmount": min_amount,
752
+ "name": name,
753
+ "unit": unit,
754
+ },
755
+ headers={
756
+ "content-type": "application/json",
757
+ },
758
+ request_options=request_options,
759
+ omit=OMIT,
760
+ )
761
+ try:
762
+ if 200 <= _response.status_code < 300:
763
+ _data = typing.cast(
764
+ BalanceDefinition,
765
+ construct_type(
766
+ type_=BalanceDefinition, # type: ignore
767
+ object_=_response.json(),
768
+ ),
769
+ )
770
+ return HttpResponse(response=_response, data=_data)
771
+ if _response.status_code == 401:
772
+ raise UnauthorizedError(
773
+ headers=dict(_response.headers),
774
+ body=typing.cast(
775
+ typing.Any,
776
+ construct_type(
777
+ type_=typing.Any, # type: ignore
778
+ object_=_response.json(),
779
+ ),
780
+ ),
781
+ )
782
+ if _response.status_code == 403:
783
+ raise ForbiddenError(
784
+ headers=dict(_response.headers),
785
+ body=typing.cast(
786
+ typing.Any,
787
+ construct_type(
788
+ type_=typing.Any, # type: ignore
789
+ object_=_response.json(),
790
+ ),
791
+ ),
792
+ )
793
+ if _response.status_code == 404:
794
+ raise NotFoundError(
795
+ headers=dict(_response.headers),
796
+ body=typing.cast(
797
+ typing.Any,
798
+ construct_type(
799
+ type_=typing.Any, # type: ignore
800
+ object_=_response.json(),
801
+ ),
802
+ ),
803
+ )
804
+ if _response.status_code == 422:
805
+ raise UnprocessableEntityError(
806
+ headers=dict(_response.headers),
807
+ body=typing.cast(
808
+ ErrorModel,
809
+ construct_type(
810
+ type_=ErrorModel, # type: ignore
811
+ object_=_response.json(),
812
+ ),
813
+ ),
814
+ )
815
+ if _response.status_code == 424:
816
+ raise FailedDependencyError(
817
+ headers=dict(_response.headers),
818
+ body=typing.cast(
819
+ typing.Any,
820
+ construct_type(
821
+ type_=typing.Any, # type: ignore
822
+ object_=_response.json(),
823
+ ),
824
+ ),
825
+ )
826
+ if _response.status_code == 500:
827
+ raise InternalServerError(
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
+ _response_json = _response.json()
838
+ except JSONDecodeError:
839
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
840
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
841
+
842
+ def delete_balance_definition(
843
+ self, pid: str, bdid: str, *, request_options: typing.Optional[RequestOptions] = None
844
+ ) -> HttpResponse[None]:
845
+ """
846
+ Delete Balance definition
847
+
848
+ Parameters
849
+ ----------
850
+ pid : str
851
+ Loyalty Program Id
852
+
853
+ bdid : str
854
+ Balance Definition Id
855
+
856
+ request_options : typing.Optional[RequestOptions]
857
+ Request-specific configuration.
858
+
859
+ Returns
860
+ -------
861
+ HttpResponse[None]
862
+ """
863
+ _response = self._client_wrapper.httpx_client.request(
864
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}",
865
+ method="DELETE",
866
+ request_options=request_options,
867
+ )
868
+ try:
869
+ if 200 <= _response.status_code < 300:
870
+ return HttpResponse(response=_response, data=None)
871
+ if _response.status_code == 401:
872
+ raise UnauthorizedError(
873
+ headers=dict(_response.headers),
874
+ body=typing.cast(
875
+ typing.Any,
876
+ construct_type(
877
+ type_=typing.Any, # type: ignore
878
+ object_=_response.json(),
879
+ ),
880
+ ),
881
+ )
882
+ if _response.status_code == 403:
883
+ raise ForbiddenError(
884
+ headers=dict(_response.headers),
885
+ body=typing.cast(
886
+ typing.Any,
887
+ construct_type(
888
+ type_=typing.Any, # type: ignore
889
+ object_=_response.json(),
890
+ ),
891
+ ),
892
+ )
893
+ if _response.status_code == 404:
894
+ raise NotFoundError(
895
+ headers=dict(_response.headers),
896
+ body=typing.cast(
897
+ typing.Any,
898
+ construct_type(
899
+ type_=typing.Any, # type: ignore
900
+ object_=_response.json(),
901
+ ),
902
+ ),
903
+ )
904
+ if _response.status_code == 422:
905
+ raise UnprocessableEntityError(
906
+ headers=dict(_response.headers),
907
+ body=typing.cast(
908
+ ErrorModel,
909
+ construct_type(
910
+ type_=ErrorModel, # type: ignore
911
+ object_=_response.json(),
912
+ ),
913
+ ),
914
+ )
915
+ if _response.status_code == 500:
916
+ raise InternalServerError(
917
+ headers=dict(_response.headers),
918
+ body=typing.cast(
919
+ typing.Any,
920
+ construct_type(
921
+ type_=typing.Any, # type: ignore
922
+ object_=_response.json(),
923
+ ),
924
+ ),
925
+ )
926
+ _response_json = _response.json()
927
+ except JSONDecodeError:
928
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
929
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
930
+
931
+ def create_balance_limit(
932
+ self,
933
+ pid: str,
934
+ bdid: str,
935
+ *,
936
+ constraint_type: CreateBalanceLimitRequestConstraintType,
937
+ duration_unit: CreateBalanceLimitRequestDurationUnit,
938
+ duration_value: int,
939
+ transaction_type: CreateBalanceLimitRequestTransactionType,
940
+ value: int,
941
+ sliding_schedule: typing.Optional[bool] = OMIT,
942
+ request_options: typing.Optional[RequestOptions] = None,
943
+ ) -> HttpResponse[BalanceLimit]:
944
+ """
945
+ Creates balance limit and sends the created UUID along with the data
946
+
947
+ Parameters
948
+ ----------
949
+ pid : str
950
+ Loyalty Program Id
951
+
952
+ bdid : str
953
+ Balance Definition Id
954
+
955
+ constraint_type : CreateBalanceLimitRequestConstraintType
956
+ Defines whether the limit applies to transaction count or amount.
957
+
958
+ duration_unit : CreateBalanceLimitRequestDurationUnit
959
+ Unit of time for which the limit is applicable.
960
+
961
+ duration_value : int
962
+ Number of time units for the balance limit.
963
+
964
+ transaction_type : CreateBalanceLimitRequestTransactionType
965
+ Specifies whether the limit applies to credit or debit transactions.
966
+
967
+ value : int
968
+ Maximum allowed value for the specified constraint type.
969
+
970
+ sliding_schedule : typing.Optional[bool]
971
+ Determines if the limit resets on a rolling schedule.
972
+
973
+ request_options : typing.Optional[RequestOptions]
974
+ Request-specific configuration.
975
+
976
+ Returns
977
+ -------
978
+ HttpResponse[BalanceLimit]
979
+ Successful creation of balance limit
980
+ """
981
+ _response = self._client_wrapper.httpx_client.request(
982
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits",
983
+ method="POST",
984
+ json={
985
+ "constraintType": constraint_type,
986
+ "durationUnit": duration_unit,
987
+ "durationValue": duration_value,
988
+ "slidingSchedule": sliding_schedule,
989
+ "transactionType": transaction_type,
990
+ "value": value,
991
+ },
992
+ headers={
993
+ "content-type": "application/json",
994
+ },
995
+ request_options=request_options,
996
+ omit=OMIT,
997
+ )
998
+ try:
999
+ if 200 <= _response.status_code < 300:
1000
+ _data = typing.cast(
1001
+ BalanceLimit,
1002
+ construct_type(
1003
+ type_=BalanceLimit, # type: ignore
1004
+ object_=_response.json(),
1005
+ ),
1006
+ )
1007
+ return HttpResponse(response=_response, data=_data)
1008
+ if _response.status_code == 401:
1009
+ raise UnauthorizedError(
1010
+ headers=dict(_response.headers),
1011
+ body=typing.cast(
1012
+ typing.Any,
1013
+ construct_type(
1014
+ type_=typing.Any, # type: ignore
1015
+ object_=_response.json(),
1016
+ ),
1017
+ ),
1018
+ )
1019
+ if _response.status_code == 403:
1020
+ raise ForbiddenError(
1021
+ headers=dict(_response.headers),
1022
+ body=typing.cast(
1023
+ typing.Any,
1024
+ construct_type(
1025
+ type_=typing.Any, # type: ignore
1026
+ object_=_response.json(),
1027
+ ),
1028
+ ),
1029
+ )
1030
+ if _response.status_code == 422:
1031
+ raise UnprocessableEntityError(
1032
+ headers=dict(_response.headers),
1033
+ body=typing.cast(
1034
+ ErrorModel,
1035
+ construct_type(
1036
+ type_=ErrorModel, # type: ignore
1037
+ object_=_response.json(),
1038
+ ),
1039
+ ),
1040
+ )
1041
+ if _response.status_code == 424:
1042
+ raise FailedDependencyError(
1043
+ headers=dict(_response.headers),
1044
+ body=typing.cast(
1045
+ typing.Any,
1046
+ construct_type(
1047
+ type_=typing.Any, # type: ignore
1048
+ object_=_response.json(),
1049
+ ),
1050
+ ),
1051
+ )
1052
+ if _response.status_code == 500:
1053
+ raise InternalServerError(
1054
+ headers=dict(_response.headers),
1055
+ body=typing.cast(
1056
+ typing.Any,
1057
+ construct_type(
1058
+ type_=typing.Any, # type: ignore
1059
+ object_=_response.json(),
1060
+ ),
1061
+ ),
1062
+ )
1063
+ _response_json = _response.json()
1064
+ except JSONDecodeError:
1065
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1066
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1067
+
1068
+ def get_balance_limit(
1069
+ self,
1070
+ pid: str,
1071
+ bdid: str,
1072
+ blid: str,
1073
+ *,
1074
+ version: typing.Optional[GetBalanceLimitRequestVersion] = None,
1075
+ request_options: typing.Optional[RequestOptions] = None,
1076
+ ) -> HttpResponse[BalanceLimit]:
1077
+ """
1078
+ Fetches balance limits and send the created UUID along with the data
1079
+
1080
+ Parameters
1081
+ ----------
1082
+ pid : str
1083
+ Loyalty Program Id
1084
+
1085
+ bdid : str
1086
+ Balance Definition Id
1087
+
1088
+ blid : str
1089
+ Balance Limit Id
1090
+
1091
+ version : typing.Optional[GetBalanceLimitRequestVersion]
1092
+ Version
1093
+
1094
+ request_options : typing.Optional[RequestOptions]
1095
+ Request-specific configuration.
1096
+
1097
+ Returns
1098
+ -------
1099
+ HttpResponse[BalanceLimit]
1100
+ Successful retrieval of balance limit
1101
+ """
1102
+ _response = self._client_wrapper.httpx_client.request(
1103
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits/{jsonable_encoder(blid)}",
1104
+ method="GET",
1105
+ params={
1106
+ "version": version,
1107
+ },
1108
+ request_options=request_options,
1109
+ )
1110
+ try:
1111
+ if 200 <= _response.status_code < 300:
1112
+ _data = typing.cast(
1113
+ BalanceLimit,
1114
+ construct_type(
1115
+ type_=BalanceLimit, # type: ignore
1116
+ object_=_response.json(),
1117
+ ),
1118
+ )
1119
+ return HttpResponse(response=_response, data=_data)
1120
+ if _response.status_code == 401:
1121
+ raise UnauthorizedError(
1122
+ headers=dict(_response.headers),
1123
+ body=typing.cast(
1124
+ typing.Any,
1125
+ construct_type(
1126
+ type_=typing.Any, # type: ignore
1127
+ object_=_response.json(),
1128
+ ),
1129
+ ),
1130
+ )
1131
+ if _response.status_code == 403:
1132
+ raise ForbiddenError(
1133
+ headers=dict(_response.headers),
1134
+ body=typing.cast(
1135
+ typing.Any,
1136
+ construct_type(
1137
+ type_=typing.Any, # type: ignore
1138
+ object_=_response.json(),
1139
+ ),
1140
+ ),
1141
+ )
1142
+ if _response.status_code == 404:
1143
+ raise NotFoundError(
1144
+ headers=dict(_response.headers),
1145
+ body=typing.cast(
1146
+ typing.Any,
1147
+ construct_type(
1148
+ type_=typing.Any, # type: ignore
1149
+ object_=_response.json(),
1150
+ ),
1151
+ ),
1152
+ )
1153
+ if _response.status_code == 422:
1154
+ raise UnprocessableEntityError(
1155
+ headers=dict(_response.headers),
1156
+ body=typing.cast(
1157
+ ErrorModel,
1158
+ construct_type(
1159
+ type_=ErrorModel, # type: ignore
1160
+ object_=_response.json(),
1161
+ ),
1162
+ ),
1163
+ )
1164
+ if _response.status_code == 500:
1165
+ raise InternalServerError(
1166
+ headers=dict(_response.headers),
1167
+ body=typing.cast(
1168
+ typing.Any,
1169
+ construct_type(
1170
+ type_=typing.Any, # type: ignore
1171
+ object_=_response.json(),
1172
+ ),
1173
+ ),
1174
+ )
1175
+ _response_json = _response.json()
1176
+ except JSONDecodeError:
1177
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1178
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1179
+
1180
+ def update_balance_limit(
1181
+ self,
1182
+ pid: str,
1183
+ bdid: str,
1184
+ blid: str,
1185
+ *,
1186
+ constraint_type: UpdateBalanceLimitRequestConstraintType,
1187
+ duration_unit: UpdateBalanceLimitRequestDurationUnit,
1188
+ duration_value: int,
1189
+ transaction_type: UpdateBalanceLimitRequestTransactionType,
1190
+ value: int,
1191
+ sliding_schedule: typing.Optional[bool] = OMIT,
1192
+ request_options: typing.Optional[RequestOptions] = None,
1193
+ ) -> HttpResponse[BalanceLimit]:
1194
+ """
1195
+ Updates balance limit
1196
+
1197
+ Parameters
1198
+ ----------
1199
+ pid : str
1200
+ Loyalty Program Id
1201
+
1202
+ bdid : str
1203
+ Balance Definition Id
1204
+
1205
+ blid : str
1206
+ Balance Limit Id
1207
+
1208
+ constraint_type : UpdateBalanceLimitRequestConstraintType
1209
+ Defines whether the limit applies to transaction count or amount.
1210
+
1211
+ duration_unit : UpdateBalanceLimitRequestDurationUnit
1212
+ Unit of time for which the limit is applicable.
1213
+
1214
+ duration_value : int
1215
+ Number of time units for the balance limit.
1216
+
1217
+ transaction_type : UpdateBalanceLimitRequestTransactionType
1218
+ Specifies whether the limit applies to credit or debit transactions.
1219
+
1220
+ value : int
1221
+ Maximum allowed value for the specified constraint type.
1222
+
1223
+ sliding_schedule : typing.Optional[bool]
1224
+ Determines if the limit resets on a rolling schedule.
1225
+
1226
+ request_options : typing.Optional[RequestOptions]
1227
+ Request-specific configuration.
1228
+
1229
+ Returns
1230
+ -------
1231
+ HttpResponse[BalanceLimit]
1232
+ Successful update of balance limit
1233
+ """
1234
+ _response = self._client_wrapper.httpx_client.request(
1235
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits/{jsonable_encoder(blid)}",
1236
+ method="PUT",
1237
+ json={
1238
+ "constraintType": constraint_type,
1239
+ "durationUnit": duration_unit,
1240
+ "durationValue": duration_value,
1241
+ "slidingSchedule": sliding_schedule,
1242
+ "transactionType": transaction_type,
1243
+ "value": value,
1244
+ },
1245
+ headers={
1246
+ "content-type": "application/json",
1247
+ },
1248
+ request_options=request_options,
1249
+ omit=OMIT,
1250
+ )
1251
+ try:
1252
+ if 200 <= _response.status_code < 300:
1253
+ _data = typing.cast(
1254
+ BalanceLimit,
1255
+ construct_type(
1256
+ type_=BalanceLimit, # type: ignore
1257
+ object_=_response.json(),
1258
+ ),
1259
+ )
1260
+ return HttpResponse(response=_response, data=_data)
1261
+ if _response.status_code == 401:
1262
+ raise UnauthorizedError(
1263
+ headers=dict(_response.headers),
1264
+ body=typing.cast(
1265
+ typing.Any,
1266
+ construct_type(
1267
+ type_=typing.Any, # type: ignore
1268
+ object_=_response.json(),
1269
+ ),
1270
+ ),
1271
+ )
1272
+ if _response.status_code == 403:
1273
+ raise ForbiddenError(
1274
+ headers=dict(_response.headers),
1275
+ body=typing.cast(
1276
+ typing.Any,
1277
+ construct_type(
1278
+ type_=typing.Any, # type: ignore
1279
+ object_=_response.json(),
1280
+ ),
1281
+ ),
1282
+ )
1283
+ if _response.status_code == 404:
1284
+ raise NotFoundError(
1285
+ headers=dict(_response.headers),
1286
+ body=typing.cast(
1287
+ typing.Any,
1288
+ construct_type(
1289
+ type_=typing.Any, # type: ignore
1290
+ object_=_response.json(),
1291
+ ),
1292
+ ),
1293
+ )
1294
+ if _response.status_code == 422:
1295
+ raise UnprocessableEntityError(
1296
+ headers=dict(_response.headers),
1297
+ body=typing.cast(
1298
+ ErrorModel,
1299
+ construct_type(
1300
+ type_=ErrorModel, # type: ignore
1301
+ object_=_response.json(),
1302
+ ),
1303
+ ),
1304
+ )
1305
+ if _response.status_code == 500:
1306
+ raise InternalServerError(
1307
+ headers=dict(_response.headers),
1308
+ body=typing.cast(
1309
+ typing.Any,
1310
+ construct_type(
1311
+ type_=typing.Any, # type: ignore
1312
+ object_=_response.json(),
1313
+ ),
1314
+ ),
1315
+ )
1316
+ _response_json = _response.json()
1317
+ except JSONDecodeError:
1318
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1319
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1320
+
1321
+ def delete_balance_limit(
1322
+ self, pid: str, bdid: str, blid: str, *, request_options: typing.Optional[RequestOptions] = None
1323
+ ) -> HttpResponse[None]:
1324
+ """
1325
+ Delete balance limit
1326
+
1327
+ Parameters
1328
+ ----------
1329
+ pid : str
1330
+ Loyalty Program Id
1331
+
1332
+ bdid : str
1333
+ Balance Definition Id
1334
+
1335
+ blid : str
1336
+ Balance Limit Id
1337
+
1338
+ request_options : typing.Optional[RequestOptions]
1339
+ Request-specific configuration.
1340
+
1341
+ Returns
1342
+ -------
1343
+ HttpResponse[None]
1344
+ """
1345
+ _response = self._client_wrapper.httpx_client.request(
1346
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits/{jsonable_encoder(blid)}",
1347
+ method="DELETE",
1348
+ request_options=request_options,
1349
+ )
1350
+ try:
1351
+ if 200 <= _response.status_code < 300:
1352
+ return HttpResponse(response=_response, data=None)
1353
+ if _response.status_code == 401:
1354
+ raise UnauthorizedError(
1355
+ headers=dict(_response.headers),
1356
+ body=typing.cast(
1357
+ typing.Any,
1358
+ construct_type(
1359
+ type_=typing.Any, # type: ignore
1360
+ object_=_response.json(),
1361
+ ),
1362
+ ),
1363
+ )
1364
+ if _response.status_code == 403:
1365
+ raise ForbiddenError(
1366
+ headers=dict(_response.headers),
1367
+ body=typing.cast(
1368
+ typing.Any,
1369
+ construct_type(
1370
+ type_=typing.Any, # type: ignore
1371
+ object_=_response.json(),
1372
+ ),
1373
+ ),
1374
+ )
1375
+ if _response.status_code == 404:
1376
+ raise NotFoundError(
1377
+ headers=dict(_response.headers),
1378
+ body=typing.cast(
1379
+ typing.Any,
1380
+ construct_type(
1381
+ type_=typing.Any, # type: ignore
1382
+ object_=_response.json(),
1383
+ ),
1384
+ ),
1385
+ )
1386
+ if _response.status_code == 422:
1387
+ raise UnprocessableEntityError(
1388
+ headers=dict(_response.headers),
1389
+ body=typing.cast(
1390
+ ErrorModel,
1391
+ construct_type(
1392
+ type_=ErrorModel, # type: ignore
1393
+ object_=_response.json(),
1394
+ ),
1395
+ ),
1396
+ )
1397
+ if _response.status_code == 500:
1398
+ raise InternalServerError(
1399
+ headers=dict(_response.headers),
1400
+ body=typing.cast(
1401
+ typing.Any,
1402
+ construct_type(
1403
+ type_=typing.Any, # type: ignore
1404
+ object_=_response.json(),
1405
+ ),
1406
+ ),
1407
+ )
1408
+ _response_json = _response.json()
1409
+ except JSONDecodeError:
1410
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1411
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1412
+
1413
+ def get_contact_balances(
1414
+ self, pid: str, *, request_options: typing.Optional[RequestOptions] = None
1415
+ ) -> HttpResponse[GetContactBalancesResponse]:
1416
+ """
1417
+ Returns balance list
1418
+
1419
+ Parameters
1420
+ ----------
1421
+ pid : str
1422
+ Loyalty Program Id
1423
+
1424
+ request_options : typing.Optional[RequestOptions]
1425
+ Request-specific configuration.
1426
+
1427
+ Returns
1428
+ -------
1429
+ HttpResponse[GetContactBalancesResponse]
1430
+ Successful retrieval of contact balance
1431
+ """
1432
+ _response = self._client_wrapper.httpx_client.request(
1433
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/contact-balances",
1434
+ method="GET",
1435
+ request_options=request_options,
1436
+ )
1437
+ try:
1438
+ if 200 <= _response.status_code < 300:
1439
+ _data = typing.cast(
1440
+ GetContactBalancesResponse,
1441
+ construct_type(
1442
+ type_=GetContactBalancesResponse, # type: ignore
1443
+ object_=_response.json(),
1444
+ ),
1445
+ )
1446
+ return HttpResponse(response=_response, data=_data)
1447
+ if _response.status_code == 401:
1448
+ raise UnauthorizedError(
1449
+ headers=dict(_response.headers),
1450
+ body=typing.cast(
1451
+ typing.Any,
1452
+ construct_type(
1453
+ type_=typing.Any, # type: ignore
1454
+ object_=_response.json(),
1455
+ ),
1456
+ ),
1457
+ )
1458
+ if _response.status_code == 403:
1459
+ raise ForbiddenError(
1460
+ headers=dict(_response.headers),
1461
+ body=typing.cast(
1462
+ typing.Any,
1463
+ construct_type(
1464
+ type_=typing.Any, # type: ignore
1465
+ object_=_response.json(),
1466
+ ),
1467
+ ),
1468
+ )
1469
+ if _response.status_code == 404:
1470
+ raise NotFoundError(
1471
+ headers=dict(_response.headers),
1472
+ body=typing.cast(
1473
+ typing.Any,
1474
+ construct_type(
1475
+ type_=typing.Any, # type: ignore
1476
+ object_=_response.json(),
1477
+ ),
1478
+ ),
1479
+ )
1480
+ if _response.status_code == 422:
1481
+ raise UnprocessableEntityError(
1482
+ headers=dict(_response.headers),
1483
+ body=typing.cast(
1484
+ ErrorModel,
1485
+ construct_type(
1486
+ type_=ErrorModel, # type: ignore
1487
+ object_=_response.json(),
1488
+ ),
1489
+ ),
1490
+ )
1491
+ if _response.status_code == 500:
1492
+ raise InternalServerError(
1493
+ headers=dict(_response.headers),
1494
+ body=typing.cast(
1495
+ typing.Any,
1496
+ construct_type(
1497
+ type_=typing.Any, # type: ignore
1498
+ object_=_response.json(),
1499
+ ),
1500
+ ),
1501
+ )
1502
+ _response_json = _response.json()
1503
+ except JSONDecodeError:
1504
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1505
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1506
+
1507
+ def create_balance_order(
1508
+ self,
1509
+ pid: str,
1510
+ *,
1511
+ amount: float,
1512
+ balance_definition_id: str,
1513
+ contact_id: int,
1514
+ due_at: str,
1515
+ source: str,
1516
+ expires_at: typing.Optional[str] = OMIT,
1517
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
1518
+ request_options: typing.Optional[RequestOptions] = None,
1519
+ ) -> HttpResponse[CreateBalanceOrderResponse]:
1520
+ """
1521
+ Returns created order
1522
+
1523
+ Parameters
1524
+ ----------
1525
+ pid : str
1526
+ Loyalty Program Id
1527
+
1528
+ amount : float
1529
+ Order amount (must be non-zero).
1530
+
1531
+ balance_definition_id : str
1532
+ Unique identifier (UUID) of the associated balance definition.
1533
+
1534
+ contact_id : int
1535
+ Unique identifier of the contact placing the order (must be ≥ 1).
1536
+
1537
+ due_at : str
1538
+ RFC3339 timestamp specifying when the order is due.
1539
+
1540
+ source : str
1541
+ Specifies the origin of the order (`engine` or `user`).
1542
+
1543
+ expires_at : typing.Optional[str]
1544
+ Optional RFC3339 timestamp defining order expiration.
1545
+
1546
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
1547
+ Optional metadata associated with the order.
1548
+
1549
+ request_options : typing.Optional[RequestOptions]
1550
+ Request-specific configuration.
1551
+
1552
+ Returns
1553
+ -------
1554
+ HttpResponse[CreateBalanceOrderResponse]
1555
+ Successful creation of order
1556
+ """
1557
+ _response = self._client_wrapper.httpx_client.request(
1558
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/create-order",
1559
+ method="POST",
1560
+ json={
1561
+ "amount": amount,
1562
+ "balanceDefinitionId": balance_definition_id,
1563
+ "contactId": contact_id,
1564
+ "dueAt": due_at,
1565
+ "expiresAt": expires_at,
1566
+ "meta": meta,
1567
+ "source": source,
1568
+ },
1569
+ headers={
1570
+ "content-type": "application/json",
1571
+ },
1572
+ request_options=request_options,
1573
+ omit=OMIT,
1574
+ )
1575
+ try:
1576
+ if 200 <= _response.status_code < 300:
1577
+ _data = typing.cast(
1578
+ CreateBalanceOrderResponse,
1579
+ construct_type(
1580
+ type_=CreateBalanceOrderResponse, # type: ignore
1581
+ object_=_response.json(),
1582
+ ),
1583
+ )
1584
+ return HttpResponse(response=_response, data=_data)
1585
+ if _response.status_code == 401:
1586
+ raise UnauthorizedError(
1587
+ headers=dict(_response.headers),
1588
+ body=typing.cast(
1589
+ typing.Any,
1590
+ construct_type(
1591
+ type_=typing.Any, # type: ignore
1592
+ object_=_response.json(),
1593
+ ),
1594
+ ),
1595
+ )
1596
+ if _response.status_code == 403:
1597
+ raise ForbiddenError(
1598
+ headers=dict(_response.headers),
1599
+ body=typing.cast(
1600
+ typing.Any,
1601
+ construct_type(
1602
+ type_=typing.Any, # type: ignore
1603
+ object_=_response.json(),
1604
+ ),
1605
+ ),
1606
+ )
1607
+ if _response.status_code == 422:
1608
+ raise UnprocessableEntityError(
1609
+ headers=dict(_response.headers),
1610
+ body=typing.cast(
1611
+ ErrorModel,
1612
+ construct_type(
1613
+ type_=ErrorModel, # type: ignore
1614
+ object_=_response.json(),
1615
+ ),
1616
+ ),
1617
+ )
1618
+ if _response.status_code == 500:
1619
+ raise InternalServerError(
1620
+ headers=dict(_response.headers),
1621
+ body=typing.cast(
1622
+ typing.Any,
1623
+ construct_type(
1624
+ type_=typing.Any, # type: ignore
1625
+ object_=_response.json(),
1626
+ ),
1627
+ ),
1628
+ )
1629
+ _response_json = _response.json()
1630
+ except JSONDecodeError:
1631
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1632
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1633
+
1634
+ def get_subscription_balances(
1635
+ self, pid: str, cid: str, *, request_options: typing.Optional[RequestOptions] = None
1636
+ ) -> HttpResponse[GetSubscriptionBalancesResponse]:
1637
+ """
1638
+ Returns subscription balances
1639
+
1640
+ Parameters
1641
+ ----------
1642
+ pid : str
1643
+ Loyalty Program Id
1644
+
1645
+ cid : str
1646
+ Contact Id
1647
+
1648
+ request_options : typing.Optional[RequestOptions]
1649
+ Request-specific configuration.
1650
+
1651
+ Returns
1652
+ -------
1653
+ HttpResponse[GetSubscriptionBalancesResponse]
1654
+ Successful retrieval of contact balance
1655
+ """
1656
+ _response = self._client_wrapper.httpx_client.request(
1657
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/subscriptions/{jsonable_encoder(cid)}/balances",
1658
+ method="GET",
1659
+ request_options=request_options,
1660
+ )
1661
+ try:
1662
+ if 200 <= _response.status_code < 300:
1663
+ _data = typing.cast(
1664
+ GetSubscriptionBalancesResponse,
1665
+ construct_type(
1666
+ type_=GetSubscriptionBalancesResponse, # type: ignore
1667
+ object_=_response.json(),
1668
+ ),
1669
+ )
1670
+ return HttpResponse(response=_response, data=_data)
1671
+ if _response.status_code == 401:
1672
+ raise UnauthorizedError(
1673
+ headers=dict(_response.headers),
1674
+ body=typing.cast(
1675
+ typing.Any,
1676
+ construct_type(
1677
+ type_=typing.Any, # type: ignore
1678
+ object_=_response.json(),
1679
+ ),
1680
+ ),
1681
+ )
1682
+ if _response.status_code == 403:
1683
+ raise ForbiddenError(
1684
+ headers=dict(_response.headers),
1685
+ body=typing.cast(
1686
+ typing.Any,
1687
+ construct_type(
1688
+ type_=typing.Any, # type: ignore
1689
+ object_=_response.json(),
1690
+ ),
1691
+ ),
1692
+ )
1693
+ if _response.status_code == 404:
1694
+ raise NotFoundError(
1695
+ headers=dict(_response.headers),
1696
+ body=typing.cast(
1697
+ typing.Any,
1698
+ construct_type(
1699
+ type_=typing.Any, # type: ignore
1700
+ object_=_response.json(),
1701
+ ),
1702
+ ),
1703
+ )
1704
+ if _response.status_code == 422:
1705
+ raise UnprocessableEntityError(
1706
+ headers=dict(_response.headers),
1707
+ body=typing.cast(
1708
+ ErrorModel,
1709
+ construct_type(
1710
+ type_=ErrorModel, # type: ignore
1711
+ object_=_response.json(),
1712
+ ),
1713
+ ),
1714
+ )
1715
+ if _response.status_code == 500:
1716
+ raise InternalServerError(
1717
+ headers=dict(_response.headers),
1718
+ body=typing.cast(
1719
+ typing.Any,
1720
+ construct_type(
1721
+ type_=typing.Any, # type: ignore
1722
+ object_=_response.json(),
1723
+ ),
1724
+ ),
1725
+ )
1726
+ _response_json = _response.json()
1727
+ except JSONDecodeError:
1728
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1729
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1730
+
1731
+ def create_subscription_balances(
1732
+ self, pid: str, cid: str, *, balance_definition_id: str, request_options: typing.Optional[RequestOptions] = None
1733
+ ) -> HttpResponse[PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse]:
1734
+ """
1735
+ Creates a balance for a contact
1736
+
1737
+ Parameters
1738
+ ----------
1739
+ pid : str
1740
+ Loyalty Program Id
1741
+
1742
+ cid : str
1743
+ Contact Id
1744
+
1745
+ balance_definition_id : str
1746
+ Unique identifier (UUID) of the balance definition associated with the new balance.
1747
+
1748
+ request_options : typing.Optional[RequestOptions]
1749
+ Request-specific configuration.
1750
+
1751
+ Returns
1752
+ -------
1753
+ HttpResponse[PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse]
1754
+ Successful creation of balance
1755
+ """
1756
+ _response = self._client_wrapper.httpx_client.request(
1757
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/subscriptions/{jsonable_encoder(cid)}/balances",
1758
+ method="POST",
1759
+ json={
1760
+ "balanceDefinitionId": balance_definition_id,
1761
+ },
1762
+ headers={
1763
+ "content-type": "application/json",
1764
+ },
1765
+ request_options=request_options,
1766
+ omit=OMIT,
1767
+ )
1768
+ try:
1769
+ if 200 <= _response.status_code < 300:
1770
+ _data = typing.cast(
1771
+ PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse,
1772
+ construct_type(
1773
+ type_=PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse, # type: ignore
1774
+ object_=_response.json(),
1775
+ ),
1776
+ )
1777
+ return HttpResponse(response=_response, data=_data)
1778
+ if _response.status_code == 401:
1779
+ raise UnauthorizedError(
1780
+ headers=dict(_response.headers),
1781
+ body=typing.cast(
1782
+ typing.Any,
1783
+ construct_type(
1784
+ type_=typing.Any, # type: ignore
1785
+ object_=_response.json(),
1786
+ ),
1787
+ ),
1788
+ )
1789
+ if _response.status_code == 403:
1790
+ raise ForbiddenError(
1791
+ headers=dict(_response.headers),
1792
+ body=typing.cast(
1793
+ typing.Any,
1794
+ construct_type(
1795
+ type_=typing.Any, # type: ignore
1796
+ object_=_response.json(),
1797
+ ),
1798
+ ),
1799
+ )
1800
+ if _response.status_code == 404:
1801
+ raise NotFoundError(
1802
+ headers=dict(_response.headers),
1803
+ body=typing.cast(
1804
+ typing.Any,
1805
+ construct_type(
1806
+ type_=typing.Any, # type: ignore
1807
+ object_=_response.json(),
1808
+ ),
1809
+ ),
1810
+ )
1811
+ if _response.status_code == 422:
1812
+ raise UnprocessableEntityError(
1813
+ headers=dict(_response.headers),
1814
+ body=typing.cast(
1815
+ ErrorModel,
1816
+ construct_type(
1817
+ type_=ErrorModel, # type: ignore
1818
+ object_=_response.json(),
1819
+ ),
1820
+ ),
1821
+ )
1822
+ if _response.status_code == 500:
1823
+ raise InternalServerError(
1824
+ headers=dict(_response.headers),
1825
+ body=typing.cast(
1826
+ typing.Any,
1827
+ construct_type(
1828
+ type_=typing.Any, # type: ignore
1829
+ object_=_response.json(),
1830
+ ),
1831
+ ),
1832
+ )
1833
+ _response_json = _response.json()
1834
+ except JSONDecodeError:
1835
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1836
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1837
+
1838
+ def get_transaction_history_api(
1839
+ self,
1840
+ pid: str,
1841
+ *,
1842
+ contact_id: int,
1843
+ balance_definition_id: str,
1844
+ limit: typing.Optional[int] = None,
1845
+ offset: typing.Optional[int] = None,
1846
+ sort_field: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField] = None,
1847
+ sort: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort] = None,
1848
+ filters: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
1849
+ request_options: typing.Optional[RequestOptions] = None,
1850
+ ) -> HttpResponse[GetLoyaltyBalanceProgramsPidTransactionHistoryResponse]:
1851
+ """
1852
+ Returns transaction history
1853
+
1854
+ Parameters
1855
+ ----------
1856
+ pid : str
1857
+ Loyalty Program Id
1858
+
1859
+ contact_id : int
1860
+ Contact ID
1861
+
1862
+ balance_definition_id : str
1863
+ Balance Definition ID
1864
+
1865
+ limit : typing.Optional[int]
1866
+ Limit the number of records returned
1867
+
1868
+ offset : typing.Optional[int]
1869
+ Skip a number of records
1870
+
1871
+ sort_field : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField]
1872
+ Field to sort by
1873
+
1874
+ sort : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort]
1875
+ Sort order, either asc or desc
1876
+
1877
+ filters : typing.Optional[typing.Union[str, typing.Sequence[str]]]
1878
+ Filters to apply
1879
+
1880
+ request_options : typing.Optional[RequestOptions]
1881
+ Request-specific configuration.
1882
+
1883
+ Returns
1884
+ -------
1885
+ HttpResponse[GetLoyaltyBalanceProgramsPidTransactionHistoryResponse]
1886
+ Successful retrieval of transaction history
1887
+ """
1888
+ _response = self._client_wrapper.httpx_client.request(
1889
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transaction-history",
1890
+ method="GET",
1891
+ params={
1892
+ "limit": limit,
1893
+ "offset": offset,
1894
+ "sort_field": sort_field,
1895
+ "sort": sort,
1896
+ "contact_id": contact_id,
1897
+ "balance_definition_id": balance_definition_id,
1898
+ "filters": filters,
1899
+ },
1900
+ request_options=request_options,
1901
+ )
1902
+ try:
1903
+ if 200 <= _response.status_code < 300:
1904
+ _data = typing.cast(
1905
+ GetLoyaltyBalanceProgramsPidTransactionHistoryResponse,
1906
+ construct_type(
1907
+ type_=GetLoyaltyBalanceProgramsPidTransactionHistoryResponse, # type: ignore
1908
+ object_=_response.json(),
1909
+ ),
1910
+ )
1911
+ return HttpResponse(response=_response, data=_data)
1912
+ if _response.status_code == 401:
1913
+ raise UnauthorizedError(
1914
+ headers=dict(_response.headers),
1915
+ body=typing.cast(
1916
+ typing.Any,
1917
+ construct_type(
1918
+ type_=typing.Any, # type: ignore
1919
+ object_=_response.json(),
1920
+ ),
1921
+ ),
1922
+ )
1923
+ if _response.status_code == 403:
1924
+ raise ForbiddenError(
1925
+ headers=dict(_response.headers),
1926
+ body=typing.cast(
1927
+ typing.Any,
1928
+ construct_type(
1929
+ type_=typing.Any, # type: ignore
1930
+ object_=_response.json(),
1931
+ ),
1932
+ ),
1933
+ )
1934
+ if _response.status_code == 404:
1935
+ raise NotFoundError(
1936
+ headers=dict(_response.headers),
1937
+ body=typing.cast(
1938
+ typing.Any,
1939
+ construct_type(
1940
+ type_=typing.Any, # type: ignore
1941
+ object_=_response.json(),
1942
+ ),
1943
+ ),
1944
+ )
1945
+ if _response.status_code == 422:
1946
+ raise UnprocessableEntityError(
1947
+ headers=dict(_response.headers),
1948
+ body=typing.cast(
1949
+ ErrorModel,
1950
+ construct_type(
1951
+ type_=ErrorModel, # type: ignore
1952
+ object_=_response.json(),
1953
+ ),
1954
+ ),
1955
+ )
1956
+ if _response.status_code == 500:
1957
+ raise InternalServerError(
1958
+ headers=dict(_response.headers),
1959
+ body=typing.cast(
1960
+ typing.Any,
1961
+ construct_type(
1962
+ type_=typing.Any, # type: ignore
1963
+ object_=_response.json(),
1964
+ ),
1965
+ ),
1966
+ )
1967
+ _response_json = _response.json()
1968
+ except JSONDecodeError:
1969
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1970
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1971
+
1972
+ def begin_transaction(
1973
+ self,
1974
+ pid: str,
1975
+ *,
1976
+ amount: float,
1977
+ balance_definition_id: str,
1978
+ loyalty_subscription_id: typing.Optional[str] = OMIT,
1979
+ auto_complete: typing.Optional[bool] = OMIT,
1980
+ balance_expiry_in_minutes: typing.Optional[int] = OMIT,
1981
+ contact_id: typing.Optional[int] = OMIT,
1982
+ event_time: typing.Optional[str] = OMIT,
1983
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
1984
+ ttl: typing.Optional[int] = OMIT,
1985
+ request_options: typing.Optional[RequestOptions] = None,
1986
+ ) -> HttpResponse[Transaction]:
1987
+ """
1988
+ Creates new transaction and returns information
1989
+
1990
+ Parameters
1991
+ ----------
1992
+ pid : str
1993
+ Loyalty Program Id
1994
+
1995
+ amount : float
1996
+ Transaction amount (must be provided).
1997
+
1998
+ balance_definition_id : str
1999
+ Unique identifier (UUID) of the associated balance definition.
2000
+
2001
+ loyalty_subscription_id : typing.Optional[str]
2002
+ Unique identifier for the loyalty subscription (required unless `contactId` is provided).
2003
+
2004
+ auto_complete : typing.Optional[bool]
2005
+ Whether the transaction should be automatically completed.
2006
+
2007
+ balance_expiry_in_minutes : typing.Optional[int]
2008
+ Optional expiry time for the balance in minutes (must be greater than 0 if provided).
2009
+
2010
+ contact_id : typing.Optional[int]
2011
+ Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided).
2012
+
2013
+ event_time : typing.Optional[str]
2014
+ Optional timestamp specifying when the transaction occurred.
2015
+
2016
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
2017
+ Optional metadata associated with the transaction.
2018
+
2019
+ ttl : typing.Optional[int]
2020
+ Optional time-to-live for the transaction (must be greater than 0 if provided).
2021
+
2022
+ request_options : typing.Optional[RequestOptions]
2023
+ Request-specific configuration.
2024
+
2025
+ Returns
2026
+ -------
2027
+ HttpResponse[Transaction]
2028
+ Transaction information
2029
+ """
2030
+ _response = self._client_wrapper.httpx_client.request(
2031
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions",
2032
+ method="POST",
2033
+ json={
2034
+ "LoyaltySubscriptionId": loyalty_subscription_id,
2035
+ "amount": amount,
2036
+ "autoComplete": auto_complete,
2037
+ "balanceDefinitionId": balance_definition_id,
2038
+ "balanceExpiryInMinutes": balance_expiry_in_minutes,
2039
+ "contactId": contact_id,
2040
+ "eventTime": event_time,
2041
+ "meta": meta,
2042
+ "ttl": ttl,
2043
+ },
2044
+ headers={
2045
+ "content-type": "application/json",
2046
+ },
2047
+ request_options=request_options,
2048
+ omit=OMIT,
2049
+ )
2050
+ try:
2051
+ if 200 <= _response.status_code < 300:
2052
+ _data = typing.cast(
2053
+ Transaction,
2054
+ construct_type(
2055
+ type_=Transaction, # type: ignore
2056
+ object_=_response.json(),
2057
+ ),
2058
+ )
2059
+ return HttpResponse(response=_response, data=_data)
2060
+ if _response.status_code == 401:
2061
+ raise UnauthorizedError(
2062
+ headers=dict(_response.headers),
2063
+ body=typing.cast(
2064
+ typing.Any,
2065
+ construct_type(
2066
+ type_=typing.Any, # type: ignore
2067
+ object_=_response.json(),
2068
+ ),
2069
+ ),
2070
+ )
2071
+ if _response.status_code == 403:
2072
+ raise ForbiddenError(
2073
+ headers=dict(_response.headers),
2074
+ body=typing.cast(
2075
+ typing.Any,
2076
+ construct_type(
2077
+ type_=typing.Any, # type: ignore
2078
+ object_=_response.json(),
2079
+ ),
2080
+ ),
2081
+ )
2082
+ if _response.status_code == 404:
2083
+ raise NotFoundError(
2084
+ headers=dict(_response.headers),
2085
+ body=typing.cast(
2086
+ typing.Any,
2087
+ construct_type(
2088
+ type_=typing.Any, # type: ignore
2089
+ object_=_response.json(),
2090
+ ),
2091
+ ),
2092
+ )
2093
+ if _response.status_code == 422:
2094
+ raise UnprocessableEntityError(
2095
+ headers=dict(_response.headers),
2096
+ body=typing.cast(
2097
+ ErrorModel,
2098
+ construct_type(
2099
+ type_=ErrorModel, # type: ignore
2100
+ object_=_response.json(),
2101
+ ),
2102
+ ),
2103
+ )
2104
+ if _response.status_code == 500:
2105
+ raise InternalServerError(
2106
+ headers=dict(_response.headers),
2107
+ body=typing.cast(
2108
+ typing.Any,
2109
+ construct_type(
2110
+ type_=typing.Any, # type: ignore
2111
+ object_=_response.json(),
2112
+ ),
2113
+ ),
2114
+ )
2115
+ _response_json = _response.json()
2116
+ except JSONDecodeError:
2117
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2118
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2119
+
2120
+ def cancel_transaction(
2121
+ self, pid: str, tid: str, *, request_options: typing.Optional[RequestOptions] = None
2122
+ ) -> HttpResponse[Transaction]:
2123
+ """
2124
+ Cancels transaction
2125
+
2126
+ Parameters
2127
+ ----------
2128
+ pid : str
2129
+ Loyalty Program Id
2130
+
2131
+ tid : str
2132
+ Transaction Id
2133
+
2134
+ request_options : typing.Optional[RequestOptions]
2135
+ Request-specific configuration.
2136
+
2137
+ Returns
2138
+ -------
2139
+ HttpResponse[Transaction]
2140
+ Transaction information
2141
+ """
2142
+ _response = self._client_wrapper.httpx_client.request(
2143
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions/{jsonable_encoder(tid)}/cancel",
2144
+ method="POST",
2145
+ request_options=request_options,
2146
+ )
2147
+ try:
2148
+ if 200 <= _response.status_code < 300:
2149
+ _data = typing.cast(
2150
+ Transaction,
2151
+ construct_type(
2152
+ type_=Transaction, # type: ignore
2153
+ object_=_response.json(),
2154
+ ),
2155
+ )
2156
+ return HttpResponse(response=_response, data=_data)
2157
+ if _response.status_code == 401:
2158
+ raise UnauthorizedError(
2159
+ headers=dict(_response.headers),
2160
+ body=typing.cast(
2161
+ typing.Any,
2162
+ construct_type(
2163
+ type_=typing.Any, # type: ignore
2164
+ object_=_response.json(),
2165
+ ),
2166
+ ),
2167
+ )
2168
+ if _response.status_code == 403:
2169
+ raise ForbiddenError(
2170
+ headers=dict(_response.headers),
2171
+ body=typing.cast(
2172
+ typing.Any,
2173
+ construct_type(
2174
+ type_=typing.Any, # type: ignore
2175
+ object_=_response.json(),
2176
+ ),
2177
+ ),
2178
+ )
2179
+ if _response.status_code == 404:
2180
+ raise NotFoundError(
2181
+ headers=dict(_response.headers),
2182
+ body=typing.cast(
2183
+ typing.Any,
2184
+ construct_type(
2185
+ type_=typing.Any, # type: ignore
2186
+ object_=_response.json(),
2187
+ ),
2188
+ ),
2189
+ )
2190
+ if _response.status_code == 422:
2191
+ raise UnprocessableEntityError(
2192
+ headers=dict(_response.headers),
2193
+ body=typing.cast(
2194
+ ErrorModel,
2195
+ construct_type(
2196
+ type_=ErrorModel, # type: ignore
2197
+ object_=_response.json(),
2198
+ ),
2199
+ ),
2200
+ )
2201
+ if _response.status_code == 500:
2202
+ raise InternalServerError(
2203
+ headers=dict(_response.headers),
2204
+ body=typing.cast(
2205
+ typing.Any,
2206
+ construct_type(
2207
+ type_=typing.Any, # type: ignore
2208
+ object_=_response.json(),
2209
+ ),
2210
+ ),
2211
+ )
2212
+ _response_json = _response.json()
2213
+ except JSONDecodeError:
2214
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2215
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2216
+
2217
+ def complete_transaction(
2218
+ self, pid: str, tid: str, *, request_options: typing.Optional[RequestOptions] = None
2219
+ ) -> HttpResponse[Transaction]:
2220
+ """
2221
+ Completes transaction
2222
+
2223
+ Parameters
2224
+ ----------
2225
+ pid : str
2226
+ Loyalty Program Id
2227
+
2228
+ tid : str
2229
+ Transaction Id
2230
+
2231
+ request_options : typing.Optional[RequestOptions]
2232
+ Request-specific configuration.
2233
+
2234
+ Returns
2235
+ -------
2236
+ HttpResponse[Transaction]
2237
+ Transaction information
2238
+ """
2239
+ _response = self._client_wrapper.httpx_client.request(
2240
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions/{jsonable_encoder(tid)}/complete",
2241
+ method="POST",
2242
+ request_options=request_options,
2243
+ )
2244
+ try:
2245
+ if 200 <= _response.status_code < 300:
2246
+ _data = typing.cast(
2247
+ Transaction,
2248
+ construct_type(
2249
+ type_=Transaction, # type: ignore
2250
+ object_=_response.json(),
2251
+ ),
2252
+ )
2253
+ return HttpResponse(response=_response, data=_data)
2254
+ if _response.status_code == 401:
2255
+ raise UnauthorizedError(
2256
+ headers=dict(_response.headers),
2257
+ body=typing.cast(
2258
+ typing.Any,
2259
+ construct_type(
2260
+ type_=typing.Any, # type: ignore
2261
+ object_=_response.json(),
2262
+ ),
2263
+ ),
2264
+ )
2265
+ if _response.status_code == 403:
2266
+ raise ForbiddenError(
2267
+ headers=dict(_response.headers),
2268
+ body=typing.cast(
2269
+ typing.Any,
2270
+ construct_type(
2271
+ type_=typing.Any, # type: ignore
2272
+ object_=_response.json(),
2273
+ ),
2274
+ ),
2275
+ )
2276
+ if _response.status_code == 404:
2277
+ raise NotFoundError(
2278
+ headers=dict(_response.headers),
2279
+ body=typing.cast(
2280
+ typing.Any,
2281
+ construct_type(
2282
+ type_=typing.Any, # type: ignore
2283
+ object_=_response.json(),
2284
+ ),
2285
+ ),
2286
+ )
2287
+ if _response.status_code == 422:
2288
+ raise UnprocessableEntityError(
2289
+ headers=dict(_response.headers),
2290
+ body=typing.cast(
2291
+ ErrorModel,
2292
+ construct_type(
2293
+ type_=ErrorModel, # type: ignore
2294
+ object_=_response.json(),
2295
+ ),
2296
+ ),
2297
+ )
2298
+ if _response.status_code == 500:
2299
+ raise InternalServerError(
2300
+ headers=dict(_response.headers),
2301
+ body=typing.cast(
2302
+ typing.Any,
2303
+ construct_type(
2304
+ type_=typing.Any, # type: ignore
2305
+ object_=_response.json(),
2306
+ ),
2307
+ ),
2308
+ )
2309
+ _response_json = _response.json()
2310
+ except JSONDecodeError:
2311
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2312
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2313
+
2314
+
2315
+ class AsyncRawBalanceClient:
2316
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
2317
+ self._client_wrapper = client_wrapper
2318
+
2319
+ async def get_active_balances_api(
2320
+ self,
2321
+ pid: str,
2322
+ *,
2323
+ contact_id: int,
2324
+ balance_definition_id: str,
2325
+ limit: typing.Optional[int] = None,
2326
+ offset: typing.Optional[int] = None,
2327
+ sort_field: typing.Optional[str] = None,
2328
+ sort: typing.Optional[str] = None,
2329
+ request_options: typing.Optional[RequestOptions] = None,
2330
+ ) -> AsyncHttpResponse[BalanceLimit]:
2331
+ """
2332
+ Returns Active Balances
2333
+
2334
+ Parameters
2335
+ ----------
2336
+ pid : str
2337
+ Loyalty Program Id
2338
+
2339
+ contact_id : int
2340
+ Contact ID
2341
+
2342
+ balance_definition_id : str
2343
+ Balance Definition ID
2344
+
2345
+ limit : typing.Optional[int]
2346
+ Limit
2347
+
2348
+ offset : typing.Optional[int]
2349
+ Offset
2350
+
2351
+ sort_field : typing.Optional[str]
2352
+ Sort Field
2353
+
2354
+ sort : typing.Optional[str]
2355
+ Sort Order
2356
+
2357
+ request_options : typing.Optional[RequestOptions]
2358
+ Request-specific configuration.
2359
+
2360
+ Returns
2361
+ -------
2362
+ AsyncHttpResponse[BalanceLimit]
2363
+ Successful retrieval of active balance
2364
+ """
2365
+ _response = await self._client_wrapper.httpx_client.request(
2366
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/active-balance",
2367
+ method="GET",
2368
+ params={
2369
+ "limit": limit,
2370
+ "offset": offset,
2371
+ "sort_field": sort_field,
2372
+ "sort": sort,
2373
+ "contact_id": contact_id,
2374
+ "balance_definition_id": balance_definition_id,
2375
+ },
2376
+ request_options=request_options,
2377
+ )
2378
+ try:
2379
+ if 200 <= _response.status_code < 300:
2380
+ _data = typing.cast(
2381
+ BalanceLimit,
2382
+ construct_type(
2383
+ type_=BalanceLimit, # type: ignore
2384
+ object_=_response.json(),
2385
+ ),
2386
+ )
2387
+ return AsyncHttpResponse(response=_response, data=_data)
2388
+ if _response.status_code == 401:
2389
+ raise UnauthorizedError(
2390
+ headers=dict(_response.headers),
2391
+ body=typing.cast(
2392
+ typing.Any,
2393
+ construct_type(
2394
+ type_=typing.Any, # type: ignore
2395
+ object_=_response.json(),
2396
+ ),
2397
+ ),
2398
+ )
2399
+ if _response.status_code == 403:
2400
+ raise ForbiddenError(
2401
+ headers=dict(_response.headers),
2402
+ body=typing.cast(
2403
+ typing.Any,
2404
+ construct_type(
2405
+ type_=typing.Any, # type: ignore
2406
+ object_=_response.json(),
2407
+ ),
2408
+ ),
2409
+ )
2410
+ if _response.status_code == 404:
2411
+ raise NotFoundError(
2412
+ headers=dict(_response.headers),
2413
+ body=typing.cast(
2414
+ typing.Any,
2415
+ construct_type(
2416
+ type_=typing.Any, # type: ignore
2417
+ object_=_response.json(),
2418
+ ),
2419
+ ),
2420
+ )
2421
+ if _response.status_code == 422:
2422
+ raise UnprocessableEntityError(
2423
+ headers=dict(_response.headers),
2424
+ body=typing.cast(
2425
+ ErrorModel,
2426
+ construct_type(
2427
+ type_=ErrorModel, # type: ignore
2428
+ object_=_response.json(),
2429
+ ),
2430
+ ),
2431
+ )
2432
+ if _response.status_code == 500:
2433
+ raise InternalServerError(
2434
+ headers=dict(_response.headers),
2435
+ body=typing.cast(
2436
+ typing.Any,
2437
+ construct_type(
2438
+ type_=typing.Any, # type: ignore
2439
+ object_=_response.json(),
2440
+ ),
2441
+ ),
2442
+ )
2443
+ _response_json = _response.json()
2444
+ except JSONDecodeError:
2445
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2446
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2447
+
2448
+ async def get_balance_definition_list(
2449
+ self,
2450
+ pid: str,
2451
+ *,
2452
+ limit: typing.Optional[int] = None,
2453
+ offset: typing.Optional[int] = None,
2454
+ sort_field: typing.Optional[GetBalanceDefinitionListRequestSortField] = None,
2455
+ sort: typing.Optional[GetBalanceDefinitionListRequestSort] = None,
2456
+ version: typing.Optional[GetBalanceDefinitionListRequestVersion] = None,
2457
+ request_options: typing.Optional[RequestOptions] = None,
2458
+ ) -> AsyncHttpResponse[GetBalanceDefinitionListResponse]:
2459
+ """
2460
+ Returns balance definition page
2461
+
2462
+ Parameters
2463
+ ----------
2464
+ pid : str
2465
+ Loyalty Program Id
2466
+
2467
+ limit : typing.Optional[int]
2468
+ Limit the number of records returned
2469
+
2470
+ offset : typing.Optional[int]
2471
+ Offset to paginate records
2472
+
2473
+ sort_field : typing.Optional[GetBalanceDefinitionListRequestSortField]
2474
+ Field to sort by
2475
+
2476
+ sort : typing.Optional[GetBalanceDefinitionListRequestSort]
2477
+ Sort direction
2478
+
2479
+ version : typing.Optional[GetBalanceDefinitionListRequestVersion]
2480
+ Version
2481
+
2482
+ request_options : typing.Optional[RequestOptions]
2483
+ Request-specific configuration.
2484
+
2485
+ Returns
2486
+ -------
2487
+ AsyncHttpResponse[GetBalanceDefinitionListResponse]
2488
+ Successful retrieval of balance definition page
2489
+ """
2490
+ _response = await self._client_wrapper.httpx_client.request(
2491
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions",
2492
+ method="GET",
2493
+ params={
2494
+ "limit": limit,
2495
+ "offset": offset,
2496
+ "sortField": sort_field,
2497
+ "sort": sort,
2498
+ "version": version,
2499
+ },
2500
+ request_options=request_options,
2501
+ )
2502
+ try:
2503
+ if 200 <= _response.status_code < 300:
2504
+ _data = typing.cast(
2505
+ GetBalanceDefinitionListResponse,
2506
+ construct_type(
2507
+ type_=GetBalanceDefinitionListResponse, # type: ignore
2508
+ object_=_response.json(),
2509
+ ),
2510
+ )
2511
+ return AsyncHttpResponse(response=_response, data=_data)
2512
+ if _response.status_code == 401:
2513
+ raise UnauthorizedError(
2514
+ headers=dict(_response.headers),
2515
+ body=typing.cast(
2516
+ typing.Any,
2517
+ construct_type(
2518
+ type_=typing.Any, # type: ignore
2519
+ object_=_response.json(),
2520
+ ),
2521
+ ),
2522
+ )
2523
+ if _response.status_code == 403:
2524
+ raise ForbiddenError(
2525
+ headers=dict(_response.headers),
2526
+ body=typing.cast(
2527
+ typing.Any,
2528
+ construct_type(
2529
+ type_=typing.Any, # type: ignore
2530
+ object_=_response.json(),
2531
+ ),
2532
+ ),
2533
+ )
2534
+ if _response.status_code == 422:
2535
+ raise UnprocessableEntityError(
2536
+ headers=dict(_response.headers),
2537
+ body=typing.cast(
2538
+ ErrorModel,
2539
+ construct_type(
2540
+ type_=ErrorModel, # type: ignore
2541
+ object_=_response.json(),
2542
+ ),
2543
+ ),
2544
+ )
2545
+ if _response.status_code == 500:
2546
+ raise InternalServerError(
2547
+ headers=dict(_response.headers),
2548
+ body=typing.cast(
2549
+ typing.Any,
2550
+ construct_type(
2551
+ type_=typing.Any, # type: ignore
2552
+ object_=_response.json(),
2553
+ ),
2554
+ ),
2555
+ )
2556
+ _response_json = _response.json()
2557
+ except JSONDecodeError:
2558
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2559
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2560
+
2561
+ async def create_balance_definition(
2562
+ self,
2563
+ pid: str,
2564
+ *,
2565
+ name: str,
2566
+ unit: PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestUnit,
2567
+ balance_availability_duration_modifier: typing.Optional[
2568
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier
2569
+ ] = OMIT,
2570
+ balance_availability_duration_unit: typing.Optional[
2571
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationUnit
2572
+ ] = OMIT,
2573
+ balance_availability_duration_value: typing.Optional[int] = OMIT,
2574
+ balance_expiration_date: typing.Optional[dt.date] = OMIT,
2575
+ balance_option_amount_overtaking_strategy: typing.Optional[
2576
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionAmountOvertakingStrategy
2577
+ ] = OMIT,
2578
+ balance_option_credit_rounding: typing.Optional[
2579
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionCreditRounding
2580
+ ] = OMIT,
2581
+ balance_option_debit_rounding: typing.Optional[
2582
+ PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionDebitRounding
2583
+ ] = OMIT,
2584
+ description: typing.Optional[str] = OMIT,
2585
+ image_ref: typing.Optional[str] = OMIT,
2586
+ max_amount: typing.Optional[float] = OMIT,
2587
+ max_credit_amount_limit: typing.Optional[float] = OMIT,
2588
+ max_debit_amount_limit: typing.Optional[float] = OMIT,
2589
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
2590
+ min_amount: typing.Optional[float] = OMIT,
2591
+ request_options: typing.Optional[RequestOptions] = None,
2592
+ ) -> AsyncHttpResponse[BalanceDefinition]:
2593
+ """
2594
+ Creates balance definition and returns information
2595
+
2596
+ Parameters
2597
+ ----------
2598
+ pid : str
2599
+ Loyalty Program Id
2600
+
2601
+ name : str
2602
+ Name of the balance definition.
2603
+
2604
+ unit : PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestUnit
2605
+ Unit of balance measurement.
2606
+
2607
+ balance_availability_duration_modifier : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier]
2608
+ Defines when the balance expires within the selected duration.
2609
+
2610
+ balance_availability_duration_unit : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationUnit]
2611
+ Unit of time for balance validity.
2612
+
2613
+ balance_availability_duration_value : typing.Optional[int]
2614
+ Number of time units before the balance expires.
2615
+
2616
+ balance_expiration_date : typing.Optional[dt.date]
2617
+ Fixed expiration date (`dd/mm` format) as an alternative to duration-based expiry.
2618
+
2619
+ balance_option_amount_overtaking_strategy : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionAmountOvertakingStrategy]
2620
+ Defines whether partial credit is allowed when reaching max balance.
2621
+
2622
+ balance_option_credit_rounding : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionCreditRounding]
2623
+ Defines rounding strategy for credit transactions.
2624
+
2625
+ balance_option_debit_rounding : typing.Optional[PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceOptionDebitRounding]
2626
+ Defines rounding strategy for debit transactions.
2627
+
2628
+ description : typing.Optional[str]
2629
+ Short description of the balance definition.
2630
+
2631
+ image_ref : typing.Optional[str]
2632
+ URL of an optional image reference.
2633
+
2634
+ max_amount : typing.Optional[float]
2635
+ Maximum allowable balance amount.
2636
+
2637
+ max_credit_amount_limit : typing.Optional[float]
2638
+ Maximum credit allowed per operation.
2639
+
2640
+ max_debit_amount_limit : typing.Optional[float]
2641
+ Maximum debit allowed per operation.
2642
+
2643
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
2644
+ Additional metadata for the balance definition.
2645
+
2646
+ min_amount : typing.Optional[float]
2647
+ Minimum allowable balance amount.
2648
+
2649
+ request_options : typing.Optional[RequestOptions]
2650
+ Request-specific configuration.
2651
+
2652
+ Returns
2653
+ -------
2654
+ AsyncHttpResponse[BalanceDefinition]
2655
+ Successful creation of balance definition
2656
+ """
2657
+ _response = await self._client_wrapper.httpx_client.request(
2658
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions",
2659
+ method="POST",
2660
+ json={
2661
+ "balanceAvailabilityDurationModifier": balance_availability_duration_modifier,
2662
+ "balanceAvailabilityDurationUnit": balance_availability_duration_unit,
2663
+ "balanceAvailabilityDurationValue": balance_availability_duration_value,
2664
+ "balanceExpirationDate": balance_expiration_date,
2665
+ "balanceOptionAmountOvertakingStrategy": balance_option_amount_overtaking_strategy,
2666
+ "balanceOptionCreditRounding": balance_option_credit_rounding,
2667
+ "balanceOptionDebitRounding": balance_option_debit_rounding,
2668
+ "description": description,
2669
+ "imageRef": image_ref,
2670
+ "maxAmount": max_amount,
2671
+ "maxCreditAmountLimit": max_credit_amount_limit,
2672
+ "maxDebitAmountLimit": max_debit_amount_limit,
2673
+ "meta": meta,
2674
+ "minAmount": min_amount,
2675
+ "name": name,
2676
+ "unit": unit,
2677
+ },
2678
+ headers={
2679
+ "content-type": "application/json",
2680
+ },
2681
+ request_options=request_options,
2682
+ omit=OMIT,
2683
+ )
2684
+ try:
2685
+ if 200 <= _response.status_code < 300:
2686
+ _data = typing.cast(
2687
+ BalanceDefinition,
2688
+ construct_type(
2689
+ type_=BalanceDefinition, # type: ignore
2690
+ object_=_response.json(),
2691
+ ),
2692
+ )
2693
+ return AsyncHttpResponse(response=_response, data=_data)
2694
+ if _response.status_code == 401:
2695
+ raise UnauthorizedError(
2696
+ headers=dict(_response.headers),
2697
+ body=typing.cast(
2698
+ typing.Any,
2699
+ construct_type(
2700
+ type_=typing.Any, # type: ignore
2701
+ object_=_response.json(),
2702
+ ),
2703
+ ),
2704
+ )
2705
+ if _response.status_code == 403:
2706
+ raise ForbiddenError(
2707
+ headers=dict(_response.headers),
2708
+ body=typing.cast(
2709
+ typing.Any,
2710
+ construct_type(
2711
+ type_=typing.Any, # type: ignore
2712
+ object_=_response.json(),
2713
+ ),
2714
+ ),
2715
+ )
2716
+ if _response.status_code == 404:
2717
+ raise NotFoundError(
2718
+ headers=dict(_response.headers),
2719
+ body=typing.cast(
2720
+ typing.Any,
2721
+ construct_type(
2722
+ type_=typing.Any, # type: ignore
2723
+ object_=_response.json(),
2724
+ ),
2725
+ ),
2726
+ )
2727
+ if _response.status_code == 422:
2728
+ raise UnprocessableEntityError(
2729
+ headers=dict(_response.headers),
2730
+ body=typing.cast(
2731
+ ErrorModel,
2732
+ construct_type(
2733
+ type_=ErrorModel, # type: ignore
2734
+ object_=_response.json(),
2735
+ ),
2736
+ ),
2737
+ )
2738
+ if _response.status_code == 500:
2739
+ raise InternalServerError(
2740
+ headers=dict(_response.headers),
2741
+ body=typing.cast(
2742
+ typing.Any,
2743
+ construct_type(
2744
+ type_=typing.Any, # type: ignore
2745
+ object_=_response.json(),
2746
+ ),
2747
+ ),
2748
+ )
2749
+ _response_json = _response.json()
2750
+ except JSONDecodeError:
2751
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2752
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2753
+
2754
+ async def get_balance_definition(
2755
+ self,
2756
+ pid: str,
2757
+ bdid: str,
2758
+ *,
2759
+ version: typing.Optional[GetBalanceDefinitionRequestVersion] = None,
2760
+ request_options: typing.Optional[RequestOptions] = None,
2761
+ ) -> AsyncHttpResponse[BalanceDefinition]:
2762
+ """
2763
+ Returns balance definition
2764
+
2765
+ Parameters
2766
+ ----------
2767
+ pid : str
2768
+ Loyalty Program Id
2769
+
2770
+ bdid : str
2771
+ Balance Definition Id
2772
+
2773
+ version : typing.Optional[GetBalanceDefinitionRequestVersion]
2774
+ Version
2775
+
2776
+ request_options : typing.Optional[RequestOptions]
2777
+ Request-specific configuration.
2778
+
2779
+ Returns
2780
+ -------
2781
+ AsyncHttpResponse[BalanceDefinition]
2782
+ Successful retrieval of balance definition
2783
+ """
2784
+ _response = await self._client_wrapper.httpx_client.request(
2785
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}",
2786
+ method="GET",
2787
+ params={
2788
+ "version": version,
2789
+ },
2790
+ request_options=request_options,
2791
+ )
2792
+ try:
2793
+ if 200 <= _response.status_code < 300:
2794
+ _data = typing.cast(
2795
+ BalanceDefinition,
2796
+ construct_type(
2797
+ type_=BalanceDefinition, # type: ignore
2798
+ object_=_response.json(),
2799
+ ),
2800
+ )
2801
+ return AsyncHttpResponse(response=_response, data=_data)
2802
+ if _response.status_code == 401:
2803
+ raise UnauthorizedError(
2804
+ headers=dict(_response.headers),
2805
+ body=typing.cast(
2806
+ typing.Any,
2807
+ construct_type(
2808
+ type_=typing.Any, # type: ignore
2809
+ object_=_response.json(),
2810
+ ),
2811
+ ),
2812
+ )
2813
+ if _response.status_code == 403:
2814
+ raise ForbiddenError(
2815
+ headers=dict(_response.headers),
2816
+ body=typing.cast(
2817
+ typing.Any,
2818
+ construct_type(
2819
+ type_=typing.Any, # type: ignore
2820
+ object_=_response.json(),
2821
+ ),
2822
+ ),
2823
+ )
2824
+ if _response.status_code == 404:
2825
+ raise NotFoundError(
2826
+ headers=dict(_response.headers),
2827
+ body=typing.cast(
2828
+ typing.Any,
2829
+ construct_type(
2830
+ type_=typing.Any, # type: ignore
2831
+ object_=_response.json(),
2832
+ ),
2833
+ ),
2834
+ )
2835
+ if _response.status_code == 422:
2836
+ raise UnprocessableEntityError(
2837
+ headers=dict(_response.headers),
2838
+ body=typing.cast(
2839
+ ErrorModel,
2840
+ construct_type(
2841
+ type_=ErrorModel, # type: ignore
2842
+ object_=_response.json(),
2843
+ ),
2844
+ ),
2845
+ )
2846
+ if _response.status_code == 500:
2847
+ raise InternalServerError(
2848
+ headers=dict(_response.headers),
2849
+ body=typing.cast(
2850
+ typing.Any,
2851
+ construct_type(
2852
+ type_=typing.Any, # type: ignore
2853
+ object_=_response.json(),
2854
+ ),
2855
+ ),
2856
+ )
2857
+ _response_json = _response.json()
2858
+ except JSONDecodeError:
2859
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2860
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2861
+
2862
+ async def update_balance_definition(
2863
+ self,
2864
+ pid: str,
2865
+ bdid: str,
2866
+ *,
2867
+ name: str,
2868
+ unit: UpdateBalanceDefinitionRequestUnit,
2869
+ balance_availability_duration_modifier: typing.Optional[
2870
+ UpdateBalanceDefinitionRequestBalanceAvailabilityDurationModifier
2871
+ ] = OMIT,
2872
+ balance_availability_duration_unit: typing.Optional[
2873
+ UpdateBalanceDefinitionRequestBalanceAvailabilityDurationUnit
2874
+ ] = OMIT,
2875
+ balance_availability_duration_value: typing.Optional[int] = OMIT,
2876
+ balance_expiration_date: typing.Optional[str] = OMIT,
2877
+ balance_option_amount_overtaking_strategy: typing.Optional[
2878
+ UpdateBalanceDefinitionRequestBalanceOptionAmountOvertakingStrategy
2879
+ ] = OMIT,
2880
+ balance_option_credit_rounding: typing.Optional[
2881
+ UpdateBalanceDefinitionRequestBalanceOptionCreditRounding
2882
+ ] = OMIT,
2883
+ balance_option_debit_rounding: typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionDebitRounding] = OMIT,
2884
+ description: typing.Optional[str] = OMIT,
2885
+ image_ref: typing.Optional[str] = OMIT,
2886
+ max_amount: typing.Optional[float] = OMIT,
2887
+ max_credit_amount_limit: typing.Optional[float] = OMIT,
2888
+ max_debit_amount_limit: typing.Optional[float] = OMIT,
2889
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
2890
+ min_amount: typing.Optional[float] = OMIT,
2891
+ request_options: typing.Optional[RequestOptions] = None,
2892
+ ) -> AsyncHttpResponse[BalanceDefinition]:
2893
+ """
2894
+ Updates Balance definition
2895
+
2896
+ Parameters
2897
+ ----------
2898
+ pid : str
2899
+ Loyalty Program Id
2900
+
2901
+ bdid : str
2902
+ Balance Definition Id
2903
+
2904
+ name : str
2905
+ Name of the balance definition.
2906
+
2907
+ unit : UpdateBalanceDefinitionRequestUnit
2908
+ Unit of balance measurement.
2909
+
2910
+ balance_availability_duration_modifier : typing.Optional[UpdateBalanceDefinitionRequestBalanceAvailabilityDurationModifier]
2911
+ Defines when the balance expires within the selected duration.
2912
+
2913
+ balance_availability_duration_unit : typing.Optional[UpdateBalanceDefinitionRequestBalanceAvailabilityDurationUnit]
2914
+ Unit of time for balance validity.
2915
+
2916
+ balance_availability_duration_value : typing.Optional[int]
2917
+ Number of time units before the balance expires.
2918
+
2919
+ balance_expiration_date : typing.Optional[str]
2920
+ Expiration date (`dd/mm` format) or empty if not applicable.
2921
+
2922
+ balance_option_amount_overtaking_strategy : typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionAmountOvertakingStrategy]
2923
+ Defines whether partial credit is allowed when reaching max balance.
2924
+
2925
+ balance_option_credit_rounding : typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionCreditRounding]
2926
+ Rounding strategy for credit transactions.
2927
+
2928
+ balance_option_debit_rounding : typing.Optional[UpdateBalanceDefinitionRequestBalanceOptionDebitRounding]
2929
+ Rounding strategy for debit transactions.
2930
+
2931
+ description : typing.Optional[str]
2932
+ Short description of the balance definition.
2933
+
2934
+ image_ref : typing.Optional[str]
2935
+ URL of an optional image reference.
2936
+
2937
+ max_amount : typing.Optional[float]
2938
+ Maximum allowable balance amount.
2939
+
2940
+ max_credit_amount_limit : typing.Optional[float]
2941
+ Maximum credit allowed per operation.
2942
+
2943
+ max_debit_amount_limit : typing.Optional[float]
2944
+ Maximum debit allowed per operation.
2945
+
2946
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
2947
+ Optional metadata for the balance definition.
2948
+
2949
+ min_amount : typing.Optional[float]
2950
+ Minimum allowable balance amount.
2951
+
2952
+ request_options : typing.Optional[RequestOptions]
2953
+ Request-specific configuration.
2954
+
2955
+ Returns
2956
+ -------
2957
+ AsyncHttpResponse[BalanceDefinition]
2958
+ Successful update of balance definition
2959
+ """
2960
+ _response = await self._client_wrapper.httpx_client.request(
2961
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}",
2962
+ method="PUT",
2963
+ json={
2964
+ "balanceAvailabilityDurationModifier": balance_availability_duration_modifier,
2965
+ "balanceAvailabilityDurationUnit": balance_availability_duration_unit,
2966
+ "balanceAvailabilityDurationValue": balance_availability_duration_value,
2967
+ "balanceExpirationDate": balance_expiration_date,
2968
+ "balanceOptionAmountOvertakingStrategy": balance_option_amount_overtaking_strategy,
2969
+ "balanceOptionCreditRounding": balance_option_credit_rounding,
2970
+ "balanceOptionDebitRounding": balance_option_debit_rounding,
2971
+ "description": description,
2972
+ "imageRef": image_ref,
2973
+ "maxAmount": max_amount,
2974
+ "maxCreditAmountLimit": max_credit_amount_limit,
2975
+ "maxDebitAmountLimit": max_debit_amount_limit,
2976
+ "meta": meta,
2977
+ "minAmount": min_amount,
2978
+ "name": name,
2979
+ "unit": unit,
2980
+ },
2981
+ headers={
2982
+ "content-type": "application/json",
2983
+ },
2984
+ request_options=request_options,
2985
+ omit=OMIT,
2986
+ )
2987
+ try:
2988
+ if 200 <= _response.status_code < 300:
2989
+ _data = typing.cast(
2990
+ BalanceDefinition,
2991
+ construct_type(
2992
+ type_=BalanceDefinition, # type: ignore
2993
+ object_=_response.json(),
2994
+ ),
2995
+ )
2996
+ return AsyncHttpResponse(response=_response, data=_data)
2997
+ if _response.status_code == 401:
2998
+ raise UnauthorizedError(
2999
+ headers=dict(_response.headers),
3000
+ body=typing.cast(
3001
+ typing.Any,
3002
+ construct_type(
3003
+ type_=typing.Any, # type: ignore
3004
+ object_=_response.json(),
3005
+ ),
3006
+ ),
3007
+ )
3008
+ if _response.status_code == 403:
3009
+ raise ForbiddenError(
3010
+ headers=dict(_response.headers),
3011
+ body=typing.cast(
3012
+ typing.Any,
3013
+ construct_type(
3014
+ type_=typing.Any, # type: ignore
3015
+ object_=_response.json(),
3016
+ ),
3017
+ ),
3018
+ )
3019
+ if _response.status_code == 404:
3020
+ raise NotFoundError(
3021
+ headers=dict(_response.headers),
3022
+ body=typing.cast(
3023
+ typing.Any,
3024
+ construct_type(
3025
+ type_=typing.Any, # type: ignore
3026
+ object_=_response.json(),
3027
+ ),
3028
+ ),
3029
+ )
3030
+ if _response.status_code == 422:
3031
+ raise UnprocessableEntityError(
3032
+ headers=dict(_response.headers),
3033
+ body=typing.cast(
3034
+ ErrorModel,
3035
+ construct_type(
3036
+ type_=ErrorModel, # type: ignore
3037
+ object_=_response.json(),
3038
+ ),
3039
+ ),
3040
+ )
3041
+ if _response.status_code == 424:
3042
+ raise FailedDependencyError(
3043
+ headers=dict(_response.headers),
3044
+ body=typing.cast(
3045
+ typing.Any,
3046
+ construct_type(
3047
+ type_=typing.Any, # type: ignore
3048
+ object_=_response.json(),
3049
+ ),
3050
+ ),
3051
+ )
3052
+ if _response.status_code == 500:
3053
+ raise InternalServerError(
3054
+ headers=dict(_response.headers),
3055
+ body=typing.cast(
3056
+ typing.Any,
3057
+ construct_type(
3058
+ type_=typing.Any, # type: ignore
3059
+ object_=_response.json(),
3060
+ ),
3061
+ ),
3062
+ )
3063
+ _response_json = _response.json()
3064
+ except JSONDecodeError:
3065
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3066
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3067
+
3068
+ async def delete_balance_definition(
3069
+ self, pid: str, bdid: str, *, request_options: typing.Optional[RequestOptions] = None
3070
+ ) -> AsyncHttpResponse[None]:
3071
+ """
3072
+ Delete Balance definition
3073
+
3074
+ Parameters
3075
+ ----------
3076
+ pid : str
3077
+ Loyalty Program Id
3078
+
3079
+ bdid : str
3080
+ Balance Definition Id
3081
+
3082
+ request_options : typing.Optional[RequestOptions]
3083
+ Request-specific configuration.
3084
+
3085
+ Returns
3086
+ -------
3087
+ AsyncHttpResponse[None]
3088
+ """
3089
+ _response = await self._client_wrapper.httpx_client.request(
3090
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}",
3091
+ method="DELETE",
3092
+ request_options=request_options,
3093
+ )
3094
+ try:
3095
+ if 200 <= _response.status_code < 300:
3096
+ return AsyncHttpResponse(response=_response, data=None)
3097
+ if _response.status_code == 401:
3098
+ raise UnauthorizedError(
3099
+ headers=dict(_response.headers),
3100
+ body=typing.cast(
3101
+ typing.Any,
3102
+ construct_type(
3103
+ type_=typing.Any, # type: ignore
3104
+ object_=_response.json(),
3105
+ ),
3106
+ ),
3107
+ )
3108
+ if _response.status_code == 403:
3109
+ raise ForbiddenError(
3110
+ headers=dict(_response.headers),
3111
+ body=typing.cast(
3112
+ typing.Any,
3113
+ construct_type(
3114
+ type_=typing.Any, # type: ignore
3115
+ object_=_response.json(),
3116
+ ),
3117
+ ),
3118
+ )
3119
+ if _response.status_code == 404:
3120
+ raise NotFoundError(
3121
+ headers=dict(_response.headers),
3122
+ body=typing.cast(
3123
+ typing.Any,
3124
+ construct_type(
3125
+ type_=typing.Any, # type: ignore
3126
+ object_=_response.json(),
3127
+ ),
3128
+ ),
3129
+ )
3130
+ if _response.status_code == 422:
3131
+ raise UnprocessableEntityError(
3132
+ headers=dict(_response.headers),
3133
+ body=typing.cast(
3134
+ ErrorModel,
3135
+ construct_type(
3136
+ type_=ErrorModel, # type: ignore
3137
+ object_=_response.json(),
3138
+ ),
3139
+ ),
3140
+ )
3141
+ if _response.status_code == 500:
3142
+ raise InternalServerError(
3143
+ headers=dict(_response.headers),
3144
+ body=typing.cast(
3145
+ typing.Any,
3146
+ construct_type(
3147
+ type_=typing.Any, # type: ignore
3148
+ object_=_response.json(),
3149
+ ),
3150
+ ),
3151
+ )
3152
+ _response_json = _response.json()
3153
+ except JSONDecodeError:
3154
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3155
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3156
+
3157
+ async def create_balance_limit(
3158
+ self,
3159
+ pid: str,
3160
+ bdid: str,
3161
+ *,
3162
+ constraint_type: CreateBalanceLimitRequestConstraintType,
3163
+ duration_unit: CreateBalanceLimitRequestDurationUnit,
3164
+ duration_value: int,
3165
+ transaction_type: CreateBalanceLimitRequestTransactionType,
3166
+ value: int,
3167
+ sliding_schedule: typing.Optional[bool] = OMIT,
3168
+ request_options: typing.Optional[RequestOptions] = None,
3169
+ ) -> AsyncHttpResponse[BalanceLimit]:
3170
+ """
3171
+ Creates balance limit and sends the created UUID along with the data
3172
+
3173
+ Parameters
3174
+ ----------
3175
+ pid : str
3176
+ Loyalty Program Id
3177
+
3178
+ bdid : str
3179
+ Balance Definition Id
3180
+
3181
+ constraint_type : CreateBalanceLimitRequestConstraintType
3182
+ Defines whether the limit applies to transaction count or amount.
3183
+
3184
+ duration_unit : CreateBalanceLimitRequestDurationUnit
3185
+ Unit of time for which the limit is applicable.
3186
+
3187
+ duration_value : int
3188
+ Number of time units for the balance limit.
3189
+
3190
+ transaction_type : CreateBalanceLimitRequestTransactionType
3191
+ Specifies whether the limit applies to credit or debit transactions.
3192
+
3193
+ value : int
3194
+ Maximum allowed value for the specified constraint type.
3195
+
3196
+ sliding_schedule : typing.Optional[bool]
3197
+ Determines if the limit resets on a rolling schedule.
3198
+
3199
+ request_options : typing.Optional[RequestOptions]
3200
+ Request-specific configuration.
3201
+
3202
+ Returns
3203
+ -------
3204
+ AsyncHttpResponse[BalanceLimit]
3205
+ Successful creation of balance limit
3206
+ """
3207
+ _response = await self._client_wrapper.httpx_client.request(
3208
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits",
3209
+ method="POST",
3210
+ json={
3211
+ "constraintType": constraint_type,
3212
+ "durationUnit": duration_unit,
3213
+ "durationValue": duration_value,
3214
+ "slidingSchedule": sliding_schedule,
3215
+ "transactionType": transaction_type,
3216
+ "value": value,
3217
+ },
3218
+ headers={
3219
+ "content-type": "application/json",
3220
+ },
3221
+ request_options=request_options,
3222
+ omit=OMIT,
3223
+ )
3224
+ try:
3225
+ if 200 <= _response.status_code < 300:
3226
+ _data = typing.cast(
3227
+ BalanceLimit,
3228
+ construct_type(
3229
+ type_=BalanceLimit, # type: ignore
3230
+ object_=_response.json(),
3231
+ ),
3232
+ )
3233
+ return AsyncHttpResponse(response=_response, data=_data)
3234
+ if _response.status_code == 401:
3235
+ raise UnauthorizedError(
3236
+ headers=dict(_response.headers),
3237
+ body=typing.cast(
3238
+ typing.Any,
3239
+ construct_type(
3240
+ type_=typing.Any, # type: ignore
3241
+ object_=_response.json(),
3242
+ ),
3243
+ ),
3244
+ )
3245
+ if _response.status_code == 403:
3246
+ raise ForbiddenError(
3247
+ headers=dict(_response.headers),
3248
+ body=typing.cast(
3249
+ typing.Any,
3250
+ construct_type(
3251
+ type_=typing.Any, # type: ignore
3252
+ object_=_response.json(),
3253
+ ),
3254
+ ),
3255
+ )
3256
+ if _response.status_code == 422:
3257
+ raise UnprocessableEntityError(
3258
+ headers=dict(_response.headers),
3259
+ body=typing.cast(
3260
+ ErrorModel,
3261
+ construct_type(
3262
+ type_=ErrorModel, # type: ignore
3263
+ object_=_response.json(),
3264
+ ),
3265
+ ),
3266
+ )
3267
+ if _response.status_code == 424:
3268
+ raise FailedDependencyError(
3269
+ headers=dict(_response.headers),
3270
+ body=typing.cast(
3271
+ typing.Any,
3272
+ construct_type(
3273
+ type_=typing.Any, # type: ignore
3274
+ object_=_response.json(),
3275
+ ),
3276
+ ),
3277
+ )
3278
+ if _response.status_code == 500:
3279
+ raise InternalServerError(
3280
+ headers=dict(_response.headers),
3281
+ body=typing.cast(
3282
+ typing.Any,
3283
+ construct_type(
3284
+ type_=typing.Any, # type: ignore
3285
+ object_=_response.json(),
3286
+ ),
3287
+ ),
3288
+ )
3289
+ _response_json = _response.json()
3290
+ except JSONDecodeError:
3291
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3292
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3293
+
3294
+ async def get_balance_limit(
3295
+ self,
3296
+ pid: str,
3297
+ bdid: str,
3298
+ blid: str,
3299
+ *,
3300
+ version: typing.Optional[GetBalanceLimitRequestVersion] = None,
3301
+ request_options: typing.Optional[RequestOptions] = None,
3302
+ ) -> AsyncHttpResponse[BalanceLimit]:
3303
+ """
3304
+ Fetches balance limits and send the created UUID along with the data
3305
+
3306
+ Parameters
3307
+ ----------
3308
+ pid : str
3309
+ Loyalty Program Id
3310
+
3311
+ bdid : str
3312
+ Balance Definition Id
3313
+
3314
+ blid : str
3315
+ Balance Limit Id
3316
+
3317
+ version : typing.Optional[GetBalanceLimitRequestVersion]
3318
+ Version
3319
+
3320
+ request_options : typing.Optional[RequestOptions]
3321
+ Request-specific configuration.
3322
+
3323
+ Returns
3324
+ -------
3325
+ AsyncHttpResponse[BalanceLimit]
3326
+ Successful retrieval of balance limit
3327
+ """
3328
+ _response = await self._client_wrapper.httpx_client.request(
3329
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits/{jsonable_encoder(blid)}",
3330
+ method="GET",
3331
+ params={
3332
+ "version": version,
3333
+ },
3334
+ request_options=request_options,
3335
+ )
3336
+ try:
3337
+ if 200 <= _response.status_code < 300:
3338
+ _data = typing.cast(
3339
+ BalanceLimit,
3340
+ construct_type(
3341
+ type_=BalanceLimit, # type: ignore
3342
+ object_=_response.json(),
3343
+ ),
3344
+ )
3345
+ return AsyncHttpResponse(response=_response, data=_data)
3346
+ if _response.status_code == 401:
3347
+ raise UnauthorizedError(
3348
+ headers=dict(_response.headers),
3349
+ body=typing.cast(
3350
+ typing.Any,
3351
+ construct_type(
3352
+ type_=typing.Any, # type: ignore
3353
+ object_=_response.json(),
3354
+ ),
3355
+ ),
3356
+ )
3357
+ if _response.status_code == 403:
3358
+ raise ForbiddenError(
3359
+ headers=dict(_response.headers),
3360
+ body=typing.cast(
3361
+ typing.Any,
3362
+ construct_type(
3363
+ type_=typing.Any, # type: ignore
3364
+ object_=_response.json(),
3365
+ ),
3366
+ ),
3367
+ )
3368
+ if _response.status_code == 404:
3369
+ raise NotFoundError(
3370
+ headers=dict(_response.headers),
3371
+ body=typing.cast(
3372
+ typing.Any,
3373
+ construct_type(
3374
+ type_=typing.Any, # type: ignore
3375
+ object_=_response.json(),
3376
+ ),
3377
+ ),
3378
+ )
3379
+ if _response.status_code == 422:
3380
+ raise UnprocessableEntityError(
3381
+ headers=dict(_response.headers),
3382
+ body=typing.cast(
3383
+ ErrorModel,
3384
+ construct_type(
3385
+ type_=ErrorModel, # type: ignore
3386
+ object_=_response.json(),
3387
+ ),
3388
+ ),
3389
+ )
3390
+ if _response.status_code == 500:
3391
+ raise InternalServerError(
3392
+ headers=dict(_response.headers),
3393
+ body=typing.cast(
3394
+ typing.Any,
3395
+ construct_type(
3396
+ type_=typing.Any, # type: ignore
3397
+ object_=_response.json(),
3398
+ ),
3399
+ ),
3400
+ )
3401
+ _response_json = _response.json()
3402
+ except JSONDecodeError:
3403
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3404
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3405
+
3406
+ async def update_balance_limit(
3407
+ self,
3408
+ pid: str,
3409
+ bdid: str,
3410
+ blid: str,
3411
+ *,
3412
+ constraint_type: UpdateBalanceLimitRequestConstraintType,
3413
+ duration_unit: UpdateBalanceLimitRequestDurationUnit,
3414
+ duration_value: int,
3415
+ transaction_type: UpdateBalanceLimitRequestTransactionType,
3416
+ value: int,
3417
+ sliding_schedule: typing.Optional[bool] = OMIT,
3418
+ request_options: typing.Optional[RequestOptions] = None,
3419
+ ) -> AsyncHttpResponse[BalanceLimit]:
3420
+ """
3421
+ Updates balance limit
3422
+
3423
+ Parameters
3424
+ ----------
3425
+ pid : str
3426
+ Loyalty Program Id
3427
+
3428
+ bdid : str
3429
+ Balance Definition Id
3430
+
3431
+ blid : str
3432
+ Balance Limit Id
3433
+
3434
+ constraint_type : UpdateBalanceLimitRequestConstraintType
3435
+ Defines whether the limit applies to transaction count or amount.
3436
+
3437
+ duration_unit : UpdateBalanceLimitRequestDurationUnit
3438
+ Unit of time for which the limit is applicable.
3439
+
3440
+ duration_value : int
3441
+ Number of time units for the balance limit.
3442
+
3443
+ transaction_type : UpdateBalanceLimitRequestTransactionType
3444
+ Specifies whether the limit applies to credit or debit transactions.
3445
+
3446
+ value : int
3447
+ Maximum allowed value for the specified constraint type.
3448
+
3449
+ sliding_schedule : typing.Optional[bool]
3450
+ Determines if the limit resets on a rolling schedule.
3451
+
3452
+ request_options : typing.Optional[RequestOptions]
3453
+ Request-specific configuration.
3454
+
3455
+ Returns
3456
+ -------
3457
+ AsyncHttpResponse[BalanceLimit]
3458
+ Successful update of balance limit
3459
+ """
3460
+ _response = await self._client_wrapper.httpx_client.request(
3461
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits/{jsonable_encoder(blid)}",
3462
+ method="PUT",
3463
+ json={
3464
+ "constraintType": constraint_type,
3465
+ "durationUnit": duration_unit,
3466
+ "durationValue": duration_value,
3467
+ "slidingSchedule": sliding_schedule,
3468
+ "transactionType": transaction_type,
3469
+ "value": value,
3470
+ },
3471
+ headers={
3472
+ "content-type": "application/json",
3473
+ },
3474
+ request_options=request_options,
3475
+ omit=OMIT,
3476
+ )
3477
+ try:
3478
+ if 200 <= _response.status_code < 300:
3479
+ _data = typing.cast(
3480
+ BalanceLimit,
3481
+ construct_type(
3482
+ type_=BalanceLimit, # type: ignore
3483
+ object_=_response.json(),
3484
+ ),
3485
+ )
3486
+ return AsyncHttpResponse(response=_response, data=_data)
3487
+ if _response.status_code == 401:
3488
+ raise UnauthorizedError(
3489
+ headers=dict(_response.headers),
3490
+ body=typing.cast(
3491
+ typing.Any,
3492
+ construct_type(
3493
+ type_=typing.Any, # type: ignore
3494
+ object_=_response.json(),
3495
+ ),
3496
+ ),
3497
+ )
3498
+ if _response.status_code == 403:
3499
+ raise ForbiddenError(
3500
+ headers=dict(_response.headers),
3501
+ body=typing.cast(
3502
+ typing.Any,
3503
+ construct_type(
3504
+ type_=typing.Any, # type: ignore
3505
+ object_=_response.json(),
3506
+ ),
3507
+ ),
3508
+ )
3509
+ if _response.status_code == 404:
3510
+ raise NotFoundError(
3511
+ headers=dict(_response.headers),
3512
+ body=typing.cast(
3513
+ typing.Any,
3514
+ construct_type(
3515
+ type_=typing.Any, # type: ignore
3516
+ object_=_response.json(),
3517
+ ),
3518
+ ),
3519
+ )
3520
+ if _response.status_code == 422:
3521
+ raise UnprocessableEntityError(
3522
+ headers=dict(_response.headers),
3523
+ body=typing.cast(
3524
+ ErrorModel,
3525
+ construct_type(
3526
+ type_=ErrorModel, # type: ignore
3527
+ object_=_response.json(),
3528
+ ),
3529
+ ),
3530
+ )
3531
+ if _response.status_code == 500:
3532
+ raise InternalServerError(
3533
+ headers=dict(_response.headers),
3534
+ body=typing.cast(
3535
+ typing.Any,
3536
+ construct_type(
3537
+ type_=typing.Any, # type: ignore
3538
+ object_=_response.json(),
3539
+ ),
3540
+ ),
3541
+ )
3542
+ _response_json = _response.json()
3543
+ except JSONDecodeError:
3544
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3545
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3546
+
3547
+ async def delete_balance_limit(
3548
+ self, pid: str, bdid: str, blid: str, *, request_options: typing.Optional[RequestOptions] = None
3549
+ ) -> AsyncHttpResponse[None]:
3550
+ """
3551
+ Delete balance limit
3552
+
3553
+ Parameters
3554
+ ----------
3555
+ pid : str
3556
+ Loyalty Program Id
3557
+
3558
+ bdid : str
3559
+ Balance Definition Id
3560
+
3561
+ blid : str
3562
+ Balance Limit Id
3563
+
3564
+ request_options : typing.Optional[RequestOptions]
3565
+ Request-specific configuration.
3566
+
3567
+ Returns
3568
+ -------
3569
+ AsyncHttpResponse[None]
3570
+ """
3571
+ _response = await self._client_wrapper.httpx_client.request(
3572
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/balance-definitions/{jsonable_encoder(bdid)}/limits/{jsonable_encoder(blid)}",
3573
+ method="DELETE",
3574
+ request_options=request_options,
3575
+ )
3576
+ try:
3577
+ if 200 <= _response.status_code < 300:
3578
+ return AsyncHttpResponse(response=_response, data=None)
3579
+ if _response.status_code == 401:
3580
+ raise UnauthorizedError(
3581
+ headers=dict(_response.headers),
3582
+ body=typing.cast(
3583
+ typing.Any,
3584
+ construct_type(
3585
+ type_=typing.Any, # type: ignore
3586
+ object_=_response.json(),
3587
+ ),
3588
+ ),
3589
+ )
3590
+ if _response.status_code == 403:
3591
+ raise ForbiddenError(
3592
+ headers=dict(_response.headers),
3593
+ body=typing.cast(
3594
+ typing.Any,
3595
+ construct_type(
3596
+ type_=typing.Any, # type: ignore
3597
+ object_=_response.json(),
3598
+ ),
3599
+ ),
3600
+ )
3601
+ if _response.status_code == 404:
3602
+ raise NotFoundError(
3603
+ headers=dict(_response.headers),
3604
+ body=typing.cast(
3605
+ typing.Any,
3606
+ construct_type(
3607
+ type_=typing.Any, # type: ignore
3608
+ object_=_response.json(),
3609
+ ),
3610
+ ),
3611
+ )
3612
+ if _response.status_code == 422:
3613
+ raise UnprocessableEntityError(
3614
+ headers=dict(_response.headers),
3615
+ body=typing.cast(
3616
+ ErrorModel,
3617
+ construct_type(
3618
+ type_=ErrorModel, # type: ignore
3619
+ object_=_response.json(),
3620
+ ),
3621
+ ),
3622
+ )
3623
+ if _response.status_code == 500:
3624
+ raise InternalServerError(
3625
+ headers=dict(_response.headers),
3626
+ body=typing.cast(
3627
+ typing.Any,
3628
+ construct_type(
3629
+ type_=typing.Any, # type: ignore
3630
+ object_=_response.json(),
3631
+ ),
3632
+ ),
3633
+ )
3634
+ _response_json = _response.json()
3635
+ except JSONDecodeError:
3636
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3637
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3638
+
3639
+ async def get_contact_balances(
3640
+ self, pid: str, *, request_options: typing.Optional[RequestOptions] = None
3641
+ ) -> AsyncHttpResponse[GetContactBalancesResponse]:
3642
+ """
3643
+ Returns balance list
3644
+
3645
+ Parameters
3646
+ ----------
3647
+ pid : str
3648
+ Loyalty Program Id
3649
+
3650
+ request_options : typing.Optional[RequestOptions]
3651
+ Request-specific configuration.
3652
+
3653
+ Returns
3654
+ -------
3655
+ AsyncHttpResponse[GetContactBalancesResponse]
3656
+ Successful retrieval of contact balance
3657
+ """
3658
+ _response = await self._client_wrapper.httpx_client.request(
3659
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/contact-balances",
3660
+ method="GET",
3661
+ request_options=request_options,
3662
+ )
3663
+ try:
3664
+ if 200 <= _response.status_code < 300:
3665
+ _data = typing.cast(
3666
+ GetContactBalancesResponse,
3667
+ construct_type(
3668
+ type_=GetContactBalancesResponse, # type: ignore
3669
+ object_=_response.json(),
3670
+ ),
3671
+ )
3672
+ return AsyncHttpResponse(response=_response, data=_data)
3673
+ if _response.status_code == 401:
3674
+ raise UnauthorizedError(
3675
+ headers=dict(_response.headers),
3676
+ body=typing.cast(
3677
+ typing.Any,
3678
+ construct_type(
3679
+ type_=typing.Any, # type: ignore
3680
+ object_=_response.json(),
3681
+ ),
3682
+ ),
3683
+ )
3684
+ if _response.status_code == 403:
3685
+ raise ForbiddenError(
3686
+ headers=dict(_response.headers),
3687
+ body=typing.cast(
3688
+ typing.Any,
3689
+ construct_type(
3690
+ type_=typing.Any, # type: ignore
3691
+ object_=_response.json(),
3692
+ ),
3693
+ ),
3694
+ )
3695
+ if _response.status_code == 404:
3696
+ raise NotFoundError(
3697
+ headers=dict(_response.headers),
3698
+ body=typing.cast(
3699
+ typing.Any,
3700
+ construct_type(
3701
+ type_=typing.Any, # type: ignore
3702
+ object_=_response.json(),
3703
+ ),
3704
+ ),
3705
+ )
3706
+ if _response.status_code == 422:
3707
+ raise UnprocessableEntityError(
3708
+ headers=dict(_response.headers),
3709
+ body=typing.cast(
3710
+ ErrorModel,
3711
+ construct_type(
3712
+ type_=ErrorModel, # type: ignore
3713
+ object_=_response.json(),
3714
+ ),
3715
+ ),
3716
+ )
3717
+ if _response.status_code == 500:
3718
+ raise InternalServerError(
3719
+ headers=dict(_response.headers),
3720
+ body=typing.cast(
3721
+ typing.Any,
3722
+ construct_type(
3723
+ type_=typing.Any, # type: ignore
3724
+ object_=_response.json(),
3725
+ ),
3726
+ ),
3727
+ )
3728
+ _response_json = _response.json()
3729
+ except JSONDecodeError:
3730
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3731
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3732
+
3733
+ async def create_balance_order(
3734
+ self,
3735
+ pid: str,
3736
+ *,
3737
+ amount: float,
3738
+ balance_definition_id: str,
3739
+ contact_id: int,
3740
+ due_at: str,
3741
+ source: str,
3742
+ expires_at: typing.Optional[str] = OMIT,
3743
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
3744
+ request_options: typing.Optional[RequestOptions] = None,
3745
+ ) -> AsyncHttpResponse[CreateBalanceOrderResponse]:
3746
+ """
3747
+ Returns created order
3748
+
3749
+ Parameters
3750
+ ----------
3751
+ pid : str
3752
+ Loyalty Program Id
3753
+
3754
+ amount : float
3755
+ Order amount (must be non-zero).
3756
+
3757
+ balance_definition_id : str
3758
+ Unique identifier (UUID) of the associated balance definition.
3759
+
3760
+ contact_id : int
3761
+ Unique identifier of the contact placing the order (must be ≥ 1).
3762
+
3763
+ due_at : str
3764
+ RFC3339 timestamp specifying when the order is due.
3765
+
3766
+ source : str
3767
+ Specifies the origin of the order (`engine` or `user`).
3768
+
3769
+ expires_at : typing.Optional[str]
3770
+ Optional RFC3339 timestamp defining order expiration.
3771
+
3772
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
3773
+ Optional metadata associated with the order.
3774
+
3775
+ request_options : typing.Optional[RequestOptions]
3776
+ Request-specific configuration.
3777
+
3778
+ Returns
3779
+ -------
3780
+ AsyncHttpResponse[CreateBalanceOrderResponse]
3781
+ Successful creation of order
3782
+ """
3783
+ _response = await self._client_wrapper.httpx_client.request(
3784
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/create-order",
3785
+ method="POST",
3786
+ json={
3787
+ "amount": amount,
3788
+ "balanceDefinitionId": balance_definition_id,
3789
+ "contactId": contact_id,
3790
+ "dueAt": due_at,
3791
+ "expiresAt": expires_at,
3792
+ "meta": meta,
3793
+ "source": source,
3794
+ },
3795
+ headers={
3796
+ "content-type": "application/json",
3797
+ },
3798
+ request_options=request_options,
3799
+ omit=OMIT,
3800
+ )
3801
+ try:
3802
+ if 200 <= _response.status_code < 300:
3803
+ _data = typing.cast(
3804
+ CreateBalanceOrderResponse,
3805
+ construct_type(
3806
+ type_=CreateBalanceOrderResponse, # type: ignore
3807
+ object_=_response.json(),
3808
+ ),
3809
+ )
3810
+ return AsyncHttpResponse(response=_response, data=_data)
3811
+ if _response.status_code == 401:
3812
+ raise UnauthorizedError(
3813
+ headers=dict(_response.headers),
3814
+ body=typing.cast(
3815
+ typing.Any,
3816
+ construct_type(
3817
+ type_=typing.Any, # type: ignore
3818
+ object_=_response.json(),
3819
+ ),
3820
+ ),
3821
+ )
3822
+ if _response.status_code == 403:
3823
+ raise ForbiddenError(
3824
+ headers=dict(_response.headers),
3825
+ body=typing.cast(
3826
+ typing.Any,
3827
+ construct_type(
3828
+ type_=typing.Any, # type: ignore
3829
+ object_=_response.json(),
3830
+ ),
3831
+ ),
3832
+ )
3833
+ if _response.status_code == 422:
3834
+ raise UnprocessableEntityError(
3835
+ headers=dict(_response.headers),
3836
+ body=typing.cast(
3837
+ ErrorModel,
3838
+ construct_type(
3839
+ type_=ErrorModel, # type: ignore
3840
+ object_=_response.json(),
3841
+ ),
3842
+ ),
3843
+ )
3844
+ if _response.status_code == 500:
3845
+ raise InternalServerError(
3846
+ headers=dict(_response.headers),
3847
+ body=typing.cast(
3848
+ typing.Any,
3849
+ construct_type(
3850
+ type_=typing.Any, # type: ignore
3851
+ object_=_response.json(),
3852
+ ),
3853
+ ),
3854
+ )
3855
+ _response_json = _response.json()
3856
+ except JSONDecodeError:
3857
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3858
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3859
+
3860
+ async def get_subscription_balances(
3861
+ self, pid: str, cid: str, *, request_options: typing.Optional[RequestOptions] = None
3862
+ ) -> AsyncHttpResponse[GetSubscriptionBalancesResponse]:
3863
+ """
3864
+ Returns subscription balances
3865
+
3866
+ Parameters
3867
+ ----------
3868
+ pid : str
3869
+ Loyalty Program Id
3870
+
3871
+ cid : str
3872
+ Contact Id
3873
+
3874
+ request_options : typing.Optional[RequestOptions]
3875
+ Request-specific configuration.
3876
+
3877
+ Returns
3878
+ -------
3879
+ AsyncHttpResponse[GetSubscriptionBalancesResponse]
3880
+ Successful retrieval of contact balance
3881
+ """
3882
+ _response = await self._client_wrapper.httpx_client.request(
3883
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/subscriptions/{jsonable_encoder(cid)}/balances",
3884
+ method="GET",
3885
+ request_options=request_options,
3886
+ )
3887
+ try:
3888
+ if 200 <= _response.status_code < 300:
3889
+ _data = typing.cast(
3890
+ GetSubscriptionBalancesResponse,
3891
+ construct_type(
3892
+ type_=GetSubscriptionBalancesResponse, # type: ignore
3893
+ object_=_response.json(),
3894
+ ),
3895
+ )
3896
+ return AsyncHttpResponse(response=_response, data=_data)
3897
+ if _response.status_code == 401:
3898
+ raise UnauthorizedError(
3899
+ headers=dict(_response.headers),
3900
+ body=typing.cast(
3901
+ typing.Any,
3902
+ construct_type(
3903
+ type_=typing.Any, # type: ignore
3904
+ object_=_response.json(),
3905
+ ),
3906
+ ),
3907
+ )
3908
+ if _response.status_code == 403:
3909
+ raise ForbiddenError(
3910
+ headers=dict(_response.headers),
3911
+ body=typing.cast(
3912
+ typing.Any,
3913
+ construct_type(
3914
+ type_=typing.Any, # type: ignore
3915
+ object_=_response.json(),
3916
+ ),
3917
+ ),
3918
+ )
3919
+ if _response.status_code == 404:
3920
+ raise NotFoundError(
3921
+ headers=dict(_response.headers),
3922
+ body=typing.cast(
3923
+ typing.Any,
3924
+ construct_type(
3925
+ type_=typing.Any, # type: ignore
3926
+ object_=_response.json(),
3927
+ ),
3928
+ ),
3929
+ )
3930
+ if _response.status_code == 422:
3931
+ raise UnprocessableEntityError(
3932
+ headers=dict(_response.headers),
3933
+ body=typing.cast(
3934
+ ErrorModel,
3935
+ construct_type(
3936
+ type_=ErrorModel, # type: ignore
3937
+ object_=_response.json(),
3938
+ ),
3939
+ ),
3940
+ )
3941
+ if _response.status_code == 500:
3942
+ raise InternalServerError(
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
+ _response_json = _response.json()
3953
+ except JSONDecodeError:
3954
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3955
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3956
+
3957
+ async def create_subscription_balances(
3958
+ self, pid: str, cid: str, *, balance_definition_id: str, request_options: typing.Optional[RequestOptions] = None
3959
+ ) -> AsyncHttpResponse[PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse]:
3960
+ """
3961
+ Creates a balance for a contact
3962
+
3963
+ Parameters
3964
+ ----------
3965
+ pid : str
3966
+ Loyalty Program Id
3967
+
3968
+ cid : str
3969
+ Contact Id
3970
+
3971
+ balance_definition_id : str
3972
+ Unique identifier (UUID) of the balance definition associated with the new balance.
3973
+
3974
+ request_options : typing.Optional[RequestOptions]
3975
+ Request-specific configuration.
3976
+
3977
+ Returns
3978
+ -------
3979
+ AsyncHttpResponse[PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse]
3980
+ Successful creation of balance
3981
+ """
3982
+ _response = await self._client_wrapper.httpx_client.request(
3983
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/subscriptions/{jsonable_encoder(cid)}/balances",
3984
+ method="POST",
3985
+ json={
3986
+ "balanceDefinitionId": balance_definition_id,
3987
+ },
3988
+ headers={
3989
+ "content-type": "application/json",
3990
+ },
3991
+ request_options=request_options,
3992
+ omit=OMIT,
3993
+ )
3994
+ try:
3995
+ if 200 <= _response.status_code < 300:
3996
+ _data = typing.cast(
3997
+ PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse,
3998
+ construct_type(
3999
+ type_=PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse, # type: ignore
4000
+ object_=_response.json(),
4001
+ ),
4002
+ )
4003
+ return AsyncHttpResponse(response=_response, data=_data)
4004
+ if _response.status_code == 401:
4005
+ raise UnauthorizedError(
4006
+ headers=dict(_response.headers),
4007
+ body=typing.cast(
4008
+ typing.Any,
4009
+ construct_type(
4010
+ type_=typing.Any, # type: ignore
4011
+ object_=_response.json(),
4012
+ ),
4013
+ ),
4014
+ )
4015
+ if _response.status_code == 403:
4016
+ raise ForbiddenError(
4017
+ headers=dict(_response.headers),
4018
+ body=typing.cast(
4019
+ typing.Any,
4020
+ construct_type(
4021
+ type_=typing.Any, # type: ignore
4022
+ object_=_response.json(),
4023
+ ),
4024
+ ),
4025
+ )
4026
+ if _response.status_code == 404:
4027
+ raise NotFoundError(
4028
+ headers=dict(_response.headers),
4029
+ body=typing.cast(
4030
+ typing.Any,
4031
+ construct_type(
4032
+ type_=typing.Any, # type: ignore
4033
+ object_=_response.json(),
4034
+ ),
4035
+ ),
4036
+ )
4037
+ if _response.status_code == 422:
4038
+ raise UnprocessableEntityError(
4039
+ headers=dict(_response.headers),
4040
+ body=typing.cast(
4041
+ ErrorModel,
4042
+ construct_type(
4043
+ type_=ErrorModel, # type: ignore
4044
+ object_=_response.json(),
4045
+ ),
4046
+ ),
4047
+ )
4048
+ if _response.status_code == 500:
4049
+ raise InternalServerError(
4050
+ headers=dict(_response.headers),
4051
+ body=typing.cast(
4052
+ typing.Any,
4053
+ construct_type(
4054
+ type_=typing.Any, # type: ignore
4055
+ object_=_response.json(),
4056
+ ),
4057
+ ),
4058
+ )
4059
+ _response_json = _response.json()
4060
+ except JSONDecodeError:
4061
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4062
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4063
+
4064
+ async def get_transaction_history_api(
4065
+ self,
4066
+ pid: str,
4067
+ *,
4068
+ contact_id: int,
4069
+ balance_definition_id: str,
4070
+ limit: typing.Optional[int] = None,
4071
+ offset: typing.Optional[int] = None,
4072
+ sort_field: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField] = None,
4073
+ sort: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort] = None,
4074
+ filters: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
4075
+ request_options: typing.Optional[RequestOptions] = None,
4076
+ ) -> AsyncHttpResponse[GetLoyaltyBalanceProgramsPidTransactionHistoryResponse]:
4077
+ """
4078
+ Returns transaction history
4079
+
4080
+ Parameters
4081
+ ----------
4082
+ pid : str
4083
+ Loyalty Program Id
4084
+
4085
+ contact_id : int
4086
+ Contact ID
4087
+
4088
+ balance_definition_id : str
4089
+ Balance Definition ID
4090
+
4091
+ limit : typing.Optional[int]
4092
+ Limit the number of records returned
4093
+
4094
+ offset : typing.Optional[int]
4095
+ Skip a number of records
4096
+
4097
+ sort_field : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField]
4098
+ Field to sort by
4099
+
4100
+ sort : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort]
4101
+ Sort order, either asc or desc
4102
+
4103
+ filters : typing.Optional[typing.Union[str, typing.Sequence[str]]]
4104
+ Filters to apply
4105
+
4106
+ request_options : typing.Optional[RequestOptions]
4107
+ Request-specific configuration.
4108
+
4109
+ Returns
4110
+ -------
4111
+ AsyncHttpResponse[GetLoyaltyBalanceProgramsPidTransactionHistoryResponse]
4112
+ Successful retrieval of transaction history
4113
+ """
4114
+ _response = await self._client_wrapper.httpx_client.request(
4115
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transaction-history",
4116
+ method="GET",
4117
+ params={
4118
+ "limit": limit,
4119
+ "offset": offset,
4120
+ "sort_field": sort_field,
4121
+ "sort": sort,
4122
+ "contact_id": contact_id,
4123
+ "balance_definition_id": balance_definition_id,
4124
+ "filters": filters,
4125
+ },
4126
+ request_options=request_options,
4127
+ )
4128
+ try:
4129
+ if 200 <= _response.status_code < 300:
4130
+ _data = typing.cast(
4131
+ GetLoyaltyBalanceProgramsPidTransactionHistoryResponse,
4132
+ construct_type(
4133
+ type_=GetLoyaltyBalanceProgramsPidTransactionHistoryResponse, # type: ignore
4134
+ object_=_response.json(),
4135
+ ),
4136
+ )
4137
+ return AsyncHttpResponse(response=_response, data=_data)
4138
+ if _response.status_code == 401:
4139
+ raise UnauthorizedError(
4140
+ headers=dict(_response.headers),
4141
+ body=typing.cast(
4142
+ typing.Any,
4143
+ construct_type(
4144
+ type_=typing.Any, # type: ignore
4145
+ object_=_response.json(),
4146
+ ),
4147
+ ),
4148
+ )
4149
+ if _response.status_code == 403:
4150
+ raise ForbiddenError(
4151
+ headers=dict(_response.headers),
4152
+ body=typing.cast(
4153
+ typing.Any,
4154
+ construct_type(
4155
+ type_=typing.Any, # type: ignore
4156
+ object_=_response.json(),
4157
+ ),
4158
+ ),
4159
+ )
4160
+ if _response.status_code == 404:
4161
+ raise NotFoundError(
4162
+ headers=dict(_response.headers),
4163
+ body=typing.cast(
4164
+ typing.Any,
4165
+ construct_type(
4166
+ type_=typing.Any, # type: ignore
4167
+ object_=_response.json(),
4168
+ ),
4169
+ ),
4170
+ )
4171
+ if _response.status_code == 422:
4172
+ raise UnprocessableEntityError(
4173
+ headers=dict(_response.headers),
4174
+ body=typing.cast(
4175
+ ErrorModel,
4176
+ construct_type(
4177
+ type_=ErrorModel, # type: ignore
4178
+ object_=_response.json(),
4179
+ ),
4180
+ ),
4181
+ )
4182
+ if _response.status_code == 500:
4183
+ raise InternalServerError(
4184
+ headers=dict(_response.headers),
4185
+ body=typing.cast(
4186
+ typing.Any,
4187
+ construct_type(
4188
+ type_=typing.Any, # type: ignore
4189
+ object_=_response.json(),
4190
+ ),
4191
+ ),
4192
+ )
4193
+ _response_json = _response.json()
4194
+ except JSONDecodeError:
4195
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4196
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4197
+
4198
+ async def begin_transaction(
4199
+ self,
4200
+ pid: str,
4201
+ *,
4202
+ amount: float,
4203
+ balance_definition_id: str,
4204
+ loyalty_subscription_id: typing.Optional[str] = OMIT,
4205
+ auto_complete: typing.Optional[bool] = OMIT,
4206
+ balance_expiry_in_minutes: typing.Optional[int] = OMIT,
4207
+ contact_id: typing.Optional[int] = OMIT,
4208
+ event_time: typing.Optional[str] = OMIT,
4209
+ meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
4210
+ ttl: typing.Optional[int] = OMIT,
4211
+ request_options: typing.Optional[RequestOptions] = None,
4212
+ ) -> AsyncHttpResponse[Transaction]:
4213
+ """
4214
+ Creates new transaction and returns information
4215
+
4216
+ Parameters
4217
+ ----------
4218
+ pid : str
4219
+ Loyalty Program Id
4220
+
4221
+ amount : float
4222
+ Transaction amount (must be provided).
4223
+
4224
+ balance_definition_id : str
4225
+ Unique identifier (UUID) of the associated balance definition.
4226
+
4227
+ loyalty_subscription_id : typing.Optional[str]
4228
+ Unique identifier for the loyalty subscription (required unless `contactId` is provided).
4229
+
4230
+ auto_complete : typing.Optional[bool]
4231
+ Whether the transaction should be automatically completed.
4232
+
4233
+ balance_expiry_in_minutes : typing.Optional[int]
4234
+ Optional expiry time for the balance in minutes (must be greater than 0 if provided).
4235
+
4236
+ contact_id : typing.Optional[int]
4237
+ Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided).
4238
+
4239
+ event_time : typing.Optional[str]
4240
+ Optional timestamp specifying when the transaction occurred.
4241
+
4242
+ meta : typing.Optional[typing.Dict[str, typing.Any]]
4243
+ Optional metadata associated with the transaction.
4244
+
4245
+ ttl : typing.Optional[int]
4246
+ Optional time-to-live for the transaction (must be greater than 0 if provided).
4247
+
4248
+ request_options : typing.Optional[RequestOptions]
4249
+ Request-specific configuration.
4250
+
4251
+ Returns
4252
+ -------
4253
+ AsyncHttpResponse[Transaction]
4254
+ Transaction information
4255
+ """
4256
+ _response = await self._client_wrapper.httpx_client.request(
4257
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions",
4258
+ method="POST",
4259
+ json={
4260
+ "LoyaltySubscriptionId": loyalty_subscription_id,
4261
+ "amount": amount,
4262
+ "autoComplete": auto_complete,
4263
+ "balanceDefinitionId": balance_definition_id,
4264
+ "balanceExpiryInMinutes": balance_expiry_in_minutes,
4265
+ "contactId": contact_id,
4266
+ "eventTime": event_time,
4267
+ "meta": meta,
4268
+ "ttl": ttl,
4269
+ },
4270
+ headers={
4271
+ "content-type": "application/json",
4272
+ },
4273
+ request_options=request_options,
4274
+ omit=OMIT,
4275
+ )
4276
+ try:
4277
+ if 200 <= _response.status_code < 300:
4278
+ _data = typing.cast(
4279
+ Transaction,
4280
+ construct_type(
4281
+ type_=Transaction, # type: ignore
4282
+ object_=_response.json(),
4283
+ ),
4284
+ )
4285
+ return AsyncHttpResponse(response=_response, data=_data)
4286
+ if _response.status_code == 401:
4287
+ raise UnauthorizedError(
4288
+ headers=dict(_response.headers),
4289
+ body=typing.cast(
4290
+ typing.Any,
4291
+ construct_type(
4292
+ type_=typing.Any, # type: ignore
4293
+ object_=_response.json(),
4294
+ ),
4295
+ ),
4296
+ )
4297
+ if _response.status_code == 403:
4298
+ raise ForbiddenError(
4299
+ headers=dict(_response.headers),
4300
+ body=typing.cast(
4301
+ typing.Any,
4302
+ construct_type(
4303
+ type_=typing.Any, # type: ignore
4304
+ object_=_response.json(),
4305
+ ),
4306
+ ),
4307
+ )
4308
+ if _response.status_code == 404:
4309
+ raise NotFoundError(
4310
+ headers=dict(_response.headers),
4311
+ body=typing.cast(
4312
+ typing.Any,
4313
+ construct_type(
4314
+ type_=typing.Any, # type: ignore
4315
+ object_=_response.json(),
4316
+ ),
4317
+ ),
4318
+ )
4319
+ if _response.status_code == 422:
4320
+ raise UnprocessableEntityError(
4321
+ headers=dict(_response.headers),
4322
+ body=typing.cast(
4323
+ ErrorModel,
4324
+ construct_type(
4325
+ type_=ErrorModel, # type: ignore
4326
+ object_=_response.json(),
4327
+ ),
4328
+ ),
4329
+ )
4330
+ if _response.status_code == 500:
4331
+ raise InternalServerError(
4332
+ headers=dict(_response.headers),
4333
+ body=typing.cast(
4334
+ typing.Any,
4335
+ construct_type(
4336
+ type_=typing.Any, # type: ignore
4337
+ object_=_response.json(),
4338
+ ),
4339
+ ),
4340
+ )
4341
+ _response_json = _response.json()
4342
+ except JSONDecodeError:
4343
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4344
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4345
+
4346
+ async def cancel_transaction(
4347
+ self, pid: str, tid: str, *, request_options: typing.Optional[RequestOptions] = None
4348
+ ) -> AsyncHttpResponse[Transaction]:
4349
+ """
4350
+ Cancels transaction
4351
+
4352
+ Parameters
4353
+ ----------
4354
+ pid : str
4355
+ Loyalty Program Id
4356
+
4357
+ tid : str
4358
+ Transaction Id
4359
+
4360
+ request_options : typing.Optional[RequestOptions]
4361
+ Request-specific configuration.
4362
+
4363
+ Returns
4364
+ -------
4365
+ AsyncHttpResponse[Transaction]
4366
+ Transaction information
4367
+ """
4368
+ _response = await self._client_wrapper.httpx_client.request(
4369
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions/{jsonable_encoder(tid)}/cancel",
4370
+ method="POST",
4371
+ request_options=request_options,
4372
+ )
4373
+ try:
4374
+ if 200 <= _response.status_code < 300:
4375
+ _data = typing.cast(
4376
+ Transaction,
4377
+ construct_type(
4378
+ type_=Transaction, # type: ignore
4379
+ object_=_response.json(),
4380
+ ),
4381
+ )
4382
+ return AsyncHttpResponse(response=_response, data=_data)
4383
+ if _response.status_code == 401:
4384
+ raise UnauthorizedError(
4385
+ headers=dict(_response.headers),
4386
+ body=typing.cast(
4387
+ typing.Any,
4388
+ construct_type(
4389
+ type_=typing.Any, # type: ignore
4390
+ object_=_response.json(),
4391
+ ),
4392
+ ),
4393
+ )
4394
+ if _response.status_code == 403:
4395
+ raise ForbiddenError(
4396
+ headers=dict(_response.headers),
4397
+ body=typing.cast(
4398
+ typing.Any,
4399
+ construct_type(
4400
+ type_=typing.Any, # type: ignore
4401
+ object_=_response.json(),
4402
+ ),
4403
+ ),
4404
+ )
4405
+ if _response.status_code == 404:
4406
+ raise NotFoundError(
4407
+ headers=dict(_response.headers),
4408
+ body=typing.cast(
4409
+ typing.Any,
4410
+ construct_type(
4411
+ type_=typing.Any, # type: ignore
4412
+ object_=_response.json(),
4413
+ ),
4414
+ ),
4415
+ )
4416
+ if _response.status_code == 422:
4417
+ raise UnprocessableEntityError(
4418
+ headers=dict(_response.headers),
4419
+ body=typing.cast(
4420
+ ErrorModel,
4421
+ construct_type(
4422
+ type_=ErrorModel, # type: ignore
4423
+ object_=_response.json(),
4424
+ ),
4425
+ ),
4426
+ )
4427
+ if _response.status_code == 500:
4428
+ raise InternalServerError(
4429
+ headers=dict(_response.headers),
4430
+ body=typing.cast(
4431
+ typing.Any,
4432
+ construct_type(
4433
+ type_=typing.Any, # type: ignore
4434
+ object_=_response.json(),
4435
+ ),
4436
+ ),
4437
+ )
4438
+ _response_json = _response.json()
4439
+ except JSONDecodeError:
4440
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4441
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
4442
+
4443
+ async def complete_transaction(
4444
+ self, pid: str, tid: str, *, request_options: typing.Optional[RequestOptions] = None
4445
+ ) -> AsyncHttpResponse[Transaction]:
4446
+ """
4447
+ Completes transaction
4448
+
4449
+ Parameters
4450
+ ----------
4451
+ pid : str
4452
+ Loyalty Program Id
4453
+
4454
+ tid : str
4455
+ Transaction Id
4456
+
4457
+ request_options : typing.Optional[RequestOptions]
4458
+ Request-specific configuration.
4459
+
4460
+ Returns
4461
+ -------
4462
+ AsyncHttpResponse[Transaction]
4463
+ Transaction information
4464
+ """
4465
+ _response = await self._client_wrapper.httpx_client.request(
4466
+ f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions/{jsonable_encoder(tid)}/complete",
4467
+ method="POST",
4468
+ request_options=request_options,
4469
+ )
4470
+ try:
4471
+ if 200 <= _response.status_code < 300:
4472
+ _data = typing.cast(
4473
+ Transaction,
4474
+ construct_type(
4475
+ type_=Transaction, # type: ignore
4476
+ object_=_response.json(),
4477
+ ),
4478
+ )
4479
+ return AsyncHttpResponse(response=_response, data=_data)
4480
+ if _response.status_code == 401:
4481
+ raise UnauthorizedError(
4482
+ headers=dict(_response.headers),
4483
+ body=typing.cast(
4484
+ typing.Any,
4485
+ construct_type(
4486
+ type_=typing.Any, # type: ignore
4487
+ object_=_response.json(),
4488
+ ),
4489
+ ),
4490
+ )
4491
+ if _response.status_code == 403:
4492
+ raise ForbiddenError(
4493
+ headers=dict(_response.headers),
4494
+ body=typing.cast(
4495
+ typing.Any,
4496
+ construct_type(
4497
+ type_=typing.Any, # type: ignore
4498
+ object_=_response.json(),
4499
+ ),
4500
+ ),
4501
+ )
4502
+ if _response.status_code == 404:
4503
+ raise NotFoundError(
4504
+ headers=dict(_response.headers),
4505
+ body=typing.cast(
4506
+ typing.Any,
4507
+ construct_type(
4508
+ type_=typing.Any, # type: ignore
4509
+ object_=_response.json(),
4510
+ ),
4511
+ ),
4512
+ )
4513
+ if _response.status_code == 422:
4514
+ raise UnprocessableEntityError(
4515
+ headers=dict(_response.headers),
4516
+ body=typing.cast(
4517
+ ErrorModel,
4518
+ construct_type(
4519
+ type_=ErrorModel, # type: ignore
4520
+ object_=_response.json(),
4521
+ ),
4522
+ ),
4523
+ )
4524
+ if _response.status_code == 500:
4525
+ raise InternalServerError(
4526
+ headers=dict(_response.headers),
4527
+ body=typing.cast(
4528
+ typing.Any,
4529
+ construct_type(
4530
+ type_=typing.Any, # type: ignore
4531
+ object_=_response.json(),
4532
+ ),
4533
+ ),
4534
+ )
4535
+ _response_json = _response.json()
4536
+ except JSONDecodeError:
4537
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
4538
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)