app.cybrid.cybrid_api_bank.client.api.AccountsBankApi 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.AccountBankModel;
import app.cybrid.cybrid_api_bank.client.model.AccountListBankModel;
import app.cybrid.cybrid_api_bank.client.model.ErrorResponseBankModel;
import app.cybrid.cybrid_api_bank.client.model.PostAccountBankModel;
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 AccountsBankApi {
private ApiClient apiClient;
public AccountsBankApi() {
this(new ApiClient());
}
@Autowired
public AccountsBankApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create Account
* Creates an account. ## Account Type An Account is tied to a specific cryptocurrency or fiat and is comprised of transactions and a current balance. An account is required to allow a Bank or Customer to hold cryptocurrency or a Customer to hold fiat on the Cybrid Platform. At present, accounts can be created as `trading`, `storage` or `fiat ` accounts and are required before a Customer can generate quotes or execute a `trade` or `transfer`. To create accounts for your Bank, omit the `customer_guid` parameter in the request body. To create accounts for your Customers, include the `customer_guid` parameter in the request body. At the bank level, `invoice_operations` accounts can be configured to pre-fund your customers' Lightning Network operations. ## Asset The asset is the specific cryptocurrency or fiat that the account holds, e.g., 'BTC' for Bitcoin or `USD` for US dollars. See the Symbols API for a complete list of cryptocurrencies and fiat supported. ## State | State | Description | |-------|-------------| | storing | The Platform is storing the account details in our private store | | created | The Platform has created the account | Required scope: **accounts:execute**
* 201 - account created
*
400 - Invalid requests
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
* @param postAccountBankModel The postAccountBankModel parameter
* @return AccountBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec createAccountRequestCreation(PostAccountBankModel postAccountBankModel) throws WebClientResponseException {
Object postBody = postAccountBankModel;
// verify the required parameter 'postAccountBankModel' is set
if (postAccountBankModel == null) {
throw new WebClientResponseException("Missing the required parameter 'postAccountBankModel' when calling createAccount", 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/accounts", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Create Account
* Creates an account. ## Account Type An Account is tied to a specific cryptocurrency or fiat and is comprised of transactions and a current balance. An account is required to allow a Bank or Customer to hold cryptocurrency or a Customer to hold fiat on the Cybrid Platform. At present, accounts can be created as `trading`, `storage` or `fiat ` accounts and are required before a Customer can generate quotes or execute a `trade` or `transfer`. To create accounts for your Bank, omit the `customer_guid` parameter in the request body. To create accounts for your Customers, include the `customer_guid` parameter in the request body. At the bank level, `invoice_operations` accounts can be configured to pre-fund your customers' Lightning Network operations. ## Asset The asset is the specific cryptocurrency or fiat that the account holds, e.g., 'BTC' for Bitcoin or `USD` for US dollars. See the Symbols API for a complete list of cryptocurrencies and fiat supported. ## State | State | Description | |-------|-------------| | storing | The Platform is storing the account details in our private store | | created | The Platform has created the account | Required scope: **accounts:execute**
* 201 - account created
*
400 - Invalid requests
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
* @param postAccountBankModel The postAccountBankModel parameter
* @return AccountBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono createAccount(PostAccountBankModel postAccountBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createAccountRequestCreation(postAccountBankModel).bodyToMono(localVarReturnType);
}
public Mono> createAccountWithHttpInfo(PostAccountBankModel postAccountBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createAccountRequestCreation(postAccountBankModel).toEntity(localVarReturnType);
}
/**
* Get Account
* Retrieves an account. Required scope: **accounts:read**
* 200 - account found
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
*
404 - account not found
* @param accountGuid Identifier for the account.
* @return AccountBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec getAccountRequestCreation(String accountGuid) throws WebClientResponseException {
Object postBody = null;
// verify the required parameter 'accountGuid' is set
if (accountGuid == null) {
throw new WebClientResponseException("Missing the required parameter 'accountGuid' when calling getAccount", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// create path and map variables
final Map pathParams = new HashMap();
pathParams.put("account_guid", accountGuid);
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/accounts/{account_guid}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get Account
* Retrieves an account. Required scope: **accounts:read**
* 200 - account found
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
*
404 - account not found
* @param accountGuid Identifier for the account.
* @return AccountBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono getAccount(String accountGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return getAccountRequestCreation(accountGuid).bodyToMono(localVarReturnType);
}
public Mono> getAccountWithHttpInfo(String accountGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return getAccountRequestCreation(accountGuid).toEntity(localVarReturnType);
}
/**
* List Accounts
* Retrieves a list of accounts. Required scope: **accounts:read**
* 200 - get list of accounts
*
400 - Invalid requests
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
* @param page The page index to retrieve.
* @param perPage The number of entities per page to return.
* @param owner The owner of the entity.
* @param guid Comma separated account_guids to list accounts for.
* @param type Comma separated account_types to list accounts for.
* @param bankGuid Comma separated bank_guids to list accounts for.
* @param customerGuid Comma separated customer_guids to list accounts for.
* @param label Comma separated labels to list accounts for.
* @return AccountListBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec listAccountsRequestCreation(java.math.BigInteger page, java.math.BigInteger perPage, String owner, String guid, String type, String bankGuid, String customerGuid, String label) 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, "owner", owner));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "guid", guid));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "type", type));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "bank_guid", bankGuid));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "customer_guid", customerGuid));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "label", label));
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/accounts", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* List Accounts
* Retrieves a list of accounts. Required scope: **accounts:read**
* 200 - get list of accounts
*
400 - Invalid requests
*
401 - Unauthorized - Authentication failed,
*
403 - Invalid scope
* @param page The page index to retrieve.
* @param perPage The number of entities per page to return.
* @param owner The owner of the entity.
* @param guid Comma separated account_guids to list accounts for.
* @param type Comma separated account_types to list accounts for.
* @param bankGuid Comma separated bank_guids to list accounts for.
* @param customerGuid Comma separated customer_guids to list accounts for.
* @param label Comma separated labels to list accounts for.
* @return AccountListBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono listAccounts(java.math.BigInteger page, java.math.BigInteger perPage, String owner, String guid, String type, String bankGuid, String customerGuid, String label) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listAccountsRequestCreation(page, perPage, owner, guid, type, bankGuid, customerGuid, label).bodyToMono(localVarReturnType);
}
public Mono> listAccountsWithHttpInfo(java.math.BigInteger page, java.math.BigInteger perPage, String owner, String guid, String type, String bankGuid, String customerGuid, String label) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listAccountsRequestCreation(page, perPage, owner, guid, type, bankGuid, customerGuid, label).toEntity(localVarReturnType);
}
}