2016-12-14 12:38:14 -05:00
|
|
|
request = require("request").defaults({baseUrl: "http://localhost:3010"})
|
|
|
|
|
|
|
|
module.exports =
|
2016-12-16 11:52:50 -05:00
|
|
|
sendGlobalMessage: (project_id, user_id, content, callback) ->
|
2016-12-14 12:38:14 -05:00
|
|
|
request.post {
|
2016-12-16 11:52:50 -05:00
|
|
|
url: "/project/#{project_id}/messages"
|
2016-12-14 12:38:14 -05:00
|
|
|
json:
|
|
|
|
user_id: user_id
|
|
|
|
content: content
|
|
|
|
}, callback
|
|
|
|
|
2016-12-16 11:52:50 -05:00
|
|
|
getGlobalMessages: (project_id, callback) ->
|
2016-12-14 12:38:14 -05:00
|
|
|
request.get {
|
2016-12-16 11:52:50 -05:00
|
|
|
url: "/project/#{project_id}/messages",
|
|
|
|
json: true
|
|
|
|
}, callback
|
|
|
|
|
|
|
|
sendMessage: (project_id, thread_id, user_id, content, callback) ->
|
|
|
|
request.post {
|
|
|
|
url: "/project/#{project_id}/thread/#{thread_id}/messages"
|
|
|
|
json:
|
|
|
|
user_id: user_id
|
|
|
|
content: content
|
|
|
|
}, callback
|
|
|
|
|
|
|
|
getThreads: (project_id, callback) ->
|
|
|
|
request.get {
|
|
|
|
url: "/project/#{project_id}/threads",
|
2016-12-14 12:38:14 -05:00
|
|
|
json: true
|
2017-01-04 08:51:08 -05:00
|
|
|
}, callback
|
|
|
|
|
|
|
|
resolveThread: (project_id, thread_id, user_id, callback) ->
|
|
|
|
request.post {
|
|
|
|
url: "/project/#{project_id}/thread/#{thread_id}/resolve",
|
|
|
|
json: {
|
|
|
|
user_id: user_id
|
|
|
|
}
|
|
|
|
}, callback
|
|
|
|
|
|
|
|
reopenThread: (project_id, thread_id, callback) ->
|
|
|
|
request.post {
|
|
|
|
url: "/project/#{project_id}/thread/#{thread_id}/reopen",
|
2017-01-24 09:44:32 -05:00
|
|
|
}, callback
|
|
|
|
|
|
|
|
deleteThread: (project_id, thread_id, callback) ->
|
|
|
|
request.del {
|
|
|
|
url: "/project/#{project_id}/thread/#{thread_id}",
|
|
|
|
}, callback
|
|
|
|
|
|
|
|
editMessage: (project_id, thread_id, message_id, content, callback) ->
|
|
|
|
request.post {
|
|
|
|
url: "/project/#{project_id}/thread/#{thread_id}/messages/#{message_id}/edit"
|
|
|
|
json:
|
|
|
|
content: content
|
|
|
|
}, callback
|
|
|
|
|
|
|
|
deleteMessage: (project_id, thread_id, message_id, callback) ->
|
|
|
|
request.del {
|
|
|
|
url: "/project/#{project_id}/thread/#{thread_id}/messages/#{message_id}",
|
|
|
|
}, callback
|