blob: 8745f8519a1de722734893d046469a9a1f1f19ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
//
// SDLURLRequestTask.h
// SmartDeviceLink-iOS
//
// Created by Joel Fischer on 8/17/15.
// Copyright (c) 2015 smartdevicelink. All rights reserved.
//
#import <Foundation/Foundation.h>
@class SDLURLRequestTask;
@class SDLURLSession;
typedef void (^SDLURLConnectionRequestCompletionHandler)(NSData *__nullable data, NSURLResponse *__nullable response, NSError *__nullable error);
typedef NS_ENUM(NSUInteger, SDLURLRequestTaskState) {
SDLURLRequestTaskStateRunning,
SDLURLRequestTaskStateCompleted
};
NS_ASSUME_NONNULL_BEGIN
@protocol SDLURLRequestTaskDelegate <NSObject>
- (void)taskDidFinish:(SDLURLRequestTask *)task;
@end
@interface SDLURLRequestTask : NSObject
@property (weak, nonatomic) id<SDLURLRequestTaskDelegate> delegate;
@property (assign, nonatomic) SDLURLRequestTaskState state;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithURLRequest:(NSURLRequest *)request completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler NS_DESIGNATED_INITIALIZER;
+ (instancetype)taskWithURLRequest:(NSURLRequest *)request completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler;
- (void)cancel;
@end
NS_ASSUME_NONNULL_END
|