added iOS source code
[wl-app.git] / iOS / Pods / Realm / include / RLMJSONModels.h
1 ////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright 2017 Realm Inc.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 ////////////////////////////////////////////////////////////////////////////
18
19 #import <Foundation/Foundation.h>
20
21 #import "RLMSyncUtil_Private.h"
22
23 NS_ASSUME_NONNULL_BEGIN
24
25 @class RLMTokenDataModel, RLMSyncUserAccountInfo;
26
27 #pragma mark - RLMTokenModel
28
29 @interface RLMTokenModel : NSObject RLM_SYNC_UNINITIALIZABLE
30
31 @property (nonatomic, readonly) NSString *token;
32 @property (nonatomic, nullable, readonly) NSString *path;
33 @property (nonatomic, readonly) RLMTokenDataModel *tokenData;
34
35 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
36
37 @end
38
39 #pragma mark - RLMTokenDataModel
40
41 @interface RLMTokenDataModel : NSObject RLM_SYNC_UNINITIALIZABLE
42
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;
49
50 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
51
52 @end
53
54 #pragma mark - RLMAuthResponseModel
55
56 /**
57  An internal class representing a valid JSON response to an auth request.
58
59  ```
60  {
61  "access_token": { ... } // (optional),
62  "refresh_token": { ... } // (optional)
63  }
64  ```
65  */
66 @interface RLMAuthResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
67
68 @property (nonatomic, readonly, nullable) RLMTokenModel *accessToken;
69 @property (nonatomic, readonly, nullable) RLMTokenModel *refreshToken;
70
71 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary
72                 requireAccessToken:(BOOL)requireAccessToken
73                requireRefreshToken:(BOOL)requireRefreshToken;
74
75 @end
76
77 #pragma mark - RLMUserInfoResponseModel
78
79 @interface RLMUserResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
80
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;
85
86 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
87
88 @end
89
90 #pragma mark - RLMSyncErrorResponseModel
91
92 @interface RLMSyncErrorResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE
93
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;
98
99 - (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary;
100
101 @end
102
103 NS_ASSUME_NONNULL_END