/iPhoneSample/Frameworks/FSKit.framework/Versions/A/Headers/FSKConnection.h

http://fskit.googlecode.com/ · C Header · 140 lines · 44 code · 26 blank · 70 comment · 0 complexity · 162cf2f1c941f4a106fa69bd077a0d9f MD5 · raw file

  1. //
  2. // FamilySearchConnection.h
  3. // FamilySearchKit
  4. //
  5. // Created by Logan Allred on 6/9/07.
  6. // Copyright 2008 Logan Allred. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. /*!
  10. @brief FSKRequest brief
  11. @details FSKRequest details
  12. */
  13. @class FSKRequest;
  14. /*!
  15. @brief <#(description)#>
  16. @details <#(description)#>
  17. */
  18. #define FSKitVersion @"0.1"
  19. /*!
  20. @brief <#(description)#>
  21. @details <#(description)#>
  22. */
  23. #define FSKitAgent @"FSKit"
  24. /*!
  25. @brief <#(description)#>
  26. @details <#(description)#>
  27. */
  28. extern NSString *kFSAPIProductionBaseURLString; // Production
  29. extern NSString *kFSAPIBetaBaseURLString; // Beta
  30. extern NSString *kFSAPIDevBaseURLString; // Development
  31. /*!
  32. @class FSKConnection
  33. @brief Stores details needed to make connections to the FamilySearch web services, including authentication
  34. @details (comprehensive description)
  35. */
  36. @interface FSKConnection : NSObject {
  37. NSString *baseURLString;
  38. NSString *developerKey;
  39. NSString *_sessionId;
  40. BOOL needsAuthentication;
  41. BOOL _isAuthenticating;
  42. NSTimeInterval connectionTimeoutInterval;
  43. id _delegate;
  44. NSMutableDictionary *responseDataCache;
  45. NSMutableArray *requestQueue;
  46. }
  47. /*!
  48. @brief (brief description)
  49. @details (comprehensive description)
  50. */
  51. - (id)init;
  52. + (id)sharedConnection;
  53. #pragma mark Accessors
  54. - (NSString *)baseURLString;
  55. - (void)setBaseURLString:(NSString *)value;
  56. /**
  57. * Stores the developer key for this session, only used for login requests, but is required
  58. */
  59. - (NSString *)developerKey;
  60. - (void)setDeveloperKey:(NSString *)value;
  61. - (NSString *)sessionId;
  62. - (void)setSessionId:(NSString *)value;
  63. - (BOOL)hasSessionId;
  64. - (BOOL)needsAuthentication;
  65. - (void)setNeedsAuthentication:(BOOL)value;
  66. - (NSString *)userAgentString;
  67. - (void)setUserAgentString:(NSString *)newAgentString override:(BOOL)override;
  68. -(void)setConnectionTimeoutInterval:(double)aConnectionTimeoutInterval;
  69. -(NSTimeInterval)connectionTimeoutInterval;
  70. - (id)delegate;
  71. - (void)setDelegate:(id)value;
  72. - (void)handleAuthenticationForRequest:(FSKRequest *)request;
  73. @end
  74. #pragma mark -
  75. #pragma mark Delegate Methods
  76. /*!
  77. @category NSObject(FSKConnectionDelegate)
  78. The FSKConnectionDelegate category on NSObject defines
  79. FSKRequest delegate methods that can be implemented by
  80. objects to receive informational callbacks about the asynchronous
  81. load of a FamilySearch API request. For now it just allows a more
  82. centralized location to handle authentication events than with
  83. the FSKRequestDelegate. It may expand to serve as an alternate
  84. to the other FSKRequestDelegate methods as well
  85. <p>See FSKRequestDelegate for detailed documentation
  86. */
  87. @interface NSObject (FSKConnectionDelegate)
  88. /*!
  89. @brief Start authentication for a given challenge
  90. @details Call useCredential:forAuthenticationChallenge:,
  91. continueWithoutCredentialForAuthenticationChallenge: or cancelAuthenticationChallenge: on
  92. the challenge sender when done.
  93. @param request the request for which authentication is needed
  94. @param challenge The NSURLAuthenticationChallenge to start authentication for
  95. */
  96. - (void)request:(FSKRequest *)request didReceiveAuthenticationURL:(NSURL *)url;
  97. /*!
  98. @brief Provides the window to attach the authentication sheet to
  99. @details If you implement this delegate method, you can choose which window will have
  100. the authentication sheet attached to it during an authentication challenge. If you do not
  101. implement this method, by default the sheet will attempt to attach to [NSApp mainWindow].
  102. If you return nil, the authentication will be performed with an application modal dialog
  103. instead of a sheet.
  104. */
  105. //- (NSWindow *)windowForAuthenticationSheet:(FSKRequest *)request;
  106. /*!
  107. @brief Cancel authentication for a given request
  108. @param request the request for which authentication was cancelled
  109. @param challenge The NSURLAuthenticationChallenge for which to cancel authentication
  110. */
  111. - (void)request:(FSKRequest *)request didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
  112. @end