removeRoles
Use this to remove roles from a User API Key
Type signature of remove
async function removeRoles(
userAPIKeyId: string,
roles: Array<string>
): Promise<
| {
error: "authorizationHeaderNotPresent";
success: false;
reason: string;
}
| {
error: "apiTokenNotPresent";
success: false;
reason: string;
}
| {
error: "invalidAPIToken";
success: false;
reason: string;
}
| {
error: "invalidBody";
success: false;
reason: string;
}
| {
error: "invalidId";
success: false;
reason: string;
}
| {
success: true;
count: number;
}
>;
Paramters
userAPIKeyId-idofUser API Keythat you got fromcreateUserAPIKeyIdroles- Anarrayof role names. Duplicated roles and roles which is not present inUser API Keywill be ignored.
Returns
type Returns = {
success: true;
count: number;
};
count represents number of roles removed to User API Key
Errors
If roles are unable to add to User API Key successfully, then removeRoles will return an error. Check the Type signature for possible errors that can happen