156 lines
5.6 KiB
Plaintext
156 lines
5.6 KiB
Plaintext
' Auto-generated file - do not modify manually
|
|
' md5:a67e7e5809b87399b499043edf609988
|
|
|
|
import "pkg:/source/Protobuf/BinaryReader.bs"
|
|
import "pkg:/source/Protobuf/BinaryWriter.bs"
|
|
import "pkg:/source/Protobuf/Decoder.bs"
|
|
import "pkg:/source/Protobuf/Encoder.bs"
|
|
|
|
namespace Protobuf
|
|
namespace Generated
|
|
namespace misc
|
|
|
|
enum SortBy
|
|
RELEVANCE = 0
|
|
RATING = 1
|
|
UPLOAD_DATE = 2
|
|
VIEW_COUNT = 3
|
|
end enum
|
|
|
|
enum UploadDate
|
|
ANY_DATE = 0
|
|
HOUR = 1
|
|
TODAY = 2
|
|
WEEK = 3
|
|
MONTH = 4
|
|
YEAR = 5
|
|
end enum
|
|
|
|
enum SearchType
|
|
ANY_TYPE = 0
|
|
VIDEO = 1
|
|
CHANNEL = 2
|
|
PLAYLIST = 3
|
|
MOVIE = 4
|
|
end enum
|
|
|
|
enum Duration
|
|
ANY_DURATION = 0
|
|
SHORT = 1
|
|
LONG = 2
|
|
MEDIUM = 3
|
|
end enum
|
|
|
|
|
|
|
|
function encodeFilters(message as dynamic, asByteArray = false as boolean) as dynamic
|
|
buffer = CreateObject("roByteArray")
|
|
writer = new Protobuf.BinaryWriter()
|
|
writer.SetBuffer(buffer)
|
|
encoder = new Protobuf.Encoder(writer)
|
|
if message.DoesExist("upload_date")
|
|
value = message["upload_date"]
|
|
encoder.EncodeInt32(1, value)
|
|
end if
|
|
if message.DoesExist("type")
|
|
value = message["type"]
|
|
encoder.EncodeInt32(2, value)
|
|
end if
|
|
if message.DoesExist("duration")
|
|
value = message["duration"]
|
|
encoder.EncodeInt32(3, value)
|
|
end if
|
|
if message.DoesExist("features_hd")
|
|
value = message["features_hd"]
|
|
encoder.EncodeBool(4, value)
|
|
end if
|
|
if message.DoesExist("features_subtitles")
|
|
value = message["features_subtitles"]
|
|
encoder.EncodeBool(5, value)
|
|
end if
|
|
if message.DoesExist("features_creative_commons")
|
|
value = message["features_creative_commons"]
|
|
encoder.EncodeBool(6, value)
|
|
end if
|
|
if message.DoesExist("features_3d")
|
|
value = message["features_3d"]
|
|
encoder.EncodeBool(7, value)
|
|
end if
|
|
if message.DoesExist("features_live")
|
|
value = message["features_live"]
|
|
encoder.EncodeBool(8, value)
|
|
end if
|
|
if message.DoesExist("features_purchased")
|
|
value = message["features_purchased"]
|
|
encoder.EncodeBool(9, value)
|
|
end if
|
|
if message.DoesExist("features_4k")
|
|
value = message["features_4k"]
|
|
encoder.EncodeBool(14, value)
|
|
end if
|
|
if message.DoesExist("features_360")
|
|
value = message["features_360"]
|
|
encoder.EncodeBool(15, value)
|
|
end if
|
|
if message.DoesExist("features_location")
|
|
value = message["features_location"]
|
|
encoder.EncodeBool(23, value)
|
|
end if
|
|
if message.DoesExist("features_hdr")
|
|
value = message["features_hdr"]
|
|
encoder.EncodeBool(25, value)
|
|
end if
|
|
if message.DoesExist("features_vr180")
|
|
value = message["features_vr180"]
|
|
encoder.EncodeBool(26, value)
|
|
end if
|
|
if asByteArray
|
|
return buffer
|
|
else
|
|
return buffer.ToBase64String().EncodeUriComponent()
|
|
end if
|
|
end function
|
|
|
|
function encodeSearchFilter(message as dynamic, asByteArray = false as boolean) as dynamic
|
|
buffer = CreateObject("roByteArray")
|
|
writer = new Protobuf.BinaryWriter()
|
|
writer.SetBuffer(buffer)
|
|
encoder = new Protobuf.Encoder(writer)
|
|
if message.DoesExist("sort_by")
|
|
value = message["sort_by"]
|
|
encoder.EncodeInt32(1, value)
|
|
end if
|
|
if message.DoesExist("filters")
|
|
value = message["filters"]
|
|
encoder.EncodeMessage(2, Protobuf.Generated.misc.encodeFilters(value, true))
|
|
end if
|
|
if asByteArray
|
|
return buffer
|
|
else
|
|
return buffer.ToBase64String().EncodeUriComponent()
|
|
end if
|
|
end function
|
|
|
|
function encodeNextParams(message as dynamic, asByteArray = false as boolean) as dynamic
|
|
buffer = CreateObject("roByteArray")
|
|
writer = new Protobuf.BinaryWriter()
|
|
writer.SetBuffer(buffer)
|
|
encoder = new Protobuf.Encoder(writer)
|
|
if message.DoesExist("video_id")
|
|
for each value in message["video_id"]
|
|
encoder.EncodeString(5, value)
|
|
end for
|
|
end if
|
|
if asByteArray
|
|
return buffer
|
|
else
|
|
return buffer.ToBase64String().EncodeUriComponent()
|
|
end if
|
|
end function
|
|
|
|
|
|
|
|
end namespace
|
|
end namespace
|
|
end namespace
|