android-components / mozilla.components.feature.addons.amo / AddonCollectionProvider

AddonCollectionProvider

class AddonCollectionProvider : AddonsProvider (source)

Provide access to the AMO collections API. https://addons-server.readthedocs.io/en/latest/topics/api/collections.html

Constructors

Name Summary
<init> AddonCollectionProvider(context: <ERROR CLASS>, client: Client, serverURL: String = DEFAULT_SERVER_URL, collectionName: String = DEFAULT_COLLECTION_NAME, maxCacheAgeInMinutes: Long = -1)
Provide access to the AMO collections API. https://addons-server.readthedocs.io/en/latest/topics/api/collections.html

Functions

Name Summary
getAddonIconBitmap suspend fun getAddonIconBitmap(addon: Addon): <ERROR CLASS>?
Fetches given Addon icon from the url and returns a decoded Bitmap
getAvailableAddons suspend fun getAvailableAddons(allowCache: Boolean, readTimeoutInSeconds: Long?): List<Addon>
Interacts with the collections endpoint to provide a list of available add-ons. May return a cached response, if allowCache is true, and the cache is not expired (see maxCacheAgeInMinutes) or fetching from AMO failed.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.