Skip to content

Commit 6cffae2

Browse files
committed
Added Astronomy API New Fields in SDK
1 parent e0bdb3a commit 6cffae2

20 files changed

+1130
-172
lines changed

README.md

Lines changed: 239 additions & 96 deletions
Large diffs are not rendered by default.

docs/Astronomy.md

100755100644
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,29 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**date** | **Date** | | [optional]
7+
**date** | **String** | | [optional]
88
**currentTime** | **String** | | [optional]
9+
**midNight** | **String** | | [optional]
10+
**nightEnd** | **String** | | [optional]
11+
**morning** | [**AstronomyMorning**](AstronomyMorning.md) | | [optional]
912
**sunrise** | **String** | | [optional]
1013
**sunset** | **String** | | [optional]
14+
**evening** | [**AstronomyEvening**](AstronomyEvening.md) | | [optional]
15+
**nightBegin** | **String** | | [optional]
1116
**sunStatus** | **String** | | [optional]
1217
**solarNoon** | **String** | | [optional]
1318
**dayLength** | **String** | | [optional]
1419
**sunAltitude** | **Number** | | [optional]
1520
**sunDistance** | **Number** | | [optional]
1621
**sunAzimuth** | **Number** | | [optional]
22+
**moonPhase** | **String** | | [optional]
1723
**moonrise** | **String** | | [optional]
1824
**moonset** | **String** | | [optional]
1925
**moonStatus** | **String** | | [optional]
2026
**moonAltitude** | **Number** | | [optional]
2127
**moonDistance** | **Number** | | [optional]
2228
**moonAzimuth** | **Number** | | [optional]
2329
**moonParallacticAngle** | **Number** | | [optional]
24-
**moonPhase** | **String** | | [optional]
2530
**moonIlluminationPercentage** | **String** | | [optional]
2631
**moonAngle** | **Number** | | [optional]
2732

docs/AstronomyEvening.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# AstronomyEvening
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**goldenHourBegin** | **String** | | [optional]
8+
**goldenHourEnd** | **String** | | [optional]
9+
**blueHourBegin** | **String** | | [optional]
10+
**blueHourEnd** | **String** | | [optional]
11+
**civilTwilightBegin** | **String** | | [optional]
12+
**civilTwilightEnd** | **String** | | [optional]
13+
**nauticalTwilightBegin** | **String** | | [optional]
14+
**nauticalTwilightEnd** | **String** | | [optional]
15+
**astronomicalTwilightBegin** | **String** | | [optional]
16+
**astronomicalTwilightEnd** | **String** | | [optional]
17+
18+

docs/AstronomyLocation.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# AstronomyLocation
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**locationString** | **String** | | [optional]
8+
**continentCode** | **String** | | [optional]
9+
**continentName** | **String** | | [optional]
10+
**countryCode2** | **String** | | [optional]
11+
**countryCode3** | **String** | | [optional]
12+
**countryName** | **String** | | [optional]
13+
**countryNameOfficial** | **String** | | [optional]
14+
**isEu** | **Boolean** | | [optional]
15+
**stateProv** | **String** | | [optional]
16+
**stateCode** | **String** | | [optional]
17+
**district** | **String** | | [optional]
18+
**city** | **String** | | [optional]
19+
**locality** | **String** | | [optional]
20+
**zipcode** | **String** | | [optional]
21+
**latitude** | **String** | | [optional]
22+
**longitude** | **String** | | [optional]
23+
**elevation** | **String** | | [optional]
24+
25+

docs/AstronomyMorning.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# AstronomyMorning
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**astronomicalTwilightBegin** | **String** | | [optional]
8+
**astronomicalTwilightEnd** | **String** | | [optional]
9+
**nauticalTwilightBegin** | **String** | | [optional]
10+
**nauticalTwilightEnd** | **String** | | [optional]
11+
**civilTwilightBegin** | **String** | | [optional]
12+
**civilTwilightEnd** | **String** | | [optional]
13+
**blueHourBegin** | **String** | | [optional]
14+
**blueHourEnd** | **String** | | [optional]
15+
**goldenHourBegin** | **String** | | [optional]
16+
**goldenHourEnd** | **String** | | [optional]
17+
18+

docs/AstronomyResponse.md

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# AstronomyResponse
1+
# IpGeolocationIoIpIntelligenceProducts.AstronomyResponse
22

33
## Properties
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**ip** | **String** | | [optional]
8-
**location** | [**TimezoneLocation**](TimezoneLocation.md) | | [optional]
8+
**location** | [**AstronomyLocation**](AstronomyLocation.md) | | [optional]
99
**astronomy** | [**Astronomy**](Astronomy.md) | | [optional]
1010

1111

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "IPGeolocation.io",
33
"name": "ip-geolocation-api-javascript-sdk",
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"description": "Official JavaScript SDK for IPGeolocation.io. Effortlessly integrate IP Geolocation, IP Security, Timezone, ASN, Astronomy, User Agent, Abuse Contact, and Timezone Conversion APIs into your Node.js applications.",
66
"license": "ISC",
77
"main": "dist/index.js",

src/models/Astronomy.js

100755100644
Lines changed: 81 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
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
*/
170211
Astronomy.prototype['date'] = undefined;
171212

@@ -174,6 +215,21 @@ Astronomy.prototype['date'] = undefined;
174215
*/
175216
Astronomy.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
*/
185241
Astronomy.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
*/
215281
Astronomy.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
*/
250321
Astronomy.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

Comments
 (0)