Skip to content

Commit

Permalink
Add available user roles listing endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoPouletSouchard committed Jan 7, 2025
1 parent 57451b3 commit 588271e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ export class Users {
.post(`/users/delete/${deletionId}/confirm`, { deletion: params }),
);
}

/**
* List all known roles.
*/
roles(): Promise<string[]> {
return unpackData(
this._client.authApiClient().get("/users/roles"),
"roles",
);
}
}

export default Users;
11 changes: 11 additions & 0 deletions test/Users/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,14 @@ describe("Users#confirmAccountDeletion", () => {
},
);
});

describe("Users#roles", () => {
testGetter(
"https://auth.scalingo.com/v1/users/roles",
null,
"roles",
(client) => {
return new Users(client).roles();
},
);
});

0 comments on commit 588271e

Please sign in to comment.