Favorites
The Favorites library provides APIs for adding and removing content as favorites with Quickplay platform. The library facilitates marking content as favorite and provides API to perform CRUD operations on favorite content.
The FavoritesService is the interface for favorites operations contract which has all the APIs to perform different operations (Put, Delete, and Get favorite records).
Usage
Use the following methods to create and manage your favorite content.
Create FavoritesService
let favoritesService = FLFavoritesFactory.favoritesService(endPoint: endPoint,
httpClient: httpClient,
authorizer: authorizer)
Create, fetch, and delete favorites
// Get Favorite contents
favoritesService.getFavorites(
pageNumber: 1,
pageSize: 100,
sortBy: SortBy(rawValue: "15434565"),
sortOrder: SortOrder(rawValue: "asc"),
completion: { (result: Result<[FavoritesRecord], Error>) in
response = result
switch result {
case .success:
// success
case let .failure(error):
// failure
}
})
// Mark a content as Favorite
favoritesService.putFavorite(itemId: itemId,
completion: { (result: Result<Void, Error>) in
response = result
switch result {
case .success:
// success
case let .failure(error):
// failure
}
})
// Delete a favorite content
favoritesService.deleteFavorite(itemId: itemId,
completion: { (result: Result<Void, Error>) in
response = result
switch result {
case .success:
// success
case let .failure(error):
// failure
}
})