1 ////////////////////////////////////////////////////////////////////////////
3 // Copyright 2017 Realm Inc.
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 ////////////////////////////////////////////////////////////////////////////
19 #import <Foundation/Foundation.h>
21 #import "RLMSyncUtil_Private.h"
23 NS_ASSUME_NONNULL_BEGIN
25 @class RLMTokenDataModel, RLMSyncUserAccountInfo;
27 #pragma mark - RLMTokenModel
29 @interface RLMTokenModel : NSObject RLM_SYNC_UNINITIALIZABLE
31 @property (nonatomic, readonly) NSString *token;
32 @property (nonatomic, nullable, readonly) NSString *path;
33 @property (nonatomic, readonly) RLMTokenDataModel *tokenData;
35 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
39 #pragma mark - RLMTokenDataModel
41 @interface RLMTokenDataModel : NSObject RLM_SYNC_UNINITIALIZABLE
43 @property (nonatomic, readonly) NSString *identity;
44 @property (nonatomic, nullable, readonly) NSString *appID;
45 @property (nonatomic, nullable, readonly) NSString *path;
46 @property (nonatomic, readonly) NSTimeInterval expires;
47 @property (nonatomic, readonly) BOOL isAdmin;
48 //@property (nonatomic, readonly) NSArray *access;
50 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
54 #pragma mark - RLMAuthResponseModel
57 An internal class representing a valid JSON response to an auth request.
61 "access_token": { ... } // (optional),
62 "refresh_token": { ... } // (optional)
66 @interface RLMAuthResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
68 @property (nonatomic, readonly, nullable) RLMTokenModel *accessToken;
69 @property (nonatomic, readonly, nullable) RLMTokenModel *refreshToken;
71 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary
72 requireAccessToken:(BOOL)requireAccessToken
73 requireRefreshToken:(BOOL)requireRefreshToken;
77 #pragma mark - RLMUserInfoResponseModel
79 @interface RLMUserResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
81 @property (nonatomic, readonly) NSString *identity;
82 @property (nonatomic, readonly) NSArray<RLMSyncUserAccountInfo *> *accounts;
83 @property (nonatomic, readonly) NSDictionary *metadata;
84 @property (nonatomic, readonly) BOOL isAdmin;
86 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
90 #pragma mark - RLMSyncErrorResponseModel
92 @interface RLMSyncErrorResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
94 @property (nonatomic, readonly) NSInteger status;
95 @property (nonatomic, readonly) NSInteger code;
96 @property (nullable, nonatomic, readonly, copy) NSString *title;
97 @property (nullable, nonatomic, readonly, copy) NSString *hint;
99 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
103 NS_ASSUME_NONNULL_END