Class DeepSpaceNetworkClient
java.lang.Object
net.adambruce.dsn.now.client.DeepSpaceNetworkClient
Client for requesting information from the DSN Now API.
-
Method Summary
Modifier and TypeMethodDescriptionFetches the DSN Now configuration, and caches it for later use.Fetches the current state of the DSN and merges the response with the DSN Now configuration to provide a complete representation of DSN's current state.Fetches the current state of the DSN.static DeepSpaceNetworkClientCreates a new instance of the client with the default max configuration age (30 mins).static DeepSpaceNetworkClientnewDeepSpaceNetworkClient(Duration maxConfigurationAge) Creates a new instance of the client.
-
Method Details
-
newDeepSpaceNetworkClient
Creates a new instance of the client with the default max configuration age (30 mins).- Returns:
- a new client
-
newDeepSpaceNetworkClient
Creates a new instance of the client.- Parameters:
maxConfigurationAge- the maximum configuration age beforefetchMergedData()will trigger refresh- Returns:
- a new client
-
fetchConfiguration
Fetches the DSN Now configuration, and caches it for later use.- Returns:
- the configuration
- Throws:
Exception- the network request failed, or the response could not be deserialized
-
fetchState
-
fetchMergedData
Fetches the current state of the DSN and merges the response with the DSN Now configuration to provide a complete representation of DSN's current state. If the configuration is uninitialized or expired, a new configuration will be fetched.- Returns:
- the current DSN state merged with the DSN Now configuration
- Throws:
Exception- the network request failed, or the response could not be deserialized
-