Stream Chat Unreal SDK
Loading...
Searching...
No Matches
User.h
1// Copyright 2022 Stream.IO, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Kismet/BlueprintFunctionLibrary.h"
7#include "Moderation/MutedChannel.h"
8
9#include "User.generated.h"
10
11struct FUserDto;
12struct FUserObjectDto;
14
18USTRUCT(BlueprintType)
19struct STREAMCHAT_API FUser
20{
21 GENERATED_BODY()
22
23
25
27 explicit FUser(const FString& InId);
28
30 explicit FUser(const FUserDto&);
32 explicit FUser(const FUserObjectDto&);
34 explicit operator FUserDto() const;
36 explicit operator FUserObjectDto() const;
38 explicit operator FUserObjectRequestDto() const;
39
40 void Update(const FUser& User);
41
42 // Get name, falling back to id
43 const FString& GetNameOrId() const;
45 FString GetInitials(int32 Limit = 2) const;
47 const FDateTime& GetLastActive() const;
49 FText GetLastSeenText() const;
50
52 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stream Chat|User")
53 FString Id;
54
56 UPROPERTY(BlueprintReadOnly, Category = "Stream Chat|User")
57 bool bOnline = false;
58
60 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|User", AdvancedDisplay)
61 bool bInvisible = false;
62
64 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stream Chat|User", AdvancedDisplay)
65 FDateTime CreatedAt = FDateTime{0};
66
68 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stream Chat|User", AdvancedDisplay)
69 FDateTime UpdatedAt = FDateTime{0};
70
72 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stream Chat|User", AdvancedDisplay)
73 FDateTime DeactivatedAt = FDateTime{0};
74
76 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stream Chat|User", AdvancedDisplay)
77 FDateTime DeletedAt = FDateTime{0};
78
80 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stream Chat|User", AdvancedDisplay)
81 FDateTime LastActive = FDateTime{0};
82
84 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|User", AdvancedDisplay)
85 FDateTime BanExpires = FDateTime{0};
86
88 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|User", AdvancedDisplay)
89 bool bBanned = false;
90
92 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|User", AdvancedDisplay)
93 FString Language;
94
96 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|User", AdvancedDisplay)
97 FDateTime RevokeTokensIssuedBefore = FDateTime{0};
98
100 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|User", AdvancedDisplay)
101 FString Role;
102
104 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|User", AdvancedDisplay)
105 TArray<FString> Teams;
106
108 // Not in the API spec, but common
109 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Stream Chat|User")
110 FString Name;
111
113 // Not in the API spec, but common
114 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Stream Chat|User")
115 FString Image;
116};
117
122UCLASS()
123class STREAMCHAT_API UUserBlueprintLibrary final : public UBlueprintFunctionLibrary
124{
125 GENERATED_BODY()
126
127public:
133 UFUNCTION(BlueprintCallable, Category = "Stream Chat|User")
134 static bool GenerateUserId(const FString& Name, FString& OutUserId);
135
141 UFUNCTION(BlueprintCallable, Category = "Stream Chat|User")
142 static bool SanitizeName(const FString& Name, FString& SanitizedName);
143};
Blueprint functions for the User struct.
Definition: User.h:124
@ LastActive
When the user was last active.
@ Id
Message ID.
Common fields for users.
Definition: UserDto.h:16
FString Language
Preferred language of a user.
Definition: UserDto.h:60
FString Role
Determines the set of user permissions.
Definition: UserDto.h:68
TArray< FString > Teams
List of teams user is a part of.
Definition: UserDto.h:72
bool bInvisible
Whether a user should appear online or not.
Definition: UserDto.h:56
bool bBanned
Whether a user is banned or not.
Definition: UserDto.h:52
FDateTime RevokeTokensIssuedBefore
Revocation date for tokens.
Definition: UserDto.h:64
FDateTime BanExpires
Expiration date of the ban.
Definition: UserDto.h:48
A Stream Chat user.
Definition: User.h:20
#/components/schemas/UserObject Used in both requests and responses
Definition: UserObjectDto.h:17
#/components/schemas/UserObjectRequest
Definition: UserObjectRequestDto.h:16