Skip to main content

Favorites

The Favorites library provides APIs for adding/removing contents as favorites with Quickplay platform. The library facilitates marking any content as favorite content and also provides API to perform CRUD operations on favorites contents.

The FavoritesService is the interface for favorites operations contract which has all the APIs to perform different operations (Put, Delete & Get favorite records).

Usage

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
}
})