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
AWFPlaceinstance.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
placeThe place to use for the request.
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional).completionBlockThe 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
AWFWeatherObjectinstances 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
AWFPlaceinstance.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
placeThe place to use for the request
fromDateThe starting date to request data for, otherwise the endpoint’s default will be used
toDateThe ending date to request data for, otherwise the endpoint’s default will be used
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional).completionBlockThe 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
AWFWeatherObjectinstances 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
AWFPlaceinstance.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
placeThe place to use for the request
fromStringThe starting date to request data for as a relative string, e.g.
-2days, otherwise the endpoint’s default will be usedtoStringThe ending date to request data for as a relative string, e.g.
+5days, otherwise the endpoint’s default will be usedoptionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional).completionBlockThe 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
AWFWeatherObjectinstances 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
AWFPlaceinstance.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
placeThe place to use for the request.
radiusThe 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.optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional).completionBlockThe 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
AWFWeatherObjectinstances 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
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional).completionBlockThe 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
AWFWeatherObjectinstances 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
fromDateThe starting date to request data for, otherwise the endpoint’s default will be used
toDateThe ending date to request data for, otherwise the endpoint’s default will be used
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional).completionBlockThe 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
AWFWeatherObjectinstances 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
fromStringThe starting date to request data for as a relative string, e.g.
-2days, otherwise the endpoint’s default will be usedtoStringThe ending date to request data for as a relative string, e.g.
+5days, otherwise the endpoint’s default will be usedoptionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional).completionBlockThe 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
AWFWeatherObjectinstances 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
centerCoordinateThe center coordinate to use for the request
radiusThe radius from the center coordinate to include results for. This value should be provided as a valid distance string (e.g. “50mi” or 100km")
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional)completionBlockThe 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
AWFWeatherObjectinstances 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
AWFCoordinateBoundsinstance.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
boundsThe coordinate bounds for the request, defining the northwest and southeast coorners
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional)completionBlockThe 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
AWFWeatherObjectinstances 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
AWFGeoPolygoninstance.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
polygonThe polygon
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional)completionBlockThe 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
AWFWeatherObjectinstances 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
placeThe place that must be contain within an object’s polygon
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional)completionBlockThe 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
AWFWeatherObjectinstances 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
objectThe endpoint object used with the request
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional)completionBlockThe 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
AWFWeatherObjectinstances 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
identifierThe identifier associated with the endpoint object
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional)completionBlockThe 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
AWFWeatherObjectinstances 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
queryvalue on the provided options instance.Note: If no objects were returned from the request, but the request did not contain any errors, then the
completionBlockblock 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
optionsAn
AWFWeatherRequestOptionsinstance containing additional parameters to be used with the request (optional)completionBlockThe 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
AWFWeatherObjectinstances returned by the request and the error that occurred during the request (if any)
View on GitHub
AWFWeatherEndpoint Class Reference