app.cybrid.cybrid_api_bank.client.api.VerificationKeysBankApi 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.PostVerificationKeyBankModel;
import app.cybrid.cybrid_api_bank.client.model.VerificationKeyBankModel;
import app.cybrid.cybrid_api_bank.client.model.VerificationKeyListBankModel;
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 = "2022-06-16T13:21:55.427016Z[Etc/UTC]")
public class VerificationKeysBankApi {
private ApiClient apiClient;
public VerificationKeysBankApi() {
this(new ApiClient());
}
@Autowired
public VerificationKeysBankApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create VerificationKey
* Creates a verification key. Example code (python) for generating a Verification Key ```python import base64 from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives.asymmetric import rsa nonce = \"wen moon\" private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048) signature = base64.b64encode(private_key.sign( data=nonce.encode('ascii'), padding=padding.PKCS1v15(), algorithm=hashes.SHA512())).decode('ascii') public_key = base64.b64encode(private_key.public_key().public_bytes( encoding=serialization.Encoding.DER, format=serialization.PublicFormat.SubjectPublicKeyInfo)).decode('ascii') ### DISCLAIMER:- Since NO ENCRYPTION is used in the key storage/formatting. Please DO NOT use this code in production environment. private_pem = private_key.private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()) ## Store the private_key in a file verification_key.pem with open (\"verification_key.pem\", 'wb') as pem_out: pem_out.write(private_pem) pem_out.close() print(\"Public Key: \", public_key) print(\"Signature: \", signature) ```` ## State | State | Description | |-------|-------------| | storing | The Platform is storing the verification in our private key store | | pending | The Platform is verifying the verification key's signature | | verified | The Platform has verified the verification key's signature and the key can be used | | failed | The Platform was not able to verify the verification key's signature and the key cannot be used | Required scope: **banks:write**
* 201 - verification key created
*
400 - Invalid requests - malformed authentication header
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
* @param postVerificationKeyBankModel The postVerificationKeyBankModel parameter
* @return VerificationKeyBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec createVerificationKeyRequestCreation(PostVerificationKeyBankModel postVerificationKeyBankModel) throws WebClientResponseException {
Object postBody = postVerificationKeyBankModel;
// verify the required parameter 'postVerificationKeyBankModel' is set
if (postVerificationKeyBankModel == null) {
throw new WebClientResponseException("Missing the required parameter 'postVerificationKeyBankModel' when calling createVerificationKey", 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/bank_verification_keys", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Create VerificationKey
* Creates a verification key. Example code (python) for generating a Verification Key ```python import base64 from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives.asymmetric import rsa nonce = \"wen moon\" private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048) signature = base64.b64encode(private_key.sign( data=nonce.encode('ascii'), padding=padding.PKCS1v15(), algorithm=hashes.SHA512())).decode('ascii') public_key = base64.b64encode(private_key.public_key().public_bytes( encoding=serialization.Encoding.DER, format=serialization.PublicFormat.SubjectPublicKeyInfo)).decode('ascii') ### DISCLAIMER:- Since NO ENCRYPTION is used in the key storage/formatting. Please DO NOT use this code in production environment. private_pem = private_key.private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()) ## Store the private_key in a file verification_key.pem with open (\"verification_key.pem\", 'wb') as pem_out: pem_out.write(private_pem) pem_out.close() print(\"Public Key: \", public_key) print(\"Signature: \", signature) ```` ## State | State | Description | |-------|-------------| | storing | The Platform is storing the verification in our private key store | | pending | The Platform is verifying the verification key's signature | | verified | The Platform has verified the verification key's signature and the key can be used | | failed | The Platform was not able to verify the verification key's signature and the key cannot be used | Required scope: **banks:write**
* 201 - verification key created
*
400 - Invalid requests - malformed authentication header
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
* @param postVerificationKeyBankModel The postVerificationKeyBankModel parameter
* @return VerificationKeyBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono createVerificationKey(PostVerificationKeyBankModel postVerificationKeyBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createVerificationKeyRequestCreation(postVerificationKeyBankModel).bodyToMono(localVarReturnType);
}
public Mono> createVerificationKeyWithHttpInfo(PostVerificationKeyBankModel postVerificationKeyBankModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createVerificationKeyRequestCreation(postVerificationKeyBankModel).toEntity(localVarReturnType);
}
/**
* Get VerificationKey
* Retrieves a verification key. Required scope: **banks:read**
* 200 - Verification Key found
*
400 - Invalid requests - malformed authentication header
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
*
404 - verification key not found
* @param verificationKeyGuid Identifier for the verification key.
* @return VerificationKeyBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec getVerificationKeyRequestCreation(String verificationKeyGuid) throws WebClientResponseException {
Object postBody = null;
// verify the required parameter 'verificationKeyGuid' is set
if (verificationKeyGuid == null) {
throw new WebClientResponseException("Missing the required parameter 'verificationKeyGuid' when calling getVerificationKey", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// create path and map variables
final Map pathParams = new HashMap();
pathParams.put("verification_key_guid", verificationKeyGuid);
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/bank_verification_keys/{verification_key_guid}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get VerificationKey
* Retrieves a verification key. Required scope: **banks:read**
* 200 - Verification Key found
*
400 - Invalid requests - malformed authentication header
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
*
404 - verification key not found
* @param verificationKeyGuid Identifier for the verification key.
* @return VerificationKeyBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono getVerificationKey(String verificationKeyGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return getVerificationKeyRequestCreation(verificationKeyGuid).bodyToMono(localVarReturnType);
}
public Mono> getVerificationKeyWithHttpInfo(String verificationKeyGuid) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return getVerificationKeyRequestCreation(verificationKeyGuid).toEntity(localVarReturnType);
}
/**
* Get Verification Keys list
* Retrieves a listing of verification keys of a bank. Required scope: **banks:read**
* 200 - get list of verification keys
*
400 - Invalid requests - malformed authentication header
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
* @param page The page parameter
* @param perPage The perPage parameter
* @return VerificationKeyListBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec listVerificationKeysRequestCreation(java.math.BigInteger page, java.math.BigInteger perPage) 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));
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/bank_verification_keys", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get Verification Keys list
* Retrieves a listing of verification keys of a bank. Required scope: **banks:read**
* 200 - get list of verification keys
*
400 - Invalid requests - malformed authentication header
*
401 - Unauthorized - Authentication failed, invalid subject
*
403 - Invalid scope
* @param page The page parameter
* @param perPage The perPage parameter
* @return VerificationKeyListBankModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono listVerificationKeys(java.math.BigInteger page, java.math.BigInteger perPage) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listVerificationKeysRequestCreation(page, perPage).bodyToMono(localVarReturnType);
}
public Mono> listVerificationKeysWithHttpInfo(java.math.BigInteger page, java.math.BigInteger perPage) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return listVerificationKeysRequestCreation(page, perPage).toEntity(localVarReturnType);
}
}