get-available-addons.md 1.78 KB
Newer Older
MickeyMoz's avatar
MickeyMoz committed
1
2
3
4
[android-components](../../index.md) / [mozilla.components.feature.addons.amo](../index.md) / [AddonCollectionProvider](index.md) / [getAvailableAddons](./get-available-addons.md)

# getAvailableAddons

MickeyMoz's avatar
MickeyMoz committed
5
`suspend fun getAvailableAddons(allowCache: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`, readTimeoutInSeconds: `[`Long`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`?): `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`Addon`](../../mozilla.components.feature.addons/-addon/index.md)`>` [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/feature/addons/src/main/java/mozilla/components/feature/addons/amo/AddonCollectionProvider.kt#L82)
MickeyMoz's avatar
MickeyMoz committed
6
7
8
9

Overrides [AddonsProvider.getAvailableAddons](../../mozilla.components.feature.addons/-addons-provider/get-available-addons.md)

Interacts with the collections endpoint to provide a list of available
MickeyMoz's avatar
MickeyMoz committed
10
11
12
add-ons. May return a cached response, if [allowCache](get-available-addons.md#mozilla.components.feature.addons.amo.AddonCollectionProvider$getAvailableAddons(kotlin.Boolean, kotlin.Long)/allowCache) is true, and the
cache is not expired (see [maxCacheAgeInMinutes](#)) or fetching from
AMO failed.
MickeyMoz's avatar
MickeyMoz committed
13
14
15
16

### Parameters

`allowCache` - whether or not the result may be provided
MickeyMoz's avatar
MickeyMoz committed
17
18
from a previously cached response, defaults to true. Note that
[maxCacheAgeInMinutes](#) must be set for the cache to be active.
MickeyMoz's avatar
MickeyMoz committed
19
20
21
22
23
24
25
26
27

`readTimeoutInSeconds` - optional timeout in seconds to use when fetching
available add-ons from a remote endpoint. If not specified [DEFAULT_READ_TIMEOUT_IN_SECONDS](#)
will be used.

### Exceptions

`IOException` - if the request failed, or could not be executed due to cancellation,
a connectivity problem or a timeout.