Skip to content

Commit 3e9232b

Browse files
fix: add name to Axon (#8277)
1 parent 6966e67 commit 3e9232b

4 files changed

Lines changed: 35 additions & 7 deletions

File tree

.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
@@ -89,7 +89,7 @@ Types:
8989

9090
Methods:
9191

92-
- <code title="post /v1/axons">client.axons.<a href="./src/resources/axons.ts">create</a>() -> AxonView</code>
92+
- <code title="post /v1/axons">client.axons.<a href="./src/resources/axons.ts">create</a>({ ...params }) -> AxonView</code>
9393
- <code title="get /v1/axons/{id}">client.axons.<a href="./src/resources/axons.ts">retrieve</a>(id) -> AxonView</code>
9494
- <code title="get /v1/axons">client.axons.<a href="./src/resources/axons.ts">list</a>() -> AxonListView</code>
9595
- <code title="post /v1/axons/{id}/publish">client.axons.<a href="./src/resources/axons.ts">publish</a>(id, { ...params }) -> PublishResultView</code>

src/resources/axons.ts

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

33
import { APIResource } from '../resource';
4+
import { isRequestOptions } from '../core';
45
import { APIPromise } from '../core';
56
import * as Core from '../core';
67
import { Stream } from '../streaming';
@@ -9,10 +10,15 @@ export class Axons extends APIResource {
910
/**
1011
* [Beta] Create a new axon.
1112
*/
13+
create(body?: AxonCreateParams, options?: Core.RequestOptions): Core.APIPromise<AxonView>;
14+
create(options?: Core.RequestOptions): Core.APIPromise<AxonView>;
1215
create(
13-
body?: AxonCreateParams | null | undefined,
16+
body: AxonCreateParams | Core.RequestOptions = {},
1417
options?: Core.RequestOptions,
1518
): Core.APIPromise<AxonView> {
19+
if (isRequestOptions(body)) {
20+
return this.create({}, body);
21+
}
1622
return this._client.post('/v1/axons', { body, ...options });
1723
}
1824

@@ -51,7 +57,12 @@ export class Axons extends APIResource {
5157
}
5258
}
5359

54-
export type AxonCreateParams = unknown;
60+
export interface AxonCreateParams {
61+
/**
62+
* (Optional) Name for the axon.
63+
*/
64+
name?: string | null;
65+
}
5566

5667
export interface AxonEventView {
5768
/**
@@ -107,6 +118,11 @@ export interface AxonView {
107118
* Creation time in milliseconds since epoch.
108119
*/
109120
created_at_ms: number;
121+
122+
/**
123+
* The name of the axon.
124+
*/
125+
name?: string | null;
110126
}
111127

112128
export interface PublishParams {
@@ -143,7 +159,12 @@ export interface PublishResultView {
143159
timestamp_ms: number;
144160
}
145161

146-
export interface AxonCreateParams {}
162+
export interface AxonCreateParams {
163+
/**
164+
* (Optional) Name for the axon.
165+
*/
166+
name?: string | null;
167+
}
147168

148169
export interface AxonPublishParams {
149170
/**

tests/api-resources/axons.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@ describe('resource axons', () => {
2020
expect(dataAndResponse.response).toBe(rawResponse);
2121
});
2222

23+
test('create: request options instead of params are passed correctly', async () => {
24+
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
25+
await expect(client.axons.create({ path: '/_stainless_unknown_path' })).rejects.toThrow(
26+
Runloop.NotFoundError,
27+
);
28+
});
29+
2330
test('create: request options and params are passed correctly', async () => {
2431
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
25-
await expect(client.axons.create({}, { path: '/_stainless_unknown_path' })).rejects.toThrow(
32+
await expect(client.axons.create({ name: 'name' }, { path: '/_stainless_unknown_path' })).rejects.toThrow(
2633
Runloop.NotFoundError,
2734
);
2835
});

0 commit comments

Comments
 (0)