I have an API call that returns an observable collection of objects. For each object in that observable collection I need to do another API call to get an observable value.
What is the correct way to merge an observable collection with a collection of observables so that the result is an observable collection where we get rid of extra data ?
I.E: (1:n) -> 1
Concretely:
// getMarkets API response:
[ {
"data": [
{
"mkt_name": "X",
...
},
{...}, {...}, {...}
//there is a lot of these, cardinality changes over time
]}
]
//getTicker(market=X) API response:
[ {
"data": [
{
"last_trade": "651.4000000000",
...
}
//there is only one of this, "last_trade" value changes a lot more over time
],
"notifications": []
}
]
and I need
//getMarketsWithTickers Service response (! Also Observable !)
[
{"market" : "X", "last_trade" : "651.4000000000" },
{...},
{...},
{...}
]
How do I implement getMarketWithTickers
using getMarkets
/getTicker
observables ?
NOTE: I am new to this whole RxJS thing.
Thanks