Import api roku module as a bsc namespace

This commit is contained in:
Charles Ewert 2023-05-05 13:13:49 -04:00
parent 0dd873c787
commit 8997b1fd02
2 changed files with 2231 additions and 0 deletions

View File

@ -91,6 +91,39 @@ function postVoid(req, data = "" as string) as boolean
return false
end function
function headVoid(req) as boolean
req.setMessagePort(CreateObject("roMessagePort"))
req.AddHeader("Content-Type", "application/json")
req.AsyncHead()
resp = wait(30000, req.GetMessagePort())
if type(resp) <> "roUrlEvent"
return false
end if
if resp.GetResponseCode() = 200
return true
end if
return false
end function
function getVoid(req) as boolean
req.setMessagePort(CreateObject("roMessagePort"))
req.AddHeader("Content-Type", "application/json")
req.AsyncGetToString()
resp = wait(30000, req.GetMessagePort())
if type(resp) <> "roUrlEvent"
return false
end if
if resp.GetResponseCode() = 200
return true
end if
return false
end function
function postJson(req, data = "" as string)
req.setMessagePort(CreateObject("roMessagePort"))
req.AddHeader("Content-Type", "application/json")
@ -133,6 +166,23 @@ function get_url()
return base
end function
function getString(req)
data = req.GetToString()
return data
end function
function postString(req, data = "" as string)
req.setMessagePort(CreateObject("roMessagePort"))
req.AddHeader("Content-Type", "application/json")
req.AsyncPostFromString(data)
resp = wait(30000, req.GetMessagePort())
if type(resp) <> "roUrlEvent"
return invalid
end if
return resp.getString()
end function
function authorize_request(request)
user = get_setting("active_user")

2181
source/api/sdk.bs Normal file

File diff suppressed because it is too large Load Diff