Search in sources :

Example 36 with MultipartEntityBuilder

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

the class FursuitsApi method apiV2FursuitsCollectingGameTokensPost.

/**
 *   * Requires authorization     * Requires any of the following roles: **`Developer`**, **`System`**
 * @param tokenValue
 */
public void apiV2FursuitsCollectingGameTokensPost(String tokenValue, final Response.Listener<String> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = tokenValue;
    // create path and map variables
    String path = "/Api/v2/Fursuits/CollectingGame/Tokens".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) CollectTokenResponse(io.swagger.client.model.CollectTokenResponse) ApiSafeResultCollectTokenResponse(io.swagger.client.model.ApiSafeResultCollectTokenResponse) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 37 with MultipartEntityBuilder

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

the class FursuitsApi method apiV2FursuitsBadgesRegistrationPost.

/**
 * Upsert Fursuit Badge information
 *   * Requires authorization     * Requires any of the following roles: **&#x60;Developer&#x60;**, **&#x60;FursuitBadgeSystem&#x60;**, **&#x60;System&#x60;**  This is used by the fursuit badge system to push badge information to this backend.  **Not meant to be consumed by the mobile apps**
 * @param registration
 */
public void apiV2FursuitsBadgesRegistrationPost(FursuitBadgeRegistration registration, final Response.Listener<String> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = registration;
    // create path and map variables
    String path = "/Api/v2/Fursuits/Badges/Registration".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) CollectTokenResponse(io.swagger.client.model.CollectTokenResponse) ApiSafeResultCollectTokenResponse(io.swagger.client.model.ApiSafeResultCollectTokenResponse) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 38 with MultipartEntityBuilder

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

the class FursuitsApi method apiV2FursuitsCollectingGamePlayerParticipationGet.

/**
 *   * Requires authorization     * Requires any of the following roles: **&#x60;Attendee&#x60;**
 */
public void apiV2FursuitsCollectingGamePlayerParticipationGet(final Response.Listener<PlayerParticipationInfo> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/Fursuits/CollectingGame/PlayerParticipation".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 {
        apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener<String>() {

            @Override
            public void onResponse(String localVarResponse) {
                try {
                    responseListener.onResponse((PlayerParticipationInfo) ApiInvoker.deserialize(localVarResponse, "", PlayerParticipationInfo.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) Response(com.android.volley.Response) CollectTokenResponse(io.swagger.client.model.CollectTokenResponse) ApiSafeResultCollectTokenResponse(io.swagger.client.model.ApiSafeResultCollectTokenResponse) PlayerParticipationInfo(io.swagger.client.model.PlayerParticipationInfo) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 39 with MultipartEntityBuilder

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

the class FursuitsApi method apiV2FursuitsCollectingGameTokensBatchPost.

/**
 *   * Requires authorization     * Requires any of the following roles: **&#x60;Developer&#x60;**, **&#x60;System&#x60;**
 * @param tokenValues
 */
public void apiV2FursuitsCollectingGameTokensBatchPost(List<String> tokenValues, final Response.Listener<String> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = tokenValues;
    // create path and map variables
    String path = "/Api/v2/Fursuits/CollectingGame/Tokens/Batch".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) CollectTokenResponse(io.swagger.client.model.CollectTokenResponse) ApiSafeResultCollectTokenResponse(io.swagger.client.model.ApiSafeResultCollectTokenResponse) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 40 with MultipartEntityBuilder

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

the class FursuitsApi method apiV2FursuitsCollectingGameFursuitParticipationScoreboardGet.

/**
 * @param top
 */
public void apiV2FursuitsCollectingGameFursuitParticipationScoreboardGet(Integer top, final Response.Listener<List<FursuitScoreboardEntry>> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/Fursuits/CollectingGame/FursuitParticipation/Scoreboard".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>();
    queryParams.addAll(ApiInvoker.parameterToPairs("", "Top", top));
    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<FursuitScoreboardEntry>) ApiInvoker.deserialize(localVarResponse, "array", FursuitScoreboardEntry.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) Response(com.android.volley.Response) CollectTokenResponse(io.swagger.client.model.CollectTokenResponse) ApiSafeResultCollectTokenResponse(io.swagger.client.model.ApiSafeResultCollectTokenResponse) FursuitScoreboardEntry(io.swagger.client.model.FursuitScoreboardEntry) ArrayList(java.util.ArrayList) List(java.util.List) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Aggregations

MultipartEntityBuilder (org.apache.http.entity.mime.MultipartEntityBuilder)227 HttpEntity (org.apache.http.HttpEntity)166 ArrayList (java.util.ArrayList)126 HashMap (java.util.HashMap)123 VolleyError (com.android.volley.VolleyError)120 ApiException (io.swagger.client.ApiException)120 Pair (io.swagger.client.Pair)120 HttpPost (org.apache.http.client.methods.HttpPost)68 ExecutionException (java.util.concurrent.ExecutionException)61 TimeoutException (java.util.concurrent.TimeoutException)61 Response (com.android.volley.Response)60 File (java.io.File)40 List (java.util.List)40 HttpResponse (org.apache.http.HttpResponse)37 IOException (java.io.IOException)31 Test (org.junit.Test)26 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)22 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)22 StringBody (org.apache.http.entity.mime.content.StringBody)18 ApiSafeResultCollectTokenResponse (io.swagger.client.model.ApiSafeResultCollectTokenResponse)16