123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- #import "GTMSessionFetcher.h"
- NS_ASSUME_NONNULL_BEGIN
- extern NSString *const kGTMSessionFetcherServiceSessionBecameInvalidNotification;
- extern NSString *const kGTMSessionFetcherServiceSessionKey;
- @interface GTMSessionFetcherService : NSObject <GTMSessionFetcherServiceProtocol>
- @property(atomic, strong, readonly, nullable)
- NSDictionary<NSString *, NSArray *> *delayedFetchersByHost;
- @property(atomic, strong, readonly, nullable)
- NSDictionary<NSString *, NSArray *> *runningFetchersByHost;
- @property(atomic, assign) NSUInteger maxRunningFetchersPerHost;
- @property(atomic, strong, nullable) NSURLSessionConfiguration *configuration;
- @property(atomic, copy, nullable) GTMSessionFetcherConfigurationBlock configurationBlock;
- @property(atomic, strong, nullable) NSHTTPCookieStorage *cookieStorage;
- @property(atomic, strong, null_resettable) dispatch_queue_t callbackQueue;
- @property(atomic, copy, nullable) GTMSessionFetcherChallengeBlock challengeBlock;
- @property(atomic, strong, nullable) NSURLCredential *credential;
- @property(atomic, strong) NSURLCredential *proxyCredential;
- @property(atomic, copy, nullable) NSArray<NSString *> *allowedInsecureSchemes;
- @property(atomic, assign) BOOL allowLocalhostRequest;
- @property(atomic, assign) BOOL allowInvalidServerCertificates;
- @property(atomic, assign, getter=isRetryEnabled) BOOL retryEnabled;
- @property(atomic, copy, nullable) GTMSessionFetcherRetryBlock retryBlock;
- @property(atomic, assign) NSTimeInterval maxRetryInterval;
- @property(atomic, assign) NSTimeInterval minRetryInterval;
- @property(atomic, copy, nullable) NSDictionary<NSString *, id> *properties;
- @property(atomic, copy, nullable)
- GTMSessionFetcherMetricsCollectionBlock metricsCollectionBlock API_AVAILABLE(
- ios(10.0), macosx(10.12), tvos(10.0), watchos(6.0));
- #if GTM_BACKGROUND_TASK_FETCHING
- @property(atomic, assign) BOOL skipBackgroundTask;
- #endif
- @property(atomic, copy, nullable) NSString *userAgent;
- @property(atomic, strong, nullable) id<GTMFetcherAuthorizationProtocol> authorizer;
- @property(atomic, strong, null_resettable) NSOperationQueue *sessionDelegateQueue;
- @property(atomic, assign) BOOL reuseSession;
- @property(atomic, assign) NSTimeInterval unusedSessionTimeout;
- - (void)resetSession;
- - (GTMSessionFetcher *)fetcherWithRequest:(NSURLRequest *)request;
- - (GTMSessionFetcher *)fetcherWithURL:(NSURL *)requestURL;
- - (GTMSessionFetcher *)fetcherWithURLString:(NSString *)requestURLString;
- - (id)fetcherWithRequest:(NSURLRequest *)request fetcherClass:(Class)fetcherClass;
- - (BOOL)isDelayingFetcher:(GTMSessionFetcher *)fetcher;
- - (NSUInteger)numberOfFetchers;
- - (NSUInteger)numberOfRunningFetchers;
- - (NSUInteger)numberOfDelayedFetchers;
- - (nullable NSArray<GTMSessionFetcher *> *)issuedFetchers;
- - (nullable NSArray<GTMSessionFetcher *> *)issuedFetchersWithRequestURL:(NSURL *)requestURL;
- - (void)stopAllFetchers;
- - (void)addDecorator:(id<GTMFetcherDecoratorProtocol>)decorator;
- - (void)removeDecorator:(id<GTMFetcherDecoratorProtocol>)decorator;
- - (nullable NSURLSession *)session;
- - (nullable NSURLSession *)sessionForFetcherCreation;
- - (nullable id<NSURLSessionDelegate>)sessionDelegate;
- - (nullable NSDate *)stoppedAllFetchersDate;
- @property(atomic, copy, nullable) GTMSessionFetcherTestBlock testBlock;
- @end
- @interface GTMSessionFetcherService (TestingSupport)
- + (instancetype)mockFetcherServiceWithFakedData:(nullable NSData *)fakedDataOrNil
- fakedError:(nullable NSError *)fakedErrorOrNil;
- + (instancetype)mockFetcherServiceWithFakedData:(nullable NSData *)fakedDataOrNil
- fakedResponse:(NSHTTPURLResponse *)fakedResponse
- fakedError:(nullable NSError *)fakedErrorOrNil;
- - (BOOL)waitForCompletionOfAllFetchersWithTimeout:(NSTimeInterval)timeoutInSeconds
- __deprecated_msg("Use XCTestExpectation instead");
- @end
- @interface GTMSessionFetcherService (BackwardsCompatibilityOnly)
- @property(atomic, assign) NSInteger cookieStorageMethod __deprecated_msg(
- "Create an NSHTTPCookieStorage and set .cookieStorage directly.");
- @end
- NS_ASSUME_NONNULL_END
|