commit | author | age
|
655e66
|
1 |
/* |
H |
2 |
* Copyright (C) 2017 Twitter, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
* |
|
16 |
*/ |
|
17 |
|
a0a843
|
18 |
#import <TwitterCore/TWTRSessionStore.h> |
H |
19 |
#import "TWTRNetworkingPipeline.h" |
|
20 |
|
|
21 |
NS_ASSUME_NONNULL_BEGIN |
|
22 |
|
|
23 |
@interface TWTRNetworkingPipelinePackage : NSObject <NSCopying> |
|
24 |
|
|
25 |
/** |
|
26 |
* The URL request object that will be executed by this package. |
|
27 |
*/ |
|
28 |
@property (nonatomic, copy, readonly) NSURLRequest *request; |
|
29 |
|
|
30 |
/** |
|
31 |
* The session store that will be used by the package to provide session information. |
|
32 |
*/ |
|
33 |
@property (nonatomic, readonly) id<TWTRSessionStore> sessionStore; |
|
34 |
|
|
35 |
/** |
|
36 |
* The userID associated with this package or nil to signify that |
|
37 |
* the guest session should be used. |
|
38 |
*/ |
|
39 |
@property (nonatomic, copy, readonly, nullable) NSString *userID; |
|
40 |
|
|
41 |
/** |
|
42 |
The calback block to execute when the request is finished or fails. |
|
43 |
*/ |
|
44 |
@property (nonatomic, copy, readonly, nullable) TWTRNetworkingPipelineCallback callback; |
|
45 |
|
|
46 |
/** |
|
47 |
A counter to track the attempts (with retries) of the request operation associated with the this package. It can be useful |
|
48 |
to avoid retrying a request indefinitely (stop after certain threshold). It starts with 1 |
|
49 |
*/ |
|
50 |
@property (nonatomic, readonly) NSInteger attemptCounter; |
|
51 |
|
|
52 |
/** |
|
53 |
* A UUI associated with this package. |
|
54 |
*/ |
|
55 |
@property (nonatomic, readonly) NSUUID *UUID; |
|
56 |
|
|
57 |
- (instancetype)initWithRequest:(NSURLRequest *)request sessionStore:(id<TWTRSessionStore>)sessionStore userID:(nullable NSString *)userID completion:(nullable TWTRNetworkingPipelineCallback)callback NS_DESIGNATED_INITIALIZER; |
|
58 |
|
|
59 |
+ (instancetype)packageWithRequest:(NSURLRequest *)request sessionStore:(id<TWTRSessionStore>)sessionStore userID:(nullable NSString *)userID completion:(nullable TWTRNetworkingPipelineCallback)callback; |
|
60 |
|
|
61 |
/* |
|
62 |
Create a copy of current package instance with attemptCounter being added by one. current package object remain unchanged. |
|
63 |
*/ |
|
64 |
- (instancetype)copyForRetry; |
|
65 |
|
|
66 |
- (instancetype)init NS_UNAVAILABLE; |
|
67 |
|
|
68 |
@end |
|
69 |
|
|
70 |
NS_ASSUME_NONNULL_END |