mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-08 18:03:12 +00:00
155 lines
3.9 KiB
Dart
155 lines
3.9 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'server_details.dart';
|
|
|
|
// **************************************************************************
|
|
// TypeAdapterGenerator
|
|
// **************************************************************************
|
|
|
|
class ServerHostingDetailsAdapter extends TypeAdapter<ServerHostingDetails> {
|
|
@override
|
|
final int typeId = 2;
|
|
|
|
@override
|
|
ServerHostingDetails read(BinaryReader reader) {
|
|
final numOfFields = reader.readByte();
|
|
final fields = <int, dynamic>{
|
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
};
|
|
return ServerHostingDetails(
|
|
ip4: fields[0] as String,
|
|
id: fields[1] as int,
|
|
createTime: fields[3] as DateTime?,
|
|
volume: fields[4] as ServerVolume,
|
|
apiToken: fields[5] as String,
|
|
provider: fields[6] == null
|
|
? ServerProviderType.hetzner
|
|
: fields[6] as ServerProviderType,
|
|
startTime: fields[2] as DateTime?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, ServerHostingDetails obj) {
|
|
writer
|
|
..writeByte(7)
|
|
..writeByte(0)
|
|
..write(obj.ip4)
|
|
..writeByte(1)
|
|
..write(obj.id)
|
|
..writeByte(3)
|
|
..write(obj.createTime)
|
|
..writeByte(2)
|
|
..write(obj.startTime)
|
|
..writeByte(4)
|
|
..write(obj.volume)
|
|
..writeByte(5)
|
|
..write(obj.apiToken)
|
|
..writeByte(6)
|
|
..write(obj.provider);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is ServerHostingDetailsAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|
|
|
|
class ServerVolumeAdapter extends TypeAdapter<ServerVolume> {
|
|
@override
|
|
final int typeId = 5;
|
|
|
|
@override
|
|
ServerVolume read(BinaryReader reader) {
|
|
final numOfFields = reader.readByte();
|
|
final fields = <int, dynamic>{
|
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
|
};
|
|
return ServerVolume(
|
|
id: fields[1] as int,
|
|
name: fields[2] as String,
|
|
sizeByte: fields[3] == null ? 10737418240 : fields[3] as int,
|
|
serverId: fields[4] as int?,
|
|
linuxDevice: fields[5] as String?,
|
|
uuid: fields[6] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, ServerVolume obj) {
|
|
writer
|
|
..writeByte(6)
|
|
..writeByte(1)
|
|
..write(obj.id)
|
|
..writeByte(2)
|
|
..write(obj.name)
|
|
..writeByte(3)
|
|
..write(obj.sizeByte)
|
|
..writeByte(4)
|
|
..write(obj.serverId)
|
|
..writeByte(5)
|
|
..write(obj.linuxDevice)
|
|
..writeByte(6)
|
|
..write(obj.uuid);
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is ServerVolumeAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|
|
|
|
class ServerProviderTypeAdapter extends TypeAdapter<ServerProviderType> {
|
|
@override
|
|
final int typeId = 101;
|
|
|
|
@override
|
|
ServerProviderType read(BinaryReader reader) {
|
|
switch (reader.readByte()) {
|
|
case 0:
|
|
return ServerProviderType.unknown;
|
|
case 1:
|
|
return ServerProviderType.hetzner;
|
|
case 2:
|
|
return ServerProviderType.digitalOcean;
|
|
default:
|
|
return ServerProviderType.unknown;
|
|
}
|
|
}
|
|
|
|
@override
|
|
void write(BinaryWriter writer, ServerProviderType obj) {
|
|
switch (obj) {
|
|
case ServerProviderType.unknown:
|
|
writer.writeByte(0);
|
|
break;
|
|
case ServerProviderType.hetzner:
|
|
writer.writeByte(1);
|
|
break;
|
|
case ServerProviderType.digitalOcean:
|
|
writer.writeByte(2);
|
|
break;
|
|
}
|
|
}
|
|
|
|
@override
|
|
int get hashCode => typeId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is ServerProviderTypeAdapter &&
|
|
runtimeType == other.runtimeType &&
|
|
typeId == other.typeId;
|
|
}
|