Last Updated on : 2022-02-17 06:55:55download
The member management API methods can be called to implement a bunch of features to manage house members. For example, add, transfer, query, or delete members.
ITuyaCommunityHouseMember
provides the capabilities to add a member, get a list of house members, and delete members. The class TuyaCommunitySDK.getHouseMemberInstance()
is called to implement these features.
Data types of TuyaCommunityMemberBean
Property | Type | Description |
---|---|---|
memberId | String | The member ID. |
headPic | String | The avatar of the member. |
sex | Integer | The gender of the member.
|
houseId | Long | The house ID. |
nickName | String | The nickname of the member. |
roomUserId | String | The ID of the mapping between a house and a user. |
houseId | Long | The house ID. |
userTypeName | String | The type of the current user. |
userTypeCode | String | The user type code of the current user. Valid values:
|
audit | Integer | The reviewing status of a member. Valid values:
|
dealStatus | Integer | The status of a member’s request to join a house. Valid values:
|
role | Integer | The role of the member. Valid values:
|
activeStatus | Boolean | Indicates whether the member is activated. The member’s mobile phone number is registered for activation. |
uploaded | Boolean | Indicates whether a member has uploaded the biometric identity. |
mobile | String | The mobile phone number of the member. |
applySource | Integer | The channel through which the member is added. Valid values:
|
Adds a member to a specified house.
API description
void addMember(String communityId, String roomId, String realName, @TuyaCommunityGenderType int sex,
String phoneNumber, String userType, @TuyaCommunityMemberRole int role,
@Nullable String expireTime, ITuyaCommunityResultCallback<String> callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
houseId | The house ID. |
realName | The real name of the member. |
sex | The gender of a member. Valid values:
|
phoneNumber | The mobile phone number. |
userType | The type of member. You can get the value from the returned list of user types. |
role | The role of the house member. Valid values:
|
expireTime | The expiration time. This parameter is optional and specifies the time when a lease expires for a tenant user. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().addMember(communityId, roomId,
etName.getText().toString(), TuyaCommunityGenderType.Female, etPhone.getText().toString(),
mUserType, TuyaCommunityMemberRole.ROLE_MEMBER,"", new ITuyaCommunityResultCallback<String>() {
@Override
public void onSuccess(String roomUserId) {
// do something
}
@Override
public void onFailure(String s, String s1) {
// do something
}
});
Returns the details of a member in a house.
API description
void getMemberDetail(String communityId, String roomUserId, ITuyaCommunityResultCallback<TuyaCommunityMemberBean> callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
roomUserId | The ID of the mapping between a house and a user. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().getMemberDetail(communityId, item.getRoomUserId(), new ITuyaCommunityResultCallback<TuyaCommunityMemberBean>() {
@Override
public void onSuccess(TuyaCommunityMemberBean tuyaCommunityMemberBean) {
// do something
}
@Override
public void onFailure(String s, String s1) {
// do something
}
});
Returns the details of a member that is transferred out of a house.
API description
void getMoveOutMemberDetail(String communityId, String roomUserId, ITuyaCommunityResultCallback<TuyaCommunityMemberBean> callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
roomUserId | The ID of the mapping between a house and a user. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance(). getMoveOutMemberDetail(communityId, item.getRoomUserId(), new ITuyaCommunityResultCallback<TuyaCommunityMemberBean>() {
@Override
public void onSuccess(TuyaCommunityMemberBean tuyaCommunityMemberBean) {
// do something
}
@Override
public void onFailure(String s, String s1) {
// do something
}
});
Returns a list of members that are not transferred out of a house.
API description
void getMemberList(String communityId, long houseId, ITuyaCommunityResultCallback<ArrayList<TuyaCommunityMemberBean>> callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
houseId | The house ID. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().getMemberList(communityId, houseId, new ITuyaCommunityResultCallback<ArrayList<TuyaCommunityMemberBean>>() {
@Override
public void onSuccess(ArrayList<TuyaCommunityMemberBean> tuyaCommunityMemberBeans) {
if (tuyaCommunityMemberBeans != null) {
mCommunityListAdapter.setCommunityList(tuyaCommunityMemberBeans);
}
}
@Override
public void onFailure(String s, String s1) {
}
});
Returns a list of members that are transferred out of a house.
API description
void getMoveOutMemberList(String communityId, long houseId, ITuyaCommunityResultCallback<ArrayList<TuyaCommunityMemberBean>> callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
houseId | The house ID. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().getMemberList(communityId, houseId, new ITuyaCommunityResultCallback<ArrayList<TuyaCommunityMemberBean>>() {
@Override
public void onSuccess(ArrayList<TuyaCommunityMemberBean> tuyaCommunityMemberBeans) {
if (tuyaCommunityMemberBeans != null) {
mCommunityListAdapter.setCommunityList(tuyaCommunityMemberBeans);
}
}
@Override
public void onFailure(String s, String s1) {
}
});
Returns the type of members, such as the owner, house member, or tenant.
API description
void getMemberTypeList(String roomId, ITuyaCommunityResultCallback<ArrayList<TuyaCommunityMemberTypeBean>> callback);
Request parameter
Parameter | Description |
---|---|
roomId | The house ID. |
callback | The callback. |
Data types of TuyaCommunityMemberTypeBean
Property | Type | Description |
---|---|---|
memberTypeCode | String | The type of member. Valid values:
|
memberTypeId | String | The ID of the member type. Valid values are the same as that of memberTypeCode . |
memberTypeName | String | The name of the member type. |
ifHasOwner | Boolean | Indicates whether the house has an owner. |
select | Boolean | Indicates whether a member type is available. |
Example
TuyaCommunitySDK.getHouseMemberInstance().getMemberTypeList(roomId, new ITuyaCommunityResultCallback<ArrayList<TuyaCommunityMemberTypeBean>>() {
@Override
public void onSuccess(ArrayList<TuyaCommunityMemberTypeBean> data) {
}
@Override
public void onFailure(String s, String s1) {
}
});
API description
void auditMember(String communityId, String roomUserId, @TuyaCommunityMemberAuditStatus int audit, @TuyaCommunityMemberRole int role, ISuccessFailureCallback callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
roomUserId | The ID of the mapping between a house and a user. |
audit | The reviewing status. Valid values:
|
role | The role of the house member. Valid values:
|
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().auditMember(communityId, roomUserId, audit, role, new ISuccessFailureCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onFailure(String s, String s1) {
// do something
}
}););
This API method is used to verify a user’s identity and mobile phone number in a community. It is required when the user requests to add a house to the community. The house can be added only after the user identity is verified.
API description
void getUserCertificationInfo(ITuyaCommunityResultCallback<TuyaCommunityUserCertificationInfoBean> callback);
Request parameter
Parameter | Description |
---|---|
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().getUserCertificationInfo(new ITuyaCommunityResultCallback<TuyaCommunityUserCertificationInfoBean>() {
@Override
public void onSuccess(TuyaCommunityUserCertificationInfoBean houseCerificationBean) {
if (!houseCerificationBean.isUserIdentificationStatus()) {
startActivity(new Intent(HouseListActivity.this, VerifyInfoActivity.class));
} else {
startActivity(new Intent(HouseListActivity.this, ChooseCommunityActivity.class));
}
}
@Override
public void onFailure(String s, String s1) {
ToastUtil.shortToast(HouseListActivity.this, s1);
}
});
If the current user gets the verification status as unverified, this API method can be called to implement user identity verification. After the user identity is verified, the user is allowed to add a house.
API description
void verifyUserInfo(String realName, @TuyaCommunityGenderType int sex, @Nullable String idCard, ISuccessFailureCallback callback);
Request parameter
Parameter | Description |
---|---|
realName | The real name of the member. |
sex | The gender of a member. Valid values:
|
idCard | The ID card number. This parameter is optional. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().verifyUserInfo(etName.getText().toString(),
1, etIdCard.getText().toString(), new ISuccessFailureCallback() {
@Override
public void onSuccess() {
startActivity(new Intent(VerifyInfoActivity.this, ChooseCommunityActivity.class));
}
@Override
public void onFailure(String s, String s1) {
ToastUtil.shortToast(VerifyInfoActivity.this, s1);
}
});
Updates the role of a member in a house. In most cases, this API method is called when the member is transferred out of the house.
API description
void updateMemberRole(long memberId, @TuyaCommunityMemberRole int role, ISuccessFailureCallback callback);
Request parameter
Parameter | Description |
---|---|
memberId | The member ID. |
name | The name of the member. This parameter is optional. |
headPic | The avatar of the member. This parameter is optional. |
role | The role of the house member. Valid values:
|
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().updateMemberRole(memberId, TuyaCommunityMemberRole.ROLE_ADMIN, new ISuccessFailureCallback() {
@Override
public void onSuccess() {
if (communityId !=null){
}
}
@Override
public void onFailure(String s, String s1) {
if (communityId !=null){
}
}
});
TuyaCommunityMemberRole
can be sorted in ascending order of permission levels: Custom < Member < Admin < Owner. Members can manage those with the same or lower levels of permissions.TuyaCommunityMemberRole.ROLE_OWNER
specifies a house owner that is granted the highest level of permission. Only the owner can transfer other members out of the same house.Transfers a member out of a house by using the role of an owner.
API description
void moveOutMember(String communityId, String roomUserId, ISuccessFailureCallback callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
roomUserId | The ID of the mapping between a house and a user. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance(). moveOutMember(communityId, roomUserId, item.getRoomUserId(), new ISuccessFailureCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onFailure(String s, String s1) {
// do something
}
});
API description
void deleteMember(String communityId, long houseId, String roomUserId, ISuccessFailureCallback callback);
Request parameter
Parameter | Description |
---|---|
communityId | The community ID. |
houseId | The house ID. |
roomUserId | The ID of the mapping between a house and a user. |
callback | The callback. |
Example
TuyaCommunitySDK.getHouseMemberInstance().deleteMember(communityId, houseId, item.getRoomUserId(), new ISuccessFailureCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onFailure(String s, String s1) {
// do something
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback