getFavorites

open suspend fun getFavorites(): List<FavoriteLocation>

Retrieves all of the member's favorite locations, each joined with the location's own data (address, coordinates, category, geofence radius), so a list never needs a second fetch per row.

One read returns every relationship once: LocationFavoriteType.FAVORITE, LocationFavoriteType.MUTED and LocationFavoriteType.EXCLUDED. A muted favorite comes back as MUTED, never also as FAVORITE. Filter by FavoriteLocation.favoriteType for what a screen shows: for the member's own list - their favorites, muted or not - drop the EXCLUDED rows; for the active ones only, keep FAVORITE.

Use it for the member's "my gyms" list - it replaces facilities().get(). Favorites mix gyms and retail stores: filter with FavoriteLocation.isFitness wherever only gyms count (a "my gyms" list, a self-report location picker, choosing the primary location).

Android (Kotlin)

lifecycleScope.launch {
try {
val myGyms = AFCore.locations().getFavorites()
.filter { it.favoriteType == LocationFavoriteType.FAVORITE && it.isFitness }
showGyms(myGyms)
} catch (t: Throwable) {
showError(t)
}
}

iOS (Swift)

Task {
do {
let myGyms = try await AFCore.shared.locations().getFavorites()
.filter { $0.favoriteType == .favorite && $0.isFitness }
showGyms(myGyms)
} catch {
showError(error)
}
}

Return

The list of FavoriteLocation; empty when the member has none.

Throws

if the list cannot be retrieved.