Search in sources :

Example 76 with MultipartEntityBuilder

use of org.apache.http.entity.mime.MultipartEntityBuilder in project ef-app_android by eurofurence.

the class DealersApi method apiV2DealersGet.

/**
 * Retrieves a list of all dealer entries.
 *
 * @return List<DealerRecord>
 */
public List<DealerRecord> apiV2DealersGet() throws TimeoutException, ExecutionException, InterruptedException, ApiException {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/Dealers".replaceAll("\\{format\\}", "json");
    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    // header params
    Map<String, String> headerParams = new HashMap<String, String>();
    // form params
    Map<String, String> formParams = new HashMap<String, String>();
    String[] contentTypes = {};
    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
    if (contentType.startsWith("multipart/form-data")) {
        // file uploading
        MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
        HttpEntity httpEntity = localVarBuilder.build();
        postBody = httpEntity;
    } else {
    // normal form params
    }
    String[] authNames = new String[] {};
    try {
        String localVarResponse = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
        if (localVarResponse != null) {
            return (List<DealerRecord>) ApiInvoker.deserialize(localVarResponse, "array", DealerRecord.class);
        } else {
            return null;
        }
    } catch (ApiException ex) {
        throw ex;
    } catch (InterruptedException ex) {
        throw ex;
    } catch (ExecutionException ex) {
        if (ex.getCause() instanceof VolleyError) {
            VolleyError volleyError = (VolleyError) ex.getCause();
            if (volleyError.networkResponse != null) {
                throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
            }
        }
        throw ex;
    } catch (TimeoutException ex) {
        throw ex;
    }
}
Also used : VolleyError(com.android.volley.VolleyError) MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) HttpEntity(org.apache.http.HttpEntity) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DealerRecord(io.swagger.client.model.DealerRecord) ArrayList(java.util.ArrayList) List(java.util.List) ExecutionException(java.util.concurrent.ExecutionException) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException) TimeoutException(java.util.concurrent.TimeoutException)

Example 77 with MultipartEntityBuilder

use of org.apache.http.entity.mime.MultipartEntityBuilder in project ef-app_android by eurofurence.

the class EventConferenceDaysApi method apiV2EventConferenceDaysGet.

/**
 * Retrieves a list of all event conference days in the event schedule.
 */
public void apiV2EventConferenceDaysGet(final Response.Listener<List<EventConferenceDayRecord>> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/EventConferenceDays".replaceAll("\\{format\\}", "json");
    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    // header params
    Map<String, String> headerParams = new HashMap<String, String>();
    // form params
    Map<String, String> formParams = new HashMap<String, String>();
    String[] contentTypes = {};
    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
    if (contentType.startsWith("multipart/form-data")) {
        // file uploading
        MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
        HttpEntity httpEntity = localVarBuilder.build();
        postBody = httpEntity;
    } else {
    // normal form params
    }
    String[] authNames = new String[] {};
    try {
        apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener<String>() {

            @Override
            public void onResponse(String localVarResponse) {
                try {
                    responseListener.onResponse((List<EventConferenceDayRecord>) ApiInvoker.deserialize(localVarResponse, "array", EventConferenceDayRecord.class));
                } catch (ApiException exception) {
                    errorListener.onErrorResponse(new VolleyError(exception));
                }
            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
                errorListener.onErrorResponse(error);
            }
        });
    } catch (ApiException ex) {
        errorListener.onErrorResponse(new VolleyError(ex));
    }
}
Also used : VolleyError(com.android.volley.VolleyError) MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) HttpEntity(org.apache.http.HttpEntity) HashMap(java.util.HashMap) EventConferenceDayRecord(io.swagger.client.model.EventConferenceDayRecord) ArrayList(java.util.ArrayList) Response(com.android.volley.Response) ArrayList(java.util.ArrayList) List(java.util.List) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 78 with MultipartEntityBuilder

use of org.apache.http.entity.mime.MultipartEntityBuilder in project ef-app_android by eurofurence.

the class EventConferenceDaysApi method apiV2EventConferenceDaysGet.

/**
 * Retrieves a list of all event conference days in the event schedule.
 *
 * @return List<EventConferenceDayRecord>
 */
public List<EventConferenceDayRecord> apiV2EventConferenceDaysGet() throws TimeoutException, ExecutionException, InterruptedException, ApiException {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/EventConferenceDays".replaceAll("\\{format\\}", "json");
    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    // header params
    Map<String, String> headerParams = new HashMap<String, String>();
    // form params
    Map<String, String> formParams = new HashMap<String, String>();
    String[] contentTypes = {};
    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
    if (contentType.startsWith("multipart/form-data")) {
        // file uploading
        MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
        HttpEntity httpEntity = localVarBuilder.build();
        postBody = httpEntity;
    } else {
    // normal form params
    }
    String[] authNames = new String[] {};
    try {
        String localVarResponse = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
        if (localVarResponse != null) {
            return (List<EventConferenceDayRecord>) ApiInvoker.deserialize(localVarResponse, "array", EventConferenceDayRecord.class);
        } else {
            return null;
        }
    } catch (ApiException ex) {
        throw ex;
    } catch (InterruptedException ex) {
        throw ex;
    } catch (ExecutionException ex) {
        if (ex.getCause() instanceof VolleyError) {
            VolleyError volleyError = (VolleyError) ex.getCause();
            if (volleyError.networkResponse != null) {
                throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
            }
        }
        throw ex;
    } catch (TimeoutException ex) {
        throw ex;
    }
}
Also used : VolleyError(com.android.volley.VolleyError) MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) HttpEntity(org.apache.http.HttpEntity) HashMap(java.util.HashMap) EventConferenceDayRecord(io.swagger.client.model.EventConferenceDayRecord) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ExecutionException(java.util.concurrent.ExecutionException) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException) TimeoutException(java.util.concurrent.TimeoutException)

Example 79 with MultipartEntityBuilder

use of org.apache.http.entity.mime.MultipartEntityBuilder in project ef-app_android by eurofurence.

the class EventFeedbackApi method apiV2EventFeedbackPost.

/**
 *   * Requires authorization     * Requires any of the following roles: **&#x60;Attendee&#x60;**, **&#x60;Developer&#x60;**, **&#x60;System&#x60;**
 * @param record
 */
public void apiV2EventFeedbackPost(EventFeedbackRecord record, final Response.Listener<String> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = record;
    // create path and map variables
    String path = "/Api/v2/EventFeedback".replaceAll("\\{format\\}", "json");
    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    // header params
    Map<String, String> headerParams = new HashMap<String, String>();
    // form params
    Map<String, String> formParams = new HashMap<String, String>();
    String[] contentTypes = { "application/json", "text/json", "application/json-patch+json" };
    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
    if (contentType.startsWith("multipart/form-data")) {
        // file uploading
        MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
        HttpEntity httpEntity = localVarBuilder.build();
        postBody = httpEntity;
    } else {
    // normal form params
    }
    String[] authNames = new String[] { "Bearer" };
    try {
        apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener<String>() {

            @Override
            public void onResponse(String localVarResponse) {
                responseListener.onResponse(localVarResponse);
            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
                errorListener.onErrorResponse(error);
            }
        });
    } catch (ApiException ex) {
        errorListener.onErrorResponse(new VolleyError(ex));
    }
}
Also used : VolleyError(com.android.volley.VolleyError) MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) HttpEntity(org.apache.http.HttpEntity) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Response(com.android.volley.Response) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 80 with MultipartEntityBuilder

use of org.apache.http.entity.mime.MultipartEntityBuilder in project ef-app_android by eurofurence.

the class EventFeedbackApi method apiV2EventFeedbackGet.

/**
 *   * Requires authorization     * Requires any of the following roles: **&#x60;Attendee&#x60;**, **&#x60;Developer&#x60;**, **&#x60;System&#x60;**
 * @return List<EventFeedbackRecord>
 */
public List<EventFeedbackRecord> apiV2EventFeedbackGet() throws TimeoutException, ExecutionException, InterruptedException, ApiException {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/EventFeedback".replaceAll("\\{format\\}", "json");
    // query params
    List<Pair> queryParams = new ArrayList<Pair>();
    // header params
    Map<String, String> headerParams = new HashMap<String, String>();
    // form params
    Map<String, String> formParams = new HashMap<String, String>();
    String[] contentTypes = {};
    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
    if (contentType.startsWith("multipart/form-data")) {
        // file uploading
        MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
        HttpEntity httpEntity = localVarBuilder.build();
        postBody = httpEntity;
    } else {
    // normal form params
    }
    String[] authNames = new String[] { "Bearer" };
    try {
        String localVarResponse = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
        if (localVarResponse != null) {
            return (List<EventFeedbackRecord>) ApiInvoker.deserialize(localVarResponse, "array", EventFeedbackRecord.class);
        } else {
            return null;
        }
    } catch (ApiException ex) {
        throw ex;
    } catch (InterruptedException ex) {
        throw ex;
    } catch (ExecutionException ex) {
        if (ex.getCause() instanceof VolleyError) {
            VolleyError volleyError = (VolleyError) ex.getCause();
            if (volleyError.networkResponse != null) {
                throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
            }
        }
        throw ex;
    } catch (TimeoutException ex) {
        throw ex;
    }
}
Also used : VolleyError(com.android.volley.VolleyError) EventFeedbackRecord(io.swagger.client.model.EventFeedbackRecord) MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) HttpEntity(org.apache.http.HttpEntity) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ExecutionException(java.util.concurrent.ExecutionException) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

MultipartEntityBuilder (org.apache.http.entity.mime.MultipartEntityBuilder)213 HttpEntity (org.apache.http.HttpEntity)161 ArrayList (java.util.ArrayList)126 HashMap (java.util.HashMap)122 VolleyError (com.android.volley.VolleyError)120 ApiException (io.swagger.client.ApiException)120 Pair (io.swagger.client.Pair)120 ExecutionException (java.util.concurrent.ExecutionException)61 TimeoutException (java.util.concurrent.TimeoutException)61 Response (com.android.volley.Response)60 HttpPost (org.apache.http.client.methods.HttpPost)59 List (java.util.List)40 File (java.io.File)37 HttpResponse (org.apache.http.HttpResponse)33 IOException (java.io.IOException)26 Test (org.junit.Test)25 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)17 ApiSafeResultCollectTokenResponse (io.swagger.client.model.ApiSafeResultCollectTokenResponse)16 CollectTokenResponse (io.swagger.client.model.CollectTokenResponse)15 StringBody (org.apache.http.entity.mime.content.StringBody)15