getLocationTypes

abstract suspend fun getLocationTypes(categoryId: Int? = null, categoryCode: String? = null, activeOnly: Boolean = true): List<LocationTypeDefinition>

Lists the place types a nomination can be filed under, each linked to its category.

Use it to fill the type picker once a category is chosen: the picked LocationTypeDefinition.id is the nomination's LocationNomination.locationTypeId. Like the categories, the types are runtime data.

Android (Kotlin)

lifecycleScope.launch {
try {
val types = AFCore.locations().getLocationTypes(categoryCode = FavoriteLocation.FITNESS_CATEGORY)
showTypePicker(types)
} catch (t: Throwable) {
showError(t)
}
}

iOS (Swift)

Task {
do {
let types = try await AFCore.shared.locations().getLocationTypes(
categoryId: KotlinInt(int: category.id), categoryCode: nil, activeOnly: true
)
showTypePicker(types)
} catch {
showError(error)
}
}

Return

The list of LocationTypeDefinition.

Parameters

categoryId

Optional filter by category id.

categoryCode

Optional filter by category code.

activeOnly

true (default) returns only active types.

Throws

if the list cannot be retrieved. Same empty-200 degradation caveat as getLocationCategories.