hank
2017-06-14 3f9b5125cd79f60e878a3f93708d1254048fd1fb
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
//  TWTRNetworkingPipelineQueue.h
//  TwitterKit
//
//  Created by Chase Latta on 6/23/15.
//  Copyright (c) 2015 Twitter. All rights reserved.
//
 
#import <Foundation/Foundation.h>
#import <TwitterCore/TWTRNetworkingPipeline.h>
 
@class TWTRNetworkingPipelinePackage;
 
NS_ASSUME_NONNULL_BEGIN
 
typedef NS_ENUM(NSInteger, TWTRNetworkingPipelineQueueType) {
    /**
     * Queues that depend on having a valid guest session
     */
    TWTRNetworkingPipelineQueueTypeGuest,
 
    /**
     * Queues that depend on having a valid user session
     */
    TWTRNetworkingPipelineQueueTypeUser
};
 
@interface TWTRNetworkingPipelineQueue : NSObject
 
/**
 * Returns the type that this queue was initialized with.
 */
@property (nonatomic, readonly) TWTRNetworkingPipelineQueueType queueType;
 
/**
 * A response validator to use to validate network responses.
 */
@property (nonatomic, readonly, nullable) id<TWTRNetworkingResponseValidating> responseValidator;
 
/**
 * Initializes the queue witht the given type.
 *
 * @param type The type of queue to initialize
 * @param session The NSURLSession to send requests with
 * @param responseValidator The response validator to use for this queue
 */
- (instancetype)initWithType:(TWTRNetworkingPipelineQueueType)type URLSession:(NSURLSession *)session responseValidator:(nullable id<TWTRNetworkingResponseValidating>)responseValidator NS_DESIGNATED_INITIALIZER;
 
/**
 * Convenience initializer to make a new guest pipeline.
 */
+ (instancetype)guestPipelineQueueWithURLSession:(NSURLSession *)session responseValidator:(nullable id<TWTRNetworkingResponseValidating>)responseValidator;
 
/**
 * Convenience initializer to make a new user pipeline.
 */
+ (instancetype)userPipelineQueueWithURLSession:(NSURLSession *)session responseValidator:(nullable id<TWTRNetworkingResponseValidating>)responseValidator;
 
/**
 * Enqueues a package for processing.
 * @return an NSProgress object which can be used to cancel the request.
 */
- (NSProgress *)enqueuePipelinePackage:(TWTRNetworkingPipelinePackage *)package;
 
/**
 * Use -[TWTRNetworkingPipelineQueue initWithType:URLSession:] instead.
 */
- (instancetype)init NS_UNAVAILABLE;
 
@end
 
NS_ASSUME_NONNULL_END