@@ -35,6 +35,25 @@ export class Invocations extends APIResource {
3535 retrieve ( id : string , options ?: RequestOptions ) : APIPromise < InvocationRetrieveResponse > {
3636 return this . _client . get ( path `/invocations/${ id } ` , options ) ;
3737 }
38+
39+ /**
40+ * Update invocation status or output
41+ *
42+ * @example
43+ * ```ts
44+ * const invocation = await client.apps.invocations.update(
45+ * 'id',
46+ * { status: 'succeeded' },
47+ * );
48+ * ```
49+ */
50+ update (
51+ id : string ,
52+ body : InvocationUpdateParams ,
53+ options ?: RequestOptions ,
54+ ) : APIPromise < InvocationUpdateResponse > {
55+ return this . _client . patch ( path `/invocations/${ id } ` , { body, ...options } ) ;
56+ }
3857}
3958
4059export interface InvocationCreateResponse {
@@ -109,6 +128,55 @@ export interface InvocationRetrieveResponse {
109128 status_reason ?: string ;
110129}
111130
131+ export interface InvocationUpdateResponse {
132+ /**
133+ * ID of the invocation
134+ */
135+ id : string ;
136+
137+ /**
138+ * Name of the action invoked
139+ */
140+ action_name : string ;
141+
142+ /**
143+ * Name of the application
144+ */
145+ app_name : string ;
146+
147+ /**
148+ * RFC 3339 Nanoseconds timestamp when the invocation started
149+ */
150+ started_at : string ;
151+
152+ /**
153+ * Status of the invocation
154+ */
155+ status : 'queued' | 'running' | 'succeeded' | 'failed' ;
156+
157+ /**
158+ * RFC 3339 Nanoseconds timestamp when the invocation finished (null if still
159+ * running)
160+ */
161+ finished_at ?: string | null ;
162+
163+ /**
164+ * Output produced by the action, rendered as a JSON string. This could be: string,
165+ * number, boolean, array, object, or null.
166+ */
167+ output ?: string ;
168+
169+ /**
170+ * Payload provided to the invocation. This is a string that can be parsed as JSON.
171+ */
172+ payload ?: string ;
173+
174+ /**
175+ * Status reason
176+ */
177+ status_reason ?: string ;
178+ }
179+
112180export interface InvocationCreateParams {
113181 /**
114182 * Name of the action to invoke
@@ -125,16 +193,36 @@ export interface InvocationCreateParams {
125193 */
126194 version : string ;
127195
196+ /**
197+ * If true, invoke asynchronously. When set, the API responds 202 Accepted with
198+ * status "queued".
199+ */
200+ async ?: boolean ;
201+
128202 /**
129203 * Input data for the action, sent as a JSON string.
130204 */
131205 payload ?: string ;
132206}
133207
208+ export interface InvocationUpdateParams {
209+ /**
210+ * New status for the invocation.
211+ */
212+ status : 'succeeded' | 'failed' ;
213+
214+ /**
215+ * Updated output of the invocation rendered as JSON string.
216+ */
217+ output ?: string ;
218+ }
219+
134220export declare namespace Invocations {
135221 export {
136222 type InvocationCreateResponse as InvocationCreateResponse ,
137223 type InvocationRetrieveResponse as InvocationRetrieveResponse ,
224+ type InvocationUpdateResponse as InvocationUpdateResponse ,
138225 type InvocationCreateParams as InvocationCreateParams ,
226+ type InvocationUpdateParams as InvocationUpdateParams ,
139227 } ;
140228}
0 commit comments