|
| 1 | +/* |
| 2 | + * -------------------------------------------------------------------------------- |
| 3 | + * <copyright company="Aspose" file="comment_range_end.go"> |
| 4 | + * Copyright (c) 2025 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 | +package models |
| 29 | + |
| 30 | +import ( |
| 31 | + "errors" |
| 32 | +) |
| 33 | + |
| 34 | +// Comment range end link. |
| 35 | + |
| 36 | +type ICommentRangeEnd interface { |
| 37 | + IsCommentRangeEnd() bool |
| 38 | + Initialize() |
| 39 | + Deserialize(json map[string]interface{}) |
| 40 | + CollectFilesContent(resultFilesContent []FileReference) []FileReference |
| 41 | + Validate() error |
| 42 | + GetLink() IWordsApiLink |
| 43 | + SetLink(value IWordsApiLink) |
| 44 | + GetNodeId() *string |
| 45 | + SetNodeId(value *string) |
| 46 | + GetCommentLink() ICommentLink |
| 47 | + SetCommentLink(value ICommentLink) |
| 48 | +} |
| 49 | + |
| 50 | +type CommentRangeEnd struct { |
| 51 | + // Comment range end link. |
| 52 | + Link IWordsApiLink `json:"Link,omitempty"` |
| 53 | + |
| 54 | + // Comment range end link. |
| 55 | + NodeId *string `json:"NodeId,omitempty"` |
| 56 | + |
| 57 | + // Comment range end link. |
| 58 | + CommentLink ICommentLink `json:"CommentLink,omitempty"` |
| 59 | +} |
| 60 | + |
| 61 | +func (CommentRangeEnd) IsCommentRangeEnd() bool { |
| 62 | + return true |
| 63 | +} |
| 64 | + |
| 65 | +func (CommentRangeEnd) IsNodeLink() bool { |
| 66 | + return true |
| 67 | +} |
| 68 | + |
| 69 | +func (CommentRangeEnd) IsLinkElement() bool { |
| 70 | + return true |
| 71 | +} |
| 72 | + |
| 73 | +func (obj *CommentRangeEnd) Initialize() { |
| 74 | + if (obj.Link != nil) { |
| 75 | + obj.Link.Initialize() |
| 76 | + } |
| 77 | + |
| 78 | + if (obj.CommentLink != nil) { |
| 79 | + obj.CommentLink.Initialize() |
| 80 | + } |
| 81 | + |
| 82 | + |
| 83 | +} |
| 84 | + |
| 85 | +func (obj *CommentRangeEnd) Deserialize(json map[string]interface{}) { |
| 86 | + if jsonValue, exists := json["Link"]; exists { |
| 87 | + if parsedValue, valid := jsonValue.(map[string]interface{}); valid { |
| 88 | + var modelInstance IWordsApiLink = new(WordsApiLink) |
| 89 | + modelInstance.Deserialize(parsedValue) |
| 90 | + obj.Link = modelInstance |
| 91 | + } |
| 92 | + |
| 93 | + } else if jsonValue, exists := json["link"]; exists { |
| 94 | + if parsedValue, valid := jsonValue.(map[string]interface{}); valid { |
| 95 | + var modelInstance IWordsApiLink = new(WordsApiLink) |
| 96 | + modelInstance.Deserialize(parsedValue) |
| 97 | + obj.Link = modelInstance |
| 98 | + } |
| 99 | + |
| 100 | + } |
| 101 | + |
| 102 | + if jsonValue, exists := json["NodeId"]; exists { |
| 103 | + if parsedValue, valid := jsonValue.(string); valid { |
| 104 | + obj.NodeId = &parsedValue |
| 105 | + } |
| 106 | + |
| 107 | + } else if jsonValue, exists := json["nodeId"]; exists { |
| 108 | + if parsedValue, valid := jsonValue.(string); valid { |
| 109 | + obj.NodeId = &parsedValue |
| 110 | + } |
| 111 | + |
| 112 | + } |
| 113 | + |
| 114 | + if jsonValue, exists := json["CommentLink"]; exists { |
| 115 | + if parsedValue, valid := jsonValue.(map[string]interface{}); valid { |
| 116 | + var modelInstance ICommentLink = nil |
| 117 | + if jsonType, found := parsedValue["$type"]; found { |
| 118 | + jsonTypeStr := jsonType.(string) |
| 119 | + if jsonTypeStr == "Comment, _" { modelInstance = new(Comment) } |
| 120 | + } |
| 121 | + |
| 122 | + if modelInstance == nil { modelInstance = new(CommentLink) } |
| 123 | + modelInstance.Deserialize(parsedValue) |
| 124 | + obj.CommentLink = modelInstance |
| 125 | + } |
| 126 | + |
| 127 | + } else if jsonValue, exists := json["commentLink"]; exists { |
| 128 | + if parsedValue, valid := jsonValue.(map[string]interface{}); valid { |
| 129 | + var modelInstance ICommentLink = nil |
| 130 | + if jsonType, found := parsedValue["$type"]; found { |
| 131 | + jsonTypeStr := jsonType.(string) |
| 132 | + if jsonTypeStr == "Comment, _" { modelInstance = new(Comment) } |
| 133 | + } |
| 134 | + |
| 135 | + if modelInstance == nil { modelInstance = new(CommentLink) } |
| 136 | + modelInstance.Deserialize(parsedValue) |
| 137 | + obj.CommentLink = modelInstance |
| 138 | + } |
| 139 | + |
| 140 | + } |
| 141 | +} |
| 142 | + |
| 143 | +func (obj *CommentRangeEnd) CollectFilesContent(resultFilesContent []FileReference) []FileReference { |
| 144 | + return resultFilesContent |
| 145 | +} |
| 146 | + |
| 147 | +func (obj *CommentRangeEnd) Validate() error { |
| 148 | + if obj == nil { |
| 149 | + return errors.New("Invalid object.") |
| 150 | + } |
| 151 | + |
| 152 | + if obj.Link != nil { |
| 153 | + if err := obj.Link.Validate(); err != nil { |
| 154 | + return err |
| 155 | + } |
| 156 | + } |
| 157 | + if obj.CommentLink != nil { |
| 158 | + if err := obj.CommentLink.Validate(); err != nil { |
| 159 | + return err |
| 160 | + } |
| 161 | + } |
| 162 | + |
| 163 | + return nil; |
| 164 | +} |
| 165 | + |
| 166 | +func (obj *CommentRangeEnd) GetLink() IWordsApiLink { |
| 167 | + return obj.Link |
| 168 | +} |
| 169 | + |
| 170 | +func (obj *CommentRangeEnd) SetLink(value IWordsApiLink) { |
| 171 | + obj.Link = value |
| 172 | +} |
| 173 | + |
| 174 | +func (obj *CommentRangeEnd) GetNodeId() *string { |
| 175 | + return obj.NodeId |
| 176 | +} |
| 177 | + |
| 178 | +func (obj *CommentRangeEnd) SetNodeId(value *string) { |
| 179 | + obj.NodeId = value |
| 180 | +} |
| 181 | + |
| 182 | +func (obj *CommentRangeEnd) GetCommentLink() ICommentLink { |
| 183 | + return obj.CommentLink |
| 184 | +} |
| 185 | + |
| 186 | +func (obj *CommentRangeEnd) SetCommentLink(value ICommentLink) { |
| 187 | + obj.CommentLink = value |
| 188 | +} |
| 189 | + |
0 commit comments