|
17 | 17 | subscription_list_params,
|
18 | 18 | subscription_cancel_params,
|
19 | 19 | subscription_create_params,
|
| 20 | + subscription_update_params, |
20 | 21 | subscription_fetch_costs_params,
|
21 | 22 | subscription_fetch_usage_params,
|
22 | 23 | subscription_trigger_phase_params,
|
@@ -536,6 +537,83 @@ def create(
|
536 | 537 | cast_to=Subscription,
|
537 | 538 | )
|
538 | 539 |
|
| 540 | + def update( |
| 541 | + self, |
| 542 | + subscription_id: str, |
| 543 | + *, |
| 544 | + auto_collection: Optional[bool] | NotGiven = NOT_GIVEN, |
| 545 | + default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN, |
| 546 | + invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN, |
| 547 | + metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, |
| 548 | + net_terms: Optional[int] | NotGiven = NOT_GIVEN, |
| 549 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 550 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 551 | + extra_headers: Headers | None = None, |
| 552 | + extra_query: Query | None = None, |
| 553 | + extra_body: Body | None = None, |
| 554 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 555 | + idempotency_key: str | None = None, |
| 556 | + ) -> Subscription: |
| 557 | + """ |
| 558 | + This endpoint can be used to update the `metadata`, `net terms`, |
| 559 | + `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties |
| 560 | + on a subscription. |
| 561 | +
|
| 562 | + Args: |
| 563 | + auto_collection: Determines whether issued invoices for this subscription will automatically be |
| 564 | + charged with the saved payment method on the due date. This property defaults to |
| 565 | + the plan's behavior. |
| 566 | +
|
| 567 | + default_invoice_memo: Determines the default memo on this subscription's invoices. Note that if this |
| 568 | + is not provided, it is determined by the plan configuration. |
| 569 | +
|
| 570 | + invoicing_threshold: When this subscription's accrued usage reaches this threshold, an invoice will |
| 571 | + be issued for the subscription. If not specified, invoices will only be issued |
| 572 | + at the end of the billing period. |
| 573 | +
|
| 574 | + metadata: User-specified key/value pairs for the resource. Individual keys can be removed |
| 575 | + by setting the value to `null`, and the entire metadata mapping can be cleared |
| 576 | + by setting `metadata` to `null`. |
| 577 | +
|
| 578 | + net_terms: Determines the difference between the invoice issue date for subscription |
| 579 | + invoices as the date that they are due. A value of `0` here represents that the |
| 580 | + invoice is due on issue, whereas a value of `30` represents that the customer |
| 581 | + has a month to pay the invoice. |
| 582 | +
|
| 583 | + extra_headers: Send extra headers |
| 584 | +
|
| 585 | + extra_query: Add additional query parameters to the request |
| 586 | +
|
| 587 | + extra_body: Add additional JSON properties to the request |
| 588 | +
|
| 589 | + timeout: Override the client-level default timeout for this request, in seconds |
| 590 | +
|
| 591 | + idempotency_key: Specify a custom idempotency key for this request |
| 592 | + """ |
| 593 | + if not subscription_id: |
| 594 | + raise ValueError(f"Expected a non-empty value for `subscription_id` but received {subscription_id!r}") |
| 595 | + return self._put( |
| 596 | + f"/subscriptions/{subscription_id}", |
| 597 | + body=maybe_transform( |
| 598 | + { |
| 599 | + "auto_collection": auto_collection, |
| 600 | + "default_invoice_memo": default_invoice_memo, |
| 601 | + "invoicing_threshold": invoicing_threshold, |
| 602 | + "metadata": metadata, |
| 603 | + "net_terms": net_terms, |
| 604 | + }, |
| 605 | + subscription_update_params.SubscriptionUpdateParams, |
| 606 | + ), |
| 607 | + options=make_request_options( |
| 608 | + extra_headers=extra_headers, |
| 609 | + extra_query=extra_query, |
| 610 | + extra_body=extra_body, |
| 611 | + timeout=timeout, |
| 612 | + idempotency_key=idempotency_key, |
| 613 | + ), |
| 614 | + cast_to=Subscription, |
| 615 | + ) |
| 616 | + |
539 | 617 | def list(
|
540 | 618 | self,
|
541 | 619 | *,
|
@@ -2166,6 +2244,83 @@ async def create(
|
2166 | 2244 | cast_to=Subscription,
|
2167 | 2245 | )
|
2168 | 2246 |
|
| 2247 | + async def update( |
| 2248 | + self, |
| 2249 | + subscription_id: str, |
| 2250 | + *, |
| 2251 | + auto_collection: Optional[bool] | NotGiven = NOT_GIVEN, |
| 2252 | + default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN, |
| 2253 | + invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN, |
| 2254 | + metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, |
| 2255 | + net_terms: Optional[int] | NotGiven = NOT_GIVEN, |
| 2256 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 2257 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 2258 | + extra_headers: Headers | None = None, |
| 2259 | + extra_query: Query | None = None, |
| 2260 | + extra_body: Body | None = None, |
| 2261 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 2262 | + idempotency_key: str | None = None, |
| 2263 | + ) -> Subscription: |
| 2264 | + """ |
| 2265 | + This endpoint can be used to update the `metadata`, `net terms`, |
| 2266 | + `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties |
| 2267 | + on a subscription. |
| 2268 | +
|
| 2269 | + Args: |
| 2270 | + auto_collection: Determines whether issued invoices for this subscription will automatically be |
| 2271 | + charged with the saved payment method on the due date. This property defaults to |
| 2272 | + the plan's behavior. |
| 2273 | +
|
| 2274 | + default_invoice_memo: Determines the default memo on this subscription's invoices. Note that if this |
| 2275 | + is not provided, it is determined by the plan configuration. |
| 2276 | +
|
| 2277 | + invoicing_threshold: When this subscription's accrued usage reaches this threshold, an invoice will |
| 2278 | + be issued for the subscription. If not specified, invoices will only be issued |
| 2279 | + at the end of the billing period. |
| 2280 | +
|
| 2281 | + metadata: User-specified key/value pairs for the resource. Individual keys can be removed |
| 2282 | + by setting the value to `null`, and the entire metadata mapping can be cleared |
| 2283 | + by setting `metadata` to `null`. |
| 2284 | +
|
| 2285 | + net_terms: Determines the difference between the invoice issue date for subscription |
| 2286 | + invoices as the date that they are due. A value of `0` here represents that the |
| 2287 | + invoice is due on issue, whereas a value of `30` represents that the customer |
| 2288 | + has a month to pay the invoice. |
| 2289 | +
|
| 2290 | + extra_headers: Send extra headers |
| 2291 | +
|
| 2292 | + extra_query: Add additional query parameters to the request |
| 2293 | +
|
| 2294 | + extra_body: Add additional JSON properties to the request |
| 2295 | +
|
| 2296 | + timeout: Override the client-level default timeout for this request, in seconds |
| 2297 | +
|
| 2298 | + idempotency_key: Specify a custom idempotency key for this request |
| 2299 | + """ |
| 2300 | + if not subscription_id: |
| 2301 | + raise ValueError(f"Expected a non-empty value for `subscription_id` but received {subscription_id!r}") |
| 2302 | + return await self._put( |
| 2303 | + f"/subscriptions/{subscription_id}", |
| 2304 | + body=await async_maybe_transform( |
| 2305 | + { |
| 2306 | + "auto_collection": auto_collection, |
| 2307 | + "default_invoice_memo": default_invoice_memo, |
| 2308 | + "invoicing_threshold": invoicing_threshold, |
| 2309 | + "metadata": metadata, |
| 2310 | + "net_terms": net_terms, |
| 2311 | + }, |
| 2312 | + subscription_update_params.SubscriptionUpdateParams, |
| 2313 | + ), |
| 2314 | + options=make_request_options( |
| 2315 | + extra_headers=extra_headers, |
| 2316 | + extra_query=extra_query, |
| 2317 | + extra_body=extra_body, |
| 2318 | + timeout=timeout, |
| 2319 | + idempotency_key=idempotency_key, |
| 2320 | + ), |
| 2321 | + cast_to=Subscription, |
| 2322 | + ) |
| 2323 | + |
2169 | 2324 | def list(
|
2170 | 2325 | self,
|
2171 | 2326 | *,
|
@@ -3310,6 +3465,9 @@ def __init__(self, subscriptions: Subscriptions) -> None:
|
3310 | 3465 | self.create = _legacy_response.to_raw_response_wrapper(
|
3311 | 3466 | subscriptions.create,
|
3312 | 3467 | )
|
| 3468 | + self.update = _legacy_response.to_raw_response_wrapper( |
| 3469 | + subscriptions.update, |
| 3470 | + ) |
3313 | 3471 | self.list = _legacy_response.to_raw_response_wrapper(
|
3314 | 3472 | subscriptions.list,
|
3315 | 3473 | )
|
@@ -3358,6 +3516,9 @@ def __init__(self, subscriptions: AsyncSubscriptions) -> None:
|
3358 | 3516 | self.create = _legacy_response.async_to_raw_response_wrapper(
|
3359 | 3517 | subscriptions.create,
|
3360 | 3518 | )
|
| 3519 | + self.update = _legacy_response.async_to_raw_response_wrapper( |
| 3520 | + subscriptions.update, |
| 3521 | + ) |
3361 | 3522 | self.list = _legacy_response.async_to_raw_response_wrapper(
|
3362 | 3523 | subscriptions.list,
|
3363 | 3524 | )
|
@@ -3406,6 +3567,9 @@ def __init__(self, subscriptions: Subscriptions) -> None:
|
3406 | 3567 | self.create = to_streamed_response_wrapper(
|
3407 | 3568 | subscriptions.create,
|
3408 | 3569 | )
|
| 3570 | + self.update = to_streamed_response_wrapper( |
| 3571 | + subscriptions.update, |
| 3572 | + ) |
3409 | 3573 | self.list = to_streamed_response_wrapper(
|
3410 | 3574 | subscriptions.list,
|
3411 | 3575 | )
|
@@ -3454,6 +3618,9 @@ def __init__(self, subscriptions: AsyncSubscriptions) -> None:
|
3454 | 3618 | self.create = async_to_streamed_response_wrapper(
|
3455 | 3619 | subscriptions.create,
|
3456 | 3620 | )
|
| 3621 | + self.update = async_to_streamed_response_wrapper( |
| 3622 | + subscriptions.update, |
| 3623 | + ) |
3457 | 3624 | self.list = async_to_streamed_response_wrapper(
|
3458 | 3625 | subscriptions.list,
|
3459 | 3626 | )
|
|
0 commit comments