jf-roku/source/api/UserLibrary.brs
Charles Ewert bdfcac74e6
Implement global session var (#1224)
Co-authored-by: Jimi <jimi@thedodgefamily.com>
2023-06-01 08:43:27 -04:00

28 lines
902 B
Plaintext

function MarkItemFavorite(id as string)
url = Substitute("Users/{0}/FavoriteItems/{1}", m.global.session.user.id, id)
resp = APIRequest(url)
return postJson(resp)
end function
function UnmarkItemFavorite(id as string)
url = Substitute("Users/{0}/FavoriteItems/{1}", m.global.session.user.id, id)
resp = APIRequest(url)
resp.setRequest("DELETE")
return getJson(resp)
end function
sub MarkItemWatched(id as string)
date = CreateObject("roDateTime")
dateStr = date.ToISOString()
url = Substitute("Users/{0}/PlayedItems/{1}", m.global.session.user.id, id)
req = APIRequest(url)
postVoid(req, FormatJson({ "DatePlayed": dateStr }))
end sub
function UnmarkItemWatched(id as string)
url = Substitute("Users/{0}/PlayedItems/{1}", m.global.session.user.id, id)
resp = APIRequest(url)
resp.setRequest("DELETE")
return getJson(resp)
end function