Query Videos
Querying videos happens through the video store component that you can retrieve with VideoKit.videos()
.
All functions of this component are asynchronous and will return the usual Call
object,
described here.
Note that just like all other network APIs, you will need a valid session or the call will return an error.
Fetch single video
Single videos can be fetched by id with the get()
method:
val videos: VideoStore = VideoKit.videos()
videos.get(id).onSuccess {
// Got video!
}.onError {
// Something went wrong.
}
Query lists
The video store can return immutable lists of videos (List<Video>
). As with other APIs, we
use request objects to define the query parameters, all extending the ListRequest
interface.
We expose several types of requests, and in all cases you can set a SortOrder
and limit
and offset
parameters.
Once you have the request, just call getList
:
val videos: VideoStore = VideoKit.videos()
videos.getList(request).onSuccess {
// Got videos!
}.onError {
// Something went wrong.
}
Filter by user
You can filter by user using UserListRequest
:
val request = UserListRequest(userIdentity)
val request = UserListRequest.builder(userIdentity) {
order(SortOrder.DESC)
limit(10)
offset(10)
}
Filter by id
You can filter by id using CustomListRequest
:
val request = CustomListRequest(ids = listOfIds)
val request = CustomListRequest.builder() {
ids("id1", "id2")
order(SortOrder.DESC)
limit(10)
offset(10)
}
Filter by metadata and tags
You can filter by metadata and tags using FilteredListRequest
:
val request = FilteredListRequest(tags = tags, metadata = metadata)
val request = FilteredListRequest.builder() {
tags("tag1", "tag2")
metadata("key", "value")
order(SortOrder.DESC)
limit(10)
offset(10)
}