summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLAPIClient.h
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2016-02-19 15:00:17 -0800
committerJesse Bounds <jesse@rebounds.net>2016-02-24 14:45:42 -0800
commit9a97a4d34f03e2c6266ae9b38c4dacda342520e1 (patch)
tree8b788c09b40317e80cf479ae154b25bae55c4278 /platform/ios/src/MGLAPIClient.h
parent96cd22efa0ac6b69fe93a130b5e8f1b17526db59 (diff)
downloadqtlocation-mapboxgl-9a97a4d34f03e2c6266ae9b38c4dacda342520e1.tar.gz
[ios] Introduce API Client
Addresses https://github.com/mapbox/mapbox-gl-native/issues/3704 This introduces a new utility class that wraps networking via NSURLSession. All related code that used to live inside the telemetry MGLMapboxEvents class has been pulled into the new MGLAPIClient. An API client instance is used as a service by telemetry and can be reused in the future when and if our networking needs grow or become more complex.
Diffstat (limited to 'platform/ios/src/MGLAPIClient.h')
-rw-r--r--platform/ios/src/MGLAPIClient.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/ios/src/MGLAPIClient.h b/platform/ios/src/MGLAPIClient.h
new file mode 100644
index 0000000000..ef64b021b7
--- /dev/null
+++ b/platform/ios/src/MGLAPIClient.h
@@ -0,0 +1,12 @@
+#import <Foundation/Foundation.h>
+
+#import "MGLMapboxEvents.h"
+#import "MGLTypes.h"
+
+@interface MGLAPIClient : NSObject <NSURLSessionDelegate>
+
+- (void)postEvents:(nonnull NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler;
+- (void)postEvent:(nonnull MGLMapboxEventAttributes *)event completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler;
+- (void)cancelAll;
+
+@end