@studyfetch/sdk 1.43.0 → 1.45.0
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/CHANGELOG.md +32 -0
- package/package.json +1 -1
- package/resources/v1/assignment-grader/assignment-grader.d.mts +12 -0
- package/resources/v1/assignment-grader/assignment-grader.d.mts.map +1 -1
- package/resources/v1/assignment-grader/assignment-grader.d.ts +12 -0
- package/resources/v1/assignment-grader/assignment-grader.d.ts.map +1 -1
- package/resources/v1/assignment-grader/assignment-grader.js.map +1 -1
- package/resources/v1/assignment-grader/assignment-grader.mjs.map +1 -1
- package/resources/v1/assignment-grader/rubric-templates.d.mts +8 -0
- package/resources/v1/assignment-grader/rubric-templates.d.mts.map +1 -1
- package/resources/v1/assignment-grader/rubric-templates.d.ts +8 -0
- package/resources/v1/assignment-grader/rubric-templates.d.ts.map +1 -1
- package/resources/v1/chat.d.mts +53 -1
- package/resources/v1/chat.d.mts.map +1 -1
- package/resources/v1/chat.d.ts +53 -1
- package/resources/v1/chat.d.ts.map +1 -1
- package/resources/v1/chat.js +30 -0
- package/resources/v1/chat.js.map +1 -1
- package/resources/v1/chat.mjs +30 -0
- package/resources/v1/chat.mjs.map +1 -1
- package/resources/v1/components.d.mts +9 -1
- package/resources/v1/components.d.mts.map +1 -1
- package/resources/v1/components.d.ts +9 -1
- package/resources/v1/components.d.ts.map +1 -1
- package/resources/v1/embed/context.d.mts +61 -0
- package/resources/v1/embed/context.d.mts.map +1 -0
- package/resources/v1/embed/context.d.ts +61 -0
- package/resources/v1/embed/context.d.ts.map +1 -0
- package/resources/v1/embed/context.js +61 -0
- package/resources/v1/embed/context.js.map +1 -0
- package/resources/v1/embed/context.mjs +57 -0
- package/resources/v1/embed/context.mjs.map +1 -0
- package/resources/v1/embed/embed.d.mts +4 -0
- package/resources/v1/embed/embed.d.mts.map +1 -1
- package/resources/v1/embed/embed.d.ts +4 -0
- package/resources/v1/embed/embed.d.ts.map +1 -1
- package/resources/v1/embed/embed.js +4 -0
- package/resources/v1/embed/embed.js.map +1 -1
- package/resources/v1/embed/embed.mjs +4 -0
- package/resources/v1/embed/embed.mjs.map +1 -1
- package/resources/v1/embed/index.d.mts +1 -0
- package/resources/v1/embed/index.d.mts.map +1 -1
- package/resources/v1/embed/index.d.ts +1 -0
- package/resources/v1/embed/index.d.ts.map +1 -1
- package/resources/v1/embed/index.js +3 -1
- package/resources/v1/embed/index.js.map +1 -1
- package/resources/v1/embed/index.mjs +1 -0
- package/resources/v1/embed/index.mjs.map +1 -1
- package/resources/v1/folders.d.mts +25 -1
- package/resources/v1/folders.d.mts.map +1 -1
- package/resources/v1/folders.d.ts +25 -1
- package/resources/v1/folders.d.ts.map +1 -1
- package/resources/v1/folders.js +11 -0
- package/resources/v1/folders.js.map +1 -1
- package/resources/v1/folders.mjs +11 -0
- package/resources/v1/folders.mjs.map +1 -1
- package/resources/v1/index.d.mts +3 -2
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +3 -2
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js +3 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +1 -0
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/materials/upload.d.mts +38 -4
- package/resources/v1/materials/upload.d.mts.map +1 -1
- package/resources/v1/materials/upload.d.ts +38 -4
- package/resources/v1/materials/upload.d.ts.map +1 -1
- package/resources/v1/materials/upload.js +20 -3
- package/resources/v1/materials/upload.js.map +1 -1
- package/resources/v1/materials/upload.mjs +19 -2
- package/resources/v1/materials/upload.mjs.map +1 -1
- package/resources/v1/pdf-generator/get.d.mts +4 -0
- package/resources/v1/pdf-generator/get.d.mts.map +1 -1
- package/resources/v1/pdf-generator/get.d.ts +4 -0
- package/resources/v1/pdf-generator/get.d.ts.map +1 -1
- package/resources/v1/pdf-generator/pdf-generator.d.mts +29 -0
- package/resources/v1/pdf-generator/pdf-generator.d.mts.map +1 -1
- package/resources/v1/pdf-generator/pdf-generator.d.ts +29 -0
- package/resources/v1/pdf-generator/pdf-generator.d.ts.map +1 -1
- package/resources/v1/pdf-generator/pdf-generator.js.map +1 -1
- package/resources/v1/pdf-generator/pdf-generator.mjs.map +1 -1
- package/resources/v1/performance-insights/conversations.d.mts +131 -0
- package/resources/v1/performance-insights/conversations.d.mts.map +1 -0
- package/resources/v1/performance-insights/conversations.d.ts +131 -0
- package/resources/v1/performance-insights/conversations.d.ts.map +1 -0
- package/resources/v1/performance-insights/conversations.js +131 -0
- package/resources/v1/performance-insights/conversations.js.map +1 -0
- package/resources/v1/performance-insights/conversations.mjs +127 -0
- package/resources/v1/performance-insights/conversations.mjs.map +1 -0
- package/resources/v1/performance-insights/index.d.mts +3 -0
- package/resources/v1/performance-insights/index.d.mts.map +1 -0
- package/resources/v1/performance-insights/index.d.ts +3 -0
- package/resources/v1/performance-insights/index.d.ts.map +1 -0
- package/resources/v1/performance-insights/index.js +9 -0
- package/resources/v1/performance-insights/index.js.map +1 -0
- package/resources/v1/performance-insights/index.mjs +4 -0
- package/resources/v1/performance-insights/index.mjs.map +1 -0
- package/resources/v1/performance-insights/performance-insights.d.mts +139 -0
- package/resources/v1/performance-insights/performance-insights.d.mts.map +1 -0
- package/resources/v1/performance-insights/performance-insights.d.ts +139 -0
- package/resources/v1/performance-insights/performance-insights.d.ts.map +1 -0
- package/resources/v1/performance-insights/performance-insights.js +55 -0
- package/resources/v1/performance-insights/performance-insights.js.map +1 -0
- package/resources/v1/performance-insights/performance-insights.mjs +50 -0
- package/resources/v1/performance-insights/performance-insights.mjs.map +1 -0
- package/resources/v1/performance-insights.d.mts +2 -0
- package/resources/v1/performance-insights.d.mts.map +1 -0
- package/resources/v1/performance-insights.d.ts +2 -0
- package/resources/v1/performance-insights.d.ts.map +1 -0
- package/resources/v1/performance-insights.js +6 -0
- package/resources/v1/performance-insights.js.map +1 -0
- package/resources/v1/performance-insights.mjs +3 -0
- package/resources/v1/performance-insights.mjs.map +1 -0
- package/resources/v1/usage.d.mts +8 -0
- package/resources/v1/usage.d.mts.map +1 -1
- package/resources/v1/usage.d.ts +8 -0
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1/v1.d.mts +8 -4
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +8 -4
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js +4 -0
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +4 -0
- package/resources/v1/v1.mjs.map +1 -1
- package/src/resources/v1/assignment-grader/assignment-grader.ts +15 -0
- package/src/resources/v1/assignment-grader/rubric-templates.ts +10 -0
- package/src/resources/v1/chat.ts +81 -1
- package/src/resources/v1/components.ts +10 -1
- package/src/resources/v1/embed/context.ts +96 -0
- package/src/resources/v1/embed/embed.ts +11 -0
- package/src/resources/v1/embed/index.ts +6 -0
- package/src/resources/v1/folders.ts +35 -0
- package/src/resources/v1/index.ts +9 -1
- package/src/resources/v1/materials/upload.ts +74 -7
- package/src/resources/v1/pdf-generator/get.ts +5 -0
- package/src/resources/v1/pdf-generator/pdf-generator.ts +35 -0
- package/src/resources/v1/performance-insights/conversations.ts +238 -0
- package/src/resources/v1/performance-insights/index.ts +17 -0
- package/src/resources/v1/performance-insights/performance-insights.ts +214 -0
- package/src/resources/v1/performance-insights.ts +3 -0
- package/src/resources/v1/usage.ts +10 -0
- package/src/resources/v1/v1.ts +27 -2
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { APIResource } from '../../../core/resource';
|
|
4
4
|
import * as MaterialsAPI from './materials';
|
|
5
5
|
import { APIPromise } from '../../../core/api-promise';
|
|
6
|
-
import { type Uploadable } from '../../../core/uploads';
|
|
6
|
+
import { toFile, type Uploadable } from '../../../core/uploads';
|
|
7
7
|
import { RequestOptions } from '../../../internal/request-options';
|
|
8
8
|
import { multipartFormRequestOptions } from '../../../internal/uploads';
|
|
9
9
|
|
|
@@ -65,7 +65,7 @@ export class Upload extends APIResource {
|
|
|
65
65
|
): APIPromise<MaterialsAPI.MaterialResponse> {
|
|
66
66
|
return this._client.post(
|
|
67
67
|
'/api/v1/materials/upload',
|
|
68
|
-
|
|
68
|
+
multipartUploadRequestOptions(body, options, this._client),
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -88,7 +88,7 @@ export class Upload extends APIResource {
|
|
|
88
88
|
): APIPromise<MaterialsAPI.MaterialResponse> {
|
|
89
89
|
return this._client.post(
|
|
90
90
|
'/api/v1/materials/upload/file-and-process',
|
|
91
|
-
|
|
91
|
+
multipartUploadRequestOptions(body, options, this._client),
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -201,16 +201,29 @@ export interface UploadUploadFileParams {
|
|
|
201
201
|
*/
|
|
202
202
|
name: string;
|
|
203
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Content-Type/MIME type of the file (e.g., video/mp4, application/pdf).
|
|
206
|
+
* If not provided, the uploadable's existing type is used.
|
|
207
|
+
*/
|
|
208
|
+
contentType?: string;
|
|
209
|
+
|
|
204
210
|
/**
|
|
205
211
|
* Whether to extract images from files (true/false, default: true)
|
|
206
212
|
*/
|
|
207
213
|
extractImages?: string;
|
|
208
214
|
|
|
209
215
|
/**
|
|
210
|
-
* Folder ID (optional)
|
|
216
|
+
* Folder ID (optional). If folderPath is provided, folderId will be ignored.
|
|
211
217
|
*/
|
|
212
218
|
folderId?: string;
|
|
213
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Relative folder path (e.g., "folder1/folder2"). Folders will be created if
|
|
222
|
+
* they don't exist. The filename can be included and will be extracted
|
|
223
|
+
* automatically.
|
|
224
|
+
*/
|
|
225
|
+
folderPath?: string;
|
|
226
|
+
|
|
214
227
|
/**
|
|
215
228
|
* JSON string of references array (optional)
|
|
216
229
|
*/
|
|
@@ -225,16 +238,29 @@ export interface UploadUploadFileAndProcessParams {
|
|
|
225
238
|
*/
|
|
226
239
|
name: string;
|
|
227
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Content-Type/MIME type of the file (e.g., video/mp4, application/pdf).
|
|
243
|
+
* If not provided, the uploadable's existing type is used.
|
|
244
|
+
*/
|
|
245
|
+
contentType?: string;
|
|
246
|
+
|
|
228
247
|
/**
|
|
229
248
|
* Whether to extract images from files (true/false, default: true)
|
|
230
249
|
*/
|
|
231
250
|
extractImages?: string;
|
|
232
251
|
|
|
233
252
|
/**
|
|
234
|
-
* Folder ID (optional)
|
|
253
|
+
* Folder ID (optional). If folderPath is provided, folderId will be ignored.
|
|
235
254
|
*/
|
|
236
255
|
folderId?: string;
|
|
237
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Relative folder path (e.g., "folder1/folder2"). Folders will be created if
|
|
259
|
+
* they don't exist. The filename can be included and will be extracted
|
|
260
|
+
* automatically.
|
|
261
|
+
*/
|
|
262
|
+
folderPath?: string;
|
|
263
|
+
|
|
238
264
|
/**
|
|
239
265
|
* Polling interval in milliseconds (default: 2000)
|
|
240
266
|
*/
|
|
@@ -258,9 +284,16 @@ export interface UploadUploadFromURLParams {
|
|
|
258
284
|
url: string;
|
|
259
285
|
|
|
260
286
|
/**
|
|
261
|
-
* Folder ID (optional)
|
|
287
|
+
* Folder ID (optional). If folderPath is provided, folderId will be ignored.
|
|
262
288
|
*/
|
|
263
289
|
folderId?: string;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Relative folder path (e.g., "folder1/folder2"). Folders will be created if
|
|
293
|
+
* they don't exist. The filename can be included and will be extracted
|
|
294
|
+
* automatically.
|
|
295
|
+
*/
|
|
296
|
+
folderPath?: string;
|
|
264
297
|
}
|
|
265
298
|
|
|
266
299
|
export interface UploadUploadFromURLAndProcessParams {
|
|
@@ -275,10 +308,17 @@ export interface UploadUploadFromURLAndProcessParams {
|
|
|
275
308
|
url: string;
|
|
276
309
|
|
|
277
310
|
/**
|
|
278
|
-
* Folder ID (optional)
|
|
311
|
+
* Folder ID (optional). If folderPath is provided, folderId will be ignored.
|
|
279
312
|
*/
|
|
280
313
|
folderId?: string;
|
|
281
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Relative folder path (e.g., "folder1/folder2"). Folders will be created if
|
|
317
|
+
* they don't exist. The filename can be included and will be extracted
|
|
318
|
+
* automatically.
|
|
319
|
+
*/
|
|
320
|
+
folderPath?: string;
|
|
321
|
+
|
|
282
322
|
/**
|
|
283
323
|
* Polling interval in milliseconds (default: 2 seconds)
|
|
284
324
|
*/
|
|
@@ -306,3 +346,30 @@ export declare namespace Upload {
|
|
|
306
346
|
type UploadUploadFromURLAndProcessParams as UploadUploadFromURLAndProcessParams,
|
|
307
347
|
};
|
|
308
348
|
}
|
|
349
|
+
|
|
350
|
+
type MultipartClient = Parameters<typeof multipartFormRequestOptions>[1];
|
|
351
|
+
type MultipartUploadBody = UploadUploadFileParams | UploadUploadFileAndProcessParams;
|
|
352
|
+
|
|
353
|
+
async function multipartUploadRequestOptions(
|
|
354
|
+
body: MultipartUploadBody,
|
|
355
|
+
options: RequestOptions | undefined,
|
|
356
|
+
client: MultipartClient,
|
|
357
|
+
): Promise<RequestOptions> {
|
|
358
|
+
const { contentType, ...bodyWithoutContentType } = body;
|
|
359
|
+
const multipartBody =
|
|
360
|
+
contentType ?
|
|
361
|
+
{ ...bodyWithoutContentType, file: await toUploadableWithContentType(body.file, contentType) }
|
|
362
|
+
: bodyWithoutContentType;
|
|
363
|
+
|
|
364
|
+
return multipartFormRequestOptions({ body: multipartBody, ...options }, client);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
async function toUploadableWithContentType(file: Uploadable, contentType: string): Promise<Uploadable> {
|
|
368
|
+
const typedFile = await toFile(file, undefined, { type: contentType });
|
|
369
|
+
if (typedFile.type === contentType) return typedFile;
|
|
370
|
+
|
|
371
|
+
return new File([typedFile], typedFile.name, {
|
|
372
|
+
type: contentType,
|
|
373
|
+
lastModified: typedFile.lastModified,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
@@ -96,6 +96,41 @@ export interface PdfGeneratorCreateParams {
|
|
|
96
96
|
* The topic for the PDF presentation
|
|
97
97
|
*/
|
|
98
98
|
topic: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Custom images to use (required when imageMode is "provide-own")
|
|
102
|
+
*/
|
|
103
|
+
customImages?: Array<PdfGeneratorCreateParams.CustomImage>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Image handling mode: search (auto-search), provide-own (use custom images), none
|
|
107
|
+
* (no images, use icons)
|
|
108
|
+
*/
|
|
109
|
+
imageMode?: 'search' | 'provide-own' | 'none';
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Custom logo URL to use (optional, falls back to default StudyFetch logo)
|
|
113
|
+
*/
|
|
114
|
+
logoUrl?: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export namespace PdfGeneratorCreateParams {
|
|
118
|
+
export interface CustomImage {
|
|
119
|
+
/**
|
|
120
|
+
* Description of what this image shows
|
|
121
|
+
*/
|
|
122
|
+
description: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Base64-encoded image data (provide either url or base64)
|
|
126
|
+
*/
|
|
127
|
+
base64?: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Image URL to download and use (provide either url or base64)
|
|
131
|
+
*/
|
|
132
|
+
url?: string;
|
|
133
|
+
}
|
|
99
134
|
}
|
|
100
135
|
|
|
101
136
|
PdfGenerator.Get = Get;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
7
|
+
import { path } from '../../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
export class Conversations extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* List Performance Insights conversations for the current user.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* await client.v1.performanceInsights.conversations.list();
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
list(params: ConversationListParams | null | undefined = {}, options?: RequestOptions): APIPromise<void> {
|
|
19
|
+
const { 'x-user-id': xUserID, 'x-group-ids': xGroupIDs, ...query } = params ?? {};
|
|
20
|
+
return this._client.get('/api/v1/performance-insights/sessions', {
|
|
21
|
+
query,
|
|
22
|
+
...options,
|
|
23
|
+
headers: buildHeaders([
|
|
24
|
+
{
|
|
25
|
+
Accept: '*/*',
|
|
26
|
+
...(xUserID != null ? { 'x-user-id': xUserID } : undefined),
|
|
27
|
+
...(xGroupIDs != null ? { 'x-group-ids': xGroupIDs } : undefined),
|
|
28
|
+
},
|
|
29
|
+
options?.headers,
|
|
30
|
+
]),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a new Performance Insights conversation.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* await client.v1.performanceInsights.conversations.create();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
create(
|
|
43
|
+
params: ConversationCreateParams | null | undefined = {},
|
|
44
|
+
options?: RequestOptions,
|
|
45
|
+
): APIPromise<void> {
|
|
46
|
+
const { 'x-group-ids': xGroupIDs, ...body } = params ?? {};
|
|
47
|
+
return this._client.post('/api/v1/performance-insights/sessions/create', {
|
|
48
|
+
body,
|
|
49
|
+
...options,
|
|
50
|
+
headers: buildHeaders([
|
|
51
|
+
{ Accept: '*/*', ...(xGroupIDs != null ? { 'x-group-ids': xGroupIDs } : undefined) },
|
|
52
|
+
options?.headers,
|
|
53
|
+
]),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Retrieve a single conversation with its full message history.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await client.v1.performanceInsights.conversations.retrieve('sessionId');
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
retrieve(
|
|
66
|
+
sessionID: string,
|
|
67
|
+
params: ConversationRetrieveParams | null | undefined = {},
|
|
68
|
+
options?: RequestOptions,
|
|
69
|
+
): APIPromise<void> {
|
|
70
|
+
const { 'x-group-ids': xGroupIDs } = params ?? {};
|
|
71
|
+
return this._client.get(path`/api/v1/performance-insights/session/${sessionID}`, {
|
|
72
|
+
...options,
|
|
73
|
+
headers: buildHeaders([
|
|
74
|
+
{ Accept: '*/*', ...(xGroupIDs != null ? { 'x-group-ids': xGroupIDs } : undefined) },
|
|
75
|
+
options?.headers,
|
|
76
|
+
]),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Push messages to a conversation. Creates the conversation if it does not exist.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* await client.v1.performanceInsights.conversations.pushMessages('sessionId', {
|
|
86
|
+
* messages: [],
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
pushMessages(
|
|
91
|
+
sessionID: string,
|
|
92
|
+
params: ConversationPushMessagesParams,
|
|
93
|
+
options?: RequestOptions,
|
|
94
|
+
): APIPromise<void> {
|
|
95
|
+
const { 'x-group-ids': xGroupIDs, ...body } = params;
|
|
96
|
+
return this._client.put(path`/api/v1/performance-insights/session/${sessionID}/messages`, {
|
|
97
|
+
body,
|
|
98
|
+
...options,
|
|
99
|
+
headers: buildHeaders([
|
|
100
|
+
{ Accept: '*/*', ...(xGroupIDs != null ? { 'x-group-ids': xGroupIDs } : undefined) },
|
|
101
|
+
options?.headers,
|
|
102
|
+
]),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Rename a conversation.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* await client.v1.performanceInsights.conversations.rename('sessionId', {
|
|
112
|
+
* title: 'New title',
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
rename(sessionID: string, params: ConversationRenameParams, options?: RequestOptions): APIPromise<void> {
|
|
117
|
+
const { 'x-group-ids': xGroupIDs, ...body } = params;
|
|
118
|
+
return this._client.patch(path`/api/v1/performance-insights/session/${sessionID}/title`, {
|
|
119
|
+
body,
|
|
120
|
+
...options,
|
|
121
|
+
headers: buildHeaders([
|
|
122
|
+
{ Accept: '*/*', ...(xGroupIDs != null ? { 'x-group-ids': xGroupIDs } : undefined) },
|
|
123
|
+
options?.headers,
|
|
124
|
+
]),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Delete a conversation.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* await client.v1.performanceInsights.conversations.delete('sessionId');
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
delete(
|
|
137
|
+
sessionID: string,
|
|
138
|
+
params: ConversationDeleteParams | null | undefined = {},
|
|
139
|
+
options?: RequestOptions,
|
|
140
|
+
): APIPromise<void> {
|
|
141
|
+
const { 'x-group-ids': xGroupIDs } = params ?? {};
|
|
142
|
+
return this._client.delete(path`/api/v1/performance-insights/session/${sessionID}`, {
|
|
143
|
+
...options,
|
|
144
|
+
headers: buildHeaders([
|
|
145
|
+
{ Accept: '*/*', ...(xGroupIDs != null ? { 'x-group-ids': xGroupIDs } : undefined) },
|
|
146
|
+
options?.headers,
|
|
147
|
+
]),
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface ConversationListParams {
|
|
153
|
+
/**
|
|
154
|
+
* Query param: Maximum number of conversations to return (default 50)
|
|
155
|
+
*/
|
|
156
|
+
limit?: string;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Header param: Group IDs header (comma-separated) to scope sessions by group
|
|
160
|
+
*/
|
|
161
|
+
'x-group-ids'?: string;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Header param: User ID header (used when authenticating via API key)
|
|
165
|
+
*/
|
|
166
|
+
'x-user-id'?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ConversationCreateParams {
|
|
170
|
+
/**
|
|
171
|
+
* Body param: Custom session ID. Auto-generated if omitted.
|
|
172
|
+
*/
|
|
173
|
+
sessionId?: string;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Body param: Conversation title (default "New Chat")
|
|
177
|
+
*/
|
|
178
|
+
title?: string;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Header param: Group IDs header (comma-separated) to scope sessions by group
|
|
182
|
+
*/
|
|
183
|
+
'x-group-ids'?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface ConversationRetrieveParams {
|
|
187
|
+
/**
|
|
188
|
+
* Header param: Group IDs header (comma-separated) to scope sessions by group
|
|
189
|
+
*/
|
|
190
|
+
'x-group-ids'?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ConversationPushMessagesParams {
|
|
194
|
+
/**
|
|
195
|
+
* Body param: Array of AI SDK UIMessage objects to persist
|
|
196
|
+
*/
|
|
197
|
+
messages: unknown;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Body param: Update the conversation title
|
|
201
|
+
*/
|
|
202
|
+
title?: string;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Header param: Group IDs header (comma-separated) to scope sessions by group
|
|
206
|
+
*/
|
|
207
|
+
'x-group-ids'?: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface ConversationRenameParams {
|
|
211
|
+
/**
|
|
212
|
+
* Body param: New conversation title
|
|
213
|
+
*/
|
|
214
|
+
title: string;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Header param: Group IDs header (comma-separated) to scope sessions by group
|
|
218
|
+
*/
|
|
219
|
+
'x-group-ids'?: string;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface ConversationDeleteParams {
|
|
223
|
+
/**
|
|
224
|
+
* Header param: Group IDs header (comma-separated) to scope sessions by group
|
|
225
|
+
*/
|
|
226
|
+
'x-group-ids'?: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export declare namespace Conversations {
|
|
230
|
+
export {
|
|
231
|
+
type ConversationListParams as ConversationListParams,
|
|
232
|
+
type ConversationCreateParams as ConversationCreateParams,
|
|
233
|
+
type ConversationRetrieveParams as ConversationRetrieveParams,
|
|
234
|
+
type ConversationPushMessagesParams as ConversationPushMessagesParams,
|
|
235
|
+
type ConversationRenameParams as ConversationRenameParams,
|
|
236
|
+
type ConversationDeleteParams as ConversationDeleteParams,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Conversations,
|
|
5
|
+
type ConversationListParams,
|
|
6
|
+
type ConversationCreateParams,
|
|
7
|
+
type ConversationRetrieveParams,
|
|
8
|
+
type ConversationPushMessagesParams,
|
|
9
|
+
type ConversationRenameParams,
|
|
10
|
+
type ConversationDeleteParams,
|
|
11
|
+
} from './conversations';
|
|
12
|
+
export {
|
|
13
|
+
PerformanceInsights,
|
|
14
|
+
type PerformanceInsightsGenerateEmbedResponse,
|
|
15
|
+
type PerformanceInsightsGenerateEmbedParams,
|
|
16
|
+
type PerformanceInsightsStreamParams,
|
|
17
|
+
} from './performance-insights';
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as ConversationsAPI from './conversations';
|
|
5
|
+
import {
|
|
6
|
+
ConversationCreateParams,
|
|
7
|
+
ConversationDeleteParams,
|
|
8
|
+
ConversationListParams,
|
|
9
|
+
ConversationPushMessagesParams,
|
|
10
|
+
ConversationRenameParams,
|
|
11
|
+
ConversationRetrieveParams,
|
|
12
|
+
Conversations,
|
|
13
|
+
} from './conversations';
|
|
14
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
15
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
16
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
17
|
+
|
|
18
|
+
export class PerformanceInsights extends APIResource {
|
|
19
|
+
conversations: ConversationsAPI.Conversations = new ConversationsAPI.Conversations(this._client);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Generate an embeddable URL and token for the Performance Insights dashboard.
|
|
23
|
+
* Requires a TrueLearn userContextJwt to authenticate data access.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const response = await client.v1.performanceInsights.generateEmbed({
|
|
28
|
+
* userContextJwt: 'userContextJwt',
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
generateEmbed(
|
|
33
|
+
body: PerformanceInsightsGenerateEmbedParams,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<PerformanceInsightsGenerateEmbedResponse> {
|
|
36
|
+
return this._client.post('/api/v1/performance-insights/embed', { body, ...options });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Stream an AI-powered analytics response using server-sent events (SSE).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* await client.v1.performanceInsights.stream();
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
stream(
|
|
48
|
+
params: PerformanceInsightsStreamParams | null | undefined = {},
|
|
49
|
+
options?: RequestOptions,
|
|
50
|
+
): APIPromise<void> {
|
|
51
|
+
const { 'x-embed-token': xEmbedToken, 'x-user-id': xUserID, ...body } = params ?? {};
|
|
52
|
+
return this._client.post('/api/v1/performance-insights/stream', {
|
|
53
|
+
body,
|
|
54
|
+
...options,
|
|
55
|
+
headers: buildHeaders([
|
|
56
|
+
{
|
|
57
|
+
Accept: '*/*',
|
|
58
|
+
...(xEmbedToken != null ? { 'x-embed-token': xEmbedToken } : undefined),
|
|
59
|
+
...(xUserID != null ? { 'x-user-id': xUserID } : undefined),
|
|
60
|
+
},
|
|
61
|
+
options?.headers,
|
|
62
|
+
]),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface PerformanceInsightsGenerateEmbedResponse {
|
|
68
|
+
/**
|
|
69
|
+
* Full embed URL for iframe integration
|
|
70
|
+
*/
|
|
71
|
+
embedUrl: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* JWT embed token
|
|
75
|
+
*/
|
|
76
|
+
token: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Token expiration timestamp (1 hour from creation)
|
|
80
|
+
*/
|
|
81
|
+
expiresAt: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PerformanceInsightsGenerateEmbedParams {
|
|
85
|
+
/**
|
|
86
|
+
* TrueLearn user context JWT for data access
|
|
87
|
+
*/
|
|
88
|
+
userContextJwt: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Show Python code execution details in the embed
|
|
92
|
+
*/
|
|
93
|
+
debug?: boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Group IDs for access control
|
|
97
|
+
*/
|
|
98
|
+
groupIds?: Array<string>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Embed height (e.g., "400px", "100vh")
|
|
102
|
+
*/
|
|
103
|
+
height?: string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Swagger/OpenAPI JSON path appended to the API base URL. Scopes which endpoints
|
|
107
|
+
* the bot can discover. Defaults to swagger/v1/swagger.json when omitted.
|
|
108
|
+
*/
|
|
109
|
+
swaggerDocPath?: string;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* IANA timezone string for data analysis (e.g., "America/New_York"). Timestamps in
|
|
113
|
+
* reports will be shown in this timezone.
|
|
114
|
+
*/
|
|
115
|
+
timezone?: string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* TrueLearn API origin (https). Defaults to QA when omitted.
|
|
119
|
+
*/
|
|
120
|
+
trueLearnApiBase?: string;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* TrueLearn OAuth token URL (must include connect/token path). Defaults to QA login
|
|
124
|
+
* when omitted.
|
|
125
|
+
*/
|
|
126
|
+
trueLearnTokenUrl?: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* User ID for tracking. If omitted, derived from userContextJwt hash.
|
|
130
|
+
*/
|
|
131
|
+
userId?: string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Embed width (e.g., "100%", "600px")
|
|
135
|
+
*/
|
|
136
|
+
width?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface PerformanceInsightsStreamParams {
|
|
140
|
+
/**
|
|
141
|
+
* Body param: Session / conversation ID (AI SDK uses "id")
|
|
142
|
+
*/
|
|
143
|
+
id?: string;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Body param: Component ID
|
|
147
|
+
*/
|
|
148
|
+
componentId?: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Body param: Additional context
|
|
152
|
+
*/
|
|
153
|
+
context?: unknown;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Body param: Group IDs for access control
|
|
157
|
+
*/
|
|
158
|
+
groupIds?: Array<string>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Body param: Messages array for AI SDK format
|
|
162
|
+
*/
|
|
163
|
+
messages?: Array<string>;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Body param: Session ID
|
|
167
|
+
*/
|
|
168
|
+
sessionId?: string;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Body param: IANA timezone string for data analysis
|
|
172
|
+
*/
|
|
173
|
+
timezone?: string;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Body param: Trigger for AI SDK (what triggered the message)
|
|
177
|
+
*/
|
|
178
|
+
trigger?: string;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Body param: User ID
|
|
182
|
+
*/
|
|
183
|
+
userId?: string;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Header param: Embed token containing the TrueLearn userContextJwt
|
|
187
|
+
*/
|
|
188
|
+
'x-embed-token'?: string;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Header param: User ID header (used when authenticating via API key)
|
|
192
|
+
*/
|
|
193
|
+
'x-user-id'?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
PerformanceInsights.Conversations = Conversations;
|
|
197
|
+
|
|
198
|
+
export declare namespace PerformanceInsights {
|
|
199
|
+
export {
|
|
200
|
+
type PerformanceInsightsGenerateEmbedResponse as PerformanceInsightsGenerateEmbedResponse,
|
|
201
|
+
type PerformanceInsightsGenerateEmbedParams as PerformanceInsightsGenerateEmbedParams,
|
|
202
|
+
type PerformanceInsightsStreamParams as PerformanceInsightsStreamParams,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export {
|
|
206
|
+
Conversations as Conversations,
|
|
207
|
+
type ConversationListParams as ConversationListParams,
|
|
208
|
+
type ConversationCreateParams as ConversationCreateParams,
|
|
209
|
+
type ConversationRetrieveParams as ConversationRetrieveParams,
|
|
210
|
+
type ConversationPushMessagesParams as ConversationPushMessagesParams,
|
|
211
|
+
type ConversationRenameParams as ConversationRenameParams,
|
|
212
|
+
type ConversationDeleteParams as ConversationDeleteParams,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
@@ -63,6 +63,11 @@ export class Usage extends APIResource {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export interface UsageGetStatsParams {
|
|
66
|
+
/**
|
|
67
|
+
* Filter by component type
|
|
68
|
+
*/
|
|
69
|
+
componentType?: string;
|
|
70
|
+
|
|
66
71
|
/**
|
|
67
72
|
* End date for stats (ISO 8601)
|
|
68
73
|
*/
|
|
@@ -82,6 +87,11 @@ export interface UsageGetStatsParams {
|
|
|
82
87
|
* Filter by user ID
|
|
83
88
|
*/
|
|
84
89
|
userId?: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Filter by resource ID (component ID)
|
|
93
|
+
*/
|
|
94
|
+
resourceId?: string;
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
export interface UsageGetSummaryParams {
|