app.cybrid.cybrid_api_bank.client.api.BanksBankApi 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.BankBankModel;
import app.cybrid.cybrid_api_bank.client.model.BankListBankModel;
import app.cybrid.cybrid_api_bank.client.model.ErrorResponseBankModel;
import app.cybrid.cybrid_api_bank.client.model.PatchBankBankModel;
import app.cybrid.cybrid_api_bank.client.model.PostBankBankModel;
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-18T18:47:55.865917Z[Etc/UTC]")
public class BanksBankApi {
private ApiClient apiClient;
public BanksBankApi() {
this(new ApiClient());
}
@Autowired
public BanksBankApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create Bank
* Creates a bank. ## Bank Type Bank's can be created in either `sandbox` or `production` mode. Sandbox Banks will not transact in real fiat dollars or cryptocurrencies. Via the API, only `sandbox` banks can be created. In order to enable a `production` bank please contact [Support](mailto:[email protected]). Required scope: **banks:execute**
* 201 - Bank created
*
401 - Unauthorized
*
403 - Forbidden
*
422 - Unprocessable Content
* @param postBankBankModel The postBankBankModel parameter
* @return BankBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec createBankRequestCreation(PostBankBankModel postBankBankModel) throws WebClientResponseException {
Object postBody = postBankBankModel;
// verify the required parameter 'postBankBankModel' is set
if (postBankBankModel == null) {
throw new WebClientResponseException("Missing the required parameter 'postBankBankModel' when calling createBank", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, 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();
final String[] localVarAccepts = {
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "BearerAuth", "oauth2" };
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI("/api/banks", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Create Bank
* Creates a bank. ## Bank Type Bank's can be created in either `sandbox` or `production` mode. Sandbox Banks will not transact in real fiat dollars or cryptocurrencies. Via the API, only `sandbox` banks can be created. In order to enable a `production` bank please contact [Support](mailto:[email protected]). Required scope: **banks:execute**
* 201 - Bank created
*
401 - Unauthorized
*
403 - Forbidden
*
422 - Unprocessable Content
* @param postBankBankModel The postBankBankModel parameter
* @return BankBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono createBank(PostBankBankModel postBankBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createBankRequestCreation(postBankBankModel).bodyToMono(localVarReturnType);
}
public Mono> createBankWithHttpInfo(PostBankBankModel postBankBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createBankRequestCreation(postBankBankModel).toEntity(localVarReturnType);
}
/**
* Get Bank
* Retrieves a bank. Required scope: **banks:read**
* 200 - bank found
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
*
404 - bank not found
* @param bankGuid Identifier for the bank.
* @return BankBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec getBankRequestCreation(String bankGuid) throws WebClientResponseException {
Object postBody = null;
// verify the required parameter 'bankGuid' is set
if (bankGuid == null) {
throw new WebClientResponseException("Missing the required parameter 'bankGuid' when calling getBank", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// create path and map variables
final Map pathParams = new HashMap();
pathParams.put("bank_guid", bankGuid);
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap cookieParams = new LinkedMultiValueMap();
final MultiValueMap formParams = new LinkedMultiValueMap();
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/banks/{bank_guid}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get Bank
* Retrieves a bank. Required scope: **banks:read**
* 200 - bank found
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
*
404 - bank not found
* @param bankGuid Identifier for the bank.
* @return BankBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono getBank(String bankGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return getBankRequestCreation(bankGuid).bodyToMono(localVarReturnType);
}
public Mono> getBankWithHttpInfo(String bankGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return getBankRequestCreation(bankGuid).toEntity(localVarReturnType);
}
/**
* Get banks list
* Retrieves a listing of bank. Required scope: **banks:read**
* 200 - get list of banks
*
401 - Unauthorized - invalid subject, Authentication failed
*
403 - Invalid scope
* @param page The page index to retrieve.
* @param perPage The number of entities per page to return.
* @param type Comma separated types to list banks for.
* @param guid Comma separated bank_guids to list banks for.
* @return BankListBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec listBanksRequestCreation(java.math.BigInteger page, java.math.BigInteger perPage, String type, String guid) 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, "page", page));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "per_page", perPage));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "type", type));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "guid", guid));
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/banks", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get banks list
* Retrieves a listing of bank. Required scope: **banks:read**
* 200 - get list of banks
*
401 - Unauthorized - invalid subject, Authentication failed
*
403 - Invalid scope
* @param page The page index to retrieve.
* @param perPage The number of entities per page to return.
* @param type Comma separated types to list banks for.
* @param guid Comma separated bank_guids to list banks for.
* @return BankListBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono listBanks(java.math.BigInteger page, java.math.BigInteger perPage, String type, String guid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listBanksRequestCreation(page, perPage, type, guid).bodyToMono(localVarReturnType);
}
public Mono> listBanksWithHttpInfo(java.math.BigInteger page, java.math.BigInteger perPage, String type, String guid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listBanksRequestCreation(page, perPage, type, guid).toEntity(localVarReturnType);
}
/**
* Patch Bank
* Update a bank. Required scope: **banks:write**
* 200 - bank found
*
401 - Unauthorized
*
403 - Forbidden
*
422 - Unprocessable Content
* @param bankGuid Identifier for the bank.
* @param patchBankBankModel The patchBankBankModel parameter
* @return BankBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec updateBankRequestCreation(String bankGuid, PatchBankBankModel patchBankBankModel) throws WebClientResponseException {
Object postBody = patchBankBankModel;
// verify the required parameter 'bankGuid' is set
if (bankGuid == null) {
throw new WebClientResponseException("Missing the required parameter 'bankGuid' when calling updateBank", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// verify the required parameter 'patchBankBankModel' is set
if (patchBankBankModel == null) {
throw new WebClientResponseException("Missing the required parameter 'patchBankBankModel' when calling updateBank", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// create path and map variables
final Map pathParams = new HashMap();
pathParams.put("bank_guid", bankGuid);
final MultiValueMap queryParams = new LinkedMultiValueMap();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap cookieParams = new LinkedMultiValueMap();
final MultiValueMap formParams = new LinkedMultiValueMap();
final String[] localVarAccepts = {
"application/json"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "BearerAuth", "oauth2" };
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI("/api/banks/{bank_guid}", HttpMethod.PATCH, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Patch Bank
* Update a bank. Required scope: **banks:write**
* 200 - bank found
*
401 - Unauthorized
*
403 - Forbidden
*
422 - Unprocessable Content
* @param bankGuid Identifier for the bank.
* @param patchBankBankModel The patchBankBankModel parameter
* @return BankBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono updateBank(String bankGuid, PatchBankBankModel patchBankBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return updateBankRequestCreation(bankGuid, patchBankBankModel).bodyToMono(localVarReturnType);
}
public Mono> updateBankWithHttpInfo(String bankGuid, PatchBankBankModel patchBankBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return updateBankRequestCreation(bankGuid, patchBankBankModel).toEntity(localVarReturnType);
}
}