|
| 1 | +/* |
| 2 | + * -------------------------------------------------------------------------------- |
| 3 | + * <copyright company="Aspose" file="NewDocumentPosition.swift"> |
| 4 | + * Copyright (c) 2023 Aspose.Words for Cloud |
| 5 | + * </copyright> |
| 6 | + * <summary> |
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | + * of this software and associated documentation files (the "Software"), to deal |
| 9 | + * in the Software without restriction, including without limitation the rights |
| 10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | + * copies of the Software, and to permit persons to whom the Software is |
| 12 | + * furnished to do so, subject to the following conditions: |
| 13 | + * |
| 14 | + * The above copyright notice and this permission notice shall be included in all |
| 15 | + * copies or substantial portions of the Software. |
| 16 | + * |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | + * SOFTWARE. |
| 24 | + * </summary> |
| 25 | + * -------------------------------------------------------------------------------- |
| 26 | + */ |
| 27 | + |
| 28 | +import Foundation |
| 29 | + |
| 30 | +// DTO container with a new position in the document tree. |
| 31 | +@available(macOS 10.12, iOS 10.3, watchOS 3.3, tvOS 12.0, *) |
| 32 | +public class NewDocumentPosition : Codable, WordsApiModel { |
| 33 | + // Field of nodeId. DTO container with a new position in the document tree. |
| 34 | + private var _nodeId : String? = nil; |
| 35 | + |
| 36 | + public var nodeId : String? { |
| 37 | + get { |
| 38 | + return self._nodeId; |
| 39 | + } |
| 40 | + set { |
| 41 | + self._nodeId = newValue; |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + // Field of offset. DTO container with a new position in the document tree. |
| 46 | + private var _offset : Int? = nil; |
| 47 | + |
| 48 | + public var offset : Int? { |
| 49 | + get { |
| 50 | + return self._offset; |
| 51 | + } |
| 52 | + set { |
| 53 | + self._offset = newValue; |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + private enum CodingKeys: String, CodingKey { |
| 58 | + case nodeId = "NodeId"; |
| 59 | + case offset = "Offset"; |
| 60 | + case invalidCodingKey; |
| 61 | + } |
| 62 | + |
| 63 | + public init() { |
| 64 | + } |
| 65 | + |
| 66 | + public required init(from decoder: Decoder) throws { |
| 67 | + let container = try decoder.container(keyedBy: CodingKeys.self); |
| 68 | + self.nodeId = try container.decodeIfPresent(String.self, forKey: .nodeId); |
| 69 | + self.offset = try container.decodeIfPresent(Int.self, forKey: .offset); |
| 70 | + } |
| 71 | + |
| 72 | + public func encode(to encoder: Encoder) throws { |
| 73 | + var container = encoder.container(keyedBy: CodingKeys.self); |
| 74 | + if (self.nodeId != nil) { |
| 75 | + try container.encode(self.nodeId, forKey: .nodeId); |
| 76 | + } |
| 77 | + if (self.offset != nil) { |
| 78 | + try container.encode(self.offset, forKey: .offset); |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + public func collectFilesContent(_ resultFilesContent : inout [FileReference]) { |
| 83 | + } |
| 84 | + |
| 85 | + // Sets nodeId. Gets or sets the node id. |
| 86 | + public func setNodeId(nodeId : String?) -> NewDocumentPosition { |
| 87 | + self.nodeId = nodeId; |
| 88 | + return self; |
| 89 | + } |
| 90 | + |
| 91 | + // Gets nodeId. Gets or sets the node id. |
| 92 | + public func getNodeId() -> String? { |
| 93 | + return self.nodeId; |
| 94 | + } |
| 95 | + |
| 96 | + |
| 97 | + // Sets offset. Gets or sets the offset in the node. |
| 98 | + public func setOffset(offset : Int?) -> NewDocumentPosition { |
| 99 | + self.offset = offset; |
| 100 | + return self; |
| 101 | + } |
| 102 | + |
| 103 | + // Gets offset. Gets or sets the offset in the node. |
| 104 | + public func getOffset() -> Int? { |
| 105 | + return self.offset; |
| 106 | + } |
| 107 | +} |
0 commit comments