User Meta Data

Registration with MetaData#

To register a user with providing MetaData, you can utilise below method.

FlyCore.registerUser(USER_IDENTIFIER,META_DATA, (isSuccess, throwable, data ) -> {
if(isSuccess) {
Boolean isNewUser = (Boolean) data.get("is_new_user");
String userJid = (String) data.get("userJid");
JSONObject responseObject = (JSONObject) data.get("data");
// Get Username and password from the object
} else {
// Register user failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
USER_IDENTIFIERStringA unique Id to Register the User. We accept only the AlphaNumeric String
META_DATAList<MetaData>list of key - value pair of metadata object. Maximum size is 3
CALLBACKFlyCallbackFlyCallback is used as a callback, implemented and expressed as lambda expression for easy reading

Get User List with MetaData#

To retrive all registered users with MetaData use below method. User list can also be retrived based on search key word, also this method supports pagination. This function will return the total number of pages.

FlyCore.getUserList(PAGE_NUMBER, PER_PAGE_RESULT_SIZE, SEARCH_TERM, META_DATA_USER_LIST, (isSuccess, throwable, data) -> {
if (isSuccess) {
ArrayList<ProfileDetails> userList = (ArrayList<ProfileDetails>) data.get("data");
Integer totalPage = (Integer) data.get("total_pages");
//User list fetched. Update the UI
} else {
//Get user list failed print throwable to find the details
}
});

Refer this doc to know more about Profile Details Class

ArgumentTypeDescription
PAGE_NUMBERintPage number of user list default value 1
PER_PAGE_RESULT_SIZEintNumber of users per page default value 50
SEARCH_TERMStringtext characters for which search has to happen default value empty
META_DATA_USER_LISTMetaDataUserListmodel class which filters the results by metadata default value is empty
CALLBACKFlyCallbackFlyCallback implemented as as lambda expression

Get MetaData of user#

If you want to get MetaData value of user, you can utilise the below method.

ChatManager.getMetaData((isSuccess, throwable, data) -> {
if (isSuccess) {
ArrayList<MetaData> metDataList = (ArrayList<MetaData>) data.get("data");
//update the UI
} else {
//Fetching metaData value failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
CALLBACKFlyCallbackFlyCallback implemented as lambda expression

Update MetaData of user#

If you want to update MetaData value of user, you can utilise the below method.

ChatManager.updateMetaData(META_DATA, (isSuccess, throwable, data) -> {
if (isSuccess) {
ArrayList<MetaData> metDataList = (ArrayList<MetaData>) data.get("data");
//update the UI
} else {
//updated metaData value failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
META_DATAList<MetaData>list of key - value pair of metadata object. Maximum size is 3
CALLBACKFlyCallbackFlyCallback implemented as lambda expression