Skip to content

Commit 96fec17

Browse files
committed
docs
1 parent 224e23f commit 96fec17

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

docs/useCases.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ The different use cases currently available in the package are classified below,
5151
- [Files write use cases](#files-write-use-cases)
5252
- [File Uploading Use Cases](#file-uploading-use-cases)
5353
- [Delete a File](#delete-a-file)
54+
- [Replace a File](#replace-a-file)
5455
- [Metadata Blocks](#metadata-blocks)
5556
- [Metadata Blocks read use cases](#metadata-blocks-read-use-cases)
5657
- [Get All Facetable Metadata Fields](#get-all-facetable-metadata-fields)
@@ -1264,6 +1265,37 @@ Note that the behavior of deleting files depends on if the dataset has ever been
12641265
- If the dataset has published, the file is deleted from the draft (and future published versions).
12651266
- If the dataset has published, the deleted file can still be downloaded because it was part of a published version.
12661267

1268+
#### Replace a File
1269+
1270+
Replaces a File. Currently working for already uploaded S3 bucket files.
1271+
1272+
##### Example call:
1273+
1274+
```typescript
1275+
import { replaceFile } from '@iqss/dataverse-client-javascript'
1276+
1277+
/* ... */
1278+
1279+
const fileId = 12345
1280+
const uploadedFileDTO: UploadedFileDTO = {
1281+
fileName: 'the-file-name',
1282+
storageId: 'localstack1://mybucket:19121faf7e7-2c40322ff54e',
1283+
checksumType: 'md5',
1284+
checksumValue: 'ede3d3b685b4e137ba4cb2521329a75e',
1285+
mimeType: 'text/plain'
1286+
}
1287+
1288+
replaceFile.execute(fileId, uploadedFileDTO)
1289+
1290+
/* ... */
1291+
```
1292+
1293+
_See [use case](../src/files/domain/useCases/ReplaceFile.ts) implementation_.
1294+
1295+
The `fileId` parameter should be a number, the numeric identifier.
1296+
1297+
The `uploadedFileDTO` parameter is a [UploadedFileDTO](../src/files/domain/dtos/UploadedFileDTO.ts) and includes properties related to the uploaded files. Some of these properties should be calculated from the uploaded File Blob objects and the resulting storage identifiers from the Upload File use case.
1298+
12671299
## Metadata Blocks
12681300

12691301
### Metadata Blocks read use cases

0 commit comments

Comments
 (0)