i have 2 endpoints give me Category detail. one is like below just give a list of category children:
[{
"id": 5,
"title": "cat1",
"parent": 1
},
{
"id": 4,
"title": "cat2",
"parent": 1
},
{
"id": 2,
"title": "cat3",
"parent": 1
}]
and the other give a category object that contain its parent until root item like below:
{
"id": 5,
"title": "cat1",
"parent": {
"id": 4,
"title": "cat2",
"parent": {
"id": 2,
"title": "cat3",
"parent": {
"id": 1,
"title": "cat4",
"parent": null
}
}
}
}
is it possible handle these endpoints response by one wrapper? what is best solution in this situation?