import { BackendApiClient } from '../../../apis/api-client';
export class RoleManagementApi {
  async getEditorProfiles() {
    return (await BackendApiClient.instance.url(`users/editors`).get().json());
  }
  async assignRole(profileId, role) {
    const req = {
      command: {
        assignRole: role
      }
    };
    return BackendApiClient.instance
      .url(`users/${profileId}`)
      .post(req)
      .badRequest(() => {
      throw new Error('Failed to execute user command');
    })
      .res();
  }
}
export default new RoleManagementApi();
