@happyrobot-ai/sdk 0.1.29 → 0.1.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyrobot-ai/sdk",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "TypeScript SDK for the HappyRobot Public API",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
@@ -2,16 +2,19 @@
2
2
  * Session resource — client.sessions.*
3
3
  *
4
4
  * Maps to:
5
+ * GET /sessions
5
6
  * GET /sessions/:session_id
6
7
  * GET /sessions/:session_id/messages
7
8
  * GET /sessions/:session_id/stream
8
9
  */
9
10
  import type { HttpClient } from "../core/http";
10
11
  import type { SSEEvent } from "../core/sse";
11
- import type { SessionItem, ListMessagesQuery, PaginatedMessagesResponse, StreamQuery, SessionStreamEvent } from "../types/sessions.types";
12
+ import type { SessionItem, ListSessionsByCallerQuery, PaginatedSessionsResponse, ListMessagesQuery, PaginatedMessagesResponse, StreamQuery, SessionStreamEvent } from "../types/sessions.types";
12
13
  export declare class SessionsResource {
13
14
  private readonly http;
14
15
  constructor(http: HttpClient);
16
+ /** List sessions by caller phone number. */
17
+ list(query: ListSessionsByCallerQuery): Promise<PaginatedSessionsResponse>;
15
18
  /** Get a session by ID. */
16
19
  get(sessionId: string): Promise<SessionItem>;
17
20
  /** Get messages for a session. */
@@ -3,6 +3,7 @@
3
3
  * Session resource — client.sessions.*
4
4
  *
5
5
  * Maps to:
6
+ * GET /sessions
6
7
  * GET /sessions/:session_id
7
8
  * GET /sessions/:session_id/messages
8
9
  * GET /sessions/:session_id/stream
@@ -15,6 +16,14 @@ class SessionsResource {
15
16
  constructor(http) {
16
17
  this.http = http;
17
18
  }
19
+ /** List sessions by caller phone number. */
20
+ async list(query) {
21
+ return this.http.request({
22
+ method: "GET",
23
+ path: `/sessions`,
24
+ query: query,
25
+ });
26
+ }
18
27
  /** Get a session by ID. */
19
28
  async get(sessionId) {
20
29
  return this.http.request({
@@ -2,8 +2,9 @@
2
2
  * Session types extracted from Zod schemas.
3
3
  */
4
4
  import type { z } from "zod";
5
- import type { ListSessionsQuerySchema, SessionItemSchema, PaginatedSessionsResponseSchema, ListMessagesQuerySchema, MessageItemSchema, PaginatedMessagesResponseSchema, StreamQuerySchema } from "../../routes/sessions/schemas";
5
+ import type { ListSessionsQuerySchema, ListSessionsByCallerQuerySchema, SessionItemSchema, PaginatedSessionsResponseSchema, ListMessagesQuerySchema, MessageItemSchema, PaginatedMessagesResponseSchema, StreamQuerySchema } from "../../routes/sessions/schemas";
6
6
  export type ListSessionsQuery = z.input<typeof ListSessionsQuerySchema>;
7
+ export type ListSessionsByCallerQuery = z.input<typeof ListSessionsByCallerQuerySchema>;
7
8
  export type SessionItem = z.infer<typeof SessionItemSchema>;
8
9
  export type PaginatedSessionsResponse = z.infer<typeof PaginatedSessionsResponseSchema>;
9
10
  export type ListMessagesQuery = z.input<typeof ListMessagesQuerySchema>;