diff --git a/.idea/protoeditor.xml b/.idea/protoeditor.xml new file mode 100644 index 0000000..ae0e40b --- /dev/null +++ b/.idea/protoeditor.xml @@ -0,0 +1,71 @@ + + + + + + \ No newline at end of file diff --git a/API/pom.xml b/API/pom.xml index 3302ae6..97f494f 100644 --- a/API/pom.xml +++ b/API/pom.xml @@ -17,6 +17,11 @@ 3.24.1 provided + + com.google.code.gson + gson + 2.10.1 + @@ -53,6 +58,25 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.0 + + + attach-javadocs + package + + jar + + + -html,-syntax,-accessibility,-missing + false + true + + + + \ No newline at end of file diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/ClientSettings.java b/API/src/main/java/io/github/jwdeveloper/tiktok/ClientSettings.java index 647fa80..5c6c2ed 100644 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/ClientSettings.java +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/ClientSettings.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2023-2023 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; import lombok.Data; @@ -13,7 +35,6 @@ public class ClientSettings { */ private Duration timeout; - // public RotatingProxy Proxy; /** * ISO-Language for Client */ @@ -27,18 +48,14 @@ public class ClientSettings { /** - * Wait to connect again for selected amount of time + * Before retrying connect, wait for select amount of time */ private Duration retryConnectionTimeout; /** - * Whether to handle Messages received from Room when Connecting + * Whether to handle Events received from Room when Connecting */ - private boolean handleExistingMessagesOnConnect; - /** - * Whether to download List of Gifts for Room when Connecting - */ - private boolean downloadGiftInfo; + private boolean handleExistingEvents; /** * Whether to print Logs to Console @@ -50,19 +67,15 @@ public class ClientSettings { */ private Level logLevel; - /** - * Whether to print Base64-Data for Messages to Console - */ - private boolean printMessageData; /** - * Optional: Use it if you need to change tiktok live hostname in builder + * Optional: Use it if you need to change TikTok live hostname in builder */ private String hostName; /** - * Parameters used in requests to Tiktok api + * Parameters used in requests to TikTok api */ private Map clientParameters; diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/Constants.java b/API/src/main/java/io/github/jwdeveloper/tiktok/Constants.java index dc1878e..a2236fd 100644 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/Constants.java +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/Constants.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2023-2023 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; import java.time.Duration; @@ -26,27 +48,20 @@ public class Constants { * Default TimeOut for Connections */ public static final int DEFAULT_TIMEOUT = 20; - /** - * Default Polling-Time for Socket-Connection - */ - public static final int DEFAULT_POLLTIME = 1; + /** * Default Settings for Client */ - - public static ClientSettings DefaultClientSettings() { var clientSettings = new ClientSettings(); clientSettings.setTimeout(Duration.ofSeconds(DEFAULT_TIMEOUT)); clientSettings.setClientLanguage("en-US"); - clientSettings.setHandleExistingMessagesOnConnect(true); - clientSettings.setDownloadGiftInfo(true); + clientSettings.setHandleExistingEvents(true); clientSettings.setRetryOnConnectionFailure(false); clientSettings.setRetryConnectionTimeout(Duration.ofSeconds(1)); clientSettings.setPrintToConsole(false); clientSettings.setLogLevel(Level.ALL); - clientSettings.setPrintMessageData(false); clientSettings.setClientParameters(Constants.DefaultClientParams()); return clientSettings; } @@ -55,8 +70,6 @@ public class Constants { /** * Default Parameters for HTTP-Request */ - - public static Map DefaultClientParams() { var clientParams = new TreeMap(); clientParams.put("aid", 1988); @@ -103,6 +116,7 @@ public class Constants { public static Map DefaultRequestHeaders() { var headers = new HashMap(); + headers.put("authority","www.tiktok.com"); headers.put("Connection", "keep-alive"); headers.put("Cache-Control", "max-age=0"); headers.put("Accept", "text/html,application/json,application/protobuf"); diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventMeta.java b/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventMeta.java index 71dc01a..ffe84d8 100644 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventMeta.java +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventMeta.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2023-2023 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.annotations; import java.lang.annotation.Retention; diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventType.java b/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventType.java index 27c79f1..58cdf26 100644 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventType.java +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventType.java @@ -1,10 +1,29 @@ +/* + * Copyright (c) 2023-2023 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.annotations; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - public enum EventType { - Control, Message, Custom + Control, Message, Debug } diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/TikTokEventHandler.java b/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/TikTokEventHandler.java index a7882c1..b404460 100644 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/TikTokEventHandler.java +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/annotations/TikTokEventHandler.java @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2023-2023 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.annotations; import java.lang.annotation.Retention; diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokBarrageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokBarrageEvent.java new file mode 100644 index 0000000..b084be1 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokBarrageEvent.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.data.models.barrage.BarrageParam; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokBarrageEvent extends TikTokHeaderEvent { + private final Picture icon; + private final Picture backGround; + private final Picture rightIcon; + private final String eventName; + private final int duration; + + private BarrageParam barrageParam; + + public TikTokBarrageEvent(WebcastBarrageMessage msg) { + super(msg.getCommon()); + icon = Picture.map(msg.getIcon()); + eventName = msg.getEvent().getEventName(); + backGround = Picture.map(msg.getBackground()); + rightIcon = Picture.map(msg.getRightIcon()); + duration = msg.getDuration(); + barrageParam = BarrageParam.map(msg); + + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokCaptionEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokCaptionEvent.java new file mode 100644 index 0000000..5903f57 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokCaptionEvent.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastCaptionMessage; +import lombok.Value; + +@Value +@EventMeta(eventType = EventType.Message) +public class TikTokCaptionEvent extends TikTokHeaderEvent { + Long captionTimeStamp; + + String iSOLanguage; + + String text; + + public TikTokCaptionEvent(WebcastCaptionMessage msg) { + super(msg.getCommon()); + captionTimeStamp = msg.getTimeStamp(); + iSOLanguage = msg.getCaptionData().getLanguage(); + text = msg.getCaptionData().getText(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokCommentEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokCommentEvent.java new file mode 100644 index 0000000..28e57a7 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokCommentEvent.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastChatMessage; +import lombok.Getter; + +import java.util.List; + +/** + * Triggered every time a new chat comment arrives. + */ +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokCommentEvent extends TikTokHeaderEvent { + private final User user; + private final String text; + private final String getUserLanguage; + private final User mentionedUser; + private final List pictures; + private final boolean visibleToSender; + + public TikTokCommentEvent(WebcastChatMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + text = msg.getContent(); + visibleToSender = msg.getVisibleToSender(); + getUserLanguage = msg.getContentLanguage(); + mentionedUser = User.map(msg.getAtUser(),msg.getUserIdentity()); + pictures = msg.getEmotesListList().stream().map(e -> Picture.map(e.getEmote().getImage())).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokConnectedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokConnectedEvent.java new file mode 100644 index 0000000..cf8e1ed --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokConnectedEvent.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-2023 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.data.events; +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; + +/** + * Triggered when the connection is successfully established. + */ +@EventMeta(eventType = EventType.Control) +public class TikTokConnectedEvent extends TikTokLiveClientEvent +{ + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDetectEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDetectEvent.java new file mode 100644 index 0000000..299cbfd --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDetectEvent.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMsgDetectMessage; +import lombok.Getter; +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokDetectEvent extends TikTokHeaderEvent { + String language; + + + public TikTokDetectEvent(WebcastMsgDetectMessage msg) { + super(msg.getCommon()); + language = msg.getFromRegion(); + } + + + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDisconnectedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDisconnectedEvent.java new file mode 100644 index 0000000..4565b7f --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDisconnectedEvent.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-2023 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.data.events; +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; + + +/** + * Triggered when the connection gets disconnected. In that case you can call connect() again to have a reconnect logic. + * Note that you should wait a little bit before attempting a reconnect to to avoid being rate-limited. + */ +@EventMeta(eventType = EventType.Control) +public class TikTokDisconnectedEvent extends TikTokLiveClientEvent { +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokEmoteEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokEmoteEvent.java new file mode 100644 index 0000000..a9e0e5e --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokEmoteEvent.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.Emote; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEmoteChatMessage; +import lombok.Value; + +import java.util.List; + +/** + * Triggered every time a subscriber sends an emote (sticker). + */ +@Value +@EventMeta(eventType = EventType.Message) +public class TikTokEmoteEvent extends TikTokHeaderEvent { + User user; + List emotes; + + public TikTokEmoteEvent(WebcastEmoteChatMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + emotes = msg.getEmoteListList().stream().map(Emote::map).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokEnvelopeEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokEnvelopeEvent.java new file mode 100644 index 0000000..57118ee --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokEnvelopeEvent.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEnvelopeMessage; +import lombok.Value; + + +/** + * Triggered every time someone sends a treasure chest. + */ +@Value +@EventMeta(eventType = EventType.Message) +public class TikTokEnvelopeEvent extends TikTokHeaderEvent { + User user; + public TikTokEnvelopeEvent(WebcastEnvelopeMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getEnvelopeInfo()); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokErrorEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokErrorEvent.java new file mode 100644 index 0000000..c3cedf7 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokErrorEvent.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * General error event. You should handle this. + */ +@Getter +@AllArgsConstructor +@EventMeta(eventType = EventType.Control) +public class TikTokErrorEvent extends TikTokLiveClientEvent +{ + private final Throwable exception; +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokGoalUpdateEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokGoalUpdateEvent.java new file mode 100644 index 0000000..e476248 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokGoalUpdateEvent.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.data.models.users.User; + +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGoalUpdateMessage; +import lombok.Getter; + +import java.util.List; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokGoalUpdateEvent extends TikTokHeaderEvent { + private final Long goalId; + private final Picture picture; + private final String description; + private final List users; + + public TikTokGoalUpdateEvent(WebcastGoalUpdateMessage msg) { + super(msg.getCommon()); + picture = Picture.map(msg.getContributorAvatar()); + goalId = msg.getGoal().getId(); + description = msg.getGoal().getDescription(); + users = msg.getGoal() + .getContributorsListList() + .stream() + .map(u -> new User(u.getUserId(), u.getDisplayId(), Picture.map(u.getAvatar()))) + .toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokIMDeleteEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokIMDeleteEvent.java new file mode 100644 index 0000000..8d8bd50 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokIMDeleteEvent.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastImDeleteMessage; +import lombok.Getter; + +import java.util.List; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokIMDeleteEvent extends TikTokHeaderEvent { + + List userIds; + public TikTokIMDeleteEvent(WebcastImDeleteMessage msg) { + super(msg.getCommon()); + this.userIds = msg.getDeleteUserIdsListList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokInRoomBannerEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokInRoomBannerEvent.java new file mode 100644 index 0000000..02a90c3 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokInRoomBannerEvent.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastInRoomBannerMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokInRoomBannerEvent extends TikTokHeaderEvent { + private final String json; + + public TikTokInRoomBannerEvent(WebcastInRoomBannerMessage msg) { + super(msg.getHeader()); + json = msg.getJson(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkEvent.java new file mode 100644 index 0000000..dd991af --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkEvent.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; +import lombok.Getter; + +import java.util.List; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokLinkEvent extends TikTokHeaderEvent { + private final String token; + + private User user; + + private final List otherUsers; + + public TikTokLinkEvent(WebcastLinkMessage msg) { + super(msg.getCommon()); + token = msg.getToken(); + if (msg.getUser().getUser().hasUser()) { + user = new User(msg.getUser().getUser().getUser()); + } + otherUsers = msg.getUser().getOtherUsersList().stream().map(e -> new User(e.getUser())).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkLayerEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkLayerEvent.java new file mode 100644 index 0000000..ea350ba --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkLayerEvent.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; + +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkLayerMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokLinkLayerEvent extends TikTokHeaderEvent { + + + public TikTokLinkLayerEvent(WebcastLinkLayerMessage msg) { + super(msg.getCommon()); + + } + + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicArmiesEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicArmiesEvent.java new file mode 100644 index 0000000..3345737 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicArmiesEvent.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.LinkMicArmy; +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicArmies; +import lombok.Getter; + +import java.util.List; + + +/** + * Triggered every time a battle participant receives points. Contains the current status of the battle and the army that suported the group. + */ +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokLinkMicArmiesEvent extends TikTokHeaderEvent { + private final Long battleId; + + private final Integer battleStatus; + + private final Picture picture; + + private final List armies; + + public TikTokLinkMicArmiesEvent(WebcastLinkMicArmies msg) { + super(msg.getCommon()); + battleId = msg.getId(); + armies = msg.getBattleItemsList().stream().map(LinkMicArmy::new).toList(); + picture = Picture.map(msg.getImage()); + battleStatus = msg.getBattleStatus(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicBattleEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicBattleEvent.java new file mode 100644 index 0000000..62c28ad --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicBattleEvent.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.LinkMicBattleTeam; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle; +import lombok.Getter; + +import java.util.List; + +/** + * Triggered every time a battle starts. + */ +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent { + private final Long battleId; + private final List team1; + private final List team2; + + public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) { + super(msg.getCommon()); + battleId = msg.getId(); + team1 = msg.getTeams1List().stream().map(LinkMicBattleTeam::new).toList(); + team2 = msg.getTeams2List().stream().map(LinkMicBattleTeam::new).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicFanTicketEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicFanTicketEvent.java new file mode 100644 index 0000000..a4aa376 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicFanTicketEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicFanTicketMethod; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokLinkMicFanTicketEvent extends TikTokHeaderEvent { + + public TikTokLinkMicFanTicketEvent(WebcastLinkMicFanTicketMethod msg) { + super(msg.getCommon()); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicMethodEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicMethodEvent.java new file mode 100644 index 0000000..46561b2 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicMethodEvent.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicMethod; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokLinkMicMethodEvent extends TikTokHeaderEvent { + + public TikTokLinkMicMethodEvent(WebcastLinkMicMethod msg) { + super(msg.getCommon()); + + } + + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLiveEndedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLiveEndedEvent.java new file mode 100644 index 0000000..20a4e71 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLiveEndedEvent.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023-2023 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.data.events; +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; + + +/** + * Triggered when the live stream gets terminated by the host. Will also trigger the TikTokDisconnectedEvent event. + */ +@EventMeta(eventType = EventType.Message) +public class TikTokLiveEndedEvent extends TikTokEvent { +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLivePausedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLivePausedEvent.java new file mode 100644 index 0000000..4f4331d --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLivePausedEvent.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; + +@EventMeta(eventType = EventType.Message) +public class TikTokLivePausedEvent extends TikTokEvent { +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokQuestionEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokQuestionEvent.java new file mode 100644 index 0000000..3570463 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokQuestionEvent.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastQuestionNewMessage; +import lombok.Getter; + +/* +Triggered every time someone asks a new question via the question feature. + */ +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokQuestionEvent extends TikTokHeaderEvent { + private final Long questionId; + private final String text; + private final Long time; + private final User user; + public TikTokQuestionEvent(WebcastQuestionNewMessage msg) { + super(msg.getCommon()); + var data = msg.getDetails(); + questionId = data.getId(); + text = data.getText(); + time = data.getTimeStamp(); + user = User.map(data.getUser()); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankTextEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankTextEvent.java new file mode 100644 index 0000000..6532fa0 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankTextEvent.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.Text; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRankTextMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokRankTextEvent extends TikTokHeaderEvent { + private final String eventType; + + private final String label; + + public TikTokRankTextEvent(WebcastRankTextMessage msg) { + super(msg.getCommon()); + var text = Text.map(msg.getSelfGetBadgeMsg()); + label = text.getPattern(); + eventType = text.getKey(); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankUpdateEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankUpdateEvent.java new file mode 100644 index 0000000..41e972b --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankUpdateEvent.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastHourlyRankMessage; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRankUpdateMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokRankUpdateEvent extends TikTokHeaderEvent { + + public TikTokRankUpdateEvent(WebcastHourlyRankMessage msg) { + super(msg.getCommon()); + + } + + public TikTokRankUpdateEvent(WebcastRankUpdateMessage msg) { + super(msg.getCommon()); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokReconnectingEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokReconnectingEvent.java new file mode 100644 index 0000000..681a3ad --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokReconnectingEvent.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Control) +public class TikTokReconnectingEvent extends TikTokLiveClientEvent +{ + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokShopEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokShopEvent.java new file mode 100644 index 0000000..584b8d0 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokShopEvent.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastOecLiveShoppingMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokShopEvent extends TikTokHeaderEvent { + private final String title; + + private final String price; + + private final Picture picture; + + private final String shopUrl; + + private final String shopName; + + //Not working + public TikTokShopEvent(WebcastOecLiveShoppingMessage msg) { + super(msg.getCommon()); + var data = msg.getShopData(); + title = data.getTitle(); + price = data.getPriceString(); + picture = new Picture(data.getImageUrl()); + shopUrl = data.getShopUrl(); + shopName = data.getShopName(); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokSubNotifyEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokSubNotifyEvent.java new file mode 100644 index 0000000..29c3555 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokSubNotifyEvent.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSubNotifyMessage; +import lombok.Value; + +@Value +@EventMeta(eventType = EventType.Message) +public class TikTokSubNotifyEvent extends TikTokHeaderEvent { + User user; + + public TikTokSubNotifyEvent(WebcastSubNotifyMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokSubscribeEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokSubscribeEvent.java new file mode 100644 index 0000000..5c6d8b4 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokSubscribeEvent.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage; +import lombok.Getter; + +/** + * Triggers when a user creates a subscription. + */ +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokSubscribeEvent extends TikTokHeaderEvent { + private User user; + + public TikTokSubscribeEvent(WebcastMemberMessage msg) { + super(msg.getCommon()); + + if(msg.hasUser()) + { + user = new User(msg.getUser()); + } + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnauthorizedMemberEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnauthorizedMemberEvent.java new file mode 100644 index 0000000..5a429fc --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnauthorizedMemberEvent.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastUnauthorizedMemberMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokUnauthorizedMemberEvent extends TikTokHeaderEvent { + private final String userNickName; + + public TikTokUnauthorizedMemberEvent(WebcastUnauthorizedMemberMessage msg) { + super(msg.getCommon()); + + userNickName = msg.getNickName(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledControlEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledControlEvent.java new file mode 100644 index 0000000..5798725 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledControlEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastControlMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokUnhandledControlEvent extends TikTokUnhandledEvent { + + public TikTokUnhandledControlEvent(WebcastControlMessage data) { + super(data); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledMemberEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledMemberEvent.java new file mode 100644 index 0000000..a55509c --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledMemberEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokUnhandledMemberEvent extends TikTokUnhandledEvent +{ + public TikTokUnhandledMemberEvent(WebcastMemberMessage data) { + super(data); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledSocialEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledSocialEvent.java new file mode 100644 index 0000000..5c342e8 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledSocialEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023-2023 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.data.events; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokUnhandledSocialEvent extends TikTokUnhandledEvent +{ + public TikTokUnhandledSocialEvent(WebcastSocialMessage data) { + super(data); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEmptyEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEmptyEvent.java new file mode 100644 index 0000000..f0b0b5b --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEmptyEvent.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023-2023 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.data.events.common; + + +/** + * + */ +public class TikTokEmptyEvent extends TikTokEvent +{ + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEvent.java new file mode 100644 index 0000000..1c01ec5 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023-2023 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.data.events.common; + + +import io.github.jwdeveloper.tiktok.utils.JsonUtil; +import lombok.Getter; + +/** + * Base class for all events + */ +@Getter +public abstract class TikTokEvent { + + public String toJson() { + return JsonUtil.toJson(this); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokHeaderEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokHeaderEvent.java new file mode 100644 index 0000000..f2acde9 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokHeaderEvent.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023-2023 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.data.events.common; + +import io.github.jwdeveloper.tiktok.messages.data.Common; +import lombok.Getter; + +@Getter +public class TikTokHeaderEvent extends TikTokEvent { + private final long messageId; + private final long roomId; + private final long timeStamp; + + public TikTokHeaderEvent(Common header) { + this(header.getMsgId(), header.getRoomId(), header.getCreateTime()); + } + + public TikTokHeaderEvent(long messageId, long roomId, long timeStamp) { + this.messageId = messageId; + this.roomId = roomId; + this.timeStamp = timeStamp; + } + + public TikTokHeaderEvent() { + messageId = 0; + roomId = 0; + timeStamp = 0; + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokLiveClientEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokLiveClientEvent.java new file mode 100644 index 0000000..f6ee669 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokLiveClientEvent.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023-2023 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.data.events.common; + + +public class TikTokLiveClientEvent extends TikTokEvent { +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokUnhandledEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokUnhandledEvent.java new file mode 100644 index 0000000..e0ad62d --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokUnhandledEvent.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023-2023 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.data.events.common; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class TikTokUnhandledEvent extends TikTokEvent +{ + private final T data; +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/gift/TikTokGiftComboEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/gift/TikTokGiftComboEvent.java new file mode 100644 index 0000000..cbc81ca --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/gift/TikTokGiftComboEvent.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023-2023 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.data.events.gift; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.models.gifts.Gift; +import io.github.jwdeveloper.tiktok.data.models.gifts.GiftSendType; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage; +import lombok.Getter; + + +/** + * Triggered every time gift is sent + * + * @see GiftSendType it has 3 states + * + *

Example when user sends gift with combo

+ *

>Combo: 1 -> comboState = GiftSendType.Begin

+ *

Combo: 4 -> comboState = GiftSendType.Active

+ *

Combo: 8 -> comboState = GiftSendType.Active

+ *

Combo: 12 -> comboState = GiftSendType.Finsihed

+ * + * Remember if comboState is Finsihed both TikTokGiftComboEvent and TikTokGiftEvent event gets triggered + */ +@EventMeta(eventType = EventType.Message) +@Getter +public class TikTokGiftComboEvent extends TikTokGiftEvent { + private final GiftSendType comboState; + + public TikTokGiftComboEvent(Gift gift, WebcastGiftMessage msg, GiftSendType comboState) { + super(gift, msg); + this.comboState = comboState; + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/gift/TikTokGiftEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/gift/TikTokGiftEvent.java new file mode 100644 index 0000000..d3a2ff8 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/gift/TikTokGiftEvent.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023-2023 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.data.events.gift; + + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.gifts.Gift; +import io.github.jwdeveloper.tiktok.data.models.gifts.GiftSendType; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage; +import lombok.Getter; + + +/* + * Triggered when user sends gifts that has + * no combo (most of expensive gifts) + * or if combo has finished + */ +@EventMeta(eventType = EventType.Message) +@Getter +public class TikTokGiftEvent extends TikTokHeaderEvent { + private final Gift gift; + private final User user; + private final int combo; + public TikTokGiftEvent(Gift gift, WebcastGiftMessage msg) { + super(msg.getCommon()); + this.gift = gift; + user = User.map(msg.getUser(), msg.getUserIdentity()); + combo = msg.getComboCount(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollEndEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollEndEvent.java new file mode 100644 index 0000000..e0cfc57 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollEndEvent.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023-2023 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.data.events.poll; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.models.PollOption; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage; +import lombok.Getter; + +import java.util.List; + +@EventMeta(eventType = EventType.Message) +@Getter +public class TikTokPollEndEvent extends TikTokPollEvent +{ + private final User operator; + private final List options; + public TikTokPollEndEvent(WebcastPollMessage msg) { + super(msg); + var end = msg.getEndContent(); + operator = User.map(end.getOperator()); + options = end.getOptionListList().stream().map(PollOption::map).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollEvent.java new file mode 100644 index 0000000..5794cd4 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollEvent.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023-2023 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.data.events.poll; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokPollEvent extends TikTokHeaderEvent { + private final Long pollId; + + public TikTokPollEvent(WebcastPollMessage msg) + { + super(msg.getCommon()); + pollId = msg.getPollId(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollStartEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollStartEvent.java new file mode 100644 index 0000000..7d1c2ef --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollStartEvent.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023-2023 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.data.events.poll; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.models.PollOption; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage; +import lombok.Getter; + +import java.util.List; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokPollStartEvent extends TikTokPollEvent { + + private final List options; + private final String title; + private final User operator; + + public TikTokPollStartEvent(WebcastPollMessage msg) { + super(msg); + var startContent = msg.getStartContent(); + + title = startContent.getTitle(); + operator = User.map(startContent.getOperator()); + options = startContent.getOptionListList().stream().map(PollOption::map).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollUpdateEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollUpdateEvent.java new file mode 100644 index 0000000..7349fe2 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollUpdateEvent.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023-2023 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.data.events.poll; + + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.models.PollOption; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage; +import lombok.Getter; + +import java.util.List; + +@EventMeta(eventType = EventType.Message) +@Getter +public class TikTokPollUpdateEvent extends TikTokPollEvent { + private final List options; + public TikTokPollUpdateEvent(WebcastPollMessage msg) { + super(msg); + options = msg.getUpdateContent().getOptionListList().stream().map(PollOption::map).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomEvent.java new file mode 100644 index 0000000..1e9f67e --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomEvent.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023-2023 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.data.events.room; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.data.models.users.UserAttribute; +import io.github.jwdeveloper.tiktok.messages.webcast.RoomMessage; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLiveIntroMessage; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomMessage; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSystemMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokRoomEvent extends TikTokHeaderEvent +{ + private User hostUser; + private String hostLanguage; + private final String welcomeMessage; + + public TikTokRoomEvent(WebcastRoomMessage msg) { + super(msg.getCommon()); + welcomeMessage = msg.getContent(); + } + + public TikTokRoomEvent(RoomMessage msg) { + super(msg.getCommon()); + welcomeMessage = msg.getContent(); + } + + public TikTokRoomEvent(WebcastSystemMessage msg) { + super(msg.getCommon()); + welcomeMessage = msg.getMessage(); + } + + public TikTokRoomEvent(WebcastLiveIntroMessage msg) { + super(msg.getCommon()); + hostUser = User.map(msg.getHost()); + hostUser.addAttribute(UserAttribute.LiveHost); + welcomeMessage = msg.getContent(); + hostLanguage = msg.getLanguage(); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomPinEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomPinEvent.java new file mode 100644 index 0000000..f599853 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomPinEvent.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023-2023 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.data.events.room; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.events.TikTokCommentEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomPinMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokRoomPinEvent extends TikTokHeaderEvent +{ + + private TikTokCommentEvent pinnedMessage; + private long timestamp; + + public TikTokRoomPinEvent(WebcastRoomPinMessage msg, TikTokCommentEvent commentEvent) + { + super(msg.getCommon()); + this.timestamp = msg.getTimestamp(); + this.pinnedMessage = commentEvent; + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomUserInfoEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomUserInfoEvent.java new file mode 100644 index 0000000..3a86def --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomUserInfoEvent.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023-2023 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.data.events.room; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.RankingUser; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomUserSeqMessage; +import lombok.Getter; + +import java.util.List; +import java.util.stream.Collectors; + + + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokRoomUserInfoEvent extends TikTokHeaderEvent { + private final int totalUsers; + + /** + * Only top 5 users in ranking has detailed data + * rest has only ID + */ + private final List usersRanking; + public TikTokRoomUserInfoEvent(WebcastRoomUserSeqMessage msg) { + super(msg.getCommon()); + totalUsers = msg.getTotalUser(); + usersRanking = msg.getRanksListList().stream().map(RankingUser::new) + .sorted((ru1, ru2) -> Integer.compare(ru2.getScore(), ru1.getScore())) + .collect(Collectors.toList()); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokFollowEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokFollowEvent.java new file mode 100644 index 0000000..c1715d5 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokFollowEvent.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023-2023 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.data.events.social; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage; +import lombok.Value; + +/** + * Triggers when a user follows the streamer. Based on social event. + */ +@Value +@EventMeta(eventType = EventType.Message) +public class TikTokFollowEvent extends TikTokHeaderEvent +{ + User user; + int totalFollowers; + + public TikTokFollowEvent(WebcastSocialMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + totalFollowers = msg.getFollowCount(); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokJoinEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokJoinEvent.java new file mode 100644 index 0000000..700e27a --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokJoinEvent.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023-2023 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.data.events.social; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage; +import lombok.Getter; + +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokJoinEvent extends TikTokHeaderEvent { + private final User user; + private final int totalUsers; + + public TikTokJoinEvent(WebcastSocialMessage msg, int viewersCount) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + this.totalUsers = viewersCount; + } + + public TikTokJoinEvent(WebcastMemberMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + totalUsers = msg.getMemberCount(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokLikeEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokLikeEvent.java new file mode 100644 index 0000000..6c64270 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokLikeEvent.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023-2023 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.data.events.social; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLikeMessage; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage; +import lombok.Getter; + + +/** + * Triggered when a viewer sends likes to the streamer. For streams with many viewers, this event is not always triggered by TikTok. + */ +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokLikeEvent extends TikTokHeaderEvent +{ + private final User user; + + private final int likes; + + private final int totalLikes; + + public TikTokLikeEvent(WebcastSocialMessage msg, int totalLikes) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + likes = 1; + this.totalLikes = totalLikes; + } + + public TikTokLikeEvent(WebcastLikeMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + likes = msg.getCount(); + totalLikes = msg.getTotal(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokShareEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokShareEvent.java new file mode 100644 index 0000000..0133b2c --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/social/TikTokShareEvent.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023-2023 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.data.events.social; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage; +import lombok.Getter; + +/** + * Triggers when a user shares the stream. Based on social event. + */ +@Getter +@EventMeta(eventType = EventType.Message) +public class TikTokShareEvent extends TikTokHeaderEvent { + private final User user; + private final int totalShares; + + public TikTokShareEvent(WebcastSocialMessage msg, Integer amount) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + this.totalShares = amount; + } + + public TikTokShareEvent(WebcastSocialMessage msg) { + super(msg.getCommon()); + user = User.map(msg.getUser()); + totalShares = 1; + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketMessageEvent.java new file mode 100644 index 0000000..2576996 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketMessageEvent.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023-2023 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.data.events.websocket; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Value; + +import java.time.Duration; + + +/** + * Triggered every time a protobuf encoded webcast message arrives. You can deserialize the binary object depending on the use case. + */ +@Getter +@AllArgsConstructor +@EventMeta(eventType = EventType.Debug) +public class TikTokWebsocketMessageEvent extends TikTokEvent +{ + private TikTokEvent event; + + private WebcastResponse.Message message; + + private MetaData metaData; + + @Value + public static class MetaData + { + Duration handlingTime; + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketResponseEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketResponseEvent.java new file mode 100644 index 0000000..32db2e4 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketResponseEvent.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023-2023 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.data.events.websocket; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +@EventMeta(eventType = EventType.Debug) +public class TikTokWebsocketResponseEvent extends TikTokEvent +{ + private WebcastResponse response; +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketUnhandledMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketUnhandledMessageEvent.java new file mode 100644 index 0000000..72b8715 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketUnhandledMessageEvent.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023-2023 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.data.events.websocket; + +import io.github.jwdeveloper.tiktok.annotations.EventMeta; +import io.github.jwdeveloper.tiktok.annotations.EventType; +import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse; +import lombok.Getter; + + +/** + * Triggered every time a protobuf encoded webcast message arrives. You can deserialize the binary object depending on the use case. + */ +@Getter +@EventMeta(eventType = EventType.Debug) +public class TikTokWebsocketUnhandledMessageEvent extends TikTokUnhandledEvent +{ + public TikTokWebsocketUnhandledMessageEvent(WebcastResponse.Message data) { + super(data); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Emote.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Emote.java new file mode 100644 index 0000000..69d1636 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Emote.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + +import lombok.Value; + +@Value +public class Emote { + String emoteId; + Picture picture; + + public static Emote map(io.github.jwdeveloper.tiktok.messages.data.Emote input) { + return new Emote(input.getEmoteId(), Picture.map(input.getImage())); + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/EnumValue.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/EnumValue.java new file mode 100644 index 0000000..cf679c1 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/EnumValue.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + +import lombok.Value; + +@Value +public class EnumValue +{ + public int value; + public String name; + + public static EnumValue Map(Enum _enum) + { + return new EnumValue(_enum.ordinal() ,_enum.name()); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/LinkMicArmy.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/LinkMicArmy.java new file mode 100644 index 0000000..0777172 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/LinkMicArmy.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.data.LinkMicArmiesItems; +import lombok.Value; + +import java.util.List; + +@Value +public class LinkMicArmy { + Long armyId; + List armies; + + public LinkMicArmy(LinkMicArmiesItems army) { + armyId = army.getHostUserId(); + armies = army.getBattleGroupsList() + .stream() + .map(x -> new Army(x.getUsersList().stream().map(User::map).toList(), x.getPoints())) + .toList(); + } + + @Value + public static class Army { + List Users; + Integer Points; + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/LinkMicBattleTeam.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/LinkMicBattleTeam.java new file mode 100644 index 0000000..59141d8 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/LinkMicBattleTeam.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + + +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle; +import lombok.Value; + +import java.util.List; + +@Value +public class LinkMicBattleTeam { + Long teamId; + List users; + + public LinkMicBattleTeam(WebcastLinkMicBattle.LinkMicBattleTeam team) { + this.teamId = team.getId(); + this.users = team.getUsersList().stream().map(User::new).toList(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Picture.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Picture.java new file mode 100644 index 0000000..c052af4 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Picture.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + +import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException; +import lombok.Getter; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CompletableFuture; + + +public class Picture { + + @Getter + private final String link; + + private Image image; + + public Picture(String link) { + this.link = link; + } + + public static Picture map(io.github.jwdeveloper.tiktok.messages.data.Image profilePicture) { + + var index = profilePicture.getUrlListCount() - 1; + if (index <= 0) { + return new Picture(""); + } + var url = profilePicture.getUrlList(index); + return new Picture(url); + } + + public boolean isDownloaded() { + return image != null; + } + + public Image downloadImage() { + if (isDownloaded()) { + return image; + } + image = download(link); + return image; + } + + public CompletableFuture downloadImageAsync() { + return CompletableFuture.supplyAsync(this::downloadImage); + } + + private BufferedImage download(String urlString) + { + if(urlString.isEmpty()) + { + return null; + } + var baos = new ByteArrayOutputStream(); + try (var is = new URL(urlString).openStream()) { + var byteChunk = new byte[4096]; + int n; + + while ((n = is.read(byteChunk)) > 0) { + baos.write(byteChunk, 0, n); + } + } catch (IOException e) { + throw new TikTokLiveException("Unable map downloaded image", e); + } + + var bais = new ByteArrayInputStream(baos.toByteArray()); + try { + return ImageIO.read(bais); + } catch (IOException e) { + throw new TikTokLiveException("Unable map downloaded image bytes to Image", e); + } + } + + public static Picture Empty() { + return new Picture(""); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/PollOption.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/PollOption.java new file mode 100644 index 0000000..63c2076 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/PollOption.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.data.PollOptionInfo; +import lombok.Value; + +import java.util.List; + +@Value +public class PollOption { + + int optionId; + String content; + int votes; + List users; + + public static PollOption map(PollOptionInfo pollOptionInfo) { + + var users = pollOptionInfo.getVoteUserListList().stream().map(User::map).toList(); + return new PollOption( + pollOptionInfo.getOptionIdx(), + pollOptionInfo.getDisplayContent(), + pollOptionInfo.getVotes(), + users); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/RankingUser.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/RankingUser.java new file mode 100644 index 0000000..b94f83b --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/RankingUser.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + +import io.github.jwdeveloper.tiktok.data.models.users.User; +import lombok.Value; + +@Value +public class RankingUser { + int rank; + User user; + int score; + + public RankingUser(io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomUserSeqMessage.Contributor viewer) { + rank = viewer.getRank(); + user = User.map(viewer.getUser()); + score = viewer.getScore(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Text.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Text.java new file mode 100644 index 0000000..02e3d98 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Text.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2023-2023 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.data.models; + +import io.github.jwdeveloper.tiktok.data.models.users.User; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Value; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +@Getter +public class Text { + String key; + String pattern; + List textPieces; + String value; + + public Text(String key, String pattern, List textPieces) { + this.key = key; + this.pattern = pattern; + this.textPieces = textPieces; + this.value = computeValue(); + } + + public static Text map(io.github.jwdeveloper.tiktok.messages.data.Text input) { + var pieces = input.getPiecesListList().stream().map(Text::mapTextPiece).toList(); + return new Text(input.getKey(), input.getDefaultPattern(), pieces); + } + + + public static TextPiece mapTextPiece(io.github.jwdeveloper.tiktok.messages.data.Text.TextPiece input) { + return switch (input.getType()) { + case 11 -> { + var user = User.map(input.getUserValue().getUser()); + yield new UserTextPiece(user); + } + case 12 -> new GiftTextPiece(input.getGiftValue().getGiftId()); + default -> new StringTextPiece(input.getStringValue()); + }; + } + + + private String computeValue() { + var regexPattern = Pattern.compile("\\{.*?\\}"); + var matcher = regexPattern.matcher(pattern); + var format = matcher.replaceAll("%s"); + + var output = new ArrayList(); + for (var piece : textPieces) + { + output.add(piece.getText()); + } + if(matcher.groupCount() != output.size()) + { + return format; + } + return String.format(format, output.toArray()); + } + + + @Getter + @AllArgsConstructor + public static class TextPiece { + public String getText() { + return ""; + } + } + + @Value + public static class StringTextPiece extends TextPiece { + String text; + + public StringTextPiece(String text) { + this.text = text; + } + } + + public static class UserTextPiece extends TextPiece { + User user; + + public UserTextPiece(User user) { + this.user = user; + } + + + @Override + public String getText() { + return user.getProfileName(); + } + } + + public static class GiftTextPiece extends TextPiece { + + int giftId; + + public GiftTextPiece(int giftId) { + this.giftId = giftId; + } + + @Override + public String getText() { + return giftId + ""; + } + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/Badge.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/Badge.java new file mode 100644 index 0000000..ac429b8 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/Badge.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023-2023 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.data.models.badges; + +public class Badge { + + public static Badge map(io.github.jwdeveloper.tiktok.messages.data.BadgeStruct badge) { + return switch (badge.getDisplayType()) { + case BADGEDISPLAYTYPE_TEXT -> new TextBadge(badge.getText()); + case BADGEDISPLAYTYPE_IMAGE -> new PictureBadge(badge.getImage()); + case BADGEDISPLAYTYPE_STRING -> new StringBadge(badge.getStr()); + case BADGEDISPLAYTYPE_COMBINE -> new CombineBadge(badge.getCombine()); + default -> empty(); + }; + } + + public static Badge empty() { + return new Badge(); + } + + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/CombineBadge.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/CombineBadge.java new file mode 100644 index 0000000..655efe0 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/CombineBadge.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2023-2023 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.data.models.badges; + +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; + +public class CombineBadge extends Badge { + private final Picture picture; + private final String text; + private final String subText; + + + public CombineBadge(BadgeStruct.CombineBadge combineBadge) { + + picture = Picture.map(combineBadge.getIcon()); + text = combineBadge.getText().getDefaultPattern(); + subText = combineBadge.getStr(); + } + + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/PictureBadge.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/PictureBadge.java new file mode 100644 index 0000000..3dbba78 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/PictureBadge.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-2023 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.data.models.badges; + +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; + +public class PictureBadge extends Badge { + + private final Picture picture; + public PictureBadge(BadgeStruct.ImageBadge imageBadge) { + + picture = Picture.map(imageBadge.getImage()); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/StringBadge.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/StringBadge.java new file mode 100644 index 0000000..4f241b3 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/StringBadge.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023-2023 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.data.models.badges; + +import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; + +public class StringBadge extends Badge { + + public String text; + public StringBadge(BadgeStruct.StringBadge stringBadge) { + + this.text = stringBadge.getStr(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/TextBadge.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/TextBadge.java new file mode 100644 index 0000000..cf62a34 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/TextBadge.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-2023 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.data.models.badges; + +import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; + +public class TextBadge extends Badge +{ + private final String text; + + public TextBadge(BadgeStruct.TextBadge textBadge) + { + this.text = textBadge.getDefaultPattern(); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/BarrageParam.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/BarrageParam.java new file mode 100644 index 0000000..855eab2 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/BarrageParam.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023-2023 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.data.models.barrage; + +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; + +public class BarrageParam { + + //Figure out barrage type:11 + public static BarrageParam map(WebcastBarrageMessage msg) { + return switch (msg.getMsgType()) { + case GRADEUSERENTRANCENOTIFICATION -> new UserGradeParam(msg.getUserGradeParam()); + case FANSLEVELUPGRADE -> new FansLevelParam(msg.getFansLevelParam()); + case SUBSCRIBEGIFT -> new SubscribeGiftParam(msg.getSubscribeGiftParam()); + default -> new BarrageParam(); + }; + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/FansLevelParam.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/FansLevelParam.java new file mode 100644 index 0000000..1206ee7 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/FansLevelParam.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023-2023 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.data.models.barrage; + +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; + +public class FansLevelParam extends BarrageParam +{ + int currentGrade; + User user; + public FansLevelParam(WebcastBarrageMessage.BarrageTypeFansLevelParam param) + { + this.currentGrade = param.getCurrentGrade(); + this.user = User.map(param.getUser()); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/SubscribeGiftParam.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/SubscribeGiftParam.java new file mode 100644 index 0000000..6cb50d3 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/SubscribeGiftParam.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023-2023 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.data.models.barrage; + +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; + +public class SubscribeGiftParam extends BarrageParam +{ + public SubscribeGiftParam(WebcastBarrageMessage.BarrageTypeSubscribeGiftParam param) + { + + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/UserGradeParam.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/UserGradeParam.java new file mode 100644 index 0000000..22d945a --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/UserGradeParam.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-2023 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.data.models.barrage; + +import io.github.jwdeveloper.tiktok.data.models.users.User; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; + +public class UserGradeParam extends BarrageParam { + int currentGrade; + User user; + public UserGradeParam(WebcastBarrageMessage.BarrageTypeUserGradeParam param) { + this.currentGrade = param.getCurrentGrade(); + this.user = User.map(param.getUser()); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/gifts/Gift.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/gifts/Gift.java new file mode 100644 index 0000000..de88661 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/gifts/Gift.java @@ -0,0 +1,1099 @@ +/* + * Copyright (c) 2023-2023 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. + */ +// This enum is generated +package io.github.jwdeveloper.tiktok.data.models.gifts; + +import io.github.jwdeveloper.tiktok.data.models.Picture; +import lombok.Getter; + +@Getter +public enum Gift { + UNDEFINED(-1, "undefined", -1), + + HEART(5480, "Heart", 10), + + HEART_5738(5738, "Heart", 200), + + HEART_6247(6247, "Heart", 1), + + INTERSTELLAR(6149, "Interstellar", 10000), + + LOVE_CHAT(6205, "Love Chat", 400), + + CHICK(8165, "Chick", 10), + + DOUBLE_TROUBLE(8038, "Double trouble", 2988), + + FALCON(6271, "Falcon", 10999), + + SNEAKERHEAD(7394, "Sneakerhead", 1), + + PANTHER_PAWS(7204, "Panther Paws", 199), + + PANTHER_PAWS_8358(8358, "Panther Paws", 199), + + SHOOTING_STARS(5753, "Shooting Stars", 1580), + + LION(6369, "Lion", 29999), + + CAR_DRIFTING(8086, "Car Drifting", 3000), + + FUNNY_FACE(7933, "Funny Face", 1), + + ENJOY_MUSIC(5685, "Enjoy Music", 1), + + COOPER_FLIES_HOME(6862, "Cooper Flies Home", 1999), + + MAKE_UP_BOX(6033, "Make-up Box", 1999), + + LITTLE_CROWN(6097, "Little Crown", 99), + + RUBY_RED(8434, "Ruby red", 88), + + PUPPY_LOVE(7927, "Puppy Love", 199), + + COTTON_CANDY(7265, "Cotton Candy", 700), + + KNIGHT_HELMET(8672, "Knight Helmet", 199), + + SUB_STAR(7072, "Sub Star", 1), + + MY_FAVOURITE(8155, "My favourite", 99), + + MY_FAVOURITE_8156(8156, "My favourite", 99), + + SAPLING(7003, "Sapling", 1), + + HEADPHONES(5740, "Headphones", 20), + + ICE_HOCKEY(7780, "Ice hockey", 199), + + MIKE(7789, "Mike", 4000), + + HEADPHONE(6609, "Headphone", 199), + + HEADPHONE_8017(8017, "Headphone", 199), + + ICE_CREAM(5757, "Ice cream", 5), + + ICE_CREAM_8963(8963, "Ice cream", 5), + + GIVE_IT_ALL(6649, "Give It All", 1), + + MARVELOUS_CONFETTI(7121, "Marvelous Confetti", 100), + + PINKY_PROMISE(8810, "Pinky promise", 5), + + KITE(7090, "Kite", 199), + + WIDE_EYE_WURSTIE(6774, "Wide Eye Wurstie", 5), + + I_LOVE_KR(7048, "I LOVE KR", 1), + + WEIGHTS(5760, "Weights", 1), + + RED_LIGHTNING(8419, "Red Lightning", 12000), + + GUACAMOLE(6519, "Guacamole", 6), + + FINGER_HEART(5487, "Finger Heart", 5), + + COOPER_SWIMS_HOME(6863, "Cooper Swims Home", 3999), + + RED_CARPET(6789, "Red Carpet", 1999), + + CUPID(5236, "Cupid", 2888), + + MYSTERY_FIREWORK(7529, "Mystery Firework", 1999), + + BUNGEO_PPANG(5644, "Bungeo-ppang", 1), + + SCENTED_CANDLE(7131, "Scented Candle", 20), + + MOTORCYCLE(5765, "Motorcycle", 2988), + + DREAM_TEAM(7532, "Dream Team", 299), + + DREAM_TEAM_8892(8892, "Dream Team", 500), + + WATERMELON(8826, "Watermelon", 10), + + SHOW_TIME(6907, "Show Time", 3999), + + LOVE_FOCUS(6436, "Love Focus", 199), + + CHICKEN_LEG(6209, "Chicken Leg", 10), + + BEACH_DAY(6431, "Beach Day", 2999), + + I_LOVE_MUSIC(8392, "I love music", 398), + + SPEEDBOAT(5763, "Speedboat", 1888), + + YELLOW_BUS(8263, "Yellow Bus", 6000), + + ROSA_NEBULA(8912, "Rosa Nebula", 15000), + + KISS(5284, "Kiss", 150), + + KISS_5481(5481, "Kiss", 150), + + KISS_5577(5577, "Kiss", 150), + + ANTI_HERO(7316, "Anti Hero", 1), + + TUCKER_THE_TURKEY(7403, "Tucker the Turkey", 10), + + BIRTHDAY_HAT(5866, "Birthday Hat", 99), + + LUCKY_PIG(7375, "Lucky Pig", 1), + + GARLAND_(5651, "Garland ", 1500), + + COWBOY_HAT(8842, "Cowboy Hat", 199), + + SPORTS_CAR(6089, "Sports Car", 7000), + + ICE_TEA(5464, "Ice Tea", 1), + + TEMPE_TOFU(5462, "Tempe Tofu", 1), + + CHOCO_PIE(6503, "Choco Pie", 10), + + WHALE_DIVING(6084, "Whale diving", 1750), + + WHALE_DIVING_6820(6820, "Whale diving", 2150), + + DIAMOND_RING_OF_LOVE(5283, "Diamond ring of love", 300), + + DIAMOND_RING_OF_LOVE_5569(5569, "Diamond ring of love", 300), + + MONEY_GUN(5739, "Money Gun", 500), + + MONEY_GUN_6365(6365, "Money Gun", 500), + + MONEY_GUN_7168(7168, "Money Gun", 500), + + HONORABLE_PERSON(6525, "Honorable Person", 99), + + PEARL(5664, "Pearl", 800), + + LET_US_DANCE(7196, "Let Us Dance", 1999), + + MINI_SPEAKER(6042, "Mini Speaker", 1), + + FLORAL_BLOOM(5788, "Floral Bloom", 1500), + + APPLAUSE(5564, "Applause", 600), + + APPLAUSE_7266(7266, "Applause", 600), + + VALLEY_FESTIVAL(6556, "Valley Festival", 5999), + + GIFT_BOX(6834, "Gift Box", 1999), + + GIFT_BOX_6835(6835, "Gift Box", 3999), + + ARCADE_GAME(5876, "Arcade Game", 1200), + + IT_S_CORN(6928, "It's corn", 1), + + SUSHI_SET(7226, "Sushi Set", 20), + + BIRTHDAY_GLASSES(6776, "Birthday Glasses", 199), + + SOCKS_AND_SANDALS(6618, "Socks and Sandals", 150), + + FLOWERS(5737, "Flowers", 100), + + ROCKET(5930, "Rocket", 20000), + + GAMEPAD(6052, "Gamepad", 10), + + ORANGE_JUICE(5778, "Orange Juice", 1), + + GERRY_THE_GIRAFFE(6842, "Gerry the Giraffe", 1000), + + NOVEMBER(7177, "November", 88), + + GG(6064, "GG", 1), + + GG_8286(8286, "GG", 1), + + WE_ARE_A_TEAM(8201, "We are a team", 1), + + TIKTOK_VOLCANO(6869, "TikTok Volcano", 4000), + + _2023(7604, "2023", 1), + + ROMAN_EMPIRE(7166, "Roman Empire", 199), + + CHEER_FOR_YOU(6713, "Cheer For You", 199), + + TREASURE_CHEST(5513, "Treasure Chest", 100), + + DIAMOND(5781, "Diamond", 1099), + + SWEET_DREAMS(6073, "Sweet dreams", 399), + + FOOTBALL(5894, "Football", 5), + + FOOTBALL_6093(6093, "Football", 1), + + RESTAURANTS(6204, "Restaurants", 4000), + + PIZZA(7055, "Pizza", 40), + + LOVE_BALLOON(5488, "LOVE Balloon", 699), + + DANCING_CAPYBARAS(8806, "Dancing Capybaras", 2200), + + DUCK(6265, "Duck", 299), + + FLOWER_OVERFLOW(6148, "Flower Overflow", 4000), + + PINK_SHOES(8815, "Pink shoes", 5), + + PINK_SHOES_8843(8843, "Pink shoes", 5), + + FROG_PRINCE(7730, "Frog Prince", 12000), + + COUNTING_SHEEP(7984, "Counting Sheep", 1200), + + DOUGHNUT(5879, "Doughnut", 30), + + SPAGHETTI_KISS(7282, "Spaghetti Kiss", 500), + + BEAR_LOVE(7264, "Bear love", 100), + + SUNDAY_ROAST(6634, "Sunday Roast", 199), + + LEDERHOSEN(6975, "Lederhosen", 10), + + MATE_TEA(7089, "Mate tea", 10), + + HAPPY_NEW_YEAR(6101, "Happy New Year", 199), + + SAKURA_TRAIN(6244, "Sakura Train", 3999), + + AUTUMN_LEAVES(6967, "Autumn Leaves", 500), + + SKI_GOGGLES(7781, "Ski Goggles", 199), + + PAPER_CRANE(5659, "Paper Crane", 99), + + BIGFOOT(9147, "Bigfoot", 3000), + + SO_BEAUTIFUL(7024, "So Beautiful", 1), + + SUNGLASSES(5509, "Sunglasses", 199), + + PANDA(37, "Panda", 5), + + TIKTOK_UNIVERSE(6038, "TikTok Universe", 34999), + + TIKTOK_UNIVERSE_6039(6039, "TikTok Universe", 34999), + + TIKTOK_UNIVERSE_6041(6041, "TikTok Universe", 34999), + + TIKTOK_UNIVERSE_9072(9072, "TikTok Universe", 44999), + + CUDDLE_WITH_ME(8074, "Cuddle with Me", 500), + + BASEBALL(7897, "Baseball", 1), + + PINCH_CHEEK(6694, "Pinch Cheek", 199), + + MARVIN_THE_MONKEY(6843, "Marvin the Monkey", 10), + + ELEPHANT_TRUNK(8260, "Elephant trunk", 299), + + TRAIN(5978, "Train", 899), + + MAY(6470, "May", 1), + + WISHING_BOTTLE(7160, "Wishing Bottle", 1), + + RABBIT(6348, "Rabbit", 1999), + + ROSE(5655, "Rose", 1), + + ROSA(7997, "Rosa", 10), + + ROSA_8913(8913, "Rosa", 10), + + COOPER_S_HOME(6864, "Cooper's Home", 5999), + + CHEER_YOU_UP(8243, "Cheer You Up", 9), + + BOXING_ROBE(7989, "Boxing Robe", 99), + + COOL_CAT(5832, "Cool Cat", 499), + + COTTON_S_SHELL(8352, "Cotton's Shell", 5), + + FLAME_HEART(9087, "Flame heart", 1), + + TIKTOK_SHUTTLE(6751, "TikTok Shuttle", 20000), + + PANDA_SKYDIVING(8812, "Panda skydiving", 2000), + + FIREWORKS(6090, "Fireworks", 1088), + + DANCING_BEAVER_IN_SUNGLASSES(5798, "Dancing beaver in sunglasses", 500), + + GAMER_CYBER_MASK(7895, "Gamer Cyber Mask", 399), + + KO(7542, "KO", 20), + + KO_7655(7655, "KO", 20), + + LEON_AND_LILI(8916, "Leon and Lili", 9699), + + MAGIC_STAGE(6263, "Magic Stage", 2599), + + MAGIC_STAGE_7881(7881, "Magic Stage", 2599), + + DON_T_DO_IT(7688, "Don’t Do It", 500), + + GOLDEN_TRUMPET(8767, "Golden Trumpet", 15), + + HANDS_UP(8244, "Hands Up", 499), + + HAT_AND_MUSTACHE(6427, "Hat and Mustache", 99), + + CONCERT(7880, "Concert", 2888), + + PAIMON_SURPRISE(8299, "Paimon Surprise", 1299), + + HI_MAY(6471, "Hi May", 88), + + WEDDING(6286, "Wedding", 1400), + + JUNGLE_HAT(7262, "Jungle Hat", 199), + + CENTER_STAGE(7879, "Center Stage", 1799), + + ROCK__N__ROLL(5882, "Rock 'n' Roll", 299), + + GALAXY(5886, "Galaxy", 1000), + + CHICKEN_AND_COLA(6487, "Chicken and Cola", 100), + + DJ_SET(6248, "DJ Set", 20), + + ELLIE_THE_ELEPHANT(6845, "Ellie the Elephant", 5000), + + ELLIE_THE_ELEPHANT_6922(6922, "Ellie the Elephant", 5000), + + MUSIC_NOTE(5915, "Music Note", 169), + + MAXWELL(8189, "Maxwell", 10), + + LOVE_DROP(8277, "Love Drop", 1800), + + YACHT(6103, "Yacht", 9888), + + WINDOW_BASKET(8648, "Window basket", 500), + + SWAN(5897, "Swan", 699), + + GREAT_TEAM(8203, "Great Team", 1), + + HELLO_TRAVELER(7501, "Hello Traveler", 5), + + HEARTS(5586, "Hearts", 199), + + FOOTBALL_HELMET(7851, "Football Helmet", 50), + + SCORPIO_STAR_SIGN(7159, "Scorpio Star Sign", 9999), + + GAME_CONTROLLER(6467, "Game Controller", 100), + + GAME_CONTROLLER_6960(6960, "Game Controller", 100), + + TIKTOK_UNIVERSE_(7312, "TikTok Universe+", 34999), + + HANGING_LIGHTS(5937, "Hanging Lights", 199), + + BATIK_CLOTHES(5461, "Batik Clothes", 1000), + + TIKTOK(5269, "TikTok", 1), + + AIR_DANCER(5661, "Air Dancer", 300), + + APRIL(8237, "April", 1), + + DIAMOND_RING(7367, "Diamond Ring", 1500), + + THE_PASSION_ROSE(7824, "The Passion Rose", 199), + + THE_PASSION_ROSE_7835(7835, "The Passion Rose", 199), + + CHEF_S_KISS(7016, "Chef's Kiss", 199), + + FALL_CANDLE(5903, "Fall Candle", 1999), + + SENDING_POSITIVITY(8600, "Sending positivity", 199), + + GAMING_CHAIR(6031, "Gaming Chair", 1200), + + CHAMPION(5955, "Champion", 1500), + + STAR_ADVENTURES(6320, "Star Adventures", 1999), + + GIANT(9149, "Giant", 3999), + + HARVEST_FESTIVAL(7073, "Harvest Festival", 1), + + ISLAND_OF_LOVE(6506, "Island of Love", 4000), + + LEON_AND_LION(7823, "Leon and Lion", 34000), + + CLOUD_BREAD(5826, "Cloud Bread", 1), + + MATCH_WAND(7029, "Match Wand", 100), + + MATCH_WAND_7810(7810, "Match Wand", 100), + + BUTTERFLY(5729, "Butterfly", 169), + + FOUNTAIN(8887, "Fountain", 1200), + + GARLAND_HEADPIECE(6437, "Garland Headpiece", 199), + + FULL_MOON(7222, "Full moon", 299), + + CAT_PAWS(6046, "Cat Paws", 1), + + WAVING_HAND(5959, "Waving Hand", 7), + + BUBBLES(5850, "Bubbles", 500), + + SILVER_SPORTS_CAR(8433, "Silver sports car", 5000), + + RACCOON(8448, "Raccoon", 15), + + HEART_ME(7934, "Heart Me", 1), + + TIKTOK_TROPHY(7357, "TikTok Trophy", 699), + + TENNIS(6169, "Tennis", 1), + + NECKLACE(5662, "Necklace", 400), + + CHOCO_STRAWBERRIES(7837, "Choco Strawberries", 30), + + BIRTHDAY_CAKE(5776, "Birthday Cake", 300), + + BIRTHDAY_CAKE_6071(6071, "Birthday Cake", 300), + + BIRTHDAY_CAKE_9097(9097, "Birthday Cake", 1), + + ICE_LOLLY(6545, "Ice Lolly", 10), + + CONFETTI(5585, "Confetti", 100), + + MATCH__MATCH_(7068, "Match! Match!", 200), + + SHINY_AIR_BALLOON(7123, "Shiny air balloon", 1000), + + RACE_CAR(6892, "Race Car", 12000), + + MARIACHI_HAT(6242, "Mariachi Hat", 199), + + MARIACHI_HAT_7094(7094, "Mariachi Hat", 199), + + SUNSET_SPEEDWAY(6203, "Sunset Speedway", 10000), + + DANCING_ADAM(7468, "Dancing Adam", 5000), + + SCEPTRE(5300, "Sceptre", 150), + + SCEPTRE_7364(7364, "Sceptre", 150), + + SEAL_AND_WHALE(8381, "Seal and Whale", 34500), + + HAPPY_PARTY(8247, "Happy Party", 6999), + + WE_LOVE(7503, "We Love", 299), + + HI_NOVEMBER(7176, "Hi November", 1), + + CELEBRATION_TIME(6790, "Celebration Time", 6999), + + MONTY(7742, "Monty", 1), + + PYRAMIDS(8416, "Pyramids", 15000), + + CASTLE_FANTASY(5340, "Castle Fantasy", 20000), + + CASTLE_FANTASY_5478(5478, "Castle Fantasy", 20000), + + HI_JULY(6603, "Hi July", 1), + + LIGHTNING_BOLT_(6652, "Lightning Bolt ", 1), + + CAMPING_NIGHT(6520, "Camping Night", 13999), + + MAKE_IT_RAIN(5336, "Make it rain", 500), + + GOGGLES(5734, "Goggles", 199), + + GOGGLES_8066(8066, "Goggles", 199), + + RANKING_LIT(6793, "Ranking Lit", 99), + + RANKING_LIT_6794(6794, "Ranking Lit", 199), + + RANKING_LIT_6795(6795, "Ranking Lit", 199), + + RANKING_LIT_6796(6796, "Ranking Lit", 199), + + STARFISH_BAY(8604, "Starfish Bay", 6000), + + I_M_SHY(7391, "I'm shy", 55), + + SWING(5899, "Swing", 399), + + COOKIE(6883, "Cookie", 5), + + DOG_BONE(8108, "Dog Bone", 10), + + FLYING_JETS(7482, "Flying Jets", 5000), + + FLYING_JETS_7720(7720, "Flying Jets", 5000), + + INDOOR_FAN(6565, "Indoor Fan", 199), + + MIC(5650, "Mic", 5), + + FOREVER_ROSA(8914, "Forever Rosa", 399), + + ICE_CREAM_CONE(5827, "Ice Cream Cone", 1), + + FLY_LOVE(8248, "Fly Love", 19999), + + BEACH_DATE(6132, "Beach Date", 899), + + TRAVEL_WITH_YOU(6233, "Travel with You", 999), + + CHOCOLATE_STICK(6002, "Chocolate Stick", 1), + + DJ_ALIEN(8988, "DJ Alien", 5000), + + GAMER_CAT(7549, "Gamer Cat", 199), + + CASTLE_SKYLINE(6662, "Castle Skyline", 15000), + + BUCKET_HAT(6627, "Bucket Hat", 99), + + ROMANTIC_CARRIAGE(5627, "Romantic Carriage", 6000), + + BRIDAL_VEIL(5902, "Bridal Veil", 299), + + TULIP_BOX(5325, "Tulip Box", 200), + + SQUIRREL(7213, "Squirrel", 1), + + METEOR_SHOWER(6563, "Meteor Shower", 3000), + + CAKE(5720, "Cake", 20), + + MARCH(7976, "March", 1), + + MARCH_8077(8077, "March", 88), + + SNOWBOARD(7747, "Snowboard", 199), + + FIRE_PHOENIX(9092, "Fire Phoenix", 41999), + + STAR(6432, "Star", 99), + + SPRING_TRAIN(8152, "Spring train", 3999), + + DALLAH(8097, "Dallah", 10), + + THUNDER_HAMMER(6635, "Thunder Hammer", 1), + + WOLF(8778, "Wolf", 5000), + + DAISIES(6447, "Daisies", 1), + + DANCE_TOGETHER(6554, "Dance Together", 699), + + CAMPING(6322, "Camping", 250), + + TICKET(6856, "Ticket", 10), + + FLOWER_FLIGHT(8327, "Flower Flight", 399), + + SOCCER(7283, "Soccer", 1), + + MUSHROOM(8283, "Mushroom", 10), + + CHOCOLATE(5860, "Chocolate", 1), + + CORNFLOWER(8186, "Cornflower", 5), + + ASMR_TIME_(6990, "ASMR Time ", 10), + + POOL_PARTY(5938, "Pool Party", 4999), + + MATCH_STAR(7070, "Match Star", 1), + + MATCH_STAR_7074(7074, "Match Star", 1), + + GLOW_STICK(6788, "Glow Stick", 1), + + MUSIC(6415, "Music", 499), + + FIRE(5523, "Fire", 1), + + FIRE_5719(5719, "Fire", 5), + + AIRSHIP(6327, "Airship", 1999), + + DRAGON_FLAME(7610, "Dragon Flame", 26999), + + NASI_LEMAK(5588, "Nasi Lemak", 1), + + MERMAID(6938, "Mermaid", 600), + + TURKISH_COFFEE(5994, "Turkish coffee", 5), + + HI_APRIL(8238, "Hi April", 88), + + TELESCOPE(6733, "Telescope", 5), + + SPACESHIP(6588, "Spaceship", 13999), + + BIRTHDAY_CROWN(9096, "Birthday Crown", 99), + + LION_S_MANE(7985, "Lion's Mane", 500), + + WATERMELON_LOVE(6781, "Watermelon Love", 1000), + + COTTON_THE_SEAL(8349, "Cotton the Seal", 399), + + COTTON_THE_SEAL_8852(8852, "Cotton the Seal", 399), + + ADAM_S_DREAM(7400, "Adam’s Dream", 25999), + + GOLDEN_SPORTS_CAR(5287, "Golden sports car", 29999), + + ICE_SKATING(7749, "Ice skating", 199), + + M4_BEATRIX(7543, "M4 Beatrix", 20), + + M4_BEATRIX_7656(7656, "M4 Beatrix", 20), + + LIKE_POP(8130, "Like-Pop", 99), + + FOREST_FAIRY(9148, "Forest Fairy", 4000), + + NEW_UNIVERSE(9081, "New Universe", 1), + + DRUMS(7882, "Drums", 1000), + + PUMPKIN_PIE(7396, "Pumpkin Pie", 5), + + EMAIL_MESSAGE(6199, "Email Message", 1000), + + PREMIUM_SHUTTLE(7125, "Premium Shuttle", 20000), + + PARTY_HAT(6398, "Party hat", 199), + + HI_MARCH(7977, "Hi March", 88), + + HEDGEHOG(6868, "Hedgehog", 299), + + I_LOVE_TR(7139, "I LOVE TR", 1), + + SHIBA_INU(5482, "Shiba Inu", 222), + + SHIBA_INU_7839(7839, "Shiba Inu", 199), + + LEMOND_BUDDY(8744, "Lemond Buddy", 199), + + LOVE_HANGUL(7050, "Love Hangul", 1), + + HI_BEAR(8692, "Hi Bear", 10), + + MIRROR(6070, "Mirror", 30), + + DEHYA(8298, "Dehya", 10), + + BASKETBALL(6269, "Basketball", 1), + + SUNSET_IN_BALI(5835, "Sunset in Bali", 799), + + ANEMO_SLIME(7974, "Anemo Slime", 5), + + ANEMO_SLIME_8297(8297, "Anemo Slime", 5), + + MP3(6472, "Mp3", 100), + + PHOENIX(7319, "Phoenix", 25999), + + BOUQUET_FLOWER(5780, "Bouquet Flower", 30), + + CHILI(7086, "Chili", 1), + + GO_SNACKING(7021, "Go Snacking", 1), + + PUG(6939, "Pug", 299), + + TIKTOK_STARS(8582, "TikTok Stars", 39999), + + CHILL(6704, "Chill", 5), + + TAKE_A_DRIVE(7624, "Take a Drive", 1200), + + TAKE_A_DRIVE_7631(7631, "Take a Drive", 1200), + + FRUITS_HAT(7091, "Fruits Hat", 199), + + MISHKA_BEAR(5486, "Mishka Bear", 100), + + MISHKA_BEAR_5566(5566, "Mishka Bear", 100), + + MISHKA_BEAR_7163(7163, "Mishka Bear", 100), + + PRIVATE_JET(5767, "Private Jet", 4888), + + BALALAIKA(5927, "Balalaika", 100), + + DRACO(8613, "Draco", 5000), + + SPEEDSTER(8418, "Speedster", 15000), + + GEM_GUN(7122, "Gem Gun", 500), + + KNOCKOUT(8415, "Knockout", 4999), + + WASP(7867, "Wasp", 1), + + FEATHER_HAT(7545, "Feather Hat", 199), + + PRETZEL(7056, "Pretzel", 10), + + PRETZEL_9175(9175, "Pretzel", 1), + + BIG_LOVE(7224, "Big Love", 5), + + GOLDEN_GAMEPAD(6582, "Golden Gamepad", 30), + + SUMMER_BAND(6555, "Summer Band", 3999), + + THUMBS_UP(6246, "Thumbs Up", 1), + + TOWARDS_THE_FUTURE(6625, "Towards the future", 28888), + + ZEUS(8457, "Zeus", 34000), + + HAND_WAVE(6059, "Hand Wave", 9), + + COOPER_SKATES_HOME(6865, "Cooper Skates Home", 599), + + BIRTHDAY_PARTY(6787, "Birthday Party", 6999), + + TEASING(6390, "Teasing", 401), + + FOAMY_DRINK(6740, "Foamy Drink", 100), + + CAPYBARA(8217, "Capybara", 30), + + GUMMY(6126, "Gummy", 5), + + LEON_THE_KITTEN(6646, "Leon the Kitten", 4888), + + STAR_THRONE(7764, "Star Throne", 7999), + + STAR_THRONE_8420(8420, "Star Throne", 7999), + + PLANET(5954, "Planet", 15000), + + DISCO_BALL(5540, "Disco Ball", 1000), + + OUD(5301, "Oud", 300), + + SUITCASE(8597, "Suitcase", 199), + + DANCING_BEARS(8188, "Dancing Bears", 3000), + + I_LOVE_YOU(5779, "I Love you", 10), + + I_LOVE_YOU_8259(8259, "I love you", 49), + + SUPER_CAKE(6797, "Super Cake", 1999), + + DAFFODILS(6435, "Daffodils", 99), + + TINY_DINY(6560, "Tiny Diny", 10), + + TINY_DINY_7591(7591, "Tiny Diny", 10), + + CORGI(6267, "Corgi", 299), + + DIAMOND_KING(5337, "Diamond King", 1500), + + LOCK_AND_KEY(5880, "Lock and Key", 199), + + TTEOKBOKKI(5645, "Tteokbokki", 5), + + LOLLIPOP(5657, "Lollipop", 10), + + GRAPES(7234, "Grapes", 1), + + SAM_THE_WHALE(8391, "Sam the Whale", 30000), + + DIAMOND_TREE(7963, "Diamond Tree", 1088), + + LOVE_YOU(6125, "Love You", 10), + + LOVE_YOU_5919(5919, "Love you", 20), + + LOVE_YOU_6890(6890, "Love you", 1), + + HERE_WE_GO(8245, "Here We Go", 1799), + + CHASING_THE_DREAM(7467, "Chasing the Dream", 1500), + + BIRD_WHISPERER(8344, "Bird Whisperer", 5000), + + ALIEN_PEACE_SIGN(7831, "Alien Peace Sign", 1), + + THE_MAGIC_LAMP(7161, "The Magic Lamp", 1000), + + TIARA(8496, "Tiara", 299), + + COFFEE(5333, "Coffee", 1), + + COFFEE_5479(5479, "Coffee", 1), + + COFFEE_5933(5933, "Coffee", 10), + + COFFEE_5961(5961, "Coffee", 30), + + HAND_HEART(5924, "Hand Heart", 100), + + HAND_HEART_6968(6968, "Hand Heart", 100), + + FRIEND(6752, "Friend", 299), + + GARDENING(8232, "Gardening", 500), + + GOLD_MINE(5587, "Gold Mine", 1000), + + HAND_HEARTS(5660, "Hand Hearts", 100), + + GUITAR(6723, "Guitar", 99), + + GUITAR_7092(7092, "Guitar", 99), + + GUITAR_7883(7883, "Guitar", 99), + + MIRROR_BLOOM(6200, "Mirror Bloom", 1000), + + CHEF_S_HAT(6725, "Chef's Hat", 199), + + FULL_ENGLISH(6491, "Full English", 199), + + OWL(5885, "Owl", 500), + + TIKTOK_CROWN(8873, "TikTok Crown", 299), + + ON_FIRE(6840, "On Fire", 200), + + ON_FIRE_6958(6958, "On Fire", 200), + + CROWN(5502, "Crown", 199), + + CROWN_5713(5713, "Crown", 199), + + TELEPHONE_BOX(6381, "Telephone Box", 2100), + + BOXING_GLOVES(6007, "Boxing Gloves", 299), + + FERRIS_WHEEL(5652, "Ferris Wheel", 3000), + + RUGBY_BALL(6249, "Rugby Ball", 10), + + TROPHY(5712, "Trophy", 500), + + ACROSS_THE_BOARD(8793, "Across the board", 450), + + GARDEN_GNOME(7002, "Garden Gnome", 1), + + MUSIC_BOX(5964, "Music Box", 2399), + + PRINCE(7398, "Prince", 500), + + DASH(6757, "Dash", 299), + + BABY_FOX(8552, "Baby fox", 20), + + RAYA_RICE(6383, "Raya Rice", 1), + + TACO(7087, "Taco", 9), + + UNICORN_FANTASY(5338, "Unicorn Fantasy", 5000), + + UNICORN_FANTASY_5348(5348, "Unicorn Fantasy", 5000), + + UNICORN_FANTASY_5475(5475, "Unicorn Fantasy", 5000), + + UNICORN_FANTASY_5483(5483, "Unicorn Fantasy", 5000), + + UNICORN_FANTASY_7237(7237, "Unicorn Fantasy", 5000), + + PANTHER(7341, "Panther", 10), + + BEACH_HOUSE(5803, "Beach House", 9999), + + GOLD_NECKLACE(5599, "Gold necklace", 200), + + MPL_TROPHY(7119, "MPL Trophy", 450), + + OCTOPUS(8417, "Octopus", 10000), + + PIM_BEAR(9043, "Pim Bear", 1500), + + SIGNATURE_JET(7124, "Signature Jet", 4888), + + CAP(6104, "Cap", 99), + + BLUE_BEAD(5319, "Blue Bead", 5), + + TIKTOK_RED_CARPET(6542, "TikTok Red Carpet", 6600), + + CAT(6345, "Cat", 3999), + + STARS_SNAP(8581, "Stars Snap", 10), + + SUPERB_TEAM(8202, "Superb Team", 1), + + GLOWING_JELLYFISH(8978, "Glowing Jellyfish", 1000), + + RAINING_GIFTS(8769, "Raining gifts", 999), + + NACHOS(7088, "Nachos", 9), + + APPETIZERS(6106, "Appetizers", 19), + + LOVE_LETTER(7932, "Love Letter", 1), + + DANCING_CACTUS(6532, "Dancing Cactus", 299), + + EARTH(5906, "Earth", 1), + + BUMPER_CARS(5996, "Bumper Cars", 1288), + + CAKE_SLICE(6784, "Cake Slice", 1), + + CROCODILE(8740, "Crocodile", 10), + + LOVE_YOU_6671(6671, "Love You", 199), + + NO_1_TEAM(8205, "No.1 Team", 5), + + MONSTER_TRUCK(8104, "Monster Truck", 7999), + + SUPERPOWER(8111, "Superpower", 299), + + DIAMOND_CROWN(5561, "Diamond Crown", 1499), + + DIAMOND_CROWN_5604(5604, "Diamond Crown", 1499), + + M4_TROPHY(7544, "M4 Trophy", 450), + + PERFUME(5658, "Perfume", 20), + + KISS_YOUR_HEART(6661, "Kiss your Heart", 99), + + CHESTNUTS(7233, "Chestnuts", 1), + + CHESTNUTS_7296(7296, "Chestnuts", 1), + + DIAMOND_HEART_NECKLACE(5598, "Diamond Heart necklace", 200), + + HAPPY_MOTHER_S_DAY(8455, "Happy Mother's Day", 99), + + HOT_AIR_BALLOON(5976, "Hot Air Balloon", 999), + + TEA(5303, "Tea", 50), + + TEA_6726(6726, "Tea", 20), + + CELEBRATION_RICE(5929, "Celebration Rice", 300), + + JETSKI(5774, "Jetski", 2199), + + CORAL(5731, "Coral", 499), + + GRIFFIN(7987, "Griffin", 25999), + + BEACH_HUT(6719, "Beach Hut", 5000), + + WELCOME(6350, "Welcome", 9), + + THUNDER_FALCON(8651, "Thunder Falcon", 39999), + + BALLOONS(5756, "Balloons", 10); + + private final int id; + + private final String name; + + private final int diamondCost; + + private final Picture picture; + + Gift(int id, String name, int diamondCost) + { + this.id = id; + this.name = name; + this.diamondCost = diamondCost; + this.picture = new Picture("https://storage.streamdps.com/iblock/94f/94f6f0d4bfb3294395007ba45db34a54/e141809d2278e1ca80a5107bce4a16f6.png"); + } + + public boolean hasDiamondCostRange(int minimalCost, int maximalCost) { + return diamondCost >= minimalCost && diamondCost <= maximalCost; + } + + public boolean hasDiamondCost(int cost) { + return diamondCost == cost; + } + + + @Override + public String toString() { + return "Gift{" + + "id=" + id + + ", name='" + name + '\'' + + ", diamondCost=" + diamondCost + + '}'; + } + +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/gifts/GiftSendType.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/gifts/GiftSendType.java new file mode 100644 index 0000000..f6cac7c --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/gifts/GiftSendType.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023-2023 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.data.models.gifts; + +public enum GiftSendType +{ + Finished, + Begin, + Active; + + + public static GiftSendType fromNumber(long number) + { + return switch ((int) number) { + case 0 -> GiftSendType.Finished; + case 1, 2, 4 -> GiftSendType.Active; + default -> GiftSendType.Finished; + }; + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/users/User.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/users/User.java new file mode 100644 index 0000000..0b331f3 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/users/User.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2023-2023 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.data.models.users; + +import io.github.jwdeveloper.tiktok.data.models.badges.Badge; +import io.github.jwdeveloper.tiktok.data.models.Picture; +import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEnvelopeMessage; +import lombok.AccessLevel; +import lombok.Getter; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Getter +public class User { + private final Long id; + private final String name; + private String profileName; + private Picture picture; + private long following; + private long followers; + private List badges; + @Getter(AccessLevel.NONE) + private Set attributes; + + public List getAttributes() { + return attributes.stream().toList(); + } + public boolean hasAttribute(UserAttribute userFlag) { + return attributes.contains(userFlag); + } + + public void addAttribute(UserAttribute... flags) { + this.attributes.addAll(Arrays.stream(flags).toList()); + } + + public boolean isGiftGiver() { + return hasAttribute(UserAttribute.GiftGiver); + } + + public boolean isSubscriber() { + return hasAttribute(UserAttribute.Subscriber); + } + + public boolean isMutualFollowingWithHost() { + return hasAttribute(UserAttribute.MutualFollowingWithLiveHost); + } + + public boolean isFollower() { + return hasAttribute(UserAttribute.Follower); + } + + public boolean isAdmin() { + return hasAttribute(UserAttribute.Admin); + } + + public boolean isMuted() { + return hasAttribute(UserAttribute.Muted); + } + + public boolean isBlocked() { + return hasAttribute(UserAttribute.Blocked); + } + + public boolean isModerator() { + return hasAttribute(UserAttribute.Moderator); + } + + public boolean isLiveHost() { + return hasAttribute(UserAttribute.LiveHost); + } + + public User(Long userId, + String nickName, + Picture profilePicture, + Integer following, + Integer followers, + List badges) { + this.id = userId; + this.name = nickName; + this.picture = profilePicture; + this.following = following; + this.followers = followers; + this.badges = badges; + this.attributes = new HashSet<>(); + } + + public User(Long userId, + String nickName) { + this.id = userId; + this.name = nickName; + this.attributes = new HashSet<>(); + } + + public User(Long userId, + String nickName, + Picture picture) { + this(userId, nickName); + this.picture = picture; + } + + public User(io.github.jwdeveloper.tiktok.messages.data.User user) { + this(user.getId(), user.getDisplayId(), Picture.map(user.getAvatarThumb())); + profileName = user.getNickname(); + following = user.getFollowInfo().getFollowingCount(); + followers = user.getFollowInfo().getFollowerCount(); + badges = user.getBadgeListList().stream().map(Badge::map).toList(); + if (user.getIsFollower()) { + addAttribute(UserAttribute.Follower); + } + if (user.getSubscribeInfo() != null && user.getSubscribeInfo().getIsSubscribedToAnchor()) { + addAttribute(UserAttribute.Subscriber); + } + if (user.getUserAttr().getIsAdmin()) { + addAttribute(UserAttribute.Admin); + } + if (user.getUserAttr().getIsMuted()) { + addAttribute(UserAttribute.Muted); + } + if (user.getIsBlock()) { + addAttribute(UserAttribute.Blocked); + } + } + + + public static User EMPTY = new User(0L, + "", + Picture.Empty(), + 0, + 0, + List.of(Badge.empty())); + + public static User map(io.github.jwdeveloper.tiktok.messages.data.User user) { + return new User(user); + } + + public static User map(io.github.jwdeveloper.tiktok.messages.data.User user, + io.github.jwdeveloper.tiktok.messages.data.UserIdentity userIdentity) { + var outUser = map(user); + + if (userIdentity.getIsGiftGiverOfAnchor()) { + outUser.addAttribute(UserAttribute.GiftGiver); + } + if (userIdentity.getIsSubscriberOfAnchor()) { + outUser.addAttribute(UserAttribute.Subscriber); + } + if (userIdentity.getIsMutualFollowingWithAnchor()) { + outUser.addAttribute(UserAttribute.MutualFollowingWithLiveHost); + } + if (userIdentity.getIsFollowerOfAnchor()) { + outUser.addAttribute(UserAttribute.Follower); + } + if (userIdentity.getIsModeratorOfAnchor()) { + outUser.addAttribute(UserAttribute.Moderator); + } + if (userIdentity.getIsAnchor()) { + outUser.addAttribute(UserAttribute.LiveHost); + } + return outUser; + } + + public static User map(io.github.jwdeveloper.tiktok.messages.data.VoteUser user) { + return new User(user.getUserId(), user.getNickName()); + } + + public static User map(WebcastEnvelopeMessage.EnvelopeInfo envelopeInfo) { + return new User(0L, + //envelopeInfo.getSendUserId(), + envelopeInfo.getSendUserName(), + Picture.map(envelopeInfo.getSendUserAvatar()), + 0, + 0, + List.of(Badge.empty())); + } +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/users/UserAttribute.java b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/users/UserAttribute.java new file mode 100644 index 0000000..4dea4b3 --- /dev/null +++ b/API/src/main/java/io/github/jwdeveloper/tiktok/data/models/users/UserAttribute.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023-2023 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.data.models.users; + +public enum UserAttribute +{ + GiftGiver, Subscriber, Follower, Moderator, LiveHost, MutualFollowingWithLiveHost,Admin,Blocked,Muted +} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEvent.java deleted file mode 100644 index 1ac8481..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.github.jwdeveloper.tiktok.events; - -import io.github.jwdeveloper.tiktok.messages.*; -import lombok.Getter; - -/* - Base class for all events - */ -@Getter -public abstract class TikTokEvent -{ - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEventBuilder.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEventBuilder.java deleted file mode 100644 index b851743..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEventBuilder.java +++ /dev/null @@ -1,97 +0,0 @@ -package io.github.jwdeveloper.tiktok.events; - -import io.github.jwdeveloper.tiktok.events.messages.*; - - -public interface TikTokEventBuilder { - T onUnhandledSocial(TikTokEventConsumer event); - - T onLinkMicFanTicket(TikTokEventConsumer event); - - T onEnvelope(TikTokEventConsumer event); - - T onShopMessage(TikTokEventConsumer event); - - T onDetectMessage(TikTokEventConsumer event); - - T onLinkLayerMessage(TikTokEventConsumer event); - - T onConnected(TikTokEventConsumer event); - - T onCaption(TikTokEventConsumer event); - - T onQuestion(TikTokEventConsumer event); - - T onRoomPinMessage(TikTokEventConsumer event); - - T onRoomMessage(TikTokEventConsumer event); - - T onLivePaused(TikTokEventConsumer event); - - T onLike(TikTokEventConsumer event); - - T onLinkMessage(TikTokEventConsumer event); - - T onBarrageMessage(TikTokEventConsumer event); - - T onGiftMessage(TikTokEventConsumer event); - - T onLinkMicArmies(TikTokEventConsumer event); - - T onEmote(TikTokEventConsumer event); - - T onUnauthorizedMember(TikTokEventConsumer event); - - T onInRoomBanner(TikTokEventConsumer event); - - T onLinkMicMethod(TikTokEventConsumer event); - - T onSubscribe(TikTokEventConsumer event); - - T onPollMessage(TikTokEventConsumer event); - - T onFollow(TikTokEventConsumer event); - - T onRoomViewerData(TikTokEventConsumer event); - - T onGoalUpdate(TikTokEventConsumer event); - - T onComment(TikTokEventConsumer event); - - T onRankUpdate(TikTokEventConsumer event); - - T onIMDelete(TikTokEventConsumer event); - - T onLiveEnded(TikTokEventConsumer event); - - T onError(TikTokEventConsumer event); - - T onUnhandled(TikTokEventConsumer event); - - T onJoin(TikTokEventConsumer event); - - T onRankText(TikTokEventConsumer event); - - T onShare(TikTokEventConsumer event); - - T onUnhandledMember(TikTokEventConsumer event); - - T onSubNotify(TikTokEventConsumer event); - - T onLinkMicBattle(TikTokEventConsumer event); - - T onDisconnected(TikTokEventConsumer event); - - T onGiftBroadcast(TikTokEventConsumer event); - - T onUnhandledControl(TikTokEventConsumer event); - - T onEvent(TikTokEventConsumer event); - - T onWebsocketMessage(TikTokEventConsumer event); - - T onReconnecting(TikTokEventConsumer event); - -} - - diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEventConsumer.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEventConsumer.java deleted file mode 100644 index 1156f4a..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/TikTokEventConsumer.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.github.jwdeveloper.tiktok.events; - -import io.github.jwdeveloper.tiktok.live.LiveClient; - -public interface TikTokEventConsumer -{ - void onEvent(LiveClient liveClient, T event); -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokHeaderEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokHeaderEvent.java deleted file mode 100644 index c80e9d8..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokHeaderEvent.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.base; - -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.messages.*; -import lombok.Getter; - -@Getter -public class TikTokHeaderEvent extends TikTokEvent { - private final long messageId; - private final long roomId; - private final long timeStamp; - - public TikTokHeaderEvent(Common header) { - this(header.getMsgId(), header.getRoomId(), header.getCreateTime()); - } - - public TikTokHeaderEvent(MessageHeader header) { - this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1()); - } - - public TikTokHeaderEvent(GiftMessageHeader header) { - this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1()); - } - - public TikTokHeaderEvent(MemberMessageHeader header) { - this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1()); - } - - public TikTokHeaderEvent(SocialMessageHeader header) { - this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1()); - } - - public TikTokHeaderEvent(LikeMessageHeader header) { - this(header.getMessageId(), header.getRoomId(), header.getTimeStamp1()); - } - - public TikTokHeaderEvent(long messageId, long roomId, long timeStamp) { - this.messageId = messageId; - this.roomId = roomId; - this.timeStamp = timeStamp; - } - - public TikTokHeaderEvent() { - messageId = 0; - roomId = 0; - timeStamp = 0; - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokLiveClientEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokLiveClientEvent.java deleted file mode 100644 index 415b380..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokLiveClientEvent.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.base; - -import io.github.jwdeveloper.tiktok.events.TikTokEvent; - - -public class TikTokLiveClientEvent extends TikTokEvent { -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokUnhandledEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokUnhandledEvent.java deleted file mode 100644 index 398d712..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/base/TikTokUnhandledEvent.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.base; - -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class TikTokUnhandledEvent extends TikTokEvent -{ - private final T data; -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokBarrageMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokBarrageMessageEvent.java deleted file mode 100644 index 0a27aba..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokBarrageMessageEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.BarrageData; -import io.github.jwdeveloper.tiktok.events.objects.Picture; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastBarrageMessage; -import lombok.Value; - -@Value -@EventMeta(eventType = EventType.Message) -public class TikTokBarrageMessageEvent extends TikTokHeaderEvent { - Picture picture; - Picture picture2; - Picture picture3; - User user; - BarrageData barrageData; - public TikTokBarrageMessageEvent(WebcastBarrageMessage msg) { - super(msg.getHeader()); - - picture = new Picture(msg.getImage()); - picture2 = new Picture(msg.getImage2()); - picture3 = new Picture(msg.getImage3()); - user = new User(msg.getUserData().getUser()); - barrageData = new BarrageData(msg.getMessage().getEventType(), - msg.getMessage().getLabel(), - msg.getMessage().getData1List().stream().map(e -> - { - var user = new User(e.getUser().getUser()); - return new BarrageData.BarrageUser(user, e.getData2()); - }).toList() - ); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokCaptionEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokCaptionEvent.java deleted file mode 100644 index c3a1746..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokCaptionEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastCaptionMessage; -import lombok.Value; - -@Value -@EventMeta(eventType = EventType.Message) -public class TikTokCaptionEvent extends TikTokHeaderEvent { - Long captionTimeStamp; - - String iSOLanguage; - - String text; - - public TikTokCaptionEvent(WebcastCaptionMessage msg) { - super(msg.getHeader()); - captionTimeStamp = msg.getTimeStamp(); - iSOLanguage = msg.getCaptionData().getISOLanguage(); - text = msg.getCaptionData().getText(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokCommentEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokCommentEvent.java deleted file mode 100644 index 1a66ef6..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokCommentEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.Picture; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastChatMessage; -import io.github.jwdeveloper.tiktok.messages.WebcastRoomPinMessage; -import lombok.Value; - -import java.util.ArrayList; -import java.util.List; - -@Value -@EventMeta(eventType = EventType.Message) -public class TikTokCommentEvent extends TikTokHeaderEvent { - User user; - String text; - String language; - List mentionedUsers; - List pictures; - - public TikTokCommentEvent(WebcastRoomPinMessage.RoomPinMessageData data) { - super(data.getDetails().getRoomId(), data.getDetails().getMessageId(), data.getDetails().getServerTime()); - user = User.MapOrEmpty(data.getSender()); - text = data.getComment(); - language = data.getLanguage(); - mentionedUsers = new ArrayList<>(); - pictures = new ArrayList<>(); - } - - public TikTokCommentEvent(WebcastChatMessage msg) { - super(msg.getCommon()); - user = User.MapOrEmpty(msg.getUser()); - text = msg.getContent(); - language = msg.getContentLanguage(); - mentionedUsers = List.of(User.MapOrEmpty(msg.getAtUser())); - pictures = msg.getEmotesListList().stream().map(e -> new Picture(e.getEmote().getImage())).toList(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokConnectedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokConnectedEvent.java deleted file mode 100644 index 0d5ac90..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokConnectedEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokLiveClientEvent; -@EventMeta(eventType = EventType.Control) -public class TikTokConnectedEvent extends TikTokLiveClientEvent -{ - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokDetectMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokDetectMessageEvent.java deleted file mode 100644 index 3384874..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokDetectMessageEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastMsgDetectMessage; -import lombok.Getter; - -import java.util.List; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokDetectMessageEvent extends TikTokHeaderEvent { - String language; - - List data; - - List timings; - - public TikTokDetectMessageEvent(WebcastMsgDetectMessage msg) { - super(msg.getHeader());; - language = msg.getLanguage(); - data = List.of(msg.getData2().getData1(), msg.getData2().getData2(), msg.getData2().getData3()); - timings= List.of(msg.getTimestamps().getTimestamp1(), msg.getTimestamps().getTimestamp2(), msg.getTimestamps().getTimestamp3()); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokDisconnectedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokDisconnectedEvent.java deleted file mode 100644 index 3f65039..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokDisconnectedEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokLiveClientEvent; - -@EventMeta(eventType = EventType.Control) -public class TikTokDisconnectedEvent extends TikTokLiveClientEvent { -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokEmoteEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokEmoteEvent.java deleted file mode 100644 index 9738088..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokEmoteEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.Picture; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastEmoteChatMessage; -import lombok.Value; - -@Value -@EventMeta(eventType = EventType.Message) -public class TikTokEmoteEvent extends TikTokHeaderEvent { - User user; - String emoteId; - Picture picture; - - public TikTokEmoteEvent(WebcastEmoteChatMessage msg) { - super(msg.getHeader()); - user = User.MapOrEmpty(msg.getSender()); - emoteId = msg.getDetails().getId(); - picture = new Picture(msg.getDetails().getImage().getUrl()); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokEnvelopeEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokEnvelopeEvent.java deleted file mode 100644 index 8ad5b61..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokEnvelopeEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastEnvelopeMessage; -import lombok.Getter; -import lombok.Value; - -@Value -@EventMeta(eventType = EventType.Message) -public class TikTokEnvelopeEvent extends TikTokHeaderEvent { - User user; - public TikTokEnvelopeEvent(WebcastEnvelopeMessage msg) { - super(msg.getHeader()); - user = new User(msg.getUser().getId(), msg.getUser().getUsername()); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokErrorEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokErrorEvent.java deleted file mode 100644 index 57bd973..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokErrorEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokLiveClientEvent; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -@EventMeta(eventType = EventType.Control) -public class TikTokErrorEvent extends TikTokLiveClientEvent -{ - private final Throwable exception; -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokFollowEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokFollowEvent.java deleted file mode 100644 index 75e0533..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokFollowEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage; -import lombok.Value; - -@Value -@EventMeta(eventType = EventType.Custom) -public class TikTokFollowEvent extends TikTokHeaderEvent -{ - User newFollower; - Long totalFollowers; - - public TikTokFollowEvent(WebcastSocialMessage msg) { - super(msg.getHeader()); - newFollower = User.MapOrEmpty(msg.getSender()); - totalFollowers = msg.getTotalFollowers(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGiftBroadcastEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGiftBroadcastEvent.java deleted file mode 100644 index 88873eb..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGiftBroadcastEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.Picture; -import io.github.jwdeveloper.tiktok.messages.WebcastGiftBroadcastMessage; -import lombok.Getter; -import lombok.Value; - -@Value -@EventMeta(eventType = EventType.Message) -public class TikTokGiftBroadcastEvent extends TikTokHeaderEvent -{ - Picture picture; - - String shortURL; - - String notifyEventType; - - String notifyLabel; - - String notifyType; - - public TikTokGiftBroadcastEvent(WebcastGiftBroadcastMessage msg) - { - super(msg.getHeader()); - picture = new Picture(msg.getImage()); - var data = msg.getData(); - shortURL = data.getUri(); - notifyEventType = data.getRoomNotifyMessage().getData().getType(); - notifyLabel = data.getRoomNotifyMessage().getData().getLabel(); - notifyType = data.getNotifyType(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGiftMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGiftMessageEvent.java deleted file mode 100644 index 505a475..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGiftMessageEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.Gift; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastGiftMessage; -import lombok.Value; - -@Value -@EventMeta(eventType = EventType.Message) -public class TikTokGiftMessageEvent extends TikTokHeaderEvent { - - Gift gift; - User sender; - String purchaseId; - String receipt; - Long comboCount; - Boolean streakFinished; - Long streakIndex; - - public TikTokGiftMessageEvent(WebcastGiftMessage msg) { - super(msg.getCommon()); - gift = new Gift(msg.getGift()); - sender = User.MapOrEmpty(msg.getUser()); - purchaseId = msg.getLogId(); - receipt = msg.getMonitorExtra(); - comboCount = msg.getComboCount(); - streakFinished = msg.getRepeatEnd() > 0; //todo check values - streakIndex = msg.getRepeatCount(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGoalUpdateEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGoalUpdateEvent.java deleted file mode 100644 index 6794e7a..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokGoalUpdateEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.Picture; - -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastGoalUpdateMessage; -import lombok.Getter; - -import java.util.List; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokGoalUpdateEvent extends TikTokHeaderEvent -{ - private final Long goalId; - private final Picture picture; - private final String eventType; - private final String label; - private final List users; - - public TikTokGoalUpdateEvent(WebcastGoalUpdateMessage msg) { - super(msg.getHeader()); - picture = new Picture(msg.getImage()); - goalId = msg.getId(); - eventType = msg.getData().getType(); - label = msg.getUpdateData().getLabel(); - users = msg.getUpdateData().getUsersList().stream().map(u ->new User(u.getId(),u.getNickname(),new Picture(u.getProfileImage()))).toList(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokIMDeleteEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokIMDeleteEvent.java deleted file mode 100644 index e9cd408..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokIMDeleteEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastImDeleteMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokIMDeleteEvent extends TikTokHeaderEvent { - private final byte[] data; - - public TikTokIMDeleteEvent(WebcastImDeleteMessage msg) { - super(msg.getHeader()); - data = msg.getData().toByteArray(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokInRoomBannerEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokInRoomBannerEvent.java deleted file mode 100644 index 4c2aec0..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokInRoomBannerEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastInRoomBannerMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokInRoomBannerEvent extends TikTokHeaderEvent { - private final String jSON; - - public TikTokInRoomBannerEvent(WebcastInRoomBannerMessage msg) { - super(msg.getHeader());; - jSON = msg.getJson(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokJoinEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokJoinEvent.java deleted file mode 100644 index e201ffd..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokJoinEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage; -import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Custom) -public class TikTokJoinEvent extends TikTokHeaderEvent { - private User user; - private final Long totalViewers; - - public TikTokJoinEvent(WebcastSocialMessage msg) { - super(msg.getHeader()); - - if (msg.hasSender()) { - user = new User(msg.getSender()); - } - - totalViewers = 0L; - } - - public TikTokJoinEvent(WebcastMemberMessage msg) { - super(msg.getHeader()); - if (msg.hasUser()) { - user = new User(msg.getUser()); - } - totalViewers = msg.getTotalViewers(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLikeEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLikeEvent.java deleted file mode 100644 index 5d1d34e..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLikeEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastLikeMessage; -import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Custom) -public class TikTokLikeEvent extends TikTokHeaderEvent -{ - private User sender; - - private final Integer count; - - private final Long totalLikes; - - public TikTokLikeEvent(WebcastSocialMessage msg) { - super(msg.getHeader()); - if (msg.hasSender()) { - sender = new User(msg.getSender()); - } - count = 1; - totalLikes = 0L; - } - - public TikTokLikeEvent(WebcastLikeMessage msg) { - super(msg.getHeader()); - - if (msg.hasSender()) { - sender = new User(msg.getSender()); - } - - count = msg.getCount(); - totalLikes = msg.getTotalLikes(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkLayerMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkLayerMessageEvent.java deleted file mode 100644 index eee5179..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkLayerMessageEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastLinkLayerMessage; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokLinkLayerMessageEvent extends TikTokHeaderEvent { - private final Long linkId; - private final LinkData link1; - private final LinkData link2; - - public TikTokLinkLayerMessageEvent(WebcastLinkLayerMessage msg) { - super(msg.getHeader()); - linkId = msg.getId(); - link1 = new LinkData(msg.getIdContainer1().getIds().getId1(), msg.getIdContainer1().getIds().getId2()); - link2 = new LinkData(msg.getIdContainer2().getIds().getId1(), msg.getIdContainer2().getIds().getId2()); - } - - @AllArgsConstructor - @Getter - private class LinkData { - private final Long id1; - private final Long id2; - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMessageEvent.java deleted file mode 100644 index 2373b10..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMessageEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastLinkMessage; -import lombok.Getter; - -import java.util.List; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokLinkMessageEvent extends TikTokHeaderEvent { - private final String token; - - private User user; - - private final List otherUsers; - - public TikTokLinkMessageEvent(WebcastLinkMessage msg) { - super(msg.getHeader()); - token = msg.getToken(); - if (msg.getUser().getUser().hasUser()) { - user = new User(msg.getUser().getUser().getUser()); - } - otherUsers = msg.getUser().getOtherUsersList().stream().map(e -> new User(e.getUser())).toList(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicArmiesEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicArmiesEvent.java deleted file mode 100644 index 4dbf246..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicArmiesEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.LinkMicArmy; -import io.github.jwdeveloper.tiktok.events.objects.Picture; -import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicArmies; -import lombok.Getter; - -import java.util.List; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokLinkMicArmiesEvent extends TikTokHeaderEvent { - private final Long battleId; - - private final Integer battleStatus; - - private final Picture picture; - - private final List armies; - - public TikTokLinkMicArmiesEvent(WebcastLinkMicArmies msg) { - super(msg.getHeader()); - battleId = msg.getId(); - armies = msg.getBattleItemsList().stream().map(LinkMicArmy::new).toList(); - picture = new Picture(msg.getImage()); - battleStatus = msg.getBattleStatus(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicBattleEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicBattleEvent.java deleted file mode 100644 index 011bdef..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicBattleEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.LinkMicBattleTeam; -import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicBattle; -import lombok.Getter; - -import java.util.List; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent { - private final Long battleId; - private final List team1; - private final List team2; - - public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) { - super(msg.getHeader()); - battleId = msg.getId(); - team1 = msg.getTeams1List().stream().map(LinkMicBattleTeam::new).toList(); - team2 = msg.getTeams2List().stream().map(LinkMicBattleTeam::new).toList(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicFanTicketEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicFanTicketEvent.java deleted file mode 100644 index f1273b8..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicFanTicketEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicFanTicketMethod; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokLinkMicFanTicketEvent extends TikTokHeaderEvent { - private final Long id; - private final Integer data1; - private final Integer data2; - - public TikTokLinkMicFanTicketEvent(WebcastLinkMicFanTicketMethod msg) { - super(msg.getHeader()); - id = msg.getData().getDetails().getId(); - data1 = msg.getData().getData1(); - data2 = msg.getData().getDetails().getData(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicMethodEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicMethodEvent.java deleted file mode 100644 index 617d909..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLinkMicMethodEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.LinkMicMethod; -import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicMethod; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokLinkMicMethodEvent extends TikTokHeaderEvent { - private final String jSON; - - public TikTokLinkMicMethodEvent(WebcastLinkMicMethod msg) { - super(msg.getHeader());; - jSON = ""; - } - - public TikTokLinkMicMethodEvent(LinkMicMethod msg) { - super(msg.getHeader());; - jSON = msg.getJson(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLiveEndedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLiveEndedEvent.java deleted file mode 100644 index 665c0f8..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLiveEndedEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; - -@EventMeta(eventType = EventType.Custom) -public class TikTokLiveEndedEvent extends TikTokEvent { -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLivePausedEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLivePausedEvent.java deleted file mode 100644 index b96726c..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokLivePausedEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; - -@EventMeta(eventType = EventType.Custom) -public class TikTokLivePausedEvent extends TikTokEvent { -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokPollMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokPollMessageEvent.java deleted file mode 100644 index 5f76f7b..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokPollMessageEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.PollOption; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastPollMessage; -import lombok.Getter; - -import java.util.List; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokPollMessageEvent extends TikTokHeaderEvent { - private final Long id; - - private final PollOption option1; - - private final PollOption option2; - - private final List options; - - public TikTokPollMessageEvent(WebcastPollMessage msg) { - super(msg.getHeader()); - id = msg.getId(); - options = msg.getPollData().getOptionsList().stream().map(e -> new PollOption.Option(e.getLabel(), e.getCurrentTotal())).toList(); - option1 = new PollOption(new User(msg.getOptions1().getUser()), msg.getOptions1().getOptionsList().stream().map(e -> new PollOption.Option(e.getLabel(), e.getCurrentTotal())).toList()); - option2 = new PollOption(new User(msg.getOptions2().getUser()), msg.getOptions2().getOptionsList().stream().map(e -> new PollOption.Option(e.getLabel(), e.getCurrentTotal())).toList()); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokQuestionEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokQuestionEvent.java deleted file mode 100644 index c3322b4..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokQuestionEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastQuestionNewMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokQuestionEvent extends TikTokHeaderEvent { - private final Long questionId; - - private final String text; - - private final Long time; - - private User user; - - - public TikTokQuestionEvent(WebcastQuestionNewMessage msg) { - super(msg.getHeader()); - var data = msg.getDetails(); - questionId = data.getId(); - text = data.getText(); - time = data.getTimeStamp(); - if (data.hasUser()) { - user = new User(data.getUser()); - } - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRankTextEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRankTextEvent.java deleted file mode 100644 index bc39336..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRankTextEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastRankTextMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokRankTextEvent extends TikTokHeaderEvent { - private final String eventType; - - private final String label; - - - public TikTokRankTextEvent(WebcastRankTextMessage msg) { - super(0,0,0);//TODO passing info - eventType = msg.getDetails().getType(); - label =msg.getDetails().getLabel(); - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRankUpdateEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRankUpdateEvent.java deleted file mode 100644 index 7962cf5..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRankUpdateEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastHourlyRankMessage; -import io.github.jwdeveloper.tiktok.messages.WebcastRankUpdateMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokRankUpdateEvent extends TikTokHeaderEvent { - private final String eventType; - - private final String label; - - private final String rank; - - private final String color; - - public TikTokRankUpdateEvent(WebcastHourlyRankMessage msg) { - super(msg.getHeader()); - var rankData = msg.getData().getRankings(); - eventType = rankData.getType(); - label = rankData.getLabel(); - if(rankData.getDetailsList().isEmpty()) - { - rank = ""; - } - else - { - rank = rankData.getDetails(0).getLabel(); - } - color = rankData.getColor().getColor(); - } - - public TikTokRankUpdateEvent(WebcastRankUpdateMessage msg) { - super(msg.getHeader()); - var rankData = msg.getData().getRankData(); - eventType = rankData.getType(); - label = rankData.getLabel(); - if(rankData.getDetailsList().isEmpty()) - { - rank = ""; - } - else - { - rank = rankData.getDetails(0).getLabel(); - } - color = rankData.getColor().getColor(); - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokReconnectingEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokReconnectingEvent.java deleted file mode 100644 index ba7c348..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokReconnectingEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokLiveClientEvent; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Control) -public class TikTokReconnectingEvent extends TikTokLiveClientEvent -{ - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomMessageEvent.java deleted file mode 100644 index 3140cfd..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomMessageEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.RoomMessage; -import io.github.jwdeveloper.tiktok.messages.SystemMessage; -import io.github.jwdeveloper.tiktok.messages.WebcastLiveIntroMessage; -import io.github.jwdeveloper.tiktok.messages.WebcastRoomMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokRoomMessageEvent extends TikTokHeaderEvent { - private User host; - private String hostLanguage; - private final String message; - - public TikTokRoomMessageEvent(WebcastRoomMessage msg) { - super(msg.getHeader()); - message = msg.getData(); - } - - public TikTokRoomMessageEvent(SystemMessage msg) { - super(msg.getHeader()); - message = msg.getMessage(); - } - - public TikTokRoomMessageEvent(RoomMessage msg) { - super(msg.getHeader()); - message = msg.getMessage(); - } - - public TikTokRoomMessageEvent(WebcastLiveIntroMessage msg) { - super(msg.getHeader()); - if (msg.hasHost()) { - host = new User(msg.getHost()); - } - message = msg.getDescription(); - hostLanguage = msg.getLanguage(); - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomPinMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomPinMessageEvent.java deleted file mode 100644 index 659ab39..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomPinMessageEvent.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastRoomPinMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokRoomPinMessageEvent extends TikTokHeaderEvent { - private final Long pinTimeStamp; - private final TikTokCommentEvent comment; - - public TikTokRoomPinMessageEvent(WebcastRoomPinMessage msg) { - super(msg.getHeader()); - this.pinTimeStamp = msg.getTimestamp(); - this.comment = new TikTokCommentEvent(msg.getPinData1()); - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomViewerDataEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomViewerDataEvent.java deleted file mode 100644 index 52dcb8b..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokRoomViewerDataEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.TopViewer; -import io.github.jwdeveloper.tiktok.messages.WebcastRoomUserSeqMessage; -import lombok.Getter; - -import java.util.List; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokRoomViewerDataEvent extends TikTokHeaderEvent { - private final Integer viewerCount; - private final List topViewers; - - public TikTokRoomViewerDataEvent(WebcastRoomUserSeqMessage msg) { - super(msg.getHeader()); - - //TODO sorting by rank TopViewers = msg?.TopViewers?.Select(t => new Objects.TopViewer(t))?.OrderBy(t => t.Rank)? - viewerCount = msg.getViewerCount(); - topViewers = msg.getTopViewersList().stream().map(TopViewer::new).toList(); - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokShareEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokShareEvent.java deleted file mode 100644 index c70192c..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokShareEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Custom) -public class TikTokShareEvent extends TikTokHeaderEvent { - private final User user; - private final Integer amount; - - public TikTokShareEvent(WebcastSocialMessage msg, Integer amount) { - super(msg.getHeader());; - user = User.MapOrEmpty(msg.getSender()); - this.amount = amount; - } - - public TikTokShareEvent(WebcastSocialMessage msg) { - super(msg.getHeader()); - user = User.MapOrEmpty(msg.getSender()); - amount = 1; - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokShopMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokShopMessageEvent.java deleted file mode 100644 index aa01872..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokShopMessageEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.Picture; -import io.github.jwdeveloper.tiktok.messages.WebcastOecLiveShoppingMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokShopMessageEvent extends TikTokHeaderEvent { - private final String title; - - private final String price; - - private final Picture picture; - - private final String shopUrl; - - private final String shopName; - - public TikTokShopMessageEvent(WebcastOecLiveShoppingMessage msg) { - super(msg.getHeader()); - var data = msg.getShopData(); - title = data.getTitle(); - price = data.getPriceString(); - picture = new Picture(data.getImageUrl()); - shopUrl = data.getShopUrl(); - shopName = data.getShopName(); - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokSubNotifyEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokSubNotifyEvent.java deleted file mode 100644 index ede35a8..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokSubNotifyEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastSubNotifyMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokSubNotifyEvent extends TikTokHeaderEvent { - private User user; - - public TikTokSubNotifyEvent(WebcastSubNotifyMessage msg) { - super(msg.getHeader()); - - if (msg.hasSender()) { - user = new User(msg.getSender()); - } - - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokSubscribeEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokSubscribeEvent.java deleted file mode 100644 index 0f5a924..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokSubscribeEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.events.objects.User; -import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Custom) -public class TikTokSubscribeEvent extends TikTokHeaderEvent { - private User newSubscriber; - - public TikTokSubscribeEvent(WebcastMemberMessage msg) { - super(msg.getHeader()); - - if(msg.hasUser()) - { - newSubscriber = new User(msg.getUser()); - } - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnauthorizedMemberEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnauthorizedMemberEvent.java deleted file mode 100644 index 5a97696..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnauthorizedMemberEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokHeaderEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastUnauthorizedMemberMessage; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokUnauthorizedMemberEvent extends TikTokHeaderEvent { - private final String data; - - private final UnauthorizedMemberData event; - - private final UnauthorizedMemberData underlying; - - public TikTokUnauthorizedMemberEvent(WebcastUnauthorizedMemberMessage msg) { - super(msg.getHeader()); - - data = msg.getData2(); - event = new UnauthorizedMemberData(msg.getDetails1().getType(), msg.getDetails1().getLabel()); - underlying = new UnauthorizedMemberData(msg.getDetails2().getType(), msg.getDetails2().getLabel()); - } - - - @Getter - @AllArgsConstructor - public class UnauthorizedMemberData { - private final String data1; - - private final String data2; - } - -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledControlEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledControlEvent.java deleted file mode 100644 index 390cdfd..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledControlEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastControlMessage; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Custom) -public class TikTokUnhandledControlEvent extends TikTokUnhandledEvent { - - public TikTokUnhandledControlEvent(WebcastControlMessage data) { - super(data); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledMemberEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledMemberEvent.java deleted file mode 100644 index ecdd893..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledMemberEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokUnhandledMemberEvent extends TikTokUnhandledEvent -{ - public TikTokUnhandledMemberEvent(WebcastMemberMessage data) { - super(data); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledSocialEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledSocialEvent.java deleted file mode 100644 index a400cad..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledSocialEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastMemberMessage; -import io.github.jwdeveloper.tiktok.messages.WebcastSocialMessage; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@EventMeta(eventType = EventType.Custom) -public class TikTokUnhandledSocialEvent extends TikTokUnhandledEvent -{ - public TikTokUnhandledSocialEvent(WebcastSocialMessage data) { - super(data); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledWebsocketMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledWebsocketMessageEvent.java deleted file mode 100644 index bdd7e40..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokUnhandledWebsocketMessageEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.events.base.TikTokUnhandledEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastResponse; -import lombok.AllArgsConstructor; -import lombok.Getter; - - -@Getter -@EventMeta(eventType = EventType.Message) -public class TikTokUnhandledWebsocketMessageEvent extends TikTokUnhandledEvent -{ - public TikTokUnhandledWebsocketMessageEvent(WebcastResponse.Message data) { - super(data); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokWebsocketMessageEvent.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokWebsocketMessageEvent.java deleted file mode 100644 index 5808ebc..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/messages/TikTokWebsocketMessageEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.messages; - -import io.github.jwdeveloper.tiktok.annotations.EventMeta; -import io.github.jwdeveloper.tiktok.annotations.EventType; -import io.github.jwdeveloper.tiktok.events.TikTokEvent; -import io.github.jwdeveloper.tiktok.messages.WebcastResponse; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.Getter; - - -/** - * Happens when TikTok websocket receive message from server - */ -@Getter -@AllArgsConstructor -@EventMeta(eventType = EventType.Custom) -public class TikTokWebsocketMessageEvent extends TikTokEvent -{ - private TikTokEvent event; - - private WebcastResponse.Message message; -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Badge.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Badge.java deleted file mode 100644 index d0c03ec..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Badge.java +++ /dev/null @@ -1,77 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - -import io.github.jwdeveloper.tiktok.messages.BadgeStruct; -import lombok.Value; - -import java.util.ArrayList; -import java.util.List; - -@Value -public class Badge { - ComboBadge comboBadges; - List textBadges; - List imageBadges; - - public Badge(ComboBadge comboBadges, List textBadges, List imageBadges) { - this.comboBadges = comboBadges; - this.textBadges = textBadges; - this.imageBadges = imageBadges; - } - - public Badge(io.github.jwdeveloper.tiktok.messages.BadgeStruct badge) - { - comboBadges = ComboBadge.map(badge.getCombine()); - textBadges = TextBadge.mapAll(badge.getTextList()); - imageBadges = ImageBadge.mapAll(badge.getImageList()); - } - - @Value - public static class TextBadge { - EnumValue type; - String name; - - public static TextBadge map(BadgeStruct.TextBadge input) { - return new TextBadge(EnumValue.Map(input.getDisplayType()),input.getKey()); - } - public static List mapAll(List list) { - return list.stream().map(TextBadge::map).toList(); - } - } - - @Value - public static class ImageBadge { - EnumValue displayType; - Picture image; - - public static ImageBadge map(BadgeStruct.ImageBadge input) { - return new ImageBadge(EnumValue.Map(input.getDisplayType()), Picture.Map(input.getImage())); - } - public static List mapAll(List list) { - return list.stream().map(ImageBadge::map).toList(); - } - } - - @Value - public static class ComboBadge { - Picture image; - String data; - - public static ComboBadge map(BadgeStruct.CombineBadge input) { - return new ComboBadge(Picture.Map(input.getIcon()),input.getStr()); - } - public static List mapAll(List list) { - return list.stream().map(ComboBadge::map).toList(); - } - } - - public static Badge Empty() { - var comboBadge = new ComboBadge(Picture.Empty(), ""); - var textBadges = new ArrayList(); - var imageBadges = new ArrayList(); - return new Badge(comboBadge, textBadges, imageBadges); - } - - public static List EmptyList() { - return new ArrayList(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/BarrageData.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/BarrageData.java deleted file mode 100644 index 449d2d0..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/BarrageData.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Value; - -import java.util.List; - -@Value -public class BarrageData { - String eventType; - String label; - List users; - - public BarrageData(String eventType, String label, List users) - { - this.eventType = eventType; - this.label = label; - this.users = users; - } - - @Value - public static class BarrageUser - { - User user; - - String data; - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/EnumValue.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/EnumValue.java deleted file mode 100644 index e9ce817..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/EnumValue.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - -import lombok.Value; - -@Value -public class EnumValue -{ - public int value; - public String name; - - public static EnumValue Map(Enum _enum) - { - return new EnumValue(_enum.ordinal() ,_enum.name()); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Gift.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Gift.java deleted file mode 100644 index e550286..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Gift.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - -import lombok.Value; - -@Value -public class Gift { - Long id; - String name; - String description; - Integer diamondCost; - Integer type; - Picture picture; - - public Gift(io.github.jwdeveloper.tiktok.messages.GiftStruct gift) { - id = gift.getId(); - name = gift.getName(); - description = gift.getDescribe(); - diamondCost = gift.getDiamondCount(); - type = gift.getType(); - picture = new Picture(gift.getImage()); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/LinkMicArmy.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/LinkMicArmy.java deleted file mode 100644 index 28ce279..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/LinkMicArmy.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - -import io.github.jwdeveloper.tiktok.messages.LinkMicArmiesItems; -import lombok.Value; - -import java.util.List; - -@Value -public class LinkMicArmy { - Long armyId; - List armies; - - public LinkMicArmy(LinkMicArmiesItems army) { - armyId = army.getHostUserId(); - armies = army.getBattleGroupsList() - .stream() - .map(x -> new Army(x.getUsersList().stream().map(User::MapOrEmpty).toList(), x.getPoints())) - - - .toList(); - } - - @Value - public static class Army { - List Users; - Integer Points; - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/LinkMicBattleTeam.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/LinkMicBattleTeam.java deleted file mode 100644 index 6432a0f..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/LinkMicBattleTeam.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - - -import io.github.jwdeveloper.tiktok.messages.WebcastLinkMicBattle; -import lombok.Getter; -import lombok.Value; - -import java.util.List; - -@Value -public class LinkMicBattleTeam { - Long teamId; - List users; - - public LinkMicBattleTeam(WebcastLinkMicBattle.LinkMicBattleTeam team) { - this.teamId = team.getId(); - this.users = team.getUsersList().stream().map(User::new).toList(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Picture.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Picture.java deleted file mode 100644 index 31adda8..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/Picture.java +++ /dev/null @@ -1,41 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - -import lombok.Getter; -import lombok.Value; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -@Getter -public class Picture { - - List urls; - public Picture(io.github.jwdeveloper.tiktok.messages.Image profilePicture) { - this.urls = profilePicture.getUrlListList(); - } - public Picture(List urls) { - this.urls = urls; - } - - public Picture(String ... urls) - { - this.urls = Arrays.stream(urls).toList(); - } - - - public static Picture Map(io.github.jwdeveloper.tiktok.messages.Image profilePicture) - { - return new Picture(profilePicture.getUrlListList()); - } - - public static Picture Empty() - { - return new Picture(); - } - - public static List EmptyList() - { - return new ArrayList(); - } -} diff --git a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/PollOption.java b/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/PollOption.java deleted file mode 100644 index 326328b..0000000 --- a/API/src/main/java/io/github/jwdeveloper/tiktok/events/objects/PollOption.java +++ /dev/null @@ -1,21 +0,0 @@ -package io.github.jwdeveloper.tiktok.events.objects; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Value; - -import java.util.List; - -@Value -public class PollOption { - - private final User user; - private final List