If the POST / PATCH body needs to look like this
{
"class_name" : {
"field_a" : "fjdksljf"
"field_b" : "jfsljd"
...
etc.
}
}
and I have a POJO
public class ClassName () {
@SerializedName("field_a")
String fieldA;
@SerializedName("field_b")
String fieldB;
... etc.
}
and I want to pass it as
@PATCH("endpoint_url")
Call<ResponseBody> testFunction(@Body ClassName class)
How can I annotate the class itself with the class_name
mapping needed for the JSON request without creating a RequestClass that wraps ClassName and annotates it with serialized name there?
(I tried annotating the class with @SerializedName
but it gives me a "not applicable to type" warning.)