From 12dbbca6fdd308e919cac4e39666c88f2e96b796 Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 31 Jan 2024 12:36:13 +0700 Subject: [PATCH] Fix parsing QueryEmailResponse --- lib/jmap/core/method/response/query_response.dart | 4 ++-- lib/jmap/mail/email/query/query_email_response.dart | 5 +++-- lib/jmap/mail/email/query/query_email_response.g.dart | 8 ++++---- lib/jmap/mail/mailbox/query/query_mailbox_response.dart | 5 +++-- lib/jmap/mail/mailbox/query/query_mailbox_response.g.dart | 8 ++++---- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/jmap/core/method/response/query_response.dart b/lib/jmap/core/method/response/query_response.dart index f4fa149..06bb232 100644 --- a/lib/jmap/core/method/response/query_response.dart +++ b/lib/jmap/core/method/response/query_response.dart @@ -9,8 +9,8 @@ abstract class QueryResponse extends ResponseRequiringAccountId { final bool canCalculateChanges; final UnsignedInt position; final Set ids; - final UnsignedInt total; - final UnsignedInt limit; + final UnsignedInt? total; + final UnsignedInt? limit; QueryResponse( AccountId accountId, diff --git a/lib/jmap/mail/email/query/query_email_response.dart b/lib/jmap/mail/email/query/query_email_response.dart index 08fe06b..649815f 100644 --- a/lib/jmap/mail/email/query/query_email_response.dart +++ b/lib/jmap/mail/email/query/query_email_response.dart @@ -2,6 +2,7 @@ import 'package:jmap_dart_client/http/converter/account_id_converter.dart'; import 'package:jmap_dart_client/http/converter/id_converter.dart'; import 'package:jmap_dart_client/http/converter/state_converter.dart'; import 'package:jmap_dart_client/http/converter/unsigned_int_converter.dart'; +import 'package:jmap_dart_client/http/converter/unsigned_int_nullable_converter.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/core/id.dart'; import 'package:jmap_dart_client/jmap/core/method/response/query_response.dart'; @@ -24,8 +25,8 @@ class QueryEmailResponse extends QueryResponse { bool canCalculateChanges, UnsignedInt position, Set ids, - UnsignedInt total, - UnsignedInt limit, + UnsignedInt? total, + UnsignedInt? limit, ) : super(accountId, queryState, canCalculateChanges, position, ids, total, limit); factory QueryEmailResponse.fromJson(Map json) => _$QueryEmailResponseFromJson(json); diff --git a/lib/jmap/mail/email/query/query_email_response.g.dart b/lib/jmap/mail/email/query/query_email_response.g.dart index 4f60872..98187bf 100644 --- a/lib/jmap/mail/email/query/query_email_response.g.dart +++ b/lib/jmap/mail/email/query/query_email_response.g.dart @@ -15,8 +15,8 @@ QueryEmailResponse _$QueryEmailResponseFromJson(Map json) { (json['ids'] as List) .map((e) => const IdConverter().fromJson(e as String)) .toSet(), - const UnsignedIntConverter().fromJson(json['total'] as int), - const UnsignedIntConverter().fromJson(json['limit'] as int), + const UnsignedIntNullableConverter().fromJson(json['total'] as int?), + const UnsignedIntNullableConverter().fromJson(json['limit'] as int?), ); } @@ -27,6 +27,6 @@ Map _$QueryEmailResponseToJson(QueryEmailResponse instance) => 'canCalculateChanges': instance.canCalculateChanges, 'position': const UnsignedIntConverter().toJson(instance.position), 'ids': instance.ids.map(const IdConverter().toJson).toList(), - 'total': const UnsignedIntConverter().toJson(instance.total), - 'limit': const UnsignedIntConverter().toJson(instance.limit), + 'total': const UnsignedIntNullableConverter().toJson(instance.total), + 'limit': const UnsignedIntNullableConverter().toJson(instance.limit), }; diff --git a/lib/jmap/mail/mailbox/query/query_mailbox_response.dart b/lib/jmap/mail/mailbox/query/query_mailbox_response.dart index 3aafcbe..a9cd133 100644 --- a/lib/jmap/mail/mailbox/query/query_mailbox_response.dart +++ b/lib/jmap/mail/mailbox/query/query_mailbox_response.dart @@ -2,6 +2,7 @@ import 'package:jmap_dart_client/http/converter/account_id_converter.dart'; import 'package:jmap_dart_client/http/converter/id_converter.dart'; import 'package:jmap_dart_client/http/converter/state_converter.dart'; import 'package:jmap_dart_client/http/converter/unsigned_int_converter.dart'; +import 'package:jmap_dart_client/http/converter/unsigned_int_nullable_converter.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/core/id.dart'; import 'package:jmap_dart_client/jmap/core/method/response/query_response.dart'; @@ -24,8 +25,8 @@ class QueryMailboxResponse extends QueryResponse { bool canCalculateChanges, UnsignedInt position, Set ids, - UnsignedInt total, - UnsignedInt limit, + UnsignedInt? total, + UnsignedInt? limit, ) : super(accountId, queryState, canCalculateChanges, position, ids, total, limit); factory QueryMailboxResponse.fromJson(Map json) => _$QueryMailboxResponseFromJson(json); diff --git a/lib/jmap/mail/mailbox/query/query_mailbox_response.g.dart b/lib/jmap/mail/mailbox/query/query_mailbox_response.g.dart index c924f4a..e12f920 100644 --- a/lib/jmap/mail/mailbox/query/query_mailbox_response.g.dart +++ b/lib/jmap/mail/mailbox/query/query_mailbox_response.g.dart @@ -16,8 +16,8 @@ QueryMailboxResponse _$QueryMailboxResponseFromJson( (json['ids'] as List) .map((e) => const IdConverter().fromJson(e as String)) .toSet(), - const UnsignedIntConverter().fromJson(json['total'] as int), - const UnsignedIntConverter().fromJson(json['limit'] as int), + const UnsignedIntNullableConverter().fromJson(json['total'] as int?), + const UnsignedIntNullableConverter().fromJson(json['limit'] as int?), ); Map _$QueryMailboxResponseToJson( @@ -28,6 +28,6 @@ Map _$QueryMailboxResponseToJson( 'canCalculateChanges': instance.canCalculateChanges, 'position': const UnsignedIntConverter().toJson(instance.position), 'ids': instance.ids.map(const IdConverter().toJson).toList(), - 'total': const UnsignedIntConverter().toJson(instance.total), - 'limit': const UnsignedIntConverter().toJson(instance.limit), + 'total': const UnsignedIntNullableConverter().toJson(instance.total), + 'limit': const UnsignedIntNullableConverter().toJson(instance.limit), };