so i have an api call that returns Single<List&...
# android
l
so i have an api call that returns Single<List<Spot>>, i want to iterate through that list and make an api call for each spot in that list, then once i get the result of the second api call which will be a Single<List<Forecast> i want to operate on that list. how do i do that?
h
Copy code
fun apiCall(i: Int) = Single.just(i)

    Single
      .just(listOf(1))
      .toObservable()
      .flatMap { it.toObservable() }
      .flatMapSingle(::apiCall)
      .toList()
d
Sounds like you are building a surfing app @lawlorslaw `Spot`s, `Tide`s,
Forecast
... all very familiar domain models to me. 😉
l
Yep I am
d
Is it in prod already? Link me.
It's in beta
Let me know what you think
d
Sweet. Cheers. Will head on over. I would link you mine but alas my API has been down for about a month now 😑 ...my middleware is hosted on Openshift and they are in the middle of a "transition" to charging me bucket tonnes of 💰
l
That's no fun
d
Tell me about it. Saying I can't download in the UK? Feel free to send me an APK in a PM! #security.
l
Oh sorry about that
i limited the distribution to the US since it only shows surf reports for beaches in California. its limited by the public api im using.
d
no worries. If I had my API up and running I’d say you could use that to get coverage over the rest of the world! My API amalgamates data from NOAA, BoM, MetOffice (UK), WaveWatch III models, a XTide instance and WWO to get the swell, tide and weather for spots around the world. Been a labour of love (almost 7 years now since I started it!) …thinking of moving to GCP to avoid the price hikes of Openshift. It’s a free app, don’t want to haemorrhage cash.