@studyfetch/sdk 1.20.0 → 1.21.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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.21.0 (2025-07-21)
4
+
5
+ Full Changelog: [v1.20.0...v1.21.0](https://github.com/GoStudyFetchGo/studyfetch-sdk/compare/v1.20.0...v1.21.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([980a2ab](https://github.com/GoStudyFetchGo/studyfetch-sdk/commit/980a2ab1d562abc0e78a244f8a1f96cdfd7ad205))
10
+
3
11
  ## 1.20.0 (2025-07-21)
4
12
 
5
13
  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.21.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,145 @@
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: 'materialId',
15
+ * organizationId: 'organizationId',
16
+ * s3Key: 's3Key',
17
+ * },
10
18
  * );
11
19
  * ```
12
20
  */
13
- completeUpload(componentID: string, options?: RequestOptions): APIPromise<void>;
21
+ completeUpload(componentID: string, body: ComponentCompleteUploadParams, options?: RequestOptions): APIPromise<void>;
14
22
  /**
23
+ * Get a presigned URL for direct file upload
24
+ *
15
25
  * @example
16
26
  * ```ts
17
- * await client.v1.upload.component.getPresignedURL(
18
- * 'componentId',
19
- * );
27
+ * const response =
28
+ * await client.v1.upload.component.getPresignedURL(
29
+ * 'componentId',
30
+ * {
31
+ * contentType: 'application/pdf',
32
+ * filename: 'document.pdf',
33
+ * folderId: 'folderId',
34
+ * organizationId: 'organizationId',
35
+ * },
36
+ * );
20
37
  * ```
21
38
  */
22
- getPresignedURL(componentID: string, options?: RequestOptions): APIPromise<void>;
39
+ getPresignedURL(componentID: string, body: ComponentGetPresignedURLParams, options?: RequestOptions): APIPromise<ComponentGetPresignedURLResponse>;
23
40
  /**
41
+ * Upload a file to a component
42
+ *
24
43
  * @example
25
44
  * ```ts
26
- * await client.v1.upload.component.uploadFile('componentId');
45
+ * await client.v1.upload.component.uploadFile('componentId', {
46
+ * file: fs.createReadStream('path/to/file'),
47
+ * folderId: 'folderId',
48
+ * organizationId: 'organizationId',
49
+ * });
27
50
  * ```
28
51
  */
29
- uploadFile(componentID: string, options?: RequestOptions): APIPromise<void>;
52
+ uploadFile(componentID: string, body: ComponentUploadFileParams, options?: RequestOptions): APIPromise<void>;
30
53
  /**
54
+ * Upload a file from URL to a component
55
+ *
31
56
  * @example
32
57
  * ```ts
33
- * await client.v1.upload.component.uploadURL('componentId');
58
+ * await client.v1.upload.component.uploadURL('componentId', {
59
+ * folderId: 'folderId',
60
+ * name: 'my-document.pdf',
61
+ * organizationId: 'organizationId',
62
+ * url: 'https://example.com/document.pdf',
63
+ * });
34
64
  * ```
35
65
  */
36
- uploadURL(componentID: string, options?: RequestOptions): APIPromise<void>;
66
+ uploadURL(componentID: string, body: ComponentUploadURLParams, options?: RequestOptions): APIPromise<void>;
67
+ }
68
+ export interface ComponentGetPresignedURLResponse {
69
+ /**
70
+ * The S3 key for the file
71
+ */
72
+ key?: string;
73
+ /**
74
+ * The presigned URL for uploading
75
+ */
76
+ uploadUrl?: string;
77
+ }
78
+ export interface ComponentCompleteUploadParams {
79
+ /**
80
+ * The ID of the material that was uploaded
81
+ */
82
+ materialId: string;
83
+ /**
84
+ * The ID of the organization
85
+ */
86
+ organizationId: string;
87
+ /**
88
+ * The S3 key of the uploaded file
89
+ */
90
+ s3Key: string;
91
+ }
92
+ export interface ComponentGetPresignedURLParams {
93
+ /**
94
+ * The MIME type of the file
95
+ */
96
+ contentType: string;
97
+ /**
98
+ * The name of the file to upload
99
+ */
100
+ filename: string;
101
+ /**
102
+ * The ID of the folder to upload to
103
+ */
104
+ folderId: string;
105
+ /**
106
+ * The ID of the organization
107
+ */
108
+ organizationId: string;
109
+ }
110
+ export interface ComponentUploadFileParams {
111
+ /**
112
+ * The file to upload
113
+ */
114
+ file: Uploadable;
115
+ /**
116
+ * The ID of the folder to upload to
117
+ */
118
+ folderId: string;
119
+ /**
120
+ * The ID of the organization
121
+ */
122
+ organizationId: string;
123
+ }
124
+ export interface ComponentUploadURLParams {
125
+ /**
126
+ * The ID of the folder to upload to
127
+ */
128
+ folderId: string;
129
+ /**
130
+ * The name for the uploaded file
131
+ */
132
+ name: string;
133
+ /**
134
+ * The ID of the organization
135
+ */
136
+ organizationId: string;
137
+ /**
138
+ * The URL of the file to upload
139
+ */
140
+ url: string;
141
+ }
142
+ export declare namespace Component {
143
+ export { type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams as ComponentCompleteUploadParams, type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams, type ComponentUploadFileParams as ComponentUploadFileParams, type ComponentUploadURLParams as ComponentUploadURLParams, };
37
144
  }
38
145
  //# 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;;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E,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAO3G;AAED,MAAM,WAAW,gCAAgC;IAC/C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,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"}
@@ -1,38 +1,145 @@
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: 'materialId',
15
+ * organizationId: 'organizationId',
16
+ * s3Key: 's3Key',
17
+ * },
10
18
  * );
11
19
  * ```
12
20
  */
13
- completeUpload(componentID: string, options?: RequestOptions): APIPromise<void>;
21
+ completeUpload(componentID: string, body: ComponentCompleteUploadParams, options?: RequestOptions): APIPromise<void>;
14
22
  /**
23
+ * Get a presigned URL for direct file upload
24
+ *
15
25
  * @example
16
26
  * ```ts
17
- * await client.v1.upload.component.getPresignedURL(
18
- * 'componentId',
19
- * );
27
+ * const response =
28
+ * await client.v1.upload.component.getPresignedURL(
29
+ * 'componentId',
30
+ * {
31
+ * contentType: 'application/pdf',
32
+ * filename: 'document.pdf',
33
+ * folderId: 'folderId',
34
+ * organizationId: 'organizationId',
35
+ * },
36
+ * );
20
37
  * ```
21
38
  */
22
- getPresignedURL(componentID: string, options?: RequestOptions): APIPromise<void>;
39
+ getPresignedURL(componentID: string, body: ComponentGetPresignedURLParams, options?: RequestOptions): APIPromise<ComponentGetPresignedURLResponse>;
23
40
  /**
41
+ * Upload a file to a component
42
+ *
24
43
  * @example
25
44
  * ```ts
26
- * await client.v1.upload.component.uploadFile('componentId');
45
+ * await client.v1.upload.component.uploadFile('componentId', {
46
+ * file: fs.createReadStream('path/to/file'),
47
+ * folderId: 'folderId',
48
+ * organizationId: 'organizationId',
49
+ * });
27
50
  * ```
28
51
  */
29
- uploadFile(componentID: string, options?: RequestOptions): APIPromise<void>;
52
+ uploadFile(componentID: string, body: ComponentUploadFileParams, options?: RequestOptions): APIPromise<void>;
30
53
  /**
54
+ * Upload a file from URL to a component
55
+ *
31
56
  * @example
32
57
  * ```ts
33
- * await client.v1.upload.component.uploadURL('componentId');
58
+ * await client.v1.upload.component.uploadURL('componentId', {
59
+ * folderId: 'folderId',
60
+ * name: 'my-document.pdf',
61
+ * organizationId: 'organizationId',
62
+ * url: 'https://example.com/document.pdf',
63
+ * });
34
64
  * ```
35
65
  */
36
- uploadURL(componentID: string, options?: RequestOptions): APIPromise<void>;
66
+ uploadURL(componentID: string, body: ComponentUploadURLParams, options?: RequestOptions): APIPromise<void>;
67
+ }
68
+ export interface ComponentGetPresignedURLResponse {
69
+ /**
70
+ * The S3 key for the file
71
+ */
72
+ key?: string;
73
+ /**
74
+ * The presigned URL for uploading
75
+ */
76
+ uploadUrl?: string;
77
+ }
78
+ export interface ComponentCompleteUploadParams {
79
+ /**
80
+ * The ID of the material that was uploaded
81
+ */
82
+ materialId: string;
83
+ /**
84
+ * The ID of the organization
85
+ */
86
+ organizationId: string;
87
+ /**
88
+ * The S3 key of the uploaded file
89
+ */
90
+ s3Key: string;
91
+ }
92
+ export interface ComponentGetPresignedURLParams {
93
+ /**
94
+ * The MIME type of the file
95
+ */
96
+ contentType: string;
97
+ /**
98
+ * The name of the file to upload
99
+ */
100
+ filename: string;
101
+ /**
102
+ * The ID of the folder to upload to
103
+ */
104
+ folderId: string;
105
+ /**
106
+ * The ID of the organization
107
+ */
108
+ organizationId: string;
109
+ }
110
+ export interface ComponentUploadFileParams {
111
+ /**
112
+ * The file to upload
113
+ */
114
+ file: Uploadable;
115
+ /**
116
+ * The ID of the folder to upload to
117
+ */
118
+ folderId: string;
119
+ /**
120
+ * The ID of the organization
121
+ */
122
+ organizationId: string;
123
+ }
124
+ export interface ComponentUploadURLParams {
125
+ /**
126
+ * The ID of the folder to upload to
127
+ */
128
+ folderId: string;
129
+ /**
130
+ * The name for the uploaded file
131
+ */
132
+ name: string;
133
+ /**
134
+ * The ID of the organization
135
+ */
136
+ organizationId: string;
137
+ /**
138
+ * The URL of the file to upload
139
+ */
140
+ url: string;
141
+ }
142
+ export declare namespace Component {
143
+ export { type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse, type ComponentCompleteUploadParams as ComponentCompleteUploadParams, type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams, type ComponentUploadFileParams as ComponentUploadFileParams, type ComponentUploadURLParams as ComponentUploadURLParams, };
37
144
  }
38
145
  //# 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;;;;;OAKG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAM3E"}
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;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAIzB,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;;OAcG;IACH,cAAc,CACZ,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,6BAA6B,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,IAAI,CAAC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;;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,85 @@ 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: 'materialId',
19
+ * organizationId: 'organizationId',
20
+ * s3Key: 's3Key',
21
+ * },
14
22
  * );
15
23
  * ```
16
24
  */
17
- completeUpload(componentID, options) {
25
+ completeUpload(componentID, body, options) {
18
26
  return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/complete`, {
27
+ body,
19
28
  ...options,
20
29
  headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
21
30
  });
22
31
  }
23
32
  /**
33
+ * Get a presigned URL for direct file upload
34
+ *
24
35
  * @example
25
36
  * ```ts
26
- * await client.v1.upload.component.getPresignedURL(
27
- * 'componentId',
28
- * );
37
+ * const response =
38
+ * await client.v1.upload.component.getPresignedURL(
39
+ * 'componentId',
40
+ * {
41
+ * contentType: 'application/pdf',
42
+ * filename: 'document.pdf',
43
+ * folderId: 'folderId',
44
+ * organizationId: 'organizationId',
45
+ * },
46
+ * );
29
47
  * ```
30
48
  */
31
- getPresignedURL(componentID, options) {
49
+ getPresignedURL(componentID, body, options) {
32
50
  return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/presigned-url`, {
51
+ body,
33
52
  ...options,
34
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
35
53
  });
36
54
  }
37
55
  /**
56
+ * Upload a file to a component
57
+ *
38
58
  * @example
39
59
  * ```ts
40
- * await client.v1.upload.component.uploadFile('componentId');
60
+ * await client.v1.upload.component.uploadFile('componentId', {
61
+ * file: fs.createReadStream('path/to/file'),
62
+ * folderId: 'folderId',
63
+ * organizationId: 'organizationId',
64
+ * });
41
65
  * ```
42
66
  */
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
- });
67
+ uploadFile(componentID, body, options) {
68
+ 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
69
  }
49
70
  /**
71
+ * Upload a file from URL to a component
72
+ *
50
73
  * @example
51
74
  * ```ts
52
- * await client.v1.upload.component.uploadURL('componentId');
75
+ * await client.v1.upload.component.uploadURL('componentId', {
76
+ * folderId: 'folderId',
77
+ * name: 'my-document.pdf',
78
+ * organizationId: 'organizationId',
79
+ * url: 'https://example.com/document.pdf',
80
+ * });
53
81
  * ```
54
82
  */
55
- uploadURL(componentID, options) {
83
+ uploadURL(componentID, body, options) {
56
84
  return this._client.post((0, path_1.path) `/api/v1/upload/component/${componentID}/url`, {
85
+ body,
57
86
  ...options,
58
87
  headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
59
88
  });
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/resources/v1/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Y,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAxDD,8BAwDC"}
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAGrD,0DAAyD;AAEzD,0DAAwE;AACxE,0DAAoD;AAEpD,MAAa,SAAU,SAAQ,sBAAW;IACxC;;;;;;;;;;;;;;OAcG;IACH,cAAc,CACZ,WAAmB,EACnB,IAAmC,EACnC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,4BAA4B,WAAW,WAAW,EAAE;YAC/E,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;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;AAtGD,8BAsGC"}
@@ -1,56 +1,85 @@
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: 'materialId',
16
+ * organizationId: 'organizationId',
17
+ * s3Key: 's3Key',
18
+ * },
11
19
  * );
12
20
  * ```
13
21
  */
14
- completeUpload(componentID, options) {
22
+ completeUpload(componentID, body, options) {
15
23
  return this._client.post(path `/api/v1/upload/component/${componentID}/complete`, {
24
+ body,
16
25
  ...options,
17
26
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
18
27
  });
19
28
  }
20
29
  /**
30
+ * Get a presigned URL for direct file upload
31
+ *
21
32
  * @example
22
33
  * ```ts
23
- * await client.v1.upload.component.getPresignedURL(
24
- * 'componentId',
25
- * );
34
+ * const response =
35
+ * await client.v1.upload.component.getPresignedURL(
36
+ * 'componentId',
37
+ * {
38
+ * contentType: 'application/pdf',
39
+ * filename: 'document.pdf',
40
+ * folderId: 'folderId',
41
+ * organizationId: 'organizationId',
42
+ * },
43
+ * );
26
44
  * ```
27
45
  */
28
- getPresignedURL(componentID, options) {
46
+ getPresignedURL(componentID, body, options) {
29
47
  return this._client.post(path `/api/v1/upload/component/${componentID}/presigned-url`, {
48
+ body,
30
49
  ...options,
31
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
32
50
  });
33
51
  }
34
52
  /**
53
+ * Upload a file to a component
54
+ *
35
55
  * @example
36
56
  * ```ts
37
- * await client.v1.upload.component.uploadFile('componentId');
57
+ * await client.v1.upload.component.uploadFile('componentId', {
58
+ * file: fs.createReadStream('path/to/file'),
59
+ * folderId: 'folderId',
60
+ * organizationId: 'organizationId',
61
+ * });
38
62
  * ```
39
63
  */
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
- });
64
+ uploadFile(componentID, body, options) {
65
+ return this._client.post(path `/api/v1/upload/component/${componentID}/file`, multipartFormRequestOptions({ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) }, this._client));
45
66
  }
46
67
  /**
68
+ * Upload a file from URL to a component
69
+ *
47
70
  * @example
48
71
  * ```ts
49
- * await client.v1.upload.component.uploadURL('componentId');
72
+ * await client.v1.upload.component.uploadURL('componentId', {
73
+ * folderId: 'folderId',
74
+ * name: 'my-document.pdf',
75
+ * organizationId: 'organizationId',
76
+ * url: 'https://example.com/document.pdf',
77
+ * });
50
78
  * ```
51
79
  */
52
- uploadURL(componentID, options) {
80
+ uploadURL(componentID, body, options) {
53
81
  return this._client.post(path `/api/v1/upload/component/${componentID}/url`, {
82
+ body,
54
83
  ...options,
55
84
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
56
85
  });
@@ -1 +1 @@
1
- {"version":3,"file":"component.mjs","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings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EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"component.mjs","sourceRoot":"","sources":["../../../src/resources/v1/upload/component.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;OAC/B,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;;OAcG;IACH,cAAc,CACZ,WAAmB,EACnB,IAAmC,EACnC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,4BAA4B,WAAW,WAAW,EAAE;YAC/E,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;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,212 @@
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: 'materialId',
21
+ * organizationId: 'organizationId',
22
+ * s3Key: 's3Key',
23
+ * },
15
24
  * );
16
25
  * ```
17
26
  */
18
- completeUpload(componentID: string, options?: RequestOptions): APIPromise<void> {
27
+ completeUpload(
28
+ componentID: string,
29
+ body: ComponentCompleteUploadParams,
30
+ options?: RequestOptions,
31
+ ): APIPromise<void> {
19
32
  return this._client.post(path`/api/v1/upload/component/${componentID}/complete`, {
33
+ body,
20
34
  ...options,
21
35
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
22
36
  });
23
37
  }
24
38
 
25
39
  /**
40
+ * Get a presigned URL for direct file upload
41
+ *
26
42
  * @example
27
43
  * ```ts
28
- * await client.v1.upload.component.getPresignedURL(
29
- * 'componentId',
30
- * );
44
+ * const response =
45
+ * await client.v1.upload.component.getPresignedURL(
46
+ * 'componentId',
47
+ * {
48
+ * contentType: 'application/pdf',
49
+ * filename: 'document.pdf',
50
+ * folderId: 'folderId',
51
+ * organizationId: 'organizationId',
52
+ * },
53
+ * );
31
54
  * ```
32
55
  */
33
- getPresignedURL(componentID: string, options?: RequestOptions): APIPromise<void> {
56
+ getPresignedURL(
57
+ componentID: string,
58
+ body: ComponentGetPresignedURLParams,
59
+ options?: RequestOptions,
60
+ ): APIPromise<ComponentGetPresignedURLResponse> {
34
61
  return this._client.post(path`/api/v1/upload/component/${componentID}/presigned-url`, {
62
+ body,
35
63
  ...options,
36
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
37
64
  });
38
65
  }
39
66
 
40
67
  /**
68
+ * Upload a file to a component
69
+ *
41
70
  * @example
42
71
  * ```ts
43
- * await client.v1.upload.component.uploadFile('componentId');
72
+ * await client.v1.upload.component.uploadFile('componentId', {
73
+ * file: fs.createReadStream('path/to/file'),
74
+ * folderId: 'folderId',
75
+ * organizationId: 'organizationId',
76
+ * });
44
77
  * ```
45
78
  */
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
- });
79
+ uploadFile(
80
+ componentID: string,
81
+ body: ComponentUploadFileParams,
82
+ options?: RequestOptions,
83
+ ): APIPromise<void> {
84
+ return this._client.post(
85
+ path`/api/v1/upload/component/${componentID}/file`,
86
+ multipartFormRequestOptions(
87
+ { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
88
+ this._client,
89
+ ),
90
+ );
51
91
  }
52
92
 
53
93
  /**
94
+ * Upload a file from URL to a component
95
+ *
54
96
  * @example
55
97
  * ```ts
56
- * await client.v1.upload.component.uploadURL('componentId');
98
+ * await client.v1.upload.component.uploadURL('componentId', {
99
+ * folderId: 'folderId',
100
+ * name: 'my-document.pdf',
101
+ * organizationId: 'organizationId',
102
+ * url: 'https://example.com/document.pdf',
103
+ * });
57
104
  * ```
58
105
  */
59
- uploadURL(componentID: string, options?: RequestOptions): APIPromise<void> {
106
+ uploadURL(componentID: string, body: ComponentUploadURLParams, options?: RequestOptions): APIPromise<void> {
60
107
  return this._client.post(path`/api/v1/upload/component/${componentID}/url`, {
108
+ body,
61
109
  ...options,
62
110
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
63
111
  });
64
112
  }
65
113
  }
114
+
115
+ export interface ComponentGetPresignedURLResponse {
116
+ /**
117
+ * The S3 key for the file
118
+ */
119
+ key?: string;
120
+
121
+ /**
122
+ * The presigned URL for uploading
123
+ */
124
+ uploadUrl?: string;
125
+ }
126
+
127
+ export interface ComponentCompleteUploadParams {
128
+ /**
129
+ * The ID of the material that was uploaded
130
+ */
131
+ materialId: string;
132
+
133
+ /**
134
+ * The ID of the organization
135
+ */
136
+ organizationId: string;
137
+
138
+ /**
139
+ * The S3 key of the uploaded file
140
+ */
141
+ s3Key: string;
142
+ }
143
+
144
+ export interface ComponentGetPresignedURLParams {
145
+ /**
146
+ * The MIME type of the file
147
+ */
148
+ contentType: string;
149
+
150
+ /**
151
+ * The name of the file to upload
152
+ */
153
+ filename: string;
154
+
155
+ /**
156
+ * The ID of the folder to upload to
157
+ */
158
+ folderId: string;
159
+
160
+ /**
161
+ * The ID of the organization
162
+ */
163
+ organizationId: string;
164
+ }
165
+
166
+ export interface ComponentUploadFileParams {
167
+ /**
168
+ * The file to upload
169
+ */
170
+ file: Uploadable;
171
+
172
+ /**
173
+ * The ID of the folder to upload to
174
+ */
175
+ folderId: string;
176
+
177
+ /**
178
+ * The ID of the organization
179
+ */
180
+ organizationId: string;
181
+ }
182
+
183
+ export interface ComponentUploadURLParams {
184
+ /**
185
+ * The ID of the folder to upload to
186
+ */
187
+ folderId: string;
188
+
189
+ /**
190
+ * The name for the uploaded file
191
+ */
192
+ name: string;
193
+
194
+ /**
195
+ * The ID of the organization
196
+ */
197
+ organizationId: string;
198
+
199
+ /**
200
+ * The URL of the file to upload
201
+ */
202
+ url: string;
203
+ }
204
+
205
+ export declare namespace Component {
206
+ export {
207
+ type ComponentGetPresignedURLResponse as ComponentGetPresignedURLResponse,
208
+ type ComponentCompleteUploadParams as ComponentCompleteUploadParams,
209
+ type ComponentGetPresignedURLParams as ComponentGetPresignedURLParams,
210
+ type ComponentUploadFileParams as ComponentUploadFileParams,
211
+ type ComponentUploadURLParams as ComponentUploadURLParams,
212
+ };
213
+ }
@@ -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.21.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.21.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.21.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.21.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.21.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map