Add plugin feature 'UnstableOpenScriptsExternally'

This commit is contained in:
Lucien Greathouse
2020-03-17 18:13:52 -07:00
parent 102c77b23e
commit 91d45afd0f
3 changed files with 79 additions and 0 deletions

View File

@@ -233,4 +233,19 @@ function ApiContext:retrieveMessages()
end)
end
function ApiContext:open(id)
local url = ("%s/api/open/%s"):format(self.__baseUrl, id)
return Http.post(url, "")
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end
return nil
end)
end
return ApiContext