forked from firka/firka
ref: kreta_client
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
class ApiResponse<T> {
|
||||
T? response;
|
||||
int statusCode;
|
||||
String? err;
|
||||
Object? err;
|
||||
bool cached;
|
||||
|
||||
ApiResponse(this.response, this.statusCode, this.err, this.cached);
|
||||
|
||||
ApiResponse.fail(this.err) : response = null, statusCode = 0, cached = false;
|
||||
|
||||
ApiResponse.success(this.response, this.statusCode)
|
||||
: err = null,
|
||||
cached = false;
|
||||
|
||||
ApiResponse.cached(this.response)
|
||||
: statusCode = 200,
|
||||
err = null,
|
||||
cached = true;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "ApiResponse("
|
||||
"response: $response, "
|
||||
"statusCode: $statusCode, "
|
||||
"err: \"$err\", "
|
||||
"err: \"${err.toString()}\", "
|
||||
"cached: $cached"
|
||||
")";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user