Stream Chat Unreal SDK
Loading...
Searching...
No Matches
ChannelProperties.h
1// Copyright 2022 Stream.IO, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "ChannelConfig.h"
6#include "CoreMinimal.h"
7#include "Member.h"
8#include "Message.h"
9#include "Request/Channel/ChannelRequestDto.h"
10
11#include "ChannelProperties.generated.h"
12
14
19USTRUCT(BlueprintType, meta = (HasNativeMake))
20struct STREAMCHAT_API FChannelProperties
21{
22 GENERATED_BODY()
23
24
26
28 explicit FChannelProperties(const FChannelResponseDto& Dto, UUserManager*);
29 explicit FChannelProperties(const FChannelResponseDto& Dto, const TArray<FChannelMemberDto>& InMembers, UUserManager*);
30
31 // For initial channel creation
32 explicit FChannelProperties(const FString& Type, const FString& Id = TEXT(""), const FString& Team = TEXT(""), const FAdditionalFields& ExtraData = {});
33
35 explicit operator FChannelRequestDto() const;
36
38 FChannelProperties& SetMembers(const TArray<FString>& UserIds);
39 FChannelProperties& SetMembers(const TArray<FMember>&);
41 FChannelProperties& SetMembers(const TArray<FUserRef>& Users);
42
43 FChannelProperties& SetName(const FString&);
44 FChannelProperties& SetImageUrl(const FString&);
45
47 void Merge(const FChannelResponseDto&, UUserManager*);
49 void Merge(const FChannelResponseDto& Dto, const TArray<FChannelMemberDto>& InMembers, UUserManager*);
51 void AppendMembers(const TArray<FChannelMemberDto>& InMembers, UUserManager*);
52
53 TOptional<FString> GetName() const;
54 TOptional<FString> GetImageUrl() const;
55
56 FMember* GetMember(const FUserRef&);
58 TArray<FUserRef> GetOtherMemberUsers() const;
59
63 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|Channel Properties")
64 FString Type;
65
68 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|Channel Properties")
69 FString Id;
70
72 UPROPERTY(BlueprintReadOnly, Category = "Stream Chat|Channel Properties")
73 FString Cid;
74
76 UPROPERTY(BlueprintReadOnly, Category = "Stream Chat|Channel Properties")
78
80 UPROPERTY()
81 int32 MemberCount = 0;
82
84 UPROPERTY(BlueprintReadOnly, Category = "Stream Chat|Channel Properties")
86
88 UPROPERTY(BlueprintReadOnly, Category = "Stream Chat|Channel Properties")
89 FTimespan Cooldown = FTimespan::Zero();
90
92 UPROPERTY()
93 FDateTime CreatedAt = FDateTime{0};
94
96 UPROPERTY()
97 FDateTime UpdatedAt = FDateTime{0};
98
100 UPROPERTY()
101 FDateTime DeletedAt = FDateTime{0};
102
104 UPROPERTY()
105 FDateTime LastMessageAt = FDateTime{0};
106
108 UPROPERTY()
110
111 UPROPERTY()
112 bool bDisabled = false;
113
115 UPROPERTY()
116 bool bFrozen = false;
117
119 UPROPERTY()
120 bool bHidden = false;
121
123 UPROPERTY()
124 bool bMuted = false;
125
127 UPROPERTY()
128 FDateTime MuteExpiresAt = FDateTime{0};
129
131 UPROPERTY()
132 FDateTime HideMessagesBefore = FDateTime{0};
133
135 UPROPERTY()
136 TArray<FString> OwnCapabilities;
137
139 UPROPERTY()
141
143 UPROPERTY()
145
147 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|Channel Properties", AdvancedDisplay)
148 FString Team;
149
151 UPROPERTY(BlueprintReadWrite, Category = "Stream Chat|Channel Properties", AdvancedDisplay)
152 FAdditionalFields ExtraData;
153};
154
159UCLASS()
160class STREAMCHAT_API UChannelPropertiesBlueprintLibrary final : public UBlueprintFunctionLibrary
161{
162 GENERATED_BODY()
163
164public:
166 UFUNCTION(BlueprintPure, Category = "Stream Chat|Channel Properties", meta = (NativeMakeFunc, DisplayName = "Make Channel Properties (ID)", AdvancedDisplay = "Team,ExtraData", AutoCreateRefTerm = ExtraData))
167 static FChannelProperties MakeChannelPropertiesId(const FString& Type, const FString& Id, const FString& Team, const FAdditionalFields& ExtraData);
169 UFUNCTION(BlueprintPure, Category = "Stream Chat|Channel Properties", meta = (NativeMakeFunc, DisplayName = "Make Channel Properties (User IDs)", AdvancedDisplay = "Team,ExtraData", AutoCreateRefTerm = ExtraData))
170 static FChannelProperties MakeChannelPropertiesUserIds(
171 const FString& Type,
172 const TArray<FString>& UserIds,
173 const FString& Team,
174 const FAdditionalFields& ExtraData);
176 UFUNCTION(BlueprintPure, Category = "Stream Chat|Channel Properties", meta = (NativeMakeFunc, DisplayName = "Make Channel Properties (Users)", AdvancedDisplay = "Team,ExtraData", AutoCreateRefTerm = ExtraData))
177 static FChannelProperties MakeChannelPropertiesUsers(
178 const FString& Type,
179 const TArray<FUserRef>& Users,
180 const FString& Team,
181 const FAdditionalFields& ExtraData);
182};
Blueprint functions for the Channel Properties struct.
Definition: ChannelProperties.h:161
@ Id
Message ID.
@ Type
Type of the message.
The configuration, permissions and features of a channel, as defined by the "channel type".
Definition: ChannelConfig.h:19
#/components/schemas/ChannelMember
Definition: ChannelMemberDto.h:16
Encapsulates the static properties of a channel.
Definition: ChannelProperties.h:21
#/components/schemas/ChannelRequest
Definition: ChannelRequestDto.h:16
#/components/schemas/ChannelResponse Represents channel in chat
Definition: ChannelResponseDto.h:20
bool bAutoTranslationEnabled
Whether auto translation is enabled or not.
Definition: ChannelResponseDto.h:25
FDateTime CreatedAt
The date of channel creation.
Definition: ChannelResponseDto.h:45
int32 MemberCount
The count of this channel members.
Definition: ChannelResponseDto.h:80
uint32 Cooldown
Cooldown period after sending each message.
Definition: ChannelResponseDto.h:41
FDateTime LastMessageAt
The date of the last message.
Definition: ChannelResponseDto.h:76
FChannelConfigWithInfoDto Config
The channel configuration data.
Definition: ChannelResponseDto.h:37
FDateTime UpdatedAt
The date of the last channel update.
Definition: ChannelResponseDto.h:108
bool bMuted
Whether this channel is muted or not.
Definition: ChannelResponseDto.h:92
bool bHidden
Whether this channel is hidden by current user or not.
Definition: ChannelResponseDto.h:64
FDateTime MuteExpiresAt
Date of mute expiration.
Definition: ChannelResponseDto.h:88
FString AutoTranslationLanguage
Language to translate to when auto translation is active.
Definition: ChannelResponseDto.h:29
bool bFrozen
Whether this channel is frozen or not.
Definition: ChannelResponseDto.h:60
FString Team
The team the channel belongs to (multi-tenant only)
Definition: ChannelResponseDto.h:100
FUserObjectDto CreatedBy
The user that created this channel.
Definition: ChannelResponseDto.h:49
TArray< FString > OwnCapabilities
List of channel capabilities of the authenticated user.
Definition: ChannelResponseDto.h:96
FString Cid
The cid of this channel.
Definition: ChannelResponseDto.h:33
TArray< FChannelMemberDto > Members
List of channel members (max 100)
Definition: ChannelResponseDto.h:84
FDateTime DeletedAt
The date of channel deletion.
Definition: ChannelResponseDto.h:53
FDateTime HideMessagesBefore
Date since when the message history is accessible.
Definition: ChannelResponseDto.h:68
Contains information about a member of a chat channel.
Definition: Member.h:19
A reference to a unique User.
Definition: UserRef.h:23