-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf7eea0
commit 9b6d8e1
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
techdocs/docs/using-the-package/apis-&-components/get-roles.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# getRoles | ||
|
||
The `getRoles` function is used to get role details from your integration in Common Hosted Single Sign-on service. | ||
|
||
!!! warning "Reminder" | ||
This function is asynchronous and must be awaited in order to get a response. | ||
|
||
## Import | ||
|
||
```JavaScript | ||
// ESModule Syntax (preferred) | ||
import { getRoles } from "@bcgov/citz-imb-sso-css-api"; | ||
|
||
// CommonJS Syntax | ||
const { getRoles } = require('@bcgov/citz-imb-sso-css-api'); | ||
``` | ||
|
||
## Usage | ||
|
||
A basic example of using the `getRoles` function to get an array of role names. | ||
|
||
```JavaScript | ||
import { getRoles } from "@bcgov/citz-imb-sso-css-api"; | ||
|
||
export const getRoleList = async () => { | ||
const roles = await getRoles(); | ||
return roles.data.map((role) => role.name); | ||
} | ||
``` | ||
|
||
## TypeScript Type | ||
|
||
```TypeScript | ||
() => Promise<RolesArrayResponse>; | ||
``` | ||
|
||
### Response Type | ||
|
||
The type `RolesArrayResponse` of `Promise<RolesArrayResponse>`: | ||
|
||
```TypeScript | ||
{ | ||
data: RoleResponse[]; | ||
} | ||
``` | ||
|
||
The type `RoleResponse`: | ||
|
||
```TypeScript | ||
{ | ||
name: string; | ||
composite: boolean; | ||
} | ||
``` |