PICO Unreal Platform SDK
Pico_User.h
1// Copyright 2022 Pico Technology Co., Ltd.All rights reserved.
2// This plugin incorporates portions of the Unreal® Engine. Unreal® is a trademark or registered trademark of Epic Games, Inc.In the United States of America and elsewhere.
3// Unreal® Engine, Copyright 1998 – 2022, Epic Games, Inc.All rights reserved.
4#pragma once
5
6#include "CoreMinimal.h"
7#include "UObject/NoExportTypes.h"
8#include "PPF_Platform.h"
9#include "OnlineSubsystemPicoNames.h"
10#include "OnlineSubsystemPico.h"
11#include "Pico_Room.h"
12#include "Pico_User.generated.h"
13
15
16DECLARE_LOG_CATEGORY_EXTERN(PicoUser, Log, All);
17
18class UPico_Room;
19
23DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetLoggedInUserFriendsAndRooms, bool, bIsError, const FString&, ErrorMessage, UPico_UserAndRoomArray*, UserAndRoomArray);
24DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetNextUserAndRoomArrayPage, bool, bIsError, const FString&, ErrorMessage, UPico_UserAndRoomArray*, UserAndRoomArray);
25DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetLoggedInUserFriends, bool, bIsError, const FString&, ErrorMessage, UPico_UserArray*, UserArray);
26DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetNextUserPage, bool, bIsError, const FString&, ErrorMessage, UPico_UserArray*, UserArray);
27DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetLoginUser, bool, bIsError, const FString&, ErrorMessage, UPico_User*, User);
28DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetUserInfo, bool, bIsError, const FString&, ErrorMessage, UPico_User*, User);
29DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetPermissionResult, bool, bIsError, const FString&, ErrorMessage, UPico_PermissionResult*, PermissionResult);
30DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetAccessTokenResult, bool, bIsError, const FString&, ErrorMessage, const FString&, AccessToken);
31DECLARE_DYNAMIC_DELEGATE_FourParams(FLaunchFriendRequestResult, bool, bIsError, const FString&, ErrorMessage, bool, bDidCancel, bool, bDidSendRequest);
32
44class ONLINESUBSYSTEMPICO_API FPicoUserInterface
45{
46private:
47
48 FOnlineSubsystemPico& PicoSubsystem;
49
50public:
51 FPicoUserInterface(FOnlineSubsystemPico& InSubsystem);
53
54 FGetLoginUser GetLoginUserDelegate;
55 FGetLoggedInUserFriendsAndRooms GetLoggedInUserFriendsAndRoomsDelegate;
56 FGetNextUserAndRoomArrayPage GetNextUserAndRoomArrayPageDelegate;
57 FGetLoggedInUserFriends GetLoggedInUserFriendsDelegate;
58 FGetNextUserPage GetNextUserFriendsPageDelegate;
59 FGetUserInfo GetUserInfoDelegate;
60 FGetPermissionResult GetAuthorizePermissionsDelegate;
61 FGetPermissionResult RequestUserPermissionsDelegate;
62 FLaunchFriendRequestResult LaunchFriendRequestDelegate;
63 FGetAccessTokenResult GetAccesstokenDelegate;
64
73 bool GetLoginUser(FGetLoginUser InGetLoginUserDelegate);
74
84 bool GetUserInfo(const FString& UserId, FGetUserInfo InGetUserInfoDelegate);
85
94 bool GetLoggedInUserAndRoom(FGetLoggedInUserFriendsAndRooms OnGetLoggedInuserFriendsAndRoomsCallback);
95
106 bool GetNextUserAndRoomArrayPage(UPico_UserAndRoomArray* InUserAndRoomArray, FGetNextUserAndRoomArrayPage OnGetNextUserAndRoomArrayPageCallback);
107
116 bool GetUserFriends(FGetLoggedInUserFriends OnGetLoggedInUserFriendsCallback);
117
127 bool GetNextUserPage(UPico_UserArray* InUserArray, FGetNextUserPage OnGetNextUserPageCallback);
128
139 bool GetAuthorizePermissions(FGetPermissionResult OnGetPermissionResultCallback);
140
157 bool RequestUserPermissions(TArray<FString> Permissions, FGetPermissionResult OnGetPermissionResultCallback);
158
170 bool LaunchFriendRequestFlow(const FString UserId, FLaunchFriendRequestResult OnLaunchFriendRequestResultCallback);
171
172 bool GetAccessToken(FGetAccessTokenResult OnGetAccessTokenResultCallback);
173};
189UCLASS()
190class ONLINESUBSYSTEMPICO_API UOnlinePicoUserFunction : public UBlueprintFunctionLibrary
191{
192 GENERATED_BODY()
193
194
195public:
196
206 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
207 static void PicoGetLoggedInUserAndRoom(UObject* WorldContextObject, FGetLoggedInUserFriendsAndRooms InGetLoggedInuserFriendsAndRoomsCallback);
208
219 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
220 static void PicoGetNextUserAndRoomArrayPage(UObject* WorldContextObject, UPico_UserAndRoomArray* InUserAndRoomArray, FGetNextUserAndRoomArrayPage InGetNextUserAndRoomArrayPageCallback);
221
222
232 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
233 static void PicoGetUserFriends(UObject* WorldContextObject, FGetLoggedInUserFriends InGetLoggedInUserFriendsDelegate);
234
245 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
246 static void PicoGetNextUserPage(UObject* WorldContextObject, UPico_UserArray* InUserArray, FGetNextUserPage InGetNextUserPageDelegate);
247
257 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
258 static bool GetLoginUser(UObject* WorldContextObject, FGetLoginUser InGetLoginUserDelegate);
259
270 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
271 static bool GetPicoUserInfo(UObject* WorldContextObject, const FString& UserId, FGetUserInfo InGetUserInfoDelegate);
272
284 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
285 static bool GetAuthorizePermissions(UObject* WorldContextObject, FGetPermissionResult OnGetPermissionResultCallback);
286
287
305 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
306 static bool RequestUserPermissions(UObject* WorldContextObject, TArray<FString> Permissions, FGetPermissionResult OnGetPermissionResultCallback);
307
320 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
321 static bool LaunchFriendRequestFlow(UObject* WorldContextObject, const FString UserId, FLaunchFriendRequestResult OnLaunchFriendRequestResultCallback);
322
323 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|User")
324 static bool GetAccessToken(UObject* WorldContextObject, FGetAccessTokenResult OnGetAccessTokenResultCallback);
325};
326 // end of BP_User // end of BlueprintFunction
329
330UCLASS(BlueprintType)
331class ONLINESUBSYSTEMPICO_API UPico_User : public UObject
332{
333 GENERATED_BODY()
334public:
335 void InitParams(ppfUser* ppfUserHandle);
336
337private:
338 FString DisplayName = FString();
339 FString ImageUrl = FString();
340 FString ID = FString();
341 FString InviteToken = FString();
342 FString SmallImageUrl = FString();
343 FString PresencePackage = FString();
345 EUserGender UserGender = EUserGender::Unknow;
346 FString Presence = FString();
347 FString PresenceDeeplinkMessage = FString();
348 FString PresenceDestinationApiName = FString();
349 FString PresenceLobbySessionId = FString();
350 FString PresenceMatchSessionId = FString();
351 FString PresenceExtra = FString();
352 FString StoreRegion = FString();
353
354public:
355
356 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
357 FString GetDisplayName();
358
359 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
360 FString GetImageURL();
361
362 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
363 FString GetID();
364
365 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
366 FString GetInviteToken();
367
368 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
369 FString GetSmallImageUrl();
370
371 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
372 FString GetPresencePackage();
373
374 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
375 EUserPresenceStatus GetUserPresenceStatus();
376
377 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
378 EUserGender GetGender();
379
380 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
381 FString GetPresence();
382
383 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
384 FString GetPresenceDeeplinkMessage();
385
386 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
387 FString GetPresenceDestinationApiName();
388
389 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
390 FString GetPresenceLobbySessionId();
391
392 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
393 FString GetPresenceMatchSessionId();
394
395 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
396 FString GetPresenceExtra();
397
398 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User")
399 FString GetStoreRegion();
400};
401
402UCLASS(BlueprintType)
403class ONLINESUBSYSTEMPICO_API UPico_UserArray : public UObject
404{
405
406 GENERATED_BODY()
407
408public:
409 void InitParams(ppfUserArray* InppfUserArrayHandle);
410
411private:
412 UPROPERTY()
413 TArray<UPico_User*> UserArray;
414 FString NextPageParam;
415 int32 Size;
416 bool bHasNextPage;
417
418public:
419
420
421 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User Array")
422 UPico_User* GetElement(int32 Index);
423
424 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User Array")
425 FString GetNextPageParam();
426
427 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User Array")
428 int32 GetSize();
429
430 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User Array")
431 bool HasNextPage();
432
433};
434
435UCLASS(BlueprintType)
436class ONLINESUBSYSTEMPICO_API UPico_UserAndRoom : public UObject
437{
438
439 GENERATED_BODY()
440private:
441 UPROPERTY()
442 UPico_Room* Room = nullptr;
443
444 UPROPERTY()
445 UPico_User* User = nullptr;
446public:
447 void InitParams(ppfUserAndRoom* InppfUserAndRoomHandle);
448
449 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User And Room")
450 UPico_Room* GetRoom();
451
452 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User And Room")
453 UPico_User* GetUser();
454};
455
456UCLASS(BlueprintType)
457class ONLINESUBSYSTEMPICO_API UPico_UserAndRoomArray : public UObject
458{
459
460 GENERATED_BODY()
461
462private:
463 UPROPERTY()
464 TArray<UPico_UserAndRoom*> UserAndRoomArray;
465 FString NextPageParam = FString();
466 int32 Size = 0;
467 bool bHasNextPage;
468public:
469 void InitParams(ppfUserAndRoomArray* InppfUserAndRoomArrayHandle);
470
471 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User And Room Array")
472 UPico_UserAndRoom* GetElement(int32 Index);
473
474 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User And Room Array")
475 FString GetNextPageParam();
476
477 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User And Room Array")
478 int32 GetSize();
479
480 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|User And Room Array")
481 bool HasNextPage();
482};
483
484UCLASS(BlueprintType)
485class ONLINESUBSYSTEMPICO_API UPico_PermissionResult : public UObject
486{
487 GENERATED_BODY()
488
489private:
490 UPROPERTY()
491 TArray<FString> AuthorizedPermissions;
492 int32 Size = 0;
493 FString AccessionToken = FString();
494 FString UserID = FString();
495public:
496 void InitParams(ppfPermissionResult* InppfPermissionResultHandle);
497
498 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|Permission")
499 FString GetAuthorizedPermission(int32 Index);
500
501 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|Permission")
502 int32 GetSize();
503
504 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|Permission")
505 FString GetAccessToken();
506
507 UFUNCTION(BlueprintPure, Category = "Pico Platform|User|Permission")
508 FString GetUserID();
509};
510
511//
PicoUserInterface class.
Definition: Pico_User.h:45
bool GetUserFriends(FGetLoggedInUserFriends OnGetLoggedInUserFriendsCallback)
Gets the friend list of the current user. Friends who don't use this app won't appear in this list.
bool GetNextUserPage(UPico_UserArray *InUserArray, FGetNextUserPage OnGetNextUserPageCallback)
Gets the next page of user list.
bool GetLoggedInUserAndRoom(FGetLoggedInUserFriendsAndRooms OnGetLoggedInuserFriendsAndRoomsCallback)
Gets the friends of the logged-in user and the rooms the friends might be in. If a friend is not in a...
bool RequestUserPermissions(TArray< FString > Permissions, FGetPermissionResult OnGetPermissionResultCallback)
Requests user permissions. The user will received a pop-up notification window.
bool GetAuthorizePermissions(FGetPermissionResult OnGetPermissionResultCallback)
Gets the authorized permissions.
bool LaunchFriendRequestFlow(const FString UserId, FLaunchFriendRequestResult OnLaunchFriendRequestResultCallback)
Launches the flow to apply for friendship with someone.
bool GetUserInfo(const FString &UserId, FGetUserInfo InGetUserInfoDelegate)
Gets the information by user ID.
bool GetNextUserAndRoomArrayPage(UPico_UserAndRoomArray *InUserAndRoomArray, FGetNextUserAndRoomArrayPage OnGetNextUserAndRoomArrayPageCallback)
Gets the friend list of the current user.
bool GetLoginUser(FGetLoginUser InGetLoginUserDelegate)
Gets the information about the current logged-in user.
OnlinePicoUser Blueprint Function class.
Definition: Pico_User.h:191
EUserPresenceStatus
User's current online status.
Definition: OnlineSubsystemPicoNames.h:28
EUserGender
User's gender.
Definition: OnlineSubsystemPicoNames.h:37