app.cybrid.cybrid_api_bank.client.api.PricesBankApi Maven / Gradle / Ivy
package app.cybrid.cybrid_api_bank.client.api;
import app.cybrid.cybrid_api_bank.client.ApiClient;
import app.cybrid.cybrid_api_bank.client.model.ErrorResponseBankModel;
import app.cybrid.cybrid_api_bank.client.model.SymbolPriceBankModel;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.web.reactive.function.client.WebClient.ResponseSpec;
import org.springframework.web.reactive.function.client.WebClientResponseException;
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;
import org.springframework.http.ResponseEntity;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-11-15T16:37:52.482761Z[Etc/UTC]")
public class PricesBankApi {
private ApiClient apiClient;
public PricesBankApi() {
this(new ApiClient());
}
@Autowired
public PricesBankApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Get Price
* Retrieves a listing of symbol prices. ## Symbols Symbol are pairs and are in the format asset-counter_asset, e.g., 'BTC-USD' for the Bitcoin/ USD pair. See the Symbols API for a complete list of cryptocurrencies supported. Required scope: **prices:read**
* 200 - get list of price
*
400 - Invalid requests
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
* @param symbol Comma separated symbols to list prices for.
* @param bankGuid The bank identifier to retrieve prices for.
* @return List<SymbolPriceBankModel>
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec listPricesRequestCreation(String symbol, String bankGuid) throws WebClientResponseException {
Object postBody = null;
// create path and map variables
final Map pathParams = new HashMap();
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap cookieParams = new LinkedMultiValueMap();
final MultiValueMap formParams = new LinkedMultiValueMap();
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "symbol", symbol));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "bank_guid", bankGuid));
final String[] localVarAccepts = {
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = { };
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "BearerAuth", "oauth2" };
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI("/api/prices", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get Price
* Retrieves a listing of symbol prices. ## Symbols Symbol are pairs and are in the format asset-counter_asset, e.g., 'BTC-USD' for the Bitcoin/ USD pair. See the Symbols API for a complete list of cryptocurrencies supported. Required scope: **prices:read**
* 200 - get list of price
*
400 - Invalid requests
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
* @param symbol Comma separated symbols to list prices for.
* @param bankGuid The bank identifier to retrieve prices for.
* @return List<SymbolPriceBankModel>
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Flux listPrices(String symbol, String bankGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listPricesRequestCreation(symbol, bankGuid).bodyToFlux(localVarReturnType);
}
public Mono>> listPricesWithHttpInfo(String symbol, String bankGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listPricesRequestCreation(symbol, bankGuid).toEntityList(localVarReturnType);
}
}