1+ # coding: utf-8
2+ # -----------------------------------------------------------------------------------
3+ # <copyright company="Aspose" file="bookmark_insert.py">
4+ # Copyright (c) 2022 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+ import pprint
27+ import re # noqa: F401
28+
29+ import datetime
30+ import six
31+ import json
32+
33+
34+ class BookmarkInsert (object ):
35+ """Represents a bookmark to insert.
36+ """
37+
38+ """
39+ Attributes:
40+ swagger_types (dict): The key is attribute name
41+ and the value is attribute type.
42+ attribute_map (dict): The key is attribute name
43+ and the value is json key in definition.
44+ """
45+ swagger_types = {
46+ 'name' : 'str' ,
47+ 'text' : 'str' ,
48+ 'end_range' : 'DocumentPosition' ,
49+ 'start_range' : 'DocumentPosition'
50+ }
51+
52+ attribute_map = {
53+ 'name' : 'Name' ,
54+ 'text' : 'Text' ,
55+ 'end_range' : 'EndRange' ,
56+ 'start_range' : 'StartRange'
57+ }
58+
59+ def __init__ (self , name = None , text = None , end_range = None , start_range = None ): # noqa: E501
60+ """BookmarkInsert - a model defined in Swagger""" # noqa: E501
61+
62+ self ._name = None
63+ self ._text = None
64+ self ._end_range = None
65+ self ._start_range = None
66+ self .discriminator = None
67+
68+ if name is not None :
69+ self .name = name
70+ if text is not None :
71+ self .text = text
72+ if end_range is not None :
73+ self .end_range = end_range
74+ if start_range is not None :
75+ self .start_range = start_range
76+
77+ @property
78+ def name (self ):
79+ """Gets the name of this BookmarkInsert. # noqa: E501
80+
81+ Gets or sets the name of the bookmark. # noqa: E501
82+
83+ :return: The name of this BookmarkInsert. # noqa: E501
84+ :rtype: str
85+ """
86+ return self ._name
87+
88+ @name .setter
89+ def name (self , name ):
90+ """Sets the name of this BookmarkInsert.
91+
92+ Gets or sets the name of the bookmark. # noqa: E501
93+
94+ :param name: The name of this BookmarkInsert. # noqa: E501
95+ :type: str
96+ """
97+ self ._name = name
98+
99+ @property
100+ def text (self ):
101+ """Gets the text of this BookmarkInsert. # noqa: E501
102+
103+ Gets or sets text, enclosed in the bookmark. # noqa: E501
104+
105+ :return: The text of this BookmarkInsert. # noqa: E501
106+ :rtype: str
107+ """
108+ return self ._text
109+
110+ @text .setter
111+ def text (self , text ):
112+ """Sets the text of this BookmarkInsert.
113+
114+ Gets or sets text, enclosed in the bookmark. # noqa: E501
115+
116+ :param text: The text of this BookmarkInsert. # noqa: E501
117+ :type: str
118+ """
119+ self ._text = text
120+
121+ @property
122+ def end_range (self ):
123+ """Gets the end_range of this BookmarkInsert. # noqa: E501
124+
125+ Gets or sets the link to end bookmark node. # noqa: E501
126+
127+ :return: The end_range of this BookmarkInsert. # noqa: E501
128+ :rtype: DocumentPosition
129+ """
130+ return self ._end_range
131+
132+ @end_range .setter
133+ def end_range (self , end_range ):
134+ """Sets the end_range of this BookmarkInsert.
135+
136+ Gets or sets the link to end bookmark node. # noqa: E501
137+
138+ :param end_range: The end_range of this BookmarkInsert. # noqa: E501
139+ :type: DocumentPosition
140+ """
141+ self ._end_range = end_range
142+
143+ @property
144+ def start_range (self ):
145+ """Gets the start_range of this BookmarkInsert. # noqa: E501
146+
147+ Gets or sets the link to start bookmark node. # noqa: E501
148+
149+ :return: The start_range of this BookmarkInsert. # noqa: E501
150+ :rtype: DocumentPosition
151+ """
152+ return self ._start_range
153+
154+ @start_range .setter
155+ def start_range (self , start_range ):
156+ """Sets the start_range of this BookmarkInsert.
157+
158+ Gets or sets the link to start bookmark node. # noqa: E501
159+
160+ :param start_range: The start_range of this BookmarkInsert. # noqa: E501
161+ :type: DocumentPosition
162+ """
163+ self ._start_range = start_range
164+
165+
166+ def to_dict (self ):
167+ """Returns the model properties as a dict"""
168+ result = {}
169+
170+ for attr , _ in six .iteritems (self .swagger_types ):
171+ value = getattr (self , attr )
172+ if value is None :
173+ continue
174+ if isinstance (value , list ):
175+ result [self .attribute_map [attr ]] = list (map (
176+ lambda x : x .to_dict () if hasattr (x , "to_dict" ) else x ,
177+ value
178+ ))
179+ elif hasattr (value , "to_dict" ):
180+ result [self .attribute_map [attr ]] = value .to_dict ()
181+ elif isinstance (value , dict ):
182+ result [self .attribute_map [attr ]] = dict (map (
183+ lambda item : (item [0 ], item [1 ].to_dict ())
184+ if hasattr (item [1 ], "to_dict" ) else item ,
185+ value .items ()
186+ ))
187+ elif isinstance (value , (datetime .datetime , datetime .date )):
188+ result [self .attribute_map [attr ]] = value .isoformat ()
189+ else :
190+ result [self .attribute_map [attr ]] = value
191+
192+ return result
193+
194+ def to_json (self ):
195+ """Returns the model properties as a dict"""
196+ result = {}
197+
198+ for attr , _ in six .iteritems (self .swagger_types ):
199+ value = getattr (self , attr )
200+ if isinstance (value , list ):
201+ result [self .attribute_map [attr ]] = list (map (
202+ lambda x : x .to_dict () if hasattr (x , "to_dict" ) else x ,
203+ value
204+ ))
205+ elif hasattr (value , "to_dict" ):
206+ result [self .attribute_map [attr ]] = value .to_dict ()
207+ elif isinstance (value , dict ):
208+ result [self .attribute_map [attr ]] = dict (map (
209+ lambda item : (item [0 ], item [1 ].to_dict ())
210+ if hasattr (item [1 ], "to_dict" ) else item ,
211+ value .items ()
212+ ))
213+ elif isinstance (value , (datetime .datetime , datetime .date )):
214+ result [self .attribute_map [attr ]] = value .isoformat ()
215+ else :
216+ result [self .attribute_map [attr ]] = value
217+
218+ return json .dumps (result )
219+
220+ def to_str (self ):
221+ """Returns the string representation of the model"""
222+ return pprint .pformat (self .to_dict ())
223+
224+ def __repr__ (self ):
225+ """For `print` and `pprint`"""
226+ return self .to_str ()
227+
228+ def __eq__ (self , other ):
229+ """Returns true if both objects are equal"""
230+ if not isinstance (other , BookmarkInsert ):
231+ return False
232+
233+ return self .__dict__ == other .__dict__
234+
235+ def __ne__ (self , other ):
236+ """Returns true if both objects are not equal"""
237+ return not self == other
0 commit comments