|
1 | 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
2 | 2 |
|
3 | 3 | import { APIResource } from '../resource'; |
| 4 | +import { APIPromise } from '../core'; |
4 | 5 | import * as Core from '../core'; |
| 6 | +import { Stream } from '../streaming'; |
5 | 7 |
|
6 | 8 | export class Axons extends APIResource { |
7 | 9 | /** |
@@ -38,10 +40,56 @@ export class Axons extends APIResource { |
38 | 40 | ): Core.APIPromise<PublishResultView> { |
39 | 41 | return this._client.post(`/v1/axons/${id}/publish`, { body, ...options }); |
40 | 42 | } |
| 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 | + } |
41 | 52 | } |
42 | 53 |
|
43 | 54 | export type AxonCreateParams = unknown; |
44 | 55 |
|
| 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 | + |
45 | 93 | export interface AxonListView { |
46 | 94 | /** |
47 | 95 | * List of active axons. |
@@ -122,6 +170,7 @@ export interface AxonPublishParams { |
122 | 170 | export declare namespace Axons { |
123 | 171 | export { |
124 | 172 | type AxonCreateParams as AxonCreateParams, |
| 173 | + type AxonEventView as AxonEventView, |
125 | 174 | type AxonListView as AxonListView, |
126 | 175 | type AxonView as AxonView, |
127 | 176 | type PublishParams as PublishParams, |
|
0 commit comments