|
27 | 27 |
|
28 | 28 | import Foundation |
29 | 29 |
|
30 | | -// Represents a entry which will be appended to the original resource document. |
| 30 | +// Represents a base class for document which will be appended to the original resource document. |
31 | 31 | @available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *) |
32 | 32 | public class BaseEntry : Codable, WordsApiModel { |
33 | | - // Field of href. Represents a entry which will be appended to the original resource document. |
34 | | - private var _href : String? = nil; |
| 33 | + // Field of fileReference. Represents a base class for document which will be appended to the original resource document. |
| 34 | + private var _fileReference : FileReference? = nil; |
35 | 35 |
|
36 | | - public var href : String? { |
| 36 | + public var fileReference : FileReference? { |
37 | 37 | get { |
38 | | - return self._href; |
| 38 | + return self._fileReference; |
39 | 39 | } |
40 | 40 | set { |
41 | | - self._href = newValue; |
| 41 | + self._fileReference = newValue; |
42 | 42 | } |
43 | 43 | } |
44 | 44 |
|
45 | 45 | private enum CodingKeys: String, CodingKey { |
46 | | - case href = "Href"; |
| 46 | + case fileReference = "FileReference"; |
47 | 47 | case invalidCodingKey; |
48 | 48 | } |
49 | 49 |
|
50 | | - public init() { |
| 50 | + internal init() { |
51 | 51 | } |
52 | 52 |
|
53 | 53 | public required init(from decoder: Decoder) throws { |
54 | 54 | let container = try decoder.container(keyedBy: CodingKeys.self); |
55 | | - self.href = try container.decodeIfPresent(String.self, forKey: .href); |
| 55 | + self.fileReference = try container.decodeIfPresent(FileReference.self, forKey: .fileReference); |
56 | 56 | } |
57 | 57 |
|
58 | 58 | public func encode(to encoder: Encoder) throws { |
59 | 59 | var container = encoder.container(keyedBy: CodingKeys.self); |
60 | | - if (self.href != nil) { |
61 | | - try container.encode(self.href, forKey: .href); |
| 60 | + if (self.fileReference != nil) { |
| 61 | + try container.encode(self.fileReference, forKey: .fileReference); |
62 | 62 | } |
63 | 63 | } |
64 | 64 |
|
65 | | - // Sets href. Gets or sets the path to entry to append at the server. |
66 | | - public func setHref(href : String?) -> BaseEntry { |
67 | | - self.href = href; |
| 65 | + public func collectFilesContent(_ resultFilesContent : inout [FileReference]) { |
| 66 | + if (self.fileReference != nil) |
| 67 | + { |
| 68 | + self.fileReference!.collectFilesContent(&resultFilesContent); |
| 69 | + } |
| 70 | + |
| 71 | + } |
| 72 | + |
| 73 | + // Sets fileReference. Gets or sets the file reference. |
| 74 | + public func setFileReference(fileReference : FileReference?) -> BaseEntry { |
| 75 | + self.fileReference = fileReference; |
68 | 76 | return self; |
69 | 77 | } |
70 | 78 |
|
71 | | - // Gets href. Gets or sets the path to entry to append at the server. |
72 | | - public func getHref() -> String? { |
73 | | - return self.href; |
| 79 | + // Gets fileReference. Gets or sets the file reference. |
| 80 | + public func getFileReference() -> FileReference? { |
| 81 | + return self.fileReference; |
74 | 82 | } |
75 | 83 | } |
0 commit comments