123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- #import <Realm/RLMConstants.h>
- #import <Realm/RLMCredentials.h>
- #import <Realm/RLMRealmConfiguration.h>
- #import <Realm/RLMSyncConfiguration.h>
- @class RLMUser, RLMSyncSession, RLMRealm, RLMUserIdentity, RLMAPIKeyAuth, RLMMongoClient, RLMMongoDatabase, RLMMongoCollection, RLMUserProfile;
- @protocol RLMBSON;
- typedef NS_ENUM(NSUInteger, RLMUserState) {
-
- RLMUserStateLoggedOut,
-
- RLMUserStateLoggedIn,
-
- RLMUserStateRemoved
- };
- RLM_SWIFT_SENDABLE
- typedef void(^RLMOptionalUserBlock)(RLMUser * _Nullable, NSError * _Nullable);
- RLM_SWIFT_SENDABLE
- typedef void(^RLMUserOptionalErrorBlock)(NSError * _Nullable);
- RLM_SWIFT_SENDABLE
- typedef void(^RLMUserCustomDataBlock)(NSDictionary * _Nullable, NSError * _Nullable);
- RLM_SWIFT_SENDABLE
- typedef void(^RLMCallFunctionCompletionBlock)(id<RLMBSON> _Nullable, NSError * _Nullable);
- RLM_HEADER_AUDIT_BEGIN(nullability, sendability)
- RLM_SWIFT_SENDABLE RLM_FINAL
- @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;
- - (RLMRealmConfiguration *)configurationWithPartitionValue:(nullable id<RLMBSON>)partitionValue
- clientResetMode:(RLMClientResetMode)clientResetMode NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)configurationWithPartitionValue:(nullable id<RLMBSON>)partitionValue
- clientResetMode:(RLMClientResetMode)clientResetMode
- notifyBeforeReset:(nullable RLMClientResetBeforeBlock)beforeResetBlock
- notifyAfterReset:(nullable RLMClientResetAfterBlock)afterResetBlock NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)configurationWithPartitionValue:(nullable id<RLMBSON>)partitionValue
- clientResetMode:(RLMClientResetMode)clientResetMode
- manualClientResetHandler:(nullable RLMSyncErrorReportingBlock)manualClientResetHandler NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)flexibleSyncConfiguration NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)flexibleSyncConfigurationWithClientResetMode:(RLMClientResetMode)clientResetMode
- notifyBeforeReset:(nullable RLMClientResetBeforeBlock)beforeResetBlock
- notifyAfterReset:(nullable RLMClientResetAfterBlock)afterResetBlock NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)flexibleSyncConfigurationWithClientResetMode:(RLMClientResetMode)clientResetMode
- manualClientResetHandler:(nullable RLMSyncErrorReportingBlock)manualClientResetHandler NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)flexibleSyncConfigurationWithInitialSubscriptions:(RLMFlexibleSyncInitialSubscriptionsBlock)initialSubscriptions
- rerunOnOpen:(BOOL)rerunOnOpen NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)flexibleSyncConfigurationWithInitialSubscriptions:(RLMFlexibleSyncInitialSubscriptionsBlock)initialSubscriptions
- rerunOnOpen:(BOOL)rerunOnOpen
- clientResetMode:(RLMClientResetMode)clientResetMode
- notifyBeforeReset:(nullable RLMClientResetBeforeBlock)beforeResetBlock
- notifyAfterReset:(nullable RLMClientResetAfterBlock)afterResetBlock NS_REFINED_FOR_SWIFT;
- - (RLMRealmConfiguration *)flexibleSyncConfigurationWithInitialSubscriptions:(RLMFlexibleSyncInitialSubscriptionsBlock)initialSubscriptions
- rerunOnOpen:(BOOL)rerunOnOpen
- clientResetMode:(RLMClientResetMode)clientResetMode
- manualClientResetHandler:(nullable RLMSyncErrorReportingBlock)manualClientResetHandler 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;
- @property (nonatomic, readonly) RLMUserProfile *profile;
- - (void)refreshCustomDataWithCompletion:(RLMUserCustomDataBlock)completion;
- - (void)linkUserWithCredentials:(RLMCredentials *)credentials
- completion:(RLMOptionalUserBlock)completion NS_REFINED_FOR_SWIFT;
- - (void)removeWithCompletion:(RLMUserOptionalErrorBlock)completion;
- - (void)deleteWithCompletion:(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
- RLM_SWIFT_SENDABLE RLM_FINAL
- @interface RLMUserIdentity : NSObject
- @property (nonatomic, readonly) NSString *providerType;
- @property (nonatomic, readonly) NSString *identifier;
- - (instancetype)initUserIdentityWithProviderType:(NSString *)providerType
- identifier:(NSString *)identifier;
- @end
- RLM_SWIFT_SENDABLE RLM_FINAL
- @interface RLMUserProfile : NSObject
- @property (nonatomic, readonly, nullable) NSString *name;
- @property (nonatomic, readonly, nullable) NSString *email;
- @property (nonatomic, readonly, nullable) NSString *pictureURL;
- @property (nonatomic, readonly, nullable) NSString *firstName;
- @property (nonatomic, readonly, nullable) NSString *lastName;
- @property (nonatomic, readonly, nullable) NSString *gender;
- @property (nonatomic, readonly, nullable) NSString *birthday;
- @property (nonatomic, readonly, nullable) NSString *minAge;
- @property (nonatomic, readonly, nullable) NSString *maxAge;
- @property (nonatomic, readonly) NSDictionary *metadata NS_REFINED_FOR_SWIFT;
- @end
- RLM_HEADER_AUDIT_END(nullability, sendability)
|