AWFWeatherEndpoint
Objective-C
@interface AWFWeatherEndpoint
Swift
class AWFWeatherEndpoint
AWFWeatherEndpoint
is a concrete class that is responsible for handling all requests for a specific API endpoint. This class should not
be used as is, but rather should be subclassed to provided the required configuration for interacting with the Aeris Weather API.
-
The default request options to use for all requests performed by this endpoint. The default is
nil
.Declaration
Objective-C
@property (nonatomic, strong, nullable) AWFWeatherRequestOptions *options;
Swift
var options: AWFWeatherRequestOptions? { get set }
-
Returns whether or not the endpoint instance currently has a request in progress.
Declaration
Objective-C
@property (nonatomic) BOOL isLoading;
Swift
var isLoading: Bool { get set }
-
A shared instance of this endpoint class that can be used instead of instantiating individual instances for each request.
Declaration
Objective-C
+ (nonnull instancetype)sharedService;
Swift
class func sharedService() -> Self
-
Requests objects for the specific place. The place must be a valid
AWFPlace
instance.Declaration
Objective-C
- (void)getForPlace:(nonnull AWFPlace *)place options:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func get(forPlace place: AWFPlace, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
place
The place to use for the request.
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional).completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects for the specific place. The place must be a valid
AWFPlace
instance.Declaration
Objective-C
- (void)getForPlace:(nonnull AWFPlace *)place fromDate:(nullable NSDate *)fromDate toDate:(nullable NSDate *)toDate options:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func get(forPlace place: AWFPlace, from fromDate: Date?, to toDate: Date?, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
place
The place to use for the request
fromDate
The starting date to request data for, otherwise the endpoint’s default will be used
toDate
The ending date to request data for, otherwise the endpoint’s default will be used
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional).completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects for the specific place. The place must be a valid
AWFPlace
instance.Declaration
Objective-C
- (void)getForPlace:(nonnull AWFPlace *)place from:(nullable NSString *)fromString to:(nullable NSString *)toString options:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func get(forPlace place: AWFPlace, from fromString: String?, to toString: String?, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
place
The place to use for the request
fromString
The starting date to request data for as a relative string, e.g.
-2days
, otherwise the endpoint’s default will be usedtoString
The ending date to request data for as a relative string, e.g.
+5days
, otherwise the endpoint’s default will be usedoptions
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional).completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects within a circle defined by a center at the specific place’s coordinate and a radius. The place must be a valid
AWFPlace
instance.Declaration
Objective-C
- (void)getClosestToPlace:(nonnull AWFPlace *)place radius:(nonnull NSString *)radius options:(nullable AWFWeatherRequestOptions *)options completion: (nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func closest(toPlace place: AWFPlace, radius: String, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
place
The place to use for the request.
radius
The radius from the place’s coordinate to include results for. Radius should be provided as a valid distance string, (e.g.,
@"50mi"
or@"100km"
). If no radius is provided, the default of@"25mi"
will be used.options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional).completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects using the provided request options.
Declaration
Objective-C
- (void)getWithOptions:(nullable AWFWeatherRequestOptions *)options completion: (nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func get(options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional).completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects for the provided from and to dates.
Declaration
Objective-C
- (void)getFromDate:(nullable NSDate *)fromDate toDate:(nullable NSDate *)toDate options:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func get(from fromDate: Date?, to toDate: Date?, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
fromDate
The starting date to request data for, otherwise the endpoint’s default will be used
toDate
The ending date to request data for, otherwise the endpoint’s default will be used
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional).completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects for the provided from and to string values.
Declaration
Objective-C
- (void)getFrom:(nullable NSString *)fromString to:(nullable NSString *)toString options:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func get(from fromString: String?, to toString: String?, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
fromString
The starting date to request data for as a relative string, e.g.
-2days
, otherwise the endpoint’s default will be usedtoString
The ending date to request data for as a relative string, e.g.
+5days
, otherwise the endpoint’s default will be usedoptions
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional).completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects within a circle defined by a center coordinate and a radius.
Declaration
Objective-C
- (void)getWithinCircleAtCoordinate:(CLLocationCoordinate2D)centerCoordinate radius:(nullable NSString *)radius options:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock) completionBlock;
Swift
func within(circleAt centerCoordinate: CLLocationCoordinate2D, radius: String?, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
centerCoordinate
The center coordinate to use for the request
radius
The radius from the center coordinate to include results for. This value should be provided as a valid distance string (e.g. “50mi” or 100km")
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional)completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects within a bounding box defined by top-left and bottom-right coordinates. The specified bounds must be a valid
AWFCoordinateBounds
instance.Declaration
Objective-C
- (void)getWithinBounds:(nonnull AWFCoordinateBounds *)bounds options:(nullable AWFWeatherRequestOptions *)options completion: (nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func within(bounds: AWFCoordinateBounds, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
bounds
The coordinate bounds for the request, defining the northwest and southeast coorners
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional)completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects within an irregular polygon defined by the a series of coordinates. The specified polygon must be a valid
AWFGeoPolygon
instance.Declaration
Objective-C
- (void)getWithinPolygon:(nonnull AWFGeoPolygon *)polygon options:(nullable AWFWeatherRequestOptions *)options completion: (nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func within(polygon: AWFGeoPolygon, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
polygon
The polygon
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional)completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests objects that contain the specified place, if any. This action is normally associated with endpoints that contain polygon data and returns only the objects associated with each polygon that contains the place.
Declaration
Objective-C
- (void)getContainingPlace:(nonnull AWFPlace *)place options:(nullable AWFWeatherRequestOptions *)options completion: (nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func containing(place: AWFPlace, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
place
The place that must be contain within an object’s polygon
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional)completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests places currently affected by the object associated with this endpoint. This action is normally associated with endpoints that contain polygon or region-specific data, such as storm cells, drought indices or convective outlooks.
Declaration
Objective-C
- (void)getPlacesAffectedByObject:(id)object options:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock) completionBlock;
Swift
func placesAffectedBy(object: Any!, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
object
The endpoint object used with the request
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional)completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests places currently affected by an object associated with this endpoint using the specified object identifier. This action is normally associated with endpoints that contain polygon or region-specific data, such as storm cells, drought indices or convective outlooks.
Declaration
Objective-C
- (void) getPlacesAffectedByObjectWithIdentifier:(nonnull NSString *)identifier options: (nullable AWFWeatherRequestOptions *) options completion: (nonnull AWFWeatherEndpointCompletionBlock) completionBlock;
Swift
func placesAffectedBy(identifier: String, options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
identifier
The identifier associated with the endpoint object
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional)completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any) -
Requests data based on a specific search query and request options. This method requires a valid
query
value on the provided options instance.Note: If no objects were returned from the request, but the request did not contain any errors, then the
completionBlock
block will still be executed without errors. Your block handler should verify the total number of objects returned before trying to access them.Declaration
Objective-C
- (void)search:(nullable AWFWeatherRequestOptions *)options completion:(nonnull AWFWeatherEndpointCompletionBlock)completionBlock;
Swift
func search(_ options: AWFWeatherRequestOptions?) async -> AWFWeatherEndpointResult?
Parameters
options
An
AWFWeatherRequestOptions
instance containing additional parameters to be used with the request (optional)completionBlock
The block to be executed on the completion or failure of a request. This block has no return value and takes two arguments: the array of
AWFWeatherObject
instances returned by the request and the error that occurred during the request (if any)