Skip to content

Commit

Permalink
feat: Added the missing edit function to the Groups API
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalrymple committed May 25, 2019
1 parent 6c5f81b commit ee6d490
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/services/Groups.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { BaseService, RequestHelper } from '../infrastructure';
import { RequestOptions } from '../infrastructure/RequestHelper';

type GroupId = string | number;

class Groups extends BaseService {
all(options: RequestOptions) {
all(options?: PaginatedRequestOptions) {
return RequestHelper.get(this, 'groups', options);
}

create(options: RequestOptions) {
create(options?: BaseRequestOptions) {
return RequestHelper.post(this, 'groups', options);
}

Expand All @@ -18,19 +15,33 @@ class Groups extends BaseService {
return RequestHelper.delete(this, `groups/${gId}`);
}

search(nameOrPath: string) {
edit(groupId: GroupId, options?: BaseRequestOptions) {
const gId = encodeURIComponent(groupId);

return RequestHelper.put(this, `groups/${gId}`, options);
}

remove(groupId: GroupId, options?: Sudo) {
const gId = encodeURIComponent(groupId);

return RequestHelper.del(this, `groups/${gId}`, options);
}


search(nameOrPath: string, options?: Sudo) {
return RequestHelper.get(this, 'groups', {
search: nameOrPath,
...options,
});
}

show(groupId: GroupId) {
show(groupId: GroupId, options?: BaseRequestOptions) {
const gId = encodeURIComponent(groupId);

return RequestHelper.get(this, `groups/${gId}`);
return RequestHelper.get(this, `groups/${gId}`, options);
}

subgroups(groupId: GroupId, options: RequestOptions) {
subgroups(groupId: GroupId, options?: PaginatedRequestOptions) {
const gId = encodeURIComponent(groupId);

return RequestHelper.get(this, `groups/${gId}/subgroups`, options);
Expand Down

0 comments on commit ee6d490

Please sign in to comment.