create<T, E> static method
Implementation
static ApiParserResponse<T, E> create<T, E>(ParserResponse<T, E> response) {
if (response.errors.isNotEmpty) {
return ApiParserErrorResponse(response.errors);
} else if (response.data != null) {
if (response is ParserResponseWithPaginationEntity) {
return ApiParserSuccessResponse(
response.data as T,
pagination: (response as ParserResponseWithPaginationEntity).pagination,
);
} else {
return ApiParserSuccessResponse(response.data as T);
}
}
return ApiParserEmptyResponse();
}