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; String get hash;
BuiltList<BuiltList<String>> get headers BuiltList<BuiltList<String>> get headers;
static Serializer<PreImportResponse> get serializer => static Serializer<PreImportResponse> get serializer =>
_$preImportResponseSerializer; _$preImportResponseSerializer;

View File

@ -22,6 +22,11 @@ class _$PreImportResponseSerializer
final result = <Object>[ final result = <Object>[
'hash', 'hash',
serializers.serialize(object.hash, specifiedType: const FullType(String)), 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; return result;
@ -43,6 +48,12 @@ class _$PreImportResponseSerializer
result.hash = serializers.deserialize(value, result.hash = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; 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 { class _$PreImportResponse extends PreImportResponse {
@override @override
final String hash; final String hash;
@override
final BuiltList<BuiltList<String>> headers;
factory _$PreImportResponse( factory _$PreImportResponse(
[void Function(PreImportResponseBuilder) updates]) => [void Function(PreImportResponseBuilder) updates]) =>
(new PreImportResponseBuilder()..update(updates)).build(); (new PreImportResponseBuilder()..update(updates)).build();
_$PreImportResponse._({this.hash}) : super._() { _$PreImportResponse._({this.hash, this.headers}) : super._() {
if (hash == null) { if (hash == null) {
throw new BuiltValueNullFieldError('PreImportResponse', 'hash'); throw new BuiltValueNullFieldError('PreImportResponse', 'hash');
} }
if (headers == null) {
throw new BuiltValueNullFieldError('PreImportResponse', 'headers');
}
} }
@override @override
@ -75,18 +91,22 @@ class _$PreImportResponse extends PreImportResponse {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if (identical(other, this)) return true; 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; int __hashCode;
@override @override
int get hashCode { int get hashCode {
return __hashCode ??= $jf($jc(0, hash.hashCode)); return __hashCode ??= $jf($jc($jc(0, hash.hashCode), headers.hashCode));
} }
@override @override
String toString() { String toString() {
return (newBuiltValueToStringHelper('PreImportResponse')..add('hash', hash)) return (newBuiltValueToStringHelper('PreImportResponse')
..add('hash', hash)
..add('headers', headers))
.toString(); .toString();
} }
} }
@ -99,11 +119,18 @@ class PreImportResponseBuilder
String get hash => _$this._hash; String get hash => _$this._hash;
set hash(String hash) => _$this._hash = 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();
PreImportResponseBuilder get _$this { PreImportResponseBuilder get _$this {
if (_$v != null) { if (_$v != null) {
_hash = _$v.hash; _hash = _$v.hash;
_headers = _$v.headers?.toBuilder();
_$v = null; _$v = null;
} }
return this; return this;
@ -124,7 +151,21 @@ class PreImportResponseBuilder
@override @override
_$PreImportResponse build() { _$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); replace(_$result);
return _$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/expense_model.dart';
import 'package:invoiceninja_flutter/data/models/group_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/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/invoice_model.dart';
import 'package:invoiceninja_flutter/data/models/models.dart'; import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/data/models/entities.dart'; import 'package:invoiceninja_flutter/data/models/entities.dart';
@ -159,6 +160,7 @@ part 'serializers.g.dart';
DesignPreviewRequest, DesignPreviewRequest,
HealthCheckResponse, HealthCheckResponse,
SystemLogEntity, SystemLogEntity,
PreImportResponse,
]) ])
final Serializers serializers = final Serializers serializers =
(_$serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); (_$serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build();

View File

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