123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- #import <Foundation/Foundation.h>
- #import <Realm/RLMCredentials.h>
- #import <Realm/RLMRealmConfiguration.h>
- @class RLMUser, RLMSyncSession, RLMRealm, RLMUserIdentity, RLMAPIKeyAuth, RLMMongoClient, RLMMongoDatabase, RLMMongoCollection;
- @protocol RLMBSON;
- typedef NS_ENUM(NSUInteger, RLMUserState) {
-
- RLMUserStateLoggedOut,
-
- RLMUserStateLoggedIn,
-
- RLMUserStateRemoved
- };
- typedef void(^RLMOptionalUserBlock)(RLMUser * _Nullable, NSError * _Nullable);
- typedef void(^RLMUserOptionalErrorBlock)(NSError * _Nullable);
- typedef void(^RLMUserCustomDataBlock)(NSDictionary * _Nullable, NSError * _Nullable);
- typedef void(^RLMCallFunctionCompletionBlock)(id<RLMBSON> _Nullable, NSError * _Nullable);
- NS_ASSUME_NONNULL_BEGIN
- @interface RLMUser : NSObject
- @property (nonatomic, readonly) NSString *identifier NS_SWIFT_NAME(id);
- @property (nonatomic, readonly) NSArray<RLMUserIdentity *> *identities;
- @property (nullable, nonatomic, readonly) NSString *refreshToken;
- @property (nullable, nonatomic, readonly) NSString *accessToken;
- @property (nonatomic, readonly) RLMUserState state;
- @property (nonatomic, readonly) BOOL isLoggedIn;
- #pragma mark - Lifecycle
- - (RLMRealmConfiguration *)configurationWithPartitionValue:(nullable id<RLMBSON>)partitionValue NS_REFINED_FOR_SWIFT;
- #pragma mark - Sessions
- - (nullable RLMSyncSession *)sessionForPartitionValue:(id<RLMBSON>)partitionValue;
- @property (nonatomic, readonly) NSArray<RLMSyncSession *> *allSessions;
- #pragma mark - Custom Data
- @property (nonatomic, readonly) NSDictionary *customData NS_REFINED_FOR_SWIFT;
- - (void)refreshCustomDataWithCompletion:(RLMUserCustomDataBlock)completion;
- - (void)linkUserWithCredentials:(RLMCredentials *)credentials
- completion:(RLMOptionalUserBlock)completion NS_REFINED_FOR_SWIFT;
- - (void)removeWithCompletion:(RLMUserOptionalErrorBlock)completion;
- - (void)logOutWithCompletion:(RLMUserOptionalErrorBlock)completion;
- @property (nonatomic, readonly) RLMAPIKeyAuth *apiKeysAuth;
- - (RLMMongoClient *)mongoClientWithServiceName:(NSString *)serviceName NS_REFINED_FOR_SWIFT;
- - (void)callFunctionNamed:(NSString *)name
- arguments:(NSArray<id<RLMBSON>> *)arguments
- completionBlock:(RLMCallFunctionCompletionBlock)completion NS_REFINED_FOR_SWIFT;
- - (instancetype)init __attribute__((unavailable("RLMUser cannot be created directly")));
- + (instancetype)new __attribute__((unavailable("RLMUser cannot be created directly")));
- @end
- #pragma mark - User info classes
- @interface RLMUserIdentity : NSObject
- @property (nonatomic, readonly) NSString *providerType;
- @property (nonatomic, readonly) NSString *identifier;
- - (instancetype)initUserIdentityWithProviderType:(NSString *)providerType
- identifier:(NSString *)identifier;
- @end
- NS_ASSUME_NONNULL_END
|