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
This commit is contained in:
Justin 2019-05-25 18:17:21 -04:00 committed by Justin Dalrymple
parent 037f4ed1ee
commit 6ea90d32ce

View File

@ -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);
}
}