Skip to content

Commit 8ac7738

Browse files
committed
Added: docs for new API token management use cases
1 parent 1f3edf1 commit 8ac7738

File tree

4 files changed

+67
-3
lines changed

4 files changed

+67
-3
lines changed

docs/useCases.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ The different use cases currently available in the package are classified below,
5252
- [Users](#Users)
5353
- [Users read use cases](#users-read-use-cases)
5454
- [Get Current Authenticated User](#get-current-authenticated-user)
55+
- [Get Current API Token](#get-current-api-token)
56+
- [Users write use cases](#users-write-use-cases)
57+
- [Delete Current API Token](#delete-current-api-token)
58+
- [Recreate Current API Token](#recreate-current-api-token)
5559
- [Info](#Info)
5660
- [Get Dataverse Backend Version](#get-dataverse-backend-version)
5761
- [Get Maximum Embargo Duration In Months](#get-maximum-embargo-duration-in-months)
@@ -1137,6 +1141,66 @@ getCurrentAuthenticatedUser.execute().then((user: AuthenticatedUser) => {
11371141

11381142
_See [use case](../src/users/domain/useCases/GetCurrentAuthenticatedUser.ts) implementation_.
11391143

1144+
### Get Current API Token
1145+
1146+
Returns the current [ApiTokenInfo](../src/users/domain/models/ApiTokenInfo.ts) corresponding to the current authenticated user.
1147+
1148+
##### Example call:
1149+
1150+
```typescript
1151+
import { getCurrentApiToken } from '@iqss/dataverse-client-javascript'
1152+
1153+
/* ... */
1154+
1155+
getCurrentApiToken.execute().then((apiTokenInfo: ApiTokenInfo) => {
1156+
/* ... */
1157+
})
1158+
1159+
/* ... */
1160+
```
1161+
1162+
_See [use case](../src/users/domain/useCases/GetCurrentApiToken.ts) implementation_.
1163+
1164+
### Users write use cases
1165+
1166+
### Delete Current API Token
1167+
1168+
Deletes the API token of the current authenticated user.
1169+
1170+
##### Example call:
1171+
1172+
```typescript
1173+
import { deleteCurrentApiToken } from '@iqss/dataverse-client-javascript'
1174+
1175+
/* ... */
1176+
1177+
deleteCurrentApiToken.execute()
1178+
1179+
/* ... */
1180+
```
1181+
1182+
_See [use case](../src/users/domain/useCases/DeleteCurrentApiToken.ts) implementation_.
1183+
1184+
### Recreate Current API Token
1185+
1186+
Reacreates the API token of the current authenticated user and returns the new [ApiTokenInfo](../src/users/domain/models/ApiTokenInfo.ts).
1187+
1188+
##### Example call:
1189+
1190+
```typescript
1191+
import { recreateCurrentApiToken } from '@iqss/dataverse-client-javascript'
1192+
1193+
/* ... */
1194+
1195+
recreateCurrentApiToken.execute().then((apiTokenInfo: ApiTokenInfo) => {
1196+
/* ... */
1197+
})
1198+
1199+
/* ... */
1200+
```
1201+
1202+
_See [use case](../src/users/domain/useCases/RecreateCurrentApiToken.ts) implementation_.
1203+
11401204
## Info
11411205

11421206
#### Get Dataverse Backend Version

src/users/domain/useCases/DeleteCurrentApiToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class DeleteCurrentApiToken implements UseCase<void> {
99
}
1010

1111
/**
12-
* Deletes the API token of the current authenticated user in ApiConfig.
12+
* Deletes the API token of the current authenticated user.
1313
*
1414
* @returns {Promise<void>}
1515
*/

src/users/domain/useCases/GetCurrentApiToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class GetCurrentApiToken implements UseCase<ApiTokenInfo> {
1010
}
1111

1212
/**
13-
* Returns the current API token information corresponding to the current user authenticated through ApiConfig.
13+
* Returns the current ApiTokenInfo corresponding to the current authenticated user.
1414
*
1515
* @returns {Promise<ApiTokenInfo>}
1616
*/

src/users/domain/useCases/RecreateCurrentApiToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class RecreateCurrentApiToken implements UseCase<ApiTokenInfo> {
1010
}
1111

1212
/**
13-
* Reacreates the API token of the current authenticated user in ApiConfig and returns the new API token info.
13+
* Reacreates the API token of the current authenticated user and returns the new ApiTokenInfo.
1414
*
1515
* @returns {Promise<ApiTokenInfo>}
1616
*/

0 commit comments

Comments
 (0)