mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 06:15:32 -05:00
0a0722a8f8
GitOrigin-RevId: 9717a14d34a662c9740aa50446d0699c6afd3222
102 lines
1.9 KiB
JavaScript
102 lines
1.9 KiB
JavaScript
const request = require('request').defaults({
|
|
baseUrl: 'http://localhost:3010',
|
|
})
|
|
|
|
module.exports = {
|
|
sendGlobalMessage(projectId, userId, content, callback) {
|
|
request.post(
|
|
{
|
|
url: `/project/${projectId}/messages`,
|
|
json: {
|
|
user_id: userId,
|
|
content,
|
|
},
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
getGlobalMessages(projectId, callback) {
|
|
request.get(
|
|
{
|
|
url: `/project/${projectId}/messages`,
|
|
json: true,
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
sendMessage(projectId, threadId, userId, content, callback) {
|
|
request.post(
|
|
{
|
|
url: `/project/${projectId}/thread/${threadId}/messages`,
|
|
json: {
|
|
user_id: userId,
|
|
content,
|
|
},
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
getThreads(projectId, callback) {
|
|
request.get(
|
|
{
|
|
url: `/project/${projectId}/threads`,
|
|
json: true,
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
resolveThread(projectId, threadId, userId, callback) {
|
|
request.post(
|
|
{
|
|
url: `/project/${projectId}/thread/${threadId}/resolve`,
|
|
json: {
|
|
user_id: userId,
|
|
},
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
reopenThread(projectId, threadId, callback) {
|
|
request.post(
|
|
{
|
|
url: `/project/${projectId}/thread/${threadId}/reopen`,
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
deleteThread(projectId, threadId, callback) {
|
|
request.del(
|
|
{
|
|
url: `/project/${projectId}/thread/${threadId}`,
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
editMessage(projectId, threadId, messageId, content, callback) {
|
|
request.post(
|
|
{
|
|
url: `/project/${projectId}/thread/${threadId}/messages/${messageId}/edit`,
|
|
json: {
|
|
content,
|
|
},
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
|
|
deleteMessage(projectId, threadId, messageId, callback) {
|
|
request.del(
|
|
{
|
|
url: `/project/${projectId}/thread/${threadId}/messages/${messageId}`,
|
|
},
|
|
callback
|
|
)
|
|
},
|
|
}
|