mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-07 22:07:49 -06:00
Externalized API and models as own package
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
class ErrorMessage implements Exception {
|
||||
final ErrorCode code;
|
||||
final String? details;
|
||||
final StackTrace? stackTrace;
|
||||
final int? httpStatusCode;
|
||||
|
||||
const ErrorMessage(
|
||||
this.code, {
|
||||
this.details,
|
||||
this.stackTrace,
|
||||
this.httpStatusCode,
|
||||
});
|
||||
|
||||
const ErrorMessage.unknown() : this(ErrorCode.unknown);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "ErrorMessage(code: $code${stackTrace != null ? ', stackTrace: ${stackTrace.toString()}' : ''}${httpStatusCode != null ? ', httpStatusCode: $httpStatusCode' : ''})";
|
||||
}
|
||||
}
|
||||
|
||||
enum ErrorCode {
|
||||
unknown,
|
||||
authenticationFailed,
|
||||
notAuthenticated,
|
||||
documentUploadFailed,
|
||||
documentUpdateFailed,
|
||||
documentLoadFailed,
|
||||
documentDeleteFailed,
|
||||
documentBulkActionFailed,
|
||||
documentPreviewFailed,
|
||||
documentAsnQueryFailed,
|
||||
tagCreateFailed,
|
||||
tagLoadFailed,
|
||||
documentTypeCreateFailed,
|
||||
documentTypeLoadFailed,
|
||||
correspondentCreateFailed,
|
||||
correspondentLoadFailed,
|
||||
scanRemoveFailed,
|
||||
invalidClientCertificateConfiguration,
|
||||
biometricsNotSupported,
|
||||
biometricAuthenticationFailed,
|
||||
deviceOffline,
|
||||
serverUnreachable,
|
||||
similarQueryError,
|
||||
autocompleteQueryError,
|
||||
storagePathLoadFailed,
|
||||
storagePathCreateFailed,
|
||||
loadSavedViewsError,
|
||||
createSavedViewError,
|
||||
deleteSavedViewError,
|
||||
requestTimedOut,
|
||||
unsupportedFileFormat,
|
||||
missingClientCertificate;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
class PaperlessServerInformation {
|
||||
static const String versionHeader = 'x-version';
|
||||
static const String apiVersionHeader = 'x-api-version';
|
||||
static const String hostHeader = 'x-served-by';
|
||||
final String? version;
|
||||
final int? apiVersion;
|
||||
final String? username;
|
||||
final String? host;
|
||||
PaperlessServerInformation({
|
||||
this.host,
|
||||
this.username,
|
||||
this.version = 'unknown',
|
||||
this.apiVersion = 1,
|
||||
});
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import 'package:paperless_mobile/core/type/types.dart';
|
||||
|
||||
class PaperlessStatistics {
|
||||
final int documentsTotal;
|
||||
final int documentsInInbox;
|
||||
|
||||
PaperlessStatistics({
|
||||
required this.documentsTotal,
|
||||
required this.documentsInInbox,
|
||||
});
|
||||
|
||||
PaperlessStatistics.fromJson(JSON json)
|
||||
: documentsTotal = json['documents_total'],
|
||||
documentsInInbox = json['documents_inbox'];
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:paperless_mobile/core/model/paperless_statistics.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
|
||||
class PaperlessStatisticsState {
|
||||
final bool isLoaded;
|
||||
final PaperlessStatistics? statistics;
|
||||
final PaperlessServerStatisticsModel? statistics;
|
||||
|
||||
PaperlessStatisticsState({
|
||||
required this.isLoaded,
|
||||
|
||||
Reference in New Issue
Block a user