369 lines
12 KiB
Dart
369 lines
12 KiB
Dart
// Autogenerated from Pigeon (v26.0.2), do not edit directly.
|
|
// See also: https://pub.dev/packages/pigeon
|
|
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers
|
|
|
|
import 'dart:async';
|
|
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
|
|
|
|
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
|
|
import 'package:flutter/services.dart';
|
|
|
|
PlatformException _createConnectionError(String channelName) {
|
|
return PlatformException(
|
|
code: 'channel-error',
|
|
message: 'Unable to establish connection on channel: "$channelName".',
|
|
);
|
|
}
|
|
|
|
bool _deepEquals(Object? a, Object? b) {
|
|
if (a is List && b is List) {
|
|
return a.length == b.length && a.indexed.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]));
|
|
}
|
|
if (a is Map && b is Map) {
|
|
return a.length == b.length &&
|
|
a.entries.every(
|
|
(MapEntry<Object?, Object?> entry) =>
|
|
(b as Map<Object?, Object?>).containsKey(entry.key) && _deepEquals(entry.value, b[entry.key]),
|
|
);
|
|
}
|
|
return a == b;
|
|
}
|
|
|
|
enum UploadApiErrorCode {
|
|
unknown,
|
|
assetNotFound,
|
|
fileNotFound,
|
|
resourceNotFound,
|
|
invalidResource,
|
|
encodingFailed,
|
|
writeFailed,
|
|
notEnoughSpace,
|
|
networkError,
|
|
photosInternalError,
|
|
photosUnknownError,
|
|
noServerUrl,
|
|
noDeviceId,
|
|
noAccessToken,
|
|
interrupted,
|
|
cancelled,
|
|
downloadStalled,
|
|
forceQuit,
|
|
outOfResources,
|
|
backgroundUpdatesDisabled,
|
|
uploadTimeout,
|
|
iCloudRateLimit,
|
|
iCloudThrottled,
|
|
}
|
|
|
|
enum UploadApiStatus {
|
|
downloadPending,
|
|
downloadQueued,
|
|
downloadFailed,
|
|
uploadPending,
|
|
uploadQueued,
|
|
uploadFailed,
|
|
uploadComplete,
|
|
uploadSkipped,
|
|
}
|
|
|
|
class UploadApiTaskStatus {
|
|
UploadApiTaskStatus({
|
|
required this.id,
|
|
required this.filename,
|
|
required this.status,
|
|
this.errorCode,
|
|
this.httpStatusCode,
|
|
});
|
|
|
|
String id;
|
|
|
|
String filename;
|
|
|
|
UploadApiStatus status;
|
|
|
|
UploadApiErrorCode? errorCode;
|
|
|
|
int? httpStatusCode;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[id, filename, status, errorCode, httpStatusCode];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UploadApiTaskStatus decode(Object result) {
|
|
result as List<Object?>;
|
|
return UploadApiTaskStatus(
|
|
id: result[0]! as String,
|
|
filename: result[1]! as String,
|
|
status: result[2]! as UploadApiStatus,
|
|
errorCode: result[3] as UploadApiErrorCode?,
|
|
httpStatusCode: result[4] as int?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UploadApiTaskStatus || other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class UploadApiTaskProgress {
|
|
UploadApiTaskProgress({required this.id, required this.progress, this.speed, this.totalBytes});
|
|
|
|
String id;
|
|
|
|
double progress;
|
|
|
|
double? speed;
|
|
|
|
int? totalBytes;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[id, progress, speed, totalBytes];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UploadApiTaskProgress decode(Object result) {
|
|
result as List<Object?>;
|
|
return UploadApiTaskProgress(
|
|
id: result[0]! as String,
|
|
progress: result[1]! as double,
|
|
speed: result[2] as double?,
|
|
totalBytes: result[3] as int?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UploadApiTaskProgress || other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class _PigeonCodec extends StandardMessageCodec {
|
|
const _PigeonCodec();
|
|
@override
|
|
void writeValue(WriteBuffer buffer, Object? value) {
|
|
if (value is int) {
|
|
buffer.putUint8(4);
|
|
buffer.putInt64(value);
|
|
} else if (value is UploadApiErrorCode) {
|
|
buffer.putUint8(129);
|
|
writeValue(buffer, value.index);
|
|
} else if (value is UploadApiStatus) {
|
|
buffer.putUint8(130);
|
|
writeValue(buffer, value.index);
|
|
} else if (value is UploadApiTaskStatus) {
|
|
buffer.putUint8(131);
|
|
writeValue(buffer, value.encode());
|
|
} else if (value is UploadApiTaskProgress) {
|
|
buffer.putUint8(132);
|
|
writeValue(buffer, value.encode());
|
|
} else {
|
|
super.writeValue(buffer, value);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Object? readValueOfType(int type, ReadBuffer buffer) {
|
|
switch (type) {
|
|
case 129:
|
|
final int? value = readValue(buffer) as int?;
|
|
return value == null ? null : UploadApiErrorCode.values[value];
|
|
case 130:
|
|
final int? value = readValue(buffer) as int?;
|
|
return value == null ? null : UploadApiStatus.values[value];
|
|
case 131:
|
|
return UploadApiTaskStatus.decode(readValue(buffer)!);
|
|
case 132:
|
|
return UploadApiTaskProgress.decode(readValue(buffer)!);
|
|
default:
|
|
return super.readValueOfType(type, buffer);
|
|
}
|
|
}
|
|
}
|
|
|
|
const StandardMethodCodec pigeonMethodCodec = StandardMethodCodec(_PigeonCodec());
|
|
|
|
class UploadApi {
|
|
/// Constructor for [UploadApi]. The [binaryMessenger] named argument is
|
|
/// available for dependency injection. If it is left null, the default
|
|
/// BinaryMessenger will be used which routes to the host platform.
|
|
UploadApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
|
|
: pigeonVar_binaryMessenger = binaryMessenger,
|
|
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
|
|
final BinaryMessenger? pigeonVar_binaryMessenger;
|
|
|
|
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
|
|
|
|
final String pigeonVar_messageChannelSuffix;
|
|
|
|
Future<void> initialize() async {
|
|
final String pigeonVar_channelName =
|
|
'dev.flutter.pigeon.immich_mobile.UploadApi.initialize$pigeonVar_messageChannelSuffix';
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final List<Object?>? pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<void> refresh() async {
|
|
final String pigeonVar_channelName =
|
|
'dev.flutter.pigeon.immich_mobile.UploadApi.refresh$pigeonVar_messageChannelSuffix';
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final List<Object?>? pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<void> cancelAll() async {
|
|
final String pigeonVar_channelName =
|
|
'dev.flutter.pigeon.immich_mobile.UploadApi.cancelAll$pigeonVar_messageChannelSuffix';
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final List<Object?>? pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<void> enqueueAssets(List<String> localIds) async {
|
|
final String pigeonVar_channelName =
|
|
'dev.flutter.pigeon.immich_mobile.UploadApi.enqueueAssets$pigeonVar_messageChannelSuffix';
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[localIds]);
|
|
final List<Object?>? pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<void> enqueueFiles(List<String> paths) async {
|
|
final String pigeonVar_channelName =
|
|
'dev.flutter.pigeon.immich_mobile.UploadApi.enqueueFiles$pigeonVar_messageChannelSuffix';
|
|
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[paths]);
|
|
final List<Object?>? pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
Stream<UploadApiTaskStatus> streamStatus({String instanceName = ''}) {
|
|
if (instanceName.isNotEmpty) {
|
|
instanceName = '.$instanceName';
|
|
}
|
|
final EventChannel streamStatusChannel = EventChannel(
|
|
'dev.flutter.pigeon.immich_mobile.UploadFlutterApi.streamStatus$instanceName',
|
|
pigeonMethodCodec,
|
|
);
|
|
return streamStatusChannel.receiveBroadcastStream().map((dynamic event) {
|
|
return event as UploadApiTaskStatus;
|
|
});
|
|
}
|
|
|
|
Stream<UploadApiTaskProgress> streamProgress({String instanceName = ''}) {
|
|
if (instanceName.isNotEmpty) {
|
|
instanceName = '.$instanceName';
|
|
}
|
|
final EventChannel streamProgressChannel = EventChannel(
|
|
'dev.flutter.pigeon.immich_mobile.UploadFlutterApi.streamProgress$instanceName',
|
|
pigeonMethodCodec,
|
|
);
|
|
return streamProgressChannel.receiveBroadcastStream().map((dynamic event) {
|
|
return event as UploadApiTaskProgress;
|
|
});
|
|
}
|