-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebsites.ts
More file actions
210 lines (177 loc) · 4.65 KB
/
Copy pathwebsites.ts
File metadata and controls
210 lines (177 loc) · 4.65 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// 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 { buildHeaders } from '../internal/headers';
import { RequestOptions } from '../internal/request-options';
export class Websites extends APIResource {
/**
* Returns the website information associated with the provided API key. This
* endpoint supports both public and private API keys with different authentication
* methods.
*/
retrieve(
params: WebsiteRetrieveParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<WebsiteRetrieveResponse> {
const { Origin, 'X-Public-Key': xPublicKey, 'X-Visitor-Id': xVisitorID } = params ?? {};
return this._client.get('/v1/websites', {
...options,
headers: buildHeaders([
{
...(Origin != null ? { Origin: Origin } : undefined),
...(xPublicKey != null ? { 'X-Public-Key': xPublicKey } : undefined),
...(xVisitorID != null ? { 'X-Visitor-Id': xVisitorID } : undefined),
},
options?.headers,
]),
__security: {},
});
}
}
export interface WebsiteRetrieveResponse {
/**
* The website's unique identifier.
*/
id: string;
availableAIAgents: Array<WebsiteRetrieveResponse.AvailableAIAgent>;
availableHumanAgents: Array<WebsiteRetrieveResponse.AvailableHumanAgent>;
/**
* The website's description.
*/
description: string | null;
/**
* The website's domain.
*/
domain: string;
/**
* The website's support last online date.
*/
lastOnlineAt: string | null;
/**
* The website's logo URL.
*/
logoUrl: string | null;
/**
* The website's name.
*/
name: string;
/**
* The organization's unique identifier.
*/
organizationId: string;
/**
* The website's status.
*/
status: string;
/**
* The visitor information. Either existing visitor data or newly created visitor.
*/
visitor: WebsiteRetrieveResponse.Visitor;
}
export namespace WebsiteRetrieveResponse {
export interface AvailableAIAgent {
/**
* The AI agent's unique identifier.
*/
id: string;
/**
* The AI agent's avatar URL.
*/
image: string | null;
/**
* The AI agent's name.
*/
name: string;
}
export interface AvailableHumanAgent {
/**
* The human agent's unique identifier.
*/
id: string;
/**
* The agent's avatar URL.
*/
image: string | null;
/**
* The agent's last online timestamp, used to determine if the agent is online. If
* the agent is offline, this will be null or more than 5 minutes ago.
*/
lastSeenAt: string | null;
/**
* The agent's name.
*/
name: string | null;
}
/**
* The visitor information. Either existing visitor data or newly created visitor.
*/
export interface Visitor {
/**
* The visitor's unique identifier (ULID).
*/
id: string;
/**
* Contact information if the visitor has been identified via .identify().
*/
contact: Visitor.Contact | null;
/**
* Whether the visitor is currently blocked.
*/
isBlocked: boolean;
/**
* The visitor's preferred language.
*/
language: string | null;
}
export namespace Visitor {
/**
* Contact information if the visitor has been identified via .identify().
*/
export interface Contact {
/**
* The contact's unique identifier.
*/
id: string;
/**
* The contact's email address.
*/
email: string | null;
/**
* The contact's avatar/profile image URL.
*/
image: string | null;
/**
* The contact's name.
*/
name: string | null;
/**
* Hash of the contact's metadata. Used to detect if metadata has changed without
* comparing full objects.
*/
metadataHash?: string;
}
}
}
export interface WebsiteRetrieveParams {
/**
* Required when using public API keys. Must match one of the whitelisted domains
* for the website. Automatically set by browsers.
*/
Origin?: string;
/**
* Public API key for browser-based authentication. Can only be used from
* whitelisted domains. Format: `pk_[live|test]_...`
*/
'X-Public-Key'?: string;
/**
* Visitor ID from localStorage. If provided, returns existing visitor data. If not
* provided, creates a new visitor.
*/
'X-Visitor-Id'?: string;
}
export declare namespace Websites {
export {
type WebsiteRetrieveResponse as WebsiteRetrieveResponse,
type WebsiteRetrieveParams as WebsiteRetrieveParams,
};
}