mollie-api-py 1.0.0__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 (337) hide show
  1. mollie/__init__.py +18 -0
  2. mollie/_hooks/__init__.py +5 -0
  3. mollie/_hooks/mollie_hooks.py +165 -0
  4. mollie/_hooks/registration.py +18 -0
  5. mollie/_hooks/sdkhooks.py +76 -0
  6. mollie/_hooks/types.py +113 -0
  7. mollie/_version.py +15 -0
  8. mollie/balance_transfers.py +651 -0
  9. mollie/balances.py +1105 -0
  10. mollie/basesdk.py +360 -0
  11. mollie/capabilities.py +209 -0
  12. mollie/captures.py +677 -0
  13. mollie/chargebacks_sdk.py +675 -0
  14. mollie/client_links.py +325 -0
  15. mollie/clients.py +409 -0
  16. mollie/customers.py +1563 -0
  17. mollie/delayed_routing.py +421 -0
  18. mollie/httpclient.py +125 -0
  19. mollie/invoices.py +429 -0
  20. mollie/mandates.py +895 -0
  21. mollie/methods.py +789 -0
  22. mollie/models/__init__.py +4002 -0
  23. mollie/models/address.py +29 -0
  24. mollie/models/amount.py +25 -0
  25. mollie/models/amount_nullable.py +24 -0
  26. mollie/models/apierror.py +40 -0
  27. mollie/models/balance_card_audience.py +10 -0
  28. mollie/models/balance_card_issuer.py +12 -0
  29. mollie/models/balance_card_region.py +12 -0
  30. mollie/models/balance_fee_type.py +43 -0
  31. mollie/models/balance_prepayment_part_type.py +13 -0
  32. mollie/models/balance_report_grouping.py +10 -0
  33. mollie/models/balance_transaction_type.py +47 -0
  34. mollie/models/balance_transfer_category.py +17 -0
  35. mollie/models/balance_transfer_category_response.py +18 -0
  36. mollie/models/balance_transfer_destination_type.py +14 -0
  37. mollie/models/balance_transfer_party_type.py +10 -0
  38. mollie/models/balance_transfer_party_type_response.py +11 -0
  39. mollie/models/balance_transfer_status.py +13 -0
  40. mollie/models/balance_transfer_status_reason_response.py +19 -0
  41. mollie/models/billingaddress.py +154 -0
  42. mollie/models/cancel_paymentop.py +93 -0
  43. mollie/models/cancel_refundop.py +86 -0
  44. mollie/models/cancel_subscriptionop.py +100 -0
  45. mollie/models/capability_requirement_status.py +15 -0
  46. mollie/models/capability_status.py +12 -0
  47. mollie/models/capability_status_reason.py +10 -0
  48. mollie/models/capture_mode.py +15 -0
  49. mollie/models/capture_mode_response.py +16 -0
  50. mollie/models/capture_response.py +265 -0
  51. mollie/models/client_link_request.py +210 -0
  52. mollie/models/client_link_response.py +56 -0
  53. mollie/models/clienterror.py +30 -0
  54. mollie/models/components_sub_totals.py +127 -0
  55. mollie/models/create_captureop.py +43 -0
  56. mollie/models/create_client_linkop.py +29 -0
  57. mollie/models/create_connect_balance_transferop.py +32 -0
  58. mollie/models/create_customer_paymentop.py +43 -0
  59. mollie/models/create_customerop.py +29 -0
  60. mollie/models/create_mandateop.py +43 -0
  61. mollie/models/create_payment_linkop.py +325 -0
  62. mollie/models/create_paymentop.py +73 -0
  63. mollie/models/create_profileop.py +29 -0
  64. mollie/models/create_refundop.py +43 -0
  65. mollie/models/create_sales_invoiceop.py +29 -0
  66. mollie/models/create_subscriptionop.py +43 -0
  67. mollie/models/create_webhook.py +123 -0
  68. mollie/models/create_webhookop.py +69 -0
  69. mollie/models/currencies.py +20 -0
  70. mollie/models/customer_response.py +169 -0
  71. mollie/models/delete_customerop.py +91 -0
  72. mollie/models/delete_payment_linkop.py +91 -0
  73. mollie/models/delete_profileop.py +29 -0
  74. mollie/models/delete_sales_invoiceop.py +44 -0
  75. mollie/models/delete_values_sales_invoice.py +54 -0
  76. mollie/models/delete_webhookop.py +56 -0
  77. mollie/models/entity_balance.py +325 -0
  78. mollie/models/entity_balance_report.py +541 -0
  79. mollie/models/entity_balance_transaction.py +1068 -0
  80. mollie/models/entity_balance_transfer.py +62 -0
  81. mollie/models/entity_balance_transfer_party.py +28 -0
  82. mollie/models/entity_balance_transfer_party_response.py +32 -0
  83. mollie/models/entity_balance_transfer_response.py +159 -0
  84. mollie/models/entity_capability.py +75 -0
  85. mollie/models/entity_capability_requirement.py +87 -0
  86. mollie/models/entity_capture.py +63 -0
  87. mollie/models/entity_chargeback.py +247 -0
  88. mollie/models/entity_customer.py +86 -0
  89. mollie/models/entity_event.py +46 -0
  90. mollie/models/entity_invoice.py +247 -0
  91. mollie/models/entity_method_get.py +329 -0
  92. mollie/models/entity_onboarding_status.py +95 -0
  93. mollie/models/entity_organization.py +178 -0
  94. mollie/models/entity_payment_route.py +111 -0
  95. mollie/models/entity_payment_route_response.py +140 -0
  96. mollie/models/entity_permission.py +61 -0
  97. mollie/models/entity_refund_response.py +361 -0
  98. mollie/models/entity_route.py +96 -0
  99. mollie/models/entity_settlement.py +467 -0
  100. mollie/models/entity_terminal.py +160 -0
  101. mollie/models/entity_webhook.py +122 -0
  102. mollie/models/entity_webhook_event.py +149 -0
  103. mollie/models/error_response.py +70 -0
  104. mollie/models/get_balance_reportop.py +126 -0
  105. mollie/models/get_balanceop.py +71 -0
  106. mollie/models/get_captureop.py +129 -0
  107. mollie/models/get_chargebackop.py +129 -0
  108. mollie/models/get_clientop.py +216 -0
  109. mollie/models/get_connect_balance_transferop.py +71 -0
  110. mollie/models/get_current_organizationop.py +22 -0
  111. mollie/models/get_current_profileop.py +22 -0
  112. mollie/models/get_customerop.py +286 -0
  113. mollie/models/get_invoiceop.py +29 -0
  114. mollie/models/get_mandateop.py +86 -0
  115. mollie/models/get_methodop.py +199 -0
  116. mollie/models/get_next_settlementop.py +22 -0
  117. mollie/models/get_onboarding_statusop.py +22 -0
  118. mollie/models/get_open_settlementop.py +22 -0
  119. mollie/models/get_organizationop.py +71 -0
  120. mollie/models/get_partner_statusop.py +231 -0
  121. mollie/models/get_payment_link_paymentsop.py +188 -0
  122. mollie/models/get_payment_linkop.py +77 -0
  123. mollie/models/get_paymentop.py +128 -0
  124. mollie/models/get_permissionop.py +73 -0
  125. mollie/models/get_primary_balanceop.py +22 -0
  126. mollie/models/get_profileop.py +71 -0
  127. mollie/models/get_refundop.py +129 -0
  128. mollie/models/get_sales_invoiceop.py +75 -0
  129. mollie/models/get_settlementop.py +29 -0
  130. mollie/models/get_subscriptionop.py +86 -0
  131. mollie/models/get_terminalop.py +77 -0
  132. mollie/models/get_webhook_eventop.py +71 -0
  133. mollie/models/get_webhookop.py +71 -0
  134. mollie/models/internal/__init__.py +54 -0
  135. mollie/models/internal/globals.py +59 -0
  136. mollie/models/line_categories.py +13 -0
  137. mollie/models/line_categories_response.py +14 -0
  138. mollie/models/list_all_chargebacksop.py +236 -0
  139. mollie/models/list_all_methodsop.py +249 -0
  140. mollie/models/list_all_refundsop.py +230 -0
  141. mollie/models/list_all_subscriptionsop.py +202 -0
  142. mollie/models/list_balance_transactionsop.py +174 -0
  143. mollie/models/list_balancesop.py +171 -0
  144. mollie/models/list_capabilitiesop.py +62 -0
  145. mollie/models/list_capture_response.py +264 -0
  146. mollie/models/list_capturesop.py +185 -0
  147. mollie/models/list_chargebacksop.py +185 -0
  148. mollie/models/list_clientsop.py +269 -0
  149. mollie/models/list_connect_balance_transfersop.py +177 -0
  150. mollie/models/list_customer_paymentsop.py +231 -0
  151. mollie/models/list_customer_response.py +164 -0
  152. mollie/models/list_customersop.py +172 -0
  153. mollie/models/list_entity_balance.py +322 -0
  154. mollie/models/list_entity_chargeback.py +244 -0
  155. mollie/models/list_entity_invoice.py +244 -0
  156. mollie/models/list_entity_method.py +315 -0
  157. mollie/models/list_entity_method_all.py +391 -0
  158. mollie/models/list_entity_permission.py +56 -0
  159. mollie/models/list_entity_refund.py +352 -0
  160. mollie/models/list_entity_settlement.py +457 -0
  161. mollie/models/list_entity_terminal.py +157 -0
  162. mollie/models/list_entity_webhook.py +117 -0
  163. mollie/models/list_invoicesop.py +175 -0
  164. mollie/models/list_links.py +68 -0
  165. mollie/models/list_mandate_response.py +261 -0
  166. mollie/models/list_mandatesop.py +186 -0
  167. mollie/models/list_methodsop.py +332 -0
  168. mollie/models/list_payment_linksop.py +159 -0
  169. mollie/models/list_payment_response.py +1953 -0
  170. mollie/models/list_paymentsop.py +217 -0
  171. mollie/models/list_permissionsop.py +85 -0
  172. mollie/models/list_profile_response.py +194 -0
  173. mollie/models/list_profilesop.py +118 -0
  174. mollie/models/list_refundsop.py +189 -0
  175. mollie/models/list_route_get_response.py +97 -0
  176. mollie/models/list_sales_invoice_response.py +505 -0
  177. mollie/models/list_sales_invoicesop.py +172 -0
  178. mollie/models/list_settlement_capturesop.py +187 -0
  179. mollie/models/list_settlement_chargebacksop.py +187 -0
  180. mollie/models/list_settlement_paymentsop.py +233 -0
  181. mollie/models/list_settlement_refundsop.py +191 -0
  182. mollie/models/list_settlementsop.py +178 -0
  183. mollie/models/list_subscription_paymentsop.py +242 -0
  184. mollie/models/list_subscription_response.py +344 -0
  185. mollie/models/list_subscriptionsop.py +189 -0
  186. mollie/models/list_terminalsop.py +172 -0
  187. mollie/models/list_webhooksop.py +189 -0
  188. mollie/models/locale.py +32 -0
  189. mollie/models/locale_response.py +33 -0
  190. mollie/models/mandate_details_card_label_response.py +22 -0
  191. mollie/models/mandate_method.py +15 -0
  192. mollie/models/mandate_method_response.py +16 -0
  193. mollie/models/mandate_request.py +160 -0
  194. mollie/models/mandate_response.py +264 -0
  195. mollie/models/metadata.py +19 -0
  196. mollie/models/method.py +50 -0
  197. mollie/models/method_include_wallets_parameter.py +8 -0
  198. mollie/models/method_resource_parameter.py +9 -0
  199. mollie/models/method_response.py +59 -0
  200. mollie/models/method_status.py +15 -0
  201. mollie/models/mode.py +12 -0
  202. mollie/models/no_response_error.py +17 -0
  203. mollie/models/onboarding_vat_regulation.py +16 -0
  204. mollie/models/organization_vat_regulation.py +17 -0
  205. mollie/models/payment_address.py +130 -0
  206. mollie/models/payment_create_routeop.py +43 -0
  207. mollie/models/payment_details_card_audition_response.py +12 -0
  208. mollie/models/payment_details_card_funding_response.py +14 -0
  209. mollie/models/payment_details_card_label_response.py +23 -0
  210. mollie/models/payment_details_card_security_response.py +12 -0
  211. mollie/models/payment_details_failure_reason_response.py +25 -0
  212. mollie/models/payment_details_fee_region_response.py +20 -0
  213. mollie/models/payment_details_receipt_card_read_method_response.py +17 -0
  214. mollie/models/payment_details_receipt_card_verification_method_response.py +21 -0
  215. mollie/models/payment_details_seller_protection_response.py +20 -0
  216. mollie/models/payment_details_wallet_response.py +11 -0
  217. mollie/models/payment_line_item.py +96 -0
  218. mollie/models/payment_line_item_response.py +104 -0
  219. mollie/models/payment_line_type.py +20 -0
  220. mollie/models/payment_line_type_response.py +21 -0
  221. mollie/models/payment_link_method.py +36 -0
  222. mollie/models/payment_link_method_response.py +37 -0
  223. mollie/models/payment_link_response.py +348 -0
  224. mollie/models/payment_link_sequence_type.py +9 -0
  225. mollie/models/payment_link_sequence_type_response.py +10 -0
  226. mollie/models/payment_list_routesop.py +140 -0
  227. mollie/models/payment_method.py +53 -0
  228. mollie/models/payment_request.py +919 -0
  229. mollie/models/payment_response.py +1953 -0
  230. mollie/models/profile_request.py +67 -0
  231. mollie/models/profile_response.py +197 -0
  232. mollie/models/profile_review_status_response.py +12 -0
  233. mollie/models/recurring_line_item.py +77 -0
  234. mollie/models/refund_external_reference_type.py +10 -0
  235. mollie/models/refund_external_reference_type_response.py +11 -0
  236. mollie/models/refund_request.py +200 -0
  237. mollie/models/release_authorizationop.py +108 -0
  238. mollie/models/request_apple_pay_payment_sessionop.py +76 -0
  239. mollie/models/responsevalidationerror.py +27 -0
  240. mollie/models/revoke_mandateop.py +100 -0
  241. mollie/models/route_create_response.py +97 -0
  242. mollie/models/route_destination_type.py +10 -0
  243. mollie/models/route_destination_type_response.py +11 -0
  244. mollie/models/sales_invoice_discount.py +21 -0
  245. mollie/models/sales_invoice_discount_response.py +25 -0
  246. mollie/models/sales_invoice_discount_type.py +11 -0
  247. mollie/models/sales_invoice_discount_type_response.py +12 -0
  248. mollie/models/sales_invoice_email_details.py +20 -0
  249. mollie/models/sales_invoice_line_item.py +67 -0
  250. mollie/models/sales_invoice_line_item_response.py +70 -0
  251. mollie/models/sales_invoice_payment_details.py +59 -0
  252. mollie/models/sales_invoice_payment_details_response.py +66 -0
  253. mollie/models/sales_invoice_payment_details_source.py +12 -0
  254. mollie/models/sales_invoice_payment_details_source_response.py +13 -0
  255. mollie/models/sales_invoice_payment_term.py +16 -0
  256. mollie/models/sales_invoice_payment_term_response.py +17 -0
  257. mollie/models/sales_invoice_recipient.py +176 -0
  258. mollie/models/sales_invoice_recipient_locale.py +18 -0
  259. mollie/models/sales_invoice_recipient_locale_response.py +19 -0
  260. mollie/models/sales_invoice_recipient_response.py +182 -0
  261. mollie/models/sales_invoice_recipient_type.py +13 -0
  262. mollie/models/sales_invoice_recipient_type_response.py +14 -0
  263. mollie/models/sales_invoice_request.py +256 -0
  264. mollie/models/sales_invoice_response.py +509 -0
  265. mollie/models/sales_invoice_status.py +25 -0
  266. mollie/models/sales_invoice_status_response.py +26 -0
  267. mollie/models/sales_invoice_vat_mode.py +13 -0
  268. mollie/models/sales_invoice_vat_mode_response.py +14 -0
  269. mollie/models/sales_invoice_vat_scheme.py +11 -0
  270. mollie/models/sales_invoice_vat_scheme_response.py +12 -0
  271. mollie/models/security.py +35 -0
  272. mollie/models/sequence_type.py +10 -0
  273. mollie/models/sequence_type_response.py +11 -0
  274. mollie/models/sorting.py +9 -0
  275. mollie/models/status_reason.py +168 -0
  276. mollie/models/sub_group.py +52 -0
  277. mollie/models/sub_totals.py +120 -0
  278. mollie/models/submit_onboarding_dataop.py +214 -0
  279. mollie/models/subscription_method.py +12 -0
  280. mollie/models/subscription_method_response.py +13 -0
  281. mollie/models/subscription_request.py +213 -0
  282. mollie/models/subscription_response.py +349 -0
  283. mollie/models/terminal_brand.py +12 -0
  284. mollie/models/terminal_model.py +16 -0
  285. mollie/models/test_webhookop.py +64 -0
  286. mollie/models/update_customerop.py +43 -0
  287. mollie/models/update_payment_linkop.py +172 -0
  288. mollie/models/update_paymentop.py +332 -0
  289. mollie/models/update_profileop.py +147 -0
  290. mollie/models/update_sales_invoiceop.py +44 -0
  291. mollie/models/update_subscriptionop.py +188 -0
  292. mollie/models/update_values_sales_invoice.py +176 -0
  293. mollie/models/update_webhookop.py +83 -0
  294. mollie/models/url.py +24 -0
  295. mollie/models/url_nullable.py +25 -0
  296. mollie/models/webhook_event_types.py +18 -0
  297. mollie/models/webhook_status.py +14 -0
  298. mollie/onboarding.py +403 -0
  299. mollie/organizations.py +579 -0
  300. mollie/payment_links.py +1323 -0
  301. mollie/payments_sdk.py +1385 -0
  302. mollie/permissions.py +397 -0
  303. mollie/profiles.py +1209 -0
  304. mollie/py.typed +1 -0
  305. mollie/refunds_sdk.py +1111 -0
  306. mollie/sales_invoices.py +1121 -0
  307. mollie/sdk.py +265 -0
  308. mollie/sdkconfiguration.py +50 -0
  309. mollie/settlements.py +1735 -0
  310. mollie/subscriptions.py +1617 -0
  311. mollie/terminals.py +427 -0
  312. mollie/types/__init__.py +21 -0
  313. mollie/types/basemodel.py +39 -0
  314. mollie/utils/__init__.py +200 -0
  315. mollie/utils/annotations.py +79 -0
  316. mollie/utils/datetimes.py +23 -0
  317. mollie/utils/enums.py +74 -0
  318. mollie/utils/eventstreaming.py +248 -0
  319. mollie/utils/forms.py +223 -0
  320. mollie/utils/headers.py +136 -0
  321. mollie/utils/logger.py +27 -0
  322. mollie/utils/metadata.py +118 -0
  323. mollie/utils/queryparams.py +205 -0
  324. mollie/utils/requestbodies.py +66 -0
  325. mollie/utils/retries.py +217 -0
  326. mollie/utils/security.py +195 -0
  327. mollie/utils/serializers.py +249 -0
  328. mollie/utils/unmarshal_json_response.py +24 -0
  329. mollie/utils/url.py +155 -0
  330. mollie/utils/values.py +137 -0
  331. mollie/wallets.py +263 -0
  332. mollie/webhook_events.py +211 -0
  333. mollie/webhooks.py +1305 -0
  334. mollie_api_py-1.0.0.dist-info/METADATA +834 -0
  335. mollie_api_py-1.0.0.dist-info/RECORD +337 -0
  336. mollie_api_py-1.0.0.dist-info/WHEEL +4 -0
  337. mollie_api_py-1.0.0.dist-info/licenses/LICENSE.md +24 -0
mollie/profiles.py ADDED
@@ -0,0 +1,1209 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from mollie import models, utils
5
+ from mollie._hooks import HookContext
6
+ from mollie.types import OptionalNullable, UNSET
7
+ from mollie.utils import get_security_from_env
8
+ from mollie.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Any, Mapping, Optional, Union
10
+
11
+
12
+ class Profiles(BaseSDK):
13
+ def create(
14
+ self,
15
+ *,
16
+ profile_request: Union[models.ProfileRequest, models.ProfileRequestTypedDict],
17
+ idempotency_key: Optional[str] = None,
18
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
19
+ server_url: Optional[str] = None,
20
+ timeout_ms: Optional[int] = None,
21
+ http_headers: Optional[Mapping[str, str]] = None,
22
+ ) -> models.ProfileResponse:
23
+ r"""Create profile
24
+
25
+ Create a profile to process payments on.
26
+
27
+ Profiles are required for payment processing. Normally they are created via the Mollie dashboard. Alternatively, you
28
+ can use this endpoint to automate profile creation.
29
+
30
+ :param profile_request:
31
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
32
+ :param retries: Override the default retry configuration for this method
33
+ :param server_url: Override the default server URL for this method
34
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
35
+ :param http_headers: Additional headers to set or replace on requests.
36
+ """
37
+ base_url = None
38
+ url_variables = None
39
+ if timeout_ms is None:
40
+ timeout_ms = self.sdk_configuration.timeout_ms
41
+
42
+ if server_url is not None:
43
+ base_url = server_url
44
+ else:
45
+ base_url = self._get_url(base_url, url_variables)
46
+
47
+ request = models.CreateProfileRequest(
48
+ idempotency_key=idempotency_key,
49
+ profile_request=utils.get_pydantic_model(
50
+ profile_request, models.ProfileRequest
51
+ ),
52
+ )
53
+
54
+ req = self._build_request(
55
+ method="POST",
56
+ path="/profiles",
57
+ base_url=base_url,
58
+ url_variables=url_variables,
59
+ request=request,
60
+ request_body_required=True,
61
+ request_has_path_params=False,
62
+ request_has_query_params=True,
63
+ user_agent_header="user-agent",
64
+ accept_header_value="application/hal+json",
65
+ http_headers=http_headers,
66
+ security=self.sdk_configuration.security,
67
+ get_serialized_body=lambda: utils.serialize_request_body(
68
+ request.profile_request, False, False, "json", models.ProfileRequest
69
+ ),
70
+ timeout_ms=timeout_ms,
71
+ )
72
+
73
+ if retries == UNSET:
74
+ if self.sdk_configuration.retry_config is not UNSET:
75
+ retries = self.sdk_configuration.retry_config
76
+ else:
77
+ retries = utils.RetryConfig(
78
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
79
+ )
80
+
81
+ retry_config = None
82
+ if isinstance(retries, utils.RetryConfig):
83
+ retry_config = (retries, ["5xx"])
84
+
85
+ http_res = self.do_request(
86
+ hook_ctx=HookContext(
87
+ config=self.sdk_configuration,
88
+ base_url=base_url or "",
89
+ operation_id="create-profile",
90
+ oauth2_scopes=None,
91
+ security_source=get_security_from_env(
92
+ self.sdk_configuration.security, models.Security
93
+ ),
94
+ ),
95
+ request=req,
96
+ error_status_codes=["422", "4XX", "5XX"],
97
+ retry_config=retry_config,
98
+ )
99
+
100
+ response_data: Any = None
101
+ if utils.match_response(http_res, "201", "application/hal+json"):
102
+ return unmarshal_json_response(models.ProfileResponse, http_res)
103
+ if utils.match_response(http_res, "422", "application/hal+json"):
104
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
105
+ raise models.ErrorResponse(response_data, http_res)
106
+ if utils.match_response(http_res, "4XX", "*"):
107
+ http_res_text = utils.stream_to_text(http_res)
108
+ raise models.APIError("API error occurred", http_res, http_res_text)
109
+ if utils.match_response(http_res, "5XX", "*"):
110
+ http_res_text = utils.stream_to_text(http_res)
111
+ raise models.APIError("API error occurred", http_res, http_res_text)
112
+
113
+ raise models.APIError("Unexpected response received", http_res)
114
+
115
+ async def create_async(
116
+ self,
117
+ *,
118
+ profile_request: Union[models.ProfileRequest, models.ProfileRequestTypedDict],
119
+ idempotency_key: Optional[str] = None,
120
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
121
+ server_url: Optional[str] = None,
122
+ timeout_ms: Optional[int] = None,
123
+ http_headers: Optional[Mapping[str, str]] = None,
124
+ ) -> models.ProfileResponse:
125
+ r"""Create profile
126
+
127
+ Create a profile to process payments on.
128
+
129
+ Profiles are required for payment processing. Normally they are created via the Mollie dashboard. Alternatively, you
130
+ can use this endpoint to automate profile creation.
131
+
132
+ :param profile_request:
133
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
134
+ :param retries: Override the default retry configuration for this method
135
+ :param server_url: Override the default server URL for this method
136
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
137
+ :param http_headers: Additional headers to set or replace on requests.
138
+ """
139
+ base_url = None
140
+ url_variables = None
141
+ if timeout_ms is None:
142
+ timeout_ms = self.sdk_configuration.timeout_ms
143
+
144
+ if server_url is not None:
145
+ base_url = server_url
146
+ else:
147
+ base_url = self._get_url(base_url, url_variables)
148
+
149
+ request = models.CreateProfileRequest(
150
+ idempotency_key=idempotency_key,
151
+ profile_request=utils.get_pydantic_model(
152
+ profile_request, models.ProfileRequest
153
+ ),
154
+ )
155
+
156
+ req = self._build_request_async(
157
+ method="POST",
158
+ path="/profiles",
159
+ base_url=base_url,
160
+ url_variables=url_variables,
161
+ request=request,
162
+ request_body_required=True,
163
+ request_has_path_params=False,
164
+ request_has_query_params=True,
165
+ user_agent_header="user-agent",
166
+ accept_header_value="application/hal+json",
167
+ http_headers=http_headers,
168
+ security=self.sdk_configuration.security,
169
+ get_serialized_body=lambda: utils.serialize_request_body(
170
+ request.profile_request, False, False, "json", models.ProfileRequest
171
+ ),
172
+ timeout_ms=timeout_ms,
173
+ )
174
+
175
+ if retries == UNSET:
176
+ if self.sdk_configuration.retry_config is not UNSET:
177
+ retries = self.sdk_configuration.retry_config
178
+ else:
179
+ retries = utils.RetryConfig(
180
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
181
+ )
182
+
183
+ retry_config = None
184
+ if isinstance(retries, utils.RetryConfig):
185
+ retry_config = (retries, ["5xx"])
186
+
187
+ http_res = await self.do_request_async(
188
+ hook_ctx=HookContext(
189
+ config=self.sdk_configuration,
190
+ base_url=base_url or "",
191
+ operation_id="create-profile",
192
+ oauth2_scopes=None,
193
+ security_source=get_security_from_env(
194
+ self.sdk_configuration.security, models.Security
195
+ ),
196
+ ),
197
+ request=req,
198
+ error_status_codes=["422", "4XX", "5XX"],
199
+ retry_config=retry_config,
200
+ )
201
+
202
+ response_data: Any = None
203
+ if utils.match_response(http_res, "201", "application/hal+json"):
204
+ return unmarshal_json_response(models.ProfileResponse, http_res)
205
+ if utils.match_response(http_res, "422", "application/hal+json"):
206
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
207
+ raise models.ErrorResponse(response_data, http_res)
208
+ if utils.match_response(http_res, "4XX", "*"):
209
+ http_res_text = await utils.stream_to_text_async(http_res)
210
+ raise models.APIError("API error occurred", http_res, http_res_text)
211
+ if utils.match_response(http_res, "5XX", "*"):
212
+ http_res_text = await utils.stream_to_text_async(http_res)
213
+ raise models.APIError("API error occurred", http_res, http_res_text)
214
+
215
+ raise models.APIError("Unexpected response received", http_res)
216
+
217
+ def list(
218
+ self,
219
+ *,
220
+ from_: OptionalNullable[str] = UNSET,
221
+ limit: OptionalNullable[int] = UNSET,
222
+ idempotency_key: Optional[str] = None,
223
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
224
+ server_url: Optional[str] = None,
225
+ timeout_ms: Optional[int] = None,
226
+ http_headers: Optional[Mapping[str, str]] = None,
227
+ ) -> models.ListProfilesResponse:
228
+ r"""List profiles
229
+
230
+ Retrieve a list of all of your profiles.
231
+
232
+ The results are paginated.
233
+
234
+ :param from_: Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
235
+ :param limit: The maximum number of items to return. Defaults to 50 items.
236
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
237
+ :param retries: Override the default retry configuration for this method
238
+ :param server_url: Override the default server URL for this method
239
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
240
+ :param http_headers: Additional headers to set or replace on requests.
241
+ """
242
+ base_url = None
243
+ url_variables = None
244
+ if timeout_ms is None:
245
+ timeout_ms = self.sdk_configuration.timeout_ms
246
+
247
+ if server_url is not None:
248
+ base_url = server_url
249
+ else:
250
+ base_url = self._get_url(base_url, url_variables)
251
+
252
+ request = models.ListProfilesRequest(
253
+ from_=from_,
254
+ limit=limit,
255
+ idempotency_key=idempotency_key,
256
+ )
257
+
258
+ req = self._build_request(
259
+ method="GET",
260
+ path="/profiles",
261
+ base_url=base_url,
262
+ url_variables=url_variables,
263
+ request=request,
264
+ request_body_required=False,
265
+ request_has_path_params=False,
266
+ request_has_query_params=True,
267
+ user_agent_header="user-agent",
268
+ accept_header_value="application/hal+json",
269
+ http_headers=http_headers,
270
+ security=self.sdk_configuration.security,
271
+ timeout_ms=timeout_ms,
272
+ )
273
+
274
+ if retries == UNSET:
275
+ if self.sdk_configuration.retry_config is not UNSET:
276
+ retries = self.sdk_configuration.retry_config
277
+ else:
278
+ retries = utils.RetryConfig(
279
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
280
+ )
281
+
282
+ retry_config = None
283
+ if isinstance(retries, utils.RetryConfig):
284
+ retry_config = (retries, ["5xx"])
285
+
286
+ http_res = self.do_request(
287
+ hook_ctx=HookContext(
288
+ config=self.sdk_configuration,
289
+ base_url=base_url or "",
290
+ operation_id="list-profiles",
291
+ oauth2_scopes=None,
292
+ security_source=get_security_from_env(
293
+ self.sdk_configuration.security, models.Security
294
+ ),
295
+ ),
296
+ request=req,
297
+ error_status_codes=["400", "4XX", "5XX"],
298
+ retry_config=retry_config,
299
+ )
300
+
301
+ response_data: Any = None
302
+ if utils.match_response(http_res, "200", "application/hal+json"):
303
+ return unmarshal_json_response(models.ListProfilesResponse, http_res)
304
+ if utils.match_response(http_res, "400", "application/hal+json"):
305
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
306
+ raise models.ErrorResponse(response_data, http_res)
307
+ if utils.match_response(http_res, "4XX", "*"):
308
+ http_res_text = utils.stream_to_text(http_res)
309
+ raise models.APIError("API error occurred", http_res, http_res_text)
310
+ if utils.match_response(http_res, "5XX", "*"):
311
+ http_res_text = utils.stream_to_text(http_res)
312
+ raise models.APIError("API error occurred", http_res, http_res_text)
313
+
314
+ raise models.APIError("Unexpected response received", http_res)
315
+
316
+ async def list_async(
317
+ self,
318
+ *,
319
+ from_: OptionalNullable[str] = UNSET,
320
+ limit: OptionalNullable[int] = UNSET,
321
+ idempotency_key: Optional[str] = None,
322
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
323
+ server_url: Optional[str] = None,
324
+ timeout_ms: Optional[int] = None,
325
+ http_headers: Optional[Mapping[str, str]] = None,
326
+ ) -> models.ListProfilesResponse:
327
+ r"""List profiles
328
+
329
+ Retrieve a list of all of your profiles.
330
+
331
+ The results are paginated.
332
+
333
+ :param from_: Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
334
+ :param limit: The maximum number of items to return. Defaults to 50 items.
335
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
336
+ :param retries: Override the default retry configuration for this method
337
+ :param server_url: Override the default server URL for this method
338
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
339
+ :param http_headers: Additional headers to set or replace on requests.
340
+ """
341
+ base_url = None
342
+ url_variables = None
343
+ if timeout_ms is None:
344
+ timeout_ms = self.sdk_configuration.timeout_ms
345
+
346
+ if server_url is not None:
347
+ base_url = server_url
348
+ else:
349
+ base_url = self._get_url(base_url, url_variables)
350
+
351
+ request = models.ListProfilesRequest(
352
+ from_=from_,
353
+ limit=limit,
354
+ idempotency_key=idempotency_key,
355
+ )
356
+
357
+ req = self._build_request_async(
358
+ method="GET",
359
+ path="/profiles",
360
+ base_url=base_url,
361
+ url_variables=url_variables,
362
+ request=request,
363
+ request_body_required=False,
364
+ request_has_path_params=False,
365
+ request_has_query_params=True,
366
+ user_agent_header="user-agent",
367
+ accept_header_value="application/hal+json",
368
+ http_headers=http_headers,
369
+ security=self.sdk_configuration.security,
370
+ timeout_ms=timeout_ms,
371
+ )
372
+
373
+ if retries == UNSET:
374
+ if self.sdk_configuration.retry_config is not UNSET:
375
+ retries = self.sdk_configuration.retry_config
376
+ else:
377
+ retries = utils.RetryConfig(
378
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
379
+ )
380
+
381
+ retry_config = None
382
+ if isinstance(retries, utils.RetryConfig):
383
+ retry_config = (retries, ["5xx"])
384
+
385
+ http_res = await self.do_request_async(
386
+ hook_ctx=HookContext(
387
+ config=self.sdk_configuration,
388
+ base_url=base_url or "",
389
+ operation_id="list-profiles",
390
+ oauth2_scopes=None,
391
+ security_source=get_security_from_env(
392
+ self.sdk_configuration.security, models.Security
393
+ ),
394
+ ),
395
+ request=req,
396
+ error_status_codes=["400", "4XX", "5XX"],
397
+ retry_config=retry_config,
398
+ )
399
+
400
+ response_data: Any = None
401
+ if utils.match_response(http_res, "200", "application/hal+json"):
402
+ return unmarshal_json_response(models.ListProfilesResponse, http_res)
403
+ if utils.match_response(http_res, "400", "application/hal+json"):
404
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
405
+ raise models.ErrorResponse(response_data, http_res)
406
+ if utils.match_response(http_res, "4XX", "*"):
407
+ http_res_text = await utils.stream_to_text_async(http_res)
408
+ raise models.APIError("API error occurred", http_res, http_res_text)
409
+ if utils.match_response(http_res, "5XX", "*"):
410
+ http_res_text = await utils.stream_to_text_async(http_res)
411
+ raise models.APIError("API error occurred", http_res, http_res_text)
412
+
413
+ raise models.APIError("Unexpected response received", http_res)
414
+
415
+ def get(
416
+ self,
417
+ *,
418
+ id: str,
419
+ testmode: Optional[bool] = None,
420
+ idempotency_key: Optional[str] = None,
421
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
422
+ server_url: Optional[str] = None,
423
+ timeout_ms: Optional[int] = None,
424
+ http_headers: Optional[Mapping[str, str]] = None,
425
+ ) -> models.ProfileResponse:
426
+ r"""Get profile
427
+
428
+ Retrieve a single profile by its ID.
429
+
430
+ :param id: Provide the ID of the item you want to perform this operation on.
431
+ :param testmode: You can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
432
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
433
+ :param retries: Override the default retry configuration for this method
434
+ :param server_url: Override the default server URL for this method
435
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
436
+ :param http_headers: Additional headers to set or replace on requests.
437
+ """
438
+ base_url = None
439
+ url_variables = None
440
+ if timeout_ms is None:
441
+ timeout_ms = self.sdk_configuration.timeout_ms
442
+
443
+ if server_url is not None:
444
+ base_url = server_url
445
+ else:
446
+ base_url = self._get_url(base_url, url_variables)
447
+
448
+ request = models.GetProfileRequest(
449
+ id=id,
450
+ testmode=testmode,
451
+ idempotency_key=idempotency_key,
452
+ )
453
+
454
+ req = self._build_request(
455
+ method="GET",
456
+ path="/profiles/{id}",
457
+ base_url=base_url,
458
+ url_variables=url_variables,
459
+ request=request,
460
+ request_body_required=False,
461
+ request_has_path_params=True,
462
+ request_has_query_params=True,
463
+ user_agent_header="user-agent",
464
+ accept_header_value="application/hal+json",
465
+ http_headers=http_headers,
466
+ _globals=models.GetProfileGlobals(
467
+ testmode=self.sdk_configuration.globals.testmode,
468
+ ),
469
+ security=self.sdk_configuration.security,
470
+ timeout_ms=timeout_ms,
471
+ )
472
+
473
+ if retries == UNSET:
474
+ if self.sdk_configuration.retry_config is not UNSET:
475
+ retries = self.sdk_configuration.retry_config
476
+ else:
477
+ retries = utils.RetryConfig(
478
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
479
+ )
480
+
481
+ retry_config = None
482
+ if isinstance(retries, utils.RetryConfig):
483
+ retry_config = (retries, ["5xx"])
484
+
485
+ http_res = self.do_request(
486
+ hook_ctx=HookContext(
487
+ config=self.sdk_configuration,
488
+ base_url=base_url or "",
489
+ operation_id="get-profile",
490
+ oauth2_scopes=None,
491
+ security_source=get_security_from_env(
492
+ self.sdk_configuration.security, models.Security
493
+ ),
494
+ ),
495
+ request=req,
496
+ error_status_codes=["404", "410", "4XX", "5XX"],
497
+ retry_config=retry_config,
498
+ )
499
+
500
+ response_data: Any = None
501
+ if utils.match_response(http_res, "200", "application/hal+json"):
502
+ return unmarshal_json_response(models.ProfileResponse, http_res)
503
+ if utils.match_response(http_res, ["404", "410"], "application/hal+json"):
504
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
505
+ raise models.ErrorResponse(response_data, http_res)
506
+ if utils.match_response(http_res, "4XX", "*"):
507
+ http_res_text = utils.stream_to_text(http_res)
508
+ raise models.APIError("API error occurred", http_res, http_res_text)
509
+ if utils.match_response(http_res, "5XX", "*"):
510
+ http_res_text = utils.stream_to_text(http_res)
511
+ raise models.APIError("API error occurred", http_res, http_res_text)
512
+
513
+ raise models.APIError("Unexpected response received", http_res)
514
+
515
+ async def get_async(
516
+ self,
517
+ *,
518
+ id: str,
519
+ testmode: Optional[bool] = None,
520
+ idempotency_key: Optional[str] = None,
521
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
522
+ server_url: Optional[str] = None,
523
+ timeout_ms: Optional[int] = None,
524
+ http_headers: Optional[Mapping[str, str]] = None,
525
+ ) -> models.ProfileResponse:
526
+ r"""Get profile
527
+
528
+ Retrieve a single profile by its ID.
529
+
530
+ :param id: Provide the ID of the item you want to perform this operation on.
531
+ :param testmode: You can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
532
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
533
+ :param retries: Override the default retry configuration for this method
534
+ :param server_url: Override the default server URL for this method
535
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
536
+ :param http_headers: Additional headers to set or replace on requests.
537
+ """
538
+ base_url = None
539
+ url_variables = None
540
+ if timeout_ms is None:
541
+ timeout_ms = self.sdk_configuration.timeout_ms
542
+
543
+ if server_url is not None:
544
+ base_url = server_url
545
+ else:
546
+ base_url = self._get_url(base_url, url_variables)
547
+
548
+ request = models.GetProfileRequest(
549
+ id=id,
550
+ testmode=testmode,
551
+ idempotency_key=idempotency_key,
552
+ )
553
+
554
+ req = self._build_request_async(
555
+ method="GET",
556
+ path="/profiles/{id}",
557
+ base_url=base_url,
558
+ url_variables=url_variables,
559
+ request=request,
560
+ request_body_required=False,
561
+ request_has_path_params=True,
562
+ request_has_query_params=True,
563
+ user_agent_header="user-agent",
564
+ accept_header_value="application/hal+json",
565
+ http_headers=http_headers,
566
+ _globals=models.GetProfileGlobals(
567
+ testmode=self.sdk_configuration.globals.testmode,
568
+ ),
569
+ security=self.sdk_configuration.security,
570
+ timeout_ms=timeout_ms,
571
+ )
572
+
573
+ if retries == UNSET:
574
+ if self.sdk_configuration.retry_config is not UNSET:
575
+ retries = self.sdk_configuration.retry_config
576
+ else:
577
+ retries = utils.RetryConfig(
578
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
579
+ )
580
+
581
+ retry_config = None
582
+ if isinstance(retries, utils.RetryConfig):
583
+ retry_config = (retries, ["5xx"])
584
+
585
+ http_res = await self.do_request_async(
586
+ hook_ctx=HookContext(
587
+ config=self.sdk_configuration,
588
+ base_url=base_url or "",
589
+ operation_id="get-profile",
590
+ oauth2_scopes=None,
591
+ security_source=get_security_from_env(
592
+ self.sdk_configuration.security, models.Security
593
+ ),
594
+ ),
595
+ request=req,
596
+ error_status_codes=["404", "410", "4XX", "5XX"],
597
+ retry_config=retry_config,
598
+ )
599
+
600
+ response_data: Any = None
601
+ if utils.match_response(http_res, "200", "application/hal+json"):
602
+ return unmarshal_json_response(models.ProfileResponse, http_res)
603
+ if utils.match_response(http_res, ["404", "410"], "application/hal+json"):
604
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
605
+ raise models.ErrorResponse(response_data, http_res)
606
+ if utils.match_response(http_res, "4XX", "*"):
607
+ http_res_text = await utils.stream_to_text_async(http_res)
608
+ raise models.APIError("API error occurred", http_res, http_res_text)
609
+ if utils.match_response(http_res, "5XX", "*"):
610
+ http_res_text = await utils.stream_to_text_async(http_res)
611
+ raise models.APIError("API error occurred", http_res, http_res_text)
612
+
613
+ raise models.APIError("Unexpected response received", http_res)
614
+
615
+ def update(
616
+ self,
617
+ *,
618
+ id: str,
619
+ request_body: Union[
620
+ models.UpdateProfileRequestBody, models.UpdateProfileRequestBodyTypedDict
621
+ ],
622
+ idempotency_key: Optional[str] = None,
623
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
624
+ server_url: Optional[str] = None,
625
+ timeout_ms: Optional[int] = None,
626
+ http_headers: Optional[Mapping[str, str]] = None,
627
+ ) -> models.ProfileResponse:
628
+ r"""Update profile
629
+
630
+ Update an existing profile.
631
+
632
+ Profiles are required for payment processing. Normally they are created and updated via the Mollie dashboard.
633
+ Alternatively, you can use this endpoint to automate profile management.
634
+
635
+ :param id: Provide the ID of the item you want to perform this operation on.
636
+ :param request_body:
637
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
638
+ :param retries: Override the default retry configuration for this method
639
+ :param server_url: Override the default server URL for this method
640
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
641
+ :param http_headers: Additional headers to set or replace on requests.
642
+ """
643
+ base_url = None
644
+ url_variables = None
645
+ if timeout_ms is None:
646
+ timeout_ms = self.sdk_configuration.timeout_ms
647
+
648
+ if server_url is not None:
649
+ base_url = server_url
650
+ else:
651
+ base_url = self._get_url(base_url, url_variables)
652
+
653
+ request = models.UpdateProfileRequest(
654
+ id=id,
655
+ idempotency_key=idempotency_key,
656
+ request_body=utils.get_pydantic_model(
657
+ request_body, models.UpdateProfileRequestBody
658
+ ),
659
+ )
660
+
661
+ req = self._build_request(
662
+ method="PATCH",
663
+ path="/profiles/{id}",
664
+ base_url=base_url,
665
+ url_variables=url_variables,
666
+ request=request,
667
+ request_body_required=True,
668
+ request_has_path_params=True,
669
+ request_has_query_params=True,
670
+ user_agent_header="user-agent",
671
+ accept_header_value="application/hal+json",
672
+ http_headers=http_headers,
673
+ security=self.sdk_configuration.security,
674
+ get_serialized_body=lambda: utils.serialize_request_body(
675
+ request.request_body,
676
+ False,
677
+ False,
678
+ "json",
679
+ models.UpdateProfileRequestBody,
680
+ ),
681
+ timeout_ms=timeout_ms,
682
+ )
683
+
684
+ if retries == UNSET:
685
+ if self.sdk_configuration.retry_config is not UNSET:
686
+ retries = self.sdk_configuration.retry_config
687
+ else:
688
+ retries = utils.RetryConfig(
689
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
690
+ )
691
+
692
+ retry_config = None
693
+ if isinstance(retries, utils.RetryConfig):
694
+ retry_config = (retries, ["5xx"])
695
+
696
+ http_res = self.do_request(
697
+ hook_ctx=HookContext(
698
+ config=self.sdk_configuration,
699
+ base_url=base_url or "",
700
+ operation_id="update-profile",
701
+ oauth2_scopes=None,
702
+ security_source=get_security_from_env(
703
+ self.sdk_configuration.security, models.Security
704
+ ),
705
+ ),
706
+ request=req,
707
+ error_status_codes=["404", "410", "422", "4XX", "5XX"],
708
+ retry_config=retry_config,
709
+ )
710
+
711
+ response_data: Any = None
712
+ if utils.match_response(http_res, "200", "application/hal+json"):
713
+ return unmarshal_json_response(models.ProfileResponse, http_res)
714
+ if utils.match_response(
715
+ http_res, ["404", "410", "422"], "application/hal+json"
716
+ ):
717
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
718
+ raise models.ErrorResponse(response_data, http_res)
719
+ if utils.match_response(http_res, "4XX", "*"):
720
+ http_res_text = utils.stream_to_text(http_res)
721
+ raise models.APIError("API error occurred", http_res, http_res_text)
722
+ if utils.match_response(http_res, "5XX", "*"):
723
+ http_res_text = utils.stream_to_text(http_res)
724
+ raise models.APIError("API error occurred", http_res, http_res_text)
725
+
726
+ raise models.APIError("Unexpected response received", http_res)
727
+
728
+ async def update_async(
729
+ self,
730
+ *,
731
+ id: str,
732
+ request_body: Union[
733
+ models.UpdateProfileRequestBody, models.UpdateProfileRequestBodyTypedDict
734
+ ],
735
+ idempotency_key: Optional[str] = None,
736
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
737
+ server_url: Optional[str] = None,
738
+ timeout_ms: Optional[int] = None,
739
+ http_headers: Optional[Mapping[str, str]] = None,
740
+ ) -> models.ProfileResponse:
741
+ r"""Update profile
742
+
743
+ Update an existing profile.
744
+
745
+ Profiles are required for payment processing. Normally they are created and updated via the Mollie dashboard.
746
+ Alternatively, you can use this endpoint to automate profile management.
747
+
748
+ :param id: Provide the ID of the item you want to perform this operation on.
749
+ :param request_body:
750
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
751
+ :param retries: Override the default retry configuration for this method
752
+ :param server_url: Override the default server URL for this method
753
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
754
+ :param http_headers: Additional headers to set or replace on requests.
755
+ """
756
+ base_url = None
757
+ url_variables = None
758
+ if timeout_ms is None:
759
+ timeout_ms = self.sdk_configuration.timeout_ms
760
+
761
+ if server_url is not None:
762
+ base_url = server_url
763
+ else:
764
+ base_url = self._get_url(base_url, url_variables)
765
+
766
+ request = models.UpdateProfileRequest(
767
+ id=id,
768
+ idempotency_key=idempotency_key,
769
+ request_body=utils.get_pydantic_model(
770
+ request_body, models.UpdateProfileRequestBody
771
+ ),
772
+ )
773
+
774
+ req = self._build_request_async(
775
+ method="PATCH",
776
+ path="/profiles/{id}",
777
+ base_url=base_url,
778
+ url_variables=url_variables,
779
+ request=request,
780
+ request_body_required=True,
781
+ request_has_path_params=True,
782
+ request_has_query_params=True,
783
+ user_agent_header="user-agent",
784
+ accept_header_value="application/hal+json",
785
+ http_headers=http_headers,
786
+ security=self.sdk_configuration.security,
787
+ get_serialized_body=lambda: utils.serialize_request_body(
788
+ request.request_body,
789
+ False,
790
+ False,
791
+ "json",
792
+ models.UpdateProfileRequestBody,
793
+ ),
794
+ timeout_ms=timeout_ms,
795
+ )
796
+
797
+ if retries == UNSET:
798
+ if self.sdk_configuration.retry_config is not UNSET:
799
+ retries = self.sdk_configuration.retry_config
800
+ else:
801
+ retries = utils.RetryConfig(
802
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
803
+ )
804
+
805
+ retry_config = None
806
+ if isinstance(retries, utils.RetryConfig):
807
+ retry_config = (retries, ["5xx"])
808
+
809
+ http_res = await self.do_request_async(
810
+ hook_ctx=HookContext(
811
+ config=self.sdk_configuration,
812
+ base_url=base_url or "",
813
+ operation_id="update-profile",
814
+ oauth2_scopes=None,
815
+ security_source=get_security_from_env(
816
+ self.sdk_configuration.security, models.Security
817
+ ),
818
+ ),
819
+ request=req,
820
+ error_status_codes=["404", "410", "422", "4XX", "5XX"],
821
+ retry_config=retry_config,
822
+ )
823
+
824
+ response_data: Any = None
825
+ if utils.match_response(http_res, "200", "application/hal+json"):
826
+ return unmarshal_json_response(models.ProfileResponse, http_res)
827
+ if utils.match_response(
828
+ http_res, ["404", "410", "422"], "application/hal+json"
829
+ ):
830
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
831
+ raise models.ErrorResponse(response_data, http_res)
832
+ if utils.match_response(http_res, "4XX", "*"):
833
+ http_res_text = await utils.stream_to_text_async(http_res)
834
+ raise models.APIError("API error occurred", http_res, http_res_text)
835
+ if utils.match_response(http_res, "5XX", "*"):
836
+ http_res_text = await utils.stream_to_text_async(http_res)
837
+ raise models.APIError("API error occurred", http_res, http_res_text)
838
+
839
+ raise models.APIError("Unexpected response received", http_res)
840
+
841
+ def delete(
842
+ self,
843
+ *,
844
+ id: str,
845
+ idempotency_key: Optional[str] = None,
846
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
847
+ server_url: Optional[str] = None,
848
+ timeout_ms: Optional[int] = None,
849
+ http_headers: Optional[Mapping[str, str]] = None,
850
+ ):
851
+ r"""Delete profile
852
+
853
+ Delete a profile. A deleted profile and its related credentials can no longer be used for accepting payments.
854
+
855
+ :param id: Provide the ID of the item you want to perform this operation on.
856
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
857
+ :param retries: Override the default retry configuration for this method
858
+ :param server_url: Override the default server URL for this method
859
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
860
+ :param http_headers: Additional headers to set or replace on requests.
861
+ """
862
+ base_url = None
863
+ url_variables = None
864
+ if timeout_ms is None:
865
+ timeout_ms = self.sdk_configuration.timeout_ms
866
+
867
+ if server_url is not None:
868
+ base_url = server_url
869
+ else:
870
+ base_url = self._get_url(base_url, url_variables)
871
+
872
+ request = models.DeleteProfileRequest(
873
+ id=id,
874
+ idempotency_key=idempotency_key,
875
+ )
876
+
877
+ req = self._build_request(
878
+ method="DELETE",
879
+ path="/profiles/{id}",
880
+ base_url=base_url,
881
+ url_variables=url_variables,
882
+ request=request,
883
+ request_body_required=False,
884
+ request_has_path_params=True,
885
+ request_has_query_params=True,
886
+ user_agent_header="user-agent",
887
+ accept_header_value="application/hal+json",
888
+ http_headers=http_headers,
889
+ security=self.sdk_configuration.security,
890
+ timeout_ms=timeout_ms,
891
+ )
892
+
893
+ if retries == UNSET:
894
+ if self.sdk_configuration.retry_config is not UNSET:
895
+ retries = self.sdk_configuration.retry_config
896
+ else:
897
+ retries = utils.RetryConfig(
898
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
899
+ )
900
+
901
+ retry_config = None
902
+ if isinstance(retries, utils.RetryConfig):
903
+ retry_config = (retries, ["5xx"])
904
+
905
+ http_res = self.do_request(
906
+ hook_ctx=HookContext(
907
+ config=self.sdk_configuration,
908
+ base_url=base_url or "",
909
+ operation_id="delete-profile",
910
+ oauth2_scopes=None,
911
+ security_source=get_security_from_env(
912
+ self.sdk_configuration.security, models.Security
913
+ ),
914
+ ),
915
+ request=req,
916
+ error_status_codes=["404", "410", "4XX", "5XX"],
917
+ retry_config=retry_config,
918
+ )
919
+
920
+ response_data: Any = None
921
+ if utils.match_response(http_res, "204", "*"):
922
+ return
923
+ if utils.match_response(http_res, ["404", "410"], "application/hal+json"):
924
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
925
+ raise models.ErrorResponse(response_data, http_res)
926
+ if utils.match_response(http_res, "4XX", "*"):
927
+ http_res_text = utils.stream_to_text(http_res)
928
+ raise models.APIError("API error occurred", http_res, http_res_text)
929
+ if utils.match_response(http_res, "5XX", "*"):
930
+ http_res_text = utils.stream_to_text(http_res)
931
+ raise models.APIError("API error occurred", http_res, http_res_text)
932
+
933
+ raise models.APIError("Unexpected response received", http_res)
934
+
935
+ async def delete_async(
936
+ self,
937
+ *,
938
+ id: str,
939
+ idempotency_key: Optional[str] = None,
940
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
941
+ server_url: Optional[str] = None,
942
+ timeout_ms: Optional[int] = None,
943
+ http_headers: Optional[Mapping[str, str]] = None,
944
+ ):
945
+ r"""Delete profile
946
+
947
+ Delete a profile. A deleted profile and its related credentials can no longer be used for accepting payments.
948
+
949
+ :param id: Provide the ID of the item you want to perform this operation on.
950
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
951
+ :param retries: Override the default retry configuration for this method
952
+ :param server_url: Override the default server URL for this method
953
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
954
+ :param http_headers: Additional headers to set or replace on requests.
955
+ """
956
+ base_url = None
957
+ url_variables = None
958
+ if timeout_ms is None:
959
+ timeout_ms = self.sdk_configuration.timeout_ms
960
+
961
+ if server_url is not None:
962
+ base_url = server_url
963
+ else:
964
+ base_url = self._get_url(base_url, url_variables)
965
+
966
+ request = models.DeleteProfileRequest(
967
+ id=id,
968
+ idempotency_key=idempotency_key,
969
+ )
970
+
971
+ req = self._build_request_async(
972
+ method="DELETE",
973
+ path="/profiles/{id}",
974
+ base_url=base_url,
975
+ url_variables=url_variables,
976
+ request=request,
977
+ request_body_required=False,
978
+ request_has_path_params=True,
979
+ request_has_query_params=True,
980
+ user_agent_header="user-agent",
981
+ accept_header_value="application/hal+json",
982
+ http_headers=http_headers,
983
+ security=self.sdk_configuration.security,
984
+ timeout_ms=timeout_ms,
985
+ )
986
+
987
+ if retries == UNSET:
988
+ if self.sdk_configuration.retry_config is not UNSET:
989
+ retries = self.sdk_configuration.retry_config
990
+ else:
991
+ retries = utils.RetryConfig(
992
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
993
+ )
994
+
995
+ retry_config = None
996
+ if isinstance(retries, utils.RetryConfig):
997
+ retry_config = (retries, ["5xx"])
998
+
999
+ http_res = await self.do_request_async(
1000
+ hook_ctx=HookContext(
1001
+ config=self.sdk_configuration,
1002
+ base_url=base_url or "",
1003
+ operation_id="delete-profile",
1004
+ oauth2_scopes=None,
1005
+ security_source=get_security_from_env(
1006
+ self.sdk_configuration.security, models.Security
1007
+ ),
1008
+ ),
1009
+ request=req,
1010
+ error_status_codes=["404", "410", "4XX", "5XX"],
1011
+ retry_config=retry_config,
1012
+ )
1013
+
1014
+ response_data: Any = None
1015
+ if utils.match_response(http_res, "204", "*"):
1016
+ return
1017
+ if utils.match_response(http_res, ["404", "410"], "application/hal+json"):
1018
+ response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
1019
+ raise models.ErrorResponse(response_data, http_res)
1020
+ if utils.match_response(http_res, "4XX", "*"):
1021
+ http_res_text = await utils.stream_to_text_async(http_res)
1022
+ raise models.APIError("API error occurred", http_res, http_res_text)
1023
+ if utils.match_response(http_res, "5XX", "*"):
1024
+ http_res_text = await utils.stream_to_text_async(http_res)
1025
+ raise models.APIError("API error occurred", http_res, http_res_text)
1026
+
1027
+ raise models.APIError("Unexpected response received", http_res)
1028
+
1029
+ def get_current(
1030
+ self,
1031
+ *,
1032
+ idempotency_key: Optional[str] = None,
1033
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1034
+ server_url: Optional[str] = None,
1035
+ timeout_ms: Optional[int] = None,
1036
+ http_headers: Optional[Mapping[str, str]] = None,
1037
+ ) -> models.ProfileResponse:
1038
+ r"""Get current profile
1039
+
1040
+ Retrieve the currently authenticated profile. A convenient alias of the [Get profile](get-profile)
1041
+ endpoint.
1042
+
1043
+ For a complete reference of the profile object, refer to the [Get profile](get-profile) endpoint
1044
+ documentation.
1045
+
1046
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
1047
+ :param retries: Override the default retry configuration for this method
1048
+ :param server_url: Override the default server URL for this method
1049
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1050
+ :param http_headers: Additional headers to set or replace on requests.
1051
+ """
1052
+ base_url = None
1053
+ url_variables = None
1054
+ if timeout_ms is None:
1055
+ timeout_ms = self.sdk_configuration.timeout_ms
1056
+
1057
+ if server_url is not None:
1058
+ base_url = server_url
1059
+ else:
1060
+ base_url = self._get_url(base_url, url_variables)
1061
+
1062
+ request = models.GetCurrentProfileRequest(
1063
+ idempotency_key=idempotency_key,
1064
+ )
1065
+
1066
+ req = self._build_request(
1067
+ method="GET",
1068
+ path="/profiles/me",
1069
+ base_url=base_url,
1070
+ url_variables=url_variables,
1071
+ request=request,
1072
+ request_body_required=False,
1073
+ request_has_path_params=False,
1074
+ request_has_query_params=True,
1075
+ user_agent_header="user-agent",
1076
+ accept_header_value="application/hal+json",
1077
+ http_headers=http_headers,
1078
+ security=self.sdk_configuration.security,
1079
+ timeout_ms=timeout_ms,
1080
+ )
1081
+
1082
+ if retries == UNSET:
1083
+ if self.sdk_configuration.retry_config is not UNSET:
1084
+ retries = self.sdk_configuration.retry_config
1085
+ else:
1086
+ retries = utils.RetryConfig(
1087
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
1088
+ )
1089
+
1090
+ retry_config = None
1091
+ if isinstance(retries, utils.RetryConfig):
1092
+ retry_config = (retries, ["5xx"])
1093
+
1094
+ http_res = self.do_request(
1095
+ hook_ctx=HookContext(
1096
+ config=self.sdk_configuration,
1097
+ base_url=base_url or "",
1098
+ operation_id="get-current-profile",
1099
+ oauth2_scopes=None,
1100
+ security_source=get_security_from_env(
1101
+ self.sdk_configuration.security, models.Security
1102
+ ),
1103
+ ),
1104
+ request=req,
1105
+ error_status_codes=["4XX", "5XX"],
1106
+ retry_config=retry_config,
1107
+ )
1108
+
1109
+ if utils.match_response(http_res, "200", "application/hal+json"):
1110
+ return unmarshal_json_response(models.ProfileResponse, http_res)
1111
+ if utils.match_response(http_res, "4XX", "*"):
1112
+ http_res_text = utils.stream_to_text(http_res)
1113
+ raise models.APIError("API error occurred", http_res, http_res_text)
1114
+ if utils.match_response(http_res, "5XX", "*"):
1115
+ http_res_text = utils.stream_to_text(http_res)
1116
+ raise models.APIError("API error occurred", http_res, http_res_text)
1117
+
1118
+ raise models.APIError("Unexpected response received", http_res)
1119
+
1120
+ async def get_current_async(
1121
+ self,
1122
+ *,
1123
+ idempotency_key: Optional[str] = None,
1124
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1125
+ server_url: Optional[str] = None,
1126
+ timeout_ms: Optional[int] = None,
1127
+ http_headers: Optional[Mapping[str, str]] = None,
1128
+ ) -> models.ProfileResponse:
1129
+ r"""Get current profile
1130
+
1131
+ Retrieve the currently authenticated profile. A convenient alias of the [Get profile](get-profile)
1132
+ endpoint.
1133
+
1134
+ For a complete reference of the profile object, refer to the [Get profile](get-profile) endpoint
1135
+ documentation.
1136
+
1137
+ :param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
1138
+ :param retries: Override the default retry configuration for this method
1139
+ :param server_url: Override the default server URL for this method
1140
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1141
+ :param http_headers: Additional headers to set or replace on requests.
1142
+ """
1143
+ base_url = None
1144
+ url_variables = None
1145
+ if timeout_ms is None:
1146
+ timeout_ms = self.sdk_configuration.timeout_ms
1147
+
1148
+ if server_url is not None:
1149
+ base_url = server_url
1150
+ else:
1151
+ base_url = self._get_url(base_url, url_variables)
1152
+
1153
+ request = models.GetCurrentProfileRequest(
1154
+ idempotency_key=idempotency_key,
1155
+ )
1156
+
1157
+ req = self._build_request_async(
1158
+ method="GET",
1159
+ path="/profiles/me",
1160
+ base_url=base_url,
1161
+ url_variables=url_variables,
1162
+ request=request,
1163
+ request_body_required=False,
1164
+ request_has_path_params=False,
1165
+ request_has_query_params=True,
1166
+ user_agent_header="user-agent",
1167
+ accept_header_value="application/hal+json",
1168
+ http_headers=http_headers,
1169
+ security=self.sdk_configuration.security,
1170
+ timeout_ms=timeout_ms,
1171
+ )
1172
+
1173
+ if retries == UNSET:
1174
+ if self.sdk_configuration.retry_config is not UNSET:
1175
+ retries = self.sdk_configuration.retry_config
1176
+ else:
1177
+ retries = utils.RetryConfig(
1178
+ "backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
1179
+ )
1180
+
1181
+ retry_config = None
1182
+ if isinstance(retries, utils.RetryConfig):
1183
+ retry_config = (retries, ["5xx"])
1184
+
1185
+ http_res = await self.do_request_async(
1186
+ hook_ctx=HookContext(
1187
+ config=self.sdk_configuration,
1188
+ base_url=base_url or "",
1189
+ operation_id="get-current-profile",
1190
+ oauth2_scopes=None,
1191
+ security_source=get_security_from_env(
1192
+ self.sdk_configuration.security, models.Security
1193
+ ),
1194
+ ),
1195
+ request=req,
1196
+ error_status_codes=["4XX", "5XX"],
1197
+ retry_config=retry_config,
1198
+ )
1199
+
1200
+ if utils.match_response(http_res, "200", "application/hal+json"):
1201
+ return unmarshal_json_response(models.ProfileResponse, http_res)
1202
+ if utils.match_response(http_res, "4XX", "*"):
1203
+ http_res_text = await utils.stream_to_text_async(http_res)
1204
+ raise models.APIError("API error occurred", http_res, http_res_text)
1205
+ if utils.match_response(http_res, "5XX", "*"):
1206
+ http_res_text = await utils.stream_to_text_async(http_res)
1207
+ raise models.APIError("API error occurred", http_res, http_res_text)
1208
+
1209
+ raise models.APIError("Unexpected response received", http_res)