Common Resources
This page contains common resources that will be used in the program, they are mostly shared request and response body.
Responses
SuccessResponse<T>
Successful response will be wrapped in this class
properties
success
booleanrequiredIndicates if the response is successfult or not.
message
stringrequiredThe success message, if any, else empty string.
data
TThe actual requested data.
ErrorResponse<T>
Failed response will be wrapped in this class, which is almost the same as the success response. We separated them in case they need to be modified differently in the future.
properties
success
booleanrequiredIndicates if the response is successfult or not.
message
stringrequiredThe error message, if any, else empty string.
data
TMostly null if there it fails.
Paging and sorting
Pagination
This class contains metadata about paging
properties
page
intrequiredmin = 11-index, i.e page 1 is the first page.
size
intrequiredmin = 1The page size, currently no limit on how big it can be.
totalItems
intread-onlyThe total number of all items of search results.
totalPages
intread-onlyThe total number of pages available, it changes according to the page and size.
Sorting
This class contains metadata about sorting
properties
direction
stringrequiredASCDESCThe sorting direction of that column, either one of the two values.
property
stringrequiredThe column / field to be sorted.
PaginationAndSorting
This class is a composition of pagination and a list of sortings
properties
The required pagination class.
sortings
The list of fields to be sorted, the order of the elements matter as it will affect how to resource is sorted.
Paginated<T>
This class contains data that is paginated and sorted
properties
The required pagination class.
sortings
The list of fields to be sorted, the order of the elements matter as it will affect how to resource is sorted.
items
T[]The list of the requested resources.