Removal of deprecated methods and addition of information in TikTokLiveUnknownHostException and TikTokLiveOfflineHostException!

This commit is contained in:
kohlerpop1
2025-02-11 16:34:27 -05:00
parent 3fda7fe446
commit 20db7cb773
12 changed files with 41 additions and 169 deletions

View File

@@ -48,7 +48,6 @@ public class Gift {
this.properties = properties;
}
public Gift(int id, String name, int diamondCost, String pictureLink) {
this(id, name, diamondCost, new Picture(pictureLink), new JsonObject());
}

View File

@@ -22,9 +22,18 @@
*/
package io.github.jwdeveloper.tiktok.exceptions;
import io.github.jwdeveloper.tiktok.data.requests.*;
import lombok.Getter;
@Getter
public class TikTokLiveOfflineHostException extends TikTokLiveException
{
public TikTokLiveOfflineHostException(String message) {
private final LiveUserData.Response userData;
private final LiveData.Response liveData;
public TikTokLiveOfflineHostException(String message, LiveUserData.Response userData, LiveData.Response liveData) {
super(message);
this.userData = userData;
this.liveData = liveData;
}
}
}

View File

@@ -22,9 +22,18 @@
*/
package io.github.jwdeveloper.tiktok.exceptions;
import io.github.jwdeveloper.tiktok.data.requests.*;
import lombok.Getter;
@Getter
public class TikTokLiveUnknownHostException extends TikTokLiveException
{
public TikTokLiveUnknownHostException(String message) {
private final LiveUserData.Response userData;
private final LiveData.Response liveData;
public TikTokLiveUnknownHostException(String message, LiveUserData.Response userData, LiveData.Response liveData) {
super(message);
this.userData = userData;
this.liveData = liveData;
}
}

View File

@@ -29,11 +29,6 @@ import io.github.jwdeveloper.tiktok.data.requests.LiveUserData;
public interface LiveHttpClient
{
/**
* @return {@link GiftsData.Response} list of gifts that are compiled and available on github
*/
GiftsData.Response fetchGiftsData();
/**
* @return {@link GiftsData.Response} list of gifts that are available in your region / livestream
*/

View File

@@ -1,73 +0,0 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.listener;
import io.github.jwdeveloper.tiktok.live.LiveClient;
/**
* ListenersManager
* <p>
* TikTokEventListener is an alternative way of handing TikTok events.
* <p>
* {@code TikTokLive.newClient("someuser").addListener(listener);}
* <p>
* After registertion, all listeners are kept in Listener manager - {@link LiveClient#getListenersManager()}
* <p>
* Method in TikTokEventListener should meet requirements below to be detected
* <p>- @TikTokEventObserver annotation
* <p>- 2 parameters of (LiveClient, Class extending TikTokEvent)
* <pre>
* {@code
* public static class CustomListener
* {
* @TikTokEventObserver
* public void onError(LiveClient liveClient, TikTokErrorEvent event)
* {
* System.out.println(event.getException().getMessage());
* }
*
* @TikTokEventObserver
* public void onCommentMessage(LiveClient liveClient, TikTokCommentEvent event)
* {
* System.out.println(event.getText());
* }
*
* @TikTokEventObserver
* public void onGiftMessage(LiveClient liveClient, TikTokGiftMessageEvent event)
* {
* System.out.println(event.getGift().getDescription());
* }
*
* @TikTokEventObserver
* public void onAnyEvent(LiveClient liveClient, TikTokEvent event)
* {
* System.out.println(event.getClass().getSimpleName());
* }
* }
* }
* </pre>
*/
@Deprecated(forRemoval = true, since = "1.8.1 (This interface is not longer needed, please remove it from your class) | Removing in 1.9.0")
public interface TikTokEventListener {
}

View File

@@ -22,12 +22,8 @@
*/
package io.github.jwdeveloper.tiktok.live;
import com.google.gson.JsonObject;
import io.github.jwdeveloper.tiktok.data.models.Picture;
import io.github.jwdeveloper.tiktok.data.models.gifts.*;
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;

View File

@@ -30,9 +30,8 @@ import io.github.jwdeveloper.tiktok.mappers.LiveMapper;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
public interface LiveClientBuilder extends EventsBuilder<LiveClientBuilder> {
public interface LiveClientBuilder extends EventsBuilder<LiveClientBuilder>
{
/**
* This method is triggered after default mappings are registered
* It could be used to OVERRIDE behaviour of mappings and implement custom behaviour
@@ -40,18 +39,15 @@ public interface LiveClientBuilder extends EventsBuilder<LiveClientBuilder> {
* Be aware if for example you override WebcastGiftEvent, onGiftEvent() will not be working
*
* @param onCustomMappings lambda method
* @return
* @return {@link LiveClientBuilder}
*/
LiveClientBuilder mappings(Consumer<LiveMapper> onCustomMappings);
@Deprecated(forRemoval = true, since = "1.8.2 use `mappings` method instead")
LiveClientBuilder onMappings(Consumer<LiveMapper> onCustomMappings);
/**
* Configuration of client settings
*
* @param onConfigure
* @return
* @param onConfigure Consumer for {@link LiveClientSettings}
* @return {@link LiveClientBuilder}
* @see LiveClientSettings
*/
LiveClientBuilder configure(Consumer<LiveClientSettings> onConfigure);
@@ -59,7 +55,7 @@ public interface LiveClientBuilder extends EventsBuilder<LiveClientBuilder> {
/**
* Adds events listener class, its fancy way to register events without using lamda method
*
* @return
* @return {@link LiveClientBuilder}
*/
LiveClientBuilder addListener(Object listener);
@@ -69,7 +65,7 @@ public interface LiveClientBuilder extends EventsBuilder<LiveClientBuilder> {
* when the default implementation does not meet your needs
*
* @param onCustomizeDependencies access to dependency container
* @return
* @return {@link LiveClientBuilder}
*/
LiveClientBuilder customize(Consumer<DependanceContainerBuilder> onCustomizeDependencies);