@studyfetch/sdk 1.24.0 → 1.26.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 (168) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/package.json +1 -1
  3. package/resources/v1/assignment-grader.d.mts +34 -1
  4. package/resources/v1/assignment-grader.d.mts.map +1 -1
  5. package/resources/v1/assignment-grader.d.ts +34 -1
  6. package/resources/v1/assignment-grader.d.ts.map +1 -1
  7. package/resources/v1/assignment-grader.js +15 -0
  8. package/resources/v1/assignment-grader.js.map +1 -1
  9. package/resources/v1/assignment-grader.mjs +15 -0
  10. package/resources/v1/assignment-grader.mjs.map +1 -1
  11. package/resources/v1/chat/chat.d.mts +62 -1
  12. package/resources/v1/chat/chat.d.mts.map +1 -1
  13. package/resources/v1/chat/chat.d.ts +62 -1
  14. package/resources/v1/chat/chat.d.ts.map +1 -1
  15. package/resources/v1/chat/chat.js.map +1 -1
  16. package/resources/v1/chat/chat.mjs.map +1 -1
  17. package/resources/v1/chat/index.d.mts +1 -1
  18. package/resources/v1/chat/index.d.mts.map +1 -1
  19. package/resources/v1/chat/index.d.ts +1 -1
  20. package/resources/v1/chat/index.d.ts.map +1 -1
  21. package/resources/v1/chat/index.js.map +1 -1
  22. package/resources/v1/chat/index.mjs +1 -1
  23. package/resources/v1/chat/index.mjs.map +1 -1
  24. package/resources/v1/components.d.mts +62 -4
  25. package/resources/v1/components.d.mts.map +1 -1
  26. package/resources/v1/components.d.ts +62 -4
  27. package/resources/v1/components.d.ts.map +1 -1
  28. package/resources/v1/data-analyst/data-analyst.d.mts +156 -0
  29. package/resources/v1/data-analyst/data-analyst.d.mts.map +1 -0
  30. package/resources/v1/data-analyst/data-analyst.d.ts +156 -0
  31. package/resources/v1/data-analyst/data-analyst.d.ts.map +1 -0
  32. package/resources/v1/data-analyst/data-analyst.js +99 -0
  33. package/resources/v1/data-analyst/data-analyst.js.map +1 -0
  34. package/resources/v1/data-analyst/data-analyst.mjs +94 -0
  35. package/resources/v1/data-analyst/data-analyst.mjs.map +1 -0
  36. package/resources/v1/data-analyst/index.d.mts +4 -0
  37. package/resources/v1/data-analyst/index.d.mts.map +1 -0
  38. package/resources/v1/data-analyst/index.d.ts +4 -0
  39. package/resources/v1/data-analyst/index.d.ts.map +1 -0
  40. package/resources/v1/data-analyst/index.js +11 -0
  41. package/resources/v1/data-analyst/index.js.map +1 -0
  42. package/resources/v1/data-analyst/index.mjs +5 -0
  43. package/resources/v1/data-analyst/index.mjs.map +1 -0
  44. package/resources/v1/data-analyst/sessions.d.mts +28 -0
  45. package/resources/v1/data-analyst/sessions.d.mts.map +1 -0
  46. package/resources/v1/data-analyst/sessions.d.ts +28 -0
  47. package/resources/v1/data-analyst/sessions.d.ts.map +1 -0
  48. package/resources/v1/data-analyst/sessions.js +38 -0
  49. package/resources/v1/data-analyst/sessions.js.map +1 -0
  50. package/resources/v1/data-analyst/sessions.mjs +34 -0
  51. package/resources/v1/data-analyst/sessions.mjs.map +1 -0
  52. package/resources/v1/data-analyst/test.d.mts +20 -0
  53. package/resources/v1/data-analyst/test.d.mts.map +1 -0
  54. package/resources/v1/data-analyst/test.d.ts +20 -0
  55. package/resources/v1/data-analyst/test.d.ts.map +1 -0
  56. package/resources/v1/data-analyst/test.js +34 -0
  57. package/resources/v1/data-analyst/test.js.map +1 -0
  58. package/resources/v1/data-analyst/test.mjs +30 -0
  59. package/resources/v1/data-analyst/test.mjs.map +1 -0
  60. package/resources/v1/data-analyst.d.mts +2 -0
  61. package/resources/v1/data-analyst.d.mts.map +1 -0
  62. package/resources/v1/data-analyst.d.ts +2 -0
  63. package/resources/v1/data-analyst.d.ts.map +1 -0
  64. package/resources/v1/data-analyst.js +6 -0
  65. package/resources/v1/data-analyst.js.map +1 -0
  66. package/resources/v1/data-analyst.mjs +3 -0
  67. package/resources/v1/data-analyst.mjs.map +1 -0
  68. package/resources/v1/index.d.mts +3 -2
  69. package/resources/v1/index.d.mts.map +1 -1
  70. package/resources/v1/index.d.ts +3 -2
  71. package/resources/v1/index.d.ts.map +1 -1
  72. package/resources/v1/index.js +15 -13
  73. package/resources/v1/index.js.map +1 -1
  74. package/resources/v1/index.mjs +1 -0
  75. package/resources/v1/index.mjs.map +1 -1
  76. package/resources/v1/materials/bulk.d.mts +30 -2
  77. package/resources/v1/materials/bulk.d.mts.map +1 -1
  78. package/resources/v1/materials/bulk.d.ts +30 -2
  79. package/resources/v1/materials/bulk.d.ts.map +1 -1
  80. package/resources/v1/materials/bulk.js +8 -7
  81. package/resources/v1/materials/bulk.js.map +1 -1
  82. package/resources/v1/materials/bulk.mjs +8 -7
  83. package/resources/v1/materials/bulk.mjs.map +1 -1
  84. package/resources/v1/materials/index.d.mts +4 -4
  85. package/resources/v1/materials/index.d.mts.map +1 -1
  86. package/resources/v1/materials/index.d.ts +4 -4
  87. package/resources/v1/materials/index.d.ts.map +1 -1
  88. package/resources/v1/materials/index.js.map +1 -1
  89. package/resources/v1/materials/index.mjs +2 -2
  90. package/resources/v1/materials/index.mjs.map +1 -1
  91. package/resources/v1/materials/materials.d.mts +270 -43
  92. package/resources/v1/materials/materials.d.mts.map +1 -1
  93. package/resources/v1/materials/materials.d.ts +270 -43
  94. package/resources/v1/materials/materials.d.ts.map +1 -1
  95. package/resources/v1/materials/materials.js +64 -44
  96. package/resources/v1/materials/materials.js.map +1 -1
  97. package/resources/v1/materials/materials.mjs +66 -46
  98. package/resources/v1/materials/materials.mjs.map +1 -1
  99. package/resources/v1/materials/test.d.mts +111 -8
  100. package/resources/v1/materials/test.d.mts.map +1 -1
  101. package/resources/v1/materials/test.d.ts +111 -8
  102. package/resources/v1/materials/test.d.ts.map +1 -1
  103. package/resources/v1/materials/test.js +20 -21
  104. package/resources/v1/materials/test.js.map +1 -1
  105. package/resources/v1/materials/test.mjs +20 -21
  106. package/resources/v1/materials/test.mjs.map +1 -1
  107. package/resources/v1/materials/upload.d.mts +149 -5
  108. package/resources/v1/materials/upload.d.mts.map +1 -1
  109. package/resources/v1/materials/upload.d.ts +149 -5
  110. package/resources/v1/materials/upload.d.ts.map +1 -1
  111. package/resources/v1/materials/upload.js +53 -13
  112. package/resources/v1/materials/upload.js.map +1 -1
  113. package/resources/v1/materials/upload.mjs +53 -13
  114. package/resources/v1/materials/upload.mjs.map +1 -1
  115. package/resources/v1/usage/analyst.d.mts +51 -6
  116. package/resources/v1/usage/analyst.d.mts.map +1 -1
  117. package/resources/v1/usage/analyst.d.ts +51 -6
  118. package/resources/v1/usage/analyst.d.ts.map +1 -1
  119. package/resources/v1/usage/analyst.js +8 -9
  120. package/resources/v1/usage/analyst.js.map +1 -1
  121. package/resources/v1/usage/analyst.mjs +8 -9
  122. package/resources/v1/usage/analyst.mjs.map +1 -1
  123. package/resources/v1/usage/index.d.mts +1 -1
  124. package/resources/v1/usage/index.d.mts.map +1 -1
  125. package/resources/v1/usage/index.d.ts +1 -1
  126. package/resources/v1/usage/index.d.ts.map +1 -1
  127. package/resources/v1/usage/index.js.map +1 -1
  128. package/resources/v1/usage/index.mjs +1 -1
  129. package/resources/v1/usage/index.mjs.map +1 -1
  130. package/resources/v1/usage/usage.d.mts +2 -2
  131. package/resources/v1/usage/usage.d.mts.map +1 -1
  132. package/resources/v1/usage/usage.d.ts +2 -2
  133. package/resources/v1/usage/usage.d.ts.map +1 -1
  134. package/resources/v1/usage/usage.js.map +1 -1
  135. package/resources/v1/usage/usage.mjs +1 -1
  136. package/resources/v1/usage/usage.mjs.map +1 -1
  137. package/resources/v1/v1.d.mts +19 -4
  138. package/resources/v1/v1.d.mts.map +1 -1
  139. package/resources/v1/v1.d.ts +19 -4
  140. package/resources/v1/v1.d.ts.map +1 -1
  141. package/resources/v1/v1.js +19 -0
  142. package/resources/v1/v1.js.map +1 -1
  143. package/resources/v1/v1.mjs +20 -1
  144. package/resources/v1/v1.mjs.map +1 -1
  145. package/src/resources/v1/assignment-grader.ts +47 -1
  146. package/src/resources/v1/chat/chat.ts +74 -0
  147. package/src/resources/v1/chat/index.ts +7 -1
  148. package/src/resources/v1/components.ts +76 -0
  149. package/src/resources/v1/data-analyst/data-analyst.ts +233 -0
  150. package/src/resources/v1/data-analyst/index.ts +10 -0
  151. package/src/resources/v1/data-analyst/sessions.ts +46 -0
  152. package/src/resources/v1/data-analyst/test.ts +34 -0
  153. package/src/resources/v1/data-analyst.ts +3 -0
  154. package/src/resources/v1/index.ts +16 -0
  155. package/src/resources/v1/materials/bulk.ts +36 -7
  156. package/src/resources/v1/materials/index.ts +28 -3
  157. package/src/resources/v1/materials/materials.ts +364 -72
  158. package/src/resources/v1/materials/test.ts +141 -25
  159. package/src/resources/v1/materials/upload.ts +200 -13
  160. package/src/resources/v1/usage/analyst.ts +80 -10
  161. package/src/resources/v1/usage/index.ts +7 -1
  162. package/src/resources/v1/usage/usage.ts +14 -2
  163. package/src/resources/v1/v1.ts +60 -1
  164. package/src/version.ts +1 -1
  165. package/version.d.mts +1 -1
  166. package/version.d.ts +1 -1
  167. package/version.js +1 -1
  168. package/version.mjs +1 -1
@@ -5,19 +5,34 @@ import { type Uploadable } from "../../../core/uploads.mjs";
5
5
  import { RequestOptions } from "../../../internal/request-options.mjs";
6
6
  export declare class Upload extends APIResource {
7
7
  /**
8
+ * Complete upload after using presigned URL
9
+ *
8
10
  * @example
9
11
  * ```ts
10
- * await client.v1.materials.upload.completeUpload();
12
+ * const material =
13
+ * await client.v1.materials.upload.completeUpload({
14
+ * materialId: '507f1f77bcf86cd799439013',
15
+ * organizationId: '507f1f77bcf86cd799439011',
16
+ * s3Key:
17
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
18
+ * });
11
19
  * ```
12
20
  */
13
- completeUpload(options?: RequestOptions): APIPromise<void>;
21
+ completeUpload(body: UploadCompleteUploadParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
14
22
  /**
23
+ * Get presigned URL for direct S3 upload
24
+ *
15
25
  * @example
16
26
  * ```ts
17
- * await client.v1.materials.upload.createPresignedURL();
27
+ * const response =
28
+ * await client.v1.materials.upload.createPresignedURL({
29
+ * contentType: 'application/pdf',
30
+ * filename: 'document.pdf',
31
+ * name: 'Chapter 1 Notes',
32
+ * });
18
33
  * ```
19
34
  */
20
- createPresignedURL(options?: RequestOptions): APIPromise<void>;
35
+ createPresignedURL(body: UploadCreatePresignedURLParams, options?: RequestOptions): APIPromise<UploadCreatePresignedURLResponse>;
21
36
  /**
22
37
  * Upload a material file
23
38
  *
@@ -31,6 +46,20 @@ export declare class Upload extends APIResource {
31
46
  * ```
32
47
  */
33
48
  uploadFile(body: UploadUploadFileParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
49
+ /**
50
+ * Uploads a file and waits for processing to finish before returning. Useful for
51
+ * synchronous API usage.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const material =
56
+ * await client.v1.materials.upload.uploadFileAndProcess({
57
+ * file: fs.createReadStream('path/to/file'),
58
+ * name: 'name',
59
+ * });
60
+ * ```
61
+ */
62
+ uploadFileAndProcess(body: UploadUploadFileAndProcessParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
34
63
  /**
35
64
  * Upload material from URL
36
65
  *
@@ -44,6 +73,80 @@ export declare class Upload extends APIResource {
44
73
  * ```
45
74
  */
46
75
  uploadFromURL(body: UploadUploadFromURLParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
76
+ /**
77
+ * Fetches content from URL and waits for processing to finish before returning.
78
+ * Useful for synchronous API usage.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const material =
83
+ * await client.v1.materials.upload.uploadURLAndProcess({
84
+ * name: 'My Document',
85
+ * url: 'https://example.com/document.pdf',
86
+ * });
87
+ * ```
88
+ */
89
+ uploadURLAndProcess(body: UploadUploadURLAndProcessParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
90
+ }
91
+ export interface Complete {
92
+ /**
93
+ * The ID of the material that was uploaded
94
+ */
95
+ materialId: string;
96
+ /**
97
+ * The ID of the organization
98
+ */
99
+ organizationId: string;
100
+ /**
101
+ * The S3 key of the uploaded file
102
+ */
103
+ s3Key: string;
104
+ }
105
+ export interface UploadCreatePresignedURLResponse {
106
+ /**
107
+ * Material ID to use for completion
108
+ */
109
+ materialId: string;
110
+ /**
111
+ * S3 key for the file
112
+ */
113
+ s3Key: string;
114
+ /**
115
+ * Presigned URL for direct S3 upload
116
+ */
117
+ uploadUrl: string;
118
+ }
119
+ export interface UploadCompleteUploadParams {
120
+ /**
121
+ * The ID of the material that was uploaded
122
+ */
123
+ materialId: string;
124
+ /**
125
+ * The ID of the organization
126
+ */
127
+ organizationId: string;
128
+ /**
129
+ * The S3 key of the uploaded file
130
+ */
131
+ s3Key: string;
132
+ }
133
+ export interface UploadCreatePresignedURLParams {
134
+ /**
135
+ * MIME type of the file
136
+ */
137
+ contentType: string;
138
+ /**
139
+ * Filename to upload
140
+ */
141
+ filename: string;
142
+ /**
143
+ * Display name for the material
144
+ */
145
+ name: string;
146
+ /**
147
+ * Folder ID to place the material in
148
+ */
149
+ folderId?: string;
47
150
  }
48
151
  export interface UploadUploadFileParams {
49
152
  file: Uploadable;
@@ -56,6 +159,25 @@ export interface UploadUploadFileParams {
56
159
  */
57
160
  folderId?: string;
58
161
  }
162
+ export interface UploadUploadFileAndProcessParams {
163
+ file: Uploadable;
164
+ /**
165
+ * Material name
166
+ */
167
+ name: string;
168
+ /**
169
+ * Folder ID (optional)
170
+ */
171
+ folderId?: string;
172
+ /**
173
+ * Polling interval in milliseconds (default: 2000)
174
+ */
175
+ pollIntervalMs?: number;
176
+ /**
177
+ * Processing timeout in milliseconds (default: 300000)
178
+ */
179
+ timeoutMs?: number;
180
+ }
59
181
  export interface UploadUploadFromURLParams {
60
182
  /**
61
183
  * Material name
@@ -70,7 +192,29 @@ export interface UploadUploadFromURLParams {
70
192
  */
71
193
  folderId?: string;
72
194
  }
195
+ export interface UploadUploadURLAndProcessParams {
196
+ /**
197
+ * Material name
198
+ */
199
+ name: string;
200
+ /**
201
+ * URL to fetch content from
202
+ */
203
+ url: string;
204
+ /**
205
+ * Folder ID (optional)
206
+ */
207
+ folderId?: string;
208
+ /**
209
+ * Polling interval in milliseconds (default: 2 seconds)
210
+ */
211
+ pollIntervalMs?: number;
212
+ /**
213
+ * Maximum time to wait for processing in milliseconds (default: 5 minutes)
214
+ */
215
+ timeoutMs?: number;
216
+ }
73
217
  export declare namespace Upload {
74
- export { type UploadUploadFileParams as UploadUploadFileParams, type UploadUploadFromURLParams as UploadUploadFromURLParams, };
218
+ export { type Complete as Complete, type UploadCreatePresignedURLResponse as UploadCreatePresignedURLResponse, type UploadCompleteUploadParams as UploadCompleteUploadParams, type UploadCreatePresignedURLParams as UploadCreatePresignedURLParams, type UploadUploadFileParams as UploadUploadFileParams, type UploadUploadFileAndProcessParams as UploadUploadFileAndProcessParams, type UploadUploadFromURLParams as UploadUploadFromURLParams, type UploadUploadURLAndProcessParams as UploadUploadURLAndProcessParams, };
75
219
  }
76
220
  //# sourceMappingURL=upload.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/materials/upload.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;OAKG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO1D;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO9D;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC;IAOrG;;;;;;;;;;;OAWG;IACH,aAAa,CACX,IAAI,EAAE,yBAAyB,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AgC;IAC/C,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC9C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,+BAA+B,IAAI,+BAA+B,GACxE,CAAC;CACH"}
@@ -5,19 +5,34 @@ import { type Uploadable } from "../../../core/uploads.js";
5
5
  import { RequestOptions } from "../../../internal/request-options.js";
6
6
  export declare class Upload extends APIResource {
7
7
  /**
8
+ * Complete upload after using presigned URL
9
+ *
8
10
  * @example
9
11
  * ```ts
10
- * await client.v1.materials.upload.completeUpload();
12
+ * const material =
13
+ * await client.v1.materials.upload.completeUpload({
14
+ * materialId: '507f1f77bcf86cd799439013',
15
+ * organizationId: '507f1f77bcf86cd799439011',
16
+ * s3Key:
17
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
18
+ * });
11
19
  * ```
12
20
  */
13
- completeUpload(options?: RequestOptions): APIPromise<void>;
21
+ completeUpload(body: UploadCompleteUploadParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
14
22
  /**
23
+ * Get presigned URL for direct S3 upload
24
+ *
15
25
  * @example
16
26
  * ```ts
17
- * await client.v1.materials.upload.createPresignedURL();
27
+ * const response =
28
+ * await client.v1.materials.upload.createPresignedURL({
29
+ * contentType: 'application/pdf',
30
+ * filename: 'document.pdf',
31
+ * name: 'Chapter 1 Notes',
32
+ * });
18
33
  * ```
19
34
  */
20
- createPresignedURL(options?: RequestOptions): APIPromise<void>;
35
+ createPresignedURL(body: UploadCreatePresignedURLParams, options?: RequestOptions): APIPromise<UploadCreatePresignedURLResponse>;
21
36
  /**
22
37
  * Upload a material file
23
38
  *
@@ -31,6 +46,20 @@ export declare class Upload extends APIResource {
31
46
  * ```
32
47
  */
33
48
  uploadFile(body: UploadUploadFileParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
49
+ /**
50
+ * Uploads a file and waits for processing to finish before returning. Useful for
51
+ * synchronous API usage.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const material =
56
+ * await client.v1.materials.upload.uploadFileAndProcess({
57
+ * file: fs.createReadStream('path/to/file'),
58
+ * name: 'name',
59
+ * });
60
+ * ```
61
+ */
62
+ uploadFileAndProcess(body: UploadUploadFileAndProcessParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
34
63
  /**
35
64
  * Upload material from URL
36
65
  *
@@ -44,6 +73,80 @@ export declare class Upload extends APIResource {
44
73
  * ```
45
74
  */
46
75
  uploadFromURL(body: UploadUploadFromURLParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
76
+ /**
77
+ * Fetches content from URL and waits for processing to finish before returning.
78
+ * Useful for synchronous API usage.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const material =
83
+ * await client.v1.materials.upload.uploadURLAndProcess({
84
+ * name: 'My Document',
85
+ * url: 'https://example.com/document.pdf',
86
+ * });
87
+ * ```
88
+ */
89
+ uploadURLAndProcess(body: UploadUploadURLAndProcessParams, options?: RequestOptions): APIPromise<MaterialsAPI.Material>;
90
+ }
91
+ export interface Complete {
92
+ /**
93
+ * The ID of the material that was uploaded
94
+ */
95
+ materialId: string;
96
+ /**
97
+ * The ID of the organization
98
+ */
99
+ organizationId: string;
100
+ /**
101
+ * The S3 key of the uploaded file
102
+ */
103
+ s3Key: string;
104
+ }
105
+ export interface UploadCreatePresignedURLResponse {
106
+ /**
107
+ * Material ID to use for completion
108
+ */
109
+ materialId: string;
110
+ /**
111
+ * S3 key for the file
112
+ */
113
+ s3Key: string;
114
+ /**
115
+ * Presigned URL for direct S3 upload
116
+ */
117
+ uploadUrl: string;
118
+ }
119
+ export interface UploadCompleteUploadParams {
120
+ /**
121
+ * The ID of the material that was uploaded
122
+ */
123
+ materialId: string;
124
+ /**
125
+ * The ID of the organization
126
+ */
127
+ organizationId: string;
128
+ /**
129
+ * The S3 key of the uploaded file
130
+ */
131
+ s3Key: string;
132
+ }
133
+ export interface UploadCreatePresignedURLParams {
134
+ /**
135
+ * MIME type of the file
136
+ */
137
+ contentType: string;
138
+ /**
139
+ * Filename to upload
140
+ */
141
+ filename: string;
142
+ /**
143
+ * Display name for the material
144
+ */
145
+ name: string;
146
+ /**
147
+ * Folder ID to place the material in
148
+ */
149
+ folderId?: string;
47
150
  }
48
151
  export interface UploadUploadFileParams {
49
152
  file: Uploadable;
@@ -56,6 +159,25 @@ export interface UploadUploadFileParams {
56
159
  */
57
160
  folderId?: string;
58
161
  }
162
+ export interface UploadUploadFileAndProcessParams {
163
+ file: Uploadable;
164
+ /**
165
+ * Material name
166
+ */
167
+ name: string;
168
+ /**
169
+ * Folder ID (optional)
170
+ */
171
+ folderId?: string;
172
+ /**
173
+ * Polling interval in milliseconds (default: 2000)
174
+ */
175
+ pollIntervalMs?: number;
176
+ /**
177
+ * Processing timeout in milliseconds (default: 300000)
178
+ */
179
+ timeoutMs?: number;
180
+ }
59
181
  export interface UploadUploadFromURLParams {
60
182
  /**
61
183
  * Material name
@@ -70,7 +192,29 @@ export interface UploadUploadFromURLParams {
70
192
  */
71
193
  folderId?: string;
72
194
  }
195
+ export interface UploadUploadURLAndProcessParams {
196
+ /**
197
+ * Material name
198
+ */
199
+ name: string;
200
+ /**
201
+ * URL to fetch content from
202
+ */
203
+ url: string;
204
+ /**
205
+ * Folder ID (optional)
206
+ */
207
+ folderId?: string;
208
+ /**
209
+ * Polling interval in milliseconds (default: 2 seconds)
210
+ */
211
+ pollIntervalMs?: number;
212
+ /**
213
+ * Maximum time to wait for processing in milliseconds (default: 5 minutes)
214
+ */
215
+ timeoutMs?: number;
216
+ }
73
217
  export declare namespace Upload {
74
- export { type UploadUploadFileParams as UploadUploadFileParams, type UploadUploadFromURLParams as UploadUploadFromURLParams, };
218
+ export { type Complete as Complete, type UploadCreatePresignedURLResponse as UploadCreatePresignedURLResponse, type UploadCompleteUploadParams as UploadCompleteUploadParams, type UploadCreatePresignedURLParams as UploadCreatePresignedURLParams, type UploadUploadFileParams as UploadUploadFileParams, type UploadUploadFileAndProcessParams as UploadUploadFileAndProcessParams, type UploadUploadFromURLParams as UploadUploadFromURLParams, type UploadUploadURLAndProcessParams as UploadUploadURLAndProcessParams, };
75
219
  }
76
220
  //# sourceMappingURL=upload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/materials/upload.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC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AK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,+BAA+B,IAAI,+BAA+B,GACxE,CAAC;CACH"}
@@ -3,32 +3,40 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Upload = void 0;
5
5
  const resource_1 = require("../../../core/resource.js");
6
- const headers_1 = require("../../../internal/headers.js");
7
6
  const uploads_1 = require("../../../internal/uploads.js");
8
7
  class Upload extends resource_1.APIResource {
9
8
  /**
9
+ * Complete upload after using presigned URL
10
+ *
10
11
  * @example
11
12
  * ```ts
12
- * await client.v1.materials.upload.completeUpload();
13
+ * const material =
14
+ * await client.v1.materials.upload.completeUpload({
15
+ * materialId: '507f1f77bcf86cd799439013',
16
+ * organizationId: '507f1f77bcf86cd799439011',
17
+ * s3Key:
18
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
19
+ * });
13
20
  * ```
14
21
  */
15
- completeUpload(options) {
16
- return this._client.post('/api/v1/materials/upload/complete', {
17
- ...options,
18
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
19
- });
22
+ completeUpload(body, options) {
23
+ return this._client.post('/api/v1/materials/upload/complete', { body, ...options });
20
24
  }
21
25
  /**
26
+ * Get presigned URL for direct S3 upload
27
+ *
22
28
  * @example
23
29
  * ```ts
24
- * await client.v1.materials.upload.createPresignedURL();
30
+ * const response =
31
+ * await client.v1.materials.upload.createPresignedURL({
32
+ * contentType: 'application/pdf',
33
+ * filename: 'document.pdf',
34
+ * name: 'Chapter 1 Notes',
35
+ * });
25
36
  * ```
26
37
  */
27
- createPresignedURL(options) {
28
- return this._client.post('/api/v1/materials/upload/presigned-url', {
29
- ...options,
30
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
31
- });
38
+ createPresignedURL(body, options) {
39
+ return this._client.post('/api/v1/materials/upload/presigned-url', { body, ...options });
32
40
  }
33
41
  /**
34
42
  * Upload a material file
@@ -45,6 +53,22 @@ class Upload extends resource_1.APIResource {
45
53
  uploadFile(body, options) {
46
54
  return this._client.post('/api/v1/materials/upload', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
47
55
  }
56
+ /**
57
+ * Uploads a file and waits for processing to finish before returning. Useful for
58
+ * synchronous API usage.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const material =
63
+ * await client.v1.materials.upload.uploadFileAndProcess({
64
+ * file: fs.createReadStream('path/to/file'),
65
+ * name: 'name',
66
+ * });
67
+ * ```
68
+ */
69
+ uploadFileAndProcess(body, options) {
70
+ return this._client.post('/api/v1/materials/upload/file-and-process', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
71
+ }
48
72
  /**
49
73
  * Upload material from URL
50
74
  *
@@ -60,6 +84,22 @@ class Upload extends resource_1.APIResource {
60
84
  uploadFromURL(body, options) {
61
85
  return this._client.post('/api/v1/materials/upload/url', { body, ...options });
62
86
  }
87
+ /**
88
+ * Fetches content from URL and waits for processing to finish before returning.
89
+ * Useful for synchronous API usage.
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const material =
94
+ * await client.v1.materials.upload.uploadURLAndProcess({
95
+ * name: 'My Document',
96
+ * url: 'https://example.com/document.pdf',
97
+ * });
98
+ * ```
99
+ */
100
+ uploadURLAndProcess(body, options) {
101
+ return this._client.post('/api/v1/materials/upload/url-and-process', { body, ...options });
102
+ }
63
103
  }
64
104
  exports.Upload = Upload;
65
105
  //# sourceMappingURL=upload.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/resources/v1/materials/upload.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAIrD,0DAAyD;AAEzD,0DAAwE;AAExE,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;OAKG;IACH,cAAc,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,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ED;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAChB,IAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,wCAAwC,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAA4B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,0BAA0B,EAC1B,IAAA,qCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAClB,IAAsC,EACtC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,2CAA2C,EAC3C,IAAA,qCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,aAAa,CACX,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,mBAAmB,CACjB,IAAqC,EACrC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0CAA0C,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;CACF;AA1HD,wBA0HC"}
@@ -1,31 +1,39 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../../../core/resource.mjs";
3
- import { buildHeaders } from "../../../internal/headers.mjs";
4
3
  import { multipartFormRequestOptions } from "../../../internal/uploads.mjs";
5
4
  export class Upload extends APIResource {
6
5
  /**
6
+ * Complete upload after using presigned URL
7
+ *
7
8
  * @example
8
9
  * ```ts
9
- * await client.v1.materials.upload.completeUpload();
10
+ * const material =
11
+ * await client.v1.materials.upload.completeUpload({
12
+ * materialId: '507f1f77bcf86cd799439013',
13
+ * organizationId: '507f1f77bcf86cd799439011',
14
+ * s3Key:
15
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
16
+ * });
10
17
  * ```
11
18
  */
12
- completeUpload(options) {
13
- return this._client.post('/api/v1/materials/upload/complete', {
14
- ...options,
15
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
16
- });
19
+ completeUpload(body, options) {
20
+ return this._client.post('/api/v1/materials/upload/complete', { body, ...options });
17
21
  }
18
22
  /**
23
+ * Get presigned URL for direct S3 upload
24
+ *
19
25
  * @example
20
26
  * ```ts
21
- * await client.v1.materials.upload.createPresignedURL();
27
+ * const response =
28
+ * await client.v1.materials.upload.createPresignedURL({
29
+ * contentType: 'application/pdf',
30
+ * filename: 'document.pdf',
31
+ * name: 'Chapter 1 Notes',
32
+ * });
22
33
  * ```
23
34
  */
24
- createPresignedURL(options) {
25
- return this._client.post('/api/v1/materials/upload/presigned-url', {
26
- ...options,
27
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
28
- });
35
+ createPresignedURL(body, options) {
36
+ return this._client.post('/api/v1/materials/upload/presigned-url', { body, ...options });
29
37
  }
30
38
  /**
31
39
  * Upload a material file
@@ -42,6 +50,22 @@ export class Upload extends APIResource {
42
50
  uploadFile(body, options) {
43
51
  return this._client.post('/api/v1/materials/upload', multipartFormRequestOptions({ body, ...options }, this._client));
44
52
  }
53
+ /**
54
+ * Uploads a file and waits for processing to finish before returning. Useful for
55
+ * synchronous API usage.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const material =
60
+ * await client.v1.materials.upload.uploadFileAndProcess({
61
+ * file: fs.createReadStream('path/to/file'),
62
+ * name: 'name',
63
+ * });
64
+ * ```
65
+ */
66
+ uploadFileAndProcess(body, options) {
67
+ return this._client.post('/api/v1/materials/upload/file-and-process', multipartFormRequestOptions({ body, ...options }, this._client));
68
+ }
45
69
  /**
46
70
  * Upload material from URL
47
71
  *
@@ -57,5 +81,21 @@ export class Upload extends APIResource {
57
81
  uploadFromURL(body, options) {
58
82
  return this._client.post('/api/v1/materials/upload/url', { body, ...options });
59
83
  }
84
+ /**
85
+ * Fetches content from URL and waits for processing to finish before returning.
86
+ * Useful for synchronous API usage.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const material =
91
+ * await client.v1.materials.upload.uploadURLAndProcess({
92
+ * name: 'My Document',
93
+ * url: 'https://example.com/document.pdf',
94
+ * });
95
+ * ```
96
+ */
97
+ uploadURLAndProcess(body, options) {
98
+ return this._client.post('/api/v1/materials/upload/url-and-process', { body, ...options });
99
+ }
60
100
  }
61
101
  //# sourceMappingURL=upload.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.mjs","sourceRoot":"","sources":["../../../src/resources/v1/materials/upload.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;AAEtC,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;OAKG;IACH,cAAc,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mCAAmC,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,wCAAwC,EAAE;YACjE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAA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