GetRoles
To get the available roles, you can use the following functions:
The difference between those two functions is that the Cache function calls the local sidecar without latency, while the API function calls Permit cloud.
If you call this function many times or in time critical code, you should use the Cache function.
Role[] roles = await permit.Cache.GetRoles();
// returns your org roles with list of SyncedRole type
// [{
// id: string,
// name: string,
// description: string,
// permissions: string[],
// metadata: Dictionary<string, object>,
// },
// ...
// }
Role[] roles = await permit.Api.GetRoles();
// returns your org roles with list of Role type
// [{
// id: string,
// name: string,
// description: string,
// tenantId: string,
// },
// ...
// }