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 accept a completion handler.
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:
let videos: VideoStore = VideoKit.videos()
videos.get(id: id) { video, err in
// Got video / error
}
Query lists
The video store can return immutable lists of videos ([Video]
). As with other APIs, we
use request objects to define the query parameters, all extending the VideosRequest
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 list
:
let videos: VideoStore = VideoKit.videos()
videos.list(request) { videos, err in
// Got videos / error
}
Filter by user
You can filter by user using UserVideosRequest
:
var request = UserVideosRequest(identity: userIdentity)
request.limit = 10
request.offset = 10
request.order = .desc
Filter by id
You can filter by id using CustomVideosRequest
:
var request = CustomVideosRequest(ids: listOfIds)
request.limit = 10
request.offset = 10
request.order = .desc
Filter by metadata and tags
You can filter by metadata and tags using FilteredVideosRequest
:
var request = FilteredVideosRequest(tags: tags, metadata: metadata)
request.title = "title"
request.limit = 10
request.offset = 10
request.order = .desc