├── .github └── workflows │ └── maven-publish.yml ├── .gitignore ├── .idea └── protoeditor.xml ├── API ├── pom.xml └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── jwdeveloper │ │ └── tiktok │ │ ├── annotations │ │ ├── EventMeta.java │ │ ├── EventType.java │ │ ├── Priority.java │ │ └── TikTokEventObserver.java │ │ ├── data │ │ ├── dto │ │ │ ├── MessageMetaData.java │ │ │ └── ProxyData.java │ │ ├── events │ │ │ ├── TikTokBarrageEvent.java │ │ │ ├── TikTokCaptionEvent.java │ │ │ ├── TikTokCommentEvent.java │ │ │ ├── TikTokConnectedEvent.java │ │ │ ├── TikTokDetectEvent.java │ │ │ ├── TikTokDisconnectedEvent.java │ │ │ ├── TikTokEmoteEvent.java │ │ │ ├── TikTokEnvelopeEvent.java │ │ │ ├── TikTokErrorEvent.java │ │ │ ├── TikTokGoalUpdateEvent.java │ │ │ ├── TikTokIMDeleteEvent.java │ │ │ ├── TikTokInRoomBannerEvent.java │ │ │ ├── TikTokLinkLayerEvent.java │ │ │ ├── TikTokLinkMicArmiesEvent.java │ │ │ ├── TikTokLinkMicBattleEvent.java │ │ │ ├── TikTokLinkMicFanTicketEvent.java │ │ │ ├── TikTokLinkMicMethodEvent.java │ │ │ ├── TikTokLiveEndedEvent.java │ │ │ ├── TikTokLivePausedEvent.java │ │ │ ├── TikTokLiveUnpausedEvent.java │ │ │ ├── TikTokQuestionEvent.java │ │ │ ├── TikTokRankTextEvent.java │ │ │ ├── TikTokRankUpdateEvent.java │ │ │ ├── TikTokReconnectingEvent.java │ │ │ ├── TikTokShopEvent.java │ │ │ ├── TikTokSubNotifyEvent.java │ │ │ ├── TikTokSubscribeEvent.java │ │ │ ├── TikTokUnauthorizedMemberEvent.java │ │ │ ├── TikTokUnhandledControlEvent.java │ │ │ ├── TikTokUnhandledMemberEvent.java │ │ │ ├── TikTokUnhandledSocialEvent.java │ │ │ ├── common │ │ │ │ ├── TikTokEmptyEvent.java │ │ │ │ ├── TikTokEvent.java │ │ │ │ ├── TikTokHeaderEvent.java │ │ │ │ ├── TikTokLiveClientEvent.java │ │ │ │ └── TikTokUnhandledEvent.java │ │ │ ├── control │ │ │ │ ├── TikTokConnectingEvent.java │ │ │ │ └── TikTokPreConnectionEvent.java │ │ │ ├── envelop │ │ │ │ └── TikTokChestEvent.java │ │ │ ├── gift │ │ │ │ ├── TikTokGiftComboEvent.java │ │ │ │ └── TikTokGiftEvent.java │ │ │ ├── http │ │ │ │ └── TikTokHttpResponseEvent.java │ │ │ ├── link │ │ │ │ ├── TikTokLinkAcceptNoticeEvent.java │ │ │ │ ├── TikTokLinkApplyEvent.java │ │ │ │ ├── TikTokLinkCancelEvent.java │ │ │ │ ├── TikTokLinkCloseEvent.java │ │ │ │ ├── TikTokLinkCohostListChangeEvent.java │ │ │ │ ├── TikTokLinkCreateEvent.java │ │ │ │ ├── TikTokLinkEnterEvent.java │ │ │ │ ├── TikTokLinkEvent.java │ │ │ │ ├── TikTokLinkInviteEvent.java │ │ │ │ ├── TikTokLinkKickOutEvent.java │ │ │ │ ├── TikTokLinkLeaveEvent.java │ │ │ │ ├── TikTokLinkLinkedListChangeEvent.java │ │ │ │ ├── TikTokLinkListChangeEvent.java │ │ │ │ ├── TikTokLinkMediaChangeEvent.java │ │ │ │ ├── TikTokLinkMicIdxUpdateEvent.java │ │ │ │ ├── TikTokLinkMuteEvent.java │ │ │ │ ├── TikTokLinkRandomMatchEvent.java │ │ │ │ ├── TikTokLinkReplyEvent.java │ │ │ │ ├── TikTokLinkSysKickOutEvent.java │ │ │ │ ├── TikTokLinkUpdateUserEvent.java │ │ │ │ ├── TikTokLinkUpdateUserSettingEvent.java │ │ │ │ ├── TikTokLinkUserToastEvent.java │ │ │ │ └── TikTokLinkWaitListChangeEvent.java │ │ │ ├── poll │ │ │ │ ├── TikTokPollEndEvent.java │ │ │ │ ├── TikTokPollEvent.java │ │ │ │ ├── TikTokPollStartEvent.java │ │ │ │ └── TikTokPollUpdateEvent.java │ │ │ ├── room │ │ │ │ ├── TikTokRoomInfoEvent.java │ │ │ │ └── TikTokRoomPinEvent.java │ │ │ ├── social │ │ │ │ ├── TikTokFollowEvent.java │ │ │ │ ├── TikTokJoinEvent.java │ │ │ │ ├── TikTokLikeEvent.java │ │ │ │ └── TikTokShareEvent.java │ │ │ └── websocket │ │ │ │ ├── TikTokWebsocketMessageEvent.java │ │ │ │ ├── TikTokWebsocketResponseEvent.java │ │ │ │ └── TikTokWebsocketUnhandledMessageEvent.java │ │ ├── models │ │ │ ├── Emote.java │ │ │ ├── LinkMicArmy.java │ │ │ ├── Picture.java │ │ │ ├── PollOption.java │ │ │ ├── RankingUser.java │ │ │ ├── Text.java │ │ │ ├── badges │ │ │ │ ├── Badge.java │ │ │ │ ├── CombineBadge.java │ │ │ │ ├── PictureBadge.java │ │ │ │ ├── StringBadge.java │ │ │ │ └── TextBadge.java │ │ │ ├── barrage │ │ │ │ ├── BarrageParam.java │ │ │ │ ├── FansLevelParam.java │ │ │ │ ├── SubscribeGiftParam.java │ │ │ │ └── UserGradeParam.java │ │ │ ├── battles │ │ │ │ └── Team.java │ │ │ ├── chest │ │ │ │ └── Chest.java │ │ │ ├── gifts │ │ │ │ ├── Gift.java │ │ │ │ └── GiftComboStateType.java │ │ │ ├── http │ │ │ │ └── HttpData.java │ │ │ └── users │ │ │ │ ├── ListUser.java │ │ │ │ ├── User.java │ │ │ │ └── UserAttribute.java │ │ ├── requests │ │ │ ├── GiftsData.java │ │ │ ├── LiveConnectionData.java │ │ │ ├── LiveData.java │ │ │ └── LiveUserData.java │ │ └── settings │ │ │ ├── HttpClientSettings.java │ │ │ ├── LiveClientSettings.java │ │ │ └── ProxyClientSettings.java │ │ ├── exceptions │ │ ├── TikTokEventListenerMethodException.java │ │ ├── TikTokLiveException.java │ │ ├── TikTokLiveMessageException.java │ │ ├── TikTokLiveOfflineHostException.java │ │ ├── TikTokLivePreConnectionException.java │ │ ├── TikTokLiveRequestException.java │ │ ├── TikTokLiveUnknownHostException.java │ │ ├── TikTokMessageMappingException.java │ │ ├── TikTokProtocolBufferException.java │ │ ├── TikTokProxyRequestException.java │ │ └── TikTokSignServerException.java │ │ ├── http │ │ └── LiveHttpClient.java │ │ ├── listener │ │ ├── ListenersManager.java │ │ └── TikTokEventListenerBase.java │ │ ├── live │ │ ├── GiftsManager.java │ │ ├── LiveClient.java │ │ ├── LiveEventsHandler.java │ │ ├── LiveMessagesHandler.java │ │ ├── LiveRoomInfo.java │ │ └── builder │ │ │ ├── EventConsumer.java │ │ │ ├── EventsBuilder.java │ │ │ └── LiveClientBuilder.java │ │ ├── mappers │ │ ├── LiveMapper.java │ │ ├── LiveMapperHelper.java │ │ ├── TikTokMapperModel.java │ │ └── data │ │ │ ├── AfterMappingAction.java │ │ │ ├── MappingAction.java │ │ │ └── MappingResult.java │ │ ├── models │ │ ├── ConnectionState.java │ │ └── SocialTypes.java │ │ ├── utils │ │ ├── ConsoleColors.java │ │ ├── JsonUtil.java │ │ ├── ProtoBufferFileGenerator.java │ │ ├── ProtoBufferJsonGenerator.java │ │ ├── ProtoBufferObject.java │ │ ├── ProtocolUtils.java │ │ └── Stopwatch.java │ │ └── websocket │ │ └── LiveSocketClient.java │ └── proto │ ├── data.proto │ ├── enums.proto │ └── webcast.proto ├── Client ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── github │ │ └── jwdeveloper │ │ └── tiktok │ │ ├── TikTokLive.java │ │ ├── TikTokLiveClient.java │ │ ├── TikTokLiveClientBuilder.java │ │ ├── TikTokLiveEventHandler.java │ │ ├── TikTokLiveHttpClient.java │ │ ├── TikTokLiveHttpOfflineClient.java │ │ ├── TikTokLiveMessageHandler.java │ │ ├── TikTokRoomInfo.java │ │ ├── common │ │ ├── ActionResult.java │ │ ├── ActionResultBuilder.java │ │ └── LoggerFactory.java │ │ ├── gifts │ │ └── TikTokGiftsManager.java │ │ ├── http │ │ ├── HttpClient.java │ │ ├── HttpClientBuilder.java │ │ ├── HttpClientFactory.java │ │ ├── HttpProxyClient.java │ │ └── mappers │ │ │ ├── GiftsDataMapper.java │ │ │ ├── HttpRequestJsonMapper.java │ │ │ ├── HttpResponseJsonMapper.java │ │ │ ├── LiveDataMapper.java │ │ │ └── LiveUserDataMapper.java │ │ ├── listener │ │ ├── ListenerMethodInfo.java │ │ └── TikTokListenersManager.java │ │ ├── mappers │ │ ├── MessagesMapperFactory.java │ │ ├── TikTokGenericEventMapper.java │ │ ├── TikTokLiveMapper.java │ │ ├── TikTokLiveMapperHelper.java │ │ ├── TikTokLiveMapperModel.java │ │ └── handlers │ │ │ ├── TikTokCommonEventHandler.java │ │ │ ├── TikTokGiftEventHandler.java │ │ │ ├── TikTokRoomInfoEventHandler.java │ │ │ └── TikTokSocialMediaEventHandler.java │ │ └── websocket │ │ ├── TikTokWebSocketClient.java │ │ ├── TikTokWebSocketListener.java │ │ ├── TikTokWebSocketOfflineClient.java │ │ └── WebSocketHeartbeatTask.java │ └── test │ └── java │ └── io │ └── github │ └── jwdeveloper │ └── tiktok │ ├── TikTokLiveClientTests.java │ ├── TikTokTestBase.java │ ├── handlers │ └── events │ │ └── TikTokGiftEventHandlerTest.java │ ├── listener │ └── TikTokListenersManagerTest.java │ └── mocks │ └── EventsHandlerMock.java ├── FUNDING.yml ├── README.md ├── collaboration.md ├── ensure-java-16 ├── examples ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── github │ └── jwdeveloper │ └── tiktok │ ├── CollectorExample.java │ ├── ConnectionExample.java │ ├── CustomEventExample.java │ ├── CustomMappingExample.java │ ├── CustomizationExample.java │ ├── Events_And_Gifts_Testing_Example.java │ ├── ListenerExample.java │ ├── ProxyExample.java │ └── RecorderExample.java ├── extension-collector ├── README.md ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── github │ └── jwdeveloper │ └── tiktok │ └── extension │ └── collector │ ├── TikTokLiveCollector.java │ ├── api │ ├── CollectorEvent.java │ ├── LiveDataCollector.java │ ├── Storage.java │ └── settings │ │ ├── CollectorListenerSettings.java │ │ ├── FileDataCollectorSettings.java │ │ └── mongo │ │ ├── MongoDBConnectionStringBuilder.java │ │ └── MongoDataCollectorSettings.java │ └── impl │ ├── DataCollector.java │ ├── DataCollectorListener.java │ └── storages │ ├── FileStorage.java │ └── MongoStorage.java ├── extension-recorder ├── README.md ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── github │ └── jwdeveloper │ └── tiktok │ └── extension │ └── recorder │ ├── TikTokLiveRecorder.java │ ├── api │ └── LiveRecorder.java │ └── impl │ ├── RecorderListener.java │ ├── data │ ├── DownloadData.java │ └── RecorderSettings.java │ ├── enums │ ├── LiveFormat.java │ └── LiveQuality.java │ └── event │ ├── TikTokLiveRecorderEndedEvent.java │ └── TikTokLiveRecorderStartedEvent.java ├── future.md ├── jitpack.yml ├── license.txt ├── pom.xml └── tools-readme ├── pom.xml ├── readme.md └── src └── main ├── java └── io │ └── github │ └── jwdeveloper │ └── tiktok │ ├── CodeExample.java │ ├── CodeExamplesGenerator.java │ ├── EventsInfoGenerator.java │ ├── FilesUtility.java │ ├── ListenerExampleGenerator.java │ ├── Main.java │ ├── Main2.java │ ├── ReadmeGenerator.java │ └── TemplateUtility.java └── resources ├── logo.svg ├── output.md ├── readme-template.html └── template.md /API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.annotations; 24 | 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.RetentionPolicy; 27 | 28 | @Retention(RetentionPolicy.RUNTIME) 29 | public @interface EventMeta 30 | { 31 | EventType eventType(); 32 | } 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/annotations/EventType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.annotations; 24 | 25 | 26 | public enum EventType 27 | { 28 | Control, Message, Debug 29 | } 30 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/annotations/Priority.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.annotations; 24 | 25 | /** 26 | ORDER - 27 | * HIGHEST 1st, 28 | * HIGH 2nd, 29 | * NORMAL 3rd, 30 | * LOW 4th, 31 | * LOWEST 5th 32 | */ 33 | public enum Priority { 34 | LOWEST(2), LOW(1), NORMAL(0), HIGH(-1), HIGHEST(-2); 35 | 36 | public final int value; 37 | 38 | Priority(int value) { 39 | this.value = value; 40 | } 41 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/annotations/TikTokEventObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.annotations; 24 | 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.RetentionPolicy; 27 | 28 | @Retention(RetentionPolicy.RUNTIME) 29 | public @interface TikTokEventObserver 30 | { 31 | /** 32 | * When more than one method listen for certain Event, you can specify the method priority 33 | * @see Priority 34 | */ 35 | Priority priority() default Priority.NORMAL; 36 | 37 | /** 38 | * When true, action is invoked on a thread, from the threads pool 39 | */ 40 | boolean async() default false; 41 | } 42 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/dto/MessageMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.dto; 24 | 25 | import lombok.AllArgsConstructor; 26 | import lombok.Data; 27 | import lombok.Value; 28 | 29 | import java.time.Duration; 30 | 31 | @Data 32 | @AllArgsConstructor 33 | public class MessageMetaData 34 | { 35 | private Duration handlingTime; 36 | } 37 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokConnectedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 25 | import io.github.jwdeveloper.tiktok.annotations.EventType; 26 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; 27 | 28 | @EventMeta(eventType = EventType.Control) 29 | public class TikTokConnectedEvent extends TikTokLiveClientEvent 30 | { 31 | 32 | 33 | public static TikTokConnectedEvent of() 34 | { 35 | return new TikTokConnectedEvent(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDetectEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMsgDetectMessage; 29 | import lombok.Getter; 30 | @Getter 31 | @EventMeta(eventType = EventType.Message) 32 | public class TikTokDetectEvent extends TikTokHeaderEvent { 33 | private final String language; 34 | 35 | public TikTokDetectEvent(WebcastMsgDetectMessage msg) { 36 | super(msg.getCommon()); 37 | language = msg.getFromRegion(); 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokDisconnectedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 25 | import io.github.jwdeveloper.tiktok.annotations.EventType; 26 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; 27 | import lombok.Getter; 28 | 29 | 30 | @Getter 31 | @EventMeta(eventType = EventType.Control) 32 | public class TikTokDisconnectedEvent extends TikTokLiveClientEvent { 33 | private final String reason; 34 | 35 | public TikTokDisconnectedEvent(String reason) { 36 | this.reason = reason.isBlank() ? "None" : reason; 37 | } 38 | 39 | public static TikTokDisconnectedEvent of(String reason) 40 | { 41 | return new TikTokDisconnectedEvent(reason); 42 | } 43 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokEnvelopeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.data.models.users.User; 29 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEnvelopeMessage; 30 | import lombok.Value; 31 | 32 | 33 | /** 34 | * Triggered every time someone sends a treasure chest. 35 | */ 36 | @Value 37 | @EventMeta(eventType = EventType.Message) 38 | public class TikTokEnvelopeEvent extends TikTokHeaderEvent { 39 | User user; 40 | public TikTokEnvelopeEvent(WebcastEnvelopeMessage msg) { 41 | super(msg.getCommon()); 42 | user = User.map(msg.getEnvelopeInfo()); 43 | } 44 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokErrorEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; 28 | import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | 32 | @Getter 33 | @AllArgsConstructor 34 | @EventMeta(eventType = EventType.Control) 35 | public class TikTokErrorEvent extends TikTokLiveClientEvent { 36 | private final Throwable exception; 37 | 38 | 39 | public static TikTokErrorEvent of(String message) { 40 | return new TikTokErrorEvent(new TikTokLiveException(message)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokIMDeleteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastImDeleteMessage; 29 | import lombok.Getter; 30 | 31 | import java.util.List; 32 | 33 | @Getter 34 | @EventMeta(eventType = EventType.Message) 35 | public class TikTokIMDeleteEvent extends TikTokHeaderEvent { 36 | 37 | private final List msgIds, userIds; 38 | public TikTokIMDeleteEvent(WebcastImDeleteMessage msg) { 39 | super(msg.getCommon()); 40 | this.msgIds = msg.getDeleteMsgIdsListList(); 41 | this.userIds = msg.getDeleteUserIdsListList(); 42 | } 43 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokInRoomBannerEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 27 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastInRoomBannerMessage; 28 | import lombok.Getter; 29 | 30 | @Getter 31 | @EventMeta(eventType = EventType.Message) 32 | public class TikTokInRoomBannerEvent extends TikTokHeaderEvent { 33 | private final String json; 34 | 35 | public TikTokInRoomBannerEvent(WebcastInRoomBannerMessage msg) { 36 | super(msg.getHeader()); 37 | json = msg.getExtraMap().toString(); 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkLayerEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | 29 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkLayerMessage; 30 | import lombok.Getter; 31 | 32 | @Getter 33 | @EventMeta(eventType = EventType.Message) 34 | public class TikTokLinkLayerEvent extends TikTokHeaderEvent { 35 | 36 | public TikTokLinkLayerEvent(WebcastLinkLayerMessage msg) { 37 | super(msg.getCommon()); 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicFanTicketEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicFanTicketMethod; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Message) 33 | public class TikTokLinkMicFanTicketEvent extends TikTokHeaderEvent { 34 | 35 | public TikTokLinkMicFanTicketEvent(WebcastLinkMicFanTicketMethod msg) { 36 | super(msg.getCommon()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLinkMicMethodEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicMethod; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Message) 33 | public class TikTokLinkMicMethodEvent extends TikTokHeaderEvent { 34 | 35 | public TikTokLinkMicMethodEvent(WebcastLinkMicMethod msg) { 36 | super(msg.getCommon()); 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLiveEndedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 25 | import io.github.jwdeveloper.tiktok.annotations.EventType; 26 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 27 | import io.github.jwdeveloper.tiktok.data.events.control.TikTokConnectingEvent; 28 | 29 | 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLiveEndedEvent extends TikTokEvent { 32 | 33 | 34 | public static TikTokLiveEndedEvent of() { 35 | return new TikTokLiveEndedEvent(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLivePausedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 28 | 29 | @EventMeta(eventType = EventType.Message) 30 | public class TikTokLivePausedEvent extends TikTokEvent { 31 | } 32 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokLiveUnpausedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 28 | 29 | 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLiveUnpausedEvent extends TikTokEvent { 32 | } 33 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankTextEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.data.models.Text; 29 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRankTextMessage; 30 | import lombok.Getter; 31 | 32 | @Getter 33 | @EventMeta(eventType = EventType.Message) 34 | public class TikTokRankTextEvent extends TikTokHeaderEvent { 35 | private final String eventType; 36 | 37 | private final String label; 38 | 39 | public TikTokRankTextEvent(WebcastRankTextMessage msg) { 40 | super(msg.getCommon()); 41 | var text = Text.map(msg.getSelfGetBadgeMsg()); 42 | label = text.getPattern(); 43 | eventType = text.getKey(); 44 | } 45 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokRankUpdateEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastHourlyRankMessage; 29 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRankUpdateMessage; 30 | import lombok.Getter; 31 | 32 | @Getter 33 | @EventMeta(eventType = EventType.Message) 34 | public class TikTokRankUpdateEvent extends TikTokHeaderEvent { 35 | 36 | public TikTokRankUpdateEvent(WebcastHourlyRankMessage msg) { 37 | super(msg.getCommon()); 38 | } 39 | 40 | public TikTokRankUpdateEvent(WebcastRankUpdateMessage msg) { 41 | super(msg.getCommon()); 42 | } 43 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokReconnectingEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; 28 | import lombok.Getter; 29 | 30 | @Getter 31 | @EventMeta(eventType = EventType.Control) 32 | public class TikTokReconnectingEvent extends TikTokLiveClientEvent 33 | { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokSubNotifyEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.data.models.users.User; 29 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSubNotifyMessage; 30 | import lombok.Value; 31 | 32 | @Value 33 | @EventMeta(eventType = EventType.Message) 34 | public class TikTokSubNotifyEvent extends TikTokHeaderEvent { 35 | User user; 36 | 37 | public TikTokSubNotifyEvent(WebcastSubNotifyMessage msg) { 38 | super(msg.getCommon()); 39 | user = User.map(msg.getUser()); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnauthorizedMemberEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastUnauthorizedMemberMessage; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Message) 33 | public class TikTokUnauthorizedMemberEvent extends TikTokHeaderEvent { 34 | private final String userNickName; 35 | 36 | public TikTokUnauthorizedMemberEvent(WebcastUnauthorizedMemberMessage msg) { 37 | super(msg.getCommon()); 38 | 39 | userNickName = msg.getNickName(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledControlEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastControlMessage; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Message) 33 | public class TikTokUnhandledControlEvent extends TikTokUnhandledEvent { 34 | 35 | public TikTokUnhandledControlEvent(WebcastControlMessage data) { 36 | super(data); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledMemberEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Message) 33 | public class TikTokUnhandledMemberEvent extends TikTokUnhandledEvent 34 | { 35 | public TikTokUnhandledMemberEvent(WebcastMemberMessage data) { 36 | super(data); 37 | } 38 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/TikTokUnhandledSocialEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Message) 33 | public class TikTokUnhandledSocialEvent extends TikTokUnhandledEvent 34 | { 35 | public TikTokUnhandledSocialEvent(WebcastSocialMessage data) { 36 | super(data); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEmptyEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.common; 24 | 25 | 26 | /** 27 | * 28 | */ 29 | public class TikTokEmptyEvent extends TikTokEvent 30 | { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.common; 24 | 25 | 26 | import io.github.jwdeveloper.tiktok.utils.JsonUtil; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | public abstract class TikTokEvent { 31 | 32 | public String toJson() { 33 | return JsonUtil.toJson(this); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokHeaderEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.common; 24 | 25 | import io.github.jwdeveloper.tiktok.messages.data.*; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | public class TikTokHeaderEvent extends TikTokEvent { 30 | private final long messageId; 31 | private final long roomId; 32 | private final long timeStamp; 33 | 34 | public TikTokHeaderEvent(CommonMessageData header) { 35 | this(header.getMsgId(), header.getRoomId(), header.getCreateTime()); 36 | } 37 | 38 | public TikTokHeaderEvent(long messageId, long roomId, long timeStamp) { 39 | this.messageId = messageId; 40 | this.roomId = roomId; 41 | this.timeStamp = timeStamp; 42 | } 43 | 44 | public TikTokHeaderEvent() { 45 | messageId = 0; 46 | roomId = 0; 47 | timeStamp = 0; 48 | } 49 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokLiveClientEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.common; 24 | 25 | 26 | public class TikTokLiveClientEvent extends TikTokEvent { 27 | } 28 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/common/TikTokUnhandledEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.common; 24 | 25 | import lombok.AllArgsConstructor; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | @AllArgsConstructor 30 | public class TikTokUnhandledEvent extends TikTokEvent 31 | { 32 | private final T data; 33 | } 34 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/control/TikTokConnectingEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.control; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent; 28 | 29 | 30 | /** 31 | * Triggered when client is connecting to live is successfully established. 32 | */ 33 | @EventMeta(eventType = EventType.Control) 34 | public class TikTokConnectingEvent extends TikTokLiveClientEvent { 35 | 36 | public static TikTokConnectingEvent of() { 37 | return new TikTokConnectingEvent(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/http/TikTokHttpResponseEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.http; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 28 | import io.github.jwdeveloper.tiktok.data.models.http.HttpData; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | 32 | @Getter 33 | @AllArgsConstructor 34 | @EventMeta(eventType = EventType.Debug) 35 | public class TikTokHttpResponseEvent extends TikTokEvent 36 | { 37 | String url; 38 | 39 | HttpData response; 40 | 41 | HttpData request; 42 | } 43 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkApplyEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkApplyEvent extends TikTokLinkEvent { 32 | 33 | public TikTokLinkApplyEvent(WebcastLinkMessage msg) { 34 | super(msg); 35 | } 36 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkCloseEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkCloseEvent extends TikTokLinkEvent { 32 | 33 | public TikTokLinkCloseEvent(WebcastLinkMessage msg) { 34 | super(msg); 35 | // if (!msg.hasCloseContent()) 36 | // throw new IllegalArgumentException("Expected WebcastLinkMessage with Close Content!"); 37 | // Proto Empty 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkCohostListChangeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkCohostListChangeEvent extends TikTokLinkEvent { 32 | 33 | public TikTokLinkCohostListChangeEvent(WebcastLinkMessage msg) { 34 | super(msg); 35 | // if (!msg.hasCohostListChangeContent()) 36 | // throw new IllegalArgumentException("Expected WebcastLinkMessage with Cohost List Change Content!"); 37 | // Proto Empty 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkCreateEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkCreateEvent extends TikTokLinkEvent { 32 | 33 | private final long hostId, roomId, linkType; 34 | public TikTokLinkCreateEvent(WebcastLinkMessage msg) { 35 | super(msg); 36 | if (!msg.hasCreateContent()) 37 | throw new IllegalArgumentException("Expected WebcastLinkMessage with Create Content!"); 38 | 39 | var content = msg.getCreateContent(); 40 | this.hostId = content.getOwnerId(); 41 | this.roomId = content.getOwnerRoomId(); 42 | this.linkType = content.getLinkType(); 43 | } 44 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 27 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 28 | import lombok.Getter; 29 | 30 | @Getter 31 | @EventMeta(eventType = EventType.Message) 32 | public class TikTokLinkEvent extends TikTokHeaderEvent { 33 | 34 | private final String extra, transferExtra; 35 | private final long expireTimestamp; 36 | 37 | public TikTokLinkEvent(WebcastLinkMessage msg) { 38 | super(msg.getCommon()); 39 | this.extra = msg.getExtra(); 40 | this.expireTimestamp = msg.getExpireTimestamp(); 41 | this.transferExtra = msg.getTransferExtra(); 42 | } 43 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkInviteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.data.models.users.User; 27 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 28 | import lombok.Getter; 29 | 30 | @Getter 31 | @EventMeta(eventType = EventType.Message) 32 | public class TikTokLinkInviteEvent extends TikTokLinkEvent { 33 | 34 | private final long roomId; 35 | private final User inviter; 36 | 37 | public TikTokLinkInviteEvent(WebcastLinkMessage msg) { 38 | super(msg); 39 | if (!msg.hasInviteContent()) 40 | throw new IllegalArgumentException("Expected WebcastLinkMessage with Invite Content!"); 41 | 42 | var content = msg.getInviteContent(); 43 | this.roomId = content.getFromRoomId(); 44 | this.inviter = User.map(content.getFromUser()); 45 | } 46 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkLinkedListChangeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkLinkedListChangeEvent extends TikTokLinkEvent { 32 | 33 | public TikTokLinkLinkedListChangeEvent(WebcastLinkMessage msg) { 34 | super(msg); 35 | // if (!msg.hasLinkedListChangeContent()) 36 | // throw new IllegalArgumentException("Expected WebcastLinkMessage with Linked List Change Content!"); 37 | // Proto Empty 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkMicIdxUpdateEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkMicIdxUpdateEvent extends TikTokLinkEvent { 32 | 33 | public TikTokLinkMicIdxUpdateEvent(WebcastLinkMessage msg) { 34 | super(msg); 35 | // if (!msg.hasMicIdxUpdateContent()) 36 | // throw new IllegalArgumentException("Expected WebcastLinkMessage with Mic Idx Update Content!"); 37 | // Proto Empty 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkSysKickOutEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkSysKickOutEvent extends TikTokLinkEvent { 32 | 33 | private final long userId; 34 | private final String linkmicIdStr; 35 | 36 | public TikTokLinkSysKickOutEvent(WebcastLinkMessage msg) { 37 | super(msg); 38 | if (!msg.hasSysKickOutContent()) 39 | throw new IllegalArgumentException("Expected WebcastLinkMessage with Sys Kick Out Content!"); 40 | 41 | var content = msg.getSysKickOutContent(); 42 | this.userId = content.getUserId(); 43 | this.linkmicIdStr = content.getLinkmicIdStr(); 44 | } 45 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkUpdateUserEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkUpdateUserEvent extends TikTokLinkEvent { 32 | 33 | private final long fromUserId, toUserId; 34 | 35 | public TikTokLinkUpdateUserEvent(WebcastLinkMessage msg) { 36 | super(msg); 37 | if (!msg.hasUpdateUserContent()) 38 | throw new IllegalArgumentException("Expected WebcastLinkMessage with Update User Content!"); 39 | 40 | var content = msg.getUpdateUserContent(); 41 | this.fromUserId = content.getFromUserId(); 42 | this.toUserId = content.getToUserId(); 43 | } 44 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkUpdateUserSettingEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkUpdateUserSettingEvent extends TikTokLinkEvent { 32 | 33 | public TikTokLinkUpdateUserSettingEvent(WebcastLinkMessage msg) { 34 | super(msg); 35 | // if (!msg.hasUpdateUserSettingContent()) 36 | // throw new IllegalArgumentException("Expected WebcastLinkMessage with Update User Setting Content!"); 37 | // Proto Empty 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/link/TikTokLinkWaitListChangeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.link; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | @EventMeta(eventType = EventType.Message) 31 | public class TikTokLinkWaitListChangeEvent extends TikTokLinkEvent { 32 | 33 | public TikTokLinkWaitListChangeEvent(WebcastLinkMessage msg) { 34 | super(msg); 35 | // if (!msg.hasWaitingListChangeContent()) 36 | // throw new IllegalArgumentException("Expected WebcastLinkMessage with Waiting List Change Content!"); 37 | // Proto Empty 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.poll; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Message) 33 | public class TikTokPollEvent extends TikTokHeaderEvent { 34 | private final Long pollId; 35 | 36 | public TikTokPollEvent(WebcastPollMessage msg) 37 | { 38 | super(msg.getCommon()); 39 | pollId = msg.getPollId(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/poll/TikTokPollUpdateEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.poll; 24 | 25 | 26 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 27 | import io.github.jwdeveloper.tiktok.annotations.EventType; 28 | import io.github.jwdeveloper.tiktok.data.models.PollOption; 29 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastPollMessage; 30 | import lombok.Getter; 31 | 32 | import java.util.List; 33 | 34 | @EventMeta(eventType = EventType.Message) 35 | @Getter 36 | public class TikTokPollUpdateEvent extends TikTokPollEvent { 37 | private final List options; 38 | public TikTokPollUpdateEvent(WebcastPollMessage msg) { 39 | super(msg); 40 | options = msg.getUpdateContent().getOptionListList().stream().map(PollOption::map).toList(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomInfoEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.room; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 28 | import io.github.jwdeveloper.tiktok.live.LiveRoomInfo; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | 32 | 33 | 34 | @Getter 35 | @AllArgsConstructor 36 | @EventMeta(eventType = EventType.Message) 37 | public class TikTokRoomInfoEvent extends TikTokEvent 38 | { 39 | LiveRoomInfo roomInfo; 40 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/room/TikTokRoomPinEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.room; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent; 28 | import io.github.jwdeveloper.tiktok.data.events.TikTokCommentEvent; 29 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomPinMessage; 30 | import lombok.Getter; 31 | 32 | @Getter 33 | @EventMeta(eventType = EventType.Message) 34 | public class TikTokRoomPinEvent extends TikTokHeaderEvent 35 | { 36 | private final TikTokCommentEvent pinnedMessage; 37 | private final long timestamp; 38 | 39 | public TikTokRoomPinEvent(WebcastRoomPinMessage msg, TikTokCommentEvent commentEvent) 40 | { 41 | super(msg.getCommon()); 42 | this.timestamp = msg.getPinTime(); 43 | this.pinnedMessage = commentEvent; 44 | } 45 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketResponseEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.websocket; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.*; 26 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 27 | import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult; 28 | import lombok.*; 29 | 30 | @Getter 31 | @AllArgsConstructor 32 | @EventMeta(eventType = EventType.Debug) 33 | public class TikTokWebsocketResponseEvent extends TikTokEvent 34 | { 35 | private ProtoMessageFetchResult response; 36 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/events/websocket/TikTokWebsocketUnhandledMessageEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.events.websocket; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.EventMeta; 26 | import io.github.jwdeveloper.tiktok.annotations.EventType; 27 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent; 28 | import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult; 29 | import lombok.Getter; 30 | 31 | @Getter 32 | @EventMeta(eventType = EventType.Debug) 33 | public class TikTokWebsocketUnhandledMessageEvent extends TikTokUnhandledEvent 34 | { 35 | public TikTokWebsocketUnhandledMessageEvent(ProtoMessageFetchResult.BaseProtoMessage data) { 36 | super(data); 37 | } 38 | 39 | public ProtoMessageFetchResult.BaseProtoMessage getMessage() 40 | { 41 | return this.getData(); 42 | } 43 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/Emote.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models; 24 | 25 | import lombok.Value; 26 | 27 | @Value 28 | public class Emote { 29 | String emoteId; 30 | Picture picture; 31 | 32 | public static Emote map(io.github.jwdeveloper.tiktok.messages.data.Emote input) { 33 | return new Emote(input.getEmoteId(), Picture.map(input.getImage())); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/LinkMicArmy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.users.User; 26 | import io.github.jwdeveloper.tiktok.messages.data.BattleUserArmies; 27 | import lombok.Value; 28 | 29 | import java.util.*; 30 | import java.util.stream.Collectors; 31 | 32 | @Value 33 | public class LinkMicArmy { 34 | Long armyId; 35 | int totalPoints; 36 | Map armies; 37 | 38 | public LinkMicArmy(BattleUserArmies userArmies) { 39 | armyId = Long.parseLong(userArmies.getAnchorIdStr()); 40 | totalPoints = (int) userArmies.getHostScore(); 41 | armies = userArmies.getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore())); 42 | } 43 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/PollOption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.users.User; 26 | import io.github.jwdeveloper.tiktok.messages.data.PollOptionInfo; 27 | import lombok.Value; 28 | 29 | import java.util.List; 30 | 31 | @Value 32 | public class PollOption { 33 | 34 | int optionId; 35 | String content; 36 | int votes; 37 | List users; 38 | 39 | public static PollOption map(PollOptionInfo pollOptionInfo) { 40 | 41 | var users = pollOptionInfo.getVoteUserListList().stream().map(User::map).toList(); 42 | return new PollOption( 43 | pollOptionInfo.getOptionIdx(), 44 | pollOptionInfo.getDisplayContent(), 45 | pollOptionInfo.getVotes(), 46 | users); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/RankingUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.users.User; 26 | import lombok.Value; 27 | 28 | @Value 29 | public class RankingUser { 30 | int rank; 31 | User user; 32 | int score; 33 | 34 | public RankingUser(io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomUserSeqMessage.Contributor viewer) { 35 | rank = viewer.getRank(); 36 | user = User.map(viewer.getUser()); 37 | score = viewer.getScore(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/Badge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.badges; 24 | 25 | public class Badge { 26 | 27 | public static Badge map(io.github.jwdeveloper.tiktok.messages.data.BadgeStruct badge) { 28 | return switch (badge.getBadgeDisplayType()) { 29 | case BADGEDISPLAYTYPE_TEXT -> new TextBadge(badge.getText()); 30 | case BADGEDISPLAYTYPE_IMAGE -> new PictureBadge(badge.getImage()); 31 | case BADGEDISPLAYTYPE_STRING -> new StringBadge(badge.getStr()); 32 | case BADGEDISPLAYTYPE_COMBINE -> new CombineBadge(badge.getCombine()); 33 | default -> empty(); 34 | }; 35 | } 36 | 37 | public static Badge empty() { 38 | return new Badge(); 39 | } 40 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/CombineBadge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.badges; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.Picture; 26 | import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | public class CombineBadge extends Badge { 31 | private final Picture picture; 32 | private final String text; 33 | private final String subText; 34 | 35 | public CombineBadge(BadgeStruct.CombineBadge combineBadge) { 36 | picture = Picture.map(combineBadge.getIcon()); 37 | text = combineBadge.getText().getDefaultPattern(); 38 | subText = combineBadge.getStr(); 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "CombineBadge{picture=" + picture +", text='" + text + "', subText='" + subText + "'}"; 44 | } 45 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/PictureBadge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.badges; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.Picture; 26 | import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; 27 | import lombok.Getter; 28 | 29 | @Getter 30 | public class PictureBadge extends Badge { 31 | private final Picture picture; 32 | 33 | public PictureBadge(BadgeStruct.ImageBadge imageBadge) { 34 | picture = Picture.map(imageBadge.getImage()); 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "PictureBadge{picture=" + picture + "}"; 40 | } 41 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/StringBadge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.badges; 24 | 25 | import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | public class StringBadge extends Badge { 30 | private final String text; 31 | 32 | public StringBadge(BadgeStruct.StringBadge stringBadge) { 33 | this.text = stringBadge.getStr(); 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "StringBadge{text='" + text + "'}"; 39 | } 40 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/badges/TextBadge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.badges; 24 | 25 | import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | public class TextBadge extends Badge { 30 | private final String text; 31 | 32 | public TextBadge(BadgeStruct.TextBadge textBadge) { 33 | this.text = textBadge.getDefaultPattern(); 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "TextBadge{text='" + text + "'}"; 39 | } 40 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/BarrageParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.barrage; 24 | 25 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; 26 | 27 | public class BarrageParam { 28 | 29 | //Figure out barrage type:11 30 | public static BarrageParam map(WebcastBarrageMessage msg) { 31 | return switch (msg.getMsgType()) { 32 | case GRADEUSERENTRANCENOTIFICATION -> new UserGradeParam(msg.getUserGradeParam()); 33 | case FANSLEVELUPGRADE -> new FansLevelParam(msg.getFansLevelParam()); 34 | case SUBSCRIBEGIFT -> new SubscribeGiftParam(msg.getSubscribeGiftParam()); 35 | default -> new BarrageParam(); 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/FansLevelParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.barrage; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.users.User; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; 27 | 28 | public class FansLevelParam extends BarrageParam 29 | { 30 | int currentGrade; 31 | User user; 32 | public FansLevelParam(WebcastBarrageMessage.BarrageTypeFansLevelParam param) 33 | { 34 | this.currentGrade = param.getCurrentGrade(); 35 | this.user = User.map(param.getUser()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/SubscribeGiftParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.barrage; 24 | 25 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; 26 | 27 | public class SubscribeGiftParam extends BarrageParam 28 | { 29 | public SubscribeGiftParam(WebcastBarrageMessage.BarrageTypeSubscribeGiftParam param) 30 | { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/barrage/UserGradeParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.barrage; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.users.User; 26 | import io.github.jwdeveloper.tiktok.messages.webcast.WebcastBarrageMessage; 27 | 28 | public class UserGradeParam extends BarrageParam { 29 | int currentGrade; 30 | User user; 31 | public UserGradeParam(WebcastBarrageMessage.BarrageTypeUserGradeParam param) { 32 | this.currentGrade = param.getCurrentGrade(); 33 | this.user = User.map(param.getUser()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/chest/Chest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.chest; 24 | 25 | 26 | import lombok.AllArgsConstructor; 27 | import lombok.Data; 28 | 29 | @Data 30 | @AllArgsConstructor 31 | public class Chest { 32 | 33 | /** 34 | * Total diamonds inside the chest 35 | */ 36 | int totalDiamonds; 37 | 38 | /** 39 | * Total users participated in chest 40 | */ 41 | int totalUsers; 42 | 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/gifts/GiftComboStateType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.gifts; 24 | 25 | public enum GiftComboStateType { 26 | Begin, 27 | Active, 28 | Finished; 29 | 30 | public static GiftComboStateType fromNumber(long number) { 31 | return switch ((int) number) { 32 | case 1, 2, 4 -> GiftComboStateType.Active; 33 | default -> GiftComboStateType.Finished; 34 | }; 35 | } 36 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/models/users/UserAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.models.users; 24 | 25 | public enum UserAttribute 26 | { 27 | GiftGiver, Subscriber, Follower, Moderator, LiveHost, MutualFollowingWithLiveHost,Admin,Blocked,Muted 28 | } 29 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/requests/GiftsData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.requests; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.gifts.Gift; 26 | import lombok.*; 27 | 28 | import java.util.List; 29 | 30 | public class GiftsData 31 | { 32 | @Data 33 | @AllArgsConstructor 34 | public static final class Response 35 | { 36 | private final String json; 37 | private final List gifts; 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/data/requests/LiveConnectionData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.data.requests; 24 | 25 | import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult; 26 | import lombok.*; 27 | 28 | import java.net.URI; 29 | 30 | public class LiveConnectionData { 31 | @Getter 32 | @AllArgsConstructor 33 | public static class Request { 34 | private final String roomId; 35 | } 36 | 37 | @Data 38 | @AllArgsConstructor 39 | public static class Response { 40 | private final String websocketCookies; 41 | private final URI websocketUrl; 42 | private final ProtoMessageFetchResult webcastResponse; 43 | } 44 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokEventListenerMethodException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | public class TikTokEventListenerMethodException extends TikTokLiveException 26 | { 27 | public TikTokEventListenerMethodException() { 28 | } 29 | 30 | public TikTokEventListenerMethodException(String message) { 31 | super(message); 32 | } 33 | 34 | public TikTokEventListenerMethodException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public TikTokEventListenerMethodException(Throwable cause) { 39 | super(cause); 40 | } 41 | 42 | public TikTokEventListenerMethodException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 43 | super(message, cause, enableSuppression, writableStackTrace); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokLiveException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | public class TikTokLiveException extends RuntimeException 26 | { 27 | public TikTokLiveException() { 28 | } 29 | 30 | public TikTokLiveException(String message) { 31 | super(message); 32 | } 33 | 34 | public TikTokLiveException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public TikTokLiveException(Throwable cause) { 39 | super(cause); 40 | } 41 | 42 | public TikTokLiveException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 43 | super(message, cause, enableSuppression, writableStackTrace); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokLiveOfflineHostException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | import io.github.jwdeveloper.tiktok.data.requests.*; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | public class TikTokLiveOfflineHostException extends TikTokLiveException 30 | { 31 | private final LiveUserData.Response userData; 32 | private final LiveData.Response liveData; 33 | 34 | public TikTokLiveOfflineHostException(String message, LiveUserData.Response userData, LiveData.Response liveData) { 35 | super(message); 36 | this.userData = userData; 37 | this.liveData = liveData; 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokLivePreConnectionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | import io.github.jwdeveloper.tiktok.data.events.control.TikTokPreConnectionEvent; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | public class TikTokLivePreConnectionException extends TikTokLiveException 30 | { 31 | private final TikTokPreConnectionEvent preconnectEvent; 32 | 33 | public TikTokLivePreConnectionException(TikTokPreConnectionEvent preconnectEvent) { 34 | super(preconnectEvent.getReason()); 35 | this.preconnectEvent = preconnectEvent; 36 | } 37 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokLiveRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | 26 | /** 27 | * Happens while bad response from Http request to TikTok 28 | */ 29 | public class TikTokLiveRequestException extends TikTokLiveException 30 | { 31 | public TikTokLiveRequestException() { 32 | } 33 | 34 | public TikTokLiveRequestException(String message) { 35 | super(message); 36 | } 37 | 38 | public TikTokLiveRequestException(String message, Throwable cause) { 39 | super(message, cause); 40 | } 41 | 42 | public TikTokLiveRequestException(Throwable cause) { 43 | super(cause); 44 | } 45 | 46 | public TikTokLiveRequestException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 47 | super(message, cause, enableSuppression, writableStackTrace); 48 | } 49 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokLiveUnknownHostException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | import io.github.jwdeveloper.tiktok.data.requests.*; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | public class TikTokLiveUnknownHostException extends TikTokLiveException 30 | { 31 | private final LiveUserData.Response userData; 32 | private final LiveData.Response liveData; 33 | 34 | public TikTokLiveUnknownHostException(String message, LiveUserData.Response userData, LiveData.Response liveData) { 35 | super(message); 36 | this.userData = userData; 37 | this.liveData = liveData; 38 | } 39 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokProtocolBufferException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | import lombok.Getter; 26 | 27 | 28 | /** 29 | * Happens when incoming data from TikTok is invalid 30 | */ 31 | public class TikTokProtocolBufferException extends TikTokLiveException 32 | { 33 | @Getter 34 | private final byte[] bytes; 35 | 36 | public TikTokProtocolBufferException(String message, byte[] bytes, Throwable cause) 37 | { 38 | super(message, cause); 39 | this.bytes = bytes; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokProxyRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | 26 | /* 27 | * Happens while bad response from http proxy request to TikTok 28 | */ 29 | public class TikTokProxyRequestException extends TikTokLiveException 30 | { 31 | public TikTokProxyRequestException() { 32 | } 33 | 34 | public TikTokProxyRequestException(String message) { 35 | super(message); 36 | } 37 | 38 | public TikTokProxyRequestException(String message, Throwable cause) { 39 | super(message, cause); 40 | } 41 | 42 | public TikTokProxyRequestException(Throwable cause) { 43 | super(cause); 44 | } 45 | 46 | public TikTokProxyRequestException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 47 | super(message, cause, enableSuppression, writableStackTrace); 48 | } 49 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/exceptions/TikTokSignServerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.exceptions; 24 | 25 | public class TikTokSignServerException extends TikTokLiveRequestException 26 | { 27 | public TikTokSignServerException() { 28 | } 29 | 30 | public TikTokSignServerException(String message) { 31 | super(message); 32 | } 33 | 34 | public TikTokSignServerException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public TikTokSignServerException(Throwable cause) { 39 | super(cause); 40 | } 41 | 42 | public TikTokSignServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 43 | super(message, cause, enableSuppression, writableStackTrace); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/listener/ListenersManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.listener; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | * Manage events listeners objects 29 | */ 30 | public interface ListenersManager 31 | { 32 | List getListeners(); 33 | 34 | void addListener(Object listener); 35 | 36 | void removeListener(Object listener); 37 | } 38 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/live/LiveEventsHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.live; 24 | 25 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 26 | import io.github.jwdeveloper.tiktok.live.builder.EventConsumer; 27 | 28 | import java.util.HashSet; 29 | import java.util.Optional; 30 | 31 | public interface LiveEventsHandler { 32 | void publish(LiveClient tikTokLiveClient, TikTokEvent tikTokEvent); 33 | 34 | void subscribe(Class clazz, EventConsumer event); 35 | 36 | void unsubscribeAll(Class clazz); 37 | 38 | void unsubscribe(EventConsumer consumer); 39 | 40 | void unsubscribe(Class clazz, EventConsumer consumer); 41 | } 42 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/live/LiveMessagesHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.live; 24 | 25 | import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult; 26 | 27 | public interface LiveMessagesHandler { 28 | void handle(LiveClient client, ProtoMessageFetchResult webcastResponse); 29 | 30 | void handleSingleMessage(LiveClient client, ProtoMessageFetchResult.BaseProtoMessage message); 31 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/live/LiveRoomInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.live; 24 | 25 | import io.github.jwdeveloper.tiktok.data.models.RankingUser; 26 | import io.github.jwdeveloper.tiktok.data.models.users.User; 27 | import io.github.jwdeveloper.tiktok.models.ConnectionState; 28 | 29 | import java.util.List; 30 | 31 | public interface LiveRoomInfo 32 | { 33 | /** 34 | * 35 | * @return get current count of viewers of live 36 | */ 37 | int getViewersCount(); 38 | 39 | /** 40 | * 41 | * @return get total current count of viewers since beginning of live 42 | */ 43 | int getTotalViewersCount(); 44 | int getLikesCount(); 45 | long getStartTime(); 46 | boolean isAgeRestricted(); 47 | String getRoomId(); 48 | String getHostName(); 49 | String getTitle(); 50 | User getHost(); 51 | List getUsersRanking(); 52 | ConnectionState getConnectionState(); 53 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/live/builder/EventConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.live.builder; 24 | 25 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 26 | import io.github.jwdeveloper.tiktok.live.LiveClient; 27 | 28 | @FunctionalInterface 29 | public interface EventConsumer 30 | { 31 | /** 32 | * 33 | * @param liveClient TikTok live client 34 | * @param event event data object 35 | */ 36 | void onEvent(LiveClient liveClient, T event); 37 | } 38 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/mappers/data/AfterMappingAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.mappers.data; 24 | 25 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 26 | 27 | import java.util.List; 28 | 29 | @FunctionalInterface 30 | public interface AfterMappingAction { 31 | /** 32 | * @param source object that was used as source to create events 33 | * @param events list of events prepared before, could be modified or changed 34 | * @return list of events that will be invoked 35 | */ 36 | List onAfterMapping(Object source, List events); 37 | } 38 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/mappers/data/MappingAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.mappers.data; 24 | 25 | import io.github.jwdeveloper.tiktok.mappers.LiveMapperHelper; 26 | 27 | @FunctionalInterface 28 | public interface MappingAction { 29 | 30 | /** 31 | * @param inputBytes incoming bytes from TikTok server. The represents protocol buffer message that was send to client 32 | * @param messageName name of protocol buffer message 33 | * @param mapperHelper utils and helper methods that can be use to debbug/display/deserialize protocol buffer data 34 | * @return 35 | */ 36 | T onMapping(byte[] inputBytes, String messageName, LiveMapperHelper mapperHelper); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/mappers/data/MappingResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.mappers.data; 24 | 25 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 26 | import lombok.AllArgsConstructor; 27 | import lombok.Getter; 28 | 29 | import java.util.List; 30 | 31 | @AllArgsConstructor 32 | @Getter 33 | public class MappingResult 34 | { 35 | 36 | Object source; 37 | 38 | List events; 39 | 40 | String message; 41 | 42 | public static MappingResult of(Object source) { 43 | return new MappingResult(source, List.of(),""); 44 | } 45 | 46 | public static MappingResult of(Object source, List events) { 47 | return new MappingResult(source, events,""); 48 | } 49 | 50 | public static MappingResult of(Object source,TikTokEvent events) { 51 | return new MappingResult(source, List.of(events),""); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/models/ConnectionState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.models; 24 | 25 | public enum ConnectionState 26 | { 27 | CONNECTING,CONNECTED,DISCONNECTED 28 | } 29 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/models/SocialTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.models; 24 | 25 | public class SocialTypes 26 | { 27 | public static final String LikeType = "pm_mt_msg_viewer"; 28 | public static final String FollowType = "pm_main_follow_message_viewer_2"; 29 | public static final String ShareType = "pm_mt_guidance_share"; 30 | public static final String JoinType = "pm_mt_join_message_other_viewer"; 31 | } 32 | -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/utils/Stopwatch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.utils; 24 | 25 | public class Stopwatch { 26 | private long startTime; 27 | private long stopTime; 28 | 29 | public void start() { 30 | startTime = System.nanoTime(); 31 | } 32 | 33 | public long stop() { 34 | stopTime = System.nanoTime(); 35 | return getElapsedTime(); 36 | } 37 | 38 | public long getElapsedTime() { 39 | return stopTime - startTime; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /API/src/main/java/io/github/jwdeveloper/tiktok/websocket/LiveSocketClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.websocket; 24 | 25 | import io.github.jwdeveloper.tiktok.data.requests.LiveConnectionData; 26 | import io.github.jwdeveloper.tiktok.live.LiveClient; 27 | 28 | public interface LiveSocketClient { 29 | void start(LiveConnectionData.Response webcastResponse, LiveClient tikTokLiveClient); 30 | void stop(int type); 31 | boolean isConnected(); 32 | } -------------------------------------------------------------------------------- /Client/src/main/java/io/github/jwdeveloper/tiktok/http/HttpClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.http; 24 | 25 | import io.github.jwdeveloper.tiktok.data.settings.*; 26 | import lombok.Getter; 27 | 28 | @Getter 29 | public class HttpClientFactory { 30 | private final LiveClientSettings liveClientSettings; 31 | 32 | public HttpClientFactory(LiveClientSettings liveClientSettings) { 33 | this.liveClientSettings = liveClientSettings; 34 | } 35 | 36 | public HttpClientBuilder client(String url) { 37 | return new HttpClientBuilder(url, liveClientSettings.getHttpSettings().clone()); 38 | } 39 | } -------------------------------------------------------------------------------- /Client/src/main/java/io/github/jwdeveloper/tiktok/http/mappers/HttpRequestJsonMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.http.mappers; 24 | 25 | import com.google.gson.*; 26 | 27 | import java.lang.reflect.Type; 28 | import java.net.http.HttpRequest; 29 | 30 | public class HttpRequestJsonMapper implements JsonSerializer 31 | { 32 | @Override 33 | public JsonElement serialize(HttpRequest src, Type typeOfSrc, JsonSerializationContext context) { 34 | JsonObject object = new JsonObject(); 35 | object.addProperty("method", src.method()); 36 | object.add("timeout", context.serialize(src.timeout().toString())); 37 | object.addProperty("expectContinue", src.expectContinue()); 38 | object.add("uri", context.serialize(src.uri())); 39 | object.add("version", context.serialize(src.version().toString())); 40 | object.add("headers", context.serialize(src.headers().map())); 41 | return object; 42 | } 43 | } -------------------------------------------------------------------------------- /Client/src/main/java/io/github/jwdeveloper/tiktok/http/mappers/HttpResponseJsonMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.http.mappers; 24 | 25 | import com.google.gson.*; 26 | 27 | import java.lang.reflect.Type; 28 | import java.net.http.HttpResponse; 29 | 30 | public class HttpResponseJsonMapper implements JsonSerializer 31 | { 32 | @Override 33 | public JsonElement serialize(HttpResponse src, Type typeOfSrc, JsonSerializationContext context) { 34 | JsonObject object = new JsonObject(); 35 | object.addProperty("statusCode", src.statusCode()); 36 | object.add("request", context.serialize(src.request())); 37 | object.add("headers", context.serialize(src.headers().map())); 38 | object.add("body", context.serialize(src.body())); 39 | object.add("uri", context.serialize(src.uri().toString())); 40 | object.add("version", context.serialize(src.version().toString())); 41 | return object; 42 | } 43 | } -------------------------------------------------------------------------------- /Client/src/main/java/io/github/jwdeveloper/tiktok/listener/ListenerMethodInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.listener; 24 | 25 | import io.github.jwdeveloper.tiktok.annotations.Priority; 26 | 27 | import io.github.jwdeveloper.tiktok.live.builder.EventConsumer; 28 | import lombok.Data; 29 | 30 | import java.lang.reflect.Method; 31 | 32 | 33 | @Data 34 | public class ListenerMethodInfo { 35 | private Object listener; 36 | 37 | private Class eventType; 38 | 39 | private Method method; 40 | 41 | private Priority priority; 42 | 43 | private boolean async; 44 | 45 | private EventConsumer action = (a, b) -> { 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: jwdeveloper 2 | custom: ["https://www.buymeacoffee.com/jwdev"] 3 | -------------------------------------------------------------------------------- /ensure-java-16: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JV=`java -version 2>&1 >/dev/null | head -1` 4 | echo $JV | sed -E 's/^.*version "([^".]*)\.[^"]*".*$/\1/' 5 | 6 | if [ "$JV" != 16 ]; then 7 | case "$1" in 8 | install) 9 | echo "Installing SDKMAN..." 10 | curl -s "https://get.sdkman.io" | bash 11 | source ~/.sdkman/bin/sdkman-init.sh 12 | sdk version 13 | sdk install java 16.0.2-open 14 | ;; 15 | use) 16 | echo "must source ~/.sdkman/bin/sdkman-init.sh" 17 | exit 1 18 | ;; 19 | esac 20 | fi -------------------------------------------------------------------------------- /extension-collector/README.md: -------------------------------------------------------------------------------- 1 | Collects live data to mongodb database 2 | 3 | 4 | ```xml 5 | 6 | 7 | jitpack.io 8 | https://jitpack.io 9 | 10 | 11 | 12 | 13 | com.github.jwdeveloper.TikTok-Live-Java 14 | Client 15 | 1.1.0-Release 16 | compile 17 | 18 | 19 | com.github.jwdeveloper.TikTok-Live-Java 20 | extension-collector 21 | 1.1.0-Release 22 | 23 | 24 | ``` 25 | 26 | 27 | Usage 28 | 29 | ```java 30 | public static void main(String[] args) throws IOException { 31 | 32 | var collector = TikTokLiveCollector.use(settings -> 33 | { 34 | settings.setConnectionUrl("mongodb+srv://" + mongoUser + ":" + mongoPassword + "@" + mongoDatabase + "/?retryWrites=true&w=majority"); 35 | settings.setDatabaseName("tiktok"); 36 | }); 37 | collector.connectDatabase(); 38 | 39 | var users = List.of("tehila_723", "dino123597", "domaxyzx", "dash4214", "obserwacje_live"); 40 | var sessionTag = "Tag1"; 41 | for (var user : users) { 42 | TikTokLive.newClient(user) 43 | .configure(liveClientSettings -> 44 | { 45 | liveClientSettings.setPrintToConsole(true); 46 | }) 47 | .onError((liveClient, event) -> 48 | { 49 | event.getException().printStackTrace(); 50 | }) 51 | .addListener(collector.newListener(Map.of("sessionTag", sessionTag), document -> 52 | { 53 | if (document.get("dataType") == "message") { 54 | return false; 55 | } 56 | return true; 57 | })) 58 | .buildAndConnectAsync(); 59 | } 60 | 61 | System.in.read(); 62 | collector.disconnectDatabase(); 63 | } 64 | ``` -------------------------------------------------------------------------------- /extension-collector/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.github.jwdeveloper.tiktok 8 | TikTokLiveJava 9 | 1.10.6-Release 10 | 11 | 12 | 13 | extension-collector 14 | 15 | 16 | 17 | 18 | io.github.jwdeveloper.tiktok 19 | API 20 | ${project.version} 21 | compile 22 | 23 | 24 | com.google.protobuf 25 | protobuf-java 26 | 4.26.1 27 | 28 | 29 | org.mongodb 30 | mongodb-driver-sync 31 | 4.4.0 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /extension-collector/src/main/java/io/github/jwdeveloper/tiktok/extension/collector/api/CollectorEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.collector.api; 24 | 25 | import io.github.jwdeveloper.tiktok.live.LiveClient; 26 | import org.bson.Document; 27 | 28 | public interface CollectorEvent { 29 | boolean execute(LiveClient client, Document document); 30 | } 31 | -------------------------------------------------------------------------------- /extension-collector/src/main/java/io/github/jwdeveloper/tiktok/extension/collector/api/LiveDataCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.collector.api; 24 | 25 | public interface LiveDataCollector 26 | { 27 | 28 | } -------------------------------------------------------------------------------- /extension-collector/src/main/java/io/github/jwdeveloper/tiktok/extension/collector/api/Storage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.collector.api; 24 | 25 | import org.bson.Document; 26 | 27 | public interface Storage { 28 | void connect(); 29 | 30 | void disconnect(); 31 | 32 | void insert(Document document); 33 | } 34 | -------------------------------------------------------------------------------- /extension-collector/src/main/java/io/github/jwdeveloper/tiktok/extension/collector/api/settings/CollectorListenerSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.collector.api.settings; 24 | 25 | import io.github.jwdeveloper.tiktok.extension.collector.api.CollectorEvent; 26 | import lombok.Data; 27 | import org.bson.Document; 28 | 29 | import java.util.Map; 30 | import java.util.function.Function; 31 | 32 | @Data 33 | public class CollectorListenerSettings { 34 | private Map extraFields; 35 | private CollectorEvent filter; 36 | } -------------------------------------------------------------------------------- /extension-collector/src/main/java/io/github/jwdeveloper/tiktok/extension/collector/api/settings/FileDataCollectorSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.collector.api.settings; 24 | 25 | import lombok.Data; 26 | 27 | import java.io.File; 28 | import java.util.function.*; 29 | 30 | @Data 31 | public class FileDataCollectorSettings { 32 | 33 | private File parentFile; 34 | private BiPredicate typeFilter = (dataType, dataTypeName) -> true; 35 | private Predicate userFilter = (tiktokUser) -> true; 36 | private boolean useFileLocks = false; 37 | private boolean appendUserName = false; 38 | } -------------------------------------------------------------------------------- /extension-collector/src/main/java/io/github/jwdeveloper/tiktok/extension/collector/api/settings/mongo/MongoDBConnectionStringBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.collector.api.settings.mongo; 24 | 25 | import lombok.Setter; 26 | import lombok.experimental.Accessors; 27 | 28 | @Setter 29 | @Accessors(chain = true) 30 | public class MongoDBConnectionStringBuilder { 31 | private String username; 32 | private String password; 33 | private String database; 34 | private String cluster; 35 | 36 | public String build() { 37 | return String.format("mongodb+srv://%s:%s@%s/%s?retryWrites=true&w=majority", 38 | username, password, cluster, database); 39 | } 40 | } -------------------------------------------------------------------------------- /extension-collector/src/main/java/io/github/jwdeveloper/tiktok/extension/collector/api/settings/mongo/MongoDataCollectorSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.collector.api.settings.mongo; 24 | 25 | import lombok.*; 26 | 27 | import java.util.function.Consumer; 28 | 29 | @Data 30 | public class MongoDataCollectorSettings { 31 | 32 | private String connectionUrl; 33 | 34 | private String databaseName = "tiktok"; 35 | 36 | private String collectionName = "data"; 37 | 38 | public void connectionBuilder(Consumer consumer) { 39 | var builder = new MongoDBConnectionStringBuilder(); 40 | consumer.accept(builder); 41 | connectionUrl = builder.build(); 42 | } 43 | } -------------------------------------------------------------------------------- /extension-recorder/README.md: -------------------------------------------------------------------------------- 1 | 2 | Records stream to flv file 3 | 4 | 5 | ```xml 6 | 7 | 8 | jitpack.io 9 | https://jitpack.io 10 | 11 | 12 | 13 | 14 | com.github.jwdeveloper.TikTok-Live-Java 15 | Client 16 | 1.1.0-Release 17 | compile 18 | 19 | 20 | com.github.jwdeveloper.TikTok-Live-Java 21 | extension-recorder 22 | 1.1.0-Release 23 | 24 | 25 | ``` 26 | 27 | 28 | Usage 29 | 30 | ```java 31 | 32 | public static void main(String[] args) { 33 | 34 | TikTokLive.newClient("bangbetmenygy") 35 | .configure(liveClientSettings -> 36 | { 37 | liveClientSettings.setPrintToConsole(true); 38 | }) 39 | .onError((liveClient, event) -> 40 | { 41 | event.getException().printStackTrace(); 42 | }) 43 | .addListener(TikTokLiveRecorder.use(recorderSettings -> 44 | { 45 | recorderSettings.setFfmpegPath("C:\\Users\\ja\\IdeaProjects\\TikTokLiveJava\\extension-recorder\\libs\\ffmpeg.exe"); 46 | recorderSettings.setOutputPath("C:\\Users\\ja\\IdeaProjects\\TikTokLiveJava\\extension-recorder\\out"); 47 | recorderSettings.setOutputFileName("test.flv"); 48 | })) 49 | .onEvent(TikTokLiveRecorderStartedEvent.class, (liveClient, event) -> 50 | { 51 | System.out.println(event.getDownloadData().getFullUrl()); 52 | }) 53 | .buildAndConnect(); 54 | 55 | } 56 | ``` -------------------------------------------------------------------------------- /extension-recorder/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | TikTokLiveJava 7 | io.github.jwdeveloper.tiktok 8 | 1.10.6-Release 9 | 10 | 4.0.0 11 | extension-recorder 12 | 13 | 14 | io.github.jwdeveloper.tiktok 15 | Client 16 | ${project.version} 17 | compile 18 | 19 | 20 | io.github.jwdeveloper.tiktok 21 | API 22 | ${project.version} 23 | compile 24 | 25 | 26 | 27 | 28 | 16 29 | 16 30 | UTF-8 31 | 32 | 33 | -------------------------------------------------------------------------------- /extension-recorder/src/main/java/io/github/jwdeveloper/tiktok/extension/recorder/TikTokLiveRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.recorder; 24 | 25 | import io.github.jwdeveloper.tiktok.extension.recorder.api.LiveRecorder; 26 | import io.github.jwdeveloper.tiktok.extension.recorder.impl.RecorderListener; 27 | import io.github.jwdeveloper.tiktok.extension.recorder.impl.data.RecorderSettings; 28 | import io.github.jwdeveloper.tiktok.live.LiveClient; 29 | 30 | import java.util.function.*; 31 | 32 | public class TikTokLiveRecorder 33 | { 34 | public static LiveRecorder use(BiConsumer consumer) 35 | { 36 | return new RecorderListener(consumer); 37 | } 38 | 39 | public static LiveRecorder use() 40 | { 41 | return use((x,y) ->{}); 42 | } 43 | } -------------------------------------------------------------------------------- /extension-recorder/src/main/java/io/github/jwdeveloper/tiktok/extension/recorder/api/LiveRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.recorder.api; 24 | 25 | public interface LiveRecorder { 26 | 27 | 28 | } -------------------------------------------------------------------------------- /extension-recorder/src/main/java/io/github/jwdeveloper/tiktok/extension/recorder/impl/data/DownloadData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.recorder.impl.data; 24 | 25 | import lombok.AllArgsConstructor; 26 | import lombok.Data; 27 | 28 | @Data 29 | @AllArgsConstructor 30 | public class DownloadData { 31 | 32 | private String downloadLiveUrl; 33 | 34 | private String sessionId; 35 | 36 | public String getFullUrl() { 37 | return downloadLiveUrl + (downloadLiveUrl.contains("?") ? "&" : "?") + "_webnoredir=1&_session_id=" + sessionId; 38 | } 39 | } -------------------------------------------------------------------------------- /extension-recorder/src/main/java/io/github/jwdeveloper/tiktok/extension/recorder/impl/enums/LiveFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.recorder.impl.enums; 24 | 25 | public enum LiveFormat 26 | { 27 | MP4 28 | } 29 | -------------------------------------------------------------------------------- /extension-recorder/src/main/java/io/github/jwdeveloper/tiktok/extension/recorder/impl/enums/LiveQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.recorder.impl.enums; 24 | 25 | public enum LiveQuality { 26 | origin, hd_60, ao, hd, sd, ld,uhd_60 27 | } 28 | -------------------------------------------------------------------------------- /extension-recorder/src/main/java/io/github/jwdeveloper/tiktok/extension/recorder/impl/event/TikTokLiveRecorderEndedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.recorder.impl.event; 24 | 25 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 26 | import io.github.jwdeveloper.tiktok.extension.recorder.impl.data.*; 27 | import lombok.*; 28 | 29 | @Getter 30 | public class TikTokLiveRecorderEndedEvent extends TikTokEvent { 31 | 32 | private final RecorderSettings settings; 33 | 34 | public TikTokLiveRecorderEndedEvent(RecorderSettings settings) { 35 | this.settings = settings; 36 | } 37 | } -------------------------------------------------------------------------------- /extension-recorder/src/main/java/io/github/jwdeveloper/tiktok/extension/recorder/impl/event/TikTokLiveRecorderStartedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok.extension.recorder.impl.event; 24 | 25 | import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent; 26 | import io.github.jwdeveloper.tiktok.extension.recorder.impl.data.*; 27 | import lombok.AllArgsConstructor; 28 | import lombok.Getter; 29 | import lombok.Setter; 30 | 31 | @AllArgsConstructor 32 | @Getter 33 | public class TikTokLiveRecorderStartedEvent extends TikTokEvent { 34 | private final DownloadData downloadData; 35 | private final RecorderSettings settings; 36 | 37 | @Setter boolean canceled; 38 | 39 | public TikTokLiveRecorderStartedEvent(DownloadData downloadData, RecorderSettings settings) { 40 | this.downloadData = downloadData; 41 | this.settings = settings; 42 | } 43 | } -------------------------------------------------------------------------------- /future.md: -------------------------------------------------------------------------------- 1 | Future plans: 2 | 3 | [ ] Publish project to Maven repository instead of JITPACK 4 | [ ] Dynamically generates readme.md when new version is released 5 | [ ] Covers all possible classes from Client module with unit test 6 | [ ] Add tests check to GitHub publish action 7 | [ ] Generates documentation based on API module and publish it with GitHub pages 8 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk16 3 | 4 | before_install: 5 | - echo "Before Install" 6 | - bash ensure-java-16 install 7 | - sdk install maven 3.9.8 8 | 9 | install: 10 | - echo "Install" 11 | - if ! bash ensure-java-16 use; then source ~/.sdkman/bin/sdkman-init.sh; fi 12 | - sdk use maven 3.9.8 13 | - java -version 14 | - mvn -v 15 | - mvn install -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner} ${email} 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /tools-readme/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | TikTokLiveJava 7 | io.github.jwdeveloper.tiktok 8 | 1.10.6-Release 9 | 10 | 4.0.0 11 | 12 | tools-readme 13 | 14 | 15 | jitpack.io 16 | https://jitpack.io 17 | 18 | 19 | 20 | 16 21 | 16 22 | UTF-8 23 | 24 | 25 | 26 | 27 | com.hubspot.jinjava 28 | jinjava 29 | 2.7.2 30 | 31 | 32 | commons-io 33 | commons-io 34 | 2.13.0 35 | compile 36 | 37 | 38 | org.reflections 39 | reflections 40 | 0.9.12 41 | compile 42 | 43 | 44 | io.github.jwdeveloper.tiktok 45 | Client 46 | ${project.version} 47 | compile 48 | 49 | 50 | -------------------------------------------------------------------------------- /tools-readme/readme.md: -------------------------------------------------------------------------------- 1 | Generates documentation from template 2 | that can be found under 3 | - `src/main/resources/readme-template.html` 4 | -------------------------------------------------------------------------------- /tools-readme/src/main/java/io/github/jwdeveloper/tiktok/ListenerExampleGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok; 24 | 25 | 26 | import java.util.regex.Pattern; 27 | 28 | public class ListenerExampleGenerator 29 | { 30 | public static void main(String[] arg) 31 | { 32 | var result = new ListenerExampleGenerator(); 33 | System.out.println(result); 34 | } 35 | 36 | 37 | public String run() 38 | { 39 | var content = FilesUtility.loadFileContent("C:\\Users\\ja\\IdeaProjects\\TikTokLiveJava\\Examples\\src\\main\\java\\io\\github\\jwdeveloper\\tiktok\\ListenerExample.java"); 40 | var p = "(.*?)"; 41 | var r = Pattern.compile(p, Pattern.DOTALL); 42 | var m = r.matcher(content); 43 | m.find(); 44 | return m.group(1); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tools-readme/src/main/java/io/github/jwdeveloper/tiktok/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok; 24 | 25 | 26 | import org.apache.commons.io.FileUtils; 27 | 28 | import java.io.File; 29 | import java.io.IOException; 30 | 31 | public class Main 32 | { 33 | public static void main(String[] args) throws IOException { 34 | var version = System.getenv("VERSION"); 35 | if (version == null || version.equals("")) { 36 | version = "[Replace with current version]"; 37 | } 38 | 39 | var inputStream = Main.class.getResourceAsStream("/readme-template.html"); 40 | var targetFile = new File("temp.file"); 41 | FileUtils.copyInputStreamToFile(inputStream, targetFile); 42 | 43 | var output = System.getProperty("user.dir"); 44 | 45 | 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tools-readme/src/main/java/io/github/jwdeveloper/tiktok/TemplateUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | package io.github.jwdeveloper.tiktok; 24 | 25 | import java.util.Map; 26 | 27 | public class TemplateUtility { 28 | public static String generateTemplate(String template, Map values) { 29 | for (var entry : values.entrySet()) { 30 | template = doReplacement(template, entry.getKey(), entry.getValue().toString()); 31 | } 32 | return template; 33 | } 34 | 35 | 36 | private static String doReplacement(String template, String keyword, String value) { 37 | var key = "(\\{\\{)" + keyword + "(}})"; 38 | return template.replaceAll(key, value); 39 | } 40 | 41 | 42 | } 43 | --------------------------------------------------------------------------------