How to Handle Two Different Response in Retrofit

前端 未结 4 567
青春惊慌失措
青春惊慌失措 2021-01-06 08:10

I followed this to POST Data Using Retrofit2

I Used JSON POJO to Parse my POST and GET files

So Here If Data inside the Records Is there I will get This Kind

4条回答
  •  醉梦人生
    2021-01-06 08:58

    class Response {
            private String status;
            private T response;
    
            private boolean isSuccess() {
                return status.equals("200");
            }
        }
    
        class ListData {
            private String cnt_id;
            private String phn_no;
            private String dat_cnt;
        }
    
        class Error {
            private String msg;
        }
    
        public class MainResponse {
            @SerializedName("Error")
            private Error error;
            @SerializedName("AuthenticateUserResponse")
            private List listData;
        }
    
    @POST("listData")
    Call> listData();
    

提交回复
热议问题