Skip to content

Commit d2a4242

Browse files
author
stlc-bot
committed
feat(axon): accept user metadata at creation
Stainless-Generated-From: 8365e99960676cdb8b7040e31597aefd6c9e8f39
1 parent 582ab9d commit d2a4242

5 files changed

Lines changed: 32 additions & 6 deletions

File tree

scripts/mock

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/runloop_api_client/resources/axons/axons.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Dict, Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -75,6 +75,7 @@ def with_streaming_response(self) -> AxonsResourceWithStreamingResponse:
7575
def create(
7676
self,
7777
*,
78+
metadata: Optional[Dict[str, str]] | Omit = omit,
7879
name: Optional[str] | Omit = omit,
7980
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8081
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -88,6 +89,8 @@ def create(
8889
[Beta] Create a new axon.
8990
9091
Args:
92+
metadata: User defined metadata to attach to the axon for organization.
93+
9194
name: (Optional) Name for the axon.
9295
9396
extra_headers: Send extra headers
@@ -102,7 +105,13 @@ def create(
102105
"""
103106
return self._post(
104107
"/v1/axons",
105-
body=maybe_transform({"name": name}, axon_create_params.AxonCreateParams),
108+
body=maybe_transform(
109+
{
110+
"metadata": metadata,
111+
"name": name,
112+
},
113+
axon_create_params.AxonCreateParams,
114+
),
106115
options=make_request_options(
107116
extra_headers=extra_headers,
108117
extra_query=extra_query,
@@ -390,6 +399,7 @@ def with_streaming_response(self) -> AsyncAxonsResourceWithStreamingResponse:
390399
async def create(
391400
self,
392401
*,
402+
metadata: Optional[Dict[str, str]] | Omit = omit,
393403
name: Optional[str] | Omit = omit,
394404
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
395405
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -403,6 +413,8 @@ async def create(
403413
[Beta] Create a new axon.
404414
405415
Args:
416+
metadata: User defined metadata to attach to the axon for organization.
417+
406418
name: (Optional) Name for the axon.
407419
408420
extra_headers: Send extra headers
@@ -417,7 +429,13 @@ async def create(
417429
"""
418430
return await self._post(
419431
"/v1/axons",
420-
body=await async_maybe_transform({"name": name}, axon_create_params.AxonCreateParams),
432+
body=await async_maybe_transform(
433+
{
434+
"metadata": metadata,
435+
"name": name,
436+
},
437+
axon_create_params.AxonCreateParams,
438+
),
421439
options=make_request_options(
422440
extra_headers=extra_headers,
423441
extra_query=extra_query,

src/runloop_api_client/types/axon_create_params.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Dict, Optional
66
from typing_extensions import TypedDict
77

88
__all__ = ["AxonCreateParams"]
99

1010

1111
class AxonCreateParams(TypedDict, total=False):
12+
metadata: Optional[Dict[str, str]]
13+
"""User defined metadata to attach to the axon for organization."""
14+
1215
name: Optional[str]
1316
"""(Optional) Name for the axon."""

src/runloop_api_client/types/axon_view.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Optional
3+
from typing import Dict, Optional
44

55
from .._models import BaseModel
66

@@ -14,5 +14,8 @@ class AxonView(BaseModel):
1414
created_at_ms: int
1515
"""Creation time in milliseconds since epoch."""
1616

17+
metadata: Dict[str, str]
18+
"""The user defined axon metadata."""
19+
1720
name: Optional[str] = None
1821
"""The name of the axon."""

tests/api_resources/test_axons.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def test_method_create(self, client: Runloop) -> None:
2929
@parametrize
3030
def test_method_create_with_all_params(self, client: Runloop) -> None:
3131
axon = client.axons.create(
32+
metadata={"foo": "string"},
3233
name="name",
3334
)
3435
assert_matches_type(AxonView, axon, path=["response"])
@@ -279,6 +280,7 @@ async def test_method_create(self, async_client: AsyncRunloop) -> None:
279280
@parametrize
280281
async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -> None:
281282
axon = await async_client.axons.create(
283+
metadata={"foo": "string"},
282284
name="name",
283285
)
284286
assert_matches_type(AxonView, axon, path=["response"])

0 commit comments

Comments
 (0)