From 6ea90d32ce58fc41f47da597ac039a00d9fe2a7c Mon Sep 17 00:00:00 2001 From: Justin Date: Sat, 25 May 2019 18:17:21 -0400 Subject: [PATCH] refactor: SystemHooks API function header updates 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 --- src/services/SystemHooks.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/services/SystemHooks.ts b/src/services/SystemHooks.ts index fd58c8b9..80a22f6c 100644 --- a/src/services/SystemHooks.ts +++ b/src/services/SystemHooks.ts @@ -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); } }