Skip to content

Commit 7bdb527

Browse files
fix: add name to Axon (#8277)
1 parent 618f1bb commit 7bdb527

File tree

7 files changed

+75
-7
lines changed

7 files changed

+75
-7
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 122
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-82e6ea2fc76e43ff397ca1d9997693307a006ef30ec1a001c0283319a3e2eb3b.yml
3-
openapi_spec_hash: 69cf8a2d13bda298f2b588bd3ba1e562
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-32e4b2dfb75745be076697d252bd80aff21c08464750928ffe2b7dd997d0b443.yml
3+
openapi_spec_hash: eb0ccabfcda0fb8c56b53939b56f6d80
44
config_hash: c422b761c745873bce8fa5ccf03b7b98

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ from runloop_api_client.types import (
104104

105105
Methods:
106106

107-
- <code title="post /v1/axons">client.axons.<a href="./src/runloop_api_client/resources/axons.py">create</a>() -> <a href="./src/runloop_api_client/types/axon_view.py">AxonView</a></code>
107+
- <code title="post /v1/axons">client.axons.<a href="./src/runloop_api_client/resources/axons.py">create</a>(\*\*<a href="src/runloop_api_client/types/axon_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/axon_view.py">AxonView</a></code>
108108
- <code title="get /v1/axons/{id}">client.axons.<a href="./src/runloop_api_client/resources/axons.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/axon_view.py">AxonView</a></code>
109109
- <code title="get /v1/axons">client.axons.<a href="./src/runloop_api_client/resources/axons.py">list</a>() -> <a href="./src/runloop_api_client/types/axon_list_view.py">AxonListView</a></code>
110110
- <code title="post /v1/axons/{id}/publish">client.axons.<a href="./src/runloop_api_client/resources/axons.py">publish</a>(id, \*\*<a href="src/runloop_api_client/types/axon_publish_params.py">params</a>) -> <a href="./src/runloop_api_client/types/publish_result_view.py">PublishResultView</a></code>

src/runloop_api_client/resources/axons.py

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
from __future__ import annotations
44

5+
from typing import Optional
56
from typing_extensions import Literal
67

78
import httpx
89

9-
from ..types import axon_publish_params
10-
from .._types import Body, Query, Headers, NotGiven, not_given
10+
from ..types import axon_create_params, axon_publish_params
11+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
1112
from .._utils import path_template, maybe_transform, async_maybe_transform
1213
from .._compat import cached_property
1314
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -50,6 +51,7 @@ def with_streaming_response(self) -> AxonsResourceWithStreamingResponse:
5051
def create(
5152
self,
5253
*,
54+
name: Optional[str] | Omit = omit,
5355
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5456
# The extra values given here take precedence over values defined on the client or passed to this method.
5557
extra_headers: Headers | None = None,
@@ -58,9 +60,25 @@ def create(
5860
timeout: float | httpx.Timeout | None | NotGiven = not_given,
5961
idempotency_key: str | None = None,
6062
) -> AxonView:
61-
"""[Beta] Create a new axon."""
63+
"""
64+
[Beta] Create a new axon.
65+
66+
Args:
67+
name: (Optional) Name for the axon.
68+
69+
extra_headers: Send extra headers
70+
71+
extra_query: Add additional query parameters to the request
72+
73+
extra_body: Add additional JSON properties to the request
74+
75+
timeout: Override the client-level default timeout for this request, in seconds
76+
77+
idempotency_key: Specify a custom idempotency key for this request
78+
"""
6279
return self._post(
6380
"/v1/axons",
81+
body=maybe_transform({"name": name}, axon_create_params.AxonCreateParams),
6482
options=make_request_options(
6583
extra_headers=extra_headers,
6684
extra_query=extra_query,
@@ -243,6 +261,7 @@ def with_streaming_response(self) -> AsyncAxonsResourceWithStreamingResponse:
243261
async def create(
244262
self,
245263
*,
264+
name: Optional[str] | Omit = omit,
246265
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
247266
# The extra values given here take precedence over values defined on the client or passed to this method.
248267
extra_headers: Headers | None = None,
@@ -251,9 +270,25 @@ async def create(
251270
timeout: float | httpx.Timeout | None | NotGiven = not_given,
252271
idempotency_key: str | None = None,
253272
) -> AxonView:
254-
"""[Beta] Create a new axon."""
273+
"""
274+
[Beta] Create a new axon.
275+
276+
Args:
277+
name: (Optional) Name for the axon.
278+
279+
extra_headers: Send extra headers
280+
281+
extra_query: Add additional query parameters to the request
282+
283+
extra_body: Add additional JSON properties to the request
284+
285+
timeout: Override the client-level default timeout for this request, in seconds
286+
287+
idempotency_key: Specify a custom idempotency key for this request
288+
"""
255289
return await self._post(
256290
"/v1/axons",
291+
body=await async_maybe_transform({"name": name}, axon_create_params.AxonCreateParams),
257292
options=make_request_options(
258293
extra_headers=extra_headers,
259294
extra_query=extra_query,

src/runloop_api_client/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from .secret_list_view import SecretListView as SecretListView
3434
from .agent_list_params import AgentListParams as AgentListParams
3535
from .scenario_run_view import ScenarioRunView as ScenarioRunView
36+
from .axon_create_params import AxonCreateParams as AxonCreateParams
3637
from .benchmark_job_view import BenchmarkJobView as BenchmarkJobView
3738
from .benchmark_run_view import BenchmarkRunView as BenchmarkRunView
3839
from .devbox_list_params import DevboxListParams as DevboxListParams
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
from typing_extensions import TypedDict
7+
8+
__all__ = ["AxonCreateParams"]
9+
10+
11+
class AxonCreateParams(TypedDict, total=False):
12+
name: Optional[str]
13+
"""(Optional) Name for the axon."""

src/runloop_api_client/types/axon_view.py

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

3+
from typing import Optional
4+
35
from .._models import BaseModel
46

57
__all__ = ["AxonView"]
@@ -11,3 +13,6 @@ class AxonView(BaseModel):
1113

1214
created_at_ms: int
1315
"""Creation time in milliseconds since epoch."""
16+
17+
name: Optional[str] = None
18+
"""The name of the axon."""

tests/api_resources/test_axons.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ def test_method_create(self, client: Runloop) -> None:
2222
axon = client.axons.create()
2323
assert_matches_type(AxonView, axon, path=["response"])
2424

25+
@parametrize
26+
def test_method_create_with_all_params(self, client: Runloop) -> None:
27+
axon = client.axons.create(
28+
name="name",
29+
)
30+
assert_matches_type(AxonView, axon, path=["response"])
31+
2532
@parametrize
2633
def test_raw_response_create(self, client: Runloop) -> None:
2734
response = client.axons.with_raw_response.create()
@@ -207,6 +214,13 @@ async def test_method_create(self, async_client: AsyncRunloop) -> None:
207214
axon = await async_client.axons.create()
208215
assert_matches_type(AxonView, axon, path=["response"])
209216

217+
@parametrize
218+
async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -> None:
219+
axon = await async_client.axons.create(
220+
name="name",
221+
)
222+
assert_matches_type(AxonView, axon, path=["response"])
223+
210224
@parametrize
211225
async def test_raw_response_create(self, async_client: AsyncRunloop) -> None:
212226
response = await async_client.axons.with_raw_response.create()

0 commit comments

Comments
 (0)