# Relationship chain data

In order to enrich the social gameplay of games, we provide developers with the ability to link data. Through the relationship chain data capability, it can satisfy usage scenarios such as in-game rankings and friend surpassing.

The relationship chain data of each WeChat user includes 3 parts:

-User data of the user's friends -User data of group members of a group that the user belongs to -The user's friend list who may be interested in the game (supported from the basic library 2.9.0)

API for obtaining relational chain data:

-wx.getFriendCloudStorage Get the user data of the current user's friends who also play the mini game -wx.getGroupCloudStorage Get the user data of the members of the current user who also play the mini game in a certain group -wx.getPotentialFriendList Get the current user's list of unregistered friends who are interested in the game

The return results of these three APIs are all an object array, each element of the array is an object representing user data, and its structure is as follows:

Property Type Description
openId string User's openId
avatarUrl string User's WeChat avatar url
nickName string User's WeChat nickname
data Object User's game data

The user's game data refers to the user's rank, record and other game business-specific data. By calling wx.setUserCloudStorage(), the current user's game data can be hosted in the WeChat background. Only users who have hosted data will be regarded as users who played the mini game and will appear in wx.getFriendCloudStorage() and wx.getGroupCloudStorage() returns an array of objects.

In addition, we also provide the following APIs: -wx.removeUserCloudStorage() delete the data in the specified field in the user managed data -wx.getUserCloudStorage() Get the hosting data of the current user

wx.getUserCloudStorage, wx.getFriendCloudStorage() and wx.getGroupCloudStorage() can only be used in the Open Data Domain Call in. wx.setUserCloudStorage() and wx.removeUserCloudStorage() can be called in both the main domain and the open data domain.

点击咨询小助手