-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseen.ts
More file actions
103 lines (86 loc) · 2.45 KB
/
Copy pathseen.ts
File metadata and controls
103 lines (86 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class Seen extends APIResource {
/**
* Fetch the seen data (read receipts) for a conversation, showing who has seen
* messages and when.
*
* @example
* ```ts
* const response =
* await client.conversations.seen.getSeenData(
* 'conversationId',
* );
* ```
*/
getSeenData(conversationID: string, options?: RequestOptions): APIPromise<SeenGetSeenDataResponse> {
return this._client.get(path`/v1/conversations/${conversationID}/seen`, { ...options, __security: {} });
}
/**
* Record a visitor's last seen timestamp for a specific conversation.
*
* @example
* ```ts
* const response = await client.conversations.seen.markAsSeen(
* 'conversationId',
* );
* ```
*/
markAsSeen(
conversationID: string,
body: SeenMarkAsSeenParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<SeenMarkAsSeenResponse> {
return this._client.post(path`/v1/conversations/${conversationID}/seen`, {
body,
...options,
__security: {},
});
}
}
export interface SeenGetSeenDataResponse {
seenData: Array<SeenGetSeenDataResponse.SeenData>;
}
export namespace SeenGetSeenDataResponse {
export interface SeenData {
id: string;
aiAgentId: string | null;
conversationId: string;
createdAt: string;
deletedAt: string | null;
lastSeenAt: string;
updatedAt: string;
userId: string | null;
visitorId: string | null;
}
}
/**
* Response confirming the conversation has been marked as seen
*/
export interface SeenMarkAsSeenResponse {
/**
* The ID of the conversation that was marked as seen
*/
conversationId: string;
/**
* Timestamp indicating when the visitor last saw the conversation
*/
lastSeenAt: string;
}
export interface SeenMarkAsSeenParams {
/**
* Visitor ID associated with the conversation. Optional if provided via the
* X-Visitor-Id header.
*/
visitorId?: string;
}
export declare namespace Seen {
export {
type SeenGetSeenDataResponse as SeenGetSeenDataResponse,
type SeenMarkAsSeenResponse as SeenMarkAsSeenResponse,
type SeenMarkAsSeenParams as SeenMarkAsSeenParams,
};
}