/core/externals/update-engine/externals/gdata-objectivec-client/Source/BaseClasses/GDataServiceBase.h

http://macfuse.googlecode.com/ · C++ Header · 594 lines · 254 code · 123 blank · 217 comment · 0 complexity · 75d381ba650204bf66401b3079bb7ae6 MD5 · raw file

  1. /* Copyright (c) 2007 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. //
  16. // GDataServiceBase.h
  17. //
  18. #import "GTMHTTPFetcherService.h"
  19. #import "GDataEntryBase.h"
  20. #import "GDataFeedBase.h"
  21. #import "GDataQuery.h"
  22. #undef _EXTERN
  23. #undef _INITIALIZE_AS
  24. #ifdef GDATASERVICEBASE_DEFINE_GLOBALS
  25. #define _EXTERN
  26. #define _INITIALIZE_AS(x) =x
  27. #else
  28. #define _EXTERN GDATA_EXTERN
  29. #define _INITIALIZE_AS(x)
  30. #endif
  31. _EXTERN Class const kGDataUseRegisteredClass _INITIALIZE_AS(nil);
  32. _EXTERN NSString* const kGDataServiceErrorDomain _INITIALIZE_AS(@"com.google.GDataServiceDomain");
  33. _EXTERN NSUInteger const kGDataStandardUploadChunkSize _INITIALIZE_AS(NSUIntegerMax);
  34. // we'll consistently store the server error string in the userInfo under
  35. // this key
  36. _EXTERN NSString* const kGDataServerErrorStringKey _INITIALIZE_AS(@"error");
  37. // when servers return us structured XML errors, the NSError will
  38. // contain a GDataErrorGroup in the userInfo dictionary under the key
  39. // kGDataStructuredErrorsKey
  40. _EXTERN NSString* const kGDataStructuredErrorsKey _INITIALIZE_AS(@"serverErrors");
  41. // when specifying an ETag for updating or deleting a single entry, use
  42. // kGDataETagWildcard to tell the server to replace the current value
  43. // unconditionally. Do not use this in entries in a batch feed.
  44. _EXTERN NSString* const kGDataETagWildcard _INITIALIZE_AS(@"*");
  45. // notifications when parsing of a fetcher feed or entry begins or ends
  46. _EXTERN NSString* const kGDataServiceTicketParsingStartedNotification _INITIALIZE_AS(@"kGDataServiceTicketParsingStartedNotification");
  47. _EXTERN NSString* const kGDataServiceTicketParsingStoppedNotification _INITIALIZE_AS(@"kGDataServiceTicketParsingStoppedNotification");
  48. enum {
  49. kGDataCouldNotConstructObjectError = -100,
  50. kGDataWaitTimedOutError = -101
  51. };
  52. @class GDataServiceTicketBase;
  53. // block types used for fetch callbacks
  54. //
  55. // these typedefs are not used in the header file method declarations
  56. // since it's more useful when code sense expansions show the argument
  57. // types rather than the typedefs
  58. #if NS_BLOCKS_AVAILABLE
  59. typedef void (^GDataServiceCompletionHandler)(GDataServiceTicketBase *ticket, id object, NSError *error);
  60. typedef void (^GDataServiceFeedBaseCompletionHandler)(GDataServiceTicketBase *ticket, GDataFeedBase *feed, NSError *error);
  61. typedef void (^GDataServiceEntryBaseCompletionHandler)(GDataServiceTicketBase *ticket, GDataEntryBase *entry, NSError *error);
  62. typedef void (^GDataServiceUploadProgressHandler)(GDataServiceTicketBase *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength);
  63. #else
  64. typedef void *GDataServiceCompletionHandler;
  65. typedef void *GDataServiceFeedBaseCompletionHandler;
  66. typedef void *GDataServiceEntryBaseCompletionHandler;
  67. typedef void *GDataServiceUploadProgressHandler;
  68. #endif // NS_BLOCKS_AVAILABLE
  69. @class GDataServiceBase;
  70. //
  71. // ticket base class
  72. //
  73. @interface GDataServiceTicketBase : NSObject {
  74. @protected
  75. GDataServiceBase *service_;
  76. id userData_;
  77. NSMutableDictionary *ticketProperties_;
  78. NSDictionary *surrogates_;
  79. GTMHTTPFetcher *currentFetcher_; // object or auth fetcher if mid-fetch
  80. GTMHTTPFetcher *objectFetcher_;
  81. SEL uploadProgressSelector_;
  82. BOOL shouldFollowNextLinks_;
  83. BOOL shouldFeedsIgnoreUnknowns_;
  84. BOOL isRetryEnabled_;
  85. SEL retrySEL_;
  86. NSTimeInterval maxRetryInterval_;
  87. #if NS_BLOCKS_AVAILABLE
  88. GDataServiceUploadProgressHandler uploadProgressBlock_;
  89. #elif !__LP64__
  90. // placeholders: for 32-bit builds, keep the size of the object's ivar section
  91. // the same with and without blocks
  92. id uploadProgressPlaceholder_;
  93. #endif
  94. GDataObject *postedObject_;
  95. GDataObject *fetchedObject_;
  96. GDataFeedBase *accumulatedFeed_;
  97. NSError *fetchError_;
  98. BOOL hasCalledCallback_;
  99. NSUInteger nextLinksFollowedCounter_;
  100. NSOperation *parseOperation_;
  101. // OAuth support
  102. id authorizer_;
  103. }
  104. + (id)ticketForService:(GDataServiceBase *)service;
  105. - (id)initWithService:(GDataServiceBase *)service;
  106. // if cancelTicket is called, the fetch is stopped if it is in progress,
  107. // the callbacks will not be called, and the ticket will no longer be useful
  108. // (though the client must still release the ticket if it retained the ticket)
  109. - (void)cancelTicket;
  110. // chunked upload tickets may be paused
  111. - (void)pauseUpload;
  112. - (void)resumeUpload;
  113. - (BOOL)isUploadPaused;
  114. - (id)service;
  115. - (id)userData;
  116. - (void)setUserData:(id)obj;
  117. // Properties are supported for client convenience.
  118. //
  119. // Property keys beginning with _ are reserved by the library.
  120. - (void)setProperties:(NSDictionary *)dict;
  121. - (NSDictionary *)properties;
  122. - (void)setProperty:(id)obj forKey:(NSString *)key; // pass nil obj to remove property
  123. - (id)propertyForKey:(NSString *)key;
  124. - (NSDictionary *)surrogates;
  125. - (void)setSurrogates:(NSDictionary *)dict;
  126. - (GTMHTTPFetcher *)currentFetcher; // object or auth fetcher, if active
  127. - (void)setCurrentFetcher:(GTMHTTPFetcher *)fetcher;
  128. - (GTMHTTPFetcher *)objectFetcher;
  129. - (void)setObjectFetcher:(GTMHTTPFetcher *)fetcher;
  130. - (void)setUploadProgressSelector:(SEL)progressSelector;
  131. - (SEL)uploadProgressSelector;
  132. #if NS_BLOCKS_AVAILABLE
  133. - (void)setUploadProgressHandler:(void (^) (GDataServiceTicketBase *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength))handler;
  134. - (GDataServiceUploadProgressHandler)uploadProgressHandler;
  135. #endif
  136. - (BOOL)shouldFollowNextLinks;
  137. - (void)setShouldFollowNextLinks:(BOOL)flag;
  138. - (BOOL)shouldFeedsIgnoreUnknowns;
  139. - (void)setShouldFeedsIgnoreUnknowns:(BOOL)flag;
  140. - (BOOL)isRetryEnabled;
  141. - (void)setIsRetryEnabled:(BOOL)flag;
  142. - (SEL)retrySelector;
  143. - (void)setRetrySelector:(SEL)theSel;
  144. - (NSTimeInterval)maxRetryInterval;
  145. - (void)setMaxRetryInterval:(NSTimeInterval)secs;
  146. - (BOOL)hasCalledCallback;
  147. - (void)setHasCalledCallback:(BOOL)flag;
  148. - (void)setPostedObject:(GDataObject *)obj;
  149. - (id)postedObject;
  150. - (void)setFetchedObject:(GDataObject *)obj;
  151. - (GDataObject *)fetchedObject;
  152. - (void)setFetchError:(NSError *)error;
  153. - (NSError *)fetchError;
  154. - (void)setAccumulatedFeed:(GDataFeedBase *)feed;
  155. - (GDataFeedBase *)accumulatedFeed;
  156. // accumulateFeed is used by the service to append an incomplete feed
  157. // to the ticket when shouldFollowNextLinks is enabled
  158. - (void)accumulateFeed:(GDataFeedBase *)newFeed;
  159. - (void)setNextLinksFollowedCounter:(NSUInteger)val;
  160. - (NSUInteger)nextLinksFollowedCounter;
  161. - (NSInteger)statusCode; // server status from object fetch
  162. - (NSOperation *)parseOperation;
  163. - (void)setParseOperation:(NSOperation *)op;
  164. // OAuth support
  165. - (id)authorizer;
  166. - (void)setAuthorizer:(id)obj;
  167. @end
  168. // category to provide opaque access to tickets stored in fetcher properties
  169. @interface GTMHTTPFetcher (GDataServiceTicketAdditions)
  170. - (id)GDataTicket;
  171. @end
  172. //
  173. // service base class
  174. //
  175. @interface GDataServiceBase : NSObject {
  176. NSOperationQueue *operationQueue_;
  177. NSString *serviceVersion_;
  178. NSString *userAgent_;
  179. GTMHTTPFetcherService *fetcherService_;
  180. NSString *username_;
  181. NSMutableData *password_;
  182. NSString *serviceUserData_; // initial value for userData in future tickets
  183. NSMutableDictionary *serviceProperties_; // initial values for properties in future tickets
  184. NSDictionary *serviceSurrogates_; // initial value for surrogates in future tickets
  185. BOOL shouldServiceFeedsIgnoreUnknowns_; // YES when feeds should ignore unknown XML
  186. SEL serviceUploadProgressSelector_; // optional
  187. #if NS_BLOCKS_AVAILABLE
  188. GDataServiceUploadProgressHandler serviceUploadProgressBlock_;
  189. #elif !__LP64__
  190. // placeholders: for 32-bit builds, keep the size of the object's ivar section
  191. // the same with and without blocks
  192. id serviceUploadProgressPlaceholder_;
  193. #endif
  194. NSUInteger uploadChunkSize_; // zero when uploading via multi-part MIME http body
  195. BOOL isServiceRetryEnabled_; // user allows auto-retries
  196. SEL serviceRetrySEL_; // optional; set with setServiceRetrySelector
  197. NSTimeInterval serviceMaxRetryInterval_; // default to 600. seconds
  198. NSInteger cookieStorageMethod_; // constant from GTMHTTPFetcher.h
  199. BOOL serviceShouldFollowNextLinks_;
  200. }
  201. // Applications should call setUserAgent: with a string of the form
  202. // CompanyName-AppName-AppVersion (without whitespace or punctuation
  203. // other than dashes and periods)
  204. - (NSString *)userAgent;
  205. - (void)setUserAgent:(NSString *)userAgent;
  206. // Run loop modes are used for scheduling NSURLConnections on 10.5 and later.
  207. //
  208. // The default value, nil, schedules connections using the current run
  209. // loop mode. To use the service during a modal dialog, specify
  210. // an array with NSRunLoopCommonModes.
  211. //
  212. // These methods just call through to the fetcher service object's
  213. // runLoopModes property.
  214. - (NSArray *)runLoopModes;
  215. - (void)setRunLoopModes:(NSArray *)modes;
  216. // On iOS 4 and later, the fetch may optionally continue in the background
  217. // until finished or stopped by OS expiration
  218. //
  219. // The default value is NO
  220. //
  221. // For Mac OS X, background fetches are always supported, and this property
  222. // is ignored
  223. - (BOOL)shouldFetchInBackground;
  224. - (void)setShouldFetchInBackground:(BOOL)flag;
  225. // The request user agent includes the library and OS version appended to the
  226. // base userAgent
  227. - (NSString *)requestUserAgent;
  228. // Users may call requestForURL:httpMethod to get a request with the proper
  229. // user-agent and authentication token
  230. //
  231. // For http method, pass nil (for default GET method), POST, PUT, or DELETE
  232. - (NSMutableURLRequest *)requestForURL:(NSURL *)url
  233. ETag:(NSString *)etag
  234. httpMethod:(NSString *)httpMethod;
  235. - (NSMutableURLRequest *)requestForURL:(NSURL *)url
  236. ETag:(NSString *)etag
  237. httpMethod:(NSString *)httpMethod
  238. ticket:(GDataServiceTicketBase *)ticket;
  239. // objectRequestForURL returns an NSMutableURLRequest for an XML GData object
  240. //
  241. //
  242. // the object is the object being sent to the server, or nil;
  243. // the http method may be nil for get, or POST, PUT, DELETE
  244. - (NSMutableURLRequest *)objectRequestForURL:(NSURL *)url
  245. object:(GDataObject *)object
  246. ETag:(NSString *)etag
  247. httpMethod:(NSString *)httpMethod
  248. ticket:(GDataServiceTicketBase *)ticket;
  249. //
  250. // Fetch methods
  251. //
  252. // fetchPublicFeed/fetchPublicEntry/fetchPublicFeedWithQuery (GET)
  253. // fetchPublicEntryByInsertingEntry (POST)
  254. // fetchPublicEntryByUpdatingEntry (PUT)
  255. // deleteEntry/deleteResourceURL (DELETE)
  256. //
  257. // NOTE:
  258. // These base class methods are for unauthenticated fetches to public feeds.
  259. //
  260. // To make authenticated fetches to a user's account, use the methods in the
  261. // service's GDataServiceXxxx class, or in the GDataServiceGoogle class.
  262. //
  263. // finishedSelector has a signature like:
  264. //
  265. // - (void)serviceTicket:(GDataServiceTicketBase *)ticket
  266. // finishedWithObject:(GDataObject *)object // a feed or an entry
  267. // error:(NSError *)error
  268. //
  269. // If an error occurred, the error parameter will be non-nil. Otherwise,
  270. // the object parameter will point to a feed or entry, if any was returned by
  271. // the fetch. (Delete fetches return no object, so the second parameter will
  272. // be nil.)
  273. - (GDataServiceTicketBase *)fetchPublicFeedWithURL:(NSURL *)feedURL
  274. feedClass:(Class)feedClass
  275. delegate:(id)delegate
  276. didFinishSelector:(SEL)finishedSelector;
  277. - (GDataServiceTicketBase *)fetchPublicFeedWithQuery:(GDataQuery *)query
  278. feedClass:(Class)feedClass
  279. delegate:(id)delegate
  280. didFinishSelector:(SEL)finishedSelector;
  281. - (GDataServiceTicketBase *)fetchPublicEntryWithURL:(NSURL *)entryURL
  282. entryClass:(Class)entryClass
  283. delegate:(id)delegate
  284. didFinishSelector:(SEL)finishedSelector;
  285. - (GDataServiceTicketBase *)fetchPublicFeedWithBatchFeed:(GDataFeedBase *)batchFeed
  286. forFeedURL:(NSURL *)feedURL
  287. delegate:(id)delegate
  288. didFinishSelector:(SEL)finishedSelector;
  289. #if NS_BLOCKS_AVAILABLE
  290. - (GDataServiceTicketBase *)fetchPublicFeedWithURL:(NSURL *)feedURL
  291. feedClass:(Class)feedClass
  292. completionHandler:(void (^)(GDataServiceTicketBase *ticket, GDataFeedBase *feed, NSError *error))handler;
  293. - (GDataServiceTicketBase *)fetchPublicFeedWithQuery:(GDataQuery *)query
  294. feedClass:(Class)feedClass
  295. completionHandler:(void (^)(GDataServiceTicketBase *ticket, GDataFeedBase *feed, NSError *error))handler;
  296. - (GDataServiceTicketBase *)fetchPublicEntryWithURL:(NSURL *)entryURL
  297. entryClass:(Class)entryClass
  298. completionHandler:(void (^)(GDataServiceTicketBase *ticket, GDataEntryBase *entry, NSError *error))handler;
  299. - (GDataServiceTicketBase *)fetchPublicFeedWithBatchFeed:(GDataFeedBase *)batchFeed
  300. forFeedURL:(NSURL *)feedURL
  301. completionHandler:(void (^)(GDataServiceTicketBase *ticket, GDataFeedBase *feed, NSError *error))handler;
  302. #endif
  303. // reset the response cache to avoid getting a Not Modified status
  304. // based on prior queries
  305. - (void)clearResponseDataCache;
  306. // Turn on data caching to receive a copy of previously-retrieved objects.
  307. // Otherwise, fetches may return status 304 (Not Modifier) rather than actual
  308. // data
  309. - (void)setShouldCacheResponseData:(BOOL)flag;
  310. - (BOOL)shouldCacheResponseData;
  311. // If dated data caching is on, this specifies the capacity of the cache.
  312. // Default is 15MB for Mac and 1 MB for iPhone.
  313. - (void)setResponseDataCacheCapacity:(NSUInteger)totalBytes;
  314. - (NSUInteger)responseDataCacheCapacity;
  315. // Fetcher service, if necessary for sharing cookies and dated data
  316. // cache with standalone http fetchers
  317. - (void)setFetcherService:(GTMHTTPFetcherService *)obj;
  318. - (GTMHTTPFetcherService *)fetcherService;
  319. // Default storage for cookies is in the service object's fetchHistory.
  320. //
  321. // Apps that want to share cookies between all standalone fetchers and the
  322. // service object may specify static application-wide cookie storage,
  323. // kGTMHTTPFetcherCookieStorageMethodStatic.
  324. - (void)setCookieStorageMethod:(NSInteger)method;
  325. - (NSInteger)cookieStorageMethod;
  326. // For feed requests, where the feed requires following "next" links to retrieve
  327. // all entries, the service can optionally do the additional fetches using the
  328. // original ticket, calling the client's finish selector only when a complete
  329. // feed has been obtained. During the fetch, the feed accumulated so far is
  330. // available from the ticket.
  331. //
  332. // Note that the final feed may be a combination of multiple partial feeds,
  333. // so is not exactly a genuine feed. In particular, it will not have a valid
  334. // "self" link, as it does not represent an object with a distinct URL.
  335. //
  336. // Default value is NO.
  337. - (BOOL)serviceShouldFollowNextLinks;
  338. - (void)setServiceShouldFollowNextLinks:(BOOL)flag;
  339. // set a non-zero value to enable uploading via chunked fetches
  340. // (resumable uploads); typically this defaults to kGDataStandardUploadChunkSize
  341. // for service subclasses that support chunked uploads
  342. - (NSUInteger)serviceUploadChunkSize;
  343. - (void)setServiceUploadChunkSize:(NSUInteger)val;
  344. // service subclasses may specify their own default chunk size
  345. + (NSUInteger)defaultServiceUploadChunkSize;
  346. // The service userData becomes the initial value for each future ticket's
  347. // userData.
  348. //
  349. // Since the network transactions may begin before the client has been
  350. // returned the ticket by the fetch call, it's preferable to call
  351. // setServiceUserData before the ticket is created rather than call the
  352. // ticket's setUserData:. Either way, the ticket's userData:
  353. // method will return the value.
  354. - (void)setServiceUserData:(id)userData;
  355. - (id)serviceUserData;
  356. // Properties are supported for client convenience.
  357. //
  358. // Property keys beginning with _ are reserved by the library.
  359. //
  360. // The service properties dictionary is copied to become the initial property
  361. // dictionary for each ticket.
  362. - (void)setServiceProperties:(NSDictionary *)dict;
  363. - (NSDictionary *)serviceProperties;
  364. - (void)setServiceProperty:(id)obj forKey:(NSString *)key; // pass nil obj to remove property
  365. - (id)servicePropertyForKey:(NSString *)key;
  366. // Set the surrogates to be used for future tickets. Surrogates are subclasses
  367. // to be used instead of standard classes when creating objects from the XML.
  368. // For example, this code will make the framework generate objects
  369. // using MyCalendarEntrySubclass instead of GDataEntryCalendar and
  370. // MyCalendarEventSubclass instead of GDataEntryCalendarEvent.
  371. //
  372. // NSDictionary *surrogates = [NSDictionary dictionaryWithObjectsAndKeys:
  373. // [MyCalendarEntrySubclass class], [GDataEntryCalendar class],
  374. // [MyCalendarEventSubclass class], [GDataEntryCalendarEvent class],
  375. // nil];
  376. // [calendarService setServiceSurrogates:surrogates];
  377. //
  378. - (NSDictionary *)serviceSurrogates;
  379. - (void)setServiceSurrogates:(NSDictionary *)dict;
  380. // Set if feeds fetched (and the entries and elements contained in the feeds)
  381. // keep track of unparsed XML elements. Setting this to YES offers a
  382. // performance and memory improvement, particularly for iPhone apps. However,
  383. // the entries in those feeds cannot be updated (as the unparsed XML inside the
  384. // entries has been lost, so cannot be sent back to the server.) An entry
  385. // can be re-fetched singly for updating. Default is NO. iPhone
  386. // apps retrieving large feeds should probably set this to YES.
  387. //
  388. - (BOOL)shouldServiceFeedsIgnoreUnknowns;
  389. - (void)setShouldServiceFeedsIgnoreUnknowns:(BOOL)flag;
  390. // The service uploadProgressSelector becomes the initial value for each future
  391. // ticket's uploadProgressSelector.
  392. //
  393. // The optional uploadProgressSelector will be called in the delegate as bytes
  394. // are uploaded to the server. It should have a signature matching
  395. //
  396. // - (void)ticket:(GDataServiceTicketBase *)ticket
  397. // hasDeliveredByteCount:(unsigned long long)numberOfBytesRead
  398. // ofTotalByteCount:(unsigned long long)dataLength;
  399. - (void)setServiceUploadProgressSelector:(SEL)progressSelector;
  400. - (SEL)serviceUploadProgressSelector;
  401. #if NS_BLOCKS_AVAILABLE
  402. - (void)setServiceUploadProgressHandler:(void (^) (GDataServiceTicketBase *ticket, unsigned long long numberOfBytesRead, unsigned long long dataLength))handler;
  403. - (GDataServiceUploadProgressHandler)serviceUploadProgressHandler;
  404. #endif
  405. // retrying; see comments on retry support at the top of GTMHTTPFetcher.
  406. - (BOOL)isServiceRetryEnabled;
  407. - (void)setIsServiceRetryEnabled:(BOOL)flag;
  408. // retry selector is optional for retries.
  409. //
  410. // If present, it should have the signature:
  411. // -(BOOL)ticket:(GDataServiceTicketBase *)ticket willRetry:(BOOL)suggestedWillRetry forError:(NSError *)error
  412. // and return YES to cause a retry. Note that unlike the GTMHTTPFetcher retry
  413. // selector, this selector's first argument is a ticket, not a fetcher.
  414. // The current fetcher can be retrived with [ticket currentFetcher]
  415. - (SEL)serviceRetrySelector;
  416. - (void)setServiceRetrySelector:(SEL)theSel;
  417. - (NSTimeInterval)serviceMaxRetryInterval;
  418. - (void)setServiceMaxRetryInterval:(NSTimeInterval)secs;
  419. // access to the parsing operation queue, for clients wanting to manage the
  420. // queue explicitly
  421. - (id)operationQueue;
  422. - (void)setOperationQueue:(id)queue;
  423. // credentials
  424. //
  425. // Note: Specifying the username and password is a deprecated method
  426. // of user authorization called ClientLogin, and does not work for all
  427. // user accounts.
  428. // Applications should instead enable users to sign in using OAuth 2,
  429. // such as with the gtm-oauth2 view and window controllers.
  430. //
  431. // http://code.google.com/p/gtm-oauth2/wiki/Introduction
  432. - (void)setUserCredentialsWithUsername:(NSString *)username
  433. password:(NSString *)password;
  434. - (NSString *)username;
  435. - (NSString *)password;
  436. // OAuth support
  437. - (id)authorizer;
  438. - (void)setAuthorizer:(id)obj;
  439. // Subclasses typically override defaultServiceVersion to specify the expected
  440. // version of the feed, but clients may also explicitly set the version
  441. // if they are using an instance of the base class directly.
  442. + (NSString *)defaultServiceVersion;
  443. - (NSString *)serviceVersion;
  444. - (void)setServiceVersion:(NSString *)str;
  445. // Wait synchronously for fetch to complete (strongly discouraged)
  446. //
  447. // This just runs the current event loop until the fetch completes
  448. // or the timout limit is reached. This may discard unexpected events
  449. // that occur while spinning, so it's really not appropriate for use
  450. // in serious applications.
  451. //
  452. // Returns true if an object was successfully fetched. If the wait
  453. // timed out, returns false and the returned error is nil.
  454. //
  455. // The returned object or error, if any, will be already autoreleased
  456. //
  457. // This routine will likely be removed in some future releases of the library.
  458. - (BOOL)waitForTicket:(GDataServiceTicketBase *)ticket
  459. timeout:(NSTimeInterval)timeoutInSeconds
  460. fetchedObject:(GDataObject **)outObjectOrNil
  461. error:(NSError **)outErrorOrNil;
  462. //
  463. // internal utilities
  464. //
  465. - (void)addAuthenticationToFetcher:(GTMHTTPFetcher *)fetcher;
  466. - (void)objectFetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *)error;
  467. + (NSString *)defaultApplicationIdentifier;
  468. + (NSString *)systemVersionString;
  469. - (BOOL)invokeRetrySelector:(SEL)retrySelector delegate:(id)delegate ticket:(GDataServiceTicketBase *)ticket willRetry:(BOOL)willRetry error:(NSError *)error;
  470. + (void)invokeCallback:(SEL)callbackSel target:(id)target ticket:(id)ticket object:(id)object error:(id)error;
  471. @end