Class Endpoint
- java.lang.Object
-
- com.aerisweather.aeris.communication.Endpoint
-
public class Endpoint extends Object
Endpoints refer to the types of data to request, such as a place, observation, forecast or advisory, and will be the basis for any request made to the API. The following endpoints are currently supported within Aeris. To query multiple endpoints with a single request viewAerisBatchRequest
-
-
Constructor Summary
Constructors Constructor Description Endpoint(EndpointType endpoint)
Endpoint construction to be used with single api request or batch request without an action.Endpoint(EndpointType endpoint, Action action)
Endpoint construction to be used with the batch requests.Endpoint(EndpointType endpoint, String id)
Endpoint construction to be used with the batch requests.Endpoint(String custom)
Endpoint construction to be used with single api request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Endpoint
addAction(Action action)
Ad an action to the requestEndpoint
addParameters(Parameter... parameters)
Add the parameters for the specific endpoint's part of a batch requestString
getCode()
Get the code for the endpointString
getCustomName()
Returns the custom endpoint name, Null otherwise.EndpointType
getEndpointType()
Gets the endpoint type that was used.boolean
hasNoAction()
Check to see if there is an action attached to the request.void
setEndpointType(EndpointType endpoint)
Sets the endpoint type
-
-
-
Constructor Detail
-
Endpoint
public Endpoint(EndpointType endpoint, Action action)
Endpoint construction to be used with the batch requests. Otherwise an action is not needed.- Parameters:
endpoint
- The type of endpoint to wrap into the requestaction
- Action to use in the batch request
-
Endpoint
public Endpoint(EndpointType endpoint, String id)
Endpoint construction to be used with the batch requests. Otherwise an ID is not needed.- Parameters:
endpoint
- The type of endpoint to wrap into the requestid
- ID to use in the batch request
-
Endpoint
public Endpoint(EndpointType endpoint)
Endpoint construction to be used with single api request or batch request without an action.- Parameters:
endpoint
- The type of endpoint to wrap into the request
-
Endpoint
public Endpoint(String custom)
Endpoint construction to be used with single api request. Should only be used for a request that has been setup with Aeris. Should use the constructor with the EndpointType in most cases.- Parameters:
custom
- single api request
-
-
Method Detail
-
getCode
public String getCode()
Get the code for the endpoint- Returns:
- Code portion for the endpoint.Differs if involved in a batch request and has an action attached to it
-
addParameters
public Endpoint addParameters(Parameter... parameters)
Add the parameters for the specific endpoint's part of a batch request- Parameters:
parameters
- Array of parameters to add- Returns:
- The endpoint after adding the parameters.
-
addAction
public Endpoint addAction(Action action)
Ad an action to the request- Parameters:
action
- Action to use in the batch request- Returns:
- The endpoint after adding the action to it.
-
hasNoAction
public boolean hasNoAction()
Check to see if there is an action attached to the request.- Returns:
- Returns true if there is no action attached.
-
getEndpointType
public EndpointType getEndpointType()
Gets the endpoint type that was used.- Returns:
- the Endpoint type this endpoint is set to
-
getCustomName
public String getCustomName()
Returns the custom endpoint name, Null otherwise.- Returns:
- The string of the custom endpoint
-
setEndpointType
public void setEndpointType(EndpointType endpoint)
Sets the endpoint type- Parameters:
endpoint
- endpoint type to set as.
-
-