|
23 | 23 | EventsResourceWithStreamingResponse, |
24 | 24 | AsyncEventsResourceWithStreamingResponse, |
25 | 25 | ) |
26 | | -from ...types import axon_list_params, axon_create_params, axon_publish_params, axon_subscribe_sse_params |
| 26 | +from ...types import ( |
| 27 | + axon_list_params, |
| 28 | + axon_create_params, |
| 29 | + axon_update_params, |
| 30 | + axon_publish_params, |
| 31 | + axon_subscribe_sse_params, |
| 32 | +) |
27 | 33 | from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given |
28 | 34 | from ..._utils import path_template, maybe_transform, async_maybe_transform |
29 | 35 | from ..._compat import cached_property |
@@ -155,6 +161,53 @@ def retrieve( |
155 | 161 | cast_to=AxonView, |
156 | 162 | ) |
157 | 163 |
|
| 164 | + def update( |
| 165 | + self, |
| 166 | + id: str, |
| 167 | + *, |
| 168 | + metadata: Optional[Dict[str, str]] | Omit = omit, |
| 169 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 170 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 171 | + extra_headers: Headers | None = None, |
| 172 | + extra_query: Query | None = None, |
| 173 | + extra_body: Body | None = None, |
| 174 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 175 | + idempotency_key: str | None = None, |
| 176 | + ) -> AxonView: |
| 177 | + """[Beta] Updates the specified axon fields. |
| 178 | +
|
| 179 | + Omitted fields are left unchanged. An |
| 180 | + empty metadata map clears the metadata. |
| 181 | +
|
| 182 | + Args: |
| 183 | + metadata: User defined metadata to replace the axon metadata. Omit or set to null to leave |
| 184 | + unchanged, or set to an empty map to clear it. |
| 185 | +
|
| 186 | + extra_headers: Send extra headers |
| 187 | +
|
| 188 | + extra_query: Add additional query parameters to the request |
| 189 | +
|
| 190 | + extra_body: Add additional JSON properties to the request |
| 191 | +
|
| 192 | + timeout: Override the client-level default timeout for this request, in seconds |
| 193 | +
|
| 194 | + idempotency_key: Specify a custom idempotency key for this request |
| 195 | + """ |
| 196 | + if not id: |
| 197 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 198 | + return self._post( |
| 199 | + path_template("/v1/axons/{id}", id=id), |
| 200 | + body=maybe_transform({"metadata": metadata}, axon_update_params.AxonUpdateParams), |
| 201 | + options=make_request_options( |
| 202 | + extra_headers=extra_headers, |
| 203 | + extra_query=extra_query, |
| 204 | + extra_body=extra_body, |
| 205 | + timeout=timeout, |
| 206 | + idempotency_key=idempotency_key, |
| 207 | + ), |
| 208 | + cast_to=AxonView, |
| 209 | + ) |
| 210 | + |
158 | 211 | def list( |
159 | 212 | self, |
160 | 213 | *, |
@@ -488,6 +541,53 @@ async def retrieve( |
488 | 541 | cast_to=AxonView, |
489 | 542 | ) |
490 | 543 |
|
| 544 | + async def update( |
| 545 | + self, |
| 546 | + id: str, |
| 547 | + *, |
| 548 | + metadata: Optional[Dict[str, str]] | Omit = omit, |
| 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 | + ) -> AxonView: |
| 557 | + """[Beta] Updates the specified axon fields. |
| 558 | +
|
| 559 | + Omitted fields are left unchanged. An |
| 560 | + empty metadata map clears the metadata. |
| 561 | +
|
| 562 | + Args: |
| 563 | + metadata: User defined metadata to replace the axon metadata. Omit or set to null to leave |
| 564 | + unchanged, or set to an empty map to clear it. |
| 565 | +
|
| 566 | + extra_headers: Send extra headers |
| 567 | +
|
| 568 | + extra_query: Add additional query parameters to the request |
| 569 | +
|
| 570 | + extra_body: Add additional JSON properties to the request |
| 571 | +
|
| 572 | + timeout: Override the client-level default timeout for this request, in seconds |
| 573 | +
|
| 574 | + idempotency_key: Specify a custom idempotency key for this request |
| 575 | + """ |
| 576 | + if not id: |
| 577 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 578 | + return await self._post( |
| 579 | + path_template("/v1/axons/{id}", id=id), |
| 580 | + body=await async_maybe_transform({"metadata": metadata}, axon_update_params.AxonUpdateParams), |
| 581 | + options=make_request_options( |
| 582 | + extra_headers=extra_headers, |
| 583 | + extra_query=extra_query, |
| 584 | + extra_body=extra_body, |
| 585 | + timeout=timeout, |
| 586 | + idempotency_key=idempotency_key, |
| 587 | + ), |
| 588 | + cast_to=AxonView, |
| 589 | + ) |
| 590 | + |
491 | 591 | def list( |
492 | 592 | self, |
493 | 593 | *, |
@@ -720,6 +820,9 @@ def __init__(self, axons: AxonsResource) -> None: |
720 | 820 | self.retrieve = to_raw_response_wrapper( |
721 | 821 | axons.retrieve, |
722 | 822 | ) |
| 823 | + self.update = to_raw_response_wrapper( |
| 824 | + axons.update, |
| 825 | + ) |
723 | 826 | self.list = to_raw_response_wrapper( |
724 | 827 | axons.list, |
725 | 828 | ) |
@@ -752,6 +855,9 @@ def __init__(self, axons: AsyncAxonsResource) -> None: |
752 | 855 | self.retrieve = async_to_raw_response_wrapper( |
753 | 856 | axons.retrieve, |
754 | 857 | ) |
| 858 | + self.update = async_to_raw_response_wrapper( |
| 859 | + axons.update, |
| 860 | + ) |
755 | 861 | self.list = async_to_raw_response_wrapper( |
756 | 862 | axons.list, |
757 | 863 | ) |
@@ -784,6 +890,9 @@ def __init__(self, axons: AxonsResource) -> None: |
784 | 890 | self.retrieve = to_streamed_response_wrapper( |
785 | 891 | axons.retrieve, |
786 | 892 | ) |
| 893 | + self.update = to_streamed_response_wrapper( |
| 894 | + axons.update, |
| 895 | + ) |
787 | 896 | self.list = to_streamed_response_wrapper( |
788 | 897 | axons.list, |
789 | 898 | ) |
@@ -816,6 +925,9 @@ def __init__(self, axons: AsyncAxonsResource) -> None: |
816 | 925 | self.retrieve = async_to_streamed_response_wrapper( |
817 | 926 | axons.retrieve, |
818 | 927 | ) |
| 928 | + self.update = async_to_streamed_response_wrapper( |
| 929 | + axons.update, |
| 930 | + ) |
819 | 931 | self.list = async_to_streamed_response_wrapper( |
820 | 932 | axons.list, |
821 | 933 | ) |
|
0 commit comments