From 942112c885b3bbf059064e7514c34b44fbad9e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Dostie?= Date: Tue, 17 Dec 2019 09:39:05 -0500 Subject: [PATCH] feat(group): add listExclusivePrivileges method --- src/resources/Groups/Groups.ts | 6 +++++- src/resources/Groups/tests/Groups.spec.ts | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/resources/Groups/Groups.ts b/src/resources/Groups/Groups.ts index 184667351..495ecafb8 100644 --- a/src/resources/Groups/Groups.ts +++ b/src/resources/Groups/Groups.ts @@ -1,5 +1,5 @@ import API from '../../APICore'; -import {New} from '../BaseInterfaces'; +import {New, PrivilegeModel} from '../BaseInterfaces'; import Resource from '../Resource'; import {CreateGroupOptions, GroupModel, UpdateGroupOptions} from './GroupsInterfaces'; import GroupInvite from './Invites/GroupInvite'; @@ -40,4 +40,8 @@ export default class Group extends Resource { update(group: GroupModel, options?: UpdateGroupOptions) { return this.api.put(this.buildPath(`${Group.baseUrl}/${group.id}`, options), group); } + + listExclusivePrivileges(groupId: string) { + return this.api.get(`${Group.baseUrl}/${groupId}/privileges/exclusive/me`); + } } diff --git a/src/resources/Groups/tests/Groups.spec.ts b/src/resources/Groups/tests/Groups.spec.ts index 476a042cd..4bef3ba4b 100644 --- a/src/resources/Groups/tests/Groups.spec.ts +++ b/src/resources/Groups/tests/Groups.spec.ts @@ -70,6 +70,17 @@ describe('Group', () => { }); }); + describe('listExclusivePrivileges', () => { + it('should make a GET call to the /groups/{groupId}/privileges/exclusive/me', () => { + group.listExclusivePrivileges('💎'); + + expect(api.get).toHaveBeenCalledTimes(1); + expect(api.get).toHaveBeenCalledWith( + '/rest/organizations/{organizationName}/groups/💎/privileges/exclusive/me' + ); + }); + }); + it('should register the realm resource', () => { expect(group.realm).toBeDefined(); expect(group.realm).toBeInstanceOf(GroupRealm);