Skip to main content

Favorites

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

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

Usage

Create FavoritesService

val favoritesService = FavouriteServiceImpl(
serviceEndPointURL,
platformAuthorizer,
httpClient
)

Create, fetch and delete favorites

// Get Favorite contents
fun getFavourites(
pageNumber: Int = DEFAULT_PAGE_NUM,
pageSize: Int = DEFAULT_PAGE_SIZE,
sortBy: SortByType = SortByType.TIMESTAMP,
sortOrder: SortOrderType = SortOrderType.DESC
): Result<List<FavouriteRecord>, Error>

// Get favourite contents
fun getFavourite(contentId: String): Result<FavouriteRecord, Error>

// Mark a content as Favorite
fun putFavourite(contentId: String): Result<Unit, Error>

// Delete a favorite content
fun deleteFavourite(contentId: String): Result<Unit, Error>

//return total favourite count
fun getFavouriteCount(): Result<FavouriteCount, Error>

pageNumber: Indicates the page number to retrieve. pageSize: Indicate the page size(number of records) to return in response. sortBy: Specifies that the records to be sorted, Allowed values: timestamp. sortOrder: Specifie thats the records to be ordered, Allowed values: asc or desc. contentId: The unique identifier of the content.