Longi94 / JavaSteam

Java library that provides an interface to directly interact with Valve's Steam servers.
MIT License
96 stars 20 forks source link

Unified Messaging v2 #282

Closed LossyDragon closed 1 month ago

LossyDragon commented 2 months ago

Description

This is a rework of the Unified Messaging Service. While this class exercises kotlin features, the goal is to still maintain strong Java Compatibility without the need to import the kotlin-stdlib dependency.

For example for either Java and Kotlin, to use the UnifiedService, you would so something like:

// All available RPC methods wil be located in: in.dragonbra.javasteam.rpc.interfaces
 var playService = steamUnifiedMessages.createService(IPlayer.class);
 playService.sendMessage(api ->
          api.GetFavoriteBadge(favoriteBadgeRequest.build())
  ).runBlocking(); // Returns a ServiceMethodResponse

// or playService.sendNotification(); for RPC method's that do not return anything. Those actually return `NoResponse` from protobufs. 

Sample 13 (SampleUnifiedMessages) touches over the use of this.

There are even compat methods that hopefully shouldn't be used. But there just incase Java complains about Function1 not being able to be accessed. Those are sendNotificationCompat() and sendMessageCompat() respectively.

This also begins development on 1.6.0

Checklist

LossyDragon commented 1 month ago

Closing this.

SteamKit recently has an open PR made after I started this fork to rework unified. They're going at it a different way which all this would be scrapped anyways.