Package com.timeanddate.services
Class AstronomyService
java.lang.Object
com.timeanddate.services.BaseService
com.timeanddate.services.AstronomyService
- Author:
- Cato Auestad <cato@timeanddate.com>
-
Field Summary
Fields inherited from class com.timeanddate.services.BaseService
Language, ServiceName, Version
-
Constructor Summary
ConstructorsConstructorDescriptionAstronomyService(String accessKey, String secretKey)
The astronomy service can be used retrieve rise, set, noon and twilight times for sun and moon for all locations. -
Method Summary
Modifier and TypeMethodDescriptionvoid
getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, TADDateTime startDate)
Gets the specified object type (Moon, Sun) for a specified place by start date.getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, TADDateTime startDate, TADDateTime endDate)
Gets the specified object type (Moon, Sun) for a specified place by start date.getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, Calendar startDate)
Gets the specified object type (Moon, Sun) for a specified place by start date.getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, Calendar startDate, Calendar endDate)
Gets the specified object type (Moon, Sun) for a specified place by start date.boolean
boolean
boolean
int
void
void
setIncludeCoordinates(boolean bool)
void
setIncludeISOTime(boolean bool)
void
setIncludeUTCTime(boolean bool)
void
setRadius(int radius)
-
Constructor Details
-
AstronomyService
The astronomy service can be used retrieve rise, set, noon and twilight times for sun and moon for all locations. The service also exposes the azimuth of the events and altitude and distance (for the noon event).- Parameters:
accessKey
- Access key.secretKey
- Secret key.- Throws:
AuthenticationException
- Encryption of the authentication failed
-
-
Method Details
-
getAstronomicalInfo
public List<AstronomyLocation> getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, Calendar startDate) throws IllegalArgumentException, ServerSideExceptionGets the specified object type (Moon, Sun) for a specified place by start date.- Parameters:
objectType
- The astronomical object type (Moon or Sun)placeId
- Place identifier.startDate
- Start date.- Returns:
- A list of astronomical information.
- Throws:
ServerSideException
- The server produced an error messageIllegalArgumentException
- A required argument was not as expected
-
getAstronomicalInfo
public List<AstronomyLocation> getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, TADDateTime startDate) throws IllegalArgumentException, ServerSideExceptionGets the specified object type (Moon, Sun) for a specified place by start date.- Parameters:
objectType
- The astronomical object type (Moon or Sun)placeId
- Place identifier.startDate
- Start date.- Returns:
- A list of astronomical information.
- Throws:
ServerSideException
- The server produced an error messageIllegalArgumentException
- A required argument was not as expected
-
getAstronomicalInfo
public List<AstronomyLocation> getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, Calendar startDate, Calendar endDate) throws IllegalArgumentException, QueriedDateOutOfRangeException, ServerSideExceptionGets the specified object type (Moon, Sun) for a specified place by start date.- Parameters:
objectType
- The astronomical object type (Moon or Sun)placeId
- Place identifier.startDate
- Start date.endDate
- End date.- Returns:
- A list of astronomical information.
- Throws:
ServerSideException
- The server produced an error messageQueriedDateOutOfRangeException
- There was a mismatch between the two dates providedIllegalArgumentException
- A required argument was not as expected
-
getAstronomicalInfo
public List<AstronomyLocation> getAstronomicalInfo(AstronomyObjectType objectType, LocationId placeId, TADDateTime startDate, TADDateTime endDate) throws IllegalArgumentException, QueriedDateOutOfRangeException, ServerSideExceptionGets the specified object type (Moon, Sun) for a specified place by start date.- Parameters:
objectType
- The astronomical object type (Moon or Sun)placeId
- Place identifier.startDate
- Start date.endDate
- End date.- Returns:
- A list of astronomical information.
- Throws:
ServerSideException
- The server produced an error messageQueriedDateOutOfRangeException
- There was a mismatch between the two dates providedIllegalArgumentException
- A required argument was not as expected
-
setRadius
public void setRadius(int radius) -
getRadius
public int getRadius() -
setIncludeUTCTime
public void setIncludeUTCTime(boolean bool) -
getIncludeUTCTime
public boolean getIncludeUTCTime() -
setIncludeISOTime
public void setIncludeISOTime(boolean bool) -
getIncludeISOTime
public boolean getIncludeISOTime() -
setIncludeCoordinates
public void setIncludeCoordinates(boolean bool) -
getIncludeCoordinates
public boolean getIncludeCoordinates() -
setAstronomyEventTypes
-
addAstronomyEventType
-
getAstronomyEventTypes
-