1
wei
2021-01-21 62d098cb78296feaa6f786a20748921338db838c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
//
// TuyaSmartHomeDeviceShare.h
// TuyaSmartDeviceKit
//
// Copyright (c) 2014-2021 Tuya Inc. (https://developer.tuya.com)
 
#import <UIKit/UIKit.h>
#import "TuyaSmartShareMemberModel.h"
#import "TuyaSmartShareMemberDetailModel.h"
#import "TuyaSmartReceiveMemberDetailModel.h"
#import "TuyaSmartReceivedShareUserModel.h"
#import "TuyaSmartShareDeviceModel.h"
#import "TuyaSmartDeviceShareModel.h"
 
 
/// Sharing device related functions (based on device dimension sharing).
@interface TuyaSmartHomeDeviceShare : NSObject
 
/// Device add sharing.
/// @param requestModel Adding a shared device model
/// @param success Called when the task finishes successfully. TuyaSmartShareMemberModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)addDeviceShareWithRequestModel:(TuyaSmartDeviceShareRequestModel *)requestModel
                               success:(void(^)(TuyaSmartShareMemberModel *model))success
                               failure:(TYFailureError)failure;
 
 
/// Add Share (New, does not overwrite old share)
/// @param memberId memberId
/// @param devIds devId list
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)addShareWithMemberId:(NSInteger)memberId
                      devIds:(NSArray <NSString *> *)devIds
                     success:(TYSuccessHandler)success
                     failure:(TYFailureError)failure;
 
 
/// Get a list of all users actively sharing under family.
/// @param homeId homeId
/// @param success Called when the task finishes successfully. A list of TuyaSmartShareMemberModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getShareMemberListWithHomeId:(long long)homeId
                             success:(void(^)(NSArray<TuyaSmartShareMemberModel *> *list))success
                             failure:(TYFailureError)failure;
 
 
/// Get a list of all users who have received a share.
/// @param success Called when the task finishes successfully. A list of TuyaSmartShareMemberModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getReceiveMemberListWithSuccess:(void(^)(NSArray<TuyaSmartShareMemberModel *> *list))success
                                failure:(TYFailureError)failure;
 
 
/// Get the shared data of a single active share user.
/// @param memberId memberId
/// @param success Called when the task finishes successfully. TuyaSmartShareMemberDetailModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getShareMemberDetailWithMemberId:(NSInteger)memberId
                                 success:(void(^)(TuyaSmartShareMemberDetailModel *model))success
                                 failure:(TYFailureError)failure;
 
 
/// Get the shared data of a single user who received a share.
/// @param memberId memberId
/// @param success Called when the task finishes successfully. TuyaSmartShareMemberDetailModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getReceiveMemberDetailWithMemberId:(NSInteger)memberId
                                   success:(void(^)(TuyaSmartReceiveMemberDetailModel *model))success
                                   failure:(TYFailureError)failure;
 
 
 
/// Remove active sharers.
/// @param memberId memberId
/// @param success  Called when the task finishes successfully.
/// @param failure  If error occurred while adding the task, this block will be called.
- (void)removeShareMemberWithMemberId:(NSInteger)memberId
                              success:(TYSuccessHandler)success
                              failure:(TYFailureError)failure;
 
 
/// Remove received sharer
/// @param memberId Shared member ID.
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)removeReceiveShareMemberWithMemberId:(NSInteger)memberId
                                     success:(TYSuccessHandler)success
                                     failure:(TYFailureError)failure;
 
 
/// Change the nickname of an active shared user.
/// @param memberId memberId
/// @param name nickname
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)renameShareMemberNameWithMemberId:(NSInteger)memberId
                                     name:(NSString *)name
                                  success:(TYSuccessHandler)success
                                  failure:(TYFailureError)failure;
 
 
/// Change the nickname of the person who received the share.
/// @param memberId memberId
/// @param name nickname
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)renameReceiveShareMemberNameWithMemberId:(NSInteger)memberId
                                            name:(NSString *)name
                                         success:(TYSuccessHandler)success
                                         failure:(TYFailureError)failure;
 
 
#pragma mark - 
 
/// Remove Received Shared.
/// @param devId   DevId
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)removeReceiveDeviceShareWithDevId:(NSString *)devId
                                  success:(TYSuccessHandler)success
                                  failure:(TYFailureError)failure;
 
 
/// Delete shared devices.
/// @param memberId member ID
/// @param devId Device ID
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)removeDeviceShareWithMemberId:(NSInteger)memberId
                                devId:(NSString *)devId
                              success:(TYSuccessHandler)success
                              failure:(TYFailureError)failure;
 
 
/// Get a list of device share users.
/// @param devId The device ID.
/// @param success Called when the task finishes successfully. A list of TuyaSmartShareMemberModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getDeviceShareMemberListWithDevId:(NSString *)devId
                                  success:(void(^)(NSArray<TuyaSmartShareMemberModel *> *list))success
                                  failure:(TYFailureError)failure;
 
 
/// Get users for device sharing.
/// @param devId The device ID.
/// @param success Called when the task finishes successfully. TuyaSmartReceivedShareUserModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getShareInfoWithDevId:(NSString *)devId
                      success:(void(^)(TuyaSmartReceivedShareUserModel *model))success
                      failure:(TYFailureError)failure;
 
 
/// Invitation to share to other users
/// @param countryCode countryCode
/// @param userAccount userAccount
/// @param devId Device ID.
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)inviteShareWithCountryCode:(NSString *)countryCode
                       userAccount:(NSString *)userAccount
                             devId:(NSString *)devId
                           success:(TYSuccessInt)success
                           failure:(TYFailureError)failure;
 
 
/// Confirm invite share.
/// @param shareId The shareId returned by the invite share interface.
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)confirmInviteShareWithShareId:(NSInteger)shareId
                              success:(TYSuccessHandler)success
                              failure:(TYFailureError)failure;
 
#pragma mark - Group Share
 
/// Get a list of shared users for a single group (reflected in the panel).
/// @param groupId groupId
/// @param success Called when the task finishes successfully. A list of TuyaSmartShareMemberModel will be returned.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getGroupShareMemberListWithGroupId:(NSString *)groupId
                                   success:(void(^)(NSArray<TuyaSmartShareMemberModel *> *list))success
                                   failure:(TYFailureError)failure;
 
 
/// Share groups to other users.
/// @param homeId HomeId
/// @param countryCode Country Code
/// @param userAccount User Account
/// @param groupId GroupId
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)addGroupShareToMemberWithHomeId:(long long)homeId
                             countyCode:(NSString *)countryCode
                            userAccount:(NSString *)userAccount
                                groupId:(NSString *)groupId
                                success:(TYSuccessID)success
                                failure:(TYFailureError)failure;
 
 
/// Get sharing information of the group.
/// @param groupId groupId
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)getShareGroupFromInfoWithGroupId:(NSString *)groupId
                                 success:(TYSuccessID)success
                                 failure:(TYFailureError)failure;
 
 
/// Remove sharing groups.
/// @param groupId groupId
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)removeShareGroupWithGroupId:(NSString *)groupId
                            success:(TYSuccessID)success
                            failure:(TYFailureError)failure;
 
 
/// Remove group shares from other members.
/// @param relationId relationId
/// @param groupId groupId
/// @param success Called when the task finishes successfully.
/// @param failure If error occurred while adding the task, this block will be called.
- (void)removeGroupShareWithRelationId:(NSInteger)relationId
                               groupId:(NSString *)groupId
                               success:(TYSuccessHandler)success
                               failure:(TYFailureError)failure;
 
@end