Skip to content

Commit 559c89c

Browse files
committed
chore: add docs
1 parent 30dbbff commit 559c89c

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

docs/useCases.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The different use cases currently available in the package are classified below,
1414
- [Get Collection Facets](#get-collection-facets)
1515
- [Get User Permissions on a Collection](#get-user-permissions-on-a-collection)
1616
- [List All Collection Items](#list-all-collection-items)
17+
- [Get Collection Featured Items](#get-collection-featured-items)
1718
- [Collections write use cases](#collections-write-use-cases)
1819
- [Create a Collection](#create-a-collection)
1920
- [Update a Collection](#update-a-collection)
@@ -202,6 +203,33 @@ This use case supports the following optional parameters depending on the search
202203
- **offset**: (number) Offset for pagination.
203204
- **collectionSearchCriteria**: ([CollectionSearchCriteria](../src/collections/domain/models/CollectionSearchCriteria.ts)) Supports filtering the collection items by different properties.
204205

206+
#### Get Collection Featured Items
207+
208+
Returns a [CollectionFeaturedItem](../src/collections/domain/models/CollectionFeaturedItem.ts) array containing the featured items of the requested collection, given the collection identifier or alias.
209+
210+
##### Example call:
211+
212+
```typescript
213+
import { getCollectionFeaturedItems } from '@iqss/dataverse-client-javascript'
214+
215+
const collectionIdOrAlias = 12345
216+
217+
getCollectionFeaturedItems
218+
.execute(collectionId)
219+
.then((featuredItems: CollectionFeaturedItem[]) => {
220+
/* ... */
221+
})
222+
.catch((error: Error) => {
223+
/* ... */
224+
})
225+
```
226+
227+
_See [use case](../src/collections/domain/useCases/GetCollectionFeaturedItems.ts)_ definition.
228+
229+
The `collectionIdOrAlias` is a generic collection identifier, which can be either a string (for queries by CollectionAlias), or a number (for queries by CollectionId).
230+
231+
If no collection identifier is specified, the default collection identifier; `:root` will be used. If you want to search for a different collection, you must add the collection identifier as a parameter in the use case call.
232+
205233
### Collections Write Use Cases
206234

207235
#### Create a Collection

src/collections/domain/useCases/GetCollectionFeaturedItems.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class GetCollectionFeaturedItems implements UseCase<CollectionFeaturedIte
1515
*
1616
* @param {number | string} [collectionIdOrAlias = ':root'] - A generic collection identifier, which can be either a string (for queries by CollectionAlias), or a number (for queries by CollectionId)
1717
* If this parameter is not set, the default value is: ':root'
18-
* @returns {Promise<CollectionFeaturedItem>}
18+
* @returns {Promise<CollectionFeaturedItem[]>}
1919
*/
2020
async execute(
2121
collectionIdOrAlias: number | string = ROOT_COLLECTION_ID

0 commit comments

Comments
 (0)