Skip to content

Commit 513b312

Browse files
committed
Added: docs for updateCollection
1 parent 78331c0 commit 513b312

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/useCases.md

+29
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The different use cases currently available in the package are classified below,
1616
- [List All Collection Items](#list-all-collection-items)
1717
- [Collections write use cases](#collections-write-use-cases)
1818
- [Create a Collection](#create-a-collection)
19+
- [Update a Collection](#update-a-collection)
1920
- [Publish a Collection](#publish-a-collection)
2021
- [Datasets](#Datasets)
2122
- [Datasets read use cases](#datasets-read-use-cases)
@@ -232,6 +233,34 @@ The above example creates the new collection in the `root` collection since no c
232233

233234
The use case returns a number, which is the identifier of the created collection.
234235

236+
#### Update a Collection
237+
238+
Updates an existing collection, given a collection identifier and a [CollectionDTO](../src/collections/domain/dtos/CollectionDTO.ts) including the updated collection data.
239+
240+
##### Example call:
241+
242+
```typescript
243+
import { updateCollection } from '@iqss/dataverse-client-javascript'
244+
245+
/* ... */
246+
247+
const collectionIdOrAlias = 12345
248+
const collectionDTO: CollectionDTO = {
249+
alias: alias,
250+
name: 'Updated Collection Name',
251+
contacts: ['[email protected]'],
252+
type: CollectionType.DEPARTMENT
253+
}
254+
255+
updateCollection.execute(collectionIdOrAlias, collectionDTO)
256+
257+
/* ... */
258+
```
259+
260+
_See [use case](../src/collections/domain/useCases/UpdateCollection.ts) implementation_.
261+
262+
The `collectionIdOrAlias` is a generic collection identifier, which can be either a string (for queries by CollectionAlias), or a number (for queries by CollectionId).
263+
235264
#### Publish a Collection
236265

237266
Publishes a Collection, given the collection identifier.

0 commit comments

Comments
 (0)