Skip to content

Commit

Permalink
Added getRoles docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyMitch committed May 31, 2024
1 parent bf7eea0 commit 9b6d8e1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ nav:
- Using the Package:
- APIs & Components:
- getIntegration: using-the-package/apis-&-components/get-integration.md
- getRoles: using-the-package/apis-&-components/get-roles.md
- Module Exports: using-the-package/module-exports.md
- TypeScript Types: using-the-package/typescript-types.md
- Troubleshooting: using-the-package/troubleshooting.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const getProjectName = async () => {

### Response Type

The type `GetIntegrationResponse` of `Promise<GetIntegrationResponse>`.
The type `GetIntegrationResponse` of `Promise<GetIntegrationResponse>`:

```TypeScript
{
Expand Down
54 changes: 54 additions & 0 deletions techdocs/docs/using-the-package/apis-&-components/get-roles.md
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;
}
```

0 comments on commit 9b6d8e1

Please sign in to comment.