Search in sources :

Example 1 with AnnouncementRecord

use of io.swagger.client.model.AnnouncementRecord in project ef-app_android by eurofurence.

the class AnnouncementsApi method apiV2AnnouncementsGet.

/**
 * Retrieves a list of all announcement entries.
 */
public void apiV2AnnouncementsGet(final Response.Listener<List<AnnouncementRecord>> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/Announcements".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<AnnouncementRecord>) ApiInvoker.deserialize(localVarResponse, "array", AnnouncementRecord.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) ArrayList(java.util.ArrayList) AnnouncementRecord(io.swagger.client.model.AnnouncementRecord) Response(com.android.volley.Response) ArrayList(java.util.ArrayList) List(java.util.List) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 2 with AnnouncementRecord

use of io.swagger.client.model.AnnouncementRecord in project ef-app_android by eurofurence.

the class AnnouncementsApi method apiV2AnnouncementsGet.

/**
 * Retrieves a list of all announcement entries.
 *
 * @return List<AnnouncementRecord>
 */
public List<AnnouncementRecord> apiV2AnnouncementsGet() throws TimeoutException, ExecutionException, InterruptedException, ApiException {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/Announcements".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<AnnouncementRecord>) ApiInvoker.deserialize(localVarResponse, "array", AnnouncementRecord.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) AnnouncementRecord(io.swagger.client.model.AnnouncementRecord) 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 3 with AnnouncementRecord

use of io.swagger.client.model.AnnouncementRecord in project ef-app_android by eurofurence.

the class AnnouncementsApi method apiV2AnnouncementsByIdGet.

/**
 * Retrieve a single announcement.
 *
 * @param id id of the requested entity
 * @return AnnouncementRecord
 */
public AnnouncementRecord apiV2AnnouncementsByIdGet(UUID id) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
    Object postBody = null;
    // verify the required parameter 'id' is set
    if (id == null) {
        VolleyError error = new VolleyError("Missing the required parameter 'id' when calling apiV2AnnouncementsByIdGet", new ApiException(400, "Missing the required parameter 'id' when calling apiV2AnnouncementsByIdGet"));
    }
    // create path and map variables
    String path = "/Api/v2/Announcements/{Id}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "id" + "\\}", apiInvoker.escapeString(id.toString()));
    // 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 (AnnouncementRecord) ApiInvoker.deserialize(localVarResponse, "", AnnouncementRecord.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) AnnouncementRecord(io.swagger.client.model.AnnouncementRecord) ExecutionException(java.util.concurrent.ExecutionException) ApiException(io.swagger.client.ApiException) Pair(io.swagger.client.Pair) TimeoutException(java.util.concurrent.TimeoutException)

Example 4 with AnnouncementRecord

use of io.swagger.client.model.AnnouncementRecord in project ef-app_android by eurofurence.

the class AnnouncementsApi method apiV2AnnouncementsByIdGet.

/**
 * Retrieve a single announcement.
 *
 * @param id id of the requested entity
 */
public void apiV2AnnouncementsByIdGet(UUID id, final Response.Listener<AnnouncementRecord> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = null;
    // verify the required parameter 'id' is set
    if (id == null) {
        VolleyError error = new VolleyError("Missing the required parameter 'id' when calling apiV2AnnouncementsByIdGet", new ApiException(400, "Missing the required parameter 'id' when calling apiV2AnnouncementsByIdGet"));
    }
    // create path and map variables
    String path = "/Api/v2/Announcements/{Id}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "id" + "\\}", apiInvoker.escapeString(id.toString()));
    // 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((AnnouncementRecord) ApiInvoker.deserialize(localVarResponse, "", AnnouncementRecord.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) ArrayList(java.util.ArrayList) AnnouncementRecord(io.swagger.client.model.AnnouncementRecord) Response(com.android.volley.Response) ApiException(io.swagger.client.ApiException) Pair(io.swagger.client.Pair)

Aggregations

VolleyError (com.android.volley.VolleyError)4 ApiException (io.swagger.client.ApiException)4 Pair (io.swagger.client.Pair)4 AnnouncementRecord (io.swagger.client.model.AnnouncementRecord)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 HttpEntity (org.apache.http.HttpEntity)4 MultipartEntityBuilder (org.apache.http.entity.mime.MultipartEntityBuilder)4 Response (com.android.volley.Response)2 List (java.util.List)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2