I'm new to Rxjs (and Angular2 in general) and I'm having trouble understanding the subtleties of RxJS.
I want to make two REST calls to the GitLab API:
Receive all the groups of a certain user (via gitlab.com/api/v4/groups). this will give me back a JSON like this one:
[ { "id": 1511397, "name": "some name", "parent_id": 1505403, ... }, { "id": 1511403, "name": "some other name", "parent_id": 1505403, ... } ]Receive all the projects of per group (via gitlab.com/api/v4/groups/:id) which give you a detailed version of 1 group:
{ "id": 1511397, "name": "group name", "parent_id": 1505403, "projects": [ { "id": 3099499, "description": "project 1" }, { "id": 3099489, "description": "Project 2" } ] }
So basically I need to loop over all ID's given by the first request and deliver an array of group-details:
[
{
"id": 1511397,
"name": "group name",
"parent_id": 1505403,
"projects": [
{
"id": 3099499,
"description": "project 1"
},
{
"id": 3099489,
"description": "Project 2"
}
]
},
{
"id": 1194997,
"name": "a second group name",
"parent_id": 152393,
"projects": [
{
"id": 9423423,
"description": "project 3"
},
{
"id": 2394238,
"description": "Project 4"
}
]
}
]
How can this be done? I already tried something along the lines of switchMap, concatMap and MergeMap, but I never can get it to work...