Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions lib/jmap/quotas/quota.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,30 @@ part 'quota.g.dart';
@DataTypeConverter()
@IdConverter()
@UnsignedIntNullableConverter()
@JsonSerializable(explicitToJson: true)
@JsonSerializable(explicitToJson: true, includeIfNull: false)
class Quota with EquatableMixin {
final Id id;
final ResourceType resourceType;
final UnsignedInt? used;
final UnsignedInt? hardLimit;
final UnsignedInt? limit;
final Scope scope;
final String name;
final List<DataType> dataTypes;

@JsonKey(includeIfNull: false)
final UnsignedInt? warnLimit;

@JsonKey(includeIfNull: false)
final UnsignedInt? softLimit;

@JsonKey(includeIfNull: false)
final String? description;

Quota(
this.id,
this.resourceType,
this.used,
this.limit,
this.scope,
this.name,
this.dataTypes,
{
this.hardLimit,
this.limit,
this.warnLimit,
this.softLimit,
this.description
Expand All @@ -56,10 +52,11 @@ class Quota with EquatableMixin {
id,
resourceType,
used,
limit,
scope,
name,
dataTypes,
hardLimit,
limit,
warnLimit,
softLimit,
description
Expand Down
21 changes: 14 additions & 7 deletions lib/jmap/quotas/quota.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions test/jmap/quotas/get_quota_method_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@ void main() {
Id('382312d0-fa5c-11eb-b647-2fef1ee78d9e'),
ResourceType.count,
UnsignedInt(20000),
UnsignedInt(50000),
Scope.account,
'[email protected]',
[DataType.mail]
[DataType.mail],
limit: UnsignedInt(50000),
hardLimit: UnsignedInt(50000),
);

final expectQuota2 = Quota(
Id('382312d0-fa5c-11eb-b647-2fef1ee876hd'),
ResourceType.count,
UnsignedInt(10000),
UnsignedInt(70000),
Scope.account,
'[email protected]',
[DataType.mail, DataType.calendar, DataType.contact],
limit: UnsignedInt(70000),
hardLimit: UnsignedInt(70000),
description: 'Personal account usage',
softLimit: UnsignedInt(30000),
warnLimit: UnsignedInt(12000)
Expand Down Expand Up @@ -58,6 +60,7 @@ void main() {
"resourceType": "count",
"used": 20000,
"limit": 50000,
"hardLimit": 50000,
"scope": "account",
"name": "[email protected]",
"dataTypes" : ["Mail"]
Expand All @@ -69,6 +72,7 @@ void main() {
"warnLimit": 12000,
"softLimit": 30000,
"limit": 70000,
"hardLimit": 70000,
"scope": "account",
"name": "[email protected]",
"description": "Personal account usage",
Expand Down