@studyfetch/sdk 1.2.0 → 1.3.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/resources/v1/components.d.mts +239 -11
  4. package/resources/v1/components.d.mts.map +1 -1
  5. package/resources/v1/components.d.ts +239 -11
  6. package/resources/v1/components.d.ts.map +1 -1
  7. package/resources/v1/components.js +10 -29
  8. package/resources/v1/components.js.map +1 -1
  9. package/resources/v1/components.mjs +10 -29
  10. package/resources/v1/components.mjs.map +1 -1
  11. package/resources/v1/index.d.mts +2 -2
  12. package/resources/v1/index.d.mts.map +1 -1
  13. package/resources/v1/index.d.ts +2 -2
  14. package/resources/v1/index.d.ts.map +1 -1
  15. package/resources/v1/index.js.map +1 -1
  16. package/resources/v1/index.mjs.map +1 -1
  17. package/resources/v1/materials/index.d.mts +2 -2
  18. package/resources/v1/materials/index.d.mts.map +1 -1
  19. package/resources/v1/materials/index.d.ts +2 -2
  20. package/resources/v1/materials/index.d.ts.map +1 -1
  21. package/resources/v1/materials/index.js.map +1 -1
  22. package/resources/v1/materials/index.mjs +1 -1
  23. package/resources/v1/materials/index.mjs.map +1 -1
  24. package/resources/v1/materials/materials.d.mts +192 -9
  25. package/resources/v1/materials/materials.d.mts.map +1 -1
  26. package/resources/v1/materials/materials.d.ts +192 -9
  27. package/resources/v1/materials/materials.d.ts.map +1 -1
  28. package/resources/v1/materials/materials.js +6 -17
  29. package/resources/v1/materials/materials.js.map +1 -1
  30. package/resources/v1/materials/materials.mjs +7 -18
  31. package/resources/v1/materials/materials.mjs.map +1 -1
  32. package/resources/v1/materials/upload.d.mts +133 -11
  33. package/resources/v1/materials/upload.d.mts.map +1 -1
  34. package/resources/v1/materials/upload.d.ts +133 -11
  35. package/resources/v1/materials/upload.d.ts.map +1 -1
  36. package/resources/v1/materials/upload.js +12 -14
  37. package/resources/v1/materials/upload.js.map +1 -1
  38. package/resources/v1/materials/upload.mjs +12 -14
  39. package/resources/v1/materials/upload.mjs.map +1 -1
  40. package/resources/v1/v1.d.mts +4 -4
  41. package/resources/v1/v1.d.mts.map +1 -1
  42. package/resources/v1/v1.d.ts +4 -4
  43. package/resources/v1/v1.d.ts.map +1 -1
  44. package/resources/v1/v1.js.map +1 -1
  45. package/resources/v1/v1.mjs.map +1 -1
  46. package/src/resources/v1/components.ts +312 -34
  47. package/src/resources/v1/index.ts +8 -0
  48. package/src/resources/v1/materials/index.ts +10 -1
  49. package/src/resources/v1/materials/materials.ts +262 -21
  50. package/src/resources/v1/materials/upload.ts +175 -19
  51. package/src/resources/v1/v1.ts +16 -0
  52. package/src/version.ts +1 -1
  53. package/version.d.mts +1 -1
  54. package/version.d.ts +1 -1
  55. package/version.js +1 -1
  56. package/version.mjs +1 -1
@@ -6,7 +6,13 @@ import { Bulk } from './bulk';
6
6
  import * as TestAPI from './test';
7
7
  import { Test } from './test';
8
8
  import * as UploadAPI from './upload';
9
- import { Upload, UploadUploadFileParams, UploadUploadFromURLParams } from './upload';
9
+ import {
10
+ Upload,
11
+ UploadUploadFileParams,
12
+ UploadUploadFileResponse,
13
+ UploadUploadFromURLParams,
14
+ UploadUploadFromURLResponse,
15
+ } from './upload';
10
16
  import { APIPromise } from '../../../core/api-promise';
11
17
  import { buildHeaders } from '../../../internal/headers';
12
18
  import { RequestOptions } from '../../../internal/request-options';
@@ -22,18 +28,14 @@ export class Materials extends APIResource {
22
28
  *
23
29
  * @example
24
30
  * ```ts
25
- * await client.v1.materials.create({
31
+ * const material = await client.v1.materials.create({
26
32
  * content: { type: 'text' },
27
33
  * name: 'Chapter 1 - Introduction',
28
34
  * });
29
35
  * ```
30
36
  */
31
- create(body: MaterialCreateParams, options?: RequestOptions): APIPromise<void> {
32
- return this._client.post('/api/v1/materials', {
33
- body,
34
- ...options,
35
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
36
- });
37
+ create(body: MaterialCreateParams, options?: RequestOptions): APIPromise<MaterialCreateResponse> {
38
+ return this._client.post('/api/v1/materials', { body, ...options });
37
39
  }
38
40
 
39
41
  /**
@@ -41,14 +43,11 @@ export class Materials extends APIResource {
41
43
  *
42
44
  * @example
43
45
  * ```ts
44
- * await client.v1.materials.retrieve('id');
46
+ * const material = await client.v1.materials.retrieve('id');
45
47
  * ```
46
48
  */
47
- retrieve(id: string, options?: RequestOptions): APIPromise<void> {
48
- return this._client.get(path`/api/v1/materials/${id}`, {
49
- ...options,
50
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
51
- });
49
+ retrieve(id: string, options?: RequestOptions): APIPromise<MaterialRetrieveResponse> {
50
+ return this._client.get(path`/api/v1/materials/${id}`, options);
52
51
  }
53
52
 
54
53
  /**
@@ -56,15 +55,14 @@ export class Materials extends APIResource {
56
55
  *
57
56
  * @example
58
57
  * ```ts
59
- * await client.v1.materials.list();
58
+ * const materials = await client.v1.materials.list();
60
59
  * ```
61
60
  */
62
- list(query: MaterialListParams | null | undefined = {}, options?: RequestOptions): APIPromise<void> {
63
- return this._client.get('/api/v1/materials', {
64
- query,
65
- ...options,
66
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
67
- });
61
+ list(
62
+ query: MaterialListParams | null | undefined = {},
63
+ options?: RequestOptions,
64
+ ): APIPromise<MaterialListResponse> {
65
+ return this._client.get('/api/v1/materials', { query, ...options });
68
66
  }
69
67
 
70
68
  /**
@@ -181,6 +179,244 @@ export class Materials extends APIResource {
181
179
  }
182
180
  }
183
181
 
182
+ export interface MaterialCreateResponse {
183
+ /**
184
+ * Material ID
185
+ */
186
+ _id: string;
187
+
188
+ /**
189
+ * Material content
190
+ */
191
+ content: MaterialCreateResponse.Content;
192
+
193
+ /**
194
+ * Content type
195
+ */
196
+ contentType: 'text' | 'pdf' | 'video' | 'audio' | 'image' | 'epub';
197
+
198
+ /**
199
+ * Creation timestamp
200
+ */
201
+ createdAt: string;
202
+
203
+ /**
204
+ * Folder ID
205
+ */
206
+ folderId: string | null;
207
+
208
+ /**
209
+ * Material name
210
+ */
211
+ name: string;
212
+
213
+ /**
214
+ * Organization ID
215
+ */
216
+ organizationId: string;
217
+
218
+ /**
219
+ * Material status
220
+ */
221
+ status: 'active' | 'processing' | 'pending_upload' | 'error' | 'deleted';
222
+
223
+ /**
224
+ * Last update timestamp
225
+ */
226
+ updatedAt: string;
227
+
228
+ /**
229
+ * Material metadata
230
+ */
231
+ metadata?: unknown;
232
+
233
+ /**
234
+ * Usage information
235
+ */
236
+ usage?: unknown;
237
+ }
238
+
239
+ export namespace MaterialCreateResponse {
240
+ /**
241
+ * Material content
242
+ */
243
+ export interface Content {
244
+ filename?: string;
245
+
246
+ fileSize?: number;
247
+
248
+ mimeType?: string;
249
+
250
+ s3Key?: string;
251
+
252
+ s3Url?: string;
253
+
254
+ text?: string;
255
+
256
+ url?: string;
257
+ }
258
+ }
259
+
260
+ export interface MaterialRetrieveResponse {
261
+ /**
262
+ * Material ID
263
+ */
264
+ _id: string;
265
+
266
+ /**
267
+ * Material content
268
+ */
269
+ content: MaterialRetrieveResponse.Content;
270
+
271
+ /**
272
+ * Content type
273
+ */
274
+ contentType: 'text' | 'pdf' | 'video' | 'audio' | 'image' | 'epub';
275
+
276
+ /**
277
+ * Creation timestamp
278
+ */
279
+ createdAt: string;
280
+
281
+ /**
282
+ * Folder ID
283
+ */
284
+ folderId: string | null;
285
+
286
+ /**
287
+ * Material name
288
+ */
289
+ name: string;
290
+
291
+ /**
292
+ * Organization ID
293
+ */
294
+ organizationId: string;
295
+
296
+ /**
297
+ * Material status
298
+ */
299
+ status: 'active' | 'processing' | 'pending_upload' | 'error' | 'deleted';
300
+
301
+ /**
302
+ * Last update timestamp
303
+ */
304
+ updatedAt: string;
305
+
306
+ /**
307
+ * Material metadata
308
+ */
309
+ metadata?: unknown;
310
+
311
+ /**
312
+ * Usage information
313
+ */
314
+ usage?: unknown;
315
+ }
316
+
317
+ export namespace MaterialRetrieveResponse {
318
+ /**
319
+ * Material content
320
+ */
321
+ export interface Content {
322
+ filename?: string;
323
+
324
+ fileSize?: number;
325
+
326
+ mimeType?: string;
327
+
328
+ s3Key?: string;
329
+
330
+ s3Url?: string;
331
+
332
+ text?: string;
333
+
334
+ url?: string;
335
+ }
336
+ }
337
+
338
+ export type MaterialListResponse = Array<MaterialListResponse.MaterialListResponseItem>;
339
+
340
+ export namespace MaterialListResponse {
341
+ export interface MaterialListResponseItem {
342
+ /**
343
+ * Material ID
344
+ */
345
+ _id: string;
346
+
347
+ /**
348
+ * Material content
349
+ */
350
+ content: MaterialListResponseItem.Content;
351
+
352
+ /**
353
+ * Content type
354
+ */
355
+ contentType: 'text' | 'pdf' | 'video' | 'audio' | 'image' | 'epub';
356
+
357
+ /**
358
+ * Creation timestamp
359
+ */
360
+ createdAt: string;
361
+
362
+ /**
363
+ * Folder ID
364
+ */
365
+ folderId: string | null;
366
+
367
+ /**
368
+ * Material name
369
+ */
370
+ name: string;
371
+
372
+ /**
373
+ * Organization ID
374
+ */
375
+ organizationId: string;
376
+
377
+ /**
378
+ * Material status
379
+ */
380
+ status: 'active' | 'processing' | 'pending_upload' | 'error' | 'deleted';
381
+
382
+ /**
383
+ * Last update timestamp
384
+ */
385
+ updatedAt: string;
386
+
387
+ /**
388
+ * Material metadata
389
+ */
390
+ metadata?: unknown;
391
+
392
+ /**
393
+ * Usage information
394
+ */
395
+ usage?: unknown;
396
+ }
397
+
398
+ export namespace MaterialListResponseItem {
399
+ /**
400
+ * Material content
401
+ */
402
+ export interface Content {
403
+ filename?: string;
404
+
405
+ fileSize?: number;
406
+
407
+ mimeType?: string;
408
+
409
+ s3Key?: string;
410
+
411
+ s3Url?: string;
412
+
413
+ text?: string;
414
+
415
+ url?: string;
416
+ }
417
+ }
418
+ }
419
+
184
420
  export interface MaterialCreateParams {
185
421
  /**
186
422
  * Content details
@@ -242,6 +478,9 @@ Materials.Test = Test;
242
478
 
243
479
  export declare namespace Materials {
244
480
  export {
481
+ type MaterialCreateResponse as MaterialCreateResponse,
482
+ type MaterialRetrieveResponse as MaterialRetrieveResponse,
483
+ type MaterialListResponse as MaterialListResponse,
245
484
  type MaterialCreateParams as MaterialCreateParams,
246
485
  type MaterialListParams as MaterialListParams,
247
486
  type MaterialGetDownloadURLParams as MaterialGetDownloadURLParams,
@@ -249,6 +488,8 @@ export declare namespace Materials {
249
488
 
250
489
  export {
251
490
  Upload as Upload,
491
+ type UploadUploadFileResponse as UploadUploadFileResponse,
492
+ type UploadUploadFromURLResponse as UploadUploadFromURLResponse,
252
493
  type UploadUploadFileParams as UploadUploadFileParams,
253
494
  type UploadUploadFromURLParams as UploadUploadFromURLParams,
254
495
  };
@@ -39,19 +39,17 @@ export class Upload extends APIResource {
39
39
  *
40
40
  * @example
41
41
  * ```ts
42
- * await client.v1.materials.upload.uploadFile({
43
- * file: fs.createReadStream('path/to/file'),
44
- * name: 'name',
45
- * });
42
+ * const response =
43
+ * await client.v1.materials.upload.uploadFile({
44
+ * file: fs.createReadStream('path/to/file'),
45
+ * name: 'name',
46
+ * });
46
47
  * ```
47
48
  */
48
- uploadFile(body: UploadUploadFileParams, options?: RequestOptions): APIPromise<void> {
49
+ uploadFile(body: UploadUploadFileParams, options?: RequestOptions): APIPromise<UploadUploadFileResponse> {
49
50
  return this._client.post(
50
51
  '/api/v1/materials/upload',
51
- multipartFormRequestOptions(
52
- { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
53
- this._client,
54
- ),
52
+ multipartFormRequestOptions({ body, ...options }, this._client),
55
53
  );
56
54
  }
57
55
 
@@ -60,18 +58,174 @@ export class Upload extends APIResource {
60
58
  *
61
59
  * @example
62
60
  * ```ts
63
- * await client.v1.materials.upload.uploadFromURL({
64
- * name: 'name',
65
- * url: 'url',
66
- * });
61
+ * const response =
62
+ * await client.v1.materials.upload.uploadFromURL({
63
+ * name: 'name',
64
+ * url: 'url',
65
+ * });
67
66
  * ```
68
67
  */
69
- uploadFromURL(body: UploadUploadFromURLParams, options?: RequestOptions): APIPromise<void> {
70
- return this._client.post('/api/v1/materials/upload/url', {
71
- body,
72
- ...options,
73
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
74
- });
68
+ uploadFromURL(
69
+ body: UploadUploadFromURLParams,
70
+ options?: RequestOptions,
71
+ ): APIPromise<UploadUploadFromURLResponse> {
72
+ return this._client.post('/api/v1/materials/upload/url', { body, ...options });
73
+ }
74
+ }
75
+
76
+ export interface UploadUploadFileResponse {
77
+ /**
78
+ * Material ID
79
+ */
80
+ _id: string;
81
+
82
+ /**
83
+ * Material content
84
+ */
85
+ content: UploadUploadFileResponse.Content;
86
+
87
+ /**
88
+ * Content type
89
+ */
90
+ contentType: 'text' | 'pdf' | 'video' | 'audio' | 'image' | 'epub';
91
+
92
+ /**
93
+ * Creation timestamp
94
+ */
95
+ createdAt: string;
96
+
97
+ /**
98
+ * Folder ID
99
+ */
100
+ folderId: string | null;
101
+
102
+ /**
103
+ * Material name
104
+ */
105
+ name: string;
106
+
107
+ /**
108
+ * Organization ID
109
+ */
110
+ organizationId: string;
111
+
112
+ /**
113
+ * Material status
114
+ */
115
+ status: 'active' | 'processing' | 'pending_upload' | 'error' | 'deleted';
116
+
117
+ /**
118
+ * Last update timestamp
119
+ */
120
+ updatedAt: string;
121
+
122
+ /**
123
+ * Material metadata
124
+ */
125
+ metadata?: unknown;
126
+
127
+ /**
128
+ * Usage information
129
+ */
130
+ usage?: unknown;
131
+ }
132
+
133
+ export namespace UploadUploadFileResponse {
134
+ /**
135
+ * Material content
136
+ */
137
+ export interface Content {
138
+ filename?: string;
139
+
140
+ fileSize?: number;
141
+
142
+ mimeType?: string;
143
+
144
+ s3Key?: string;
145
+
146
+ s3Url?: string;
147
+
148
+ text?: string;
149
+
150
+ url?: string;
151
+ }
152
+ }
153
+
154
+ export interface UploadUploadFromURLResponse {
155
+ /**
156
+ * Material ID
157
+ */
158
+ _id: string;
159
+
160
+ /**
161
+ * Material content
162
+ */
163
+ content: UploadUploadFromURLResponse.Content;
164
+
165
+ /**
166
+ * Content type
167
+ */
168
+ contentType: 'text' | 'pdf' | 'video' | 'audio' | 'image' | 'epub';
169
+
170
+ /**
171
+ * Creation timestamp
172
+ */
173
+ createdAt: string;
174
+
175
+ /**
176
+ * Folder ID
177
+ */
178
+ folderId: string | null;
179
+
180
+ /**
181
+ * Material name
182
+ */
183
+ name: string;
184
+
185
+ /**
186
+ * Organization ID
187
+ */
188
+ organizationId: string;
189
+
190
+ /**
191
+ * Material status
192
+ */
193
+ status: 'active' | 'processing' | 'pending_upload' | 'error' | 'deleted';
194
+
195
+ /**
196
+ * Last update timestamp
197
+ */
198
+ updatedAt: string;
199
+
200
+ /**
201
+ * Material metadata
202
+ */
203
+ metadata?: unknown;
204
+
205
+ /**
206
+ * Usage information
207
+ */
208
+ usage?: unknown;
209
+ }
210
+
211
+ export namespace UploadUploadFromURLResponse {
212
+ /**
213
+ * Material content
214
+ */
215
+ export interface Content {
216
+ filename?: string;
217
+
218
+ fileSize?: number;
219
+
220
+ mimeType?: string;
221
+
222
+ s3Key?: string;
223
+
224
+ s3Url?: string;
225
+
226
+ text?: string;
227
+
228
+ url?: string;
75
229
  }
76
230
  }
77
231
 
@@ -108,6 +262,8 @@ export interface UploadUploadFromURLParams {
108
262
 
109
263
  export declare namespace Upload {
110
264
  export {
265
+ type UploadUploadFileResponse as UploadUploadFileResponse,
266
+ type UploadUploadFromURLResponse as UploadUploadFromURLResponse,
111
267
  type UploadUploadFileParams as UploadUploadFileParams,
112
268
  type UploadUploadFromURLParams as UploadUploadFromURLParams,
113
269
  };
@@ -4,9 +4,14 @@ import { APIResource } from '../../core/resource';
4
4
  import * as ComponentsAPI from './components';
5
5
  import {
6
6
  ComponentCreateParams,
7
+ ComponentCreateResponse,
7
8
  ComponentEmbedParams,
9
+ ComponentEmbedResponse,
8
10
  ComponentListParams,
11
+ ComponentListResponse,
12
+ ComponentRetrieveResponse,
9
13
  ComponentUpdateParams,
14
+ ComponentUpdateResponse,
10
15
  Components,
11
16
  } from './components';
12
17
  import * as ExplainersAPI from './explainers';
@@ -59,8 +64,11 @@ import { Embed, EmbedGetThemeParams, EmbedVerifyParams } from './embed/embed';
59
64
  import * as MaterialsAPI from './materials/materials';
60
65
  import {
61
66
  MaterialCreateParams,
67
+ MaterialCreateResponse,
62
68
  MaterialGetDownloadURLParams,
63
69
  MaterialListParams,
70
+ MaterialListResponse,
71
+ MaterialRetrieveResponse,
64
72
  Materials,
65
73
  } from './materials/materials';
66
74
  import * as OrganizationsAPI from './organizations/organizations';
@@ -126,6 +134,9 @@ export declare namespace V1 {
126
134
 
127
135
  export {
128
136
  Materials as Materials,
137
+ type MaterialCreateResponse as MaterialCreateResponse,
138
+ type MaterialRetrieveResponse as MaterialRetrieveResponse,
139
+ type MaterialListResponse as MaterialListResponse,
129
140
  type MaterialCreateParams as MaterialCreateParams,
130
141
  type MaterialListParams as MaterialListParams,
131
142
  type MaterialGetDownloadURLParams as MaterialGetDownloadURLParams,
@@ -150,6 +161,11 @@ export declare namespace V1 {
150
161
 
151
162
  export {
152
163
  Components as Components,
164
+ type ComponentCreateResponse as ComponentCreateResponse,
165
+ type ComponentRetrieveResponse as ComponentRetrieveResponse,
166
+ type ComponentUpdateResponse as ComponentUpdateResponse,
167
+ type ComponentListResponse as ComponentListResponse,
168
+ type ComponentEmbedResponse as ComponentEmbedResponse,
153
169
  type ComponentCreateParams as ComponentCreateParams,
154
170
  type ComponentUpdateParams as ComponentUpdateParams,
155
171
  type ComponentListParams as ComponentListParams,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.0'; // x-release-please-version
1
+ export const VERSION = '1.3.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.2.0";
1
+ export declare const VERSION = "1.3.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.2.0";
1
+ export declare const VERSION = "1.3.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.2.0'; // x-release-please-version
4
+ exports.VERSION = '1.3.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.2.0'; // x-release-please-version
1
+ export const VERSION = '1.3.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map