@studyfetch/sdk 1.20.0 → 1.22.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.22.0 (2025-07-21)
4
+
5
+ Full Changelog: [v1.21.0...v1.22.0](https://github.com/GoStudyFetchGo/studyfetch-sdk/compare/v1.21.0...v1.22.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([84fa6b9](https://github.com/GoStudyFetchGo/studyfetch-sdk/commit/84fa6b9f665f65a742a45aa5bdf854a29463ef43))
10
+
11
+ ## 1.21.0 (2025-07-21)
12
+
13
+ Full Changelog: [v1.20.0...v1.21.0](https://github.com/GoStudyFetchGo/studyfetch-sdk/compare/v1.20.0...v1.21.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([980a2ab](https://github.com/GoStudyFetchGo/studyfetch-sdk/commit/980a2ab1d562abc0e78a244f8a1f96cdfd7ad205))
18
+
3
19
  ## 1.20.0 (2025-07-21)
4
20
 
5
21
  Full Changelog: [v1.19.0...v1.20.0](https://github.com/GoStudyFetchGo/studyfetch-sdk/compare/v1.19.0...v1.20.0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyfetch/sdk",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "description": "The official TypeScript library for the Studyfetch SDK API",
5
5
  "author": "Studyfetch SDK <support@studyfetch.com>",
6
6
  "types": "./index.d.ts",
@@ -1,38 +1,146 @@
1
1
  import { APIResource } from "../../../core/resource.mjs";
2
2
  import { APIPromise } from "../../../core/api-promise.mjs";
3
+ import { type Uploadable } from "../../../core/uploads.mjs";
3
4
  import { RequestOptions } from "../../../internal/request-options.mjs";
4
5
  export declare class Component extends APIResource {
5
6
  /**
7
+ * Complete a file upload after using presigned URL
8
+ *
6
9
  * @example
7
10
  * ```ts
8
11
  * await client.v1.upload.component.completeUpload(
9
12
  * 'componentId',
13
+ * {
14
+ * materialId: '507f1f77bcf86cd799439013',
15
+ * organizationId: '507f1f77bcf86cd799439011',
16
+ * s3Key:
17
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
18
+ * },
10
19
  * );
11
20
  * ```
12
21
  */
13
- completeUpload(componentID: string, options?: RequestOptions): APIPromise<void>;
22
+ completeUpload(componentID: string, body: ComponentCompleteUploadParams, options?: RequestOptions): APIPromise<void>;
14
23
  /**
24
+ * Get a presigned URL for direct file upload
25
+ *
15
26
  * @example
16
27
  * ```ts
17
- * await client.v1.upload.component.getPresignedURL(
18
- * 'componentId',
19
- * );
28
+ * const response =
29
+ * await client.v1.upload.component.getPresignedURL(
30
+ * 'componentId',
31
+ * {
32
+ * contentType: 'application/pdf',
33
+ * filename: 'document.pdf',
34
+ * folderId: '507f1f77bcf86cd799439012',
35
+ * organizationId: '507f1f77bcf86cd799439011',
36
+ * },
37
+ * );
20
38
  * ```
21
39
  */
22
- getPresignedURL(componentID: string, options?: RequestOptions): APIPromise<void>;
40
+ getPresignedURL(componentID: string, body: ComponentGetPresignedURLParams, options?: RequestOptions): APIPromise<ComponentGetPresignedURLResponse>;
23
41
  /**
42
+ * Upload a file to a component
43
+ *
24
44
  * @example
25
45
  * ```ts
26
- * await client.v1.upload.component.uploadFile('componentId');
46
+ * await client.v1.upload.component.uploadFile('componentId', {
47
+ * file: fs.createReadStream('path/to/file'),
48
+ * folderId: '507f1f77bcf86cd799439012',
49
+ * organizationId: '507f1f77bcf86cd799439011',
50
+ * });
27
51
  * ```
28
52
  */
29
- uploadFile(componentID: string, options?: RequestOptions): APIPromise<void>;
53
+ uploadFile(componentID: string, body: ComponentUploadFileParams, options?: RequestOptions): APIPromise<void>;
30
54
  /**
55
+ * Upload a file from URL to a component
56
+ *
31
57
  * @example
32
58
  * ```ts
33
- * await client.v1.upload.component.uploadURL('componentId');
59
+ * await client.v1.upload.component.uploadURL('componentId', {
60
+ * folderId: '507f1f77bcf86cd799439012',
61
+ * name: 'my-document.pdf',
62
+ * organizationId: '507f1f77bcf86cd799439011',
63
+ * url: 'https://example.com/document.pdf',
64
+ * });
34
65
  * ```
35
66
  */
36
- uploadURL(componentID: string, options?: RequestOptions): APIPromise<void>;
67
+ uploadURL(componentID: string, body: ComponentUploadURLParams, options?: RequestOptions): APIPromise<void>;
68
+ }
69
+ export interface ComponentGetPresignedURLResponse {
70
+ /**
71
+ * The S3 key for the file
72
+ */
73
+ key: string;
74
+ /**
75
+ * The presigned URL for uploading
76
+ */
77
+ uploadUrl: string;
78
+ }
79
+ export interface ComponentCompleteUploadParams {
80
+ /**
81
+ * The ID of the material that was uploaded
82
+ */
83
+ materialId: string;
84
+ /**
85
+ * The ID of the organization
86
+ */
87
+ organizationId: string;
88
+ /**
89
+ * The S3 key of the uploaded file
90
+ */
91
+ s3Key: string;
92
+ }
93
+ export interface ComponentGetPresignedURLParams {
94
+ /**
95
+ * The MIME type of the file
96
+ */
97
+ contentType: string;
98
+ /**
99
+ * The name of the file to upload
100
+ */
101
+ filename: string;
102
+ /**
103
+ * The ID of the folder to upload to
104
+ */
105
+ folderId: string;
106
+ /**
107
+ * The ID of the organization
108
+ */
109
+ organizationId: string;
110
+ }
111
+ export interface ComponentUploadFileParams {
112
+ /**
113
+ * The file to upload
114
+ */
115
+ file: Uploadable;
116
+ /**
117
+ * The ID of the folder to upload to
118
+ */
119
+ folderId: string;
120
+ /**
121
+ * The ID of the organization
122
+ */
123
+ organizationId: string;
124
+ }
125
+ export interface ComponentUploadURLParams {
126
+ /**
127
+ * The ID of the folder to upload to
128
+ */
129
+ folderId: string;
130
+ /**
131
+ * The name for the uploaded file
132
+ */
133
+ name: string;
134
+ /**
135
+ * The ID of the organization
136
+ */
137
+ organizationId: string;
138
+ /**
139
+ * The URL of the file to upload
140
+ */
141
+ url: string;
142
+ }
143
+ export declare namespace Component {
144
+ export { type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams as ComponentCompleteUploadParams, type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams, type ComponentUploadFileParams as ComponentUploadFileParams, type ComponentUploadURLParams as ComponentUploadURLParams, };
37
145
  }
38
146
  //# sourceMappingURL=component.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;OAOG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO/E;;;;;;;OAOG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOhF;;;;;OAKG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO3E;;;;;OAKG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAM3E"}
1
+ {"version":3,"file":"component.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAIzB,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CACZ,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,6BAA6B,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,IAAI,CAAC;IAQnB;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CACb,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G,EAAE,MAAM,CAAC;CACb;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -1,38 +1,146 @@
1
1
  import { APIResource } from "../../../core/resource.js";
2
2
  import { APIPromise } from "../../../core/api-promise.js";
3
+ import { type Uploadable } from "../../../core/uploads.js";
3
4
  import { RequestOptions } from "../../../internal/request-options.js";
4
5
  export declare class Component extends APIResource {
5
6
  /**
7
+ * Complete a file upload after using presigned URL
8
+ *
6
9
  * @example
7
10
  * ```ts
8
11
  * await client.v1.upload.component.completeUpload(
9
12
  * 'componentId',
13
+ * {
14
+ * materialId: '507f1f77bcf86cd799439013',
15
+ * organizationId: '507f1f77bcf86cd799439011',
16
+ * s3Key:
17
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
18
+ * },
10
19
  * );
11
20
  * ```
12
21
  */
13
- completeUpload(componentID: string, options?: RequestOptions): APIPromise<void>;
22
+ completeUpload(componentID: string, body: ComponentCompleteUploadParams, options?: RequestOptions): APIPromise<void>;
14
23
  /**
24
+ * Get a presigned URL for direct file upload
25
+ *
15
26
  * @example
16
27
  * ```ts
17
- * await client.v1.upload.component.getPresignedURL(
18
- * 'componentId',
19
- * );
28
+ * const response =
29
+ * await client.v1.upload.component.getPresignedURL(
30
+ * 'componentId',
31
+ * {
32
+ * contentType: 'application/pdf',
33
+ * filename: 'document.pdf',
34
+ * folderId: '507f1f77bcf86cd799439012',
35
+ * organizationId: '507f1f77bcf86cd799439011',
36
+ * },
37
+ * );
20
38
  * ```
21
39
  */
22
- getPresignedURL(componentID: string, options?: RequestOptions): APIPromise<void>;
40
+ getPresignedURL(componentID: string, body: ComponentGetPresignedURLParams, options?: RequestOptions): APIPromise<ComponentGetPresignedURLResponse>;
23
41
  /**
42
+ * Upload a file to a component
43
+ *
24
44
  * @example
25
45
  * ```ts
26
- * await client.v1.upload.component.uploadFile('componentId');
46
+ * await client.v1.upload.component.uploadFile('componentId', {
47
+ * file: fs.createReadStream('path/to/file'),
48
+ * folderId: '507f1f77bcf86cd799439012',
49
+ * organizationId: '507f1f77bcf86cd799439011',
50
+ * });
27
51
  * ```
28
52
  */
29
- uploadFile(componentID: string, options?: RequestOptions): APIPromise<void>;
53
+ uploadFile(componentID: string, body: ComponentUploadFileParams, options?: RequestOptions): APIPromise<void>;
30
54
  /**
55
+ * Upload a file from URL to a component
56
+ *
31
57
  * @example
32
58
  * ```ts
33
- * await client.v1.upload.component.uploadURL('componentId');
59
+ * await client.v1.upload.component.uploadURL('componentId', {
60
+ * folderId: '507f1f77bcf86cd799439012',
61
+ * name: 'my-document.pdf',
62
+ * organizationId: '507f1f77bcf86cd799439011',
63
+ * url: 'https://example.com/document.pdf',
64
+ * });
34
65
  * ```
35
66
  */
36
- uploadURL(componentID: string, options?: RequestOptions): APIPromise<void>;
67
+ uploadURL(componentID: string, body: ComponentUploadURLParams, options?: RequestOptions): APIPromise<void>;
68
+ }
69
+ export interface ComponentGetPresignedURLResponse {
70
+ /**
71
+ * The S3 key for the file
72
+ */
73
+ key: string;
74
+ /**
75
+ * The presigned URL for uploading
76
+ */
77
+ uploadUrl: string;
78
+ }
79
+ export interface ComponentCompleteUploadParams {
80
+ /**
81
+ * The ID of the material that was uploaded
82
+ */
83
+ materialId: string;
84
+ /**
85
+ * The ID of the organization
86
+ */
87
+ organizationId: string;
88
+ /**
89
+ * The S3 key of the uploaded file
90
+ */
91
+ s3Key: string;
92
+ }
93
+ export interface ComponentGetPresignedURLParams {
94
+ /**
95
+ * The MIME type of the file
96
+ */
97
+ contentType: string;
98
+ /**
99
+ * The name of the file to upload
100
+ */
101
+ filename: string;
102
+ /**
103
+ * The ID of the folder to upload to
104
+ */
105
+ folderId: string;
106
+ /**
107
+ * The ID of the organization
108
+ */
109
+ organizationId: string;
110
+ }
111
+ export interface ComponentUploadFileParams {
112
+ /**
113
+ * The file to upload
114
+ */
115
+ file: Uploadable;
116
+ /**
117
+ * The ID of the folder to upload to
118
+ */
119
+ folderId: string;
120
+ /**
121
+ * The ID of the organization
122
+ */
123
+ organizationId: string;
124
+ }
125
+ export interface ComponentUploadURLParams {
126
+ /**
127
+ * The ID of the folder to upload to
128
+ */
129
+ folderId: string;
130
+ /**
131
+ * The name for the uploaded file
132
+ */
133
+ name: string;
134
+ /**
135
+ * The ID of the organization
136
+ */
137
+ organizationId: string;
138
+ /**
139
+ * The URL of the file to upload
140
+ */
141
+ url: string;
142
+ }
143
+ export declare namespace Component {
144
+ export { type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams as ComponentCompleteUploadParams, type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams, type ComponentUploadFileParams as ComponentUploadFileParams, type ComponentUploadURLParams as ComponentUploadURLParams, };
37
145
  }
38
146
  //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;OAOG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO/E;;;;;;;OAOG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOhF;;;;;OAKG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO3E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8BAA8B;IAC7C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -4,56 +4,86 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Component = void 0;
5
5
  const resource_1 = require("../../../core/resource.js");
6
6
  const headers_1 = require("../../../internal/headers.js");
7
+ const uploads_1 = require("../../../internal/uploads.js");
7
8
  const path_1 = require("../../../internal/utils/path.js");
8
9
  class Component extends resource_1.APIResource {
9
10
  /**
11
+ * Complete a file upload after using presigned URL
12
+ *
10
13
  * @example
11
14
  * ```ts
12
15
  * await client.v1.upload.component.completeUpload(
13
16
  * 'componentId',
17
+ * {
18
+ * materialId: '507f1f77bcf86cd799439013',
19
+ * organizationId: '507f1f77bcf86cd799439011',
20
+ * s3Key:
21
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
22
+ * },
14
23
  * );
15
24
  * ```
16
25
  */
17
- completeUpload(componentID, options) {
26
+ completeUpload(componentID, body, options) {
18
27
  return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/complete`, {
28
+ body,
19
29
  ...options,
20
30
  headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
21
31
  });
22
32
  }
23
33
  /**
34
+ * Get a presigned URL for direct file upload
35
+ *
24
36
  * @example
25
37
  * ```ts
26
- * await client.v1.upload.component.getPresignedURL(
27
- * 'componentId',
28
- * );
38
+ * const response =
39
+ * await client.v1.upload.component.getPresignedURL(
40
+ * 'componentId',
41
+ * {
42
+ * contentType: 'application/pdf',
43
+ * filename: 'document.pdf',
44
+ * folderId: '507f1f77bcf86cd799439012',
45
+ * organizationId: '507f1f77bcf86cd799439011',
46
+ * },
47
+ * );
29
48
  * ```
30
49
  */
31
- getPresignedURL(componentID, options) {
50
+ getPresignedURL(componentID, body, options) {
32
51
  return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/presigned-url`, {
52
+ body,
33
53
  ...options,
34
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
35
54
  });
36
55
  }
37
56
  /**
57
+ * Upload a file to a component
58
+ *
38
59
  * @example
39
60
  * ```ts
40
- * await client.v1.upload.component.uploadFile('componentId');
61
+ * await client.v1.upload.component.uploadFile('componentId', {
62
+ * file: fs.createReadStream('path/to/file'),
63
+ * folderId: '507f1f77bcf86cd799439012',
64
+ * organizationId: '507f1f77bcf86cd799439011',
65
+ * });
41
66
  * ```
42
67
  */
43
- uploadFile(componentID, options) {
44
- return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/file`, {
45
- ...options,
46
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
47
- });
68
+ uploadFile(componentID, body, options) {
69
+ return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/file`, (0, uploads_1.multipartFormRequestOptions)({ body, ...options, headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]) }, this._client));
48
70
  }
49
71
  /**
72
+ * Upload a file from URL to a component
73
+ *
50
74
  * @example
51
75
  * ```ts
52
- * await client.v1.upload.component.uploadURL('componentId');
76
+ * await client.v1.upload.component.uploadURL('componentId', {
77
+ * folderId: '507f1f77bcf86cd799439012',
78
+ * name: 'my-document.pdf',
79
+ * organizationId: '507f1f77bcf86cd799439011',
80
+ * url: 'https://example.com/document.pdf',
81
+ * });
53
82
  * ```
54
83
  */
55
- uploadURL(componentID, options) {
84
+ uploadURL(componentID, body, options) {
56
85
  return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/url`, {
86
+ body,
57
87
  ...options,
58
88
  headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
59
89
  });
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAErD,0DAAyD;AAEzD,0DAAoD;AAEpD,MAAa,SAAU,SAAQ,sBAAW;IACxC;;;;;;;OAOG;IACH,cAAc,CAAC,WAAmB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,4BAA4B,WAAW,WAAW,EAAE;YAC/E,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,eAAe,CAAC,WAAmB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,4BAA4B,WAAW,gBAAgB,EAAE;YACpF,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CA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D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CACb,WAAmB,EACnB,IAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,4BAA4B,WAAW,gBAAgB,EAAE;YACpF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CACR,WAAmB,EACnB,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAA,WAAI,EAAA,4BAA4B,WAAW,OAAO,EAClD,IAAA,qCAA2B,EACzB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,EAClF,IAAI,CAAC,OAAO,CACb,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,WAAmB,EAAE,IAA8B,EAAE,OAAwB;QACrF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,4BAA4B,WAAW,MAAM,EAAE;YAC1E,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAvGD,8BAuGC"}
@@ -1,56 +1,86 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../../../core/resource.mjs";
3
3
  import { buildHeaders } from "../../../internal/headers.mjs";
4
+ import { multipartFormRequestOptions } from "../../../internal/uploads.mjs";
4
5
  import { path } from "../../../internal/utils/path.mjs";
5
6
  export class Component extends APIResource {
6
7
  /**
8
+ * Complete a file upload after using presigned URL
9
+ *
7
10
  * @example
8
11
  * ```ts
9
12
  * await client.v1.upload.component.completeUpload(
10
13
  * 'componentId',
14
+ * {
15
+ * materialId: '507f1f77bcf86cd799439013',
16
+ * organizationId: '507f1f77bcf86cd799439011',
17
+ * s3Key:
18
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
19
+ * },
11
20
  * );
12
21
  * ```
13
22
  */
14
- completeUpload(componentID, options) {
23
+ completeUpload(componentID, body, options) {
15
24
  return this._client.post(path `/api/v1/upload/component/${componentID}/complete`, {
25
+ body,
16
26
  ...options,
17
27
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
18
28
  });
19
29
  }
20
30
  /**
31
+ * Get a presigned URL for direct file upload
32
+ *
21
33
  * @example
22
34
  * ```ts
23
- * await client.v1.upload.component.getPresignedURL(
24
- * 'componentId',
25
- * );
35
+ * const response =
36
+ * await client.v1.upload.component.getPresignedURL(
37
+ * 'componentId',
38
+ * {
39
+ * contentType: 'application/pdf',
40
+ * filename: 'document.pdf',
41
+ * folderId: '507f1f77bcf86cd799439012',
42
+ * organizationId: '507f1f77bcf86cd799439011',
43
+ * },
44
+ * );
26
45
  * ```
27
46
  */
28
- getPresignedURL(componentID, options) {
47
+ getPresignedURL(componentID, body, options) {
29
48
  return this._client.post(path `/api/v1/upload/component/${componentID}/presigned-url`, {
49
+ body,
30
50
  ...options,
31
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
32
51
  });
33
52
  }
34
53
  /**
54
+ * Upload a file to a component
55
+ *
35
56
  * @example
36
57
  * ```ts
37
- * await client.v1.upload.component.uploadFile('componentId');
58
+ * await client.v1.upload.component.uploadFile('componentId', {
59
+ * file: fs.createReadStream('path/to/file'),
60
+ * folderId: '507f1f77bcf86cd799439012',
61
+ * organizationId: '507f1f77bcf86cd799439011',
62
+ * });
38
63
  * ```
39
64
  */
40
- uploadFile(componentID, options) {
41
- return this._client.post(path `/api/v1/upload/component/${componentID}/file`, {
42
- ...options,
43
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
44
- });
65
+ uploadFile(componentID, body, options) {
66
+ return this._client.post(path `/api/v1/upload/component/${componentID}/file`, multipartFormRequestOptions({ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) }, this._client));
45
67
  }
46
68
  /**
69
+ * Upload a file from URL to a component
70
+ *
47
71
  * @example
48
72
  * ```ts
49
- * await client.v1.upload.component.uploadURL('componentId');
73
+ * await client.v1.upload.component.uploadURL('componentId', {
74
+ * folderId: '507f1f77bcf86cd799439012',
75
+ * name: 'my-document.pdf',
76
+ * organizationId: '507f1f77bcf86cd799439011',
77
+ * url: 'https://example.com/document.pdf',
78
+ * });
50
79
  * ```
51
80
  */
52
- uploadURL(componentID, options) {
81
+ uploadURL(componentID, body, options) {
53
82
  return this._client.post(path `/api/v1/upload/component/${componentID}/url`, {
83
+ body,
54
84
  ...options,
55
85
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
56
86
  });
@@ -1 +1 @@
1
- {"version":3,"file":"component.mjs","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC;;;;;;;OAOG;IACH,cAAc,CAAC,WAAmB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,4BAA4B,WAAW,WAAW,EAAE;YAC/E,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;;;;;;;OAOG;IACH,eAAe,CAAC,WAAmB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAA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AAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CACb,WAAmB,EACnB,IAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,4BAA4B,WAAW,gBAAgB,EAAE;YACpF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CACR,WAAmB,EACnB,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAI,CAAA,4BAA4B,WAAW,OAAO,EAClD,2BAA2B,CACzB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,EAClF,IAAI,CAAC,OAAO,CACb,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,WAAmB,EAAE,IAA8B,EAAE,OAAwB;QACrF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,4BAA4B,WAAW,MAAM,EAAE;YAC1E,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,3 +1,3 @@
1
- export { Component } from "./component.mjs";
1
+ export { Component, type ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams, type ComponentGetPresignedURLParams, type ComponentUploadFileParams, type ComponentUploadURLParams, } from "./component.mjs";
2
2
  export { Upload } from "./upload.mjs";
3
3
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":"OAEO,EACL,SAAS,EACT,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B;OACM,EAAE,MAAM,EAAE"}
@@ -1,3 +1,3 @@
1
- export { Component } from "./component.js";
1
+ export { Component, type ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams, type ComponentGetPresignedURLParams, type ComponentUploadFileParams, type ComponentUploadURLParams, } from "./component.js";
2
2
  export { Upload } from "./upload.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":"OAEO,EACL,SAAS,EACT,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B;OACM,EAAE,MAAM,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,sCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAOqB;AANnB,sGAAA,SAAS,OAAA;AAOX,sCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
@@ -1,4 +1,4 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- export { Component } from "./component.mjs";
2
+ export { Component, } from "./component.mjs";
3
3
  export { Upload } from "./upload.mjs";
4
4
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,SAAS,EAAE;OACb,EAAE,MAAM,EAAE"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/v1/upload/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,SAAS,GAMV;OACM,EAAE,MAAM,EAAE"}
@@ -1,10 +1,10 @@
1
1
  import { APIResource } from "../../../core/resource.mjs";
2
2
  import * as ComponentAPI from "./component.mjs";
3
- import { Component } from "./component.mjs";
3
+ import { Component, ComponentCompleteUploadParams, ComponentGetPresignedURLParams, ComponentGetPresignedURLResponse, ComponentUploadFileParams, ComponentUploadURLParams } from "./component.mjs";
4
4
  export declare class Upload extends APIResource {
5
5
  component: ComponentAPI.Component;
6
6
  }
7
7
  export declare namespace Upload {
8
- export { Component as Component };
8
+ export { Component as Component, type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams as ComponentCompleteUploadParams, type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams, type ComponentUploadFileParams as ComponentUploadFileParams, type ComponentUploadURLParams as ComponentUploadURLParams, };
9
9
  }
10
10
  //# sourceMappingURL=upload.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,SAAS,EAAE;AAEpB,qBAAa,MAAO,SAAQ,WAAW;IACrC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;CAC9E;AAID,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,SAAS,IAAI,SAAS,EAAE,CAAC;CACnC"}
1
+ {"version":3,"file":"upload.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EACL,SAAS,EACT,6BAA6B,EAC7B,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACzB;AAED,qBAAa,MAAO,SAAQ,WAAW;IACrC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;CAC9E;AAID,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,SAAS,IAAI,SAAS,EACtB,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -1,10 +1,10 @@
1
1
  import { APIResource } from "../../../core/resource.js";
2
2
  import * as ComponentAPI from "./component.js";
3
- import { Component } from "./component.js";
3
+ import { Component, ComponentCompleteUploadParams, ComponentGetPresignedURLParams, ComponentGetPresignedURLResponse, ComponentUploadFileParams, ComponentUploadURLParams } from "./component.js";
4
4
  export declare class Upload extends APIResource {
5
5
  component: ComponentAPI.Component;
6
6
  }
7
7
  export declare namespace Upload {
8
- export { Component as Component };
8
+ export { Component as Component, type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams as ComponentCompleteUploadParams, type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams, type ComponentUploadFileParams as ComponentUploadFileParams, type ComponentUploadURLParams as ComponentUploadURLParams, };
9
9
  }
10
10
  //# sourceMappingURL=upload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,SAAS,EAAE;AAEpB,qBAAa,MAAO,SAAQ,WAAW;IACrC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;CAC9E;AAID,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,SAAS,IAAI,SAAS,EAAE,CAAC;CACnC"}
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EACL,SAAS,EACT,6BAA6B,EAC7B,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACzB;AAED,qBAAa,MAAO,SAAQ,WAAW;IACrC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;CAC9E;AAID,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,SAAS,IAAI,SAAS,EACtB,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,qEAA4C;AAC5C,8CAAwC;AAExC,MAAa,MAAO,SAAQ,sBAAW;IAAvC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/E,CAAC;CAAA;AAFD,wBAEC;AAED,MAAM,CAAC,SAAS,GAAG,qBAAS,CAAC"}
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,qEAA4C;AAC5C,8CAOqB;AAErB,MAAa,MAAO,SAAQ,sBAAW;IAAvC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/E,CAAC;CAAA;AAFD,wBAEC;AAED,MAAM,CAAC,SAAS,GAAG,qBAAS,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../../../core/resource.mjs";
3
3
  import * as ComponentAPI from "./component.mjs";
4
- import { Component } from "./component.mjs";
4
+ import { Component, } from "./component.mjs";
5
5
  export class Upload extends APIResource {
6
6
  constructor() {
7
7
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"upload.mjs","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,SAAS,EAAE;AAEpB,MAAM,OAAO,MAAO,SAAQ,WAAW;IAAvC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/E,CAAC;CAAA;AAED,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"upload.mjs","sourceRoot":"","sources":["../../../src/resources/v1/upload/upload.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EACL,SAAS,GAMV;AAED,MAAM,OAAO,MAAO,SAAQ,WAAW;IAAvC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/E,CAAC;CAAA;AAED,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC"}
@@ -2,64 +2,213 @@
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import { APIPromise } from '../../../core/api-promise';
5
+ import { type Uploadable } from '../../../core/uploads';
5
6
  import { buildHeaders } from '../../../internal/headers';
6
7
  import { RequestOptions } from '../../../internal/request-options';
8
+ import { multipartFormRequestOptions } from '../../../internal/uploads';
7
9
  import { path } from '../../../internal/utils/path';
8
10
 
9
11
  export class Component extends APIResource {
10
12
  /**
13
+ * Complete a file upload after using presigned URL
14
+ *
11
15
  * @example
12
16
  * ```ts
13
17
  * await client.v1.upload.component.completeUpload(
14
18
  * 'componentId',
19
+ * {
20
+ * materialId: '507f1f77bcf86cd799439013',
21
+ * organizationId: '507f1f77bcf86cd799439011',
22
+ * s3Key:
23
+ * 'organizations/507f1f77bcf86cd799439011/materials/document.pdf',
24
+ * },
15
25
  * );
16
26
  * ```
17
27
  */
18
- completeUpload(componentID: string, options?: RequestOptions): APIPromise<void> {
28
+ completeUpload(
29
+ componentID: string,
30
+ body: ComponentCompleteUploadParams,
31
+ options?: RequestOptions,
32
+ ): APIPromise<void> {
19
33
  return this._client.post(path`/api/v1/upload/component/${componentID}/complete`, {
34
+ body,
20
35
  ...options,
21
36
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
22
37
  });
23
38
  }
24
39
 
25
40
  /**
41
+ * Get a presigned URL for direct file upload
42
+ *
26
43
  * @example
27
44
  * ```ts
28
- * await client.v1.upload.component.getPresignedURL(
29
- * 'componentId',
30
- * );
45
+ * const response =
46
+ * await client.v1.upload.component.getPresignedURL(
47
+ * 'componentId',
48
+ * {
49
+ * contentType: 'application/pdf',
50
+ * filename: 'document.pdf',
51
+ * folderId: '507f1f77bcf86cd799439012',
52
+ * organizationId: '507f1f77bcf86cd799439011',
53
+ * },
54
+ * );
31
55
  * ```
32
56
  */
33
- getPresignedURL(componentID: string, options?: RequestOptions): APIPromise<void> {
57
+ getPresignedURL(
58
+ componentID: string,
59
+ body: ComponentGetPresignedURLParams,
60
+ options?: RequestOptions,
61
+ ): APIPromise<ComponentGetPresignedURLResponse> {
34
62
  return this._client.post(path`/api/v1/upload/component/${componentID}/presigned-url`, {
63
+ body,
35
64
  ...options,
36
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
37
65
  });
38
66
  }
39
67
 
40
68
  /**
69
+ * Upload a file to a component
70
+ *
41
71
  * @example
42
72
  * ```ts
43
- * await client.v1.upload.component.uploadFile('componentId');
73
+ * await client.v1.upload.component.uploadFile('componentId', {
74
+ * file: fs.createReadStream('path/to/file'),
75
+ * folderId: '507f1f77bcf86cd799439012',
76
+ * organizationId: '507f1f77bcf86cd799439011',
77
+ * });
44
78
  * ```
45
79
  */
46
- uploadFile(componentID: string, options?: RequestOptions): APIPromise<void> {
47
- return this._client.post(path`/api/v1/upload/component/${componentID}/file`, {
48
- ...options,
49
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
50
- });
80
+ uploadFile(
81
+ componentID: string,
82
+ body: ComponentUploadFileParams,
83
+ options?: RequestOptions,
84
+ ): APIPromise<void> {
85
+ return this._client.post(
86
+ path`/api/v1/upload/component/${componentID}/file`,
87
+ multipartFormRequestOptions(
88
+ { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
89
+ this._client,
90
+ ),
91
+ );
51
92
  }
52
93
 
53
94
  /**
95
+ * Upload a file from URL to a component
96
+ *
54
97
  * @example
55
98
  * ```ts
56
- * await client.v1.upload.component.uploadURL('componentId');
99
+ * await client.v1.upload.component.uploadURL('componentId', {
100
+ * folderId: '507f1f77bcf86cd799439012',
101
+ * name: 'my-document.pdf',
102
+ * organizationId: '507f1f77bcf86cd799439011',
103
+ * url: 'https://example.com/document.pdf',
104
+ * });
57
105
  * ```
58
106
  */
59
- uploadURL(componentID: string, options?: RequestOptions): APIPromise<void> {
107
+ uploadURL(componentID: string, body: ComponentUploadURLParams, options?: RequestOptions): APIPromise<void> {
60
108
  return this._client.post(path`/api/v1/upload/component/${componentID}/url`, {
109
+ body,
61
110
  ...options,
62
111
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
63
112
  });
64
113
  }
65
114
  }
115
+
116
+ export interface ComponentGetPresignedURLResponse {
117
+ /**
118
+ * The S3 key for the file
119
+ */
120
+ key: string;
121
+
122
+ /**
123
+ * The presigned URL for uploading
124
+ */
125
+ uploadUrl: string;
126
+ }
127
+
128
+ export interface ComponentCompleteUploadParams {
129
+ /**
130
+ * The ID of the material that was uploaded
131
+ */
132
+ materialId: string;
133
+
134
+ /**
135
+ * The ID of the organization
136
+ */
137
+ organizationId: string;
138
+
139
+ /**
140
+ * The S3 key of the uploaded file
141
+ */
142
+ s3Key: string;
143
+ }
144
+
145
+ export interface ComponentGetPresignedURLParams {
146
+ /**
147
+ * The MIME type of the file
148
+ */
149
+ contentType: string;
150
+
151
+ /**
152
+ * The name of the file to upload
153
+ */
154
+ filename: string;
155
+
156
+ /**
157
+ * The ID of the folder to upload to
158
+ */
159
+ folderId: string;
160
+
161
+ /**
162
+ * The ID of the organization
163
+ */
164
+ organizationId: string;
165
+ }
166
+
167
+ export interface ComponentUploadFileParams {
168
+ /**
169
+ * The file to upload
170
+ */
171
+ file: Uploadable;
172
+
173
+ /**
174
+ * The ID of the folder to upload to
175
+ */
176
+ folderId: string;
177
+
178
+ /**
179
+ * The ID of the organization
180
+ */
181
+ organizationId: string;
182
+ }
183
+
184
+ export interface ComponentUploadURLParams {
185
+ /**
186
+ * The ID of the folder to upload to
187
+ */
188
+ folderId: string;
189
+
190
+ /**
191
+ * The name for the uploaded file
192
+ */
193
+ name: string;
194
+
195
+ /**
196
+ * The ID of the organization
197
+ */
198
+ organizationId: string;
199
+
200
+ /**
201
+ * The URL of the file to upload
202
+ */
203
+ url: string;
204
+ }
205
+
206
+ export declare namespace Component {
207
+ export {
208
+ type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse,
209
+ type ComponentCompleteUploadParams as ComponentCompleteUploadParams,
210
+ type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams,
211
+ type ComponentUploadFileParams as ComponentUploadFileParams,
212
+ type ComponentUploadURLParams as ComponentUploadURLParams,
213
+ };
214
+ }
@@ -1,4 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Component } from './component';
3
+ export {
4
+ Component,
5
+ type ComponentGetPresignedURLResponse,
6
+ type ComponentCompleteUploadParams,
7
+ type ComponentGetPresignedURLParams,
8
+ type ComponentUploadFileParams,
9
+ type ComponentUploadURLParams,
10
+ } from './component';
4
11
  export { Upload } from './upload';
@@ -2,7 +2,14 @@
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import * as ComponentAPI from './component';
5
- import { Component } from './component';
5
+ import {
6
+ Component,
7
+ ComponentCompleteUploadParams,
8
+ ComponentGetPresignedURLParams,
9
+ ComponentGetPresignedURLResponse,
10
+ ComponentUploadFileParams,
11
+ ComponentUploadURLParams,
12
+ } from './component';
6
13
 
7
14
  export class Upload extends APIResource {
8
15
  component: ComponentAPI.Component = new ComponentAPI.Component(this._client);
@@ -11,5 +18,12 @@ export class Upload extends APIResource {
11
18
  Upload.Component = Component;
12
19
 
13
20
  export declare namespace Upload {
14
- export { Component as Component };
21
+ export {
22
+ Component as Component,
23
+ type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse,
24
+ type ComponentCompleteUploadParams as ComponentCompleteUploadParams,
25
+ type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams,
26
+ type ComponentUploadFileParams as ComponentUploadFileParams,
27
+ type ComponentUploadURLParams as ComponentUploadURLParams,
28
+ };
15
29
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.20.0'; // x-release-please-version
1
+ export const VERSION = '1.22.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.20.0";
1
+ export declare const VERSION = "1.22.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.20.0";
1
+ export declare const VERSION = "1.22.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.20.0'; // x-release-please-version
4
+ exports.VERSION = '1.22.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.20.0'; // x-release-please-version
1
+ export const VERSION = '1.22.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map