app.cybrid.cybrid_api_id.client.api.CustomerTokensIdpApi Maven / Gradle / Ivy
package app.cybrid.cybrid_api_id.client.api;
import app.cybrid.cybrid_api_id.client.ApiClient;
import app.cybrid.cybrid_api_id.client.model.CustomerTokenIdpModel;
import app.cybrid.cybrid_api_id.client.model.ErrorResponseIdpModel;
import app.cybrid.cybrid_api_id.client.model.PostCustomerTokenIdpModel;
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-09-21T22:21:18.012560Z[Etc/UTC]")
public class CustomerTokensIdpApi {
private ApiClient apiClient;
public CustomerTokensIdpApi() {
this(new ApiClient());
}
@Autowired
public CustomerTokensIdpApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create customer access token
* Creates a customer JWT access token. Required scopes: **customers:write** and **customers:read**
* 201 - Customer token created
*
401 - Unauthorized
*
403 - Forbidden
*
422 - Unprocessable Content
* @param postCustomerTokenIdpModel The postCustomerTokenIdpModel parameter
* @return CustomerTokenIdpModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec createCustomerTokenRequestCreation(PostCustomerTokenIdpModel postCustomerTokenIdpModel) throws WebClientResponseException {
Object postBody = postCustomerTokenIdpModel;
// verify the required parameter 'postCustomerTokenIdpModel' is set
if (postCustomerTokenIdpModel == null) {
throw new WebClientResponseException("Missing the required parameter 'postCustomerTokenIdpModel' when calling createCustomerToken", 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/customer_tokens", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Create customer access token
* Creates a customer JWT access token. Required scopes: **customers:write** and **customers:read**
* 201 - Customer token created
*
401 - Unauthorized
*
403 - Forbidden
*
422 - Unprocessable Content
* @param postCustomerTokenIdpModel The postCustomerTokenIdpModel parameter
* @return CustomerTokenIdpModel
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono createCustomerToken(PostCustomerTokenIdpModel postCustomerTokenIdpModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createCustomerTokenRequestCreation(postCustomerTokenIdpModel).bodyToMono(localVarReturnType);
}
public Mono> createCustomerTokenWithHttpInfo(PostCustomerTokenIdpModel postCustomerTokenIdpModel) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return createCustomerTokenRequestCreation(postCustomerTokenIdpModel).toEntity(localVarReturnType);
}
}