       fn = params
       params = {}
     @debug "Groups::all()"
-    
+
     params.page ?= 1
     params.per_page ?= 100
 

  listProjects: (groupId, fn = null) =>
    @debug "Groups::listProjects()"
    @get "groups/#{parseInt groupId}", (data) => fn data.projects if fn
        
  listMembers: (groupId, fn = null) =>
    @debug "Groups::listMembers()"
    @get "groups/#{parseInt groupId}/members", (data) => fn data if fn


    @post "groups/#{parseInt groupId}/members", params, (data) -> fn data if fn

  create: (params = {}, fn = null) =>
    @debug "Groups::create()"
    @post "groups", params, (data) -> fn data if fn

  addProject: (groupId, projectId, fn = null) =>
    @debug "Groups::addProject(#{groupId}, #{projectId})"
    @post "groups/#{parseInt groupId}/projects/#{parseInt projectId}", null, (data) -> fn data if fn

module.exports = (client) -> new Groups client
