Skip to content

Commit 6966e67

Browse files
fix: add AxonEventView schema to OpenAPI spec for SSE subscribe endpoint (#8274)
1 parent 81f048a commit 6966e67

5 files changed

Lines changed: 57 additions & 4 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 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-d3f6f5cc574b570bb31c768e755f957273a97846257c7144ff5c0dcf7c00fd75.yml
3-
openapi_spec_hash: 8d7f2b3ed5c1504d3d238e0e43d45383
4-
config_hash: 1b42d9862d8d811030df0ac4094f7a1d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-82e6ea2fc76e43ff397ca1d9997693307a006ef30ec1a001c0283319a3e2eb3b.yml
3+
openapi_spec_hash: 69cf8a2d13bda298f2b588bd3ba1e562
4+
config_hash: c422b761c745873bce8fa5ccf03b7b98

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Methods:
8181
Types:
8282

8383
- <code><a href="./src/resources/axons.ts">AxonCreateParams</a></code>
84+
- <code><a href="./src/resources/axons.ts">AxonEventView</a></code>
8485
- <code><a href="./src/resources/axons.ts">AxonListView</a></code>
8586
- <code><a href="./src/resources/axons.ts">AxonView</a></code>
8687
- <code><a href="./src/resources/axons.ts">PublishParams</a></code>
@@ -92,7 +93,7 @@ Methods:
9293
- <code title="get /v1/axons/{id}">client.axons.<a href="./src/resources/axons.ts">retrieve</a>(id) -> AxonView</code>
9394
- <code title="get /v1/axons">client.axons.<a href="./src/resources/axons.ts">list</a>() -> AxonListView</code>
9495
- <code title="post /v1/axons/{id}/publish">client.axons.<a href="./src/resources/axons.ts">publish</a>(id, { ...params }) -> PublishResultView</code>
95-
- <code title="get /v1/axons/{id}/subscribe/sse">client.axons.<a href="./src/resources/axons.ts">subscribeSse</a>(id) -> void</code>
96+
- <code title="get /v1/axons/{id}/subscribe/sse">client.axons.<a href="./src/resources/axons.ts">subscribeSse</a>(id) -> AxonEventView</code>
9697

9798
# Blueprints
9899

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import {
4747
} from './resources/agents';
4848
import {
4949
AxonCreateParams,
50+
AxonEventView,
5051
AxonListView,
5152
AxonPublishParams,
5253
AxonView,
@@ -589,6 +590,7 @@ export declare namespace Runloop {
589590
export {
590591
Axons as Axons,
591592
type AxonCreateParams as AxonCreateParams,
593+
type AxonEventView as AxonEventView,
592594
type AxonListView as AxonListView,
593595
type AxonView as AxonView,
594596
type PublishParams as PublishParams,

src/resources/axons.ts

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

33
import { APIResource } from '../resource';
4+
import { APIPromise } from '../core';
45
import * as Core from '../core';
6+
import { Stream } from '../streaming';
57

68
export class Axons extends APIResource {
79
/**
@@ -38,10 +40,56 @@ export class Axons extends APIResource {
3840
): Core.APIPromise<PublishResultView> {
3941
return this._client.post(`/v1/axons/${id}/publish`, { body, ...options });
4042
}
43+
44+
/**
45+
* [Beta] Subscribe to an axon event stream via server-sent events.
46+
*/
47+
subscribeSse(id: string, options?: Core.RequestOptions): APIPromise<Stream<AxonEventView>> {
48+
return this._client.get(`/v1/axons/${id}/subscribe/sse`, { ...options, stream: true }) as APIPromise<
49+
Stream<AxonEventView>
50+
>;
51+
}
4152
}
4253

4354
export type AxonCreateParams = unknown;
4455

56+
export interface AxonEventView {
57+
/**
58+
* The axon identifier.
59+
*/
60+
axon_id: string;
61+
62+
/**
63+
* Event type (e.g. push, pull_request).
64+
*/
65+
event_type: string;
66+
67+
/**
68+
* Event origin.
69+
*/
70+
origin: 'EXTERNAL_EVENT' | 'AGENT_EVENT' | 'USER_EVENT' | 'SYSTEM_EVENT';
71+
72+
/**
73+
* JSON-encoded event payload.
74+
*/
75+
payload: string;
76+
77+
/**
78+
* Monotonic sequence number.
79+
*/
80+
sequence: number;
81+
82+
/**
83+
* Event source (e.g. github, slack).
84+
*/
85+
source: string;
86+
87+
/**
88+
* Timestamp in milliseconds since epoch.
89+
*/
90+
timestamp_ms: number;
91+
}
92+
4593
export interface AxonListView {
4694
/**
4795
* List of active axons.
@@ -122,6 +170,7 @@ export interface AxonPublishParams {
122170
export declare namespace Axons {
123171
export {
124172
type AxonCreateParams as AxonCreateParams,
173+
type AxonEventView as AxonEventView,
125174
type AxonListView as AxonListView,
126175
type AxonView as AxonView,
127176
type PublishParams as PublishParams,

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export {
1313
export {
1414
Axons,
1515
type AxonCreateParams,
16+
type AxonEventView,
1617
type AxonListView,
1718
type AxonView,
1819
type PublishParams,

0 commit comments

Comments
 (0)