- refactor of the Http client

Changes:

Http-client settings in configure method

```
    TikTokLive.newClient("X")
                .configure(liveClientSettings ->
                {
                   var httpSetting = liveClientSettings.getHttpSettings();
                    httpSetting.setTimeout(Duration.ofSeconds(12));
                });
```

`TikTokLive.requests()` Easy and quick way of making
http request to tiktok
```
    var giftsResponse =TikTokLive.request.fetchGiftsData();
 ```

 Removed:
     TikTokLive.isLiveOnline(String hostName);
     TikTokLive.isHostNameValidAsync(String hostName);

     instead you can use
     ```
     TikTokLive.requests().fetchLiveUserData("Mike").getUserStatus()
     ```
This commit is contained in:
JW
2024-01-05 17:04:32 +01:00
committed by Jacek W
parent 6a42da9ecb
commit f7a92d5015
78 changed files with 8740 additions and 2081 deletions

View File

@@ -42,6 +42,11 @@ public class CustomEventExample {
public static void main(String[] args) {
TikTokLive.newClient(SimpleExample.TIKTOK_HOSTNAME)
.configure(clientSettings ->
{
clientSettings.setPrintToConsole(true);
})
.onGift((liveClient, event) ->
{
if (event.getGift().getDiamondCost() > 100)
@@ -49,14 +54,14 @@ public class CustomEventExample {
else
liveClient.publishEvent(new CheapGiftEvent(event.getGift()));
})
.onEvent(CheapGiftEvent.class,(liveClient, event) ->
.onEvent(CheapGiftEvent.class, (liveClient, event) ->
{
System.out.println("Thanks for cheap gift");
})
.onEvent(ExpensiveGiftEvent.class,(liveClient, event) ->
.onEvent(ExpensiveGiftEvent.class, (liveClient, event) ->
{
System.out.println("Thanks for expensive gift!");
})
.build();
.buildAndConnect();
}
}