removeFavorite

abstract suspend fun removeFavorite(locationId: Long): AFResult

Removes a location from the member's favorites.

Use it for a "Remove from favorites" action - it replaces facilities().delete(id), and the legacy club id (Facility.id) is accepted in place of the canonical location id. A running visit-detection session drops the location's geofence. A muted favorite loses its mute too, so it leaves the list. To keep the location but pause its notifications and visits, use muteFavorite.

Android (Kotlin)

lifecycleScope.launch {
try {
AFCore.locations().removeFavorite(locationId = favorite.locationId)
refreshFavorites()
} catch (t: Throwable) {
showError(t)
}
}

iOS (Swift)

Task {
do {
_ = try await AFCore.shared.locations().removeFavorite(locationId: favorite.locationId)
refreshFavorites()
} catch {
showError(error)
}
}

Return

AFResult with status = true - the server answers 204 with no body, so there is no list to return.

Parameters

locationId

Canonical location id (a legacy club id is resolved server-side; 409 when ambiguous).

Throws

if the request fails - 404 when the location is neither a favorite nor muted.