I am using Retrofit 2 in my project my app get data from tow APIs api1 and api2
api1 :-
[{"id":"29867","category_id":"31","author":"admins",
"title":"hi","abstract":"","image_name":"","created":"11","body":"hi"},
{"id":"29866","category_id":"14","author":"admins",
"title":"hi2","abstract":"","image_name":"img.png","created":"2017-11-16 16:02:00","body":"heloo"}]
and api2 :-
[{"obj":"29867","category_id":"31","obj2":"admins",
"title":"hi","abstract":"","image_name":"","created":"11","obj3":"hi"},
{"obj":"29866","category_id":"14","author":"admins",
"obj2":"hi2","abstract":"","image_name":"Img.png","created":"2017-11-16 16:02:00","obj3":"Hello"}]
i want to make one POJO class for both APIs like
class API_class{
var list:List<api1> =null
var list2:List<pi2> =null
}
class api1{
@SerializedName("id")
@Expose
var id: Int? = null
.
.
.
}
class api2{
@SerializedName("obj")
@Expose
var obj: Int? = null
.
.
.
}
i try something like the above but it doesn't work for me i want to do like this so i can use one call function like this
retrofit.enqueue(object: Callback<API_class> {
override fun onResponse(call: Call<API_class>?, response: Response<API_class>?) {.
.
.
.
}
if the api1 and api2 was object Json like this
{json:"ddd"
[.....]
}
i will be able to do my idea but it's now impossible