forked from Ermlab/nxt-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectHooks.coffee
More file actions
29 lines (23 loc) · 1.09 KB
/
ProjectHooks.coffee
File metadata and controls
29 lines (23 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
BaseModel = require '../BaseModel'
Utils = require '../Utils'
class ProjectHooks extends BaseModel
list: (projectId, fn = null) =>
@debug "Projects::hooks()"
@get "projects/#{Utils.parseProjectId projectId}/hooks", (data) => fn data if fn
show: (projectId, hookId, fn = null) =>
@debug "Projects::hook()"
@get "projects/#{Utils.parseProjectId projectId}/hooks/#{parseInt hookId}", (data) => fn data if fn
add: (projectId, url, fn = null) =>
@debug "Projects::addHook()"
params =
url: url
@post "projects/#{Utils.parseProjectId projectId}/hooks", params, (data) => fn data if fn
update: (projectId, hookId, url, fn = null) =>
@debug "Projects::saveHook()"
params =
access_level: parseInt accessLevel
@put "projects/#{Utils.parseProjectId projectId}/hooks/#{parseInt hookId}", params, (data) => fn data if fn
remove: (projectId, hookId, fn = null) =>
@debug "Projects::removeHook()"
@delete "projects/#{Utils.parseProjectId projectId}/hooks/#{parseInt hookId}", (data) => fn data if fn
module.exports = (client) -> new ProjectHooks client