Skip to content

Commit

Permalink
refactor: SystemHooks API function header updates
Browse files Browse the repository at this point in the history
No point in having extra arguments in the function header if they arent required!

BREAKING CHANGE: Removed projectId from System Hooks API since it wasn't required
  • Loading branch information
jdalrymple committed May 25, 2019
1 parent 037f4ed commit 6ea90d3
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/services/SystemHooks.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
import { BaseService, RequestHelper } from '../infrastructure';
import { RequestOptions } from '../infrastructure/RequestHelper';

export type HookId = string | number;
class SystemHooks extends BaseService {
add(url: string, options: RequestOptions) {
add(url: string, options?: BaseRequestOptions) {
return RequestHelper.post(this, 'hooks', { url, ...options });
}

all(options: RequestOptions) {
all(options?: PaginatedRequestOptions) {
return RequestHelper.get(this, 'hooks', options);
}

edit(hookId: HookId, url: string, options: RequestOptions) {
edit(hookId: HookId, url: string, options?: BaseRequestOptions) {
const hId = encodeURIComponent(hookId);

return RequestHelper.put(this, `hooks/${hId}`, { url, ...options });
}

remove(
// @ts-ignore 'projectId' is declared but its value is never read
projectId: ProjectId,
hookId: HookId,
) {
remove(hookId: HookId, options?: Sudo) {
const hId = encodeURIComponent(hookId);

return RequestHelper.delete(this, `hooks/${hId}`);
return RequestHelper.del(this, `hooks/${hId}`, options);
}
}

Expand Down

0 comments on commit 6ea90d3

Please sign in to comment.