structs for getAttachment
This commit is contained in:
		
							parent
							
								
									7423135fea
								
							
						
					
					
						commit
						fb9f7135dd
					
				
					 1 changed files with 29 additions and 1 deletions
				
			
		| 
						 | 
					@ -1,5 +1,7 @@
 | 
				
			||||||
//data structures
 | 
					//data structures
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import 'dart:typed_data';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GetThreadResponse {
 | 
					class GetThreadResponse {
 | 
				
			||||||
  final int id;
 | 
					  final int id;
 | 
				
			||||||
  final List<String> messages;
 | 
					  final List<String> messages;
 | 
				
			||||||
| 
						 | 
					@ -76,7 +78,7 @@ class SerializableMessage {
 | 
				
			||||||
    required this.subject,
 | 
					    required this.subject,
 | 
				
			||||||
    required this.date,
 | 
					    required this.date,
 | 
				
			||||||
    required this.uid,
 | 
					    required this.uid,
 | 
				
			||||||
    required this.list,
 | 
					    required this.list, //email list???
 | 
				
			||||||
    required this.id,
 | 
					    required this.id,
 | 
				
			||||||
    required this.in_reply_to,
 | 
					    required this.in_reply_to,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
| 
						 | 
					@ -118,3 +120,29 @@ class AttachmentInfo {
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AttachmentInfoList extends Iterable<AttachmentInfo> {
 | 
				
			||||||
 | 
					  final List<AttachmentInfo> _attachments;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  AttachmentInfoList(this._attachments);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  factory AttachmentInfoList.fromJsonList(List<Map<String, dynamic>> jsonList) {
 | 
				
			||||||
 | 
					    return AttachmentInfoList(jsonList.map((json) => AttachmentInfo.fromJson(json)).toList());
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  Iterator<AttachmentInfo> get iterator => _attachments.iterator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  String toString() => _attachments.toString();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AttachmentResponse {
 | 
				
			||||||
 | 
					  final name;
 | 
				
			||||||
 | 
					  final Uint8List data;
 | 
				
			||||||
 | 
					  AttachmentResponse({required this.name, required this.data});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  factory AttachmentResponse.fromJson(Map<String, dynamic> json) {
 | 
				
			||||||
 | 
					    return AttachmentResponse(name: json["name"], data: json["data"],);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue