Search in sources :

Example 1 with EventCreateResponse

use of in.ac.iitb.gymkhana.iitbapp.api.model.EventCreateResponse in project IITB-App by wncc.

the class AddEventFragment method addEvent.

public void addEvent(String eventImageURL) {
    progressDialog.setMessage("Creating Event");
    EventCreateRequest eventCreateRequest = new EventCreateRequest(eventName.getText().toString(), details.getText().toString(), eventImageURL, timestamp_start.toString(), timestamp_end.toString(), false, Arrays.asList(new String[] { venue.getText().toString() }), Arrays.asList(new String[] { "bde82d5e-f379-4b8a-ae38-a9f03e4f1c4a" }));
    RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
    retrofitInterface.createEvent("sessionid=" + getArguments().getString(SESSION_ID), eventCreateRequest).enqueue(new Callback<EventCreateResponse>() {

        @Override
        public void onResponse(Call<EventCreateResponse> call, Response<EventCreateResponse> response) {
            Toast.makeText(getContext(), "Event Created", Toast.LENGTH_SHORT).show();
            progressDialog.dismiss();
        }

        @Override
        public void onFailure(Call<EventCreateResponse> call, Throwable t) {
            Toast.makeText(getContext(), "Event Creation Failed", Toast.LENGTH_SHORT).show();
            progressDialog.dismiss();
        }
    });
}
Also used : EventCreateResponse(in.ac.iitb.gymkhana.iitbapp.api.model.EventCreateResponse) EventCreateRequest(in.ac.iitb.gymkhana.iitbapp.api.model.EventCreateRequest) RetrofitInterface(in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface)

Aggregations

RetrofitInterface (in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface)1 EventCreateRequest (in.ac.iitb.gymkhana.iitbapp.api.model.EventCreateRequest)1 EventCreateResponse (in.ac.iitb.gymkhana.iitbapp.api.model.EventCreateResponse)1