Last Updated on : 2022-03-03 06:42:24download
The class TuyaResidenceSiteInvitation
of TuyaSmartResidence
is used to invite and update members on a site. The following types of sites are supported:
admin
. The site cannot be modified or deleted, and its ownership cannot be transferred.owner
. This role is granted the highest-level permissions.API description
Creates an invitation code and only applies to a self-managed site. The instance method of TuyaResidenceSiteInvitation
is used.
- (void)invitationMemberWithCreateRequestModel:(TuyaResidenceInvitationCreateRequestModel *)createRequestModel
success:(void(^)(TuyaResidenceInvitationResultModel *invitationResultModel))success
failure:(TYFailureError)failure;
Parameters
Parameter | Description |
---|---|
createRequestModel | The request model to generate an invitation code. |
success | The success callback. |
failure | The failure callback. |
Data model of TuyaResidenceInvitationCreateRequestModel
Field | Type | Description |
---|---|---|
siteID | long long | The ID of the site that the target member joins. |
needMsgContent | BOOL | Specifies whether invitation text is required. |
Data model of TuyaResidenceInvitationResultModel
Field | Type | Description |
---|---|---|
invitationMsgContent | NSString | The invitation text. |
invitationCode | NSString | The invitation code. |
invitationId | NSNumber | The invitation ID. |
Example
[self.siteInvitation invitationMemberWithCreateRequestModel:model success:^(TuyaResidenceInvitationResultModel * _Nonnull invitationResultModel) {
} failure:^(NSError *error) {
}];
API description
- (void)joinSiteWithInvitationCode:(NSString *)invitationCode
success:(TYSuccessBOOL)success
failure:(TYFailureError)failure;
Parameters
Parameter | Description |
---|---|
invitationCode | The invitation code. |
success | The success callback. |
failure | The failure callback. |
Example
[self.siteInvitation joinSiteWithInvitationCode:invitationCode success:^(BOOL result) {
} failure:^(NSError *error) {
}];
API description
- (void)reinviteInvitationWithReinviteRquestModel:(TuyaResidenceInvitationCreateRequestModel *)createRequestModel
success:(void(^)(TuyaResidenceInvitationResultModel *invitationResultModel))success
failure:(TYFailureError)failure;
Parameters
Parameter | Description |
---|---|
createRequestModel | The request model to generate an invitation code. |
success | The success callback. |
failure | The failure callback. |
Example
[self.siteInvitation reinviteInvitationWithReinviteRquestModel:model success:^(TuyaResidenceInvitationResultModel * _Nonnull invitationResultModel) {
} failure:^(NSError *error) {
}];
API description
- (void)addMemberWithSiteId:(long long)siteId
nickName:(NSString *)nickName
userName:(NSString *)userName
isAdmin:(BOOL)isAdmin
isAutoAccept:(BOOL)isAutoAccept
success:(TYSuccessHandler)success
failure:(TYFailureError)failure;
Parameters
Parameter | Description |
---|---|
siteId | The site ID. |
nickName | The nickname of the member. |
userName | The username that can be a mobile phone number or email address. A mobile phone number must be prefixed with a country code in the format of country code-mobile phone number. Example: 00-1234567 . |
isAdmin | Specifies whether the target member is an administrator.
|
isAutoAccept | Specifies whether the target member automatically accepts the invitation.
|
success | The success callback. |
failure | The failure callback. |
Example
[self.siteInvitation addMemberWithSiteId:[Helper getCurrentSiteModel].siteId nickName:_nicknameTextField.text userName:_accountTextField.text isAdmin:NO isAutoAccept:YES success:^{
} failure:^(NSError *error) {
}];
API description
- (void)cancelInvitationWithInvitationID:(NSNumber *)invitationID
success:(TYSuccessBOOL)success
failure:(TYFailureError)failure;
Parameters
Parameter | Description |
---|---|
invitationID | The invitation ID. |
success | The success callback. |
failure | The failure callback. |
Example
[self.siteInvitation cancelInvitationWithInvitationID:invitationID success:^(BOOL result) {
} failure:^(NSError *error) {
}];
Returns the invitation records for a self-managed site.
API description
- (void)fetchInvitationRecordListWithSiteID:(long long)siteID
success:(void(^)(NSArray<TuyaResidenceInvitationRecordModel *> *invitationRecordList))success
failure:(TYFailureError)failure;
Parameters
Parameter | Description |
---|---|
siteID | The site ID. |
success | The success callback. |
failure | The failure callback. |
Example
[self.siteInvitation fetchInvitationRecordListWithSiteID:siteID success:^(NSArray<TuyaResidenceInvitationRecordModel *> * _Nonnull invitationRecordList) {
} failure:^(NSError *error) {
}];
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback