Skip to content

Commit 37e0e8b

Browse files
committed
add documentation
1 parent aa762a8 commit 37e0e8b

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

docs/useCases.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ The different use cases currently available in the package are classified below,
7575
- [Delete Current API Token](#delete-current-api-token)
7676
- [Recreate Current API Token](#recreate-current-api-token)
7777
- [Register User](#register-user)
78+
- [Roles](#Roles)
79+
- [Roles read use cases](#roles-read-use-cases)
80+
- [Get User Selectable Roles](#get-user-selectable-roles)
7881
- [Info](#Info)
7982
- [Get Dataverse Backend Version](#get-dataverse-backend-version)
8083
- [Get Maximum Embargo Duration In Months](#get-maximum-embargo-duration-in-months)
@@ -1842,6 +1845,28 @@ registerUser.execute(userDTO)
18421845

18431846
_See [use case](../src/users/domain/useCases/RegisterUser.ts) implementation_.
18441847

1848+
## Roles
1849+
1850+
### Get User Selectable Roles
1851+
1852+
Returns a [Role](../src/roles/domain/models/Role.ts) array that the calling user can use as filters when searching within their data.
1853+
1854+
##### Example call:
1855+
1856+
```typescript
1857+
import { getUserSelectableRoles } from '@iqss/dataverse-client-javascript'
1858+
1859+
/* ... */
1860+
1861+
getUserSelectableRoles.execute().then((roles: Role[]) => {
1862+
/* ... */
1863+
})
1864+
1865+
/* ... */
1866+
```
1867+
1868+
_See [use case](../src/roles/domain/useCases/GetUserSelectableRoles.ts) implementation_.
1869+
18451870
## Info
18461871

18471872
#### Get Dataverse Backend Version

src/roles/domain/useCases/GetUserSelectableRoles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export class GetUserSelectableRoles implements UseCase<Role[]> {
66
constructor(private readonly rolesRepository: IRolesRepository) {}
77

88
/**
9-
* Returns an array of Roles, for the currently logged in user.
9+
* Returns the appropriate roles that the calling user can use as filters when searching within their data.
1010
*
11-
* @returns {Promise<Role[]>} - A promise that resolves to an array of Role instances that the user can select.
11+
* @returns {Promise<Role[]>} - A promise that resolves to an array of Role instances.
1212
*/
1313
async execute(): Promise<Role[]> {
1414
return (await this.rolesRepository.getUserSelectableRoles()) as Role[]

0 commit comments

Comments
 (0)