mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Swift
		
	
| 
											3 years ago
										 | // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. | ||
|  | 
 | ||
|  | import Foundation | ||
|  | 
 | ||
|  | public class GetMessagesResponse: SnodeResponse { | ||
|  |     private enum CodingKeys: String, CodingKey { | ||
|  |         case messages | ||
|  |         case more | ||
|  |     } | ||
|  |      | ||
|  |     public class RawMessage: Codable { | ||
|  |         private enum CodingKeys: String, CodingKey { | ||
|  |             case data | ||
|  |             case expiration | ||
|  |             case hash | ||
|  |             case timestamp | ||
|  |         } | ||
|  |          | ||
|  |         public let data: String | ||
|  |         public let expiration: Int64? | ||
|  |         public let hash: String | ||
|  |         public let timestamp: Int64 | ||
|  |     } | ||
|  |      | ||
|  |     public let messages: [RawMessage] | ||
|  |     public let more: Bool | ||
|  |      | ||
|  |     // MARK: - Initialization | ||
|  |      | ||
|  |     required init(from decoder: Decoder) throws { | ||
|  |         let container: KeyedDecodingContainer<CodingKeys> = try decoder.container(keyedBy: CodingKeys.self) | ||
|  |          | ||
|  |         messages = try container.decode([RawMessage].self, forKey: .messages) | ||
|  |         more = try container.decode(Bool.self, forKey: .more) | ||
|  |          | ||
|  |         try super.init(from: decoder) | ||
|  |     } | ||
|  | } |