Skip to content

Commit b575086

Browse files
committed
docs: add docs for getting list of collections a user can create datasets in
1 parent 3725bb7 commit b575086

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

docs/useCases.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The different use cases currently available in the package are classified below,
1717
- [List My Data Collection Items](#list-my-data-collection-items)
1818
- [Get Collection Featured Items](#get-collection-featured-items)
1919
- [Get Collections for Linking](#get-collections-for-linking)
20+
- [Get Collections for Creating](#get-collections-for-creating)
2021
- [Collections write use cases](#collections-write-use-cases)
2122
- [Create a Collection](#create-a-collection)
2223
- [Update a Collection](#update-a-collection)
@@ -409,6 +410,46 @@ Notes:
409410
- When the first argument is `'collection'`, the second argument can be a numeric collection id or a collection alias.
410411
- When the first argument is `'dataset'`, the second argument must be the dataset persistent identifier string (e.g., `doi:...`).
411412

413+
#### Get Collections for Creating
414+
415+
Returns an array of [CollectionSummary](../src/collections/domain/models/CollectionSummary.ts) (id, alias, displayName) representing the Dataverse collections which an authenticated user may create a new dataset in.
416+
417+
##### Example calls:
418+
419+
```typescript
420+
import { getCollectionsForCreating } from '@iqss/dataverse-client-javascript'
421+
422+
/* ... */
423+
424+
// Case 1: For the user who is currently authenticated
425+
getCollectionsForCreating
426+
.execute()
427+
.then((collections) => {
428+
// collections: CollectionSummary[]
429+
/* ... */
430+
})
431+
.catch((error: Error) => {
432+
/* ... */
433+
})
434+
435+
/* ... */
436+
437+
// Case 2: For a given user (by username)
438+
const username = 'anotherUser'
439+
440+
getCollectionsForCreating
441+
.execute(username)
442+
.then((collections) => {
443+
// collections: CollectionSummary[]
444+
/* ... */
445+
})
446+
.catch((error: Error) => {
447+
/* ... */
448+
})
449+
```
450+
451+
_See [use case](../src/collections/domain/useCases/GetCollectionsForCreating.ts) implementation_.
452+
412453
### Collections Write Use Cases
413454

414455
#### Create a Collection

0 commit comments

Comments
 (0)