81 void ConnectGuestUser(
const FUser& User, TFunction<
void(
const FOwnUser&)> Callback = {});
86 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client")
87 void DisconnectUser();
92 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client")
93 void UpsertUsers(const TArray<
FUser>& Users);
96 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client")
99 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client")
100 void CancelNewChat();
114 TOptional<
FFilter> Filter = {},
115 const TArray<FChannelSortOption>& SortOptions = {},
118 TFunction<void(
const TArray<UChatChannel*>&)> Callback = {});
154 void QueryAdditionalChannels(int32 Limit = 10, TFunction<
void()> Callback = {});
167 const TArray<FUserSortOption>& Sort = {},
168 bool bPresence =
true,
169 const TOptional<FPaginationOptions> PaginationOptions = {},
170 TFunction<void(
const TArray<FUserRef>&)> Callback = {})
const;
185 const FFilter& ChannelFilter = {},
186 const TOptional<FString>&
Query = {},
187 const TOptional<FFilter>& MessageFilter = {},
188 const TArray<FMessageSortOption>& Sort = {},
189 TOptional<uint32> MessageLimit = {},
190 TFunction<void(
const TArray<FMessage>&)> Callback = {})
const;
195 UFUNCTION(BlueprintCallable, BlueprintPure =
false, Category =
"Stream Chat|Client")
196 void MarkAllRead() const;
198 UFUNCTION(BlueprintPure, Category = "Stream Chat|Client")
201 UFUNCTION(BlueprintPure, Category = "Stream Chat|Client")
202 static FString DevToken(const FString&
UserId);
209 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client")
210 void AddDevice(const FString& DeviceId, EPushProvider PushProvider) const;
216 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client")
217 void RemoveDevice(const FString& DeviceId) const;
223 void ListDevices(TFunction<
void(TArray<
FDevice>)> Callback) const;
225 UPROPERTY(EditAnywhere, Config, Category = "Stream Chat", meta = (DisplayName = "API Key"))
228 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FChannelsUpdatedDelegate, const TArray<
UChatChannel*>&, Channels);
231 UPROPERTY(BlueprintAssignable, Category = "Stream Chat|Channel")
232 FChannelsUpdatedDelegate ChannelsUpdated;
236 virtual
void BeginPlay() override;
238 void ConnectUserInternal(const
FUser& User, TFunction<
void(const
FOwnUser&)> Callback);
246 void AddChannels(const TArray<
UChatChannel*>& InChannels);
248 TSharedPtr<FTokenManager> TokenManager;
254#pragma region Blueprint
266 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client", meta = (Latent, WorldContext = WorldContextObject, LatentInfo = LatentInfo))
267 void ConnectUser(
const FUser& User,
const FString& Token,
const UObject* WorldContextObject, FLatentActionInfo LatentInfo,
FOwnUser& OutUser);
273 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client", meta = (Latent, WorldContext = WorldContextObject, LatentInfo = LatentInfo))
274 void ConnectAnonymousUser(
const UObject* WorldContextObject, FLatentActionInfo LatentInfo,
FOwnUser& OutUser);
281 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client", meta = (Latent, WorldContext = WorldContextObject, LatentInfo = LatentInfo))
282 void ConnectGuestUser(
const FUser& User,
const UObject* WorldContextObject, FLatentActionInfo LatentInfo,
FOwnUser& OutUser);
294 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client", meta = (Latent, WorldContext = WorldContextObject, LatentInfo = LatentInfo))
298 const UObject* WorldContextObject,
299 FLatentActionInfo LatentInfo,
301 UPARAM(meta = (Bitmask, BitmaskEnum =
EChannelFlags)) const int32 Flags = 3);
310 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client", meta = (Latent, WorldContext = WorldContextObject, LatentInfo = LatentInfo, AdvancedDisplay =
Id))
311 void WatchChannel(const
FChannelProperties& ChannelProperties, const UObject* WorldContextObject, FLatentActionInfo LatentInfo,
UChatChannel*& OutChannel);
314#pragma endregion Blueprint
322 template <
class TEvent>
323 using TEventMulticastDelegate = TMulticastDelegate<void(
const TEvent& Event)>;
324 template <
class TEvent>
325 using TEventDelegate =
typename TEventMulticastDelegate<TEvent>::FDelegate;
326 template <
class TEvent,
class UserClass>
327 using TEventDelegateUObjectMethodPtr =
typename TEventDelegate<TEvent>::template TMethodPtr<UserClass>;
328 template <
class TEvent,
class UserClass>
329 using TEventDelegateSpMethodPtr =
typename TEventDelegate<TEvent>::template TMethodPtr<UserClass>;
332 template <
class TEvent>
333 FDelegateHandle On(TEventDelegate<TEvent> Callback);
342 template <
class TEvent,
class UserClass>
343 typename TEnableIf<TIsDerivedFrom<UserClass, UObject>::IsDerived, FDelegateHandle>
::Type On(
345 TEventDelegateUObjectMethodPtr<TEvent, UserClass> Method);
354 template <
class TEvent,
class UserClass>
355 typename TEnableIf<!TIsDerivedFrom<UserClass, UObject>::IsDerived, FDelegateHandle>
::Type On(
357 TEventDelegateSpMethodPtr<TEvent, UserClass> Method);
367 template <
class TEvent,
typename FunctorType,
typename... VarTypes>
368 typename TEnableIf<TIsInvocable<FunctorType,
const TEvent&, VarTypes...>::Value, FDelegateHandle>
::Type On(FunctorType&& Functor, VarTypes... Vars);
370 template <
class TEvent>
371 bool Unsubscribe(FDelegateHandle)
const;
374 TSharedPtr<IChatSocket> Socket;
377#pragma endregion Events
379#pragma region Moderation
394 UFUNCTION(BlueprintCallable, BlueprintPure =
false, Category =
"Stream Chat|Client|Moderation", DisplayName =
"Ban User")
395 void BanUserBP(const
FUserRef& User, FTimespan Timeout, const FString& Reason,
bool bIpBan) const;
396 void BanUser(const
FUserRef& User, const TOptional<FTimespan>& Timeout = {},
const TOptional<FString>& Reason = {},
bool bIpBan =
false)
const;
402 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client|Moderation")
403 void UnbanUser(const
FUserRef& User) const;
412 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "Stream Chat|Client|Moderation", DisplayName = "Shadow Ban User")
413 void ShadowBanUserBP(const
FUserRef& User, FTimespan Timeout) const;
414 void ShadowBanUser(const
FUserRef& User, const TOptional<FTimespan>& Timeout = {})
const;
420 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client|Moderation")
421 void ShadowUnbanUser(const
FUserRef& User) const;
432 void QueryBannedUsers(
435 const TOptional<FBanPaginationOptions> PaginationOptions = {},
436 const TFunction<void(
const TArray<FBan>&)> Callback = {});
443 UFUNCTION(BlueprintCallable, BlueprintPure =
false, Category =
"Stream Chat|Client")
444 void FlagMessage(const
FMessage& Message) const;
451 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "Stream Chat|Client")
452 void FlagUser(const
FUserRef& User) const;
460 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "Stream Chat|Client", DisplayName = "Mute User")
461 void MuteUserBP(const
FUserRef& User, FTimespan Timeout) const;
462 void MuteUser(const
FUserRef& User, const TOptional<FTimespan>& Timeout = {})
const;
469 UFUNCTION(BlueprintCallable, Category =
"Stream Chat|Client")
470 void UnmuteUser(const
FUserRef& User) const;
480 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client|Moderation")
481 void BlockUser(const
FUserRef& User) const;
488 UFUNCTION(BlueprintCallable, Category = "Stream Chat|Client|Moderation")
489 void UnblockUser(const
FUserRef& User) const;
496 void GetBlockedUsers(TFunction<
void(const TArray<FString>&)> Callback) const;
499#pragma endregion Moderation