Search in sources :

Example 1 with CommentCreateRequest

use of app.insti.api.request.CommentCreateRequest in project IITB-App by wncc.

the class ComplaintDetailsFragment method postComment.

private void postComment() {
    final CommentCreateRequest commentCreateRequest = new CommentCreateRequest(editTextComment.getText().toString());
    RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
    retrofitInterface.postComment(Utils.getSessionIDHeader(), cId, commentCreateRequest).enqueue(new Callback<Venter.Comment>() {

        @Override
        public void onResponse(Call<Venter.Comment> call, Response<Venter.Comment> response) {
            if (response.isSuccessful()) {
                Venter.Comment comment = response.body();
                addNewComment(comment);
                editTextComment.setText(null);
            }
        }

        @Override
        public void onFailure(Call<Venter.Comment> call, Throwable t) {
            Log.i(TAG, "failure in posting comments: " + t.toString());
        }
    });
}
Also used : CommentCreateRequest(app.insti.api.request.CommentCreateRequest) RetrofitInterface(app.insti.api.RetrofitInterface)

Aggregations

RetrofitInterface (app.insti.api.RetrofitInterface)1 CommentCreateRequest (app.insti.api.request.CommentCreateRequest)1