5
5
6
6
*/
7
7
8
- const APIClient = require ( '../APIClient.js' ) ;
8
+ const APIClient = require ( '../APIClient' ) ;
9
+ const AstronomyEvening = require ( './AstronomyEvening' ) ;
10
+ const AstronomyMorning = require ( './AstronomyMorning' ) ;
9
11
10
12
/**
11
13
* The Astronomy model module.
@@ -42,17 +44,32 @@ class Astronomy {
42
44
obj = obj || new Astronomy ( ) ;
43
45
44
46
if ( data . hasOwnProperty ( 'date' ) ) {
45
- obj [ 'date' ] = APIClient . convertToType ( data [ 'date' ] , 'Date ' ) ;
47
+ obj [ 'date' ] = APIClient . convertToType ( data [ 'date' ] , 'String ' ) ;
46
48
}
47
49
if ( data . hasOwnProperty ( 'current_time' ) ) {
48
50
obj [ 'current_time' ] = APIClient . convertToType ( data [ 'current_time' ] , 'String' ) ;
49
51
}
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
+ }
50
61
if ( data . hasOwnProperty ( 'sunrise' ) ) {
51
62
obj [ 'sunrise' ] = APIClient . convertToType ( data [ 'sunrise' ] , 'String' ) ;
52
63
}
53
64
if ( data . hasOwnProperty ( 'sunset' ) ) {
54
65
obj [ 'sunset' ] = APIClient . convertToType ( data [ 'sunset' ] , 'String' ) ;
55
66
}
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
+ }
56
73
if ( data . hasOwnProperty ( 'sun_status' ) ) {
57
74
obj [ 'sun_status' ] = APIClient . convertToType ( data [ 'sun_status' ] , 'String' ) ;
58
75
}
@@ -71,6 +88,9 @@ class Astronomy {
71
88
if ( data . hasOwnProperty ( 'sun_azimuth' ) ) {
72
89
obj [ 'sun_azimuth' ] = APIClient . convertToType ( data [ 'sun_azimuth' ] , 'Number' ) ;
73
90
}
91
+ if ( data . hasOwnProperty ( 'moon_phase' ) ) {
92
+ obj [ 'moon_phase' ] = APIClient . convertToType ( data [ 'moon_phase' ] , 'String' ) ;
93
+ }
74
94
if ( data . hasOwnProperty ( 'moonrise' ) ) {
75
95
obj [ 'moonrise' ] = APIClient . convertToType ( data [ 'moonrise' ] , 'String' ) ;
76
96
}
@@ -92,9 +112,6 @@ class Astronomy {
92
112
if ( data . hasOwnProperty ( 'moon_parallactic_angle' ) ) {
93
113
obj [ 'moon_parallactic_angle' ] = APIClient . convertToType ( data [ 'moon_parallactic_angle' ] , 'Number' ) ;
94
114
}
95
- if ( data . hasOwnProperty ( 'moon_phase' ) ) {
96
- obj [ 'moon_phase' ] = APIClient . convertToType ( data [ 'moon_phase' ] , 'String' ) ;
97
- }
98
115
if ( data . hasOwnProperty ( 'moon_illumination_percentage' ) ) {
99
116
obj [ 'moon_illumination_percentage' ] = APIClient . convertToType ( data [ 'moon_illumination_percentage' ] , 'String' ) ;
100
117
}
@@ -111,18 +128,42 @@ class Astronomy {
111
128
* @return {boolean } to indicate whether the JSON data is valid with respect to <code>Astronomy</code>.
112
129
*/
113
130
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
+ }
114
135
// ensure the json data is a string
115
136
if ( data [ 'current_time' ] && ! ( typeof data [ 'current_time' ] === 'string' || data [ 'current_time' ] instanceof String ) ) {
116
137
throw new Error ( "Expected the field `current_time` to be a primitive type in the JSON string but got " + data [ 'current_time' ] ) ;
117
138
}
118
139
// 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
119
152
if ( data [ 'sunrise' ] && ! ( typeof data [ 'sunrise' ] === 'string' || data [ 'sunrise' ] instanceof String ) ) {
120
153
throw new Error ( "Expected the field `sunrise` to be a primitive type in the JSON string but got " + data [ 'sunrise' ] ) ;
121
154
}
122
155
// ensure the json data is a string
123
156
if ( data [ 'sunset' ] && ! ( typeof data [ 'sunset' ] === 'string' || data [ 'sunset' ] instanceof String ) ) {
124
157
throw new Error ( "Expected the field `sunset` to be a primitive type in the JSON string but got " + data [ 'sunset' ] ) ;
125
158
}
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
+ }
126
167
// ensure the json data is a string
127
168
if ( data [ 'sun_status' ] && ! ( typeof data [ 'sun_status' ] === 'string' || data [ 'sun_status' ] instanceof String ) ) {
128
169
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 {
136
177
throw new Error ( "Expected the field `day_length` to be a primitive type in the JSON string but got " + data [ 'day_length' ] ) ;
137
178
}
138
179
// 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
139
184
if ( data [ 'moonrise' ] && ! ( typeof data [ 'moonrise' ] === 'string' || data [ 'moonrise' ] instanceof String ) ) {
140
185
throw new Error ( "Expected the field `moonrise` to be a primitive type in the JSON string but got " + data [ 'moonrise' ] ) ;
141
186
}
@@ -148,10 +193,6 @@ class Astronomy {
148
193
throw new Error ( "Expected the field `moon_status` to be a primitive type in the JSON string but got " + data [ 'moon_status' ] ) ;
149
194
}
150
195
// 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
155
196
if ( data [ 'moon_illumination_percentage' ] && ! ( typeof data [ 'moon_illumination_percentage' ] === 'string' || data [ 'moon_illumination_percentage' ] instanceof String ) ) {
156
197
throw new Error ( "Expected the field `moon_illumination_percentage` to be a primitive type in the JSON string but got " + data [ 'moon_illumination_percentage' ] ) ;
157
198
}
@@ -165,7 +206,7 @@ class Astronomy {
165
206
166
207
167
208
/**
168
- * @member {Date } date
209
+ * @member {String } date
169
210
*/
170
211
Astronomy . prototype [ 'date' ] = undefined ;
171
212
@@ -174,6 +215,21 @@ Astronomy.prototype['date'] = undefined;
174
215
*/
175
216
Astronomy . prototype [ 'current_time' ] = undefined ;
176
217
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
+
177
233
/**
178
234
* @member {String} sunrise
179
235
*/
@@ -184,6 +240,16 @@ Astronomy.prototype['sunrise'] = undefined;
184
240
*/
185
241
Astronomy . prototype [ 'sunset' ] = undefined ;
186
242
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
+
187
253
/**
188
254
* @member {String} sun_status
189
255
*/
@@ -214,6 +280,11 @@ Astronomy.prototype['sun_distance'] = undefined;
214
280
*/
215
281
Astronomy . prototype [ 'sun_azimuth' ] = undefined ;
216
282
283
+ /**
284
+ * @member {String} moon_phase
285
+ */
286
+ Astronomy . prototype [ 'moon_phase' ] = undefined ;
287
+
217
288
/**
218
289
* @member {String} moonrise
219
290
*/
@@ -249,11 +320,6 @@ Astronomy.prototype['moon_azimuth'] = undefined;
249
320
*/
250
321
Astronomy . prototype [ 'moon_parallactic_angle' ] = undefined ;
251
322
252
- /**
253
- * @member {String} moon_phase
254
- */
255
- Astronomy . prototype [ 'moon_phase' ] = undefined ;
256
-
257
323
/**
258
324
* @member {String} moon_illumination_percentage
259
325
*/
0 commit comments