
travel.wink.sdk.booking.engine.api.LookupApi Maven / Gradle / Ivy
Show all versions of booking-engine-sdk-java Show documentation
package travel.wink.sdk.booking.engine.api;
import travel.wink.sdk.booking.engine.invoker.ApiClient;
import travel.wink.sdk.booking.engine.model.GenericErrorMessage;
import travel.wink.sdk.booking.engine.model.Lookup;
import travel.wink.sdk.booking.engine.model.LookupCached;
import travel.wink.sdk.booking.engine.model.Oauth2SearchByGeoLocation400Response;
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-29T13:20:36.800596+07:00[Asia/Bangkok]")
public class LookupApi {
private ApiClient apiClient;
public LookupApi() {
this(new ApiClient());
}
@Autowired
public LookupApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Search Lookups
* Searches for hotels, cities or countries by the search term.
* 405 - Method Not Allowed
*
415 - Unsupported Media Type
*
400 - Bad Request
*
403 - Forbidden
*
401 - Unauthorized
*
500 - Internal Server Error
*
404 - Not Found
*
503 - Service Unavailable
*
200 - OK
* @param term Search for lookups by this term
* @param accept The accept parameter
* @return List<LookupCached>
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec oauth2SearchSuggestionsRequestCreation(String term, String accept) throws WebClientResponseException {
Object postBody = null;
// verify the required parameter 'term' is set
if (term == null) {
throw new WebClientResponseException("Missing the required parameter 'term' when calling oauth2SearchSuggestions", 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();
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "term", term));
if (accept != null)
headerParams.add("Accept", apiClient.parameterToString(accept));
final String[] localVarAccepts = {
"application/json", "application/vnd.platform-v1+json", "application/xml", "text/xml", "text/plain", "*/*"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = { };
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2_client_credentials" };
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI("/api/search", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Search Lookups
* Searches for hotels, cities or countries by the search term.
* 405 - Method Not Allowed
*
415 - Unsupported Media Type
*
400 - Bad Request
*
403 - Forbidden
*
401 - Unauthorized
*
500 - Internal Server Error
*
404 - Not Found
*
503 - Service Unavailable
*
200 - OK
* @param term Search for lookups by this term
* @param accept The accept parameter
* @return List<LookupCached>
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Flux oauth2SearchSuggestions(String term, String accept) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return oauth2SearchSuggestionsRequestCreation(term, accept).bodyToFlux(localVarReturnType);
}
public Mono>> oauth2SearchSuggestionsWithHttpInfo(String term, String accept) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return oauth2SearchSuggestionsRequestCreation(term, accept).toEntityList(localVarReturnType);
}
/**
* Show Lookup
* Show lookup object by its unique url name.
* 405 - Method Not Allowed
*
415 - Unsupported Media Type
*
400 - Bad Request
*
403 - Forbidden
*
401 - Unauthorized
*
500 - Internal Server Error
*
404 - Not Found
*
503 - Service Unavailable
*
200 - OK
* @param urlName Show lookup by unique url name
* @param type Filter on type
* @param accept The accept parameter
* @return Lookup
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
private ResponseSpec oauth2ShowLookupRequestCreation(String urlName, String type, String accept) throws WebClientResponseException {
Object postBody = null;
// verify the required parameter 'urlName' is set
if (urlName == null) {
throw new WebClientResponseException("Missing the required parameter 'urlName' when calling oauth2ShowLookup", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// verify the required parameter 'type' is set
if (type == null) {
throw new WebClientResponseException("Missing the required parameter 'type' when calling oauth2ShowLookup", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
}
// create path and map variables
final Map pathParams = new HashMap();
pathParams.put("urlName", urlName);
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, "type", type));
if (accept != null)
headerParams.add("Accept", apiClient.parameterToString(accept));
final String[] localVarAccepts = {
"application/json", "application/vnd.platform-v1+json", "application/xml", "text/xml", "text/plain", "*/*"
};
final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = { };
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2_client_credentials" };
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return apiClient.invokeAPI("/api/lookup/{urlName}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Show Lookup
* Show lookup object by its unique url name.
* 405 - Method Not Allowed
*
415 - Unsupported Media Type
*
400 - Bad Request
*
403 - Forbidden
*
401 - Unauthorized
*
500 - Internal Server Error
*
404 - Not Found
*
503 - Service Unavailable
*
200 - OK
* @param urlName Show lookup by unique url name
* @param type Filter on type
* @param accept The accept parameter
* @return Lookup
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
*/
public Mono oauth2ShowLookup(String urlName, String type, String accept) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return oauth2ShowLookupRequestCreation(urlName, type, accept).bodyToMono(localVarReturnType);
}
public Mono> oauth2ShowLookupWithHttpInfo(String urlName, String type, String accept) throws WebClientResponseException {
ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};
return oauth2ShowLookupRequestCreation(urlName, type, accept).toEntity(localVarReturnType);
}
}