Line data Source code
1 : import 'package:json_annotation/json_annotation.dart'; 2 : part 'syncresult.g.dart'; 3 : 4 : /// SyncResult refers to the generic class for sync response 5 : @JsonSerializable(createFactory: true) 6 : class SyncResult { 7 : /// list of items available in sync result 8 : final List items; 9 : 10 : /// skip count in sync result 11 : final int skip; 12 : 13 : /// limit for result items in sync result 14 : final int limit; 15 : 16 : /// Total items count in sync result 17 : @JsonKey(name: 'total_count') 18 : final int totalCount; 19 : 20 : /// Sync Token for the sync result 21 : @JsonKey(name: 'sync_token') 22 : final String syncToken; 23 : 24 : /// Pagination Token for the sync result 25 : @JsonKey(name: 'pagination_token') 26 : final String paginationToken; 27 1 : SyncResult(this.items, this.skip, this.limit, this.totalCount, this.syncToken, 28 : this.paginationToken); 29 1 : factory SyncResult.fromJson(Map<String, dynamic> json) => 30 1 : _$SyncResultFromJson(json); 31 0 : Map<String, dynamic> toJson() => _$SyncResultToJson(this); 32 : } 33 : 34 : /// Total items available in sync result 35 : @JsonSerializable() 36 : class Items { 37 : final String type; 38 : final String eventAt; 39 : final String contentTypeUid; 40 : final List data; 41 0 : Items(this.type, this.eventAt, this.contentTypeUid, this.data); 42 0 : factory Items.fromJson(Map<String, dynamic> json) => _$ItemsFromJson(json); 43 0 : Map<String, dynamic> toJson() => _$ItemsToJson(this); 44 : } 45 : 46 : /// Data inside sync result's items that contains uid, locale, title etc 47 : @JsonSerializable() 48 : class Data { 49 : final String uid; 50 : final String locale; 51 : final String title; 52 0 : Data(this.uid, this.locale, this.title); 53 0 : factory Data.fromJson(Map<String, dynamic> json) => _$DataFromJson(json); 54 0 : Map<String, dynamic> toJson() => _$DataToJson(this); 55 : }