CSV Models

This commit is contained in:
Hillel Coren 2020-12-14 09:13:08 +02:00
parent f58e4b394c
commit d4fd998cbd
4 changed files with 55 additions and 6 deletions

View File

@ -18,7 +18,7 @@ abstract class PreImportResponse
String get hash;
BuiltList<BuiltList<String>> get headers
BuiltList<BuiltList<String>> get headers;
static Serializer<PreImportResponse> get serializer =>
_$preImportResponseSerializer;

View File

@ -22,6 +22,11 @@ class _$PreImportResponseSerializer
final result = <Object>[
'hash',
serializers.serialize(object.hash, specifiedType: const FullType(String)),
'headers',
serializers.serialize(object.headers,
specifiedType: const FullType(BuiltList, const [
const FullType(BuiltList, const [const FullType(String)])
])),
];
return result;
@ -43,6 +48,12 @@ class _$PreImportResponseSerializer
result.hash = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'headers':
result.headers.replace(serializers.deserialize(value,
specifiedType: const FullType(BuiltList, const [
const FullType(BuiltList, const [const FullType(String)])
])) as BuiltList<Object>);
break;
}
}
@ -53,15 +64,20 @@ class _$PreImportResponseSerializer
class _$PreImportResponse extends PreImportResponse {
@override
final String hash;
@override
final BuiltList<BuiltList<String>> headers;
factory _$PreImportResponse(
[void Function(PreImportResponseBuilder) updates]) =>
(new PreImportResponseBuilder()..update(updates)).build();
_$PreImportResponse._({this.hash}) : super._() {
_$PreImportResponse._({this.hash, this.headers}) : super._() {
if (hash == null) {
throw new BuiltValueNullFieldError('PreImportResponse', 'hash');
}
if (headers == null) {
throw new BuiltValueNullFieldError('PreImportResponse', 'headers');
}
}
@override
@ -75,18 +91,22 @@ class _$PreImportResponse extends PreImportResponse {
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is PreImportResponse && hash == other.hash;
return other is PreImportResponse &&
hash == other.hash &&
headers == other.headers;
}
int __hashCode;
@override
int get hashCode {
return __hashCode ??= $jf($jc(0, hash.hashCode));
return __hashCode ??= $jf($jc($jc(0, hash.hashCode), headers.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('PreImportResponse')..add('hash', hash))
return (newBuiltValueToStringHelper('PreImportResponse')
..add('hash', hash)
..add('headers', headers))
.toString();
}
}
@ -99,11 +119,18 @@ class PreImportResponseBuilder
String get hash => _$this._hash;
set hash(String hash) => _$this._hash = hash;
ListBuilder<BuiltList<String>> _headers;
ListBuilder<BuiltList<String>> get headers =>
_$this._headers ??= new ListBuilder<BuiltList<String>>();
set headers(ListBuilder<BuiltList<String>> headers) =>
_$this._headers = headers;
PreImportResponseBuilder();
PreImportResponseBuilder get _$this {
if (_$v != null) {
_hash = _$v.hash;
_headers = _$v.headers?.toBuilder();
_$v = null;
}
return this;
@ -124,7 +151,21 @@ class PreImportResponseBuilder
@override
_$PreImportResponse build() {
final _$result = _$v ?? new _$PreImportResponse._(hash: hash);
_$PreImportResponse _$result;
try {
_$result = _$v ??
new _$PreImportResponse._(hash: hash, headers: headers.build());
} catch (_) {
String _$failedField;
try {
_$failedField = 'headers';
headers.build();
} catch (e) {
throw new BuiltValueNestedFieldError(
'PreImportResponse', _$failedField, e.toString());
}
rethrow;
}
replace(_$result);
return _$result;
}

View File

@ -8,6 +8,7 @@ import 'package:invoiceninja_flutter/data/models/gateway_token_model.dart';
import 'package:invoiceninja_flutter/data/models/expense_model.dart';
import 'package:invoiceninja_flutter/data/models/group_model.dart';
import 'package:invoiceninja_flutter/data/models/health_check_model.dart';
import 'package:invoiceninja_flutter/data/models/import_model.dart';
import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/data/models/entities.dart';
@ -159,6 +160,7 @@ part 'serializers.g.dart';
DesignPreviewRequest,
HealthCheckResponse,
SystemLogEntity,
PreImportResponse,
])
final Serializers serializers =
(_$serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build();

View File

@ -121,6 +121,7 @@ Serializers _$serializers = (new Serializers().toBuilder()
..add(PaymentTypeListResponse.serializer)
..add(PaymentUIState.serializer)
..add(PaymentableEntity.serializer)
..add(PreImportResponse.serializer)
..add(PrefState.serializer)
..add(ProductEntity.serializer)
..add(ProductItemResponse.serializer)
@ -193,6 +194,11 @@ Serializers _$serializers = (new Serializers().toBuilder()
..add(WebhookListResponse.serializer)
..add(WebhookState.serializer)
..add(WebhookUIState.serializer)
..addBuilderFactory(
const FullType(BuiltList, const [
const FullType(BuiltList, const [const FullType(String)])
]),
() => new ListBuilder<BuiltList<String>>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(ClientEntity)]),
() => new ListBuilder<ClientEntity>())