@happyrobot-ai/sdk 0.1.26 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/package.json +1 -1
- package/resources/workflows.d.ts +4 -1
- package/resources/workflows.js +9 -0
- package/types/workflows.types.d.ts +5 -0
package/README.md
CHANGED
|
@@ -181,6 +181,9 @@ const { data } = await client.workflows.listVersions("my-workflow");
|
|
|
181
181
|
// List runs
|
|
182
182
|
const { data } = await client.workflows.listRuns("my-workflow");
|
|
183
183
|
|
|
184
|
+
// List sessions across all runs
|
|
185
|
+
const { data: sessions } = await client.workflows.listSessions("my-workflow");
|
|
186
|
+
|
|
184
187
|
// Trigger a run
|
|
185
188
|
const { run_id } = await client.workflows.triggerRun("my-workflow", { payload: { phone: "+1..." } });
|
|
186
189
|
```
|
|
@@ -200,6 +203,7 @@ const { run_id } = await client.workflows.triggerRun("my-workflow", { payload: {
|
|
|
200
203
|
| `listTemplates(query?)` | GET | `/workflows/templates` | List workflow templates |
|
|
201
204
|
| `listVersions(workflowId, query?)` | GET | `/workflows/:id/versions` | List versions for a workflow |
|
|
202
205
|
| `listRuns(workflowId, query?)` | GET | `/workflows/:id/runs` | List runs for a workflow |
|
|
206
|
+
| `listSessions(workflowId, query?)` | GET | `/workflows/:id/sessions` | List sessions for a workflow |
|
|
203
207
|
| `triggerRun(workflowId, body?)` | POST | `/workflows/:id/runs` | Trigger a new run |
|
|
204
208
|
|
|
205
209
|
---
|
package/package.json
CHANGED
package/resources/workflows.d.ts
CHANGED
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
* GET /workflows/:workflow_id/versions
|
|
16
16
|
* GET /workflows/:workflow_id/runs
|
|
17
17
|
* POST /workflows/:workflow_id/runs
|
|
18
|
+
* GET /workflows/:workflow_id/sessions
|
|
18
19
|
*/
|
|
19
20
|
import type { HttpClient } from "../core/http";
|
|
20
21
|
import type { WorkflowRunsQuery, PaginatedWorkflowRunsResponse, TriggerRunBody, TriggerRunResponse, TriggerRunWithFileBody } from "../types/runs.types";
|
|
21
|
-
import type { ListWorkflowsQuery, WorkflowListItem, PaginatedWorkflowsResponse, CreateWorkflowBody, CreateWorkflowResponse, WorkflowDetailResponse, UpdateWorkflowBody, UpdateWorkflowResponse, DuplicateWorkflowBody, DuplicateWorkflowResponse, ListTemplatesQuery, PaginatedTemplatesResponse, WorkflowPublishResponse, WorkflowUnpublishResponse, CancelRunsBody, CancelRunsResponse, ListWorkflowVersionsQuery, PaginatedWorkflowVersionsResponse } from "../types/workflows.types";
|
|
22
|
+
import type { ListWorkflowsQuery, WorkflowListItem, PaginatedWorkflowsResponse, CreateWorkflowBody, CreateWorkflowResponse, WorkflowDetailResponse, UpdateWorkflowBody, UpdateWorkflowResponse, DuplicateWorkflowBody, DuplicateWorkflowResponse, ListTemplatesQuery, PaginatedTemplatesResponse, WorkflowPublishResponse, WorkflowUnpublishResponse, CancelRunsBody, CancelRunsResponse, ListWorkflowVersionsQuery, PaginatedWorkflowVersionsResponse, ListWorkflowSessionsQuery, PaginatedWorkflowSessionsResponse } from "../types/workflows.types";
|
|
22
23
|
export declare class WorkflowsResource {
|
|
23
24
|
private readonly http;
|
|
24
25
|
constructor(http: HttpClient);
|
|
@@ -50,6 +51,8 @@ export declare class WorkflowsResource {
|
|
|
50
51
|
listVersions(workflowId: string, query?: ListWorkflowVersionsQuery): Promise<PaginatedWorkflowVersionsResponse>;
|
|
51
52
|
/** List runs for a workflow. */
|
|
52
53
|
listRuns(workflowId: string, query?: WorkflowRunsQuery): Promise<PaginatedWorkflowRunsResponse>;
|
|
54
|
+
/** List sessions for a workflow across all runs. */
|
|
55
|
+
listSessions(workflowId: string, query?: ListWorkflowSessionsQuery): Promise<PaginatedWorkflowSessionsResponse>;
|
|
53
56
|
/** Trigger a run for a workflow (JSON payload or file upload). */
|
|
54
57
|
triggerRun(workflowId: string, body?: TriggerRunBody | TriggerRunWithFileBody): Promise<TriggerRunResponse>;
|
|
55
58
|
private triggerRunWithFile;
|
package/resources/workflows.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* GET /workflows/:workflow_id/versions
|
|
17
17
|
* GET /workflows/:workflow_id/runs
|
|
18
18
|
* POST /workflows/:workflow_id/runs
|
|
19
|
+
* GET /workflows/:workflow_id/sessions
|
|
19
20
|
*/
|
|
20
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
22
|
exports.WorkflowsResource = void 0;
|
|
@@ -122,6 +123,14 @@ class WorkflowsResource {
|
|
|
122
123
|
query: query,
|
|
123
124
|
});
|
|
124
125
|
}
|
|
126
|
+
/** List sessions for a workflow across all runs. */
|
|
127
|
+
async listSessions(workflowId, query) {
|
|
128
|
+
return this.http.request({
|
|
129
|
+
method: "GET",
|
|
130
|
+
path: `/workflows/${encodeURIComponent(workflowId)}/sessions`,
|
|
131
|
+
query: query,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
125
134
|
/** Trigger a run for a workflow (JSON payload or file upload). */
|
|
126
135
|
async triggerRun(workflowId, body) {
|
|
127
136
|
const path = `/workflows/${encodeURIComponent(workflowId)}/runs`;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Uses import type — erased at compile time.
|
|
4
4
|
*/
|
|
5
5
|
import type { z } from "zod";
|
|
6
|
+
import type { ListSessionsQuerySchema } from "../../routes/sessions/schemas";
|
|
7
|
+
import type { PaginatedWorkflowSessionsResponseSchema, WorkflowSessionItemSchema } from "../../routes/workflows/:workflow_id/sessions/schemas";
|
|
6
8
|
import type { ListWorkflowsQuerySchema, WorkflowListItemSchema, PaginatedWorkflowsResponseSchema, CreateWorkflowBodySchema, CreateWorkflowResponseSchema, WorkflowDetailResponseSchema, UpdateWorkflowBodySchema, UpdateWorkflowResponseSchema, DuplicateWorkflowBodySchema, DuplicateWorkflowResponseSchema, PaginatedTemplatesResponseSchema, ListTemplatesQuerySchema, WorkflowPublishResponseSchema, WorkflowPublishErrorResponseSchema, WorkflowUnpublishResponseSchema, CancelRunsBodySchema, CancelRunsResponseSchema, ListWorkflowVersionsQuerySchema, PaginatedWorkflowVersionsResponseSchema } from "../../routes/workflows/schemas";
|
|
7
9
|
export type ListWorkflowsQuery = z.output<typeof ListWorkflowsQuerySchema>;
|
|
8
10
|
export type WorkflowListItem = z.infer<typeof WorkflowListItemSchema>;
|
|
@@ -23,3 +25,6 @@ export type CancelRunsBody = z.input<typeof CancelRunsBodySchema>;
|
|
|
23
25
|
export type CancelRunsResponse = z.infer<typeof CancelRunsResponseSchema>;
|
|
24
26
|
export type ListWorkflowVersionsQuery = z.input<typeof ListWorkflowVersionsQuerySchema>;
|
|
25
27
|
export type PaginatedWorkflowVersionsResponse = z.infer<typeof PaginatedWorkflowVersionsResponseSchema>;
|
|
28
|
+
export type ListWorkflowSessionsQuery = z.input<typeof ListSessionsQuerySchema>;
|
|
29
|
+
export type WorkflowSessionItem = z.infer<typeof WorkflowSessionItemSchema>;
|
|
30
|
+
export type PaginatedWorkflowSessionsResponse = z.infer<typeof PaginatedWorkflowSessionsResponseSchema>;
|