mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
26 lines
No EOL
673 B
CoffeeScript
26 lines
No EOL
673 B
CoffeeScript
request = require("request")
|
|
settings = require("settings-sharelatex")
|
|
logger = require("logger-sharelatex")
|
|
|
|
module.exports =
|
|
|
|
sendMessage: (project_id, user_id, messageContent, callback)->
|
|
opts =
|
|
method:"post"
|
|
json:
|
|
content:messageContent
|
|
user_id:user_id
|
|
uri:"#{settings.apis.chat.url}/room/#{project_id}/messages"
|
|
request opts, (err, response, body)->
|
|
if err?
|
|
logger.err err:err, "problem sending new message to chat"
|
|
callback(err, body)
|
|
|
|
|
|
|
|
getMessages: (project_id, query, callback)->
|
|
opts =
|
|
uri:"#{settings.apis.chat.url}/room/#{project_id}/messages"
|
|
method:"get"
|
|
request opts, (err, response, body)->
|
|
callback(err, body) |