123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- using System;
- using Pico.Platform.Models;
- using UnityEngine;
- namespace Pico.Platform
- {
-
- public static class UserService
- {
-
-
-
-
-
-
- public static Task<string> GetAccessToken()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<string>(CLIB.ppf_User_GetAccessToken());
- }
-
-
-
-
-
-
-
-
- public static Task<OrgScopedID> GetOrgScopedID(string userID)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<OrgScopedID>(CLIB.ppf_User_GetOrgScopedID(userID));
- }
-
-
-
-
- public static Task<User> GetLoggedInUser()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<User>(CLIB.ppf_User_GetLoggedInUser());
- }
-
-
-
-
-
-
- public static Task<User> Get(string userId)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<User>(CLIB.ppf_User_Get(userId));
- }
-
-
-
-
-
- public static Task<UserList> GetFriends()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<UserList>(CLIB.ppf_User_GetLoggedInUserFriends());
- }
-
-
-
-
-
-
-
- public static Task<UserRelationResult> GetUserRelations(string[] userIds)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<UserRelationResult>(CLIB.ppf_User_GetRelations(userIds));
- }
-
-
-
-
-
- public static Task<LaunchFriendResult> LaunchFriendRequestFlow(string userId)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<LaunchFriendResult>(CLIB.ppf_User_LaunchFriendRequestFlow(userId));
- }
-
-
-
-
- public static Task<UserRoomList> GetFriendsAndRooms()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<UserRoomList>(CLIB.ppf_User_GetLoggedInUserFriendsAndRooms());
- }
-
-
-
-
-
- public static Task<UserRoomList> GetNextUserAndRoomListPage(UserRoomList list)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- if (!list.HasNextPage)
- {
- Debug.LogWarning("GetNextUserAndRoomListPage: List has no next page");
- return null;
- }
- if (String.IsNullOrEmpty(list.NextPageParam))
- {
- Debug.LogWarning("GetNextUserAndRoomListPage: list.NextPageParam is empty");
- return null;
- }
- return new Task<UserRoomList>(CLIB.ppf_User_GetNextUserAndRoomArrayPage(list.NextPageParam));
- }
-
-
-
-
-
- public static Task<UserList> GetNextUserListPage(UserList list)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- if (!list.HasNextPage)
- {
- Debug.LogWarning("GetNextUserListPage: List has no next page");
- return null;
- }
- if (String.IsNullOrEmpty(list.NextPageParam))
- {
- Debug.LogWarning("GetNextUserListPage: list.NextPageParam is empty");
- return null;
- }
- return new Task<UserList>(CLIB.ppf_User_GetNextUserArrayPage(list.NextPageParam));
- }
-
-
-
-
-
-
- public static Task<PermissionResult> GetAuthorizedPermissions()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<PermissionResult>(CLIB.ppf_User_GetAuthorizedPermissions());
- }
-
-
-
-
-
-
- public static Task<PermissionResult> RequestUserPermissions(params string[] permissionList)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<PermissionResult>(CLIB.ppf_User_RequestUserPermissions(permissionList));
- }
-
-
-
-
-
-
-
-
-
-
- public static Task<EntitlementCheckResult> EntitlementCheck(bool killApp = true)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<EntitlementCheckResult>(CLIB.ppf_User_EntitlementCheck(killApp));
- }
-
-
-
-
-
-
-
-
-
- public static Task<string> GetIdToken()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<string>(CLIB.ppf_User_GetIdToken());
- }
- }
- }
|