All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.jfermat.strava.api.GearsApi Maven / Gradle / Ivy

package io.github.jfermat.strava.api;

import io.github.jfermat.strava.invoker.ApiClient;

import io.github.jfermat.strava.model.DetailedGear;
import io.github.jfermat.strava.model.Fault;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

@Component("io.github.jfermat.strava.api.GearsApi")
public class GearsApi {
    private ApiClient apiClient;

    public GearsApi() {
        this(new ApiClient());
    }

    @Autowired
    public GearsApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Get Equipment
     * Returns an equipment using its identifier.
     * 

200 - A representation of the gear. *

0 - Unexpected error. * @param id The identifier of the gear. * @return DetailedGear * @throws RestClientException if an error occurs while attempting to invoke the API */ public DetailedGear getGearById(String id) throws RestClientException { Object postBody = null; // verify the required parameter 'id' is set if (id == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling getGearById"); } // create path and map variables final Map uriVariables = new HashMap(); uriVariables.put("id", id); String path = UriComponentsBuilder.fromPath("/gear/{id}").buildAndExpand(uriVariables).toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "strava_oauth" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy