Skip to content

Commit 666e376

Browse files
committed
feat(PublishDataset use case): add use case to the docs
1 parent f4d957e commit 666e376

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

docs/useCases.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The different use cases currently available in the package are classified below,
2020
- [List All Datasets](#list-all-datasets)
2121
- [Datasets write use cases](#datasets-write-use-cases)
2222
- [Create a Dataset](#create-a-dataset)
23+
- [Publish a Dataset](#publish-a-dataset)
2324
- [Files](#Files)
2425
- [Files read use cases](#files-read-use-cases)
2526
- [Get a File](#get-a-file)
@@ -305,6 +306,40 @@ The above example creates the new dataset in the `root` collection since no coll
305306

306307
The use case returns a [CreatedDatasetIdentifiers](../src/datasets/domain/models/CreatedDatasetIdentifiers.ts) object, which includes the persistent and numeric identifiers of the created dataset.
307308

309+
#### Publish a Dataset
310+
311+
Publishes a Dataset, given its identifier and the type of version update to perform.
312+
313+
##### Example call:
314+
315+
```typescript
316+
import { publishDataset } from '@iqss/dataverse-client-javascript'
317+
318+
/* ... */
319+
320+
const datasetId = 'doi:10.77777/FK2/AAAAAA'
321+
const versionUpdateType = VersionUpdateType.MINOR
322+
323+
publishDataset.execute(datasetId, versionUpdateType).then((publishedDataset: Dataset) => {
324+
/* ... */
325+
})
326+
327+
/* ... */
328+
```
329+
330+
_See [use case](../src/datasets/domain/useCases/PublishDataset.ts) implementation_.
331+
332+
The above example publishes the dataset with the specified identifier and performs a minor version update. If the response
333+
is successful, the use case does not return the dataset object, but the HTTP status code `200`. Otherwise, it throws an error.
334+
If you want to perform a major version update, you must set the `versionUpdateType` parameter to `VersionUpdateType.MAJOR`.
335+
336+
The `datasetId` parameter can be a string, for persistent identifiers, or a number, for numeric identifiers.
337+
338+
The `versionUpdateType` parameter can be a [VersionUpdateType](../src/datasets/domain/models/VersionUpdateType.ts) enum value, which can be one of the following:
339+
340+
- `VersionUpdateType.MINOR`
341+
- `VersionUpdateType.MAJOR`
342+
308343
## Files
309344

310345
### Files read use cases

0 commit comments

Comments
 (0)