PICO Unity Platform SDK
UserService Class Reference

Static Public Member Functions

static Task< string > GetAccessToken ()
 Returns an access token for this user. More...
 
static Task< UserGetLoggedInUser ()
 Gets the information about the current logged-in user. More...
 
static Task< UserGet (string userId)
 Gets the information about a specified user. More...
 
static Task< UserListGetFriends ()
 Gets the friend list of the current user. More...
 
static Task< LaunchFriendResultLaunchFriendRequestFlow (string userId)
 Launches the flow to apply for friendship with someone. More...
 
static Task< UserRoomListGetFriendsAndRooms ()
 Gets the friends of the logged-in user and the rooms the friends might be in. More...
 
static Task< UserRoomListGetNextUserAndRoomListPage (UserRoomList list)
 Gets the next page of user and room list. More...
 
static Task< UserListGetNextUserListPage (UserList list)
 Gets the next page of user list. More...
 
static Task< PermissionResultGetAuthorizedPermissions ()
 Gets authorized permissions. More...
 
static Task< PermissionResultRequestUserPermissions (string[] permissionList)
 Requests user permissions. The user will received a pop-up notification window. More...
 

Member Function Documentation

◆ GetAccessToken()

static Task< string > GetAccessToken ( )
static

Returns an access token for this user.

Note
User's permission is required if the user uses this app firstly.
Returns
The access token for the current user.

◆ GetLoggedInUser()

static Task< User > GetLoggedInUser ( )
static

Gets the information about the current logged-in user.

Returns
The User structure that contains the details about the user.

◆ Get()

static Task< User > Get ( string  userId)
static

Gets the information about a specified user.

Note
The same user has different user IDs for different apps.
Parameters
userIdThe ID of the user.
Returns
The User structure that contains the details about the specified user.

◆ GetFriends()

static Task< UserList > GetFriends ( )
static

Gets the friend list of the current user.

Note
Friends who don't use this app won't appear in this list.
Returns
The friend list of the current user.

◆ LaunchFriendRequestFlow()

static Task< LaunchFriendResult > LaunchFriendRequestFlow ( string  userId)
static

Launches the flow to apply for friendship with someone.

Parameters
userIdThe ID of the user that the friend request is sent to.
Returns
LaunchFriendRequest that indicates whether the request is sent successfully.

◆ GetFriendsAndRooms()

static Task< UserRoomList > GetFriendsAndRooms ( )
static

Gets the friends of the logged-in user and the rooms the friends might be in.

Returns
UserRoomList that contains the friend and room data. If a friend is not in any room, the room field will be null.

◆ GetNextUserAndRoomListPage()

static Task< UserRoomList > GetNextUserAndRoomListPage ( UserRoomList  list)
static

Gets the next page of user and room list.

Parameters
listThe user and room list from the current page.
Returns
The user and room list from the next page.

◆ GetNextUserListPage()

static Task< UserList > GetNextUserListPage ( UserList  list)
static

Gets the next page of user list.

Parameters
listThe user list from the current page.
Returns
The user list from the next page.

◆ GetAuthorizedPermissions()

static Task< PermissionResult > GetAuthorizedPermissions ( )
static

Gets authorized permissions.

Returns
A struct containing the access token and permission list. The UserID field is empty so do NOT use it.

◆ RequestUserPermissions()

static Task< PermissionResult > RequestUserPermissions ( string[]  permissionList)
static

Requests user permissions. The user will received a pop-up notification window.

Parameters
permissionListThe list of permissions to request, including:
  • user_info: the permission to get the user's basic information, such as the nickname and profile picture.
  • friend_relation: the permission to get the user's friend list and invitable users.
  • sports_userinfo: the permission to get the user's information set in the sport center.
  • sports_summarydata: the permission to get a summary of the user's exercise data.
Returns
A struct containing the access token and permission list.