|
19 | 19 | alert_create_for_external_customer_params, |
20 | 20 | ) |
21 | 21 | from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given |
22 | | -from .._utils import maybe_transform, async_maybe_transform |
| 22 | +from .._utils import path_template, maybe_transform, async_maybe_transform |
23 | 23 | from .._compat import cached_property |
24 | 24 | from .._resource import SyncAPIResource, AsyncAPIResource |
25 | 25 | from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper |
@@ -84,7 +84,7 @@ def retrieve( |
84 | 84 | if not alert_id: |
85 | 85 | raise ValueError(f"Expected a non-empty value for `alert_id` but received {alert_id!r}") |
86 | 86 | return self._get( |
87 | | - f"/alerts/{alert_id}", |
| 87 | + path_template("/alerts/{alert_id}", alert_id=alert_id), |
88 | 88 | options=make_request_options( |
89 | 89 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
90 | 90 | ), |
@@ -125,7 +125,7 @@ def update( |
125 | 125 | f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
126 | 126 | ) |
127 | 127 | return self._put( |
128 | | - f"/alerts/{alert_configuration_id}", |
| 128 | + path_template("/alerts/{alert_configuration_id}", alert_configuration_id=alert_configuration_id), |
129 | 129 | body=maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams), |
130 | 130 | options=make_request_options( |
131 | 131 | extra_headers=extra_headers, |
@@ -261,7 +261,7 @@ def create_for_customer( |
261 | 261 | if not customer_id: |
262 | 262 | raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}") |
263 | 263 | return self._post( |
264 | | - f"/alerts/customer_id/{customer_id}", |
| 264 | + path_template("/alerts/customer_id/{customer_id}", customer_id=customer_id), |
265 | 265 | body=maybe_transform( |
266 | 266 | { |
267 | 267 | "currency": currency, |
@@ -328,7 +328,9 @@ def create_for_external_customer( |
328 | 328 | f"Expected a non-empty value for `external_customer_id` but received {external_customer_id!r}" |
329 | 329 | ) |
330 | 330 | return self._post( |
331 | | - f"/alerts/external_customer_id/{external_customer_id}", |
| 331 | + path_template( |
| 332 | + "/alerts/external_customer_id/{external_customer_id}", external_customer_id=external_customer_id |
| 333 | + ), |
332 | 334 | body=maybe_transform( |
333 | 335 | { |
334 | 336 | "currency": currency, |
@@ -403,7 +405,7 @@ def create_for_subscription( |
403 | 405 | if not subscription_id: |
404 | 406 | raise ValueError(f"Expected a non-empty value for `subscription_id` but received {subscription_id!r}") |
405 | 407 | return self._post( |
406 | | - f"/alerts/subscription_id/{subscription_id}", |
| 408 | + path_template("/alerts/subscription_id/{subscription_id}", subscription_id=subscription_id), |
407 | 409 | body=maybe_transform( |
408 | 410 | { |
409 | 411 | "thresholds": thresholds, |
@@ -461,7 +463,7 @@ def disable( |
461 | 463 | f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
462 | 464 | ) |
463 | 465 | return self._post( |
464 | | - f"/alerts/{alert_configuration_id}/disable", |
| 466 | + path_template("/alerts/{alert_configuration_id}/disable", alert_configuration_id=alert_configuration_id), |
465 | 467 | options=make_request_options( |
466 | 468 | extra_headers=extra_headers, |
467 | 469 | extra_query=extra_query, |
@@ -510,7 +512,7 @@ def enable( |
510 | 512 | f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
511 | 513 | ) |
512 | 514 | return self._post( |
513 | | - f"/alerts/{alert_configuration_id}/enable", |
| 515 | + path_template("/alerts/{alert_configuration_id}/enable", alert_configuration_id=alert_configuration_id), |
514 | 516 | options=make_request_options( |
515 | 517 | extra_headers=extra_headers, |
516 | 518 | extra_query=extra_query, |
@@ -576,7 +578,7 @@ async def retrieve( |
576 | 578 | if not alert_id: |
577 | 579 | raise ValueError(f"Expected a non-empty value for `alert_id` but received {alert_id!r}") |
578 | 580 | return await self._get( |
579 | | - f"/alerts/{alert_id}", |
| 581 | + path_template("/alerts/{alert_id}", alert_id=alert_id), |
580 | 582 | options=make_request_options( |
581 | 583 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
582 | 584 | ), |
@@ -617,7 +619,7 @@ async def update( |
617 | 619 | f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
618 | 620 | ) |
619 | 621 | return await self._put( |
620 | | - f"/alerts/{alert_configuration_id}", |
| 622 | + path_template("/alerts/{alert_configuration_id}", alert_configuration_id=alert_configuration_id), |
621 | 623 | body=await async_maybe_transform({"thresholds": thresholds}, alert_update_params.AlertUpdateParams), |
622 | 624 | options=make_request_options( |
623 | 625 | extra_headers=extra_headers, |
@@ -753,7 +755,7 @@ async def create_for_customer( |
753 | 755 | if not customer_id: |
754 | 756 | raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}") |
755 | 757 | return await self._post( |
756 | | - f"/alerts/customer_id/{customer_id}", |
| 758 | + path_template("/alerts/customer_id/{customer_id}", customer_id=customer_id), |
757 | 759 | body=await async_maybe_transform( |
758 | 760 | { |
759 | 761 | "currency": currency, |
@@ -820,7 +822,9 @@ async def create_for_external_customer( |
820 | 822 | f"Expected a non-empty value for `external_customer_id` but received {external_customer_id!r}" |
821 | 823 | ) |
822 | 824 | return await self._post( |
823 | | - f"/alerts/external_customer_id/{external_customer_id}", |
| 825 | + path_template( |
| 826 | + "/alerts/external_customer_id/{external_customer_id}", external_customer_id=external_customer_id |
| 827 | + ), |
824 | 828 | body=await async_maybe_transform( |
825 | 829 | { |
826 | 830 | "currency": currency, |
@@ -895,7 +899,7 @@ async def create_for_subscription( |
895 | 899 | if not subscription_id: |
896 | 900 | raise ValueError(f"Expected a non-empty value for `subscription_id` but received {subscription_id!r}") |
897 | 901 | return await self._post( |
898 | | - f"/alerts/subscription_id/{subscription_id}", |
| 902 | + path_template("/alerts/subscription_id/{subscription_id}", subscription_id=subscription_id), |
899 | 903 | body=await async_maybe_transform( |
900 | 904 | { |
901 | 905 | "thresholds": thresholds, |
@@ -953,7 +957,7 @@ async def disable( |
953 | 957 | f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
954 | 958 | ) |
955 | 959 | return await self._post( |
956 | | - f"/alerts/{alert_configuration_id}/disable", |
| 960 | + path_template("/alerts/{alert_configuration_id}/disable", alert_configuration_id=alert_configuration_id), |
957 | 961 | options=make_request_options( |
958 | 962 | extra_headers=extra_headers, |
959 | 963 | extra_query=extra_query, |
@@ -1004,7 +1008,7 @@ async def enable( |
1004 | 1008 | f"Expected a non-empty value for `alert_configuration_id` but received {alert_configuration_id!r}" |
1005 | 1009 | ) |
1006 | 1010 | return await self._post( |
1007 | | - f"/alerts/{alert_configuration_id}/enable", |
| 1011 | + path_template("/alerts/{alert_configuration_id}/enable", alert_configuration_id=alert_configuration_id), |
1008 | 1012 | options=make_request_options( |
1009 | 1013 | extra_headers=extra_headers, |
1010 | 1014 | extra_query=extra_query, |
|
0 commit comments