DBSession.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // DBSession.h
  3. // DropboxSDK
  4. //
  5. // Created by Brian Smith on 4/8/10.
  6. // Copyright 2010 Dropbox, Inc. All rights reserved.
  7. //
  8. #import "MPOAuthCredentialConcreteStore.h"
  9. extern NSString *kDBSDKVersion;
  10. extern NSString *kDBDropboxAPIHost;
  11. extern NSString *kDBDropboxAPIContentHost;
  12. extern NSString *kDBDropboxWebHost;
  13. extern NSString *kDBDropboxAPIVersion;
  14. extern NSString *kDBRootDropbox;
  15. extern NSString *kDBRootAppFolder;
  16. extern NSString *kDBProtocolHTTPS;
  17. @protocol DBSessionDelegate;
  18. /* Creating and setting the shared DBSession should be done before any other Dropbox objects are
  19. used, perferrably in the UIApplication delegate. */
  20. @interface DBSession : NSObject {
  21. NSDictionary *baseCredentials;
  22. NSMutableDictionary *credentialStores;
  23. MPOAuthCredentialConcreteStore *anonymousStore;
  24. NSString *root;
  25. id<DBSessionDelegate> delegate;
  26. }
  27. + (DBSession*)sharedSession;
  28. + (void)setSharedSession:(DBSession *)session;
  29. - (id)initWithAppKey:(NSString *)key appSecret:(NSString *)secret root:(NSString *)root;
  30. - (BOOL)isLinked; // Session must be linked before creating any DBRestClient objects
  31. - (void)unlinkAll;
  32. - (void)unlinkUserId:(NSString *)userId;
  33. - (MPOAuthCredentialConcreteStore *)credentialStoreForUserId:(NSString *)userId;
  34. - (void)updateAccessToken:(NSString *)token accessTokenSecret:(NSString *)secret forUserId:(NSString *)userId;
  35. @property (nonatomic, readonly) NSString *root;
  36. @property (nonatomic, readonly) NSArray *userIds;
  37. @property (nonatomic, assign) id<DBSessionDelegate> delegate;
  38. @end
  39. @protocol DBSessionDelegate
  40. - (void)sessionDidReceiveAuthorizationFailure:(DBSession *)session userId:(NSString *)userId;
  41. @end