31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
*
* @param client If the login succeeded, the newly created client
* @param exception If the login failed, an exception
*/
typedef void (^mtx_client_login_block_t)(MTXClient *_Nullable client,
id _Nullable exception);
/**
* @brief A class that represents a client.
*/
@interface MTXClient: OFObject
/**
* @brief The user ID used by the client.
*/
|
>
>
>
>
>
>
>
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
*
* @param client If the login succeeded, the newly created client
* @param exception If the login failed, an exception
*/
typedef void (^mtx_client_login_block_t)(MTXClient *_Nullable client,
id _Nullable exception);
/**
* @brief A block called when the device was logged out.
*
* @param exception `nil` on success, otherwise an exception
*/
typedef void (^mtx_client_logout_block_t)(id _Nullable exception);
/**
* @brief A class that represents a client.
*/
@interface MTXClient: OFObject
/**
* @brief The user ID used by the client.
*/
|
88
89
90
91
92
93
94
95
96
97
|
* @param homeserver The URL of the homeserver
* @return An initialized MTXClient
*/
- (instancetype)initWithUserID: (OFString *)userID
deviceID: (OFString *)deviceID
accessToken: (OFString *)accessToken
homeserver: (OFURL *)homeserver OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END
|
>
>
>
>
>
>
>
>
>
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
* @param homeserver The URL of the homeserver
* @return An initialized MTXClient
*/
- (instancetype)initWithUserID: (OFString *)userID
deviceID: (OFString *)deviceID
accessToken: (OFString *)accessToken
homeserver: (OFURL *)homeserver OF_DESIGNATED_INITIALIZER;
/**
* @brief Logs out the device and invalidates the access token.
*
* @warning The client can no longer be used after this succeeded!
*
* @param block The block to call when logging out succeeded or failed
*/
- (void)asyncLogOutWithBlock: (mtx_client_logout_block_t)block;
@end
OF_ASSUME_NONNULL_END
|