use of com.baeldung.petstore.client.model.Order in project tutorials by eugenp.
the class StoreApi method getOrderById.
/**
* Find purchase order by ID
* For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid ID supplied
* <p><b>404</b> - Order not found
* @param orderId ID of pet that needs to be fetched
* @return Order
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Order getOrderById(Long orderId) throws RestClientException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'orderId' when calling getOrderById");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("orderId", orderId);
String path = UriComponentsBuilder.fromPath("/store/order/{orderId}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { "application/xml", "application/json" };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] {};
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {
};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
use of com.baeldung.petstore.client.model.Order in project tutorials by eugenp.
the class StoreApi method placeOrder.
/**
* Place an order for a pet
*
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid Order
* @param body order placed for purchasing the pet
* @return Order
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Order placeOrder(Order body) throws RestClientException {
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling placeOrder");
}
String path = UriComponentsBuilder.fromPath("/store/order").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { "application/xml", "application/json" };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] {};
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {
};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
use of com.baeldung.petstore.client.model.Order in project tutorials by eugenp.
the class StoreApiTest method getOrderByIdTest.
/**
* Find purchase order by ID
*
* For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getOrderByIdTest() {
Long orderId = null;
Order response = api.getOrderById(orderId);
// TODO: test validations
}
use of com.baeldung.petstore.client.model.Order in project tutorials by eugenp.
the class StoreApiTest method placeOrderTest.
/**
* Place an order for a pet
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void placeOrderTest() {
Order body = null;
Order response = api.placeOrder(body);
// TODO: test validations
}
Aggregations