Skip to content

Commit 65a2103

Browse files
committed
Added: docs and minor tweaks
1 parent e1b0b81 commit 65a2103

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

docs/useCases.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The different use cases currently available in the package are classified below,
1111
- [Collections](#Collections)
1212
- [Collections read use cases](#collections-read-use-cases)
1313
- [Get a Collection](#get-a-collection)
14+
- [Get Collection Facets](#get-collection-facets)
1415
- [Collections write use cases](#collections-write-use-cases)
1516
- [Create a Collection](#create-a-collection)
1617
- [Datasets](#Datasets)
@@ -100,6 +101,33 @@ The `collectionIdOrAlias` is a generic collection identifier, which can be eithe
100101

101102
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.
102103

104+
#### Get Collection Facets
105+
106+
Returns the names of the configured collection facets, given a collection identifier or alias.
107+
108+
##### Example call:
109+
110+
```typescript
111+
import { getCollectionFacets } from '@iqss/dataverse-client-javascript'
112+
113+
const collectionIdOrAlias = 12345
114+
115+
getCollectionFacets
116+
.execute(collectionId)
117+
.then((facets: string[]) => {
118+
/* ... */
119+
})
120+
.catch((error: Error) => {
121+
/* ... */
122+
})
123+
```
124+
125+
_See [use case](../src/collections/domain/useCases/GetCollectionFacets.ts)_ definition.
126+
127+
The `collectionIdOrAlias` is a generic collection identifier, which can be either a string (for queries by CollectionAlias), or a number (for queries by CollectionId).
128+
129+
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.
130+
103131
### Collections Write Use Cases
104132

105133
#### Create a Collection

src/collections/domain/dtos/CollectionDTO.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface CollectionDTO {
55
type: CollectionType
66
affiliation?: string
77
description?: string
8-
metadataBlockNames: string[]
8+
metadataBlockNames?: string[]
99
facetIds?: string[]
1010
inputLevels?: CollectionInputLevelDTO[]
1111
}

src/collections/domain/useCases/GetCollectionFacets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class GetCollectionFacets implements UseCase<string[]> {
1414
*
1515
* @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)
1616
* If this parameter is not set, the default value is: 'root'
17-
* @returns {Promise<Collection>}
17+
* @returns {Promise<string[]>}
1818
*/
1919
async execute(collectionIdOrAlias: number | string = ROOT_COLLECTION_ALIAS): Promise<string[]> {
2020
return await this.collectionsRepository.getCollectionFacets(collectionIdOrAlias)

0 commit comments

Comments
 (0)