Search in sources :

Example 1 with PlayerScoreboardEntry

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

the class FursuitsApi method apiV2FursuitsCollectingGamePlayerParticipationScoreboardGet.

/**
 * @param top
 */
public void apiV2FursuitsCollectingGamePlayerParticipationScoreboardGet(Integer top, final Response.Listener<List<PlayerScoreboardEntry>> responseListener, final Response.ErrorListener errorListener) {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/Fursuits/CollectingGame/PlayerParticipation/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<PlayerScoreboardEntry>) ApiInvoker.deserialize(localVarResponse, "array", PlayerScoreboardEntry.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) PlayerScoreboardEntry(io.swagger.client.model.PlayerScoreboardEntry) ArrayList(java.util.ArrayList) List(java.util.List) Pair(io.swagger.client.Pair) ApiException(io.swagger.client.ApiException)

Example 2 with PlayerScoreboardEntry

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

the class FursuitsApi method apiV2FursuitsCollectingGamePlayerParticipationScoreboardGet.

/**
 * @param top
 * @return List<PlayerScoreboardEntry>
 */
public List<PlayerScoreboardEntry> apiV2FursuitsCollectingGamePlayerParticipationScoreboardGet(Integer top) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
    Object postBody = null;
    // create path and map variables
    String path = "/Api/v2/Fursuits/CollectingGame/PlayerParticipation/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 {
        String localVarResponse = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
        if (localVarResponse != null) {
            return (List<PlayerScoreboardEntry>) ApiInvoker.deserialize(localVarResponse, "array", PlayerScoreboardEntry.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) PlayerScoreboardEntry(io.swagger.client.model.PlayerScoreboardEntry) 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

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