@spaciv/sdk 0.1.12 → 0.1.13

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## @spaciv/sdk@0.1.12
1
+ ## @spaciv/sdk@0.1.13
2
2
 
3
3
  This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
4
4
 
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
36
36
  _published:_
37
37
 
38
38
  ```
39
- npm install @spaciv/sdk@0.1.12 --save
39
+ npm install @spaciv/sdk@0.1.13 --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_
@@ -29,6 +29,12 @@ export interface FilesApiUpdateAccountFilesRequest {
29
29
  id: string;
30
30
  accountFilePatchBody: AccountFilePatchBody;
31
31
  }
32
+ export interface FilesApiUpdateAccountFilesContentRequest {
33
+ id: string;
34
+ ifMatch: string;
35
+ filename?: Blob;
36
+ name?: string;
37
+ }
32
38
  /**
33
39
  * FilesApi - interface
34
40
  *
@@ -66,7 +72,7 @@ export interface FilesApiInterface {
66
72
  */
67
73
  deleteAccountFiles(requestParameters: FilesApiDeleteAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object>;
68
74
  /**
69
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
75
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
70
76
  * @summary Download an account file
71
77
  * @param {string} id
72
78
  * @param {*} [options] Override http request option.
@@ -75,7 +81,7 @@ export interface FilesApiInterface {
75
81
  */
76
82
  getAccountFilesContentRaw(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
77
83
  /**
78
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
84
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
79
85
  * Download an account file
80
86
  */
81
87
  getAccountFilesContent(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
@@ -109,6 +115,23 @@ export interface FilesApiInterface {
109
115
  * Rename an account file
110
116
  */
111
117
  updateAccountFiles(requestParameters: FilesApiUpdateAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
118
+ /**
119
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
120
+ * @summary Replace an account file\'s content
121
+ * @param {string} id
122
+ * @param {string} ifMatch The ETag returned when the file\&#39;s content was read. The content is replaced only if it has not changed since.
123
+ * @param {Blob} [filename] filename of the file being uploaded
124
+ * @param {string} [name] general purpose name for multipart form value
125
+ * @param {*} [options] Override http request option.
126
+ * @throws {RequiredError}
127
+ * @memberof FilesApiInterface
128
+ */
129
+ updateAccountFilesContentRaw(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelRecord>>;
130
+ /**
131
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
132
+ * Replace an account file\'s content
133
+ */
134
+ updateAccountFilesContent(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
112
135
  }
113
136
  /**
114
137
  *
@@ -135,12 +158,12 @@ export declare class FilesApi extends runtime.BaseAPI implements FilesApiInterfa
135
158
  */
136
159
  deleteAccountFiles(requestParameters: FilesApiDeleteAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object>;
137
160
  /**
138
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
161
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
139
162
  * Download an account file
140
163
  */
141
164
  getAccountFilesContentRaw(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
142
165
  /**
143
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
166
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
144
167
  * Download an account file
145
168
  */
146
169
  getAccountFilesContent(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
@@ -164,4 +187,14 @@ export declare class FilesApi extends runtime.BaseAPI implements FilesApiInterfa
164
187
  * Rename an account file
165
188
  */
166
189
  updateAccountFiles(requestParameters: FilesApiUpdateAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
190
+ /**
191
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
192
+ * Replace an account file\'s content
193
+ */
194
+ updateAccountFilesContentRaw(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelRecord>>;
195
+ /**
196
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
197
+ * Replace an account file\'s content
198
+ */
199
+ updateAccountFilesContent(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
167
200
  }
@@ -126,7 +126,7 @@ class FilesApi extends runtime.BaseAPI {
126
126
  });
127
127
  }
128
128
  /**
129
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
129
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
130
130
  * Download an account file
131
131
  */
132
132
  getAccountFilesContentRaw(requestParameters, initOverrides) {
@@ -160,7 +160,7 @@ class FilesApi extends runtime.BaseAPI {
160
160
  });
161
161
  }
162
162
  /**
163
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
163
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
164
164
  * Download an account file
165
165
  */
166
166
  getAccountFilesContent(requestParameters, initOverrides) {
@@ -254,5 +254,72 @@ class FilesApi extends runtime.BaseAPI {
254
254
  return yield response.value();
255
255
  });
256
256
  }
257
+ /**
258
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
259
+ * Replace an account file\'s content
260
+ */
261
+ updateAccountFilesContentRaw(requestParameters, initOverrides) {
262
+ return __awaiter(this, void 0, void 0, function* () {
263
+ if (requestParameters['id'] == null) {
264
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateAccountFilesContent().');
265
+ }
266
+ if (requestParameters['ifMatch'] == null) {
267
+ throw new runtime.RequiredError('ifMatch', 'Required parameter "ifMatch" was null or undefined when calling updateAccountFilesContent().');
268
+ }
269
+ const queryParameters = {};
270
+ const headerParameters = {};
271
+ if (requestParameters['ifMatch'] != null) {
272
+ headerParameters['If-Match'] = String(requestParameters['ifMatch']);
273
+ }
274
+ if (this.configuration && this.configuration.accessToken) {
275
+ const token = this.configuration.accessToken;
276
+ const tokenString = yield token("accessToken", []);
277
+ if (tokenString) {
278
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
279
+ }
280
+ }
281
+ const consumes = [
282
+ { contentType: 'multipart/form-data' },
283
+ ];
284
+ // @ts-ignore: canConsumeForm may be unused
285
+ const canConsumeForm = runtime.canConsumeForm(consumes);
286
+ let formParams;
287
+ let useForm = false;
288
+ // use FormData to transmit files using content-type "multipart/form-data"
289
+ useForm = canConsumeForm;
290
+ if (useForm) {
291
+ formParams = new FormData();
292
+ }
293
+ else {
294
+ formParams = new URLSearchParams();
295
+ }
296
+ if (requestParameters['filename'] != null) {
297
+ formParams.append('filename', requestParameters['filename']);
298
+ }
299
+ if (requestParameters['name'] != null) {
300
+ formParams.append('name', requestParameters['name']);
301
+ }
302
+ let urlPath = `/v1/account/files/{id}/content`;
303
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
304
+ const response = yield this.request({
305
+ path: urlPath,
306
+ method: 'PUT',
307
+ headers: headerParameters,
308
+ query: queryParameters,
309
+ body: formParams,
310
+ }, initOverrides);
311
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ModelRecordFromJSON)(jsonValue));
312
+ });
313
+ }
314
+ /**
315
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
316
+ * Replace an account file\'s content
317
+ */
318
+ updateAccountFilesContent(requestParameters, initOverrides) {
319
+ return __awaiter(this, void 0, void 0, function* () {
320
+ const response = yield this.updateAccountFilesContentRaw(requestParameters, initOverrides);
321
+ return yield response.value();
322
+ });
323
+ }
257
324
  }
258
325
  exports.FilesApi = FilesApi;
@@ -29,6 +29,12 @@ export interface FilesApiUpdateAccountFilesRequest {
29
29
  id: string;
30
30
  accountFilePatchBody: AccountFilePatchBody;
31
31
  }
32
+ export interface FilesApiUpdateAccountFilesContentRequest {
33
+ id: string;
34
+ ifMatch: string;
35
+ filename?: Blob;
36
+ name?: string;
37
+ }
32
38
  /**
33
39
  * FilesApi - interface
34
40
  *
@@ -66,7 +72,7 @@ export interface FilesApiInterface {
66
72
  */
67
73
  deleteAccountFiles(requestParameters: FilesApiDeleteAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object>;
68
74
  /**
69
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
75
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
70
76
  * @summary Download an account file
71
77
  * @param {string} id
72
78
  * @param {*} [options] Override http request option.
@@ -75,7 +81,7 @@ export interface FilesApiInterface {
75
81
  */
76
82
  getAccountFilesContentRaw(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
77
83
  /**
78
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
84
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
79
85
  * Download an account file
80
86
  */
81
87
  getAccountFilesContent(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
@@ -109,6 +115,23 @@ export interface FilesApiInterface {
109
115
  * Rename an account file
110
116
  */
111
117
  updateAccountFiles(requestParameters: FilesApiUpdateAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
118
+ /**
119
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
120
+ * @summary Replace an account file\'s content
121
+ * @param {string} id
122
+ * @param {string} ifMatch The ETag returned when the file\&#39;s content was read. The content is replaced only if it has not changed since.
123
+ * @param {Blob} [filename] filename of the file being uploaded
124
+ * @param {string} [name] general purpose name for multipart form value
125
+ * @param {*} [options] Override http request option.
126
+ * @throws {RequiredError}
127
+ * @memberof FilesApiInterface
128
+ */
129
+ updateAccountFilesContentRaw(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelRecord>>;
130
+ /**
131
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
132
+ * Replace an account file\'s content
133
+ */
134
+ updateAccountFilesContent(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
112
135
  }
113
136
  /**
114
137
  *
@@ -135,12 +158,12 @@ export declare class FilesApi extends runtime.BaseAPI implements FilesApiInterfa
135
158
  */
136
159
  deleteAccountFiles(requestParameters: FilesApiDeleteAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object>;
137
160
  /**
138
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
161
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
139
162
  * Download an account file
140
163
  */
141
164
  getAccountFilesContentRaw(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
142
165
  /**
143
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
166
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
144
167
  * Download an account file
145
168
  */
146
169
  getAccountFilesContent(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
@@ -164,4 +187,14 @@ export declare class FilesApi extends runtime.BaseAPI implements FilesApiInterfa
164
187
  * Rename an account file
165
188
  */
166
189
  updateAccountFiles(requestParameters: FilesApiUpdateAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
190
+ /**
191
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
192
+ * Replace an account file\'s content
193
+ */
194
+ updateAccountFilesContentRaw(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelRecord>>;
195
+ /**
196
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
197
+ * Replace an account file\'s content
198
+ */
199
+ updateAccountFilesContent(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
167
200
  }
@@ -123,7 +123,7 @@ export class FilesApi extends runtime.BaseAPI {
123
123
  });
124
124
  }
125
125
  /**
126
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
126
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
127
127
  * Download an account file
128
128
  */
129
129
  getAccountFilesContentRaw(requestParameters, initOverrides) {
@@ -157,7 +157,7 @@ export class FilesApi extends runtime.BaseAPI {
157
157
  });
158
158
  }
159
159
  /**
160
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
160
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
161
161
  * Download an account file
162
162
  */
163
163
  getAccountFilesContent(requestParameters, initOverrides) {
@@ -251,4 +251,71 @@ export class FilesApi extends runtime.BaseAPI {
251
251
  return yield response.value();
252
252
  });
253
253
  }
254
+ /**
255
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
256
+ * Replace an account file\'s content
257
+ */
258
+ updateAccountFilesContentRaw(requestParameters, initOverrides) {
259
+ return __awaiter(this, void 0, void 0, function* () {
260
+ if (requestParameters['id'] == null) {
261
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateAccountFilesContent().');
262
+ }
263
+ if (requestParameters['ifMatch'] == null) {
264
+ throw new runtime.RequiredError('ifMatch', 'Required parameter "ifMatch" was null or undefined when calling updateAccountFilesContent().');
265
+ }
266
+ const queryParameters = {};
267
+ const headerParameters = {};
268
+ if (requestParameters['ifMatch'] != null) {
269
+ headerParameters['If-Match'] = String(requestParameters['ifMatch']);
270
+ }
271
+ if (this.configuration && this.configuration.accessToken) {
272
+ const token = this.configuration.accessToken;
273
+ const tokenString = yield token("accessToken", []);
274
+ if (tokenString) {
275
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
276
+ }
277
+ }
278
+ const consumes = [
279
+ { contentType: 'multipart/form-data' },
280
+ ];
281
+ // @ts-ignore: canConsumeForm may be unused
282
+ const canConsumeForm = runtime.canConsumeForm(consumes);
283
+ let formParams;
284
+ let useForm = false;
285
+ // use FormData to transmit files using content-type "multipart/form-data"
286
+ useForm = canConsumeForm;
287
+ if (useForm) {
288
+ formParams = new FormData();
289
+ }
290
+ else {
291
+ formParams = new URLSearchParams();
292
+ }
293
+ if (requestParameters['filename'] != null) {
294
+ formParams.append('filename', requestParameters['filename']);
295
+ }
296
+ if (requestParameters['name'] != null) {
297
+ formParams.append('name', requestParameters['name']);
298
+ }
299
+ let urlPath = `/v1/account/files/{id}/content`;
300
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
301
+ const response = yield this.request({
302
+ path: urlPath,
303
+ method: 'PUT',
304
+ headers: headerParameters,
305
+ query: queryParameters,
306
+ body: formParams,
307
+ }, initOverrides);
308
+ return new runtime.JSONApiResponse(response, (jsonValue) => ModelRecordFromJSON(jsonValue));
309
+ });
310
+ }
311
+ /**
312
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
313
+ * Replace an account file\'s content
314
+ */
315
+ updateAccountFilesContent(requestParameters, initOverrides) {
316
+ return __awaiter(this, void 0, void 0, function* () {
317
+ const response = yield this.updateAccountFilesContentRaw(requestParameters, initOverrides);
318
+ return yield response.value();
319
+ });
320
+ }
254
321
  }
@@ -28,7 +28,7 @@ export interface ModelRecord {
28
28
  */
29
29
  id: string;
30
30
  /**
31
- * Media type detected from the file's contents at upload time, rather than from its name or the type the client declared.
31
+ * Media type detected from the file's contents when they were last stored, rather than from its name or the type the client declared.
32
32
  * @type {string}
33
33
  * @memberof ModelRecord
34
34
  */
@@ -28,7 +28,7 @@ export interface ModelRecord {
28
28
  */
29
29
  id: string;
30
30
  /**
31
- * Media type detected from the file's contents at upload time, rather than from its name or the type the client declared.
31
+ * Media type detected from the file's contents when they were last stored, rather than from its name or the type the client declared.
32
32
  * @type {string}
33
33
  * @memberof ModelRecord
34
34
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaciv/sdk",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "OpenAPI client for @spaciv/sdk",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -54,6 +54,13 @@ export interface FilesApiUpdateAccountFilesRequest {
54
54
  accountFilePatchBody: AccountFilePatchBody;
55
55
  }
56
56
 
57
+ export interface FilesApiUpdateAccountFilesContentRequest {
58
+ id: string;
59
+ ifMatch: string;
60
+ filename?: Blob;
61
+ name?: string;
62
+ }
63
+
57
64
  /**
58
65
  * FilesApi - interface
59
66
  *
@@ -95,7 +102,7 @@ export interface FilesApiInterface {
95
102
  deleteAccountFiles(requestParameters: FilesApiDeleteAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object>;
96
103
 
97
104
  /**
98
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
105
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
99
106
  * @summary Download an account file
100
107
  * @param {string} id
101
108
  * @param {*} [options] Override http request option.
@@ -105,7 +112,7 @@ export interface FilesApiInterface {
105
112
  getAccountFilesContentRaw(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
106
113
 
107
114
  /**
108
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
115
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
109
116
  * Download an account file
110
117
  */
111
118
  getAccountFilesContent(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
@@ -144,6 +151,25 @@ export interface FilesApiInterface {
144
151
  */
145
152
  updateAccountFiles(requestParameters: FilesApiUpdateAccountFilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
146
153
 
154
+ /**
155
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
156
+ * @summary Replace an account file\'s content
157
+ * @param {string} id
158
+ * @param {string} ifMatch The ETag returned when the file\&#39;s content was read. The content is replaced only if it has not changed since.
159
+ * @param {Blob} [filename] filename of the file being uploaded
160
+ * @param {string} [name] general purpose name for multipart form value
161
+ * @param {*} [options] Override http request option.
162
+ * @throws {RequiredError}
163
+ * @memberof FilesApiInterface
164
+ */
165
+ updateAccountFilesContentRaw(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelRecord>>;
166
+
167
+ /**
168
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
169
+ * Replace an account file\'s content
170
+ */
171
+ updateAccountFilesContent(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord>;
172
+
147
173
  }
148
174
 
149
175
  /**
@@ -263,7 +289,7 @@ export class FilesApi extends runtime.BaseAPI implements FilesApiInterface {
263
289
  }
264
290
 
265
291
  /**
266
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
292
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
267
293
  * Download an account file
268
294
  */
269
295
  async getAccountFilesContentRaw(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>> {
@@ -305,7 +331,7 @@ export class FilesApi extends runtime.BaseAPI implements FilesApiInterface {
305
331
  }
306
332
 
307
333
  /**
308
- * Returns the stored bytes of a file held against the account, with the `mimeType` recorded at upload as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
334
+ * Returns the stored bytes of a file held against the account, with the `mimeType` recorded when the content was last stored as the `Content-Type`. Files belonging to other accounts are never returned. Served only from the user content host, so that a stored file is isolated from the application\'s own origin; any other host returns 404. The response always carries `Content-Disposition: attachment` and `Content-Security-Policy: default-src \'none\'`, so a file is downloaded rather than rendered even when the browser could display it. The response\'s `ETag` identifies this version of the content: send it back as `If-Match` when replacing the content, so that a change made by someone else in the meantime is not overwritten. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. Requires the *View file storage* permission. Returns `403` (`file quarantined: it matched a virus signature`) when a rescan found the stored file matches a virus signature; the bytes are kept for investigation.
309
335
  * Download an account file
310
336
  */
311
337
  async getAccountFilesContent(requestParameters: FilesApiGetAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string> {
@@ -417,4 +443,87 @@ export class FilesApi extends runtime.BaseAPI implements FilesApiInterface {
417
443
  return await response.value();
418
444
  }
419
445
 
446
+ /**
447
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
448
+ * Replace an account file\'s content
449
+ */
450
+ async updateAccountFilesContentRaw(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelRecord>> {
451
+ if (requestParameters['id'] == null) {
452
+ throw new runtime.RequiredError(
453
+ 'id',
454
+ 'Required parameter "id" was null or undefined when calling updateAccountFilesContent().'
455
+ );
456
+ }
457
+
458
+ if (requestParameters['ifMatch'] == null) {
459
+ throw new runtime.RequiredError(
460
+ 'ifMatch',
461
+ 'Required parameter "ifMatch" was null or undefined when calling updateAccountFilesContent().'
462
+ );
463
+ }
464
+
465
+ const queryParameters: any = {};
466
+
467
+ const headerParameters: runtime.HTTPHeaders = {};
468
+
469
+ if (requestParameters['ifMatch'] != null) {
470
+ headerParameters['If-Match'] = String(requestParameters['ifMatch']);
471
+ }
472
+
473
+ if (this.configuration && this.configuration.accessToken) {
474
+ const token = this.configuration.accessToken;
475
+ const tokenString = await token("accessToken", []);
476
+
477
+ if (tokenString) {
478
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
479
+ }
480
+ }
481
+ const consumes: runtime.Consume[] = [
482
+ { contentType: 'multipart/form-data' },
483
+ ];
484
+ // @ts-ignore: canConsumeForm may be unused
485
+ const canConsumeForm = runtime.canConsumeForm(consumes);
486
+
487
+ let formParams: { append(param: string, value: any): any };
488
+ let useForm = false;
489
+ // use FormData to transmit files using content-type "multipart/form-data"
490
+ useForm = canConsumeForm;
491
+ if (useForm) {
492
+ formParams = new FormData();
493
+ } else {
494
+ formParams = new URLSearchParams();
495
+ }
496
+
497
+ if (requestParameters['filename'] != null) {
498
+ formParams.append('filename', requestParameters['filename'] as any);
499
+ }
500
+
501
+ if (requestParameters['name'] != null) {
502
+ formParams.append('name', requestParameters['name'] as any);
503
+ }
504
+
505
+
506
+ let urlPath = `/v1/account/files/{id}/content`;
507
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
508
+
509
+ const response = await this.request({
510
+ path: urlPath,
511
+ method: 'PUT',
512
+ headers: headerParameters,
513
+ query: queryParameters,
514
+ body: formParams,
515
+ }, initOverrides);
516
+
517
+ return new runtime.JSONApiResponse(response, (jsonValue) => ModelRecordFromJSON(jsonValue));
518
+ }
519
+
520
+ /**
521
+ * Replaces the stored bytes of a file held against the account and returns the updated record, with the new version of the content as the `ETag`. Send the request as `multipart/form-data` with a single file field named `file`. The uploaded file\'s name is ignored: the file keeps its name and identifier, so anything already referencing it keeps working. `mimeType` is detected again from the new contents. Maximum file size is 25 MiB, and the content is rejected if a virus scan fails. Send the `ETag` returned when the content was read as `If-Match`. If the file has been replaced since then, the request is rejected with 412 and nothing changes; read the content again before deciding what to save. A missing `If-Match` is rejected with 422, and `*` with 400. The difference in size counts towards the account\'s 1 GiB storage quota, and content that would take the account past it is rejected with 413. A 409 means concurrent changes to the account\'s files kept changing its usage while the content was being replaced. The new content may already be stored, so read the content and its `ETag` again before deciding what to save: retrying with the same `If-Match` is rejected with 412 if it was. The identifier must be one returned by the upload or list operations; a malformed identifier is rejected with 400 and an unknown one with 404. A quarantined file cannot be replaced (403). Requires the *Edit file storage* permission.
522
+ * Replace an account file\'s content
523
+ */
524
+ async updateAccountFilesContent(requestParameters: FilesApiUpdateAccountFilesContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelRecord> {
525
+ const response = await this.updateAccountFilesContentRaw(requestParameters, initOverrides);
526
+ return await response.value();
527
+ }
528
+
420
529
  }
@@ -32,7 +32,7 @@ export interface ModelRecord {
32
32
  */
33
33
  id: string;
34
34
  /**
35
- * Media type detected from the file's contents at upload time, rather than from its name or the type the client declared.
35
+ * Media type detected from the file's contents when they were last stored, rather than from its name or the type the client declared.
36
36
  * @type {string}
37
37
  * @memberof ModelRecord
38
38
  */