Class HousesAPIClient
java.lang.Object
info.ejava.assignments.api.houserenters.client.houses.HousesAPIClient
- All Implemented Interfaces:
HousesAPI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected URI
protected org.springframework.http.MediaType
protected org.springframework.web.client.RestTemplate
Fields inherited from interface info.ejava.assignments.api.houserenters.client.houses.HousesAPI
HOUSE_PATH, HOUSES_PATH
-
Constructor Summary
ConstructorsConstructorDescriptionHousesAPIClient
(org.springframework.web.client.RestTemplate restTemplate, ServerConfig serverConfig, org.springframework.http.MediaType mediaType) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<HouseDTO> createHouse
(HouseDTO house) org.springframework.http.ResponseEntity
<HouseListDTO> findHousesBy
(HouseSearchParams searchParams, org.springframework.data.domain.Pageable pageable) An example query using a GET and query parameters.org.springframework.http.ResponseEntity
<HouseDTO> org.springframework.http.ResponseEntity
<Void> protected org.springframework.web.util.UriBuilder
makeRequestParams
(org.springframework.web.util.UriComponentsBuilder uriBuilder, HouseSearchParams searchParams, org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity
<Void> org.springframework.http.ResponseEntity
<Void> removeHouse
(String id) org.springframework.http.ResponseEntity
<HouseDTO> updateHouse
(String id, HouseDTO house) withRestTemplate
(org.springframework.web.client.RestTemplate restTemplate) Used to change the authenticated identity of the client when security has been enabled.
-
Field Details
-
baseUrl
-
restTemplate
protected org.springframework.web.client.RestTemplate restTemplate -
mediaType
protected org.springframework.http.MediaType mediaType
-
-
Constructor Details
-
HousesAPIClient
public HousesAPIClient(org.springframework.web.client.RestTemplate restTemplate, ServerConfig serverConfig, org.springframework.http.MediaType mediaType)
-
-
Method Details
-
withRestTemplate
Description copied from interface:HousesAPI
Used to change the authenticated identity of the client when security has been enabled.- Specified by:
withRestTemplate
in interfaceHousesAPI
- Parameters:
restTemplate
- contains basis for client/identity- Returns:
- new client using the supplied restTemplate
-
createHouse
- Specified by:
createHouse
in interfaceHousesAPI
-
makeRequestParams
protected org.springframework.web.util.UriBuilder makeRequestParams(org.springframework.web.util.UriComponentsBuilder uriBuilder, HouseSearchParams searchParams, org.springframework.data.domain.Pageable pageable) -
findHousesBy
public org.springframework.http.ResponseEntity<HouseListDTO> findHousesBy(HouseSearchParams searchParams, org.springframework.data.domain.Pageable pageable) Description copied from interface:HousesAPI
An example query using a GET and query parameters. Useful in expressing range searches.- Specified by:
findHousesBy
in interfaceHousesAPI
- Parameters:
searchParams
- object expressing min/max propertiespageable
- paging constraints- Returns:
- list of results
-
getHouse
-
hasHouse
-
updateHouse
- Specified by:
updateHouse
in interfaceHousesAPI
-
removeHouse
- Specified by:
removeHouse
in interfaceHousesAPI
-
removeAllHouses
- Specified by:
removeAllHouses
in interfaceHousesAPI
-