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 |
|
|
18 |
/** |
|
19 |
This header is private to the Twitter Core SDK and not exposed for public SDK consumption |
|
20 |
*/ |
a0a843
|
21 |
|
H |
22 |
#import <TwitterCore/TWTRSessionStore.h> |
|
23 |
#import "TWTRNetworkingPipeline.h" |
|
24 |
|
|
25 |
NS_ASSUME_NONNULL_BEGIN |
|
26 |
|
|
27 |
@interface TWTRNetworkingPipelinePackage : NSObject <NSCopying> |
|
28 |
|
|
29 |
/** |
|
30 |
* The URL request object that will be executed by this package. |
|
31 |
*/ |
|
32 |
@property (nonatomic, copy, readonly) NSURLRequest *request; |
|
33 |
|
|
34 |
/** |
|
35 |
* The session store that will be used by the package to provide session information. |
|
36 |
*/ |
|
37 |
@property (nonatomic, readonly) id<TWTRSessionStore> sessionStore; |
|
38 |
|
|
39 |
/** |
|
40 |
* The userID associated with this package or nil to signify that |
|
41 |
* the guest session should be used. |
|
42 |
*/ |
|
43 |
@property (nonatomic, copy, readonly, nullable) NSString *userID; |
|
44 |
|
|
45 |
/** |
|
46 |
The calback block to execute when the request is finished or fails. |
|
47 |
*/ |
|
48 |
@property (nonatomic, copy, readonly, nullable) TWTRNetworkingPipelineCallback callback; |
|
49 |
|
|
50 |
/** |
|
51 |
A counter to track the attempts (with retries) of the request operation associated with the this package. It can be useful |
|
52 |
to avoid retrying a request indefinitely (stop after certain threshold). It starts with 1 |
|
53 |
*/ |
|
54 |
@property (nonatomic, readonly) NSInteger attemptCounter; |
|
55 |
|
|
56 |
/** |
|
57 |
* A UUI associated with this package. |
|
58 |
*/ |
|
59 |
@property (nonatomic, readonly) NSUUID *UUID; |
|
60 |
|
|
61 |
- (instancetype)initWithRequest:(NSURLRequest *)request sessionStore:(id<TWTRSessionStore>)sessionStore userID:(nullable NSString *)userID completion:(nullable TWTRNetworkingPipelineCallback)callback NS_DESIGNATED_INITIALIZER; |
|
62 |
|
|
63 |
+ (instancetype)packageWithRequest:(NSURLRequest *)request sessionStore:(id<TWTRSessionStore>)sessionStore userID:(nullable NSString *)userID completion:(nullable TWTRNetworkingPipelineCallback)callback; |
|
64 |
|
|
65 |
/* |
|
66 |
Create a copy of current package instance with attemptCounter being added by one. current package object remain unchanged. |
|
67 |
*/ |
|
68 |
- (instancetype)copyForRetry; |
|
69 |
|
|
70 |
- (instancetype)init NS_UNAVAILABLE; |
|
71 |
|
|
72 |
@end |
|
73 |
|
|
74 |
NS_ASSUME_NONNULL_END |