55
66 */
77
8- const APIClient = require ( '../APIClient.js' ) ;
8+ const APIClient = require ( '../APIClient' ) ;
9+ const AstronomyEvening = require ( './AstronomyEvening' ) ;
10+ const AstronomyMorning = require ( './AstronomyMorning' ) ;
911
1012/**
1113 * The Astronomy model module.
@@ -42,17 +44,32 @@ class Astronomy {
4244 obj = obj || new Astronomy ( ) ;
4345
4446 if ( data . hasOwnProperty ( 'date' ) ) {
45- obj [ 'date' ] = APIClient . convertToType ( data [ 'date' ] , 'Date ' ) ;
47+ obj [ 'date' ] = APIClient . convertToType ( data [ 'date' ] , 'String ' ) ;
4648 }
4749 if ( data . hasOwnProperty ( 'current_time' ) ) {
4850 obj [ 'current_time' ] = APIClient . convertToType ( data [ 'current_time' ] , 'String' ) ;
4951 }
52+ if ( data . hasOwnProperty ( 'mid_night' ) ) {
53+ obj [ 'mid_night' ] = APIClient . convertToType ( data [ 'mid_night' ] , 'String' ) ;
54+ }
55+ if ( data . hasOwnProperty ( 'night_end' ) ) {
56+ obj [ 'night_end' ] = APIClient . convertToType ( data [ 'night_end' ] , 'String' ) ;
57+ }
58+ if ( data . hasOwnProperty ( 'morning' ) ) {
59+ obj [ 'morning' ] = AstronomyMorning . constructFromObject ( data [ 'morning' ] ) ;
60+ }
5061 if ( data . hasOwnProperty ( 'sunrise' ) ) {
5162 obj [ 'sunrise' ] = APIClient . convertToType ( data [ 'sunrise' ] , 'String' ) ;
5263 }
5364 if ( data . hasOwnProperty ( 'sunset' ) ) {
5465 obj [ 'sunset' ] = APIClient . convertToType ( data [ 'sunset' ] , 'String' ) ;
5566 }
67+ if ( data . hasOwnProperty ( 'evening' ) ) {
68+ obj [ 'evening' ] = AstronomyEvening . constructFromObject ( data [ 'evening' ] ) ;
69+ }
70+ if ( data . hasOwnProperty ( 'night_begin' ) ) {
71+ obj [ 'night_begin' ] = APIClient . convertToType ( data [ 'night_begin' ] , 'String' ) ;
72+ }
5673 if ( data . hasOwnProperty ( 'sun_status' ) ) {
5774 obj [ 'sun_status' ] = APIClient . convertToType ( data [ 'sun_status' ] , 'String' ) ;
5875 }
@@ -71,6 +88,9 @@ class Astronomy {
7188 if ( data . hasOwnProperty ( 'sun_azimuth' ) ) {
7289 obj [ 'sun_azimuth' ] = APIClient . convertToType ( data [ 'sun_azimuth' ] , 'Number' ) ;
7390 }
91+ if ( data . hasOwnProperty ( 'moon_phase' ) ) {
92+ obj [ 'moon_phase' ] = APIClient . convertToType ( data [ 'moon_phase' ] , 'String' ) ;
93+ }
7494 if ( data . hasOwnProperty ( 'moonrise' ) ) {
7595 obj [ 'moonrise' ] = APIClient . convertToType ( data [ 'moonrise' ] , 'String' ) ;
7696 }
@@ -92,9 +112,6 @@ class Astronomy {
92112 if ( data . hasOwnProperty ( 'moon_parallactic_angle' ) ) {
93113 obj [ 'moon_parallactic_angle' ] = APIClient . convertToType ( data [ 'moon_parallactic_angle' ] , 'Number' ) ;
94114 }
95- if ( data . hasOwnProperty ( 'moon_phase' ) ) {
96- obj [ 'moon_phase' ] = APIClient . convertToType ( data [ 'moon_phase' ] , 'String' ) ;
97- }
98115 if ( data . hasOwnProperty ( 'moon_illumination_percentage' ) ) {
99116 obj [ 'moon_illumination_percentage' ] = APIClient . convertToType ( data [ 'moon_illumination_percentage' ] , 'String' ) ;
100117 }
@@ -111,18 +128,42 @@ class Astronomy {
111128 * @return {boolean } to indicate whether the JSON data is valid with respect to <code>Astronomy</code>.
112129 */
113130 static validateJSON ( data ) {
131+ // ensure the json data is a string
132+ if ( data [ 'date' ] && ! ( typeof data [ 'date' ] === 'string' || data [ 'date' ] instanceof String ) ) {
133+ throw new Error ( "Expected the field `date` to be a primitive type in the JSON string but got " + data [ 'date' ] ) ;
134+ }
114135 // ensure the json data is a string
115136 if ( data [ 'current_time' ] && ! ( typeof data [ 'current_time' ] === 'string' || data [ 'current_time' ] instanceof String ) ) {
116137 throw new Error ( "Expected the field `current_time` to be a primitive type in the JSON string but got " + data [ 'current_time' ] ) ;
117138 }
118139 // ensure the json data is a string
140+ if ( data [ 'mid_night' ] && ! ( typeof data [ 'mid_night' ] === 'string' || data [ 'mid_night' ] instanceof String ) ) {
141+ throw new Error ( "Expected the field `mid_night` to be a primitive type in the JSON string but got " + data [ 'mid_night' ] ) ;
142+ }
143+ // ensure the json data is a string
144+ if ( data [ 'night_end' ] && ! ( typeof data [ 'night_end' ] === 'string' || data [ 'night_end' ] instanceof String ) ) {
145+ throw new Error ( "Expected the field `night_end` to be a primitive type in the JSON string but got " + data [ 'night_end' ] ) ;
146+ }
147+ // validate the optional field `morning`
148+ if ( data [ 'morning' ] ) { // data not null
149+ AstronomyMorning . validateJSON ( data [ 'morning' ] ) ;
150+ }
151+ // ensure the json data is a string
119152 if ( data [ 'sunrise' ] && ! ( typeof data [ 'sunrise' ] === 'string' || data [ 'sunrise' ] instanceof String ) ) {
120153 throw new Error ( "Expected the field `sunrise` to be a primitive type in the JSON string but got " + data [ 'sunrise' ] ) ;
121154 }
122155 // ensure the json data is a string
123156 if ( data [ 'sunset' ] && ! ( typeof data [ 'sunset' ] === 'string' || data [ 'sunset' ] instanceof String ) ) {
124157 throw new Error ( "Expected the field `sunset` to be a primitive type in the JSON string but got " + data [ 'sunset' ] ) ;
125158 }
159+ // validate the optional field `evening`
160+ if ( data [ 'evening' ] ) { // data not null
161+ AstronomyEvening . validateJSON ( data [ 'evening' ] ) ;
162+ }
163+ // ensure the json data is a string
164+ if ( data [ 'night_begin' ] && ! ( typeof data [ 'night_begin' ] === 'string' || data [ 'night_begin' ] instanceof String ) ) {
165+ throw new Error ( "Expected the field `night_begin` to be a primitive type in the JSON string but got " + data [ 'night_begin' ] ) ;
166+ }
126167 // ensure the json data is a string
127168 if ( data [ 'sun_status' ] && ! ( typeof data [ 'sun_status' ] === 'string' || data [ 'sun_status' ] instanceof String ) ) {
128169 throw new Error ( "Expected the field `sun_status` to be a primitive type in the JSON string but got " + data [ 'sun_status' ] ) ;
@@ -136,6 +177,10 @@ class Astronomy {
136177 throw new Error ( "Expected the field `day_length` to be a primitive type in the JSON string but got " + data [ 'day_length' ] ) ;
137178 }
138179 // ensure the json data is a string
180+ if ( data [ 'moon_phase' ] && ! ( typeof data [ 'moon_phase' ] === 'string' || data [ 'moon_phase' ] instanceof String ) ) {
181+ throw new Error ( "Expected the field `moon_phase` to be a primitive type in the JSON string but got " + data [ 'moon_phase' ] ) ;
182+ }
183+ // ensure the json data is a string
139184 if ( data [ 'moonrise' ] && ! ( typeof data [ 'moonrise' ] === 'string' || data [ 'moonrise' ] instanceof String ) ) {
140185 throw new Error ( "Expected the field `moonrise` to be a primitive type in the JSON string but got " + data [ 'moonrise' ] ) ;
141186 }
@@ -148,10 +193,6 @@ class Astronomy {
148193 throw new Error ( "Expected the field `moon_status` to be a primitive type in the JSON string but got " + data [ 'moon_status' ] ) ;
149194 }
150195 // ensure the json data is a string
151- if ( data [ 'moon_phase' ] && ! ( typeof data [ 'moon_phase' ] === 'string' || data [ 'moon_phase' ] instanceof String ) ) {
152- throw new Error ( "Expected the field `moon_phase` to be a primitive type in the JSON string but got " + data [ 'moon_phase' ] ) ;
153- }
154- // ensure the json data is a string
155196 if ( data [ 'moon_illumination_percentage' ] && ! ( typeof data [ 'moon_illumination_percentage' ] === 'string' || data [ 'moon_illumination_percentage' ] instanceof String ) ) {
156197 throw new Error ( "Expected the field `moon_illumination_percentage` to be a primitive type in the JSON string but got " + data [ 'moon_illumination_percentage' ] ) ;
157198 }
@@ -165,7 +206,7 @@ class Astronomy {
165206
166207
167208/**
168- * @member {Date } date
209+ * @member {String } date
169210 */
170211Astronomy . prototype [ 'date' ] = undefined ;
171212
@@ -174,6 +215,21 @@ Astronomy.prototype['date'] = undefined;
174215 */
175216Astronomy . prototype [ 'current_time' ] = undefined ;
176217
218+ /**
219+ * @member {String} mid_night
220+ */
221+ Astronomy . prototype [ 'mid_night' ] = undefined ;
222+
223+ /**
224+ * @member {String} night_end
225+ */
226+ Astronomy . prototype [ 'night_end' ] = undefined ;
227+
228+ /**
229+ * @member {module:models/AstronomyMorning} morning
230+ */
231+ Astronomy . prototype [ 'morning' ] = undefined ;
232+
177233/**
178234 * @member {String} sunrise
179235 */
@@ -184,6 +240,16 @@ Astronomy.prototype['sunrise'] = undefined;
184240 */
185241Astronomy . prototype [ 'sunset' ] = undefined ;
186242
243+ /**
244+ * @member {module:models/AstronomyEvening} evening
245+ */
246+ Astronomy . prototype [ 'evening' ] = undefined ;
247+
248+ /**
249+ * @member {String} night_begin
250+ */
251+ Astronomy . prototype [ 'night_begin' ] = undefined ;
252+
187253/**
188254 * @member {String} sun_status
189255 */
@@ -214,6 +280,11 @@ Astronomy.prototype['sun_distance'] = undefined;
214280 */
215281Astronomy . prototype [ 'sun_azimuth' ] = undefined ;
216282
283+ /**
284+ * @member {String} moon_phase
285+ */
286+ Astronomy . prototype [ 'moon_phase' ] = undefined ;
287+
217288/**
218289 * @member {String} moonrise
219290 */
@@ -249,11 +320,6 @@ Astronomy.prototype['moon_azimuth'] = undefined;
249320 */
250321Astronomy . prototype [ 'moon_parallactic_angle' ] = undefined ;
251322
252- /**
253- * @member {String} moon_phase
254- */
255- Astronomy . prototype [ 'moon_phase' ] = undefined ;
256-
257323/**
258324 * @member {String} moon_illumination_percentage
259325 */
0 commit comments