Interface APIResponse<T>
-
- Type Parameters:
T
- The actual payload DTO based on the data returned by the remote service
- All Known Implementing Classes:
APIResponseDTO
public interface APIResponse<T>
Interface for extended remote API responses. Some API routes will not only return the actually requested data but will also report additional information with regards to error and pagination handling.
Note:
The type and amount of additional information returned by the remote service depends on the actual API route. Some will only return the requested records, other will also report additional error information in case invalid filter parameters have been used by the client. API calls that support pagination might also add some additional information which can be used to navigate through the "pages".
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
APIResponse.Errors
Interface representing optional soft errors that might occur while requesting data from the remote servicestatic interface
APIResponse.Links
Interface representing optional paging information for remote service requests supporting pagination
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
getData()
Returns the actually requested records mapped as Java DTO.Optional<APIResponse.Errors>
getErrors()
Returns an Optional representing the additional error information returned by the remote service.Optional<APIResponse.Links>
getLinks()
Returns an Optional representing the additional paging information returned by the remote service.
-
-
-
Method Detail
-
getData
@Nullable T getData()
Returns the actually requested records mapped as Java DTO. Resolves to the value of the {data
} JSON property.- Returns:
- Data returned by the API call
-
getErrors
Optional<APIResponse.Errors> getErrors()
Returns an Optional representing the additional error information returned by the remote service. If the request was fully compliant or if the requested resource does not support additional error reporting the returned Optional might be empty. Resolves to the value of the {errors
} JSON property.- Returns:
- Optional containing additional error details or empty Optional if no errors occurred or error reporting is not supported by the requested resource
-
getLinks
Optional<APIResponse.Links> getLinks()
Returns an Optional representing the additional paging information returned by the remote service. If the requested resource does not support pagination the returned Optional might be empty. Resolves to the value of the {links
} JSON property.- Returns:
- Optional containing additional paging information or empty Optional if pagination is not supported by the requested resource
-
-