forked from moul/node-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectLabels.coffee
More file actions
29 lines (24 loc) · 829 Bytes
/
ProjectLabels.coffee
File metadata and controls
29 lines (24 loc) · 829 Bytes
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 ProjectLabels extends BaseModel
all: (projectId, params = {}, fn = null) =>
@debug "ProjectLabels::labels()"
if 'function' is typeof params
fn = params
params = {}
params.page ?= 1
params.per_page ?= 100
data = []
cb = (err, retData) =>
if err
return fn data if fn
else if retData.length == params.per_page
@debug "Recurse ProjectLabels::all()"
data = data.concat(retData)
params.page++
return @get "projects/#{Utils.parseProjectId projectId}/labels", params, cb
else
data = data.concat(retData)
return fn data if fn
@get "projects/#{Utils.parseProjectId projectId}/labels", params, cb
module.exports = (client) -> new ProjectLabels client